Using the Debug Program

From docs
Jump to navigation Jump to search

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