mynumber1 db ?
mynumber2 db ?
mov ah,01h
int 21h
sub al, 30h <- ASCII to value
mov bl, 0Ah
mul bl <- multiply al with 10
mov mynumber1, al <- mynumber1 now stores the tens (i.e. if you entered 8 it's now 80)
mov ah,01h
int 21h
sub al, 30h <- ASCII to value, al now stores the ones
add mynumber1, al <- now your two-digit number is completely in mynumber1
Now repeat the same for mynumber2
. Then:
mov al, mynumber1
mov bl, mynumber2
mul bl
Now the product is in AX
. Proceed by converting the content of AX
back to BCD, if you really need to.
The following code will print a number with up to 4 digits stored in AX:
xor dx,dx
mov bx,03E8h
div bx
call printdig
mov ax,dx
xor dx,dx
mov bx,0064h
div bx
call printdig
mov ax,dx
xor dx,dx
mov bx,000Ah
div bx
call printdig
;remainder from last div still in dx
mov al,dl
call printdig
Note that you need the following helper function, which prints a single digit from al
:
printdig proc
push dx
mov dl,al
add dl,30h
mov ah,02h
int 21h
pop dx
ret
printdig endp