0% found this document useful (0 votes)
691 views

8086 Program To Add Two 16-Bit Numbers With or Without Carry

1. The program adds two 16-bit numbers stored at memory addresses 3000 and 3002, and stores the result in memory addresses 3004 and 3006, with the carry stored separately. 2. It loads the numbers into registers AX and BX, adds them, checks for carry, increments the carry register CX if needed, and stores the result back to memory. 3. Key instructions used are MOV to load and store data, ADD to perform the addition, JNC to check for carry, INC to increment the carry register, and HLT to stop the program.

Uploaded by

Sisay Deresa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
691 views

8086 Program To Add Two 16-Bit Numbers With or Without Carry

1. The program adds two 16-bit numbers stored at memory addresses 3000 and 3002, and stores the result in memory addresses 3004 and 3006, with the carry stored separately. 2. It loads the numbers into registers AX and BX, adds them, checks for carry, increments the carry register CX if needed, and stores the result back to memory. 3. Key instructions used are MOV to load and store data, ADD to perform the addition, JNC to check for carry, INC to increment the carry register, and HLT to stop the program.

Uploaded by

Sisay Deresa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

8086 program to add two 16-bit numbers with or

without carry
Problem – Write a program to add two 16-bit numbers where starting address is 2000 and the
numbers are at 3000 and 3002 memory address and store result into 3004 and 3006 memory
address.

Example –

Algorithm –
1. Load 0000H into CX register (for carry)
2. Load the data into AX(accumulator) from memory 3000
3. Load the data into BX register from memory 3002
4. Add BX with Accumulator AX
5. Jump if no carry
6. Increment CX by 1
7. Move data from AX(accumulator) to memory 3004
8. Move data from CX register to memory 3006
9. Stop
Program –
Explanation –
1. MOV is used to load and store data.
2. ADD is used to add two numbers where their one number is in accumulator or not.
3. JNC is a 2-bit command which is used to check whether the carry is generated from
accumulator or not.
4. INC is used to increment an register by 1.
5. HLT is used to stop the program.
6. AX is an accumulator which is used to load and store the data.
7. BX, CX are general purpose registers where BX is used for storing second number and
CX is used to store carry.

You might also like