Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the DEBUG commands?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "what are the DEBUG commands". In the daily operation, I believe many people have doubts about the DEBUG commands. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "what are the DEBUG commands?" Next, please follow the editor to study!

Debug:A (compilation)

Merge the 8086Compact 8087Comp8088 memory code directly into memory.

This command creates executable machine code from assembly language statements. All numeric values are in hexadecimal format and must be entered in one to four characters. Specify a prefix memory code before the referenced operation code (opcode).

A [address]

Parameters.

Address

Specifies where to type assembly language instructions. Use hexadecimal values for address and type each value that does not end with the "h" character. If you do not specify an address, a will start assembly where it last stopped.

For information about entering data into the specified byte, see Debug E (type).

For information on disassembly bytes, see Debug U (disassembly)

Description

Use memory code

The alternative memory codes for segments are cs:, ds:, es:, and ss:. The memory code returned remotely is retf. The memory code for string processing must explicitly declare the string size. For example, you can move 16-bit strings with movsw and 8-bit byte strings with movsb.

Assembler jump and call

The assembler automatically assembles short, near, and far jumps and calls to the target address based on byte substitution. Such a jump or call can be replaced by using the near or far prefix, as shown in the following example:

-a0100PUR 0500

0100Rom 0500 jmp 502; a 2-byte short jump

0100 0502 jmp near 505; a 3-byte near jump

0100Rom 0505 jmp far 50a; a 5-byte far jump

You can abbreviate the near prefix to ne.

Distinguish between word and byte memory locations

When an Operand can reference a word memory location or a byte memory location, the data type must be specified with the prefix word ptr or the prefix byte ptr. The acceptable abbreviations are wo and by, respectively. The following example shows two formats:

Dec wo [si]

Neg byte ptr [128]

Specify Operand

Debug refers to the idiom of the memory address using operands enclosed in parentheses ([]). This is because, on the other hand, Debug cannot distinguish between immediate operands and operands of memory addresses. The following example shows two formats:

Mov ax,21; load AX with 21h

Mov ax, [21]; load AX with the

; contents of

; memory location 21h

Use pseudo instruction

Use the a command to provide two commonly used pseudo-instructions: db opcodes, which assemble byte values directly into memory, and dw opcodes, which assemble word values directly into memory. Here are two examples of 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"

Example

The a command supports all forms of indirect registration commands, as shown in the following example:

Add bx,34 [bp+2]. [si-1]

Pop [bp+di]

Push [si])

All opcode synonyms are also supported, as shown in the following example:

Loopz 100

Loope 100

Ja 200

Jnbe 200

For 8087 opcodes, you must specify a wait or fwait prefix, as shown in the following example:

Fwait fadd st,st (3); this line assembles

; an fwait prefix

Debug:C (compare)

Compare the two parts of memory.

C range address

Parameters.

Range

Specify the start and end addresses of the first area of memory to compare, or the start address and length.

Address

Specifies the starting address of the second area of memory to compare. For information about valid address values, see the Debug description.

Description

If the range and address memory areas are the same, Debug will return directly to the Debug prompt without displaying anything. If there is a difference, the Debug will be displayed in the following format:

Address1 byte1 byte2 addess2

Example

The following commands have the same effect:

C100,10f 300

C100l10 300

Each command compares 100h to 10Fh memory blocks with 300h to 30Fh memory blocks.

Debug responds to the previous 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

Notice that the addresses 197F:0106 and 197F:0306 are missing from the list. This indicates that the values in those addresses are the same.

Debug:D (dump)

Displays the contents of a range of memory addresses.

D [range]

Parameters.

Range

Specify the start and end address, or start address and length of the memory area whose contents you want to display. If you do not specify the range,Debug program, it will display 128 bytes starting at the end of the address range specified in the previous d command.

For information about displaying the contents of the register, see Debug R (register).

Description

When using the d command, Debug displays the contents of memory in two parts: the hexadecimal part (the value of each byte is represented in hexadecimal format) and the ASCII code part (the value of each byte is represented by the ASCII character). Each non-print character is represented by a period (.) in the ASCII part of the display. It means. Each display line displays 16 bytes of content, with a hyphen between the 8th and 9th bytes. Each display line starts at a 16-byte boundary.

