Program to add two 16-bit numbers without Carry

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



Address Mnemonics Operand Opcode Comments
2000 LHLD 3000H 2A Load H-L pair with 1st operand from 3000H.
2001 00 Lower-order of 3000H.
2002 30 Higher-order of 3000H.
2003 XCHG EB Exchange H-L pair with D-E pair.
2004 LHLD 3002H 2A Load H-L pair with 2nd operand from 3002H.
2005 02 Lower-order of 3002H.
2006 30 Higher-order of 3002H.
2007 DAD D 19 Add D-E pair with H-L pair.
2008 SHLD 3004H 22 Store the result at address 3004H.
2009 04 Lower-order of 3004H.
200A 30 Higher-order of 3004H.
200B HLT 76 Halt.


Before Execution:

3000H: 02H

3001H: 04H

3002H: 04H

3003H: 03H

After Execution:

3004H: 06H

3005H: 07H

Program Explanation

  1. This program adds two 16-bit operands stored in memory locations 3000H-3001H and 3002H-3003H, without considering the carry produced (if any).
  2. Let us assume that the operands stored at memory locations 3000H-3001H is 02H-04H and 3002H-3003H is 04H-03H.
  3. The H-L pair is loaded with the first 16-bit operand 0204H from memory locations 3000H- 3001H.
  4. Then, the first 16-bit operand is moved to D-E pair.
  5. The second 16-bit operand 0403H is loaded to H-L pair from memory locations 3002H- 3003H.
  6. The two operands are added and the result is stored in H-L pair.
  7. The result is stored from H-L pair to memory locations 3004H-3005H.

Leave a Comment

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