Documente Academic
Documente Profesional
Documente Cultură
Laboratory Exercise 2
Objective:
To introduce System commands using DEBUG programming utility (at command
prompt using PC).
Description:
DEBUG is a program included in the MS-DOS and PC-DOS operating systems that
allows the programmer to monitor a program’s execution closely for debugging
purposes. Specifically, it can be used to examine and alter the contents of memory, to
enter and run programs, and to stop programs at certain points in order to check or even
change data. Student will learn
How to enter and exit DEBUG,
How to assemble and unassembled a code
How to observe machine code
How to examine and alter the contents of registers and memory
Click the DOSBox icon, it will open a command window with a prompt Z:\>
Consider that the executable file “Debug.exe” is stored in the folder LAB in drive D
i.e., “D:\LAB\”. To access the file write the following command on Z:\> prompt
C:\ >
NOTE:
DEBUG is not case-sensitive.
It is assumed in the above instruction that DEBUG program is on the drive C
After enter key pressed, the DEBUG prompt “-“ will appear on the following
line.
To quit the DEBUG, type Q at the DEBUG prompt and enter
Q <return>
C:\>
System Commands:
The system commands can be divided into the following groups according to their
functions.
Memory Management Commands.
Assembler Commands.
Program Execution Commands.
Note:
Hexadecimal numerical system is used throughout the experiments
(unless otherwise specified).
The suffix ‘H’ can be omitted.
Assembler Commands
The following letters stands for,
A Assemble a program.
U Disassemble a program
Figure 2.2 shows the Disassemble command with start address, end addresses, and machine
code.
Activity- 1:
Do the following using Memory management commands and capture each screen using print
screen option.
- Display the memory contents starting from memory location 0100h
- Display the memory contents of first 10 bytes starting from memory location 0100h
- Fill the memory location starting from 0200h with your name and 3-digit Roll #
- Note the last offset (memory) value of the last digit of your roll #
- Move the block of memory where you filled your name and Roll # to the memory
location starting from 0400h
- Compare the two memory blocks (one starting from 0100h & the other from 0400h)
- Edit 2018-CS- to the memory block starting from 0400h before your Roll #
- Compare the two memory blocks (one starting from 0100h & the other from 0400h)
- Calculate the sum and difference of 75 and 34 using H command
Activity- 2:
Assemble and Unassemble the following code and fill the following table .
Logical Address Opcode Assembly code Comments
MOV AX, 0200H ;
ADD AX, BX ;
Activity- 3:
Give answers to the following questions after unassemble the code:
Why the values 0200H and 0400H are written as 0002 and 0004, in the opcode, respectively?
Write the number of bytes and the value of IP register taken by each instruction.