Example

Suppose you type the following command:

Dcs:100 10f

Debug displays the contents of the range in the following format:

04BA:0100 54 4F 4D 00 53 41 57 59-45 52 00 00 00 TOM.SAWYER.

If you type the d command without arguments, Debug formats the display as described in the previous example. Each line displayed begins with an address 16 bytes larger than the address on the previous line (or 8 bytes in the case of a screen that displays 40 columns).

For each subsequent d command with no arguments, Debug displays the byte contents immediately after the last displayed command.

"if you type the following command, Debug displays 20h bytes starting with 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 of the CS segment:

Dcs:100 115

Debug:E (type)

Enter data to the specified address in memory.

You can type data in hexadecimal or ASCII format. Any data previously stored in the specified location is lost.

E address [list]

Parameters.

Address

Specifies the first memory location of the input data.

List

Specifies the data in consecutive bytes to enter into memory.

For information about integrated memory codes, see Debug A (compilation).

For information about displaying the memory portion, see Debug D (dump).

Description

Use the address parameter

If you specify the value of address without specifying the value of 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 a 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 numbers, Debug does not echo invalid or extra characters.

Proceed to the next byte. To do this, press SPACEBAR (spacebar). To change the value in this byte, type a new value after the current value. If you press SPACEBAR (spacebar) and move beyond the 8-digit limit, the Debug program will display a new line and a new address at the beginning of the line.

Return to the previous byte. To do this, press HYPHEN (-). You can repeatedly press the HYPHEN key (-) to move backwards more than multiple bytes. When you press HYPHEN, Debug starts a new line and displays the current address and byte values.

Stop executing the e command. To do this, press ENTER. You can press ENTER at any byte position.

Use the list parameter

If you specify a value for the list parameter, the subsequent e command replaces the existing byte value with the value in the list. If an error occurs, no byte value will be changed.

The List value can be a hexadecimal byte or string. Use spaces, commas, or tabs to separate values. The string must be enclosed in single or double quotation marks.

Example

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 the value to 41, type 41 at the insertion point, as follows:

04BA:0100 EB.41_

