0% found this document useful (0 votes)
19 views7 pages

MPI Lab 1

The document provides an introduction to the EMU 8086 simulator, detailing its user-friendly interface and features for implementing and testing 8086 assembly programs. It outlines step-by-step instructions for using the simulator, including program creation, execution, and debugging techniques. Additionally, it includes exercises for users to practice writing and executing assembly programs while monitoring the status of flags.

Uploaded by

siddu.is.me
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views7 pages

MPI Lab 1

The document provides an introduction to the EMU 8086 simulator, detailing its user-friendly interface and features for implementing and testing 8086 assembly programs. It outlines step-by-step instructions for using the simulator, including program creation, execution, and debugging techniques. Additionally, it includes exercises for users to practice writing and executing assembly programs while monitoring the status of flags.

Uploaded by

siddu.is.me
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Experiment 1: Introduction to EMU 8086 Simulator

The purpose of the first experiment is to introduce the EMU 8086 simulator which is used to
implement and test 8086 assembly programs. EMU 8086 is a user-friendly tool with interactive and
easy to use interface. EMU 8086 also provides register viewer, memory viewer and allows for step
execution which will help in debugging the assembly programs.

Please find below the steps to use EMU 8086:

Step 1. Open EMU806 program by running the emu8086.exe at location (C:\emu8086\) or by double

clicking in the “emu8086” icon available on desktop or:


Step 2. After the previous step, a window as shown below will open. Click on “new” tab. (You can
check out some example programs by clicking on “code examples”) (please note from here on
unless until explicitly specified clicking refers to left click)

Step 3. After the previous step, a window as shown below will open. Select “COM template” (default
option). We use this option to write and execute simple 8086 programs. Then click on “ok”

Page 1
Step 4. Once you click “ok”, the following code editor window will open. Here “org 100h” statement
means that the program is starting at this “offset address” and hence IP (instruction Pointer) register
will be initialized with 0100h when you execute the program. “ret” indicates the end of execution of
the user program.

Step 5. Type the program that you want to execute in the space between “org 100h” and “ret”. The
window with an example program is shown below for reference. After the program is written, save

the program by clicking on “save” tab i.e. .

Page 2
Step 6. Save the program with .asm extension as shown below:

Step 7. To execute the program, click on “emulate” icon i.e. . After clicking, two windows
i.e. “emulator” window (which shows the emulated code, status of registers and the machine codes)
and “original source code” window will open as shown below:
Machine code Assembled code
Registers

Page 3
Step 8. To execute the program, you can click on “run” tab i.e. , which executes the
complete program and show the final status as shown below. Notice that the value of registers have
changed, the program has reached “ret”instruction and also a message saying that the program has
returned control to OS.

Step 9. To understand the behaviours of instructions or to debug large programs, you can execute the
program one instruction at a time. So you can reload the program by clicking on “reload” tab i.e.

and then do the step by step execution by clicking on “single step” tab i.e. .

After single “single step” is clicked, you will see the status as below (notice that the second instruction
is highlighted indicating that first instruction is executed and AL is loaded with “0F”):

Page 4
Click on and observe that the third instruction is highlighted (indicating the completion of
execution of second instruction i.e. BL is loaded with value of 05h) as shown below:

Click on and observe that the “ret” instruction is highlighted (indicating the completion of
execution of third instruction i.e. AL will have value which is equal to 0F+05 i.e. 14h) as shown
below:

If you click on again, the program will complete its execution. At this point you can see
the final outputs (Please note that you may have to click on “single step” couple more times to
return the control to OS, like it Step 8, however it is not needed) and the control is returned to the
OS (like in Step 8)

Page 5
Step 10. For future experiments you may have to check the status of the memory and or flag register.
The memory can be viewed by clicking on “view’ tab and selecting “memory” option. You can
check the flags (useful for future experiments) by clicking on “flags” tab at the bottom of the
emulator window.

Flags

The memory will be displayed as below:

A few important flags will be showed as below: (You can observe how the status of the flags,
specifically CF (Carry Flag) and AF (Auxiliary Carry Flag) change while executing the program using
single step option)

This concludes a brief demonstration of the EMU 8086 tool.


Page 6
Complete the following exercises as part of the first experiment.
Exercise 1.1:
(a) Write an assembly program which stores 8-bit numbers in AL and BL register and the ADD
contents of AL and BL

The program to be implemented is shown below:

(b) Execute the program by using single step execution and check the status of Carry Flag

(c) Please note and write down the following in your notebook.
1. The above program
2. Status of CF (carry flag) and AF (Auxiliary Carry Flag) before ADD AL, BL instruction
3. Status of CF (carry flag) and AF (Auxiliary Carry Flag) after ADD AL, BL instruction

Exercise 1.2:
(a) Write an assembly program which stores 16-bit numbers 124Fh in AX and 0F010h in BX
register respectively and the ADD contents of AX and BX

Please write the program on your own


(*Program will be displayed on the screen in the last half an hour of the lab)

(b) Execute the program by using single step execution and check the status of Carry Flag

(c) Please note and write down the following in your notebook.
1. The above program
2. Status of CF (carry flag) and AF (Auxiliary Carry Flag) before ADD AX, BX instruction
3. Status of CF (carry flag) and AF (Auxiliary Carry Flag) after ADD AX, BX instruction

Page 7

You might also like