China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-31 19:48
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » Repost: Detailed Explanation of the debug Command View 4,249 Replies 2
Original Poster Posted 2002-10-21 00:00 ·  中国 江西 吉安 电信
版主
★★★★
Credits 7,296
Posts 1,628
Joined 2002-10-16 12:00
23-year member
UID 10
Gender Male
Status Offline
Detailed Explanation of the DEBUG Command   --This post is a repost



Debug:A (assemble)

Directly assembles 8086/8087/8088 mnemonics into memory.
This command creates executable machine code from assembly-language statements. All numeric values are in hexadecimal format, and these values must be entered as one to four characters. Specify prefix mnemonics before the referenced operation code (opcode).
a [address]
Parameters
address
Specifies the location where assembly-language instructions are to be typed. Use a hexadecimal value for address, and type each value without ending it with the “h” character. If no address is specified, a begins assembling where it last stopped.
For information about entering data into specified bytes, see Debug E (enter).
For information about disassembling bytes, see Debug U (unassemble)
Notes
Using mnemonics
The segment override mnemonics are cs:, ds:, es:, and ss:. The mnemonic for a far return is retf. The mnemonics for string handling must explicitly declare the string size. For example, movsw moves a 16-bit word string, and movsb moves an 8-bit byte string.
Assembling jumps and calls
The assembler automatically assembles short, near, and far jumps and calls to the target address according to byte displacement. You can override such a jump or call by using a near or far prefix, as shown in the following example:
-a0100:0500
0100:0500 jmp 502 ; a 2-byte short jump
0100:0502 jmp near 505 ; a 3-byte near jump
0100:0505 jmp far 50a ; a 5-byte far jump
The near prefix can be abbreviated as ne.
Distinguishing word and byte memory locations
When an operand can refer to either a word memory location or a byte memory location, you must specify the data type with the prefix word ptr or the prefix byte ptr. The acceptable abbreviations are wo and by respectively. The following examples show both formats:
dec wo [si]
neg byte ptr [128]
Specifying operands
Debug uses the convention of operands enclosed in square brackets ([ ]) to refer to memory addresses. This is because otherwise Debug cannot distinguish immediate operands from memory-address operands. The following examples show both formats:
mov ax,21 ; load AX with 21h
mov ax,[21] ; load AX with the
; contents of
; memory location 21h
Using pseudo-instructions
The a command provides two commonly used pseudo-instructions: the db opcode, which assembles byte values directly into memory, and the dw opcode, which assembles word values directly into memory. The following are examples of the two pseudo-instructions:
db 1,2,3,4,"THIS IS AN EXAMPLE"
db 'THIS IS A QUOTATION MARK:"'
db "THIS IS A QUOTATION MARK:'"
dw 1000,2000,3000,"BACH"
Examples
The a command supports all forms of indirect register commands, as shown in the following examples:
add bx,34[bp+2].[si-1]
pop [bp+di]
push [si] )
It also supports all opcode synonyms, as shown in the following examples:
loopz 100
loope 100
ja 200
jnbe 200
For 8087 opcodes, you must specify the wait or fwait prefix, as shown in the following example:
fwait fadd st,st(3) ; this line assembles
; an fwait prefix

Debug:C (compare)
Compares two portions of memory.
c range address
Parameters
range
Specifies the starting and ending addresses, or the starting address and length, of the first memory area to compare.
address
Specifies the starting address of the second memory area to compare. For information about valid address values, see “Debug Notes.”
Notes
If the range and address memory areas are the same, Debug displays nothing and returns directly to the Debug prompt. If there are differences, Debug displays them in the following format:
address1 byte1 byte2 addess2
Examples
The following commands have the same effect:
c100,10f 300
c100l10 300
Each command compares the block of memory data from 100h to 10Fh with the block of memory data from 300h to 30Fh.
Debug responds to the preceding command and displays the following information (assuming DS = 197F):
197F:0100 4D E4 197F:0300
197F:0101 67 99 197F:0301
197F:0102 A3 27 197F:0302
197F:0103 35 F3 197F:0303
197F:0104 97 BD 197F:0304
197F:0105 04 35 197F:0305
197F:0107 76 71 197F:0307
197F:0108 E6 11 197F:0308
197F:0109 19 2C 197F:0309
197F:010A 80 0A 197F:030A
197F:010B 36 7F 197F:030B
197F:010C BE 22 197F:030C
197F:010D 83 93 197F:030D
197F:010E 49 77 197F:030E
197F:010F 4F 8A 197F:030F
Note that addresses 197F:0106 and 197F:0306 are missing from the list. This indicates that the values at those addresses are the same.

