8085 Program to multiply two 8-bit numbers using shifting multiplicand

8085 is a Microprocessor which was developed by Intel in 1970s. All the instructions in this microprocessor are encoded in a single byte. Some of the instructions are followed by one or two bytes of data, which can be a memory address, an immediate operand or a port number.

In this post, we will write a program in 8085 to multiply two 8-bit numbers using shifting multiplicand.

Algorithm

Start
Read multiplier
Read multiplicand
Extend multiplicand to double(16-bit)
prod <- 0
count <- 8
Right shift multiplier
If CS == 0 go to 10
prod <- prod + multiplicand
multiplicand <- multiplicand x 2 (Left shift multiplicand)
count <- count - 1
If count != 0 go to 7
Store prod
Stop

Flow Chart

8085 Program to multiply two 8-bit numbers using shifting multiplicand flow chart

Program

      LHLD 2100H
      MOV A, L
      MOV E, H
      MVI D, 00H
      LXI H, 0000H
      MVI C, 08H
BACK: RAR
      JNC NEXT
      DAD D
NEXT: XCHG
      DCR C
      JNZ BACK
      SHLD 2102H
      RST-5

Example

2100H: 02
2101H: 03
2102H: 06  ->  Output

Check out our other 8085 programs

Let us know in the comments if you are having any questions regarding this microprocessor program.

And if you found this post helpful, then please help us by sharing this post with your friends. Thank You

Leave a Reply