Statement: Write an assembly language program to multiply 2 BCD numbers
| Source Program: - MVI C, Multiplier : Load BCD multiplier
- MVI B, 00 : Initialize counter
- LXI H, 0000H : Result = 0000
- MVI E, multiplicand : Load multiplicand
- MVI D, 00H : Extend to 16-bits
- BACK: DAD D : Result Result + Multiplicand
- MOV A, L : Get the lower byte of the result
- ADI, 00H
- DAA : Adjust the lower byte of result to BCD.
- MOV L, A : Store the lower byte of result
- MOV A, H : Get the higher byte of the result
- ACI, 00H
- DAA : Adjust the higher byte of the result to BCD
- MOV H, A : Store the higher byte of result.
- MOV A, B : [Increment
- ADI 01H : counter
- DAA : adjust it to BCD and
- MOV B,A : store it]
- CMP C : Compare if count = multiplier
- JNZ BACK : if not equal repeat
- HLT : Stop
|
Related Programs (Click down)
Find the square of given number
Search a byte in a given number
Add two decimal numbers of 6 digit each
Add each element of array with the elements of another array