8085 program to add 2-BCD numbers
Problem – Write a program to add 2-BCD numbers where starting address is 2000 and the numbers is stored at 2500 and 2501 memory addresses and store sum into 2502 and carry into 2503 memory address.
Example –

Algorithm –
- Load 00H in a register (for carry)
- Load content from memory into register pair
- Move content from L register to accumulator
- Add content of H register with accumulator
- Add 06H if sum is greater than 9 or Auxillary Carry is not zero
- If carry flag is not equal to 1, go to step 8
- Increment carry register by 1
- Store content of accumulator into memory
- Move content from carry register to accumulator
- Store content of accumulator into memory
- Stop
Program –
| Memory | Mnemonics | Operands | Comment |
|---|---|---|---|
| 2000 | MVI | C, 00H | [C] <- 00H, carry |
| 2002 | LHLD | [2500] | [H-L] <- [2500] |
| 2005 | MOV | A, L | [A] <- [L] |
| 2006 | ADD | H | [A] <- [A] + [H] |
| 2007 | DAA | Add 06 if sum > 9 or AC = 1 | |
| 2008 | JNC | 200C | Jump if no carry |
| 200B | INR | C | [C] <- [C] + 1 |
| 200C | STA | [2502] | [A] -> [2502], sum |
| 200F | MOV | A, C | [A] <- [C] |
| 2010 | STA | [2503] | [A] -> [2503], carry |
| 2013 | HLT | Stop |
Explanation – Registers A, C, H, L are used for general purpose
- MVI is used to move data immediately into any of registers (2 Byte)
- LHLD is used to load register pair direct using 16-bit address (3 Byte instruction)
- MOV is used to transfer the data from memory to accumulator (1 Byte)
- ADD is used to add accumulator with any of register (1 Byte instruction)
- STA is used to store data from accumulator into memory address (3 Byte instruction)
- DAA is used to check if sum > 9 or AC = 1 add 06 (1 Byte instruction)
- JNC is used jump if no carry to given memory location (3 Byte instruction)
- INR is used to increase given register by 1 (1 Byte instruction)
- HLT is used to halt the program
Recommended Posts:
- 8085 program to count total odd numbers in series of 10 numbers
- 8085 program to count total even numbers in series of 10 numbers
- 8085 program to add two 16 bit numbers
- 8085 program to add two 8 bit numbers
- 8085 program to add numbers in an array
- 8085 program to multiply two 16-bit numbers
- 8085 program to divide two 16 bit numbers
- 8085 program to swap two 8-bit numbers
- 8085 program to sum of two 8 bit numbers without carry
- 8085 program to multiply two 8 bit numbers
- 8085 program to divide two 8 bit numbers
- 8085 program to find the sum of first n natural numbers
- 8085 program to subtract two 16-bit numbers with or without borrow
- 8085 program to separate odd and even nos from a given list of numbers
- 8085 program to find the sum of series of even numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



