Write a program in 8086 assembly language that multiplies two single digit ASCII numbers. You must first convert these ASCII numbers to equivalent binary. The result of the multiplication must be converted to unpacked decimal number. This resultant unpacked binary coded decimal (BCD) number should have its units digit in AL register and tens digit in AX register.
Multiplication and Division
The instructions for multiplication and division are mul and div. Both only operate on the accumulator register (eax) and use the data register (edx) as an overflow. The part of the registers affected are determined by the size of the operand. The following diagram demonstrates how the accumulator and the data registers fit together when being used by the instructions
The instructions for multiplication and division are mul and div. Both only operate on the accumulator register (eax) and use the data register (edx) as an overflow. The part of the registers affected are determined by the size of the operand. The following diagram demonstrates how the accumulator and the data registers fit together when being used by the instructions
Therefore, to get expected results, it is recommended that you set edx to zero before calling mul or div. For example:
TestProc proc
mov eax, 10
xor edx, edx ; set edx to zero
mul 10
div 10
ret
TestProc endp
Write a program in 8086 assembly language that multiplies two single digit ASCII numbers. You must first convert these ASCII numbers to equivalent binary. The result of the multiplication must be converted to unpacked decimal number. This resultant unpacked binary coded decimal (BCD) number should have its units digit in AL register and tens digit in AX register.
Reviewed by enakta13
on
November 30, 2012
Rating: