Professional Documents
Culture Documents
Engineering Laboratory
Experiment No. (1)
Electrical Engineering Department
Third Class 8086 Emulator
The purpose of the experiment is to know how the program work and
to know the codes and how to fix the errors
Exercises
1. Execute the following program and write the value of AX, BX, CX.
Memory Address
Mnemonics Code AX BX CX
CS:IP
1011:1110 MOV AX, 552BH MOV AX, 552BH 552B 0000 0000
0100:0008 MOV BX, 8922 MOV BX, 8922 0000 22DA 0000
0100:0028 MOV CX, AX MOV CX, AX 0000 0000 552B
HLT HLT
(Exp. 1-1)
Microprocessor
Engineering Laboratory
Experiment No. (1)
Electrical Engineering Department
Third Class 8086 Emulator
a)
Memory Address
Mnemonics Code Generated Errors
CS:IP
Move number directly to the
Mov AX, segment registers+ should be
0100:0010 MOV DS,B822 0B822h zero before the number and
write (H) in the end
Mov BX
0100:0003 MOV BL, 256 256 is > 8bit
,0100h
the register can’t move from 0
0100:0023 MOV CX, BL Mov CX ,BX bit to 16 bit the size should be
same
HLT HLT
b)
Memory Generated Errors
Address Mnemonics Code ماهو اخلطأ يف االيعاز اذا كان هناك خطأ
CS:IP
The number should be
MOV
0100:001C MOV AX,01011111 AX,01011111B contain (b) in the end to be
binary number
the register can’t move from
0100:001C MOV CH, AX MOV CX, AX 16 bit to 8 bit the size should
be same
0100:002C MOV DX, 80 MOV DX, 80
MOV ]200H[, Must be bows to signify
0100:003C MOV 200H, CX CX memory
HLT HLT
(Exp. 1-2)
Microprocessor
Engineering Laboratory
Experiment No. (1)
Electrical Engineering Department
Third Class 8086 Emulator
(Exp. 1-3)
Microprocessor
Engineering Laboratory
Experiment No. (1)
Electrical Engineering Department
Third Class 8086 Emulator
2. Object Code :
Object code refers to low level code which is understandable by machine. Object
code is generated from source code after going through compiler or other
translator. It is in executable machine code format. Object code contains a
sequence of machine understandable instructions to which Central Processing
Unit understands and executes. Object file contains object code. It is considered
as one more of machine code. Some object file examples are common object file
format (COFF), COM files and “.exe” files. It is the output of a compiler or other
translator. We can understand source code but we cannot understand object code
as it is not in plain text like source code rather it is in binary formats.
2. What is the difference between the physical and the logical address?
SOL:
(Exp. 1-4)
Microprocessor
Engineering Laboratory
Experiment No. (1)
Electrical Engineering Department
Third Class 8086 Emulator
Space.
Visibility The user can view the The user can never view
program.
Access The user uses the logical The user can not directly
physical address.
3. Calculate the physical memory location for each of the following cases?
a- The logical address D470H in the extra segment.
SOL:
PH = ES *10 + Offset= 52B9 *10 + D470H =06666
b- The logical address 2D90H in the stack segment.
SOL:
PH = SS *10 + Offset= 5D27*10+2D90H= 06666
c- MOV [BP], AL if BP=2C30H.
(Exp. 1-5)
Microprocessor
Engineering Laboratory
Experiment No. (1)
Electrical Engineering Department
Third Class 8086 Emulator
SOL:
PH = SS *10 +[BP] =5D27*10+ +2C39 = 5FEA6
Assume ES=52B9, SS=5D27, DS=E000, and CS=B3FF.
4. Which segment will be accessed for the instruction MOV [BX], AH.
SOL:
DS segment will be accessed.
5. Write the addressing modes of 8086 assembly language program
SOL:
Immediate addressing mode
Register addressing mode
Direct addressing mode
Register indirect addressing mode
Based addressing mode
Indexed addressing mode
Based-index addressing mode
Based indexed with displacement mode
(Exp. 1-6)