Program to multiply two 2-digit BCD numbers in 8085 Microprocessor


Here we will see 8085 Microprocessor program, that will find the multiplication result of two BCD numbers.

Problem Statement 

Write an 8085 Assembly language program to find two BCD number multiplication. The numbers are stored at location 8000H and 8001H.

Discussion 

In this program the data are taken from 8000H and 8001H. The result is stored at location 8050H and 8051H.

As we know that 8085 has no multiply instruction so we have to use repetitive addition method. In this process after each addition we are adjusting the accumulator value to get decimal equivalent. When carry is present, we are incrementing the value of MS-Byte.  We can use INR instruction for incrementing, but here ADI 01H is used. The INR instruction does not affect the CY flag so we need ADI instruction.

Input

first input

Address
Data


8000
12
8001
20


second input

Address
Data


8000
27
8001
03


 

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
4E


MOV C,M
Store second operand to register C
F006
1E, 00


MVI E, 00H
Clear register E
F008
63


MOV H,E
Clear H register
F009
7B


MOV A,E
Clear A register
F00A
B9


CMP C
Compare C with A
F00B
CA, 23, F0


JZ DONE
When Z = 0, jump to DONE
F00E
80
LOOP
ADD B
Add B with A
F00F
27


DAA
Decimal Adjust
F010
57


MOV D,A
Store A to D
F011
D2, 19, F0


JNC NINC
Jump tp NINC
F014
7C


MOV A,H
Store H to A
F015
C6, 01


ADI 01H
Increase A by 1
F017
27


DAA
Decimal Adjust
F018
67


MOV H,A
Restore H from A
F019
7B
NINC
MOV A,E
Load E to A
F01A
C6, 01


ADI 01H
Increase A by 1
F01C
27


DAA
Decimal adjust
F01D
5F


MOV E,A
Restore E from A
F01E
B9


CMP C
Compare C with A
F01F
7A


MOV A,D
Load D to A
F020
C2, 0E, F0


JNZ LOOP
Jump to LOOP
F023
6F
DONE
MOV L,A
Load A to L
F024
22, 50, 80


SHLD 8050H
Store HL pair at location 8050 and 8051
F027
76


HLT
Terminate the program


Output

first output

Address
Data


8050
40
8051
02


second output

Address
Data


8050
81
8051
00


raja
Published on 09-Oct-2019 10:43:31
Advertisements