Debug:D (dump)
Displays the contents of a range of memory addresses.
d [range]
Parameters
range
Specifies the starting and ending addresses, or the starting address and length, of the memory area whose contents are to be displayed. If range is not specified, Debug displays 128 bytes of content starting from the end of the address range specified in the previous d command.
For information about displaying register contents, see Debug R (registers).
Notes
When using the d command, Debug displays memory contents in two parts: the hexadecimal part (the value of each byte is represented in hexadecimal format) and the ASCII part (the value of each byte is represented as an ASCII character). Each nonprinting character is represented by a period (.) in the displayed ASCII part. Each displayed line shows 16 bytes, with a hyphen between the 8th and 9th bytes. Each displayed line begins on a 16-byte boundary.
Examples
Suppose you type the following command:
dcs:100 10f
Debug displays the contents in the range in the following format:
04BA:0100 54 4F 4D 00 53 41 57 59-45 52 00 00 00 00 00 00 TOM.SAWYER......
If you type the d command without parameters, Debug formats the display as described in the previous example. Each displayed line begins with an address 16 bytes greater than the previous line’s address (8 bytes if displayed on a 40-column screen).
For each subsequent d command typed without parameters, Debug displays the byte contents immediately following the last displayed command.
If you type the following command, Debug displays 20h bytes of content starting at CS:100:
dcs:100 l 20
If you type the following command, Debug displays the contents of all bytes in the range from 100h to 115h in the CS segment:
dcs:100 115

Debug:E (enter)
Enters data into a specified address in memory.
Data can be typed in hexadecimal or ASCII format. Any data previously stored at the specified location is lost.
e address [list]
Parameters
address
Specifies the first memory location for entering data.
list
Specifies the data to be entered into consecutive bytes of memory.
For information about assembling mnemonics, see Debug A (assemble).
For information about displaying the contents of a portion of memory, see Debug D (dump).
Notes
Using the address parameter
If you specify the value of address without specifying the optional list parameter, Debug displays the address and contents, repeats the address on the next line, and waits for your input. At this point, you can do one of the following:
Replace the byte value. To do this, type the new value after the current value. If the value you type is not a valid hexadecimal value, or if the value contains more than two digits, Debug does not echo the invalid or extra characters.
Move to the next byte. To do this, press SPACEBAR. To change the value in that byte, type the new value after the current value. If pressing SPACEBAR moves past an 8-byte boundary, Debug displays a new line and displays the new address at the beginning of the line.
Return to the previous byte. To do this, press the HYPHEN key (-). You can press the HYPHEN key (-) repeatedly to move back past multiple bytes. When HYPHEN is pressed, Debug starts a new line and displays the current address and byte value.
Stop executing the e command. To do this, press ENTER. ENTER can be pressed at any byte position.
Using the list parameter
If the value of the list parameter is specified, the following e command replaces the existing byte values with the values in the list. If an error occurs, no byte values are changed.
List values can be hexadecimal bytes or strings. Use spaces, commas, or tabs to separate values. Strings must be enclosed in single or double quotation marks.
Examples
Suppose you type the following command:
ecs:100
Debug displays the contents of the first byte in the following format:
04BA:0100 EB.
To change this value to 41, type 41 at the insertion point, as follows:
04BA:0100 EB.41_
You can type consecutive byte values with one e command. After typing the new value, press SPACEBAR instead of ENTER. Debug displays the next value. In this example, if you press SPACEBAR three times, Debug displays the following values:
04BA:0100 EB.41 10. 00. BC._
To change the hexadecimal value BC to 42, type 42 at the insertion point, as follows:
04BA:0100 EB.41 10. 00. BC.42_
Suppose you decide that the value 10 should be 6F. To correct this value, press the HYPHEN key twice to return to address 0101 (value 10). Debug displays the following:
04BA:0100 EB.41 10. 00. BC.42-
04BA:0102 00.-
04BA:0101 10._
Type 6f at the insertion point to change the value, as follows:
04BA:0101 10.6f_
Press ENTER to stop the e command and return to the Debug prompt.
The following is an example of a string item:
eds:100 "This is the text example"
This string will fill 24 bytes starting at DS:100

