 Write an 8085 program to add two 8-bit decimal numbers which sum equals to a 16-bit decimal number - ChromeTechny
Home » Write an 8085 program to add two 8-bit decimal numbers which sum equals to a 16-bit decimal number

# Write an 8085 program to add two 8-bit decimal numbers which sum equals to a 16-bit decimal number In the previous program, we saw how we can add two 8-bit hexadecimal numbers which output a 16-bit hexadecimal number.

In this program, we are going to use the same logic but instead of using a hexadecimal number, we are going to use decimal numbers.

The whole program is going to remain the same but there will be two added instructions. Moving on, in this program, we are going to use immediate addressing mode.

The first thing that we’ll do is use two successive memory locations to store the values that we are going to use, and we will require more two memory locations to store the result.
So, like the previous program, we are going to use 2000H – 2003H memory location.

Input:

Let the first 8-bit decimal number be 82D, and the second 8-bit decimal number be 97D, we are going to store these two numbers in memory location 2000H and 2001H.
And then we are going to store the result in 2002H and 2003H.

Program:
LXI H,2000H
MVI C,00
MOV A,M
INX H
ADD M
DAA
JNC Label
INR C
Label STA 2002
MOV A,C
STA 2003
HLT

Programming Details
Memory Location OPCODE Operand Label Hex Code
2004 LXI H, 2000H 21H
2005 00H
2006 20H
2007 MVI C,00 OEH
2008 00H
2009 MOV A,M 7EH
200A INX H 23H
200B ADD M 23H
200C DAA 27H
200D JNC Label D2H
200E 11H
200F 20H
2010 INR C 0CH
2011 STA 2003 32H
2011 02H
2012 20H
2013 MOV A,C 79H
2014 STA 2003 32H
2015 03H
2016 20H
2017 HLT 76H

#### About the author #### Ayan

Hi there! this is Ayan. I am a part-time blogger, my blog is https://dreamtodeff.com/, on this site, I mostly focus on WWE, Tech news, and Programming

#### FREE Newsletters Subscription

Get Interesting stuffs everyday in your mail, with a chance to win Rs. 10,000 every month by participating FREE Giveaway.