03 Laboratory Exercise 1
03 Laboratory Exercise 1
Laboratory Exercise
Debug Facility (Part 2)
OBJECTIVES:
SOFTWARE REQUIREMENT:
MS-DOS Debug
BASIC PRINCIPLES:
DEBUG Commands
THE C COMMAND
This command stands for the COMPARE command. It compares bytes between a specified range
with the same number of bytes at a target address.
Format:
C <starting address> <ending address> <target address>
Example:
The command
compares the bytes between DS:0100 and DS:0105 at DS:0200; this command
displays
1F6E:0100 74 00 1F6E:0200
1F6E:0101 15 C3 1F6E:0201
1F6E:0102 F6 0E 1F6E:0202
1F6E:0103 C7 1F 1F6E:0203
1F6E:0104 20 E8 1F6E:0204
1F6E:0105 75 D2 1F6E:0205
THE H COMMAND
This command stands for the HEXARITHMETIC command. It performs addition and subtraction on
two (2) hexadecimal numbers.
Format:
H <value1> <value2>
Example:
The command
-H 1A 10
adds and subtracts the hexadecimal values 1A and 10; this command displays
002A 000A
THE I COMMAND
This command stands for the INPUT command. It inputs a byte from a specified input/output port
and displays the value in hexadecimal.
Format:
I <port>
where <port> is a port number between 0 and FFFF
Example:
The command
-I 3F8
inputs a byte from port 3F8 (one of the COM1 ports); this command displays
00
THE M COMMAND
This command stands for the MOVE command. It copies a block of data from one memory location
to another.
Format:
M <starting address> <ending address> <target address>
Example:
The command
-E 100 “ABCD”
-D 100 103
-M 101 103 100
-D 100 103
19EB:0100 41 42 43 44 ABCD
19EB:0100 42 43 44 44 BCDD
Explanation:
-M 101 103 100 This moves (copies) the string stored in the range
101-103 to 100. This means that 100 now stores
BCD.
-D 100 103 Memory is dumped to show the string stored in the
range 100-103. BCDD will be displayed because
BCD is stored at 100 and D is stored at 103 which
was not affected by the move (copy) command.
THE S COMMAND
This command stands for the SEARCH command. It searches a range of addresses for a sequence
of one or more bytes.
Format:
S <starting address> <ending address> <list>
Example:
The command
-E 110 “ASSEMBLY”
-E 120 “ASSEMBLY”
-S 100 130 “ASSEMBLY”
19EB:0110
19EB:0120
Explanation:
THE Q COMMAND
This command stands for the QUIT command. It quits DEBUG and returns to DOS.
LABORATORY WORK
1. Store the string SUM in 105 and the string DIFFERENCE in 120. Use the E command for storing.
2. Get the sum and difference of hexadecimal numbers 04A6 and 01B3. Store the sum and difference as
strings in 205 and 210 respectively.
3. Combine the strings in 105 and 205 separated by a space. Combine the strings in 120 and 210 separated
by a space. Use the commands E, M and D.