Debug:F (fill)
Fills addresses in a specified memory area with specified values.
The data can be specified in hexadecimal or ASCII format. Any data previously stored at the specified location will be lost.
f range list
Parameters
range
Specifies the starting and ending addresses, or the starting address and length, of the memory area to fill. For information about valid range values, see “Debug Notes.”
list
Specifies the data to enter. List can consist of hexadecimal numbers or strings enclosed in quotation marks.
Notes
Using the range parameter
If range contains more bytes than there are values in list, Debug repeatedly assigns the values in list until all bytes in range are filled.
If any memory in range is damaged or does not exist, Debug displays an error message and stops the f command.
Using the list parameter
If list contains more values than there are bytes in range, Debug ignores the extra values in list.
Examples
Suppose you type the following command:
f04ba:100l100 42 45 52 54 41
In response, Debug fills the memory locations from 04BA:100 to 04BA:1FF with the specified values. Debug repeats these five values until all 100h bytes are filled.

Debug:G (go)
Runs the program currently in memory.
g [=address] [breakpoints]
Parameters
=address
Specifies the address at which the program currently in memory is to start executing. If address is not specified, Windows 2000 starts executing the program from the current address in the CS:IP registers.
breakpoints
Specifies 1 to 10 temporary breakpoints that can be set as part of the g command.
For information about executing loops, repeated string instructions, software interrupts, or subroutines, see Debug P (proceed).
For information about executing instructions, see Debug T (trace)

Debug:H (hexadecimal)
Performs hexadecimal arithmetic on the two specified parameters.
h value1 value2
Parameters
value1
Represents any hexadecimal number in the range from 0 to FFFFh.
value2
Represents a second hexadecimal number in the range from 0 to FFFFh.
Notes
Debug first adds the two specified parameters, then subtracts the second parameter from the first. The results of these calculations are displayed on one line: first the sum, then the difference.
Examples
Suppose you type the following command:
h19f 10a
Debug performs the operation and displays the following result.
02A9 0095

Debug:I (input)
Reads and displays a byte value from the specified port.
i port
Parameters
port
Specifies the input port by address. The address can be a 16-bit value.
For information about sending a byte value to an output port, see Debug O (output).
Examples
Suppose you type the following command:
i2f8
Also suppose the byte value of the port is 42h. Debug reads the byte and displays its value as follows:
42

Debug:L (load)
Loads the contents of a file or specific disk sectors into memory.
To load the number of bytes specified in the BX:CX registers from a disk file, use the following syntax:
l [address]
To bypass the Windows 2000 file system and load specific sectors directly, use the following syntax:
l address drive start number
Parameters
address
Specifies the memory location where the file or sector contents are to be loaded. If address is not specified, Debug uses the current address in the CS register.
drive
Specifies the drive containing the disk from which the specified sectors are read. The value is numeric: 0 = A, 1 = B, 2 = C, etc.
start
Specifies the hexadecimal number of the first sector whose contents are to be loaded.
number
Specifies the hexadecimal number of consecutive sectors whose contents are to be loaded. The drive, start, and number parameters can be used only when loading the contents of specific sectors rather than loading the file specified on the debug command line or in the most recent Debug n (name) command.
For information about specifying a file for the l command, see Debug n (name).
For information about writing the debugged file to disk, see Debug w (write).
Note
Using the l command without parameters
When the l command is used without parameters, the file specified on the debug command line is loaded into memory, starting at address CS:100. Debug also sets the BX and CX registers to the number of bytes loaded. If no file is specified on the debug command line, the loaded file will be the file most recently specified with the n command.
Using the 1 command with the address parameter
If the l command is used with the address parameter, Debug loads the contents of the file or specified sectors starting at memory location address.
Using the l command with all parameters
If the l command is used with all parameters, Debug loads the contents of the specified disk sectors instead of loading a file.
Loading the contents of specific sectors
Each sector in the specified range is read from drive. Debug begins loading at start until all contents in the number of sectors specified in number have been loaded.
Loading .exe files
Debug ignores the address address parameter for .exe files. If a .exe file is specified, Debug relocates the file to the load address specified in the header of the .exe file. Before the .exe file is loaded into memory, the header itself is stripped from the .exe file, so the size of the .exe file on disk differs from that in memory. If you want to examine the entire .exe file, rename the file with a different extension.
Opening hexadecimal files
Debug treats files with the .hex extension as hexadecimal-format files. Type the l command without parameters to load the hexadecimal file starting at the address specified in the hexadecimal file. If the l command you type contains the address parameter, Debug adds the specified address to the address found in the hexadecimal file to determine the starting address.
Examples
Suppose you start Debug and type the following command:
nfile.com
You can now type the l command to load File.com. Debug loads the file and displays the Debug prompt.
Suppose you need to load the contents of 109 (6Dh) sectors, starting with logical sector 15 (0Fh), from drive C into memory starting at address 04BA:0100. To do this, type the following command:
l04ba:100 2 0f 6d

Debug:M (move)
Copies the contents of one memory block into another memory block.
m range address
Parameters
range
Specifies the starting and ending addresses, or the starting address and length, of the memory area whose contents are to be copied.
address
Specifies the starting address to which the contents of range are to be copied.
Notes
The effect of the copy operation on existing data
If the new data is not written to an address in the block of data being copied, the source data remains unchanged. However, if the destination block already contains data (as it does in an overlapping copy operation), that data is overwritten. (An overlapping copy operation is one in which part of the destination data block overlaps part of the original data block.)
Performing an overlapping copy operation
The m command performs an overlapping copy operation to the destination address without losing data. The contents of the addresses to be overwritten are copied first. Therefore, if data at higher addresses is copied to lower addresses, the copy operation starts at the lowest address of the original block and proceeds toward the highest address. Conversely, if data is copied from lower addresses to higher addresses, the copy operation starts at the highest address of the original block and proceeds toward the lowest address.
Examples
Suppose you type the following command:
mcs:100 110 cs:500
Debug first copies the contents of address CS:110 to address CS:510, then copies the contents of address CS:10F to CS:50F, and so on until the contents of address CS:100 have been copied to address CS:500. To view the result, use the Debug d (dump) command, and use the destination address specified with the m command

