Debug Command details

Source: Internet
Author: User
Debug: A (assembly)

Directly merge the 8086/8087/8088 Memory code into the memory.

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

A [address]

Parameters

Address

Specifies the location where the assembly language instruction is entered. Use a hexadecimal value for address and type each value that does not end with the character "H. If no address is specified, a starts assembly at the last stop.

For information about inputting data into a specified byte, see debug E (type ).

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

Description

Use the Memory code

The alternative Memory code of the segment is 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, movsw can be used to move 16-bit strings and movsb can be used to move 8-bit byte strings.

Assembly jump and call

The assembler automatically assembles short, near and far jumps and calls to the target address based on the replacement of bytes. You can use the near or far prefix to replace such a jump or call, 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

You can abbreviated the near prefix as ne.

Differentiate characters and byte memory locations

When an operand can reference a word memory location or byte memory location, you must use the prefix word PTR or byte PTR to specify the data type. Acceptable abbreviations are wo and. The following example shows two formats:

Dec WO [Si]
Neg byte PTR [128]

Specified operand

Debug uses the memory address referenced by the operands included in brackets. This is because debug cannot distinguish between the immediate operand and the memory address operand. The following example shows two formats:

MoV ax, 21; load ax with 21 h
MoV ax, [21]; load ax with
; Contents
; Memory location 21 h

Use pseudoinstructions

Use the command to provide two commonly used pseudo commands: db operation code, which assembles byte values directly into the memory, DW operation code, and word values directly into the memory. The following are examples of two pseudo commands:

DB 1, 2, 3, 4, "This is an example"
DB ''' this is a quotation mark :"''''
DB "this is a quotation mark :''''"
DW 3000, "Bach"

Example

Command a 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 operation code synonyms are also supported, as shown in the following example:
Loopz 100
Loope 100
Ja 200
Jnbe 200

For the 8087 operation code, 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 (comparison) FF

Compare two parts of the memory.

C range address

Parameters

Range

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

Address

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

Description

If the range and address memory regions are the same, debug returns directly to the debug prompt without displaying any content. If there are differences, debug will be displayed in the following format:
Address1 byte1 byte2 addess2

Example

The following command has the same effect:

C100, 10f 300
C100l10 300

Each Command compares the memory data blocks of 100 h to 10 FH with those of 300 h to 30 FH.

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 the addresses 197f: 0106 and 197f: 0306 are missing in the list. This indicates that the values in the addresses are the same.

Debug: D (dump)

Display the content of a certain range of memory addresses.

D [range]

Parameters

Range

Specify the start and end addresses, or the start address and length of the memory area where the content is to be displayed. If range is not specified, the debug program displays 128 bytes of content starting from the end of the address range specified in the previous D command.

For information about the display register content, see debug R (register ).

Description
When the D command is used, debug displays the memory content in two parts: the hexadecimal part (the value of each byte is expressed in hexadecimal format) and ASCII code (each byte value is represented by ASCII characters ). Each non-printable character is represented by a period (.) In the displayed ASCII section. Each display line displays 16 bytes of content, with a hyphen between 8th bytes and 9th bytes. Each display line starts at the boundary of 16 bytes.

Example
Run the following command:
DCs: 100 10f
Debug displays the content in the following format:
04ba: 0100 54 4f 4D 00 53 41 57 59-45 52 00 00 00 00 00 Tom. Sawyer ......
If you enter the D command without parameters, debug orchestrates the display format according to the content described in the previous example. The displayed line starts with a address that is 16 bytes larger than the address of the previous line (if the screen of 40 columns is displayed, It is 8 bytes.
For each d command without Parameters entered later, debug displays the byte content immediately after the last command is displayed.
If you type the following command, debug displays 20 h bytes of content starting from CS: 100:
DCs: 100 l 20
If you type the following command, debug displays all bytes in the range from 100 h to 115 h in the CS segment:
DCs: 100 115

Debug: E (type)

Input data to the address specified in the memory.
You can enter data in hexadecimal or ASCII format. All data previously stored at the specified location is lost.

E Address [LIST]

Parameters
Address
Specify the first memory location of the input data.
List
Specifies the data in consecutive bytes to be input into the memory.
For information on integrated memory codes, see debug a (assembly ).
For information on displaying part of the memory, see debug D (dump ).

Description

Use address parameters

If you specify the address value without specifying the optional list parameter value, debug displays the address and content, repeat the address in the next line, and waits for your input. In this case, you can perform one of the following operations:

Replace the byte value. To do this, enter a new value after the current value. If the entered value is not a valid hexadecimal value or contains more than two numbers, debug does not display invalid or additional characters.
Enter the next byte. Therefore, Press spacebar (Space key ). To change the value in this byte, enter a new value after the current value. If you press the spacebar (Space key) and the Movement exceeds the 8-bit limit, the debug program displays a new line and a new address at the beginning of the line.
Returns the first byte. Therefore, press the hyphen key (-). You can repeatedly press the hyphen key (-) to move more than one byte backward. When you press hyphen, debug starts a new line and displays the current address and byte value.
Stop executing the e command. Therefore, press Enter. You can press enter at any byte location.
Use LIST Parameters

If the value of the List parameter is specified, 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. Strings must be included in single or double quotation marks.

Example

Run the following command:

ECS: 100

Debug displays the content of the first byte in the following format:

04ba: 0100 EB.

To change the value to 41, type 41 at the insertion point, as shown below:

04ba: 0100 eb.41 _

You can use an e command to Type Continuous byte values. Press spacebar (Space key) instead of enter after you type a new value. 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 shown below:

04ba: 0100 eb.41 10. 00. bc.42 _

Assume 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 content:

04ba: 0100 eb.41 10. 00. bc.42-
04ba: 0102 00 .-
04ba: 0101 10 ._

At the insert point, type 6f to change the value, as shown below:

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:

EDS: 100 "this is the Text Example"

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

Debug: F (fill)

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

Data in hexadecimal or ASCII format can be specified. 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 filled. For more information about valid range values, see "Debug description ".

List

Specify the data to be input. A list can be a string consisting of hexadecimal numbers or quotation marks.

Description

Use range parameter

If the number of bytes in a range is greater than the value in the list, debug assigns a value repeatedly in the list until all bytes in the range are filled.

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

Use LIST Parameters

If the list contains more values than the number of bytes in the range, debug ignores the additional values in the list.

Example

Run the following command:

F04ba: 100l100 42 45 52 54 41

In response, debug uses the specified value to fill the memory position from 04ba: 100 to 04ba: 1ff. Debug repeats these five values until 100 h bytes are fully filled.

Debug: G (redirection)

Run the program in the memory.

G [= address] [breakpoints]

Parameters

= Address

Specifies the address of the program to be executed in the memory. If address is not specified, Windows 2000 runs the program from the current address in the Cs: IP Address Register.

Breakpoints

Specify 1 to 10 temporary breakpoints that can be set as part of the G command.>
For information on execution cycles, repeated string commands, software interruptions, or subroutines, see debug P (execution ).

For information on executing commands, see debug T (Tracking)

Debug: H (hexadecimal)

Perform the hexadecimal operation on the specified two parameters.

H value1 value2

Parameters

Value1

Represents any hexadecimal number from 0 to ffffh.

Value2

Represents the second hexadecimal number in the range from 0 to ffffh.

Description

Debug first adds the specified two parameters, and then removes the second parameter from the first parameter. The calculation results are displayed in one row: Calculate the sum first, and then calculate the difference.

Example

Run the following command:

H19f 10a

Debug executes the operation and displays the following results.
02a9 0095

Debug: I (input)

Reads data from the specified port and displays a byte value.

I Port

Parameters

Port

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

For information on sending the byte value to the output port, see debug O (output ).

Example

Run the following command:

I2f8

It is also assumed that the port's byte value is 42 h. Debug reads the byte and displays the value as follows:
42

Debug: L (load)

Load the content of a file or a specific disk sector to the memory.

To load the 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 directly load a specific sector, use the following syntax:

L address drive start number

Parameters

Address

Specify the memory location where the file or slice content is to be loaded. If no address is specified, debug uses the current address in the CS register.

Drive

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

Start

Specify the hexadecimal number of the first slice to load its content.

Number

Specify the hexadecimal number of consecutive slices to load. You can use the drive, start, and number parameters only when you want to load the content of a specific sector rather than the Files specified in the DEBUG command line or the latest debug N (name) command.

For information about the file used for the l command, see debug N (name ).

For information on writing debugging files to the disk, see debug W (write ).

Note:

Use the l command without Parameters
When the l command without parameters is used, the files specified on the DEBUG command line will be loaded into the memory, starting from the address Cs: 100. Debug sets the Bx and CX registers as the number of loaded bytes at the same time. If you do not specify a file in the DEBUG command line, the mounted file will be the file that is frequently specified by the recent 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 the content of the specified 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 content of the specified disk sector instead of the file.

Load content of a specific slice

Each sector within the specified range is read from drive. Debug is loaded from start until all the content in the specified number of slice is loaded.

Load the. exe file

Debug ignores the address parameter of the. exe file. If the. exe file is specified, debug locates the file again to the load address specified in the title of the. exe file. Before the. exe file is loaded to the memory, the title itself is detached from the. exe file. Therefore, the size of the. exe file on the disk is different from that in the memory. If you want to check the entire. EXE file, use different extensions to rename the file.

Open a hexadecimal File

Debug considers files with the. HEX extension as hexadecimal files. Type an l command without parameters to load the hexadecimal file starting from the address specified in the hexadecimal file. If the entered l command contains the address parameter, debug adds the specified address to the address found in the hexadecimal file to determine the start address.

Example

Run the following command to start Debug:

Nfile.com

Now you can type the l command to load file.com. Debug loads the file and displays the debug prompt.

Assume that the content of the 109 (6DH) Sector of the starting logical sector of 15 (0fh) needs to be loaded to the memory with the starting address 04ba: 0100 from drive C. To do this, enter the following command:
L04ba: 100 2 0f 6d

Debug: m (mobile)

Copy the content in one memory block to another.

M range address

Parameters

Range

Specify the start and end addresses, or the start address and length of the memory area of the content to be copied.

Address

Specifies the starting address for copying the range content to this location.

Description

Impact of replication on existing data

If the new data is not written to the address of the data block being copied, the source data remains unchanged. However, if the target block already contains data (just as it is in the overwriting copy operation), the data will be rewritten. (Overwriting a copy operation refers to an operation where the content of the target data block overwrites the content of the original data block .)

Overwrite Replication

Run the M command to overwrite the replication operation of the target address without losing data. Copy the modified address content first. Therefore, if you copy data from a higher address to a lower address, the copy operation starts from the lowest address of the original block and proceeds to the highest address. 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 and starts from the lowest address.

Example

Run the following command:
> MCS: 100 110 Cs: 500
Debug first copies the content in the Cs: 110 address to the address Cs: 510, and then copies the content in the Cs: 10f address to the Cs: 50f address until the Cs: copy the content from the address 100 to the address Cs: 500.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.