Professional Documents
Culture Documents
or System
Experiment No. 1
DOS Debug Command
Objective:
To introduce the "DEBUG” program that comes with MS-DOS and Windows operating systems. This program is a basic tool to write, edit
and execute assembly language programs.
Introduction:
DEBUG program which is supplied with both DOS and Windows, is the perfect tool for writing short programs and getting acquainted with the Intel
8086 microprocessor. It displays the contents of memory and lets you view registers and variables as they change. You can use DEBUG to test
assembler instructions, try out new programming ideas, or to carefully step through your program. You can step through the program one line at a
time (called tracing), making it easier to find logic errors.
Debug Commands:
The following table shows a list of some commonly used DEBUG commands.
Invoking Debug:
To invoke the DEBUG program, a user opens command promote window and enters the following:
COMMANDS IN DEBUG
W, the WRITE command. The write command is used to save instructions onto a disk. Its format is:
-W
L, the LOAD command. The load command performs the opposite function of Write command. It loads from disk into memory
starting at the specified address. Its syntax is:
-L
FLAG REGISTERS
The complete set of possible flag mnemonics in Debug (order from left to right) are as follows:
Set Clear
OV = Overflow NV = No Overflow
DN = Direction Down UP = Direction Up
EI = Interrupts Enabled DI = Interrupts Disabled
NG = Sign Flag negative PL = Sign Flag Positive
ZR = Zero NZ = Not Zero
AC = Auxiliary Carry NA = No Auxiliary Carry
PO = Odd Parity PE = Even Parity
CY = Carry NC = No Carry
Procedure:
DEBUG Environment
1. Type DEBUG at the command prompt of DOS then press ENTER key.
2. Command: R
A. You will see a dash “-“ prompt that signifies DEBUG environment. Type R/r on this prompt then ENTER key. Illustrate the output:
B. Type the following commands. Write the contents or observation on the space provided:
REGISTER COMMAND CONTENTS/OBSERVATION
IP -R IP
CX -R CX
AX -R AX
DX -R DH
C. Write the appropriate command to modify the contents of the following registers.
REGISTER NEW CONTENTS COMMAND
AX 0001
CX 0021
IP 0100
3. Command: A
Assemble the given program at the starting offset address 100h. Type A 100 then press ENTER key. Encode the program written
below:
CS:0100 MOV AX,1
MOV BX,2
MOV CX,3
ADD AX,BX
ADD AX,CX
INT 3
4. Command: U
A. Write the command that will unassemble the program in number 3:
Command: __________________________________________
5. Command: G
A. Execute the program in number 3. Type the given command
Command:
B. What are the contents of the following registers?
AX BX CX
6. Command: T
A. Reset the values of AX, BX and CX and set value of IP to 0100.
B. Execute program given in number 3 using trace command.
C. Type T or t at the DEBUG prompt, then press ENTER key. Repeat this step until all instructions are executed.
D. What are the contents of the following registers after executing each instruction?
INSTRUCTION AX BX CX
MOV AX,1
MOV BX,2
MOV CX,3
ADD AX,BX
ADD AX,CX
7. Command: D
A. Illustrate or describe the output after executing the following D commands:
COMMAND OUTPUT
D 100 10F
D CS:110 120
8. Command: F
A. Determine the contents of the following blocks of memory, after executing the F commands. You may use the D command to
display the contents:
COMMAND BLOCK OF MEMORY DATA CONTENTS
- F 100 10F FF 100 – 10F
B. Fill the following blocks of memory with the specified data. Write the appropriate command.
BLOCK OF MEMORY DATA COMMAND
100 - 110 00
9. Command: E
A. Enter the data ‘John Snith’ at starting address 100h:
Command: ______________________________________
B. Modify the data ‘John Snith’ to ‘John Smith’ (ASCII code of m=6D)
Command: ______________________________________
10. Command: N, W, L
A. Assemble the given program at starting address 100h. Write the command on the space provided.
Command: ____________________________________
CS:0100 MOV CX,05
CS:0103 MOV BX,0200
CS:0106 MOV AL,0
CS:0108 ADD AL,[BX]
CS:010A INC BX
CS:010B DEC CX
CS:010C JNZ 0108
CS:010E MOV [0205],AL
CS:0111 INT 3
B. Name the file ”LAB1.com” and save it in drive C. Set the value of CX with the total number of bytes of the program and set BX to 0
before saving. Write the commands for naming and saving the file.
Command (Naming): ____________________________
Command (Saving): _____________________________
Note: Check the file in drive C.
C. Exit from DEBUG and load the saved file (LAB1.com) by typing DEBUG LAB1.com from the DOS prompt. Use Unassemble command;
do you see the program code LAB1.com? ________