DEBUG SCRIPTS
What is the DEBUG command?
Debug is a MS-DOS command which can be used to enter machine language into the computer either to create programs or test computer peripherals by receiving back various computer machine code. Within this page as well as other pages you will begin to understand how to utilize this great method of testing computer hardware. As well as learn the basics of machine code. Debug has been included in every version of MS-DOS as well as Windows. When running any of the debug routines it is recommended that if you have Windows that you exit or shut down to get into a real DOS prompt. To exit out of a debug type q and press enter. This will return you back to the MS-DOS prompt. In some of the following debug routines you will notice that a g is typed then q. G tells the computer that the code type is not self executing and must be ran at this point. If completed the program will return Program Terminated Normally which indicates you can quit from the debug program. If during the time you are typing the debug routine you receive ^ error this is an indication that you have incorrectly typed something within the line just completed. You can type the line again without causing any problems with the routine.
Display Information about your computer ports:
debug < enter> |
D40:00 < enter> |
Q < enter> (This will return several lines of information.) |
You should get several lines however the first line is the only important line. If you see F8 03 this would be an indication that COM1 is being detected if you see 00 00 this is an indication that it is not being 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 following debug routine will clear CMOS, BIOS, Passwords, Settings, Viruses, and other items residing in the CMOS. During this process you may get returned characters which are an indication that the string has gone in, if you by chance get ERROR insure that you have typed the line in correctly, if not retype.
DEBUG <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> By pressing G this will execute the above script. |
Q <ENTER> |
Reboot, and you will get a Checksum Error. Enter setup, correct all the incorrect values, time, date, etc. |
JOYSTICK TEST
This test will test to see if you Joystick is present or not.
Type debug from the DOS prompt once at the "-". |
Type i201 |
If you get a FF response attempt hold one of the main buttons on your joystick, and while holding the button down type i201 and see if a different response is given, each button on the joystick should return a different response. However some special joysticks such as the Microsoft Sidewinder which has more then 4-5 buttons may not return a response for all extra buttons because these buttons are generally controlled through software. |
If a FF is still given on each of the buttons on the game paddle or joystick it is a good possibility that either the Joystick and or the Joystick 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. |
ERASING SECTOR 2 ON YOUR HARD DRIVE
Before doing the below routine make sure that this is safe to do on your hard drive. This could cause damage to the hard drive, and some computer hard drive manufacturers may void your warranty.
This routine is useful in clearing DDO. If this routine completes successfully it will erase everything in Sector 2. In the following debug routine only type what is in bold from line 3 to 9 you will get a response if it corresponds with the following type the text after the response without putting in a space between the response and what you type in.
A:\>debug |
-FCS:200 400 0<enter> |
-ACS:100<enter> |
-xxxx:0100 mov ax,302<enter> |
-xxxx:0103 mov bx,200<enter> |
-xxxx:0106 mov cx,2<enter> |
-xxxx:0109 mov dx, 80<enter> |
-xxxx:010a int 13<enter> |
-xxxx:010c int 20<enter> |
-xxxx:0110 <enter>(without typing anything) |
-g <enter> |
Program terminated normally. |
-q <enter> |
Create A Batch File That Reboots Your Computer.
GOTO BEGIN |
E 40:72 34 12 |
RCS |
FFFF |
RIP |
0000 |
G |
:BEGIN |
DEBUG < REBOOT.BAT |
CHECK BIOS DATE
The following 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 you should receive a string similar to: |
FFFF:0000 30 34 2F-33 30 2F 39 38 4/30/98 |
The 4/30/98 would be the date of your computer BIOS. |
Determine Your Video Card Type
The following debug routine will list the type of video card within your computer. This is an excellent way of determining the chipset on the card or the card within your computer without opening the computer.
At the C:\> type debug |
-d c000:0040 |
After typing the above command you should receive several lines of text similar to: |
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 you can pick out in the above dump this gives you enough information to determine the make and the year made on the video card. On line 4 you can see the make of this video card which in this case is a N VIDIA TNT which would be the Riva TNT chipset. The next line you notice the version of the card and finally the line thereafter is the copyright or the year manufactured generally. If you are unable to capture any information which sounds like the video card you can also type:
-d c000:0090
The above line will give you a dump similar to the above example however may have additional information about the video card.
Debug Script To Remove DOS Partitions (FAT16 & Fat32)
Warning! This will erase all data on the hard drive.
Type debug at the A:\ prompt |
- 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 hd 0, "81" for hd 1 |
xxxx:010C INT 13 [enter] |
xxxx:010E INT 20 [enter] |
xxxx:0110 [enter] ---BLANK LINE - IMPORTANT! |
- G [enter] |
Program terminated normally |
(CTRL)+(ALT)+(DEL) System should reboot |
Debug Script To Remove NON-DOS Partitions (Linux, NTFS & Windows 2000)
Warning! This will erase all data on the hard drive.
Type debug at the A:\ prompt |
- A 100 [enter] |
nnnn:0100 INT 13 [enter] |
nnnn:0102 [enter] |
- RAX [enter] |
AX 0000 0301 [enter] |
- RBX [enter] |
BX 0000 0200 [enter] |
- F 200 L 200 0 [enter] |
- RCX [enter] |
CX 0000 0001 [enter] |
- RDX [enter] |
DX 0000 0080 [enter] |
- P [enter] |
(Debug may display several lines of information at this point.) |
- Q [enter] |
Program terminated normally |
[CTRL]+[ALT]+[DEL] System should reboot |
ERASE HDD AND CLEAR CMOS
This routine is useful in clearing DDO and removing possible viruses. If this routine completes successfully it will erase everything from your Hard drive as well as your reset your CMOS values. In the following debug routine only type what is in bold from line 3 to 17. You will get a response if it corresponds with the following.
A:\>debug <enter> |
-fcs:200 400 0 <enter> |
-acs:100 <enter> |
-xxxx:0100 mov 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 routine to clear out a virus turn off your computer and wait and turn back on.) |
-q <enter> |
Once back at DOS reboot your computer |
When your computer comes back on from doing the above you will get an error message as booting up the computer such as "Invalid Configuration" you must enter CMOS and set the time and date save and reboot again. Once rebooted you will then need to run fdisk and recreate the partitions. Once created you will then need to format the hard drive and proceed as normal.