You can type consecutive byte values with an e command. Press SPACEBAR (Spacebar) instead of ENTER after typing the new value. Debug displays the next value. In this example, if you press SPACEBAR (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 the decision value of 10 should be 6F. To correct this value, press HYPHEN 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 to change the value at the insertion point, as follows:

04BA:0101 10.6f_

Press ENTER to stop the e command and return to the Debug prompt.

Here is an example of a string entry:

Eds:100 "This is the text example"

The string will be filled with 24 bytes starting with DS:100

Debug:F (fill)

Populates the address in the specified memory area with the specified value.

You can specify data in hexadecimal or ASCII format. Any data previously stored in the specified location will be lost.

F range list

Parameters.

Range

Specify the start and end addresses, or the start address and length, of the memory area to be populated. For information about valid range values, see the Debug description.

List

Specify the data to import. List can consist of hexadecimal numbers or strings enclosed in quotation marks.

Description

Use the range parameter

If range contains more bytes than the number in list, Debug will repeatedly assign values in list until all bytes in range are filled.

If any memory in range is corrupted or does not exist, Debug displays an error message and stops the f command.

Use the list parameter

If list contains more values than the number of bytes in range, Debug ignores the extra values in list.

Example

Suppose you type the following command:

F04ba:100l100 42 45 52 54 41

In response, Debug populates the memory location from 04BA:100 to 04BA:1FF with the specified value. Debug repeats these five values until all 100h bytes are filled.

Debug:G (steering)

Run the program that is currently in memory.

G [= address] [breakpoints]

Parameters.

= address

Specifies the address of the program currently in memory to start execution. If you do not specify address,Windows 2000, the program starts at the current address in the CS:IP register.

Breakpoints

Specify 1 to 10 temporary breakpoints that can be set to the part of the g command.

For information about executing loops, repeated string instructions, software interrupts, or subroutines, see Debug P (execution).

For information about executing instructions, see Debug T (tracking)

Debug:H (hexadecimal)

Performs a hexadecimal operation on the two specified parameters.

H value1 value2

Parameters.

Value1

Represents any hexadecimal number in the range from 0 to FFFFh.

Value2

Represents the second hexadecimal number from 0 to FFFFh.

Description

Debug first adds the two specified parameters and then subtracts the second parameter from the first parameter. The results of these calculations are shown on one line: sum is calculated first, and then the difference is calculated.

Example

Suppose you type the following command:

H29f 10a

Debug performs the operation and displays the following results.

02A9 0095

Debug:I (input)

Reads and displays a byte value from the specified port.

I port

Parameters.

Port

Specify the input port by address. The address can be a 16-bit value.

For information about sending byte values to the output port, see Debug O.

Example

Suppose you type the following command:

I2f8

It is also assumed that the byte value of the port is 42 hours. Debug reads the byte and displays its value as follows:

forty-two

Debug:L (load)

Loads the contents of a file or a specific disk sector into memory.

To load the number of bytes specified in the BX:CX register from a disk file, use the following syntax:

L [address]

To skip 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 in which to load the contents of the file or sector. If you do not specify address,Debug, the current address in the CS register will be used.

Drive

Specifies the drive that contains the disk that reads the specified sector. The value is numerical: 0 = A, 1 = B, 2 = C, etc.

Start

Specifies the hexadecimal number of the first sector whose contents you want to load.

Number

Specifies the hexadecimal number of contiguous sectors whose contents you want to load. The drive, start, and number parameters can be used only if you want to load the contents of a specific sector instead of the file specified in the debug command line or the most recent Debug n (name) command.

For information about the files specified for the l command, see Debug n (name).

For information about writing files that are debugged to disk, see Debug w (write).

Be careful

Use the l command with no arguments

When you use the l command with no arguments, the file specified on the debug command line is loaded into memory, starting with the address CS:100. Debug sets both the BX and CX registers to the number of bytes loaded. If you do not specify a file on the debug command line, the loaded file will be the one you have recently specified frequently with the n command.

Use the 1 command with the address parameter

If you use the l command with the address parameter, Debug will load the file or specify the contents of the sector from the memory location address.

Use the l command with all parameters

If you use the l command with all parameters, Debug loads the contents of the specified disk sector instead of the file.

Load the contents of a specific sector

Each sector in the specified range is read from drive. Debug loads from start until all of the contents of the number of sectors specified in number are loaded.

Load .exe file

Debug ignores the address address parameter of the .exe file. If you specify an .exe file, Debug relocates the file to the load address specified in the title of the .exe file. Before the .exe file is loaded into memory, the title itself is detached from the .exe file, so the size of the .exe file on disk is different from that in memory. If you want to check the entire .exe file, rename the file with a different extension.

Open hexadecimal file

Debug considers files with a .hex extension to be in hexadecimal format. Type the l command with no arguments to load the hexadecimal file that starts 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.

Example

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 with a starting logical sector of 15 (0Fh) from drive C into memory with the starting address 04BA:0100. To do this, type the following command:

L04ba:100 2 0f 6d

Debug:M (Mobile)

Copy the contents of one memory block to another.

M range address

Parameters.

Range

Specify the start and end address, or start address and length of the memory area to copy.

Address

Specify the starting address to which you want to copy the range content.

Description

Impact of replication operations on existing data

If the new data is not written to the address in the block being replicated, the source data remains the same. However, if the target block already contains data (as it does in an overwrite copy operation), the data will be overwritten. (overwrite replication operations refer to those operations in which the contents of the target block cover the contents of the original block. )

Perform an overwrite copy operation

The m command performs an overwrite copy of the destination address without losing data. Copy the contents of the rewritten address first. Therefore, if the data of the higher address is copied to the lower address, the copy operation starts from the lowest address of the original block and proceeds to the highest address. Conversely, if you want to copy data from a low address to a high address, the copy operation starts from the highest address of the original block to the lowest address.

Example

Suppose you type the following command:

Mcs:100 110 cs:500

Debug first copies the contents of the CS:110 address to the address CS:510, and then copies the contents of the CS:10F address to the CS:50F until the contents of the CS:100 address are copied to the address CS:500. To see the results, use the Debug d (dump) command and use the m command to specify the destination address

Debug:N (name)

Specify the name of the executable for the Debug l (load) or w (write) command, or specify the parameters of the executable being debugged.

N [drive:] [path] filename

To specify the parameters of the executable file for the test, use the following syntax:

N file-parameters

Parameters.

If used without parameters, the n command clears the current specification.

[drive:] [path] filename

Specify the location and name of the executable to test.

File-parameters

Specify parameters and switches for the executable you are testing.

For information about loading the contents of a file or specified disk sector into memory, see Debug L (load).

For information about writing files that are debugged to disk, see Debug W (write).

Description

Two uses of the n command

You can use the n command in two ways. First, you can use it to specify the file to be used by subsequent l (load) or w (write) commands. If you start Debug without naming the debug file, you must use the command nfilename before using the l command to load the file. Format the file name correctly for the file control block (FCB) in CS:5C. Second, you can use the n command to specify command-line parameters and switches for the file being debugged.

Memory area

The following four areas of memory are affected by the n command:

Memory location

Content

CS:5C

File control blocks for file 1 (FCB)

CS:6C

File control blocks for file 2 (FCB)

CS:80

Length of n command line (in characters)

CS:81

The beginning of the n command line character

The first file name specified for the n command is placed in the FCB of CS:5C. If you specify a second file name, it is placed in the FCB of CS:6C. The number of characters typed on the n command line (except the first character, n) is stored at the location CS:80. The actual characters on the n command line (again, except for the letter n) are stored at the beginning of the CS:81. Note that these characters can be any valid switches and delimiters in commands typed at the Windows 2000 command prompt.

Example

Assume that Debug has been started and the program Prog.com that you are debugging is 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 (turn) 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 usual runtime environment of Prog.com.

In the following command sequence, the first n command specifies File1.exe as the file followed by the 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, just as you typed File1 File2.dat File2.dat on the Windows 2000 command line.

Nfile1.exe

L

Nfile2.dat file3.dat

G

Be careful

Do not use the l command after the second form of the n command. Also note that if you use the w (write) command now, Windows 2000 will save the file File1.exe you are debugging with the name File2.dat. To avoid this result, always use the first form of the n command immediately before the l or w command.

Debug:O (output)

Sends the byte value to the output port.

O port byte-value

Parameters.

Port

Specify the output port by address. The port address can be a 16-bit value.

Byte-value

Specifies the byte value to point to port.

For information about reading byte values from the input port, see Debug I.

Example

To send the byte value 4Fh to the output port with the address 2F8h, type:

O2f8 4f

Debug:P (execution)

Execute loops, repeated string instructions, software interrupts or subroutines, or trace through any other instruction.

P [= address] [number]

Parameters.

= address

Specify the first location to execute the instruction. If no address is specified, the default address is the current address specified in the CS:IP register.

Number

Specifies the number of instructions to execute before returning control to Debug. The default value is 1.

For information about running a program that is currently in memory, see Debug G.

For information about executing instructions, see Debug T (tracking).

Description

Control is transferred to the program to be tested

When the p command transfers control from Debug to the program to be tested, the program runs uninterrupted until it loops, repeats string instructions, software interrupts, or completes subroutines at the specified address, or until a specified number of machine instructions are executed. Control returns to Debug.

Restrictions on address parameters

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 starts execution at the address specified in the CS:IP register. You must use an equal sign (=) 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 works the same as the Debug t (trace) command.

Messages displayed using the p command

When p finishes executing a description, Debug displays the register content of the program, the status of the flag, and the decoded form of the next instruction to be executed.

Warning

You cannot use the p command to track read-only memory (ROM).

Example

Suppose the program you are testing contains a call instruction at the address CS:143F. To run the subroutine of the call target location and return control to Debug, type:

Pendant 143f

Debug displays the results 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 (exit)

Stop the Debug session without saving the file for the current test.

When you type Q, control the command prompt returned to DOS.

Q

Parameters.

This command takes no parameters.

For information about saving files, see Debug W (write).

Debug:R (register)

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 register name whose contents you want to display.

For information about displaying the memory portion, see Debug D (dump).

For information on disassembly bytes, see Debug U (disassembly).

Description

Use the r command

If a register name is specified, Windows 2000 displays the 16-bit value of the register in hexadecimal notation and displays the colon as a prompt. If you want to change the value contained in the register, unless you type a new value and press ENTER; otherwise, press ENTER to return to the Debug prompt.

Valid register name

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 instruction pointers.

If you specify a register name instead of from the previous list, Windows 2000 displays the following message:

Br error

Use f characters instead of register names

If you type the f character instead of the register name, Debug displays the current setting for each tag as a two-letter code, followed by a Debug prompt. To change the settings of the flag, type the appropriate two-letter code from the following table:

Flag name

Set up

Clear

Spillover

Ov

Nv

Direction

Dn (minus)

Up (added)

Interrupt

Ei (enabled)

Di (disabled)

Plus or minus

Ng (negative)

Pl (positive)

zero

Zr

Nz

Auxiliary carry

Ac

Na

Parity check

Pe (parity check)

Po (odd parity)

Carry

Cy

Nc

You can type new flag values in any order. There is no need to leave a space between these values. To stop the r command, press ENTER. Any flags that do not specify a new value remain unchanged.

Messages displayed with the r command

If more than one value is specified for the tag, Debug displays the following message:

Df error

If you specify a flag code that is not listed in the previous table, Debug displays the following message:

Bf error

In both cases, Debug ignores all settings specified after the invalid project.

Default settings for Debug

When Debug is started, the segment register is 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 for the sp set to FFEEh.

Debug:R

Example

To view the contents of all registers, the status of all tags, and the instruction decoding table for the current location, type:

R

If the current location is CS:11A, the display will look like 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 flag, type:

Rf

Debug displays information in the following format:

NV UP DI NG NZ AC PE NC-_

You can now 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 see the changes, type the r or rf command. The Debug displays the following:

NV UP EI PL NZ AC PE CY-_

Press ENTER to return to the Debug prompt.

Debug:S (search)

A pattern that searches for one or more byte values in an address range.

S range list

Parameters.

Range

Specify the start and end addresses of the scope you want to search.

List

Specifies the pattern of one or more byte values, or the string to search for. Separate each byte value from the next byte value with a space or comma. Enclose the string value in quotation marks.

Description

If the list parameter contains more than one byte value, Debug displays only the first address where the byte value appears. If list contains only one byte value, Debug displays all addresses that appear in the specified range.

Example

Suppose you need to find all addresses that contain a value of 41 and range from CS:100 to CS:110. To do this, type the following command:

Scs:100 110 41

Debug displays the results in the following format:

04BA:0104

04BA:010D

-

The following command searches for the string "Ph" from CS:100 to CS:1A0.

Scs:100 1a0 "Ph"

Debug:T (tracking)

(the SORRY,Debug:T section is temporarily missing. If any netizen has this section, please let me know.)

AoGo added:

The specified number of code is executed from the current segment address, and the values of all registers (including flag registers) are displayed for each execution.

Such as: t 10

Assuming that you are currently in CS:100, 10 lines of code will be executed from CS:100, and the register changes after each line of code will be displayed.)

