Computer debug routines

Updated: 11/12/2023 by Computer Hope
Warning

The following debug routines are listed to help test and view extended information on your computer. However, some can also damage computer components or cause them not to work properly. We are providing these routines as a reference. If these cause problems with the computer they are run on, Computer Hope is not responsible for your actions. We recommend only experienced computer users run these commands and that you are fully aware of the potential hazards of using these routines.

Debug basics

software debug

Debug is an MS-DOS command that enters machine language into the computer either to create programs or test computer peripherals by receiving back various computer machine code.

Note

Newer versions of Windows no longer include the debug command.

Understanding responses

Several of the debug routines listed on this page and other pages return responses in hexadecimal format. We recommend if you want to understand the code in these routines that you get familiar with hexadecimal. Information about hexadecimal and binary is available on our binary and hexadecimal page.

Possible issues

If, you receive ^error, this indicates you incorrectly typed something in the line. Typing the line again does not cause any problems with the routine.

Entering debug

Debug is included in every version of MS-DOS, and Windows up to Windows XP. When running any of the debug routines, we recommend if you have Windows that you exit or shut down to get to a real DOS prompt.

At the MS-DOS prompt, run the example below, which is only showing port information.

Type debug and press Enter.
At the debug prompt, - (small dash) type d40:00 and to get several lines of information.

(See: Testing ports for an explanation of this feedback.)

To exit out of debug, type q and press Enter to get back to the MS-DOS prompt.

In the debug routines below, you may see a g is typed, then q. The "g" tells the computer that the code type is not self-executing and must run at this point. If completed, the program returns "Program Terminated Normally," which indicates it's safe to quit from the debug program. The "q" quits debug.

Listing of routines

Testing ports

The below debug routine checks the ports of the computer to allow you to know if ports are detected or not.

Type debug to get to the "-"

Type D40:0

Once entered several lines should appear, the first line is the only important line, which should resemble:

0040:0000 F8 03 F8 02 E8 03 E8 02 - 78 03 78 02 BC 03
F8 03 F8 02 E8 03 E8 02 78 03 78 02 BC 03
COM1 COM2 COM3 COM4 LPT1 LPT2 LPT3

The above table explains each port, so if you see F8 03, it indicates COM1 is detected. If you see 00 00, the port is not detected, which could mean that hardware is bad or that it is disabled in CMOS.

Once you have finished looking at the information, type Q and press Enter to get out of debug.

Clear CMOS

The below debug routine clears CMOS, BIOS, passwords, settings, viruses, and other items residing in the CMOS. During this process, you may get returned characters that are an indication that the string was entered. If you get an ERROR, make sure you have typed the line incorrectly and that no lines are skipped.

After typing debug, you get "-" which is where to begin by typing A and pressing Enter.

A Enter
MOV AX,0 Enter
MOV AX,CX Enter
OUT 70,AL Enter
MOV AX,0 Enter
OUT 71,AL Enter
INC CX Enter
CMP CX,100 Enter
JB 103 Enter
INT 20 Enter
Enter Note: Nothing is typed on this line
G Enter When you press G the above script executes, make sure you read and agree to the above disclaimer.Q Enter

Then reboot, and Setup Checksum Error should be seen. Go into CMOS setup, correct all the incorrect values with the time and date.

Joystick test

The joystick debug test detects if a joystick is present or not.

Type debug from the DOS prompt once at the -.

i201

If you get an FF response, hold one of the main buttons on your joystick, and while holding the button down type i201 to get a different response. Each button on the joystick should return a different response.

Note

Joysticks with more than four to five buttons may not return a response for all extra buttons because these buttons are controlled through software.

If an FF is given for each button on the game paddle or joystick, either the joystick or port is bad. If possible, attempt these steps with another known working joystick.

However, if you are receiving different responses when pressing and holding the keys on the joystick, the computer hardware is working properly.

Type q and press Enter to quit out of debug.

Note

