Difference between revisions of "Using the Debug Program"
Jump to navigation
Jump to search
Numberformat (talk | contribs) (Created page with "DOS comes with a program named DEBUG that is used for testing and debugging executable programs. It displays all program code and data in hex format. === Commands === * A...") |
Numberformat (talk | contribs) |
||
Line 15: | Line 15: | ||
* U - Unassemble machine code into symbolic code | * U - Unassemble machine code into symbolic code | ||
* W - Write a program into disk | * W - Write a program into disk | ||
+ | |||
+ | === Examples === | ||
+ | |||
+ | <pre> | ||
+ | ;Check the ROM BIOS date | ||
+ | |||
+ | D FFFF:5 | ||
+ | |||
+ | |||
+ | ;Enter a Program | ||
+ | |||
+ | -E CS:1OO B8 23 01 05 25 00 | ||
+ | -E CS:106 8B D8 03 D8 8B CB | ||
+ | -E CS:10C 2B C8 2B CO 90 | ||
+ | |||
+ | - R to run | ||
+ | |||
+ | - R IP 100 - to reset to the beginning | ||
+ | |||
+ | - D to display | ||
+ | |||
+ | A - Assemble | ||
+ | |||
+ | A 100 <Enter> | ||
+ | MOV CL,42 | ||
+ | MOV DL,2A | ||
+ | ADD CL,DL | ||
+ | NOP | ||
+ | |||
+ | U - Unassemble | ||
+ | U 100,106 | ||
+ | |||
+ | ; Get the current date | ||
+ | A 100 | ||
+ | MOV AH,2A | ||
+ | INT 21 | ||
+ | NOP | ||
+ | R IP 100 | ||
+ | R | ||
+ | P | ||
+ | ; The registers will contain the date | ||
+ | AL: Day of the week | ||
+ | CX: Year | ||
+ | DH: Month (01H through 0CH) | ||
+ | DL: Day of month | ||
+ | </pre> |
Latest revision as of 11:17, 19 February 2022
DOS comes with a program named DEBUG that is used for testing and debugging executable programs. It displays all program code and data in hex format.
Commands
- A - Assemble symbolic instructions into machine code
- D - Display the contents of an area of memory
- E - Enter data into memory, beginning at a specific location
- G - Run the executable program in memory
- N - Name a program
- P - Proceed, or execute a set of related instructions
- Q - Quit the debug session
- R - Display the contents of one or more registers
- T - Trace the execution of one instruction
- U - Unassemble machine code into symbolic code
- W - Write a program into disk
Examples
;Check the ROM BIOS date D FFFF:5 ;Enter a Program -E CS:1OO B8 23 01 05 25 00 -E CS:106 8B D8 03 D8 8B CB -E CS:10C 2B C8 2B CO 90 - R to run - R IP 100 - to reset to the beginning - D to display A - Assemble A 100 <Enter> MOV CL,42 MOV DL,2A ADD CL,DL NOP U - Unassemble U 100,106 ; Get the current date A 100 MOV AH,2A INT 21 NOP R IP 100 R P ; The registers will contain the date AL: Day of the week CX: Year DH: Month (01H through 0CH) DL: Day of month