Debug:N (name)
Specifies the name of the executable file for the Debug l (load) or w (write) command, or specifies parameters for the executable file being debugged.
n [drive:][path] filename
To specify parameters for the executable file to be tested, use the following syntax:
n file-parameters
Parameters
If used without parameters, the n command clears the current specification.
[drive:][path] filename
Specifies the location and name of the executable file to be tested.
file-parameters
Specifies parameters and switches for the executable file being tested.
For information about loading a file or the contents of specified disk sectors into memory, see Debug L (load).
For information about writing the debugged file to disk, see Debug W (write).
Notes
The two uses of the n command
The n command can be used in two ways. First, you can use it to specify the file used by a subsequent l (load) or w (write) command. If you start Debug without naming the file to be debugged, you must use the command nfilename before using the l command to load the file. The filename is correctly formatted for the file control block (FCB) at CS:5C. Second, you can use the n command to specify command-line parameters and switches for the file being debugged.
Memory areas
The following four memory areas are all affected by the n command:
Memory location
Contents
CS:5C
File control block (FCB) for file 1
CS:6C
File control block (FCB) for file 2
CS:80
Length of the n command line (in characters)
CS:81
Beginning of the n command-line characters
The first filename specified for the n command is placed in the FCB at CS:5C. If a second filename is specified, this name is placed in the FCB at CS:6C. The number of characters typed on the n command line (except for the first character, n) is stored at location CS:80. The actual characters on the n command line (again, except for the letter n) are stored starting at CS:81. Note that these characters can be any switches and separators valid in commands typed at the Windows 2000 command prompt.
Examples
Suppose Debug has already been started and the program being debugged, Prog.com, has been loaded. Then you decide to specify two parameters for Prog.com and run the program. The following is the command sequence for this example:
debug prog.com
nparam1 param2
g
In this case, the Debug g (go) command runs the program as if you had typed the following command at the Windows 2000 command prompt:
prog param1 param2
Therefore, testing and debugging reflect the normal run-time environment of Prog.com.
In the following command sequence, the first n command specifies File1.exe as the file for the following l (load) command, which loads File1.exe into memory. The second n command specifies the parameters that File1.exe will use. Finally, the g command runs the File1.exe file as if you had typed File1 File2.dat File2.dat at the Windows 2000 command line.
nfile1.exe
nfile2.dat file3.dat
g
Note
Do not use the l command after the second form of the n command. Also note that if you now use the w (write) command, Windows 2000 will save the file being debugged, File1.exe, using the name File2.dat. To avoid this result, you should always use the first form of the n command immediately before an l or w command.
ko20010214
=================================
大功告成,打个Kiss!
ko20010214@MSN.com
神州优雅Q300C
Intel CeleronM 370处理器 | 256MbDDR内存
40G硬盘 | USB2.0 | IEEE 1394
13.3 ' WXGA 宽屏(16:10) | COMBO光驱
10/100M网卡 | 四合一读卡器
Floor 2 Posted 2002-10-21 00:00 ·  中国 江西 吉安 电信
版主
★★★★
Credits 7,296
Posts 1,628
Joined 2002-10-16 12:00
23-year member
UID 10
Gender Male
Status Offline
Debug:O (output)
Sends a byte value to an output port.
o port byte-value
Parameters
port
Specifies the output port by address. The port address can be a 16-bit value.
byte-value
Specifies the byte value to be directed to port.
For information about reading a byte value from an input port, see Debug I (input).
Examples
To send the byte value 4Fh to the output port at address 2F8h, type the following command:
o2f8 4f

Debug:P (proceed)
Executes a loop, repeated string instruction, software interrupt, or subroutine; or traces through any other instruction.
p [= address] [number]
Parameters
=address
Specifies the location of the first instruction to execute. If no address is specified, the default address is the current address specified in the CS:IP registers.
number
Specifies the number of instructions to execute before returning control to Debug. The default value is 1.
For information about running the program currently in memory, see Debug G (go).
For information about executing instructions, see Debug T (trace).
Notes
Control is transferred to the program to be tested
When the p command transfers control from Debug to the program to be tested, that program runs uninterrupted until the loop, repeated string instruction, software interrupt, or subroutine at the specified address has completed, or until the specified number of machine instructions has been executed. Control then returns to Debug.
Limitations of the address parameter
If the address parameter does not specify a segment, Debug uses the CS register of the program being tested. If address is omitted, the program begins execution from the address specified by the CS:IP registers. An equal sign (=) must be used before the address parameter to distinguish it from the number parameter. If the instruction at the specified address is not a loop, repeated string instruction, software interrupt, or subroutine, the p command has the same effect as the Debug t (trace) command.
Messages displayed by the p command
After p executes a section of instructions, Debug displays the program’s register contents, the status of the flags, and the decoded form of the next instruction to be executed.
Warning
The p command cannot be used to trace read-only memory (ROM).
Examples
Suppose the program being tested contains a call instruction at address CS:143F. To run the subroutine at the call target location and then return control to Debug, type the following command:
p=143f
Debug displays the result in the following format:
AX=0000 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=2246 ES=2246 SS=2246 CS=2246 IP=1443 NV UP EI PL NZ AC PO NC
2246:1442 7505 JNZ 144A

