I am working on windows 7 but I also try the codes on dosbox too
I wonder how can I divide double word by word in 16 bit mode
I use fasm. and making .com file
following code run correctly
but it just shutdown emulation window when dx is higher than 0
org 100h
mov dx, 0
mov ax, 10
mov bx, 10
div bx
add ax, '0'
int 29h
mov ax, 00h
int 16h
mov ax, 4c00h
int 21h
if I change the code like following..
it shutdown when dx is higher than 0xf
I don’t know why.
org 100h
mov dx, 0xf
mov ax, 10
div word [divby]
add ax, '0'
int 29h
mov ax, 00h
int 16h
mov ax, 4c00h
int 21h
divby:
dw 0x10
how can I divide double word by word without shut down bug?
The “shutdown” or divide overflow exception occurs, when dx:ax / bx can’t fit into ax (or when one divides by zero).
Assuming one has a “big” value in aa:bb:cc:dd, then dividing by bx one would have to perform the following steps: