中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-21 05:34
47,812 topics / 349,917 posts / today 0 new / 48,270 members
DOS学习入门 & 精彩文章 (教学室) » [Original] Detailed Explanation of dr-debug Usage
Printable Version  5,245 / 8
Floor1 wolfwood Posted 2003-02-14 00:00
初级用户 Posts 14 Credits 158
Detailed Explanation of debug

First of all, I would like to recommend using DR-DEBUG that comes with DR-DOS7. It supports instructions up to Pentium pro, is powerful, and supports macros. The most convenient thing is that you can use the Enter key to replace the previous u/d/p/t instruction, which is convenient for viewing and debugging.

The following is the translation of its help:

Assemble, convert the input assembly language into machine code
A (example: Acs:100)

Set breakpoints for debugging
B (example: B100 2 al=80)

Compare the contents of two segments of memory
Compare C range address (example: C200 20d 500)

Display the specified memory data
Dump D (example: Dcs:500 L 10)

Edit memory data
Enter E (example: Eds:500 "Hello ")

Fill memory
Fill F range data (example: F100 13f "Test ")

Run the program from the specified point
Go G (example: Gcs:4bb0)

Calculate
Hex H (example: H10e 01)

Input from I/O port
Input I port (example: I3f2)

Load the content of a file or a specified logical sector
Load L (ex: L0Cff 3 09 10)

Move (copy) the content of memory
Move M range address (example: Mcs:200 220 cs:400)

Specify the operation file name
Name N filename (example: Ntest.com)

Output to I/O port
Output O port value (example: O3ff 10)

Step through (skip int/rep/call, etc.)
Proceed P (example: P=ds:3fff)

Quit debug
Quit Q

Change or display registers
Register R (example: Rax 1000)

Search for data in the specified memory
Search S range data (example: Sds:200 500 32)

Step through (enter int/rep/call, etc.)
Trace T (example: T=3cff:0100 10)

Unassemble the machine code in the specified memory
Unassemble U (example: U3cff:0200 400)

Display the screen content (equivalent to)
Viewswap V (any key returns)

Write the content of a file or a specified logical sector
Write W (ex: Wds:200 0 16 0f)
(range can be: start offset end offset or start address L length)

The following are detailed usage instructions:
--- Glossary ---
pathname - File name (optional path)
testparms - Parameters
address - Memory address offset
If the segment address is omitted, CS is used for assembly/disassembly; DS is used for other functions
range - Can be: start offset end offset
start address L length
start address, + length
reg - Register name
list - Some values separated by spaces or commas (of a given type)

drive - 0 = A:, 1 = B:, ...
firstsec - Logical sector number (starting from 0)

--- Operators ---
Numbers can be hexadecimal (default), # decimal, \ octal, % binary, '' string '' ("chars"),
Registers, , ^ stack.
Operators (+ - * /) and (parentheses) can be used.
Example: Rax=(^ + (bl * %1001) + ''a'').

- represents basic debug commands
+ represents commands unique to dr-debug
x represents instructions that can only be executed in dr-debug extended mode. Enter /s to enter default mode, and enter /x to enter extended mode

--- Dump commands ---
-D x Set/query default display length (in bytes)
-DB x Set/query default display length and return in byte mode
D= x Set/query the start point of viewing (0-f)
D - Display the specified memory content (/S mode) / repeat the last D? command (/X mode)
DB - Display the specified memory content (in bytes)
DW x Display the specified memory content (in words)
DD x Display the specified memory content (in double words)
DP x Display the pointer of the specified memory (far pointer - segment: offset)
DI x Display the interrupt vector table (range = interrupt number)

--- Enter commands ---
(When the list is omitted, enter data after pressing Enter, "." to exit)
E ] + Enter data
EB] x Enter data (in bytes)
EW] x Enter data (in words)
ED] x Enter data (in double words)
EP] x Enter data (in far pointers)
EI] x Enter interrupt vector

--- Compare commands ---
C range,address - Compare the contents of two segments of memory
CBrange,address x Compare the contents of two segments of memory (in bytes)
CWrange,address x Compare the contents of two segments of memory (in words)
CDrange,address x Compare the contents of two segments of memory (in double words)
CPrange,address x Compare the contents of two segments of memory (in far pointers)

--- Fill commands ---
F range,list - Fill data into memory
FBrange,list x Fill data into memory (in bytes)
FWrange,list x Fill data into memory (in words)
FDrange,list x Fill data into memory (in double words)
FPrange,list x Fill data into memory (in far pointers)


--- Search commands ---
S address list - Search for data in the specified memory
-Saddress list x Search for data in the specified memory and save the offset address of the (cx+1)th match in cx
SBaddress list x Search for data in the specified memory (in bytes) (-SB is as before)
SWaddress list x Search for data in the specified memory (in words) (-SW is as before)
SDaddress list x Search for data in the specified memory (in double words) (-SD is as before)
SPaddress list x Search for data in the specified memory (in far pointers) (-SP is as before)

