EXP 2 Addition of Two Hexadecimal Numbers
EXP 2 Addition of Two Hexadecimal Numbers
02:
Addition of two HEXADECIMAL numbers in the 8086 microprocessor using MDA-8086 microprocessor
kit.
Objectives:
To add two numbers in MDA-8086 microprocessor kit,
we will do the following tasks in our machine:
Store 1234H in AX register,
Store 5678H in BX register
Add the contents of AX and BX register
Store the result in AX register
Procedure:
1. Open emu-8086 in your pc, and write the below codes
MOV AX,1234H
MOV BX,5678H
ADD AX,BX
2. Click the Emulate button and Find the equivalent machine code of the above assembly statements.
You will find the machine codes there. The codes will look like below,
Physical address of memory (in Hex) Machine Codes (in Hex) Equivalent assembly code
01000 B8
01001 34
MOV AX,1234H
01002 12
01003 BB
01004 78 MOV BX,5678H
01005 56
01006 03 ADD AX,BX
01007 C3
4. Press the button. You will see the "segment" "offset" and "data" part on the LCD.
5. Press the button to navigate between segment and offset. Press and button to
increment and decrement segment or offset.
6. Press the button if your desired segment and offset is set; then fill the memory location with data
by pressing the Data Keys (0,1,2......E,F)
7. Once button is pressed usually you can just use and button and Data Keys
(0,1,2......E,F) to update the content of the consecutive memory locations.
8. Now fill up the memory locations with the above machine codes from the table. (follow steps 4-7)
9. After inputting all of the machine codes , press button once, see the register contents by pressing
. The AX register should contain "1234H" ,but BX should not contain "5678H" still now, because only
first instruction [ MOV AX, 1234H] has been executed. Again press button to execute the next
instruction [MOV BX,5678H] and check register contents by pressing button. You will now see the BX
register holding 5678H. Again press button to execute the next instruction [ADD AX,BX] and check
register contents by pressing button. You will now see the AX register containing the result of addition
68AC in hex. The previous content of AX=1234H has been erased and filled up by the result AX=AX+BX or,
AX=1234h+5678h=68ACh