Micro Firmware Tech Support

DEBUG Script to Clear Partition Sector of Hard Drive


Filename: HDCLEAR.TXT
WWW URL:  http://www.firmware.com/support/bios/hdclear.htm
FTP URL:  ftp://ftp.firmware.com/text/hdclear.txt
Revision: 02/11/99  TLS  Micro Firmware Technical Support
Summary:  This DEBUG script is used to erase a hard drive when other
          methods are not sufficient.

Even if you have repartitioned the hard drive, FDISK does not update the entire partition sector after the first time. The following DEBUG script will clear the partition sector (cyl 0, head 0, sector 1) of the first hard drive, which will force FDISK to completely start over. This is sometimes useful for removing Disk Manager or EZ Drive and should also remove any boot sector viruses, providing that the virus is not active in memory, which should be the case if you have booted clean from a non-infected diskette. Although this script clears only the first physical drive, we recommend unplugging other drives to prevent accidental data loss. Letters in script are not case-sensitive.


A:\>DEBUG
- f 200 L200 0
- a 100
xxxx:0100 mov ax,301 (ignore segment:offset values at left)
xxxx:0103 mov bx,200
xxxx:0106 mov cx,1
xxxx:0109 mov dx,0080
xxxx:010C int 13
xxxx:010E int 3
xxxx:010F (Press ENTER an extra time here)
- d 100 LF
xxxx:0100 B8 01 03 BB 00 02 B9 01-00 BA 80 00 CD 13 CC
(make sure that hex values match above line before proceeding)
(if values do not match, type Q and start over)
- g=100
(ignore register display)
- q (quits back to DOS)
FDISK should now show "No partitions defined".
Some explanation of script: (all values in DEBUG script are in HEX)
 - f 200 L200 0  FILL Length of 512 bytes at offset 200 with value 0
 - a 100         ASSEMBLE program at offset 100

(Next 4 lines set up registers for INT13 - Function 03)
mov ax,301 AH=03 INT13 function 03 - Write Disk Sectors
AL=01 specifies how many sectors to write (1)
mov bx,200 BH=02 BL=00 points to buffer area at offset 200
mov cx,1 CH=00 specifies cylinder 0 for INT13 function 03
CL=01 specifies sector 1 (first sector on drive)
mov dx,0080 DH=00 specifies head 0 (first head on drive)
DL=80 specifies physical fixed disk drive 1
(81=2nd drive, 82=3rd drive, 83=4th drive)
int 13 call INT13 (BIOS Fixed Disk Device Service Routine)
int 3 return to DEBUG (after assembling program) - d 100 LF this line is optional - the resulting hex dump can be
used as a check to verify that instructions have been
entered correctly - g=100 GO - run program stored at offset 100 - q QUIT DEBUG back to DOS prompt

SALES - SUPPORT - CONTACT - LINKS - HOME


Micro Firmware, Inc.
330 W. Gray Street
Norman, Oklahoma 73069-7111
Toll-Free Sales (USA/Canada): 1-800-767-5465 or 1-888-4-PC-BIOS
Support & Sales: +1 405-321-8333
Sales Department FAX: +1 405-573-5535
Technical Support FAX: +1 405-321-8342
Email: sales@firmware.com support@firmware.com

© 1998 Micro Firmware, Inc. - All Rights Reserved
While every attempt is made to ensure the accuracy of our support documents, Micro Firmware provides these documents on an AS-IS basis for information purposes only.