8086 program to add two 16 bit BCD numbers with carry
Problem – Write an assembly language program to add two 16 bit BCD numbers with carry in 8086 microprocessor.
Example –

Algorithm –
- Load the lower part of both the 16 bit BCD numbers in different locations.
- Add each number by adding first its lower part.
- Repeat the above step also by adding the carry if any.
- Make the lower part of register 00 and add the carry. This is done to obtain the carry.
- Display all the mumbers with highest part as carry, middle part as addition of the higher BCD 8 bits and lower part as the lower BCD 8 bits.
Program –
| Memory Address | Mnemonics | Comments |
|---|---|---|
| 0400 | MOV AL, [500] | AL ← [500] |
| 0404 | MOV BL, [502] | BL ← [502] |
| 0408 | ADD AL, BL | AL ← AL+BL |
| 040A | DAA | Decimal Adjust AL |
| 040B | MOV [600], AL | AL → [600] |
| 040F | MOV AL, [501[ | AL ← [501] |
| 0413 | MOV BL, 503 | BL ← [503] |
| 0417 | ADC AL, BL | AL ← AL+BL+CY |
| 0419 | DAA | Decimal Adjust AL |
| 041A | MOV [601], AL | AL → [601] |
| 041E | MOV AL, 00 | AL ← 00H |
| 0420 | ADC AL, AL | AL ← AL+AL+CY |
| 0422 | MOV [602], AL | AL → [602] |
| 0426 | HLT | Stop Execution |
Explanation –
- MOV AL, [500] moves the value stored at memory location 500 to AL register.
- MOV BL, [502] moves the value stored at memory location 500 to BL register.
- ADD AL, BL add the values in AL and BL registers.
- DAA adds 6 to the digit which is greater than 9.
- MOV [600], AL display the added value to memory location 600.
- MOV AL, [501] moves the value stored at memory location 501 to AL register.
- MOV BL, [503] moves the value stored at memory location 503 to BL register.
- ADC AL, BL add the values in AL and BL registers and carry (if any).
- MOV BL, [503] moves the value stored at memory location 503 to BL register.
- MOV [601], ALdisplay the added value to memory location 601.
- MOV AL, 00 moves 00 in AL register.
- ADC AL, AL add the values in AL and AL registers and carry (if any).
- MOV [602], AL display the added value to memory location 602.
- HLT stops execution.
Next related article – 8086 program to add two 8 bit BCD numbers
Recommended Posts:
- 8086 program to add two 16-bit numbers with or without carry
- 8085 program to sum of two 8 bit numbers without carry
- 8086 program to determine squares of numbers in an array of n numbers
- 8086 program to determine cubes of numbers in an array of n numbers
- 8086 program to add two 8 bit BCD numbers
- 8086 program to subtract two 8 bit BCD numbers
- 8086 program to multiply two 8 bit numbers
- 8086 program to subtract two 16 bit BCD numbers
- 8086 program to multiply two 16-bit numbers
- 8086 program to find sum of Even numbers in a given series
- 8086 program to find sum of odd numbers in a given series
- 8086 program to find average of n numbers
- 8086 program to subtract two 16-bit numbers with or without borrow
- 8086 program to find GCD of two numbers and print the GCD
- 8086 program to generate AP series of n 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.



