?? debug.html
字號:
<td><-- set up a break point at 107A:0102</td>
</tr>
</table>
<p>At this point the program will stop, display all registers and the current instruction.</p>
<a name="hex"><h3>Hex:</h3>
<p>This can be very useful. It subtracts and adds two hexadecimal values:</p>
<table>
<tr>
<td colspan="2">-h 2 1</td>
</tr>
<tr>
<td>0003 0001</td>
<td><-- 2h + 1+ = 3h and 2h - 1h = 1h</td>
</tr>
</table>
<p>This is very useful for calculating a programs length, as you will see later.</p>
<a name="input"><h3>Input:</h3>
<p>This is one of the more advanced commands, and I decided not to talk about it too much
for now. It will read a byte of data from any of your computers I/O ports (keyboard,
mouse, printer, etc).<p>
<p>-i 3FD<br>
60<br>
-</p>
<p>Your data may be different.<br>
In case you want to know, 3FD is Com port 1, also known as First Asynchronous Adapter.</p>
<a name="load"><h3>Load:</h3>
<p>This command has 2 formats. It can be used to load the filename specified with the
name command (n), or it can load a specific sector.</p>
<p>-n c:\command.com<br>
-l</p>
<p>This will load command.com into debug. When a valid program is loaded all registers will
be set up and ready to execute the program.<br>
The other method is a bit more complicated, but potential also more usefull. The syntax is</p>
<blockquote>
<p>L <address> <drive letter/> <sector> <amount to load><br>
-l 100 2 10 20</p>
</blockquote>
<p>This will load starting at offset 0100 from drive C (0 = A, 1 = B, 2 = C, etc), sector
10h for 20h sectors. This can be useful for recovering files you deleted.</p>
<a name="move"><h3>Move:</h3>
<p>Move takes a byte from the starting address and moves it to the destination address.
This is very good to temporary move data into a free area, than manipulate it without
having to worry about affecting the original program. It is especially useful if
used in conjunction with the r command to which I will get later. Lets try an example:</p>
<table>
<tr>
<td>-a</td>
<td><-- enter our original program so we have something</td>
</tr>
<tr>
<td>107A:0100 MOV AH,02</td>
<td>to work with</td>
</tr>
<tr>
<td colspan="2">107A:0102 MOV DL,41</td>
</tr>
<tr>
<td colspan="2">107A:0104 INT 21</td>
</tr>
<tr>
<td colspan="2">107A:0106 INT 20</td>
</tr>
<tr>
<td>-m 107A:0100 L 8 107B:0100</td>
<td><-- more 8 bytes starting from 107A:0100 into 107B:0100</td>
</tr>
<tr>
<td>-e 107B:0103</td>
<td><-- edit 107B:0103</td>
</tr>
<tr>
<td>107B:0103 41.42</td>
<td><-- and change it 42 (B)</td>
</tr>
<tr>
<td>-d 107A:0100 L 8</td>
<td><-- make sure it worked</td>
</tr>
<tr>
<td>107A:0100 B4 02 B2 41 CD 21 CD 20</td>
<td>...A.!.</td>
</tr>
<tr>
<td colspan="2">-d 107B:0100 L 8</td>
</tr>
<tr>
<td>107A:0100 B4 02 B2 42 CD 21 CD 20</td>
<td>...B.!.</td>
</tr>
<tr>
<td>-m 107B:0100 L 8 107A:0100</td>
<td><-- restore the original program since we like the changes.</td>
</tr>
</table>
<a name="name"><h3>Name:</h3>
<p>This will set debug up with a filename to use for I/O commands. You have to include
the file extension, and you may use addition commands:</p>
<p>-n c:\command.com</p>
<a name="output"><h3>Output:</h3>
<p>Exactly what you think it is. Output sends stuff to an I/O port. If you have an
external modem with those cool lights on it, you can test this out. Find out what port
your modem is on and use the corresponding hex number below:</p>
<p>Com 1 = 3F8 - 3FF (3DF for mine)<br>
Com 2 = 2F8 - 2FF<br>
Com 3 = ??? - ??? (if someone knows, please let me know)</p>
<p>Now turn on the DTA (Data Terminal Ready) bit by sending 01h to it:</p>
<tabel>
<tr>
<td>-o XXX 1</td>
<td><-- XXX is the com port in hex<td>
</tr>
</table>
<p>As soon as you hit enter, take a look at your modem, you should see a light light up.
You can have even more fun with the output command. Say someone put one of those BIOS
passwords on "your" computer. Usually you'd have to take out the battery to get rid of
it, but not anymore:</p>
<p>MI/AWARD BIOS<br>
-o 70 17<br>
-o 71 17</p>
<p>QPHOENIX BIOS<br>
-o 70 FF<br>
-o 71 17</p>
<p>QGENERIC<br>
-o 70 2E<br>
-o 71 FF</p>
<p>These commands will clear the BIOS memory, thus disabling the password.</p>
<a name="proceed"><h3>Proceed:</h3>
<p>Proceeds in the execution of a program, usually used together withy Trace, which I
will cover later. Like the go command, you can specify an address from which to start</p>
<p>using =address<br>
-p 2</p>
<p>Debug will respond with the registers and the current command to be executed.</p>
<a name="quite"><h3>Quite:</h3>
<p>This has got to be the most advanced feature of debug, it exits debug!</p>
<p>-q</p>
<a name="register"><h3>Register:</h3>
<p>This command can be used to display the current value of all registers, or to manually
set them. This is very useful for writing files as you will see later on.</p>
<p>-r AX<br>
AX: 011B<br>
:5<br>
-</p>
<a name="search"><h3>Search:</h3>
<p>Another very useful command. It is used to find the occurrence of a specific byte, or
series of bytes in a segment. The data to search for can by either characters, or a
hex value. Hex values are entered with a space or comma in between them, and characters
are enclosed with quotes (single or double). You can also search for hex and characters
with the same string:</p>
<table>
<tr>
<td>-n c:\command.com</td>
<td><-- load command.com so we have some data to search in</td>
</tr>
<tr>
<td colspan="2">-l</td>
</tr>
<tr>
<td>-s 0 l 0 "MS-DOS"</td>
<td><-- search entire memory block for "MS-DOS"</td>
</tr>
<tr>
<td>10A3:39E9</td>
<td><-- found the string in 10A3:39E9</td>
</tr>
</table>
<p>NOTE: the search is case sensitive!</p>
<a name="trace"><h3>Trace:</h3>
<p>This is a truly great feature of debug. It will trace through a program one instruction
at a time, displaying the instruction and registers after each. Like the go command
you can specify where to start executing from, and for how long.</p>
<table>
<tr>
<td>-a</td>
<td><-- yes, this thing again</td>
</tr>
<tr>
<td colspan="2">107A:0100 MOV AH,02</td>
</tr>
<tr>
<td colspan="2">107A:0102 MOV DL,41</td>
</tr>
<tr>
<td colspan="2">107A:0104 INT 21</td>
</tr>
<tr>
<td colspan="2">107A:0106 INT 20</td>
</tr>
<tr>
<td colspan="2">-t =0100 8</td>
</tr>
</table>
<p>If you leave out the amount of instructions that you want to trace, you can use the
proceed (p) to continue the execution as long as you want.</p>
<a name="unassemble"><h3>Unassemble:</h3>
<p>Unassembles a block of code. Great for debugging (and cracking)</p>
<table>
<tr>
<td>-u 100 L 8</td>
<td><-- unassembles 8 bytes starting at offset 100</td>
</tr>
<tr>
<td>107A:0100 MOV AH,02</td>
<td><-- debut's response</td>
</tr>
<tr>
<td colspan="2">107A:0102 MOV DL,41</td>
</tr>
<tr>
<td colspan="2">107A:0104 INT 21</td>
</tr>
<tr>
<td colspan="2">107A:0106 INT 20</td>
</tr>
</table>
<a name="write"><h3>Write:</h3>
<p>This command works very similar to Load. It also has 2 ways it can operate: using name,
and by specifying an exact location. Refer to back to Load for more information.</p>
<p>NOTE: The register CX must be set the file size in order to write!<br>
NOTE: Write will not write .EXE or .HEX files.</p>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -