i have a problem with this code...will you please help me with this...the program goes that it will input the base then its power ..
for example:
base: 2
power: 3
result : 8
the base is multiply itself 3 times...
the problem with this one is that it goes to infinite looping in the multiply function ..i know that i'm using the right code but why is it doesn't get its perfect answer..
call clear_screen
call start
int 20h
clear_screen:
mov ax,03h
int 10h
ret
start:
lea dx, msga
mov ah, 9
int 21h
mov ah,1
int 21h
sub al,30h
push ax
lea dx, msgb
mov ah, 9
int 21h
mov ah,1
int 21h
sub al,30h
push ax
lea dx, msgd
mov ah, 9
int 21h
pop bx
pop ax
multiply:
mov cx,0
mov ah,0
mov bh,0
mul bx
inc cx
cmp cx,bx
jne multiply
call print_ax
jmp exit
print_ax:
cmp ax, 0
jne print_ax_r
push ax
mov al, '0'
mov ah, 0eh
int 10h
pop ax
ret
print_ax_r:
pusha
mov dx, 0
cmp ax, 0
je pn_done
mov bx, 10
div bx
call print_ax_r
mov ax, dx
add al, 30h
mov ah, 0eh
int 10h
jmp pn_done
pn_done:
popa
ret
exit: mov ax, 4c00h
int 21h
msga db "Enter base [1-9]: $"
msgb db 13,10,"Enter power [1-9]: $"
msgd db 13,10,"Result: $"