Assembly Lab

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 13

Lab (6)

Introduction to
Assembly Language

1
Introduction

Objectives :
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.

2
Part I: Introduction to Emu8086

• “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.

3
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.

4
• 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

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

• “add/subtract‟
• “palindrome‟
• “traffic lights‟
• “led test‟
• “stepper motor‟
• “thermometer‟

6
Part 3: Assemble and execute instructions in
Emu8086

7
Use emu8086 to make the calculations
following

a) 10100101b = ?
b) 12h = ?
c) 39 = ? h
• Procedure:
– Choose “Math” and specify “Base Convertor” in
emu8086.
– Enter one of the numbers like in the Figure 3

8
Use EMU8086 to evaluate an expressions

• Evaluate : 0FFFFh *10h +0FFFFh


• Procedure:
1. Choose “Math” and specify “Multi Base Calculator” in
emu8086.
2. Enter the expression like in the Figure 4.

9
Part 4: Writing and Running Assembly Code
in Emu8086
• In this part, we are entering Assembly language
world. Let‟s say ,, hello‟

10
Part 5: Exercise Part

Calculate : (30 10 + 15 10 ) * ( 575 10 – 225 10 ) + 210


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

11
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

12
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? ………………………………….…”

13

You might also like