Professional Documents
Culture Documents
Programming of 8085: 6.6 Programs On Multiplication
Programming of 8085: 6.6 Programs On Multiplication
Programming of 8085: 6.6 Programs On Multiplication
Programming of 8085
6.6 PROGRAMS ON MULTIPLICATION
BARCOMA, ANDREW M.
BSEE – IV
Example 6.40. Write an ALP for 8085 to multiply two numbers using shift and add method. The two
numbers are in memory locations 2101 H and 2102 H. Store the result in 2103 H and 2104 H.
32(multiplicand) and 12(multiplier).
Main Program:
Label Mnemonics Operand Comments
LXI H, 2101 H ; Get H-L pair with 2101 H.
MOV E, M ; Get first number in E-register.
MVI D, 00 H ; Extend to 16 bits.
INX H ; Increment H-L pair.
MOV A, M ; Get the multiplier in accumulator.
LXI H, 0000 H ; Put 00 to H and L registers.
MVI B, 08 H ; Get count = 08.
MULT DAD H ; Multiplicand = 2 x Multiplicand...
RAL ; Rotate accumulator left to find if most significant bit
is 1.
JNC NXT ; if no carry jump to NXT.
DAD D ; Get Product = product + multiplicand.
NXT DCR B ; Decrement B.
JNZ MULT ; If not zero jump to MULT.
SHLD 2103 H ; Store the result in 2103 H and 2104 H.
HLT ; Stop processing.
Command Explanations:
Start the Process
32 is multiplied by
1 and result 32 is shifted
left by one digit to make it
32o.
Product of 32 and 12