Debug:Q (quit)
Stops the Debug session without saving the current test file.
After you type q, control returns to the Windows 2000 command prompt.
q
Parameters
This command has no parameters.
For information about saving a file, see Debug W (write).

Debug:R (registers)
Displays or changes the contents of one or more CPU registers.
r [register-name]
Parameters
None
If used without parameters, the r command displays the contents of all registers and the flags in the register storage area.
register-name
Specifies the name of the register whose contents are to be displayed.
For information about displaying the contents of a portion of memory, see Debug D (dump).
For information about disassembling bytes, see Debug U (unassemble).
Notes
Using the r command
If a register name is specified, Windows 2000 displays the 16-bit value of the register in hexadecimal notation and displays a colon as the prompt. If you want to change the value contained in the register, type the new value and press ENTER; otherwise, press ENTER to return to the Debug prompt.
Valid register names
The following are valid values for register-name: ax, bx, cx, dx, sp, bp, si, di, ds, es, ss, cs, ip, pc, and f. Both ip and pc refer to the instruction pointer.
If you specify a register name other than one from the preceding list, Windows 2000 displays the following message:
br error
Using the f character instead of a register name
If you type the f character instead of a register name, Debug displays the current setting of each flag as a two-letter code, and then displays the Debug prompt. To change the flag settings, type the appropriate two-letter codes from the following table:
Flag name
Set
Clear
Overflow
ov
nv
Direction
dn (decrement)
up (increment)
Interrupt
ei (enabled)
di (disabled)
Sign
ng (negative)
pl (positive)
Zero
zr
nz
Auxiliary carry
ac
na
Parity
pe (even parity)
po (odd parity)
Carry
cy
nc
You can type the new flag values in any order. No spaces are required between these values. To stop the r command, press ENTER. Any flag for which a new value is not specified remains unchanged.
Messages displayed by the r command
If more than one value is specified for a flag, Debug displays the following message:
df error
If you specify a flag code not listed in the preceding table, Debug displays the following message:
bf error
In both cases, Debug ignores all settings specified after the invalid item.
Debug’s default settings
When Debug is started, the segment registers are set to the low end of free memory, the instruction pointer is set to 0100h, all flags are cleared, and the remaining registers are set to zero, except sp, which is set to FFEEh.

Debug:R
Examples
To view the contents of all registers, the status of all flags, and the instruction decoding table for the current location, type the following command:
r
If the current location is CS:11A, the display will look similar to the following:
AX=0E00 BX=00FF CX=0007 DX=01FF SP=039D BP=0000 SI=005C DI=0000
DS=04BA ES=04BA SS=04BA CS=O4BA IP=011A NV UP DI NG NZ AC PE NC
04BA:011A CD21 INT 21
To view only the status of the flags, type the following command:
rf
Debug displays information in the following format:
NV UP DI NG NZ AC PE NC - _
Now you can type one or more valid flag values in any order, with or without spaces, as follows:
nv up di ng nz ac pe nc - pleicy
Debug ends the r command and displays the Debug prompt. To view the changes, type the r or rf command. Debug displays the following:
NV UP EI PL NZ AC PE CY - _
Press ENTER to return to the Debug prompt.

