0% found this document useful (0 votes)
53 views4 pages

2.2 - Lab Manual 1 - Introduction MOV, ADD Instructions

The document provides instructions for setting up NASM, AFD and DOSBox to write, assemble, and run 8086 assembly language programs, including downloading required files, configuring the environment, and writing a sample addition program to test the setup. It also describes running the sample program and exploring the debugger interface, verifying opcodes and register values at each step.

Uploaded by

Iqra Azhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views4 pages

2.2 - Lab Manual 1 - Introduction MOV, ADD Instructions

The document provides instructions for setting up NASM, AFD and DOSBox to write, assemble, and run 8086 assembly language programs, including downloading required files, configuring the environment, and writing a sample addition program to test the setup. It also describes running the sample program and exploring the debugger interface, verifying opcodes and register values at each step.

Uploaded by

Iqra Azhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

COAL – Fall 2021

Lab Manual 1 - Introduction


Activity 1: Setup
Make a separate folder COAL and NASM in your machine for example “D:\COAL\NASM”. Visit the link
given below. Download and install NASM, AFD and DOSBOX, according to the instructions, in your NASM
folder.

http://wetolearn.blogspot.com/2013/09/setting-up-afd-nasm-and-dosbox-for-8086.html

After installations double click “DOSBox 0.74-2 Options.bat” file and at the end of the file paste following
lines:

MOUNT C D://COAL//NASM
C:
(We are mounting C drive to our folder where we have saved AFD and we will save our .asm file in this
directory)

You may follow links given below for Video Tutorial of Setup:

Tutorial part
1: https://drive.google.com/file/d/1N3lWL8hsN0ZbhF3tlNwCWWwjJ_eHQqk6/view?usp=sharing

Tutorial part 2: https://drive.google.com/file/d/10p8qyaOVOwF5lDighrMKE-uNYQX-


c3bL/view?usp=sharing

AFD: https://drive.google.com/file/d/1eXnD3JEwBelFiJT6iIk7gluudV2Fu_iX/view?usp=sharing

NASM: https://drive.google.com/file/d/1ZoeE2MxjNaK7DdJKCacYfAJyn006MI_F/view?usp=sharing

Dosbox: https://drive.google.com/file/d/1DnaDIk4RoGBFDP1y4Dr3q89xwM3gx1d1/view?usp=sharing
Activity 2: Running your First Program
Follow these step in order to run your first program:

1- Copy/paste following code in notepad


; this is a comment. Comment starts with semicolon
; this program adds three numbers in registers

[org 0x0100] ;we will see org directive later

mov ax, 5 ; AX = 5
mov bx, 10 ; BX = 10
add ax, bx ; AX = AX + BX
mov bx, 15 ; BX = 15
add ax, bx ; AX = AX + BX

mov ax, 0x4c00 ;terminate the program


int 0x21

2- Save this file as “ex01.asm” in your NASM folder e.g. “D:\COAL\NASM”:

3- Go to NASM installation directory ( e.g. “D:\COAL\NASM”). Double click nasmpath.bat (batch file)
and type following command there. (Your .asm file and nasm should be in one folder)

nasm ex01.asm -o ex01.com -l ex01.lst


4- Above command will assemble your code and create ex01.com and ex01.lst files. Open ex01.lst
file in notepad.
a. What is opcode of instruction “mov ax, someConstant”
b. Verify the above opcode everywhere the instruction has been used.
c. What does “B80500” mean?
d. Verify the opcode of instruction “mov bx, someConstant” throughout the machine code.
e. What is the offset of first instruction?
f. Why are offsets of second and third instructions 3 and 6?
g. What should be the size of ex01.com file?
h. Right click ex01.com and verify its size.

5- Open DOSBox (by double clicking dosbox.exe), following window will appear:

6- Write following command and press enter.


Afd ex01.com
(Your AFD.exe should be in same directory where we have installed everything)
7- Above command will open the debugger and load your ex01.com file in it.
a. What is the value of IP register? And what will be its effect?
b. Note the initial values of data registers
c. Press F1 and watch the values of data registers

Activity 3: Explore different functions available in debugger

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy