Skip to content

@nathanpc /div_neg.asm
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Dividing By Negative Numbers
; ********************
; * DIVIDE.ASM *
; ********************
.model small
.stack 512d
.data
a dw -9d
b db 2d
x db 0, '$'
.code
mov ax, @data
mov ds, ax
mov ax, a
mov bl, b
idiv bl
mov x, al
sub bx, bx
mov bl, x
mov ah, 02h
mov dl, bl
mov cl, 04h
shr dl, cl
add dl, 030h
cmp dl, 039h
jle value1
add dl, 07h
value1:
int 021h
mov dl, bl
and dl, 0Fh
add dl, 030h
cmp dl, 039h
jle value2
add dl, 07h
value2:
int 021h
mov ah, 04Ch
int 021h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.