Debug:S (search)
Searches a range of addresses for a pattern of one or more byte values.
s range list
Parameters
range
Specifies the starting and ending addresses of the range to search.
list
Specifies a pattern of one or more byte values, or the string to search for. Separate each byte value from the next with a space or comma. Enclose string values in quotation marks.
Notes
If the list parameter contains more than one byte value, Debug displays only the first address where the byte values occur. If list contains only one byte value, Debug displays all addresses in the specified range where that value occurs.
Examples
Suppose you need to find all addresses that contain the value 41 in the range from CS:100 to CS:110. To do this, type the following command:
scs:100 110 41
Debug displays the result in the following format:
04BA:0104
04BA:010D
-
The following command searches for the string “Ph” in the range from CS:100 to CS:1A0.
scs:100 1a0 "Ph"

Debug:T (trace)
(SORRY, the Debug:T section is temporarily missing; if any net friend has this section, please notify me)

Debug:U (unassemble)
Disassembles bytes and displays the corresponding source statements, including addresses and byte values. The disassembled code looks like a listing of an assembled file.
u [range]
Parameters
None
If used without parameters, the u command disassembles 20h bytes (the default value), starting from the first address after the address displayed by the preceding u command.
range
Specifies the starting and ending addresses, or the starting address and length, of the code to disassemble.
For information about assembling mnemonics, see Debug A (assemble).
For information about displaying the contents of a portion of memory, see Debug D (dump).
Examples
To disassemble 16 (10h) bytes starting at address 04BA:0100, type the following command:
u04ba:100l10
Debug displays the result in the following format:
04BA:0100 206472 AND [SI+72],AH
04BA:0103 69 DB 69
04BA:0104 7665 JBE 016B
04BA:0106 207370 AND [BP+DI+70],DH
04BA:0109 65 DB 65
04BA:010A 63 DB 63
04BA:010B 69 DB 69
04BA:010C 66 DB 66
04BA:010D 69 DB 69
04BA:010E 63 DB 63
04BA:010F 61 DB 61
If you only want to display information for the specific addresses from 04BA:0100 to 04BA:0108, type the following command:
u04ba:0100 0108
Debug displays the following:
04BA:0100 206472 AND [SI+72],AH
04BA:0103 69 DB 69
04BA:0104 7665 JBE 016B
04BA:0106 207370 AND [BP+DI+70],DH

Debug:W (write)
Writes a file or specific partition to disk.
To write the contents of the number of bytes specified in the BX:CX registers to a disk file, use the following syntax:
w [address]
To bypass the Windows 2000 file system and write specific sectors directly, use the following syntax:
w address drive start number
Parameters
address
Specifies the starting memory address of the file or part of the file to be written to the disk file. If address is not specified, Debug starts at CS:100.
drive
Specifies the drive containing the target disk. The value is numeric: 0 = A, 1 = B, 2 = C, etc.
start
Specifies the hexadecimal number of the first sector to write.
number
Specifies the number of sectors to write.
For information about specifying a file for the w command, see Debug N (name).
For information about loading a file or the contents of file sectors into memory, see Debug L (load).
Notes
The name of the disk file must be specified when starting Debug or in the most recent Debug n (name) command. Either method correctly formats the filename in the file control block at address CS:5C.
Resetting BX:CX before using the w command without parameters
If you have used the Debug g (go), t (trace), p (proceed), or r (registers) command, you must reset the BX:CX registers before using the w command with no parameters.
Writing a modified file to disk
If you modify a file but do not change the filename, length, or starting address, Debug can still correctly write the file back to the source disk location.
Limitations of the w command
This command cannot be used to write .exe or .hex files.
Warning
Because the Windows 2000 file handle is bypassed, writing specific partitions is very dangerous. If the wrong value is typed, the disk file structure can easily be damaged.
Examples
Suppose you want to write the memory contents starting at address CS:100 to the disk in drive B. The data needs to start from logical sector number 37h on the disk and continue for 2Bh sectors. To do this, type the following command:
wcs:100 1 37 2b
When the write operation is complete, Debug displays the Debug prompt again.

