COM353 Lab1 Lab Sheet

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

COM353

Microprocessors Laboratory

Gediz University
Computer Engineering Department

LAB1:
Assembling, editing, linking, and executing Assembly code examples using
Emu8086

0 anian

]nzMy inteM[

Gediz University
COM353 Microprocessors Laboratory

NAME: __________________

STUDENT ID: ____________

DATE: __________

Time : 2 lab hours


Objective :
Learn

EMU8086 installation

EMU8086 environment

Learn how to:

Assemble instructions into the memory of 8086 using Emu8086

Use Emu8086 to execute instructions

Run opt-in programs in EMU8086

Write a complete assembly program.

Edit an existing source program.

Lab Outcomes :
Practice 8086 Emulator

Loading, verifying and saving machine code

Executing instructions and tracing programs

Part I: Introduction to 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. You can download the latest student version of EMU86 from the web page
www.emu8086.com. 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.

Gediz University
COM353 Microprocessors Laboratory

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.

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

Gediz University
COM353 Microprocessors Laboratory

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]

Part 2: Opt-in Examples in Emu8086


Look at Code Examples.
After opening one of the code samples, then press emulate, then run. Also try these :
a) add/subtract
b) palindrome
c) traffic lights
d) led test
e) stepper motor
f) thermometer

Part 3: Assemble and execute instructions in Emu8086


Step 1: Use emu8086 to make the calculations following
a)10100101b = ?
b) 1234h = ?
c) 39 = ? 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.

Gediz University
COM353 Microprocessors Laboratory

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

Gediz University
COM353 Microprocessors Laboratory

4. Please compare your results with the results base convertor produced. Is it same or not ?
Please explain clearly.

Step 3 : Initialize the internal registers of the 80x86 as follows:


(AX) = 0000H
(BX) = 0001H
(CX) = 0002H
(DX) = 0003H
(SI) = 0010H
(DI) = 0020H
(BP) = 0030H
(DS) = 0B60H [2]
Then , verify the initialization by displaying the new content of register. Please put a check if you
can verify it.

Part 4: Writing and Running Assembly Code in Emu8086


In this part, we are entering Assembly language world. Lets say hello

Part 5: Exercise Part


Exercise - 1

In this part, we will identify the x86 arithmetic instructions and examine a program which will
perform the following arithmetic operations:

Gediz University
COM353 Microprocessors Laboratory

Calculate :

(30 10 + 15 10 ) * ( 575 10 225 10 ) + 210

Procedure:
1. Choose New and specify COM template in emu8086.
2. Enter the following code to the editor:

3. Start emulation by clicking the emulate button on the toolbar. A new emulator window will
appear.
4. Single-step the program codes by pressing the single step button on the toolbar of the
emulator window.
5. Each time after pressing the single step button, check and record down the contents of AX
and BX registers in Table 1

Table 1

6. Using a calculator, calculate the answer for the above arithmetic operations

Is it the same as the final answer in the AX register?[3]


..

Gediz University
COM353 Microprocessors Laboratory

Exercise - 2

In this example, we will develop a program to perform the following arithmetic operations:

12 10 * ( 20010 225 10 ) + 127


Procedure:
1. Develop an assembly language program to perform the above arithmetic operations by only
using registers AX and BX (write the program in Table 1.2).
2. Write the program who does the calculation above into the assembler editor in EMU8086
3. Emulate the program by pressing the emulate button on the toolbar.
4. In the emulator window, single-step the program codes by pressing the single step button on
the toolbar.
5. Each time after single-stepping, observe and record down the contents of AX and BX registers
in Table 2.

Table 2

6. Using a calculator, calculate the answer for the above arithmetic operations: ..
Is it the same as the final answer in the AX register? .[3]

Part 5: Conclusion
Please express what you learn with this laboratory work with at most one paragraph.

Gediz University
COM353 Microprocessors Laboratory

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/experiment2Fall%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-RealModeProgramming-ASCII-String-Handling.html

You might also like