Computer Hope has experienced issues where this debug routine may not work under Windows NT. If you are currently running Windows NT, refer to our page for joystick installation procedures.

Erasing sector two

Erasing sector two is useful in clearing DDO and unknown partitions. If this routine completes successfully, it erases everything in sector two.

Note

Some computer hard drive manufacturers may void your warranty if this routine is run or in some situations, this can cause damage to the hard drive.

In the below debug routine, only type what is in bold. If you get a response continue to type the bold text as shown in the example below.

A:\>debug
-FCS:200 400 0Enter
-ACS:100Enter
-xxxx:0100 mov ax,302Enter
-xxxx:0103 mov bx,200Enter
-xxxx:0106 mov cx,2Enter
-xxxx:0109 mov dx, 80Enter
-xxxx:010a int 13Enter
-xxxx:010c int 20Enter
-xxxx:0110 Enter(without typing anything)
-g Enter
Program terminated normally.
-q Enter

Erase all hard drive information

In the below debug routine, only type what is in bold. If you get a response to continue to type the bold text, as shown in the example below.

Note

Some computer hard drive manufacturers may void your warranty if this routine is run or in some situations, this can cause damage to the hard drive.

A:\>debug Enter
-F 200 L1000 0 Enter
-A CS:100 Enter
xxxx:0100 MOV AX,301 Enter
xxxx:0103 MOV BX,200 Enter
xxxx:0106 MOV CX,1 Enter
xxxx:0109 MOV DX,80 Enter

(80 for hdd 0 or 81 for hdd 1 )

xxxx:010C INT 13 Enter
xxxx:010E INT 20 Enter
xxxx:0110 Enter
-g Enter
Program terminated normally
-qEnter

Once this debug routine is complete, reboot the computer, and all partitions should be erased. Before anything can be installed back onto the computer, you must run fdisk and recreate the partition and format the hard drive.

  • Additional information about fdisk is on our fdisk page.
  • Additional information about format is on our format page.

Erase the hard drive and clear CMOS

If this routine completes successfully, it erases everything from your hard drive, and resets the CMOS values.

Note

Some computer hard drive manufacturers may void your warranty if this routine is run or in some situations, this can cause damage to the hard drive.

In the below debug routine, type what is in bold. If you get a response to continue to type the bold text in the example below.

A:\>debug Enter
-fcs:200 400 0 Enter
-acs:100 Enter
-xxxx:010 0mov ax, 0 Enter
-xxxx:0103 mov ax, cx Enter
-xxxx:0105 out 70, al Enter
-xxxx:0107 mov ax, 0 Enter
-xxxx:010a out 71,al Enter
-xxxx:010c inc cx Enter
-xxxx:010d cmp cx,100 Enter
-xxxx:0111 jb 103 Enter
-xxxx:0113 mov ax,302 Enter
-xxxx:0116 mov bx,200 Enter
-xxxx:0119 mov cx,1 Enter
-xxxx:011c mov dx,80 Enter
-xxxx:011f int 13 Enter
-xxxx:012l int 20 Enter
-xxxx:0123 Enter (without typing anything.)
-g Enter
program terminated normally

If you are doing this debug routine to clear out a possible virus, turn off your computer, wait, and turn it back on.

-q Enter

Once back at DOS, reboot your computer.

When your computer comes back on from doing the above, an error message such as Invalid Configuration is displayed. Enter CMOS setup and set the time and date, save, and reboot again. Once rebooted, run fdisk and recreate the partitions. Once created, format the hard drive and proceed as normal.

Discharge old laptop batteries

The below debug routine is used for older laptop batteries (i.e., batteries made from 1990-1992), we do not recommend using this routine on any newer laptop batteries or any NiMH batteries.

N DPDISCHG.COM Enter
A Enter
MOV DX,01E8 Enter
MOV AL,F9 Enter
OUT DX,AL Enter
INT 20 Enter
Enter
RCX Enter
10 Enter
W Enter
Q Enter

