Department of: Subject of:
Computer Systems Engineering Computer Architecture and Assembly
Programming
Mehran University of Engineering Year 2nd Semester 3rd
&Technology
Batch 19CS Duration 03
Hours
Jamshoro
Practical#03
Setting environment of emulator: EMU8086
Sub Topics: Running environment, Number Systems and Expression Evaluation
Objective :
Learn
Working some 8086-based Microprocessors applications on an emulator
Intuitively, what kind of applications can be done a 8086-based microprocessor
Learn how to:
Run opt-in programs in EMU8086
Lab Outcomes :
Practice 8086 Emulator
Executing code examples
Using multi base calculator and base convertor
Part 1: Introduction to Emu8086
1- EMU8086
EMU8086 IDE
“An Integrated Development Environment (IDE) provides a convenient environment to
write a source file, assemble and link it to a -.COM or -.EXE file, and trace it in both
source file, and machine code. Emu86 is an educational IDE for assembly program
development. It is a Windows program, and will run by dragging an -.ASM, -
.OBJ, -.LST, -.EXE , or -.COM file into the emu86 shortcut icon. By this action, asm or lst files
will start the 8086 assembler source editor, while obj and exe files starts the disassembler and
debugger units.
1 1
EMU8086 Source Editor
The source editor of EMU86 is a special purpose editor which identifies the 8086
mnemonics, hexadecimal numbers and labels by different colors as seen in Figure 1.
1 2
Figure 1. a) EMU8086 Source Editor, and b) assembler status report windows.
The compile button on the taskbar starts assembling and linking of the source file. A report
window is opened after the assembling process is completed. Figure 2 shows the emulator
of 8086 which gets opened by clicking on emulate button
Figure 2: first.exe in the emulator window of EMU8086 debugging environment
Emu8086 environment contains templates to generate command and executable files.
Another benefit of Emul8086 is its emulation of a complete system, including the floppy
disk, memory, CPU, and I/O ports, which raises opportunity to write custom bios and boot
programs together with all other coding of a system. Moreover, its help is quite useful
even for a beginner of asm programming.”[1]
2- Opt-in Examples in Emu8086
Look at ‘Code Examples’. In this part, we will run some sample codes prewritten. The simple
forward operation is enough to make them work. After opening one of the code samples, then
press ‘emulate’, then ‘run’. Also try these:
a) ‘traffic lights’
e) ‘stepper motor’
3- Doing Calculations in Emu8086
Step 1: Use emu8086 to make the calculations following
“a) 11001011b = ?
b) 4321h = ?
c) 57 = ? h
Procedure:
1. Please, first, do whole calculations manually.
2. Choose “Math” and specify “Base Convertor” in emu8086.
3. Enter one of the numbers like in the Figure 3.
Figure 3: Base Convertor window
4. Please compare your results with the results “base convertor” produced.
Step 2 : Use EMU8086 to evaluate an expressions
Evaluate : 0FFFFh *10h +0FFFFh
Procedure:
1. Please, first , do whole calculations manually.
2. Choose “Math” and specify “Multi Base Calculator” in emu8086.
3. Enter the expression like in the Figure 4.
Figure 4: Multi Base Calculator window with a sample expression
4. Please compare your results with the results “base convertor” produced. Is it same or not?
Please explain clearly.
Part 4: Exercise Part
Exercise - 1:
In this part, explore other sample, show the results, and explain briefly and clearly what does
each program.
a) ‘add/subtract’
b) ‘palindrome’
c) ‘LED test’
d) ‘thermometer’
Exercise - 2 :
In this part, do the following calculations both using EMU8086 and manually. Are the results same
for two?
Note that the followings are signed integers
a) (456)8 = (? )2.
b) 045FH = (?)
c) A27DH = (?)8
d) 110010112 = (?)H
Exercise - 3 :
In this part, evaluate the following calculations both using EMU8086 and manually. Are the results
same for two?
a) 01111h *0FFFFh - 0FFFFh
b) 00FFh + 0FF00h – 0001h * 10ABh
c) ABCDh - 1FF2h
d) 0255h + FDABh
Part 5: Conclusion
Please express what you learn with this laboratory work with at most one paragraph.
RESOURCES :
1- “Assembling, editing, linking, and executing assembly language programs
using Emu8086 and MASM” , University of Jordan
Retrieved on September, 2013 from
“http://fetweb.ju.edu.jo/cpe/CoursesAndLabs/MicroprocessorLab/experiment2-
Fall%202009%202010.pdf ”
2- “TASM, EDIT, DEBUG and Emu8086 Assembler Tools”, Eastern
Mediterranean University.
Retrieved on September, 2013 from “http://cmpe.emu.edu.tr/courses/blgm323/lab1.pdf”
3- “Advanced Microprocessors Lab Sheet”,Multimedia University, 2012
Retrieved on September, 2013 from “http://findpdf.net/reader/Experiment-1-RealMode-
Programming-ASCII-String-Handling.html”
4- Honor Code,
http://www.davidson.edu/about/distinctly-davidson/honor-code