Program to Add two 8-bit numbers along without Carry

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

Flowchart/Algorithm

Program

Address Mnemonics Operand Opcode Comments
2000 LXI H, 300H 21 Load H-L pair with address 3000H.
2001     00  
2002     30  
2003 MOV A, M 7E Move the 1st operand from memory to reg. A.
2004 INX H 23 Increment H-L pair.
2005 MOV B, M 46 Move the 2nd operand from memory to reg. B.
2006 ADD B 80 Add B with A.
2007 INX H 23 Increment H-L pair.
2008 MOV M, A 77 Move the result from reg. A to memory.
2009 HLT   76 HALT

Output

Before Execution:

3000H:    04H

3001H:     02H

After Execution:

3002H:     06H

Program Explanation

  1. This program adds two operands stored in memory location 3000H and 3001H, without considering the carry produced (if any).
  2. Let us assume that the operands stored at memory location 3000H are 04H and 3001H is 02H.
  3. Initially, H-L pair is loaded with the address of first memory location.
  4. The first operand is moved to accumulator from memory location 3000H and H-L pair is incremented to point to next memory location.
  5. The second operand is moved to register B from memory location 3001H.
  6. The two operands are added and the result is stored in the accumulator.
  7. H-L pair is again incremented and the result is moved from the accumulator to memory location 3002H.

Leave a Comment

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