Program to Add two 16-bit numbers along with Carry

Q. Write an 8085 program and draw a flowchart to add two 16-bit numbers along with considering the carry.(8085 Microprocessor Program)

Flowchart/Algorithm

Program

Address Mnemonics Operand Opcode Comments
2000 LHLD 300H 2A Load H-L pair with address 3000H.
2001   00  
2002   30  
2003 XCHG EB Exchange H-L pair with D-E pair
2004 LHLD 3002H 2A Load H-L pair with data from 3002 H
2005 02
2006 30
2007 MVI C, 00H 0E Move 0 to REG. C
2008 00
2009 DAD D 19 Add D-E pair with H-L pair
200A JNC  200EH D2  Jump to location 200E H if no carry
200B   0E  
200C 20
200D INR C 0C Increment C
200E SHLD 3004H 22 Store the result at location 3004 H
200F 04
2010 30
2011 MOV A, C 79 Move carry from C to A
2012 STA 3006H 32 Store the carry at location 3006 H
2013 06
2014 30
2015 HLT   76 HALT

Output

Before Execution:

3000H:    16H

3001H:     5AH

3002H:    9AH

3003H:     7CH

After Execution:

3004H:     B0H

3005H:     76H

3006H:     01H

Program Explanation

1 thought on “Program to Add two 16-bit numbers along with Carry”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.