0% found this document useful (0 votes)
50 views4 pages

Programming of 8085: 6.6 Programs On Multiplication

This program multiplies two numbers, 32 and 12, stored in memory locations 2101H and 2102H respectively, using a shift-and-add method. It loads the multiplicand into register E and multiplier into the accumulator A. It then shifts the multiplicand left by iterating through a loop that shifts if the most significant bit of the multiplier is 1 and adds the multiplicand to the product. After shifting and adding all bits, it stores the final product in registers 2103H and 2104H.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views4 pages

Programming of 8085: 6.6 Programs On Multiplication

This program multiplies two numbers, 32 and 12, stored in memory locations 2101H and 2102H respectively, using a shift-and-add method. It loads the multiplicand into register E and multiplier into the accumulator A. It then shifts the multiplicand left by iterating through a loop that shifts if the most significant bit of the multiplier is 1 and adds the multiplicand to the product. After shifting and adding all bits, it stores the final product in registers 2103H and 2104H.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

6

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

Where the values of 32 and


12 are given.

32 is multiplied by
1 and result 32 is shifted
left by one digit to make it
32o.

If yes proceed to the


PRODUCT, and if no go
JUMP to the COUNT.

64 and 320(32o) are added

Product of 32 and 12

You might also like