Home » Embedded Systems

Addition of two 8-bit BCD numbers | 8085 Microprocessor

Here, we are going to learn how to find addition of two 8-bit BCD numbers on 8085 microprocessor?
Submitted by Akash Kumar, on November 06, 2018

Problem statement:

To perform addition operation between two 8-bit BCD numbers using 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 BCD number with carry.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.
Learn PCB Designing: PCB DESIGNING TUTORIAL







Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.