In this program, we will write an 8085 Program to Multiply Two 8-bit Numbers in the 8085 microprocessor with a program flow chart and explanation of the program.
8085 Program to Multiply Two 8-bit Numbers
Multiply two 8-bit numbers stored in memory locations D000H and D001H. Store the result in memory locations E000H and E001H.
Explanation of Program
Consider that a byte is present at the memory location D000 H and a second byte is present at memory location D001 H.
We have to multiply the bytes present at the above two memory locations.
We will multiply the numbers using the successive addition method.
In the successive addition method, one number is accepted and another number is taken as a counter. The first number is added with itself, till the counter decrements to zero.
The result is stored at memory locations E000 H and E001 H.
For example: D000 H = 12 H, D001 H=10 H
Result = 12H+ 12H+ 12H+ 12H+ 12H + 12H + 12H +12H + 12H+ 12H
Result = 0120 H
E000 H 20 H, E001 H= 01 H
Flow Chart of Program
Assembly Language Program
|LDA D000H||A = first number||A = 12 H|
|MOV E, A||E = first number||E = 12 H|
|MVI D, 00H||D = 00 H||D = 00 H|
|LDA D001H||A = second number||A = 10 H|
|MOV C, A||Initialize counter||C = 10 H|
|LXI H, 0000H||Result = 0||H = 00 H and L = 00H|
|BACK:||DAD D||Result = Result + first number||HL = HL + DE|
|DCR C||decrement counter||C = C – 1|
|JNZ BACK||If counter ≠ 0, repeat|
|SHLD E000H||Store result||E000H = 20H |
E001H = 01 H
|HLT||Terminate program execution||Stop|