8085 program to multiply two 8 bit numbers

MicrocontrollerMicroprocessor8085

In this program we will see how to multiply two 8-bit numbers using 8085 microprocessor.

Problem Statement

Write 8085 Assembly language program to multiply two 8-bit numbers stored in memory location and store the 16-bit results into the memory.

Discussion

The 8085 has no multiplication operation. To get the result of multiplication, we should use the repetitive addition method.

After multiplying two 8-bit numbers it may generate 1-byte or 2-byte numbers, so we are using two registers to hold the result.

We are saving the data at location 8000H and 8001H. The result is storing at location 8050H and 8051H.

Input

Address
Data
.
.
.
.
.
.
8000
DC
8001
AC
.
.
.
.
.
.

Flow Diagram

Program

Address
HEX Codes
Labels
Mnemonics
Comments
F000
21, 00, 80

LXI H,8000H
Load first operand address
F003
46

MOV B, M
Store first operand to B
F004
23

INX H
Increase HL pair
F005
AF

XRA A
Clear accumulator
F006
4F

MOV C, A
Store 00H at register C
F007
86
LOOP
ADD M
Add memory element with Acc
F008
D2, 0C, F0

JNC SKIP
When Carry flag is 0, skip next task
F00B
0C

INR C
Increase C when carry is 1
F00C
05
SKIP
DCR B
Decrease B register
F00D
C2, 07, F0

JNZ LOOP
Jump to loop when Z flag is not 1
F010
21, 50, 80

LXI H,8050H
Load Destination address
F013
71

MOV M, C
Store C register content into memory
F014
23

INX H
Increase HL Pair
F015
77

MOV M, A
Store Acc content to memory
F016
76

HLT
Terminate the program

Output

Address
Data
.
.
.
.
.
.
8050
93
8051
D0
.
.
.
.
.
.
raja
Published on 17-Jan-2019 15:40:09
Advertisements