Write a program in assembly language that asks the user for
Write a program in assembly language that asks the user for two integers and calculates their product. You can only use shift, add or sub instructions to calculate the multiplication (not the mult instruction)
Solution
.model small
.data
a db 09H
b db 02H
.code
mov ax, @data
mov ds, ax
mov ah, 0
mov al, a
mov bl, b
mul bl
mov ch, 04h
mov cl, 04h
mov bx, ax
l2: rol bx, cl
mov dl, bl
and dl, 0fH
cmp dl, 09
jbe l4
add dl, 07
l4: add dl, 30H
mov ah, 02
int 21H
dec ch
jnz l2
mov ah, 4cH
int 21H
end