Debug:U (disassembly)

Disassembles bytes and displays the corresponding original statement, including address and byte values. The disassembly code looks like a list of assembled files.

U [range]

Parameters.

None

If used with no parameters, the u command decomposes 20h bytes (the default), starting with the first address after the address shown in the previous u command.

Range

Specify the start address and end address of the code to disassemble, or the start address and length.

For information about integrated memory codes, see Debug A (compilation).

For information about displaying the memory portion, see Debug D (dump).

Example

To disassemble 16 (10h) bytes, starting with the address 04BA:0100, type:

U04ba:100l10

Debug displays the results 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 only the information from 04BA:0100 to a specific address of 04BA:0108 is displayed, 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)

AoGo: valid only for COM, because EXE has relocation information, and Debug cannot generate relocation information, so it cannot be written to EXE.

Writes a file or a specific partition to disk.

To write the specified number of bytes in the BX:CX register to the disk file, use the following syntax:

W [address]

To skip the Windows 2000 file system and write directly to a specific sector, 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 you do not specify the address,Debug program, it will start with CS:100.

Drive

Specifies the drive that contains the target disk. The value is numerical: 0 = A, 1 = B, 2 = C, and so on.

Start

Specifies the hexadecimal number to write to the first sector.

Number

Specifies the number of sectors to write.

