You are on page 1of 6

Microprocessor

Engineering Laboratory
Experiment No. (1)
Electrical Engineering Department
Third Class 8086 Emulator

Experiment No. (1)


8086 Emulator

‫ علي احمد يونس‬:‫اسم الطالب‬


‫ كهرباء‬:‫االختصاص‬
‫ الصباحيه‬:‫الـــــدراســــــة‬
Objective:

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

2. Execute the following programs and List the generated errors

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

Discussion (‫)اجب عن االسئلة التالية‬


1. a) What is the function of an assembler and compiler?
SOL:
An assembler is a program that converts assembly language into machine code. It
takes the basic commands and operations from assembly code and converts them
into binary code that can be recognized by a specific type of processor. Assemblers
are similar to compilers in that they produce executable code.

b) What is the object code? What is the source code?


SOL:
1. Source Code :Source code refers to high level code or assembly code which
is generated by human/programmer. Source code is easy to read and modify. It is
written by programmer by using any High Level Language or Intermediate
language which is human-readable. Source code contains comments that
programmer puts for better understanding. Source code is provided to language
translator which converts it into machine understandable code which is called
machine code or object code. Computer cannot understand direct source code,
computer understands machine code and executes it. It is considered as
fundamental component of computer. In simple we can say source code is a set
of instructions/commands and statements which is written by a programmer by
using a computer programming language like C, C++, Java, Python, Assembly
language etc. So statements written in any programming language is termed as
source code.

(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:

DIFFERENCE LOGICAL ADDRESS PHYSICAL ADDRESS

Basic It is the virtual address The physical address is a

generated by CPU location in a memory unit.

Address Set of all logical addresses Set of all physical addresses

Space generated by CPU in mapped to the corresponding

reference to a program is logical addresses is referred

referred as Logical Address as Physical Address.

(Exp. 1-4)
Microprocessor
Engineering Laboratory
Experiment No. (1)
Electrical Engineering Department
Third Class 8086 Emulator

DIFFERENCE LOGICAL ADDRESS PHYSICAL ADDRESS

Space.

Visibility The user can view the The user can never view

logical address of a physical address of program

program.

Access The user uses the logical The user can not directly

address to access the access physical address.

physical address.

Generation The Logical Address is Physical Address is Computed

generated by the CPU by MMU

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

6. Name Five 16-bit members of 80x86 Family architecture.


SOL:
 AX accumulator register
 BX base address register
 CX count register
 DX data register
 IP instruction pointer

(Exp. 1-6)

You might also like