|
Search
Other
Pages
Home
Site map
Computer help
Dictionary
News
Q&A
What's new
Tools
E-mail this page
Print Preview
Edit this page
|
|
DEBUG ROUTINES
Computer Debug Routines / Machine Code
DISCLAIMER The
following are various Debug Routines that you can run on your computer
to do various tasks. However, some can possibly damage computer
components or cause them not to work properly. We are providing these
debug routines as a reference. If these cause problems with the
computer they are ran on Computer Hope will not be held responsible for
your actions. We recommend that only experienced computer users being
aware of the potential hazards use the following routines.
When running any of the below
routines you are agreeing to the above statement.
DEBUG ABCs
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.
Additional information on the MS-DOS command debug can be
found on our debug page.
ENTERING DEBUG
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.
Once at the DOS prompt run through the following example, this
example is perfectly fine to run on any PC Computer running MS-DOS / Windows and will not
harm anything.
Type debug and press enter.
This should get you to a - (small dash). This is the debug prompt.
At the - type d40:00 and press enter this will return several lines of
information.
(See Testing Ports for explanation of this feedback.)
After the feedback you will be back to the debug prompt.
To exit out of 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 now quit from the debug program.
|
|
|
|
LISTING OF
ROUTINES TESTING PORTS
CLEAR CMOS
PRINTER TEST
JOYSTICK TEST
ERASE SECTOR 2
ERASE ALL HDD INFORMATION
ERASE HDD AND CLEAR CMOS
DISCHARGE OLD LAPTOP BATTERIES
REBOOT YOUR COMPUTER
CREATE A SLEEP FILE FOR DOS
CHECK BIOS DATE
VIDEO CARD TYPE
UNDERSTANDING RESPONSES
Several of the debug routines listed within this page as well as several other of our
pages will return responses in Hexadecimal format. It is recommended if you wish to
understand some of the code within these routines that you get a familiarity of
Hexadecimal. You can find information about Hexadecimal as well as Binary on our Binary & Hexadecimal page.
POSSIBLE ISSUES
If during the time you are typing the
debug routine you receive ^error this is and 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. |
|
|
INDEX |
|
|
|
|
|
RESOLVED |
|
|
|
|
Were you able to locate the answer to your questions?
|
|
|
|
TESTING PORTS |
|
|
The following debug routine will check the
ports of the computer to allow you to know if ports are being detected or
not.
Type debug to get to the "-"
Type D40:0
You should get several lines however the first line is the only important line which
should read the following:
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 graph shows you what the feed back means as far as port so if
you se 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 detect 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 ensure
that you have typed the line in correctly, if not retype. Ensure that you do not skip any
lines, that it is ALL typed in correctly to help prevent problems. Before running this
Debug routine also ensure that you have read the above disclaimer.
After typing debug you will get "-" which is were you can
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> By pressing G this will execute the above script,
ensure you have read and agree to the above disclaimer.
Q <ENTER>
Then reboot and you will get a Setup Checksum Error. Go into setup, correct all the
incorrect values, time, date...
|
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.
Extra 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.
See Joystick Help page for additional help.
|
ERASING SECTOR 2 |
|
|
Before doing the below routine ensure that you read our disclaimer as well as are sure
that this is safe to do on your hard drive. Some computer hard drive manufacturers may void
your warranty or cause damage to the hard drive when doing the following. 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>
|
ERASE
ALL HDD INFORMATION |
|
|
This debug routine is used to erase
all partition information on the hard disk drive and is only recommend
for experienced users or users who are unable to delete the partition
information through fdisk.
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 hd 0 or 81 for hd 1 )
xxxx:010C INT 13 <enter>
xxxx:010E INT 20 <enter>
xxxx:0110 <enter>
-g <enter>
Program terminated normally
-q<enter>
Once this debug routine is complete
reboot computer and all partitions should be erased. Before anything
can be installed back onto the computer you must run Fdisk and
recreate the partition as well as format the hard disk drive.
Additional information about fdisk can
be found on our fdisk page.
Additional information about format
can be found on our format page.
|
ERASE HDD AND CLEAR CMOS |
|
|
Before doing the below routine ensure that you read our disclaimer as well as are sure
that this is safe to do on your hard drive. Some computer hard drive manufacturers may void
your warranty or this may cause damage to the hard drive when doing the following. 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 type the text after the response without
putting in a space between the response and what you type in.
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 debug routine to clear out a possible 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.
|
DISCHARGE
OLD
LAPTOP BATTERIES |
|
|
The following 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>
This will write dpdischg.com to the directory in, 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 each time use the following source:
GOTO BEGIN
E 40:72 34 12
RCS
FFFF
RIP
0000
G
:BEGIN
DEBUG < REBOOT.BAT
|
CREATE A SLEEP FILE |
|
|
This file allows your computer to sleep for a specified amount of time. This file is
not dangerous in any way if typed improperly more then likely the file will just not work.
Type Debug
You should get a "-" begin typing the below information after each line you
may get a response do not press enter 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 past the above test into a notepad
document and save the file with a .scr extension. Once saved from DOS type debug
< name of scr which should create the file should be created SLEEP.COM.
Note:
This file is also available on our utility
download page.
|
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.
Additional information about the computer
BIOS can be found on our BIOS page.
|
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. Additional information about
computer video cards can be found on our Video Card
page.
|
|