LaboratoryNo2 - Debug CELOCIA & PEREZ
LaboratoryNo2 - Debug CELOCIA & PEREZ
Date Performed: JUNE 19, 2023 Date Submitted: JUNE 19, 2023
Instructor: ENGR. AMOR ELLARES Date: JUNE 19, 2023
1. Objective(s):
1. Perform the arithmetic operations based on the given number system using Debug.
2. Demonstrate the knowledge in data manipulation using Debug.
3. Discussion
Debug is software that is used as tool for testing executable programs. A feature of
DEBUG is that it
displays all program code and data in hexadecimal format and any data you enter into
memory must also be in hex form. It is found in any PC with the MS_DOS which make it
available to any user who has access to a machine with these characteristics.
Debug provides a set of commands that lets you perform a number of useful operations.
It is possible to visualize the values of the internal registers of the CPU using the DEBUG
program.
DEBUG Commands
G (Go)
Runs the program as a whole in memory and displays
the output Ex. –G
T (Trace)
Runs the program in single step mode. It also displays the new values of
the registers and the next instructions to be executed.
Ex. –T
The following commands are the operation used to program in assembly language.
it is used to get the sum of two registers or a register and a data and store
the result to the left most register.
Format: mul<source>
mul<register>
dec cl 🡪 c l = cl -1
4. Resources:
Desktop Computer
DOSbox application with Debug file
5. Procedure:
To begin working with DEBUG, type the following prompt in your computer.
C:\> debug
On the next line a dash will appear, this is the indicator of DEBUG at this
moment the instructions of DEBUG can be introduced using the following
command:
-r [enter key]
All the contents of the internal registers of the CPU are displayed; an alternative
of viewing them is to use the “r” command using as a parameter, the name of the
register whose value wants to be seen.
For example:
-rbx
BX 0000
This instruction will only display the content of the BX register and the DEBUG indicator
change from “-“ to “:”. When the prompt is like this, it is possible to change the value of
the register which was seen by typing the new value and [enter], or the old value can be
left by pressing [enter] without typing any other value.
Type the command “t” (trace) to execute each instruction of the program.
You see
that the value 0002H move to AX register. Type the command “t” (trace) again
and you see the second instruction is executed.
Type the command “t” (trace) to see the instruction add is executed
3. What is the purpose of NOP in your program in DEBUG? Try not to include the
NOP in your code, what happened?
Creating program on DEBUG, proceed debug type “-a 100” each input line starts with a
segment-offset address, and if you want to see the output type “- g”.
1. mov ax,
1234H mov
bh, 30 mov
bl, 12H mov
ax, bx mov
cl, 15
4. mov
ax,1234H
add al, ah
mov bx,
0034H
AX = 1246 BX= 0000 CX= 0000 DX= 0000
SS = 072F IP= 0108 ES= 072F SI= 0000
QUESTIONS:
3. What is the purpose of NOP in your program in DEBUG? Try to not include
the NOP in your code, what happened?
NOP, which stands for "No Operation" in assembly language, is an
instruction that does nothing and merely acts as a placeholder or a delay in
the program. NOP can serve a number of functions in DEBUG, including
aligning code, adding delays, and serving as a stand-in for upcoming
instructions. Since the NOP instruction comes after the addition instruction
in this particular situation, removing it from the code would not immediately
affect how the program runs.
6. Supplemental Activities:
A. Using DEBUG, determine the contents of AX, BX, CX, and DX after executing
every sequence of assembly language instruction. Write your answer on the
space provided.
Table 1:
Register AX BX CX DX
Code
MOV AX,
0420H 0420 0000 0000 0000
MOV BX,
1220H 0420 1220 0000 0000
MOV CX,
0002H 0420 1220 0002 0000
MUL CX
0840 1220 0002 0000
SUB AX, BX
F620 1220 0002 0000
ADD AL, BL
F620 1220 0002 0000
ADD CL, AH
F620 1220 00F8 0000
Table 2:
DIV DL
018D 0000 0000 0004
SUB BX, AX
018D 10A3 0000 0004
INC AL
018E 10A3 0000 0004
DEC DL
018E 10A3 0000 0003
7. Conclusion: