Another problem :) when I do the division with 16-bit operand, then:
DX:AX = AX : r/m16 <-- 16bit(word) operand
the program crashes. This is the program:
stack SEGMENT PARA STACk
db ?
stack ENDS
data SEGMENT PARA PUBLIC
db ?
data ENDS
code SEGMENT PARA PUBLIC
ASSUME ss: stack, ds: data, cs: code
_start:
mov ax, data
mov ds, ax
mov ax, 10
mov dx, 2
div dx
;output number 10/2 = 5 + 48 = 53(Ascii code '5')
add ax, 48
mov dx, ax
mov ah, 02h
int 21h
mov ah, 04ch
mov al, 1
int 21h
code ENDS
END _start
From what I understand it happens due to an overflow, but where is the overflow here? also the result of the division is saved in DX and AX? What causes an overflow?