Interrupt 13h
The next lower level of communications with drives, the ROM BIOS Int 13h routines, usually are found in ROM chips on the motherboard or on an adapter card in a slot. However, an Int 13h handler also can be implemented by using a device driver loaded at boot time. Because DOS requires Int 13h access to boot from a drive (and a device driver cannot be loaded until after boot-up), only drives with ROM BIOS-based Int 13h support can become bootable. Int 13h routines need to talk directly to the controller using the I/O ports on the controller. Therefore, the Int 13h code is very controller-specific. Table 22.2 lists the different functions available at the Interrupt 13h BIOS interface. Some functions are available to floppy drives or hard drives only, whereas others are available to both types of drives.
Table 22.3 shows the error codes that may be returned by the BIOS INT 13h routines. In some cases, you may see these codes referred to when running a low-level format program, disk editor, or other program that can directly access a disk drive through the BIOS.
Table 22.2 Int 13h BIOS Disk Functions
Function |
Floppy Disk |
Hard Disk |
Description |
00h |
X |
X |
Reset disk system |
01h |
X |
X |
Get status of last operation |
02h |
X |
X |
Read sectors |
03h |
X |
X |
Write sectors |
04h |
X |
X |
Verify sectors |
05h |
X |
X |
Format track |
06h |
|
X |
Format bad track |
07h |
|
X |
Format drive |
08h |
X |
X |
Read drive parameters |
09h |
|
X |
Initialize drive characteristics |
0Ah |
|
X |
Read long |
0Bh |
|
X |
Write long |
0Ch |
|
X |
Seek |
0Dh |
|
X |
Alternate hard disk reset |
0Eh |
|
X |
Read sector buffer |
0Fh |
|
X |
Write sector buffer |
10h |
|
X |
Test for drive ready |
11h |
|
X |
Recalibrate drive |
12h |
|
X |
Controller RAM diagnostic |
13h |
|
X |
Controller drive diagnostic |
14h |
|
X |
Controller internal diagnostic |
15h |
X |
X |
Get disk type |
16h |
X |
|
Get floppy disk change status |
17h |
X |
|
Set floppy disk type for format |
18h |
X |
|
Set media type for format |
19h |
|
X |
Park hard disk heads |
1Ah |
|
X |
ESDI--Low-level format |
1Bh |
|
X |
ESDI--Get manufacturing header |
1Ch |
|
X |
ESDI--Get configuration |
Table 22.3 BIOS INT 13h Error Codes
Code |
Description |
Code |
Description |
00h |
No error |
06h |
Media change error |
01h |
Bad command |
07h |
Initialization failed |
02h |
Address mark not found |
09h |
Cross 64K DMA boundary |
03h |
Write protect |
0Ah |
Bad sector flag detected |
04h |
Request sector not found |
0Bh |
Bad track flag detected |
05h |
Reset failed |
10h |
Bad ECC on disk read |
11h |
ECC corrected data error |
BBh |
Undefined error |
20h |
Controller has failed |
CCh |
Write fault |
40h |
Seek operation failed |
0Eh |
Register error |
80h |
Drive failed to respond |
FFh |
Sense operation failed |
AAh |
Drive not ready |
|
|
If you design your own custom disk controller device, you need to write an IBM- compatible Int 13h handler package and install it on the card using a ROM BIOS that will be linked into the system at boot time. To use Int 13h routines, a program must use exact cylinder, head, and sector coordinates to specify sectors to read and write. Accordingly, any program designed to work at this level must be intimately familiar with the parameters of the specific disk on the system on which it is designed to run. Int 13h functions exist to read the disk parameters, format tracks, read and write sectors, park heads, and reset the drive.
A low-level format program for ST-506/412 drives needs to work with disks at the Int 13h level or lower. Most ST-506/412 controller format programs work with access at the Int 13h level because virtually any operation a format program needs is available through the Int 13h interface. This is not true, however, for other types of controllers (such as IDE, SCSI, or ESDI), for which defect mapping and other operations differ considerably from the ST-506/412 types. Controllers that must perform special operations during a low-level format, such as defining disk parameters to override the motherboard ROM BIOS drive tables, would not work with any formatter that used only the standard Int 13h interface.
For these reasons, most controllers require a custom formatter designed to bypass the Int 13h interface. Most general-purpose, low-level reformat programs that perform a non-destructive format access the controller through the Int 13h interface (rather than going direct) and therefore cannot be used for an initial low-level format; the initial low-level format must be done by a controller-specific utility.
Few high-powered disk utility programs, other than some basic formatting software, can talk to the disk at the Int 13h level. The DOS FDISK program communicates at the Int 13h level. The Norton DISKEDIT and older NU programs can communicate with a disk at the Int 13h level when these programs are in their absolute sector mode; they are some of the few disk-repair utilities that can do so. These programs are important because they can be used for the worst data recovery situations, in which the partition tables have been corrupted. Because the partition tables, as well as any non-DOS partitions, exist outside the area of a disk that is defined by DOS, only programs that work at the Int 13h level can access them. Most utility programs for data recovery work only at the DOS Int 25/26h level, which makes them useless for accessing areas of a disk outside of DOS' domain. ***As you can see from the above information, either the drive is damaged at that location or the drives "offset" is incorrect. Try using the IDE auto-detect freature of your CMOS, if available, or enter required information which is printed on the drives label into the appropriate line in Standard Setup. If neither of these suggestions work, the drive is damaged. |