For information about the files specified for the w command, see Debug N (name).

For information about loading the contents of a file or file sector into memory, see Debug L (loading).

Description

You must specify the name of the disk file when you start Debug or in the most recent Debug n (name) command. Both methods can correctly format the file name of the file control block at the address CS:5C.

Reset BX:CX before using the w command with no parameters

If you use the Debug g (turn), t (trace), p (execute), or r (register) commands, you must reset the BX:CX registers before using the no-argument w command.

Write the modified file to disk

If you modify the file without changing the file name, length, or starting address, Debug can still correctly write the file to the source disk location.

Restrictions on the w command

You cannot write .exe or .hex files with this command.

Warning

Writing to a specific partition is dangerous because the Windows 2000 file handle is skipped. If you type the wrong value, the disk file structure is easily corrupted.

Example

Suppose you want to write the contents of memory with the starting address of CS:100 to the disk of drive B. You need to start the data from the disk's logical sector number 37h and continue 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 extended memory)

Allocates the specified number of pages for extended memory.

To use extended memory, an extended memory device driver that conforms to the version 4.0 Lotus/Intel/Microsoft extended memory Specification (LIM EMS) must be installed.

Xa [count]

Parameters.

Count

Specifies the number of 16KB pages of extended memory to allocate.

For information about other Debug commands that use extended memory, see Debug XD (freeing extended memory), Debug XM (mapping extended memory pages), or Debug XS (showing extended memory status).

