Interrupts Page

This page contains all the BIOS INT 13H function specifications for direct accessing the hard-disk using any low-level programming language. These functions are useful for reading and writing hard-disk sectors when installing multiple operating systems with multi-booting capability.

 

Interrupt 13h, section AH=41h

--------d-1341--BX55AA-----------------------
INT 13 - IBM/MS INT 13 Extensions - INSTALLATION CHECK
    AH = 41h
    BX = 55AAh
    DL = drive (80h-FFh)
Return: CF set on error (extensions not supported)
    AH = 01h (invalid function)
    CF clear if successful
    BX = AA55h if installed
    AH = major version of extensions
        01h = 1.x
        20h = 2.0 / EDD-1.0
        21h = 2.1 / EDD-1.1
        30h = EDD-3.0
    AL = internal use
    CX = API subset support bitmap (see #00271)
    DH = extension version (v2.0+ ??? -- not present in 1.x)
Note:    the Phoenix Enhanced Disk Drive Specification v1.0 uses version 2.0 of
    the INT 13 Extensions API
SeeAlso: AH=42h"INT 13 Ext",AH=48h"INT 13 Ext"

Bitfields for IBM/MS INT 13 Extensions API support bitmap:
Bit(s)    Description    (Table 00271)
0    extended disk access functions (AH=42h-44h,47h,48h) supported
1    removable drive controller functions (AH=45h,46h,48h,49h,INT 15/AH=52h)
    supported
2    enhanced disk drive (EDD) functions (AH=48h,AH=4Eh) supported
    extended drive parameter table is valid (see #00273,#00278)
3-15    reserved (0)

 

 

Listing of Error Codes (Referenced from Interrupts Below)

(Table 00234)
Values for disk operation status:
00h    successful completion
01h    invalid function in AH or invalid parameter
02h    address mark not found
03h    disk write-protected
04h    sector not found/read error
05h    reset failed (hard disk)
05h    data did not verify correctly (TI Professional PC)
06h    disk changed (floppy)
07h    drive parameter activity failed (hard disk)
08h    DMA overrun
09h    data boundary error (attempted DMA across 64K boundary or >80h sectors)
0Ah    bad sector detected (hard disk)
0Bh    bad track detected (hard disk)
0Ch    unsupported track or invalid media
0Dh    invalid number of sectors on format (PS/2 hard disk)
0Eh    control data address mark detected (hard disk)
0Fh    DMA arbitration level out of range (hard disk)
10h    uncorrectable CRC or ECC error on read
11h    data ECC corrected (hard disk)
20h    controller failure
31h    no media in drive (IBM/MS INT 13 extensions)
32h    incorrect drive type stored in CMOS (Compaq)
40h    seek failed
80h    timeout (not ready)
AAh    drive not ready (hard disk)
B0h    volume not locked in drive (INT 13 extensions)
B1h    volume locked in drive (INT 13 extensions)
B2h    volume not removable (INT 13 extensions)
B3h    volume in use (INT 13 extensions)
B4h    lock count exceeded (INT 13 extensions)
B5h    valid eject request failed (INT 13 extensions)
BBh    undefined error (hard disk)
CCh    write fault (hard disk)
E0h    status register error (hard disk)
FFh    sense operation failed (hard disk)

 

 

Interrupt 13h, section AH=08h

--------B-1308-------------------------------
INT 13 - DISK - GET DRIVE PARAMETERS (PC,XT286,CONV,PS,ESDI,SCSI)
    AH = 08h
    DL = drive (bit 7 set for hard disk)
Return: CF set on error
    AH = status (07h) (see #00234)
    CF clear if successful
    AH = 00h
    AL = 00h on at least some BIOSes
    BL = drive type (AT/PS2 floppies only) (see #00242)
    CH = low eight bits of maximum cylinder number
    CL = maximum sector number (bits 5-0)
        high two bits of maximum cylinder number (bits 7-6)
    DH = maximum head number
    DL = number of drives
    ES:DI -> drive parameter table (floppies only)
Notes:    may return successful even though specified drive is greater than the
    number of attached drives of that type (floppy/hard); check DL to
    ensure validity
    for systems predating the IBM AT, this call is only valid for hard
    disks, as it is implemented by the hard disk BIOS rather than the
    ROM BIOS
    Toshiba laptops with HardRAM return DL=02h when called with DL=80h,
    but fail on DL=81h. The BIOS data at 40h:75h correctly reports 01h.
    may indicate only two drives present even if more are attached; to
    ensure a correct count, one can use AH=15h to scan through possible
    drives
    for BIOSes which reserve the last cylinder for testing purposes, the
    cylinder count is automatically decremented
    on PS/1s with IBM ROM DOS 4, nonexistent drives return CF clear,
    BX=CX=0000h, and ES:DI = 0000h:0000h
    the PC-Tools PCFORMAT program requires that AL=00h before it will
    proceed with the formatting
BUG:    several different Compaq BIOSes incorrectly report high-numbered
    drives (such as 90h, B0h, D0h, and F0h) as present, giving them the
    same geometry as drive 80h; as a workaround, scan through disk
    numbers, stopping as soon as the number of valid drives encountered
    equals the value in 0040h:0075h
SeeAlso: AH=06h"Adaptec",AH=13h"SyQuest",AH=48h,AH=15h,INT 1E
SeeAlso: INT 41"HARD DISK 0"

(Table 00242)
Values for diskette drive type:
01h    360K
02h    1.2M
03h    720K
04h    1.44M
05h    ??? (reportedly an obscure drive type shipped on some IBM machines)
    2.88M on some machines (at least AMI 486 BIOS)
06h    2.88M
10h    ATAPI Removable Media Device

 

 

Interrupt 13h, section AH=48h

--------d-1348-------------------------------
INT 13 - IBM/MS INT 13 Extensions - GET DRIVE PARAMETERS
    AH = 48h
    DL = drive (80h-FFh)
    DS:SI -> buffer for drive parameters (see #00273)
Return: CF clear if successful
    AH = 00h
    DS:SI buffer filled
    CF set on error
    AH = error code (see #00234)
BUG:    several different Compaq BIOSes incorrectly report high-numbered
    drives (such as 90h, B0h, D0h, and F0h) as present, giving them the
    same geometry as drive 80h; as a workaround, scan through disk
    numbers, stopping as soon as the number of valid drives encountered
    equals the value in 0040h:0075h
SeeAlso: AH=08h,AH=41h,AH=49h,MEM 0040h:0075h

Format of IBM/MS INT 13 Extensions drive parameters:
Offset    Size    Description    (Table 00273)
00h    WORD    (call) size of buffer
        (001Ah for v1.x, 001Eh for v2.x, 42h for v3.0)
        (ret) size of returned data
02h    WORD    information flags (see #00274)
04h    DWORD    number of physical cylinders on drive
08h    DWORD    number of physical heads on drive
0Ch    DWORD    number of physical sectors per track
10h    QWORD    total number of sectors on drive
18h    WORD    bytes per sector
---v2.0+ ---
1Ah    DWORD    -> EDD configuration parameters (see #00278)
        FFFFh:FFFFh if not available
---v3.0 ---
1Eh    WORD    signature BEDDh to indicate presence of Device Path info
20h    BYTE    length of Device Path information, including signature and this
        byte (24h for v3.0)
21h 3 BYTEs    reserved (0)
24h 4 BYTEs    ASCIZ name of host bus ("ISA" or "PCI")
28h 8 BYTEs    ASCIZ name of interface type
        "ATA"
        "ATAPI"
        "SCSI"
        "USB"
        "1394" IEEE 1394 (FireWire)
        "FIBRE" Fibre Channel
30h 8 BYTEs    Interface Path (see #00275)
38h 8 BYTEs    Device Path (see #00276)
40h    BYTE    reserved (0)
41h    BYTE    checksum of bytes 1Eh-40h (two's complement of sum, which makes
        the 8-bit sum of bytes 1Eh-41h equal 00h)
Note:    if the size is less than 30 on call, the final DWORD will not be
    returned by a v2.x implementation; similarly for the Device Path info
SeeAlso: #00277,#03196

Bitfields for IBM/MS INT 13 Extensions information flags:
Bit(s)    Description    (Table 00274)
0    DMA boundary errors handled transparently
1    cylinder/head/sectors-per-track information is valid
2    removable drive
3    write with verify supported
4    drive has change-line support (required if drive >= 80h is removable)
5    drive can be locked (required if drive >= 80h is removable)
6    CHS information set to maximum supported values, not current media
15-7    reserved (0)
SeeAlso: #00273

Format of EDD v3.0 Interface Path:
Offset    Size    Description    (Table 00275)
---ISA---
00h    WORD    16-bit base address
02h 6 BYTEs    reserved (0)
---PCI---
00h    BYTE    PCI bus number
01h    BYTE    PCI device number
02h    BYTE    PCI function number
03h 5 BYTEs    reserved (0)
SeeAlso: #00273,#00276

Format of EDD v3.0 Device Path:
Offset    Size    Description    (Table 00276)
---ATA---
00h    BYTE    flag: 00h = master, 01h = slave
01h 7 BYTEs    reserved (0)
---ATAPI---
00h    BYTE    flag: 00h = master, 01h = slave
01h    BYTE    logical unit number
02h 6 BYTEs    reserved (0)
---SCSI---
00h    BYTE    logical unit number
01h 7 BYTEs    reserved (0)
---USB---
00h    BYTE    to be determined
01h 7 BYTEs    reserved (0)
---IEEE1394---
00h    QWORD    64-bit FireWire General Unique Identifier (GUID)
---FibreChannel---
00h    QWORD    Word Wide Number (WWN)
SeeAlso: #00273,#00275

Format of Phoenix Enhanced Disk Drive Spec translated drive parameter table:
Offset    Size    Description    (Table 00277)
00h    WORD    number of cylinders
02h    BYTE    number of heads
03h    BYTE    A0h (signature indicating translated table)
04h    BYTE    number of physical sectors per track
05h    WORD    starting write precompensation cylinder number
07h    BYTE    reserved
08h    BYTE    control byte (see #03198 at INT 41"DISK 0")
09h    WORD    number of physical cylinders
0Bh    BYTE    number of physical heads
0Ch    WORD    cylinder number of landing zone
0Eh    BYTE    number of logical sectors per track
0Fh    BYTE    checksum
Program: the Phoenix Enhanced Disk Drive Specification is an addition to the
    IBM/MS INT 13 extensions
SeeAlso: #00278,#03196

Format of Phoenix Enhanced Disk Drive Spec Fixed Disk Parameter Table:
Offset    Size    Description    (Table 00278)
00h    WORD    physical I/O port base address
02h    WORD    disk-drive control port address
04h    BYTE    drive flags (see #00279)
05h    BYTE    proprietary information
        bits 7-4 reserved (0)
        bits 3-0: Phoenix proprietary (used by BIOS)
06h    BYTE    IRQ for drive (bits 3-0; bits 7-4 reserved and must be 0)
07h    BYTE    sector count for multi-sector transfers
08h    BYTE    DMA control
        bits 7-4: DMA type (0-2) as per ATA-2 specification
        bits 3-0: DMA channel
09h    BYTE    programmed I/O control
        bits 7-4: reserved (0)
        bits 3-0: PIO type (1-4) as per ATA-2 specification
0Ah    WORD    drive options (see #00280)
0Ch 2 BYTEs    reserved (0)
0Eh    BYTE    extension revision level (high nybble=major, low nybble=minor)
        (currently 10h for v1.0 and 11h for v1.1-3.0)
0Fh    BYTE    2's complement checksum of bytes 00h-0Eh
        8-bit sum of all bytes 00h-0Fh should equal 00h
SeeAlso: #00277

Bitfields for Phoenix Enhanced Disk Drive Spec drive flags:
Bit(s)    Description    (Table 00279)
7    reserved (1)
6    LBA enabled
5    reserved (1)
4    drive is slave
3-0    reserved (0)
SeeAlso: #00278,#00280

Bitfields for Phoenix Enhanced Disk Drive Spec drive options:
Bit(s)    Description    (Table 00280)
0    fast PIO enabled
1    fast DMA access enabled
2    block PIO (multi-sector transfers) enabled
3    CHS translation enabled
4    LBA translation enabled
5    removable media
6    ATAPI device (CD-ROM)
7    32-bit transfer mode
---v1.1+ ---
8    ATAPI device usses DRQ to signal readiness for packet command
    (must be 0 if bit 6 is 0)
10-9    translation type (must be 00 if bit 3 is 0)
    00 Phoenix bit-shifting translation
    01 LBA-assisted translation
    10 reserved
    11 proprietary translation
---v3.0---
11    Ultra DMA access enabled
15-12    reserved
SeeAlso: #00278,#00279

 

 

Interrupt 13h, section AH=02h

--------B-1302-------------------------------
INT 13 - DISK - READ SECTOR(S) INTO MEMORY
    AH = 02h
    AL = number of sectors to read (must be nonzero)
    CH = low eight bits of cylinder number
    CL = sector number 1-63 (bits 0-5)
    high two bits of cylinder (bits 6-7, hard disk only)
    DH = head number
    DL = drive number (bit 7 set for hard disk)
    ES:BX -> data buffer
Return: CF set on error
    if AH = 11h (corrected ECC error), AL = burst length
    CF clear if successful
    AH = status (see #00234)
    AL = number of sectors transferred (only valid if CF set for some
    BIOSes)
Notes:    errors on a floppy may be due to the motor failing to spin up quickly
    enough; the read should be retried at least three times, resetting
    the disk with AH=00h between attempts
    most BIOSes support "multitrack" reads, where the value in AL
    exceeds the number of sectors remaining on the track, in which
    case any additional sectors are read beginning at sector 1 on
    the following head in the same cylinder; the MSDOS CONFIG.SYS command
    MULTITRACK (or the Novell DOS DEBLOCK=) can be used to force DOS to
    split disk accesses which would wrap across a track boundary into two
    separate calls
    the IBM AT BIOS and many other BIOSes use only the low four bits of
    DH (head number) since the WD-1003 controller which is the standard
    AT controller (and the controller that IDE emulates) only supports
    16 heads
    AWARD AT BIOS and AMI 386sx BIOS have been extended to handle more
    than 1024 cylinders by placing bits 10 and 11 of the cylinder number
    into bits 6 and 7 of DH
    under Windows95, a volume must be locked (see INT 21/AX=440Dh/CX=084Bh)
    in order to perform direct accesses such as INT 13h reads and writes
    all versions of MS-DOS (including v7 [Win95]) have a bug which prevents
    booting on hard disks with 256 heads, so many modern BIOSes provide
    mappings with at most 255 heads
SeeAlso: AH=03h,AH=0Ah,AH=06h"V10DISK.SYS",AH=21h"PS/1",AH=42h"IBM"
SeeAlso: INT 21/AX=440Dh/CX=084Bh,INT 4D/AH=02h

 

 

Interrupt 13h, section AH=42h

--------d-1342-------------------------------
INT 13 - IBM/MS INT 13 Extensions - EXTENDED READ
    AH = 42h
    DL = drive number
    DS:SI -> disk address packet (see #00272)
Return: CF clear if successful
    AH = 00h
    CF set on error
    AH = error code (see #00234)
    disk address packet's block count field set to number of blocks
    successfully transferred
SeeAlso: AH=02h,AH=41h"INT 13 Ext",AH=43h"INT 13 Ext"

Format of disk address packet:
Offset    Size    Description    (Table 00272)
00h    BYTE    10h (size of packet)
01h    BYTE    reserved (0)
02h    WORD    number of blocks to transfer (max 007Fh for Phoenix EDD)
04h    DWORD    -> transfer buffer
08h    QWORD    starting absolute block number
        (for non-LBA devices, compute as
        (Cylinder*NumHeads + SelectedHead) * SectorPerTrack +
        SelectedSector - 1

 

 

Interrupt 13h, section AH=03h

--------B-1303-------------------------------
INT 13 - DISK - WRITE DISK SECTOR(S)
    AH = 03h
    AL = number of sectors to write (must be nonzero)
    CH = low eight bits of cylinder number
    CL = sector number 1-63 (bits 0-5)
    high two bits of cylinder (bits 6-7, hard disk only)
    DH = head number
    DL = drive number (bit 7 set for hard disk)
    ES:BX -> data buffer
Return: CF set on error
    CF clear if successful
    AH = status (see #00234)
    AL = number of sectors transferred
    (only valid if CF set for some BIOSes)
Notes:    errors on a floppy may be due to the motor failing to spin up quickly
    enough; the write should be retried at least three times, resetting
    the disk with AH=00h between attempts
    most BIOSes support "multitrack" writes, where the value in AL
    exceeds the number of sectors remaining on the track, in which
    case any additional sectors are written beginning at sector 1 on
    the following head in the same cylinder; the CONFIG.SYS command
    MULTITRACK can be used to force DOS to split disk accesses which
    would wrap across a track boundary into two separate calls
    the IBM AT BIOS and many other BIOSes use only the low four bits of
    DH (head number) since the WD-1003 controller which is the standard
    AT controller (and the controller that IDE emulates) only supports
    16 heads
    AWARD AT BIOS and AMI 386sx BIOS have been extended to handle more
    than 1024 cylinders by placing bits 10 and 11 of the cylinder number
    into bits 6 and 7 of DH
    under Windows95, an application must issue a physical volume lock on
    the drive via INT 21/AX=440Dh before it can successfully write to
    the disk with this function
SeeAlso: AH=02h,AH=0Bh,AH=07h"V10DISK.SYS",AH=22h"PS/1",AH=43h"IBM"
SeeAlso: INT 21/AX=440Dh"DOS 3.2+",INT 4D/AH=03h

 

 

Interrupt 13h, section AH=43h

--------d-1343-------------------------------
INT 13 - IBM/MS INT 13 Extensions - EXTENDED WRITE
    AH = 43h
    AL = write flags
    ---v1.0,2.0---
    bit 00: verify write
    bits 7-1 reserved (0)
    ---v2.1+ ---
    00h,01h write without verify
    02h write with verify
    DL = drive number
    DS:SI -> disk address packet (see #00272)
Return: CF clear if successful
    AH = 00h
    CF set on error
    AH = error code (see #00234)
    disk address packet's block count field set to number of blocks
    successfully transferred
Note:    the BIOS returns CF set/AH=01h (invalid function) if verify is
    requested but not supported
SeeAlso: AH=03h,AH=41h"INT 13 Ext",AH=42h"INT 13 Ext",AH=44h