PROGRAM NO.2
OBJECT: Write a program to add two 16 bit hexadecimal numbers with carry.
INSTRUMENT REQUIRED: 8086 Microprocessor Trainer Kit.
PROGRAM:
MEMORY LOCATION | MACHINE CODE | OPCODE | OPERAND |
0208 | B1 00 | MOV | CL,00H |
020A | BE 00 02 | MOV | SI,0200H |
020D | 8B 04 | MOV | AX,[SI] |
020F | 46 | INC | SI |
0210 | 46 | INC | SI |
0211 | 8B 1C | MOV | BX,[SI] |
0213 | 03 C3 | ADD | AX,BX |
0215 | 73 02 | JNC L1 | |
0217 | FE C1 | INC | CL |
0219 | BF 04 02 | L1 : MOV | DI,0204H |
021C | 89 05 | MOV | [DI],AX |
021E | 47 | INC | DI |
021F | 47 | INC | DI |
0220 | 89 0D | MOV | [DI],CL |
0222 | F4 | HLT |
DESCRIPTION:
To solve the given objective, we have taken two hexadecimal numbers in the memory locations of 0200H and 0203H and added them and stored the result in the memory location of 0204H, we have also stored the carry in the memory location 0206H
To solve the given objective, we have taken the following steps:
- Initialize the counter register CL to 0.
- Move the source index register (SI) pointer to the location of the first number.
- Store the first number in the AX register using SI.
- Double increment the SI pointer to point to the memory location of the second number.
- Store the second number in the BX register using SI.
- Now apply ADD operation to add the numbers in the registers AX and BX and store the result in AX.
- Jump instruction is used that increments the carry counter if there is no carry else increments the carry counter.
- Move the destination index (DI) pointer to point to the memory location where the result is to be stored.
- Move the result from the AX register to the destination using DI.
- Finally increment the DI to point to the location to store the carry bit and move the carry bit to the destination before halting.
INPUT VALUE:
MEMORY LOCATION | VALUE |
0200H | FF |
0201H | FF |
0202H | FF |
0203H | FF |
0204H | 00 |
0205H | 00 |
0206H | 00 |
0207H | 00 |
OUTPUT:
MEMORY LOCATION | VALUE |
0204H | FE |
0205H | FF |
0206H | 01 |
0207H | 00 or Return Garbej Value |
RESULT:The addition of the two hexadecimal numbers FFFFh and FFFFh yields FFFEh as the sum and 0001 as the carry.
COMMENTS:
1. MOV SI,0200H: 16 bit data can be moved using immediate addressing . 0200 is moved to source index.
2. ADD AX,BX: Contents in the accumulator and the base register are added.
3. INC SI: The content of a specified 8-bit or 16-bit register or memory location(s) is incremented by one by this instruction.
4. HLT: This instruction stops program execution. The processor stops fetching and executing instructions.
FLOWCHART:

Most Important Question for Exam
General purpose register
Arithmatic operation
Instruction Pointer
Code Segment
Deta Segment
ES:Extra Segment
Data without on the output
Coprocessor is interfaced in MIN mode
NMI
Odd bank memory
All the above
Signed numbers go out of their range
0018H
All x86 Processor
No
Clock
Trapb
An Interrupt that can be turned off by the programmer
The Interrupt is Masked or not
Set Interrupt Mask.
Because 8085 Processor has 8 bit ALU.
LIFO
RST0-7
RST7.5 is a raising edge-trigging interrupt.
RST6.5 & RST5.5
RST4.5
B & C
B & C
Sequential
None of the above
Related Link
- 8086 Instruction Hex Code
- Write a program to two add 16 bit Hexadecimal numbers without carry.
- Write a program to two add 16 bit Hexadecimal numbers with carry.
- Write a program to find the greatest number from an array of 10 numbers.
- Write a program to calculate the factorial of a number.
- Write a program to multiply two 16-bit numbers result should be greater than 16 bit.
- Write a program to input 5 numbers and arrange them in descending order.
- Write a program to convert the string data it’s Two’s complement form.
- Write a program to read 8 bit data from Port B. Complement this data & send it back to Port A of
- Write a program to move a block of data from one memory location to another. Input Value
- Write a program to find Gray code equivalent of a Binary number using Lookup Table.
- Microprocessor 8086 Video Play List