The above script writes dpdischg.com to the current directory. To run this utility type dpdischg.

Reboot your computer

Implement this debug routine to reboot your computer.

DEBUG
E 40:72 34 12
RCS
FFFF
RIP
0000
G

To create a batch file that reboots your computer without having to type the above command, use the example below.

GOTO BEGIN

E 40:72 34 12
RCS
FFFF
RIP
0000
G

:BEGIN
DEBUG < REBOOT.BAT

Create a sleep file

Note

The below debug routine has also been made as a file and made available on our utility downloads page.

Type Debug

At the "-" (hyphen), type the following information. After each line, you may get a response, do not press Enter and type the next line after the response.

N SLEEP.COM
A 100
MOV SI,0082
MOV AX,[SI]
XCHG AH,AL
XOR AX,3030
MOV BL,AL
MOV AL,0A
MUL AH
ADD AX,BX
MOV SI,AX
MOV AH,2C
INT 21
MOV BL,DH
MOV AX,SI
AAM
OR AX,3030
XCHG AH,AL
MOV [0160],AX
MOV AH,09
MOV DX,0160
INT 21
MOV AH,06
MOV DL,FF
INT 21
JZ 014C
OR AL,AL
JNZ 013F
MOV AH,08
INT 21
MOV AL,FF
MOV DX,016C
PUSH AX
MOV AH,09
INT 21
POP AX
MOV AH,4C
INT 21
MOV AH,2C
INT 21
CMP BL,DH
JZ 012D
MOV BL,DH
DEC SI
JNZ 011A
SUB AL,AL
MOV DX,016C
JMP 0142
DB "XX SECONDS", D, 24
DB " ", D, A, 24
RCX
79
W
Q
Tip

You may cut and paste the above test into a notepad document and save the file with a .scr extension. Once saved from DOS, type: debug < name of scr that should create SLEEP.COM.

Check BIOS date

The below debug routine is to check the date of your BIOS. All BIOS dates on PC compatible computers is stored at memory address FFFF5h. To display the date of your BIOS, do the following:

At the C:\> Type debug

- d FFFF:5 L 8

After typing the above command, a string similar to the following line appears.

FFFF:0000       30 34 2F-33 30 2F 39 38        4/30/98

Where 4/30/98 is the current date as set in your computer BIOS.

Video card type

The below debug routine is a way of determining the chipset on the video card in your computer without opening the computer.

At the C:\> Type debug

-d c000:0040

After typing the above command, lines similar to the following text appears.

C000:0040    00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00    ................
C000:0050 E9 63 7B 00 B4 10 49 27 - E9 FE 2B E9 F7 2B 50 4D .c{...I'..+..+PM
C000:0060 49 44 58 00 5B 00 00 00 - 00 A0 00 B0 00 B8 00 C0 IDX.[...........
C000:0070 00 5B 53 54 42 20 6E 56 - 49 44 49 41 20 54 4E 54 .[STB NVIDIA TNT
C000:0080 20 76 65 72 2E 20 31 2E - 31 30 20 0D 0A 00 1B 43 ver. 1.10 ....C
C000:0090 6F 70 79 72 69 67 68 74 - 28 43 29 31 39 39 38 20 opyright(C)1998
C000:00A0 53 54 42 20 53 79 73 74 - 65 6D 73 20 49 6E 63 0D STB Systems Inc.
C000:00B0 0A 00 22 6C 2C 0A 01 00 - C3 50 24 7F E8 60 36 58 .."1,....P$..'6X

As seen in the dump above, this gives you enough information to determine the make and year made on the video card. In line four, the make of this video card is displayed, which in this case, is an NVIDIA TNT, utilizing the Riva TNT chipset. The next line is the version of the card, and after that is the Copyright or year manufactured.

If you do not see any information that sounds like a video card, type the following command.

-d c000:0090

The line above gives you a dump similar to the above example; however, it may have additional information about the video card.