Assembly Lab
Assembly Lab
Assembly Lab
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
3
EMU8086 Source Editor
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
• “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
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
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