Debug [[drive:][path]file.ext [testprog arguments]]This is a relatively advanced DOS tool but has many uses. For instance, it can be used to:
[drive:][path]file.ext The name of the executable you wish to debug. It doesn't have to be an executable - it could be a binary or text file. Since it can be any file, the file extension has to be specified. testprog arguments These arguments will be passed to the executable that is being debugged as command line options, if and when it is run. See Program Execution below for more information on running executables.
Once Debug is started, the Debug command prompt is displayed. Enter Q to quit Debug, and ? to display the list of Debug commands.
Debug uses hexadecimal (base 16).
Memory addresses are displayed in segment:offset form, e.g. 0D00:0100. The last four hexadecimal digits, which specify the offset from the segment, can go from 0000 to FFFF, a range of 64 Kilobytes.
Executables with the .com extenstion have all their data and code in one segment. Hence for .com files, you can usually just write the offset when specifying memory addresses in Debug commands. Debug will assume the program segment. The same is also true of text/binary files that are <64K long.
To specify a memory range, seperate two addresses with a comma.
For those who have used Debug before but are migrating from a different version of DOS, the following document has been prepared: debug.doc
quit Q help ?
compare C range address Compares two memory ranges, displaying the differences. Only the starting address of the second range is required, Debug will assume the second range will be the same size as the first. For instance C 100,110 200 will compare the range 100,110 to 200,210. dump D [range] Displays the contents of a memory range. If no range is specified, dump will display 128 bytes, starting where the last dump finished or at the beginning of the loaded file. enter E address [list] Write over part of memory, beginning at address, with the list of bytes. To enter a string of text characters, enclose the text in double quotes. For instance E 100 "Hello!" fill F range list Write over a memory range with a repeating list of bytes. For instance, to set a memory range to zero, you might put E 100,110 0 and to set a memory range to "brumbrum": E 100,107 "brum" move M sourcerange destaddress Copies the range sourcerange into another range that begins at destaddress. search S range list Searches for all occurences of the list of bytes in the specified range. The starting address of each occurence is displayed.
hex H value1 value2 Displays two numbers, the first being value1+value2, the second being value1-value2.
load program or file L [[drive:][path]progname [arglist]] Set Name N [[drive:][path]progname [arglist]] Set the name for the current file/prgoram Write program or file W Writes the current program/file to disk. Use N to change the name if you do not wish to overwrite the original file.
assemble A [address] unassemble U [range] 80x86 mode M[setting] Sets the CPU (processor) mode: the setting is in the range 1-6. 1 is for 80186, 2 for 80286 etc. If no setting is specified, the current setting is displayed This setting is reset when Debug quits. FPU mode MC MNC Sets whether the floating point maths coprocessor is present or not. Use MC to set it to present, MNC to set it to present. Use M to enquire about the current setting.
go G [=address] [breakpoints] Begins execution of the loaded program or the machine code at the specified address. Execution is suspended at the breakpoint addresses, allowing you to inspect memory etc. proceed P [=address] [count] Proceeds with execution in steps. register R [register [value]] display all CPU registers, or display/set a particular register. trace T [=address] [count]
input I port output O port byte