Assembly Language Lab2
Assembly Language Lab2
Assembly Language Lab2
OBJECTIVE
In this lab, an introduction of Emu8086 will be given. Also, the Hello World Program will be explained to
make students understand how programs are written in Emu8086 using Assembly Language.
TIME REQUIRED : 3 hrs
PROGRAMMING LANGUAGE : Assembly Language
SOFTWARE REQUIRED : Emulator 8086, DOS, Debug
HARDWARE REQUIRED : Core i5 in Computer Labs, MDA – Win8086
INTRODUCTION
Emu8086 is a program that compiles the source code (assembly language) and executes it. You can watch
registers, flags and memory while your program executes. Arithmetic & Logical Unit (ALU) shows the
internal work of the central processor unit (CPU). Emulator runs programs on a Virtual PC; this completely
blocks your program from accessing real hardware, such as hard-drives and memory, 8086 machine code is
fully compatible with all next generations of Intel's microprocessors.
WHERE TO START?
• Start Emu8086 by selecting its icon from the start menu, or by running Emu8086.exe.
• Select "Samples" from "File" menu.
• Click [Compile and Emulate] button (or press F5 hot key).
• Click [Single Step] button (or press F8 hot key) and watch how the code is being executed.
• Try opening other samples, all samples are heavily commented, so it's a great learning tool.
DIRECTIVES
ORG 100h is a compiler directive (it tells compiler how to handle the source code). This directive is very
important when you work with variables. It says to compiler that the executable file will be loaded at the offset
of 100h (256 bytes), so compiler should calculate the correct address for all variables when it replaces the
variable names with their offsets. Directives are never converted to any real machine code.
Why executable file is loaded at offset of 100h? Operating system keeps some data about the program in the
first 256 bytes of the CS (code segment), such as command line parameters etc. Offset is used to get the offset
address of the variable in register specified
MOV INSTRUCTION
• Copies the second operand (source) to the first operand (destination).
• The source operand can be an immediate value, general-purpose register or memory location.
• The destination register can be a general-purpose register, or memory location.
• Both operands must be the same size, which can be a byte or a word.
RESOURCES:
Download: https://download.cnet.com/Emu8086-Microprocessor-Emulator/3000-2069_4-10392690.html
https://www.youtube.com/watch?v=vlSjuq5BoG0
https://www.tutorialspoint.com/assembly_programming/assembly_introduction.htm