Lab Supplement 1 Debug Assembly Language
Lab Supplement 1 Debug Assembly Language
Assembly Language
Lab Assignment - Questions
1. Write an Assembly command to add two numbers, 3 and
8, and save the result into Register BX. (show the screen
shot of your complete code and results.)
2. Write an Assembly command using two registers AX
and BX that adds 5 and 7 and saves the result into BX.
(show the screen shot of your complete code and
results.)
3. (student will need to do some research for this question)
Write an Assembly program to display “Hello
World”, compile it, save it to the disk and run it from the
DOS prompt. (show the screen shot of your complete
code and results.)
Check List
The first step in using debug is to check if you are using
an operating system that is 32bits or 64bits.
32 bit operating systems still include debug and 64bit
operating systems no longer support debug.
To work around this we will download a program called
DOS Box which is free and easy to use for our debugging.
Lets Begin!!!
Download DOS Box from www.dosbox.com and then
install it.
8086 files have already been pre-installed, these files will
allow us to use DOS Box on our 64bit Windows 7
operating systems.
Once installed go ahead and click the DOSBox icon to
start it up.
Let’s start writing Assembly code
DOSBox start up window
First we need to tell DOSBox where our 8086 folder that
contains our microprocessing debug files.
Second we enter the following to direct DOSBox to get
them. You will notice that DOSBox has this line already
Z:\>…from here we enter the following.
mount c c:\8086 (we must first mount the c drive then point to
the folder where 8086 files are at) then hit enter
Next enter
c: (to navigate to our c drive) then type the next
debug (now we are ready to start our assembly commands
What your screen should look like
Debug Tutorial
Once your set up in debug type in ? After the -.
-? (this will show all of the debug command list)
W- Writes the data in memory to the disk. The name given the file is the
name entered with the n (name) command. The file size is given by
setting the BX:CX register to the number of bytes to be saved.
?- Display a help screen on some versions of debug.
Tutorial – Example 1
For our first example we are going to add two numbers
and save them into register AX. Type the following
mov ax,2 (moves the value 2 into register ax) hit enter.
add ax,2 (adds value 2 to what is already in register ax) hit
enter. Then hit enter again to get the – line. Then type
r ( this will show us all the registers AX, BX, CX etc.) next type
t ( this will trace the values in the register AX)
t (again type this and you should notice a new value in AX).