--- Port I/O commands ---
I port - Input from I/O port
IB port x Input from I/O port (in bytes)
IW port x Input from I/O port (in words)
ID port x Input from I/O port (in double words) (supported above 386)
O port,value - Output to I/O port
OB port,value x Output to I/O port (in bytes)
OW port,value x Output to I/O port (in words)
OD port,value x Output to I/O port (in double words) (supported above 386)

--- Macro commands ---
-: + Clear all macros
:macroname + Define macro
= + List macro or execute macro

--- Disk I/O commands ---
N - Release parameters for the next disk operation
N? + Display parameters
N
- Specify file
L - Load file
Laddress - Load file to the specified memory address
W - Write memory to file, starting from cs:100 with length BX-CX
W - Write memory to file, starting from the specified address with length BX-CX
Laddress,drive,firstsec,number
- Load the specified logical sector to the specified memory (num = number of sectors to load)
Waddress,drive,firstsec,number
- Save the specified memory to the specified logical sector (num = number of sectors to save, or use BX-CX to specify its length - in bytes)

--- Trace commands ---
-B x Clear all breakpoints (translated as breakpoint, the same below)
-Baddress x Clear the breakpoint at the specified address
B + List breakpoints
Baddress]
+ Set breakpoint at the specified memory, interrupt every count times, interrupt condition: reg=val
T - Step through starting from the specified address for number instructions
TU + Same as T, but do not display the execution result of intermediate instructions
P - Same as T, but skip call and int subroutines
PU + Same as P, but do not display the execution result of intermediate instructions
G Execute starting from the specified address (or CS:IP), stop at

--- Assemble command ---
A - Enter the input assembly language mode (press Enter/. to exit), support comments

--- Unassemble commands ---
-Unumber x Set/query default unassemble length
U - Unassemble the specified memory instructions

--- Help commands ---
? - Display basic help
?topic + Display specific topic or page number (1..8)
?? or ?0 + Display all help

--- Display and input modes ---
A= x Set/query default address mode (16-bit/32-bit)
O= x Set/query default operand mode (16-bit/32-bit)
R= + Set/query default register display mode (16-bit/32-bit)
RF - Set/query flag register
RDR x Display flag register in 16-bit register mode (default in /X mode)
RMS x Display flag register in standard mode (default in /S mode)

--- Utility commands ---
ASCII + Display an ASCII table
CLS + Clear screen
CPU + Display CPU type (support up to Pentium pro) and working mode (real mode/32-bit protected mode/virtual 86 mode)
H value + Display ''value'' in hexadecimal, decimal, character, octal and binary
H value1 value2 + Display the results of adding, subtracting, multiplying, dividing and taking modulus of value1 and value2
V + Display the user screen (execution result of the program, just like in c)
; comment + Comment






Floor2 minisheep Posted 2003-02-14 00:00
高级用户 Posts 233 Credits 830
Great! Then it can be downloaded! Need separate files!
Floor3 wolfwood Posted 2003-02-14 00:00
初级用户 Posts 14 Credits 158
Just download your own DR-DOS, and there are more powerful tools inside - taskmgr (multitask manager under DOS) and so on, but it can't be used on other DOSes, and there are quite a few protection measures inside, not so easy to crack. But someone has already cracked it long ago.
Floor4 Wengier Posted 2003-02-14 00:00
系统支持 Posts 10,521 Credits 27,736
I used TASKMGR in DR-DOS, but it was very unstable and not practical.
Floor5 闪猛 Posted 2003-02-15 00:00
中级用户 Posts 69 Credits 327
LZ, can you use simplified Chinese next time when posting an article? Your article makes my eyes hurt and is too difficult to read.
Floor6 Wengier Posted 2003-02-15 00:00
系统支持 Posts 10,521 Credits 27,736
Is that so? When I read traditional Chinese, I actually feel quite accustomed to it, although I'm more accustomed to reading simplified Chinese.
Floor7 wolfwood Posted 2003-02-16 00:00
初级用户 Posts 14 Credits 158
Right, after reading a lot of books from the Commercial Press and Taiwanese documents, I really feel that traditional Chinese is more comfortable.
Floor8 Wengier Posted 2003-02-17 00:00
系统支持 Posts 10,521 Credits 27,736
Traditional Chinese is a treasure of China. Now it is used in all Chinese - speaking regions around the world except the Chinese mainland. The Chinese mainland began to use simplified Chinese more than 40 years ago.
Floor9 LanE Posted 2003-02-18 00:00
银牌会员 Posts 648 Credits 1,835
Hehe, it doesn't matter, as long as it can be understood.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023