07-28-2004, 11:45 PM
I'm stuck
Awhile back I asked if there was a way to divide dx:ax by bx and get a double word anwer. (like FFFFFFFFh / Ah = 19999999h) and I got this peice of code.....
I was wondering if anyone knew how to do the same thing with the "idiv" (divide with sign) function. Thanks.
Awhile back I asked if there was a way to divide dx:ax by bx and get a double word anwer. (like FFFFFFFFh / Ah = 19999999h) and I got this peice of code.....
Code:
;*dx:ax/bx; dx:ax = answer, cx = remainder*
push ax ;save ax (lower word)
mov ax,dx ;higher word into ax so it can be divided
xor dx,dx ;dx = 0
div bx ;dx:ax/bx; ax = answer dx = remainder
mov cx,ax ;save higher word
pop ax ;get ax, the lower word
div bx ;dx:ax/bx again
xchg dx,cx ;extange;dx = higher word cx = remainder
I was wondering if anyone knew how to do the same thing with the "idiv" (divide with sign) function. Thanks.