INT 13H: BIOS Disk I/O
AH BIOS Service AH BIOS Service
▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
┌─ 00H reset controller : 0cH seek cylinder
PC │ 01H get status │ 0dH alternate reset
XT ┤ 02H read sectors │ 0eH (reserved)
AT │ 03H write sectors XT ┤ 0fH (reserved)
│ 04H verify sectors AT │ 10H test drive ready
└─ 05H format track │ 11H recalibrate
06H (reserved) │ 12H (reserved)
07H (reserved) │ 13H (reserved)
┌─ 08H get drive parms └─ 14H controller diagnostics
XT │ 09H init drive parm tbls ┌─ 15H get disk/diskette type
AT ┤ 0aH read long AT ┤ 16H disk change status
: 0bH write long └─ 17H and 18H: Set media type
Use these service for direct access to the diskette or hard disk adapters.
It is advisable to use DOS functions (dropping down to INT 25H/26H when
needed for low-level access), to let the DOS device drivers do all the
work. Of course, for very low-level access, including reading sectors on
a non-DOS disk, INT 13H may be the only alternative.
And don't overlook DOS fn 440dH (IOCTL for block devices) as a way to
format diskettes and access entire tracks of data.
█▌Diskette vs. Hard Disk Access▐█
The BIOS in the oldest PCs support access to diskette drives only. It
supported only fns 00H-05H.
Later, the XT and AT hard disk adapter cards patched-in additional
ROM-Scan code to intercept INT 13H and watch for a drive number (in DL)
that is 80H or higher. With these later systems, the original INT 13H
vector is stored as the INT 40H vector. The hard-disk logic checks DL
and passes control to INT 40H when DL is less than 80H. Note that the
BIOS disk error code returned in AH will vary, depending on whether the
function was for a diskette or a hard disk.
Nowadays, most systems support all disk I/O as part of the ROM-BIOS. Also
operating systems such a Windows may replace the BIOS code altogether to
obtain faster response--especially for read/write operations to RAM above
1 MB.
The most significant difference between diskette access and hard disk
access is that on multi-sector reads and writes to a hard disk, the BIOS
will automatically advance to the next head/cylinder. All diskette access
is limited to a single head/track.
Another thing to watch for is the diskette spin-up time. If you get an
error accessing a diskette drive, reset the controller and try at least
three times before giving up.
See Also: I/O Port Map and Diskette Controller Ports
Disk Drive Functions
BIOS Data Area
ROM-BIOS Functions
INT 25H/26H (DOS absolute sector access)
DOS fn 440dH (IOCTL for block devices)
-♦-