02-ICS 3203-Lab2-Assembly Language Programing
02-ICS 3203-Lab2-Assembly Language Programing
PROGRAMMING
Objectives :
i. To learn EMU8086 installation and familiarize with EMU8086
environment
ii. To 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. 24
1
Part I: Introduction to Emu8086
2
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.
3
EMU8086 Report Window
• 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
4
Part 2: Opt-in Examples in Emu8086
5
Part 3: Assemble and execute instructions in Emu8086
• Procedure:
1. Choose “Math” and
specify “Multi Base
Calculator” in
emu8086.
Figure 4.
2. Enter the expression
like in the Figure 4.
7
Part 4: Writing and Running Assembly
Code in Emu8086
• In this part, we are entering Assembly language world.
• Let’s say “Hello, World”
8
Part 4: Writing and Running Assembly Code in Emu8086
• Write the following assembly language program in Emu8086
9
Part 4: Writing and Running Assembly Code in Emu8086
Exercise - 1
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
Part 5: Exercise Part
Exercise - 1
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.
Table 1
5. Each time after
pressing the “single step”
button, check and record
down the contents of AX
and BX registers in Table
1 12
Part 5: Exercise Part
Exercise - 2
Procedure:
13
Part 5: Exercise Part
Exercise - 2
Procedure:
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? ………………………………….…”
14