data segment
A dw 12
data ends
code segment
assume cs:code, ds:data
main proc far
start:
push ds
mov ax, 0
push ax
mov ax, data
mov ds, ax
mov bx, A
call sub1
ret
main endp
sub1 proc near
pushf
push ax
push si
push cx
mov cx, 0
mov si, 10
mov ax, bx
loop1:
div si
push ah
inc cx
test al, 0ffh
jnz next
loop2:
pop ah
add ah, 30h
mov dl, ah
mov ah, 2
int 21h
loop loop2
pop cx
pop si
pop ax
popf
ret
next:
and ah, 00h
jmp loop1
sub1 endp
code ends
end start
************************
运行时divide overflow错误,请指教