INT 13H - Overview

Overview

See also: Enhanced BIOS

Under real mode operating systems, such as MS-DOS, calling INT 13h would jump into the computer's ROM-BIOS code for low-level disk services, which would carry out physical sector-based disk read or write operations for the program. In MS-DOS, it serves as the low-level interface for the built-in block device drivers for hard disks and floppy disks. This allows INT 25h and INT 26h to provide absolute disk read/write functions for logical sectors to the FAT file system driver in the DOS kernel, which handles file-related requests through MS-DOS API (INT 21h) functions.

Under protected mode operating systems, such as Microsoft Windows NT derivatives (e.g. NT4, 2000, XP, and Server 2003) and Linux with dosemu, the OS intercepts the call and passes it to the operating system's native disk I/O mechanism. Windows 9x and Windows for Workgroups 3.11 also bypass BIOS routines when using 32-bit File Access.

The original BIOS real-mode INT 13h interface supports drives of sizes up to about 504 MB using what is commonly referred to as physical CHS addressing. This limit originates from the hardware interface of the IBM PC/XT disk hardware. The BIOS used the cylinder-head-sector (CHS) address given in the INT 13h call, and transferred it directly to the hardware interface.

This interface was later extended to support addressing of up to exactly 8064 MB using what is commonly referred to as logical CHS addressing. This limit originates from a combination of the register value based calling convention used in the INT 13h interface, and the goal of maintaining backward compatibility. There were originally a number of BIOSes that offered incompatible versions of this interface, but eventually the computer industry standardized on the interface developed in the Microid Research ("MR BIOS") in 1989. This limit uses 1024 cylinders, 256 heads, 63 sectors, and 512 byte blocks, giving roughly 7.875 GB of addressing (1024 * 256 * 63 * 512).

To support even larger addressing modes, an interface known as INT 13h Extensions was introduced by Western Digital and Phoenix Technologies as part of BIOS Enhanced Disk Drive Services. It uses 64-bit logical block addressing (LBA) which allows addressing up to 8 ZiB (the drive can also support 28-bit or 48-bit LBA which allows up to 128 GiB or 128 PiB respectively, assuming a 512-byte sector/block size). This is a packet interface, because it uses a pointer to a packet of information rather than the register based calling convention of the original INT 13h interface. This packet is a data structure that contains an interface version, data size, and LBAs.

All versions of MS-DOS, including MS-DOS 7, and Windows 95 contain a bug that prevents booting hard disks with 256 heads (register value 0xFF), so many modern BIOS maps the drives to have at most 255 heads. Also some cache drivers will flush their buffers when detecting that MS-DOS is bypassed by applications that directly issues INT 13h requests. AMI BIOSes from around 1990-1991 trash word unaligned buffers. Some MS-DOS and TSR programs clobber interrupt enabling and registers so PC-DOS and MS-DOS install their own filters to prevent this.

Read more about this topic:  INT 13H