I'm working on a program which gets a number (for example, 42 ) then prints it to the screen using interrupt 21 with ah 2. My programs manages to split the number, but when I get a number like 60 my programs calls interrupt 0h because I'm dividing by 0
How can I overcome this?
This is the code:
PROC printNumber
push bp
push dx
push bx
push ax
mov bp, sp
mov ax, [bp + number]
mov dx, 0
mov bx, 10
splitNumber:
cmp ax, 0
jz exit
div bx
add dx, '0'
mov ah, 2
int 21h
jmp splitNumber
exit:
pop ax
pop bx
pop dx
pop bp
retn 2
ENDP printNumber
Thanks! :D