8085 Program to Multiply two 8 bits numbers


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 a 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 two8-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

LXIH,8000H
Load first operand address
F003
46

MOVB, M
Store first operand to B
F004
23

INX H
Increase HL pair
F005
AF

XRA A
Clear Accumulator  
F006
4F

MOVC, 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
DecreaseB register
F00D
C2,07, F0

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

LXIH,8050H
Load Destination address
F013
71

MOVM, C
Store C register content into memory
F014
23

INX H
Increase HL Pair
F015
77

MOVM, A
Store Acc content to memory
F016
76

HLT
Terminate the program

Output

Address
Data
.
.
.
.
.
.
8050
93
8051
D0
.
.
.
.
.
.

Updated on: 26-Jun-2020

791 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements