Back to x86 Assembly home

Debug commands A C D E F G H I L M N O P Q R S T U W ?

A-Assemble 8086/8088 mnemonics.
C-Compare two areas of memory.
D-Display contents of memory locations.
E-Enter data into memory locations.
F-Fill memory locations with values.
G-Run a program from within debug.
H-Perform Hexadecimal math on two Hex numbers.
I-Read one byte of data from a specified port.
L-Load contents of a disk file or sectors into memory.
M-Move or copy contents of memory locations.
N-Name a file for the L or W command. (load or write)
O-Output one byte of data to a specified port.
P-Execute a loop, a repeated string instruction, a software interrupt, or a subroutine.
Q-Quit (close Debug)
R-Display or modify content of CPU registers.
S-Search contents of memory for the specified string of data.
T-Executes one instruction at a time and dumps the contents of all the registers to the screen, then displays the next instruction to be executed.
U-Disassemble machine code into mnemonic form of the program.
W-Write data in memory to disk. The name given the file is the name entered with the n (name) command. The file size is given by setting the BX:CX register to the number of bytes to be saved.
?-Displays help screen on some versions of Debug.


A (assemble) Assembles 8088/8086 mnemonics into memory. This command is used to create executable machine code from assembly-language statements. All numeric values are in hexadecimal form and can only have from 1 to 4 digits.

SYNTAX - A [address]

PARAMETER
address is the location where the assembly-language instruction will be stored. The address must be in Hexadecimal form and within the range of 0100-FFFF. If you don't specify an address, debug will default to the last address used.


C (compare) Compares two blocks of memory.

SYNTAX: C range address

PARAMETERS
range - is the starting and ending address, (or the start address and length) of the first block of memory to compare.

address - specifies the starting address of the second block of memory you want to compare.

 Example: C 100 220 500 compares the block of memory at offset 100 - 220 with the block startinnng at offset 500.

C 100 L 120 500 compares the block of memory at offset 100 for a length of 120 to the block of memory starting at 500.


D (dump) Displays or dumps the contents of memory onto the display.

SYNTAX D [range]

PARAMETER
range - is the starting and ending address (or starting address and length) of memory to be displayed. If range is not specified, debug will display 128 bytes starting at the end of the last address dumped. Memory contents are displayed in two portions: a hexadecimal (each byte value is shown in hex form) and an ASCII portion (each byte shown as an ASCII character).

D 100 10F


E (enter)
Enter data into specified memory location. You can enter data in hexadecimal or ASCII format. Any old data at the specified location will be lost and replaced with the new data.


SYNTAX E address [list]

PARAMETER
address - specifies the first location in memory where you want to enter data.

list - is data that you want to enter into memory.

Using the address parameter

If you enter an address but do not enter list, Debug will display the address and it's contents and will wait for you to enter new data. Now you can do one of these:

1) Replace the byte value with a new value in hex form. If the value you enter is invalid, Debug will inform you.

2) Advance to the next byte in memory. For this, press the space bar, and to change the value at the new location,  type a new value. If you press the space bar more than eight times, debug starts a new line.

3)  Return to the preceding byte. For this, press the hyphen ( - ) key. Each time you press hyphen, debug will go back in memory one byte.

4) Exit from the E command. To do this press the enter key.

Using the list parameter

When you enter list, old values will be replaced with the new value. list values can be in hexadecimal or string form. To enter string values, enclose the string within single or double quotes.

Example:

If you type,

E 100

debug displays the contents of offset 100

0A1F:0100 41._

To change this value you just type in the new value,

0A1F:0100 41.35

In this example, the value 41 at offset 100 was changed to 35.

Using one E command, you can enter several consecutive values. Instead of pressing Enter key after you change a value, just press the space bar and Debug will display the next location in memory, at which time you can enter a new value. Repeat this as many times as you need.


F (fill)

Fills the addresses in the specified memory locations with the value you specify. You can specify the data in hexadecimal or ASCII values.

SYNTAX F range list

PARAMETERS
range - is the starting and ending address, (or the starting address and the length) of the memory area you want to fill.

list - is the data you want to fill. Data can be hexadecimal or ASCII form. If you enter ASCII data, it must be   a string of text enclosed in quotes. "Like this"

Using range

If range contains more bytes than the number of values in list, debug assigns the values in list repeatedly until all bytes in range are filled. If any of the memory in the range specified is bad or doesn't exist, debug will return an error message to that affect.

Using list parameter

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


G (go)

Using the G command, you can execute a program that is in memory. This command uses the IP register as a pointer to the next instruction.

SYNTAX G [=address] [breakpoint]

PARAMETER
address -is the address where program execution will begin..
If  an address is not specified, Debug will execute the instruction which is pointed to by CS:IP registers.
If the program ends with an int 3 instruction, Debug will make the IP register point to the next instruction. However if the program ends with an int 20 instruction, the IP register again points to offset 100.

breakpoint - Specifies from 1 to 10 breakpoints that can be entered with the Go command.

Address

address must begin with an equal sign (=). This distinguishes the starting address from breakpoint address.

Breakpoint

The program stops at the first breakpoint that it encounters and dumps the contents of all registers, the status of the FLAGS and displays the last instruction that was executed.

Examples:

If you type,

G cs:200

debug will execute the program up to offset 200, then dump the contents of all the registers on the screen.

If you type,

G=cs:200

Debug will execute the program starting at offset 200 to the end of the program.

If you type,
G
Debug will get the address pf the next instruction to be executed using  CS:IP registers. Also, before using G, you must take a look at the IP register. Make sure that it is pointing to the next instruction you want to execute. Enter rip (return),  and Debug will display the current value in IP. You can enter a new value id you want. The IP register should always be at 0100 to run the entire program.


h (Hex)

This allows you to do math on hexadecimal values.

SYNTAX h value1 value2


PARAMETER
value1and value2 could be any hex number between 0000 - FFFFh.

Debug will add the two parameters you specify and then subtracts the second from the first. The results are displayed on one line. First the sum, then the difference.

If you type,

h FF 2C5

debug does the calculations and displays,

03C4 FE3A

03C4 is the sum and FE3A is the difference.


Back to x86 Assembly home