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

  1. Load the two numbers in HL pair register.
  2. Store 00 on a register to calculate carry.
  3. Move the content of register H to accumulator.
  4. Add the content of accumulator with the content of register L.
  5. Check if the sum is greater than 09 then add 06 to result.
  6. If carry flag is equal to 0, goto step no 8 otherwise goto step no 7.
  7. Increment the value of carry by 1.
  8. Store the result in memory.
  9. Move the content from register to accumulator.
  10. Load the result in memory.
  11. 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.





Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.