Home »
Embedded Systems
Addition of Two 8-bit BCD Numbers in 8085 Microprocessor
In this tutorial, we will learn how to find the addition of two 8-bit BCD numbers in 8085 Microprocessor?
By Akash Kumar Last updated : May 13, 2023
Addition of Two 8-bit BCD Numbers in 8085 Microprocessor
Given two 8-bits numbers, we have to find their addition in 8085 Microprocessor.
Algorithm
- Load the two numbers in HL pair register.
- Store 00 on a register to calculate carry.
- Move the content of register H to accumulator.
- Add the content of accumulator with the content of register L.
- Check if the sum is greater than 09 then add 06 to result.
- If carry flag is equal to 0, goto step no 8 otherwise goto step no 7.
- Increment the value of carry by 1.
- Store the result in memory.
- Move the content from register to accumulator.
- Load the result in memory.
- Terminate the program.
Program
LHLD 2050
MVI C, 00
MOV A, H
ADD L
DAA
JNC **
INR C
** STA 3050
MOV A, C
STA 3051
HLT
Observation
INPUT:
2050:32
2051:77
OUTPUT:
3050:01
3051:09
Hence, we successfully added two 8-bits BCD numbers with carry.