Debug:XA (allocate expanded memory)
Allocates the specified number of pages of expanded memory.
To use expanded memory, an expanded memory device driver conforming to version 4.0 of the Lotus/Intel/Microsoft Expanded Memory Specification (LIM EMS) must be installed.
xa [count]
Parameters
count
Specifies the number of 16KB pages of expanded memory to allocate.
For information about other Debug commands that use expanded memory, see Debug XD (release expanded memory), Debug XM (map expanded memory pages), or Debug XS (display expanded memory status).
Notes
If the specified number of pages is available, Debug displays a message indicating the hexadecimal number of the handle created; otherwise, Debug displays an error message.

Debug:XA
Examples
To allocate 8 pages of expanded memory, type the following command:
xa8
If the command succeeds, Debug displays a message similar to the following:
Handle created=0003

Debug:XD (release expanded memory)
Releases a handle pointing to expanded memory.
To use expanded memory, an expanded memory device driver conforming to version 4.0 of the Lotus/Intel/Microsoft Expanded Memory Specification (LIM EMS) must be installed.
xd [handle]
Parameters
handle
Specifies the handle to release.
For information about other Debug commands that use expanded memory, see Debug XA (allocate expanded memory), Debug XM (map expanded memory pages), or Debug XS (display expanded memory status).
Examples
To release handle 0003, type the following command:
xd 0003
If the command succeeds, Debug displays the following message:
Hdle 0003 deallocated

Debug:XM (map expanded memory pages)
Maps a logical page of expanded memory belonging to the specified handle to a physical page of expanded memory.
To use expanded memory, an expanded memory device driver conforming to version 4.0 of the Lotus/Intel/Microsoft Expanded Memory Specification (LIM EMS) must be installed.
xm [lpage] [ppage] [handle]
Parameters
lpage
Specifies the logical page number of expanded memory to map to physical page ppage.
ppage
Specifies the physical page number to which lpage is mapped.
handle
Specifies the handle.
For information about other Debug commands that use expanded memory, see Debug XA (allocate expanded memory), Debug XD (release expanded memory), or Debug XS (display expanded memory).
Examples
To map logical page 5 of handle 0003 to physical page 2, type the following command:
xm 5 2 0003
If the command succeeds, Debug displays the following message:
Logical page 05 mapped to physical page 02

Debug:XS (display expanded memory status)
Displays information about the status of expanded memory.
To use expanded memory, an expanded memory device driver conforming to version 4.0 of the Lotus/Intel/Microsoft Expanded Memory Specification (LIM EMS) must be installed.
xs
Parameters
This command has no parameters.
For information about other Debug commands that use expanded memory, see Debug XA (allocate expanded memory), Debug XD (release expanded memory), or Debug XM (map expanded memory pages).
Notes
The information Debug displays has the following format:
Handle xx has xx pages allocated
Physical page xx = Frame segment xx
xx of a total xx EMS pages have been allocated
xx of a total xx EMS handles have been allocated
Examples
To display expanded memory information, type the following command:
xs
Debug displays information similar to the following:
Handle 0000 has 0000 pages allocated
Handle 0001 has 0002 pages allocated
Physical page 00 = Frame segment C000
Physical page 01 = Frame segment C400
Physical page 02 = Frame segment C800
Physical page 03 = Frame segment CC00
2 of a total 80 EMS pages have been allocated
2 of a total FF EMS handles have been allocated
ko20010214
=================================
大功告成,打个Kiss!
ko20010214@MSN.com
神州优雅Q300C
Intel CeleronM 370处理器 | 256MbDDR内存
40G硬盘 | USB2.0 | IEEE 1394
13.3 ' WXGA 宽屏(16:10) | COMBO光驱
10/100M网卡 | 四合一读卡器
Floor 3 Posted 2002-11-01 00:00 ·  中国 浙江 衢州 电信
初级用户
Credits 136
Posts 8
Joined 2002-10-23 00:00
23-year member
UID 46
Gender Male
Status Offline
Question for all the experts: how can Chinese such as “你好” be displayed in DEBUG? Thanks!
Forum Jump: