OBJECT:Write a program to add two 16 bit hexadecimal numbers without carry. INSTRUMENT REQUIRED:8086 Microprocessor Trainer Kit. PROGRAM:
MEMORY LOCATION
MACHINE CODE
OPCODE
OPERAND
0206
BE0002
MOV
SI,0200H
0209
8B04
MOV
AX,[SI]
020B
46
INC
SI
020C
46
INC
SI
020D
8B1C
MOV
BX,[SI]
020F
03C3
ADD
AX,BX
0211
BF0402
MOV
DI,0204H
0214
8905
MOV
[DI],AX
0216
F4
HLT
DESCRIPTION:
To solve the given objective, we have taken two hexadecimal numbers in the memory locations of 0200H and 0202H and added them and stored the result in the memory location of 0204H. To solve the given objective, we have taken the following steps:
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.
Move the destination index (DI) pointer to point to the memory location where the result is to be stored.
Finally move the result from the AX register to the destination using DI 8. HLT to Halt or End the program.
INPUT VALUE
MEMORY LOCATION
VALUE
0200H
10
0201H
3A
0202H
1C
0203H
2B
0204H
00
0205H
00
OUTPUT
MEMORY LOCATION
VALUE
0204H
2C
0205H
65
RESULT: The addition of the two hexadecimal numbers 3A1CH and 2B1CH yielded 652CH
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.