Você está na página 1de 8

Activity No.

1
Debug
Course Code: CPE 005
Course Title: Computer Systems Organization with Assembly Language
Section: CPE42FA1
Name: Aeron Paul B. Abdon

Program: BsCpE
Date Performed: June 22,
2016
Date Submitted: June 22,
2016
Instructor:
Engr. Jonathan Taylar

1. Objective:
This activity aims to demonstrate how Debug can be used as an assembler and disassembler.
2. Intended Learning Outcomes (ILOs):
After completion of this activity the students should be able to:
2.1 Write a short assembly language sequence using Debug
2.2 Execute an assembler instruction in Debug
2.3 Examine the contents memory
3. Discussion :
The DEBUG program
To create a program in assembly options are to use an assembler or a debugger. The debugger
that comes with both Windows and DOS is debug.exe or DEBUG program.
DEBUG allows users to:
control and monitor execution of programs
interactively display, examine memory contents, and view registers and variables as they change.
alter and selectively load COM, EXE and other file types
access specific sectors, I/O ports and memory addresses
The Debug Commands
Debug commands are issued at command prompt, denoted by a hyphen (-), either as a single
letter, in uppercase or lowercase, or with a combination of parameter. Table 1.1 shows the summary of the
Debug commands. The ? is used to show the long name of each command.

Command
Program Creation and Debugging
A
G
R
P
T
U

Description
Assemble a program using instruction mnemonics
Execute the program currently in memory
Display the contents of register
Proceed past an instruction, procedure or loop
Trace a single instruction
Disassemble memory into assembler mnemonics

Memory Manipulation
C
D
E
F
M
S
Miscellaneous
H
Q
Input-Output
I
L
O
N
W

Compare one memory range with another


Dump (display) the contents of memory
Enter bytes into memory
Fill a memory range with a single value
Move bytes from one memory range to another
Search a memory range for specific values
Perform Hexadecimal addition and subtraction
Quit Debug and return to DOS
Input a byte from a port
Load data from disk
Send a byte to a port
Create a filename for use by the L and W commands
Write data from memory to disk
Table 1.1 Summary of the Debug Commands

Once a Debug command has been issued, the <Enter> key must be pressed so that the command
becomes effective.
4. Resources:
Computer with 32-bit Operating System
Debug.exe
5. Procedure:
Sample Problem A.
1. Open Debug.exe. Type the following at the DOS command prompt of your computer:
C:/>Debug <Enter>
2. Issue the command E when prompted by hyphen ( - ), to place bytes in the memory,
- E CS:100 Welcome to Assembly Programming!
3. Use the D command to view contents at CS:0100
-D 100
Describe how your data are stored in the memory of the computer. In what number system are they
stored?
In Hexadecimal form of number system.
Record all results in Table 1.2.
4. Display the contents of a range, type
-D 110 11F
Describe what happened to the display.
It only displays the second row.
5. Type Q to quit from Debug.
-Q
Sample Problem B.
1. Open Debug.exe.

2. Assemble the following program at address CS:0100. Type,


-A 100
138C:0100 mov ah,02
138C:0102 mov dl,49
138C:0104 int 21
138C:0106 mov dl,20
138C:0108 int 21
138C:010A mov dl,03
138C:010C int 21
138C:010E mov dl,20
138C:0110 int 21
138C:0112 mov dl,54
138C:0114 int 21
138C:0116 mov dl,49
138C:0118 int 21
138C:011A mov dl,50
138C:011C int 21
138C:011E int 20
138C:0120 [Enter]
3. Execute the program, type G at the debug prompt.
-G
4. Analyze the output and record all results in Table 1.3
5. Unassemble the program at address 100 to 11e, type
- U 100 11E
6. Observe the output and record all results in Table 1.4.
7. Edit the values of address 107 and 10f, type
-E CS:107
20.0A
-E CS:10F
20.0A
8. Unassemble the program at address 100
-U 100
Observe what happened to the output and record all results in Table 1.5.
What changes have you observed in the values of the memory?
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
9. Execute the program. Type,
-G
10. Save the program as Prog1.com, type
-N c:\CompOrg\Prog1.com <Enter>
Note: You should have had created CompOrg directory in C: drive.

11. Use H command to get the sum and difference of the addresses 0120 and 0100. Type,
H 0120 0100
0220 0020
12. Change the value of the CX register to 0020. Type,
-R CX <Enter>
CX 0000
:0020
13. Type W to write the file Prog1.com,
-W <Enter>
The computer should display Writing 00020 bytes.
14. Exit from Debug.
Sample Problem C..
1. Check the created Prog1.com file. Open the DOS command prompt. Click START-type CMD-press
ENTER.
2. Change directory to CompOrg.
c:\cd CompOrg> <Enter>
3. Execute Prog1.com.
c:\CompOrg>Prog1.com <Enter>
4. Record your output in Table 1.6.
Sample Problem D.
1. Open Debug.exe
2. Type ?
-?
Describe what happened after you typed ? at the prompt.
Displays a list of the Debug commands.
Which of the commands does not have a parameter?
The A,D,G,L,N,P,R,T,U and W.
Use Table 1.7 to write the long names of the commands and given the examples, give the function
of each of the commands used in this activity.

6. DATA ANALYSIS:
Table 1.2- Sample Problem A.3

Table 1.3- Output of Sample Problem B.3

Table 1.4 -Result of Sample Problem B.4

Table 1.5 -Result of Sample Problem B.6

Table 1.6- Output of Procedure C.4

Table 1.7- Debug Commands

PROBLEMS:
1. Make a DEBUG program that will display your name, program, and course, on the computer
screen. Save you program as Prog2.com.
Sample Output:
Juan dela Cruz
BS CpE
CPE005

8. Assessment (Rubric for Laboratory Performance):

Você também pode gostar