0% found this document useful (0 votes)
63 views4 pages

03 Laboratory Exercise 1

The document discusses debug commands in DOS like C, H, I, M, S and Q. It provides examples of adding and subtracting hexadecimal numbers, comparing memory locations, moving data between memory locations, searching for strings, and quitting the debug session. The laboratory work asks the student to store and manipulate strings and hexadecimal values using the debug commands.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views4 pages

03 Laboratory Exercise 1

The document discusses debug commands in DOS like C, H, I, M, S and Q. It provides examples of adding and subtracting hexadecimal numbers, comparing memory locations, moving data between memory locations, searching for strings, and quitting the debug session. The laboratory work asks the student to store and manipulate strings and hexadecimal values using the debug commands.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

K0020

Laboratory Exercise
Debug Facility (Part 2)

OBJECTIVES:

At the end of the exercise, the students should be able to:

 familiarize with the different commands used in DOS debug;


 add and subtract two (2) hexadecimal numbers; and
 store, copy, and search strings;

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

-C 100 105 200

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

03 Laboratory Exercise 1 * Property of STI


Page 1 of 4
K0020

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

-M 100 105 110

moves bytes in the range DS:100-105 to location DS:110;

Here is a complete sample:

-E 100 “ABCD”
-D 100 103
-M 101 103 100
-D 100 103

The output will be:

19EB:0100 41 42 43 44 ABCD
19EB:0100 42 43 44 44 BCDD

Explanation:

-E 100 “ABCD” The string ABC is stored at location 100h.


-D 100 103 Memory is dumped to show the string. 100
represents the starting address while 103 represents
the ending address. This means that 101 refers to B
and 102 refers to C.

03 Laboratory Exercise 1 * Property of STI


Page 2 of 4
K0020

-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

-S 100 110 “ABCD”

searches for the string ABCD in the range DS:100-110;

Here is a complete sample:

-E 110 “ASSEMBLY”
-E 120 “ASSEMBLY”
-S 100 130 “ASSEMBLY”

The output will be:

19EB:0110
19EB:0120

Explanation:

-E 110 “ASSEMBLY” The string ASSEMBLY is stored at location 110h.


-E 120 “ASSEMBLY” The string ASSEMBLY is stored at location 120h.
-S 100 130 “ASSEMBLY” This searches for the string ASSEMBLY in the
range 100-130. 0110 and 0120 will be displayed
because the string can be found from both 110
and 120.

THE Q COMMAND

This command stands for the QUIT command. It quits DEBUG and returns to DOS.

03 Laboratory Exercise 1 * Property of STI


Page 3 of 4
K0020

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.

4. Inform your instructor once you’re done.

03 Laboratory Exercise 1 * Property of STI


Page 4 of 4

You might also like