INT 13
From Wikipedia, the free encyclopedia
INT 13 is shorthand for interrupt 0x13, the 20th interrupt vector in an x86 based computer system. (Interrupts start at zero, and are labeled with hexadecimal values.) INT is an x86 instruction that triggers a software interrupt, and 0x13 is the vector passed to the instruction. The BIOS typically sets up a real mode interrupt handler at this vector that provides sector based hard disk and floppy disk read and write services using Cylinder Head Sector (CHS) addressing.
[edit] Overview
Under real mode operating systems such as MS-DOS, calling INT 0x13 would jump into the computer's BIOS code for Low Level Disk Services, which will carry out sector-based disk read or write for the program. In MS-DOS, it serves as a foundation for higher-level INT 21 functions which deal with file system access.
Newer protected mode operating systems such as Microsoft Windows NT derivatives (e.g. NT4, 2000 XP and 2003 Server) or GNU/Linux with dosemu, will intercept the call and pass it to the operating system's native disk I/O mechanism. Windows 9x and Windows for Workgroups 3.11 could also bypass BIOS routines when using 32-bit File Access.
The original BIOS real-mode INT 0x13 interface supports drives of sizes up to about 504 MiB using what is commonly referred to as Physical CHS addressing. This limit originates from the hardware interface of the x86 disk hardware. The BIOS used the CHS address given in the INT 0x13 call, and transmitted it directly to the hardware interface.
This interface was later extended to support addressing of up to exactly 8064 MiB 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 0x13 interface, and the goal of maintaining backward compatibility. There were originally a number of BIOS that offered incompatibly versions of this interface, but eventually the computer industry standardized on the interface developed in the Award BIOS. This limit uses 1024 cylinders, 256 heads, 63 sectors, and 512 byte blocks, giving roughly 7.875 GiB of addressing (1024 * 256 * 63 * 512).
To support even larger addressing modes, an interface known as INT13h Extensions was introduced by Western Digital and Phoenix Technologies as part of BIOS Enhanced Disk Drive Services (EDD) standard. It uses 64-bit Logical Block Addressing (LBA) which allows addressing up to 8 ZiB (the drive can also support 32-bit or 48-bit LBA which allows up to 2 TiB or 128 PiB respectively). 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 13 interface. This packet is a data structure that contains an interface version, data size, and LBAs.