Description

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

Example

To allocate 8 pages of extended memory, type:

Xa8

If the command is successful, Debug displays a message similar to the following:

Handle created=0003

Debug:XD (free extended memory)

Release the handle to extended memory.

To use extended memory, an extended memory device driver that conforms to the version 4.0 Lotus/Intel/Microsoft extended memory Specification (LIM EMS) must be installed.

Xd [handle]

Parameters.

Handle

Specifies the handle to release.

For information about other Debug commands that use extended memory, see Debug XA (allocate extended memory), Debug XM (Map extended memory pages), or Debug XS (Show extended memory status).

Example

To release handle 0003, type:

Xd 0003

If the command is successful, Debug displays the following message:

Hdle 0003 deallocated

Debug:XM (mapping extended memory pages)

Maps an extended memory logical page that belongs to the specified handle to a physical page that extends memory.

To use extended memory, an extended memory device driver that conforms to the version 4.0 Lotus/Intel/Microsoft extended memory Specification (LIM EMS) must be installed.

Xm [lpage] [ppage] [handle]

Parameters.

Lpage

Specifies the logical page number of the extended memory to map to the physical page ppage.

Ppage

Specifies the physical page number to which the lpage is mapped.

Handle

Specifies the handle.

For information about other Debug commands that use extended memory, see Debug XA (allocate extended memory), Debug XD (free extended memory), or Debug XS (Show extended memory).

Example

To map logical page 5 of handle 0003 to physical page 2, type:

Xm 5 2 0003

If the command is successful, Debug displays the following message:

Logical page 05 mapped to physical page 02

Debug:XS (shows extended memory status)

Displays information about the state of extended memory.

To use extended memory, an extended memory device driver that conforms to the version 4.0 Lotus/Intel/Microsoft extended memory Specification (LIM EMS) must be installed.

Xs

Parameters.

This command takes no parameters.

For information about other Debug commands that use extended memory, see Debug XA (allocate extended memory), Debug XD (free extended memory), or Debug XM (map extended memory pages).

Description

The information displayed by Debug is in 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

Example

To display extended memory information, type:

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

At this point, the study of "what are the DEBUG commands" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report