BIOS interrupt calls are a facility that DOS programs and some other software, such as boot loaders, use to invoke the facilities of the Basic Input/Output System on IBM PC compatible computers. Some operating systems also use the BIOS to probe and initialize hardware resources during their early stages of booting.
In all computers, software instructions control the physical hardware (screen, disk, keyboard, etc.) from the moment the power switch is pressed.
The BIOS, preloaded in the mainboard, takes control as the machine is turned on, initializes the hardware, loads and runs the OS loader, and provides basic hardware control to the operating system installed on the machine.
Operating systems communicate with the BIOS software, in order to control the installed hardware. This system of communication is called an interrupt.
The basic idea is, BIOS and the operating system share an agreed-upon area of the computer's memory, to pass messages. The messages are broken into categories, each with its own "interrupt number", and contains sub-categories ("function numbers"). In practice, the operating system software "calls" to BIOS software by specifying an interrupt and function number, followed with whatever data needs to go in or out of the attached hardware.
The BIOS software "responds" with an error code if not successful, or with whatever data was requested if successful. The data itself can by as small as one bit or as large as an entire raw disk sector, being read or written (thousands of bytes).
Many modern operating systems (such as newer versions of Windows and Linux) bypass the built-in BIOS interrupt communication system altogether, preferring to use their own software to control the attached hardware directly.
Invoking an interrupt [edit]
Invoking an interrupt can be done using the INT x86 assembly language instruction. For example, to print a character to the screen using BIOS interrupt 0x10, the following x86 assembly language instructions would be executed:
mov ah, 0x0e
mov al, '!'
int 0x10
Interrupt table [edit]
A list of common BIOS interrupt classes can be found below. Note that some BIOSes (particularly old ones) do not implement all of these interrupt classes.
| Interrupt vector |
Description |
00h |
CPU: Executed after an attempt to divide by zero or when the quotient does not fit in the destination |
01h |
CPU: Executed after every instruction while the trace flag is set |
02h |
CPU: NMI, used e.g. by POST for memory errors |
03h |
CPU: The lowest non-reserved interrupt, it is used exclusively for debugging, and the INT 03 handler is always implemented by a debugging program |
04h |
CPU: Numeric Overflow. Usually caused by the INTO instruction when the overflow flag is set. |
05h |
Executed when Shift-Print screen is pressed, as well as when the BOUND instruction detects a bound failure. |
06h |
CPU: Called when the Undefined Opcode (invalid instruction) exception occurs. Usually installed by the operating system. |
07h |
CPU: Called when an attempt was made to execute a floating-point instruction and no numeric coprocessor was available. |
08h |
IRQ0: Implemented by the system timing component; called 18.2 times per second (once every 55 ms) by the programmable interval timer |
09h |
IRQ1: Called after every key press and release (as well as during the time when a key is being held) |
0Bh |
IRQ3: Called by serial ports 2 and 4 (COM2/4) when in need of attention |
0Ch |
IRQ4: Called by serial ports 1 and 3 (COM1/3) when in need of attention |
0Dh |
IRQ5: Called by hard disk controller (PC/XT) or 2nd parallel port LPT2 (AT) when in need of attention |
0Eh |
IRQ6: Called by floppy disk controller when in need of attention |
0Fh |
IRQ7: Called by 1st parallel port LPT1 (printer) when in need of attention |
10h |
Video Services
AH |
Description |
00h |
Set Video Mode |
01h |
Set Cursor Shape |
02h |
Set Cursor Position |
03h |
Get Cursor Position And Shape |
04h |
Get Light Pen Position |
05h |
Set Display Page |
06h |
Clear/Scroll Screen Up |
07h |
Clear/Scroll Screen Down |
08h |
Read Character and Attribute at Cursor |
09h |
Write Character and Attribute at Cursor |
0Ah |
Write Character at Cursor |
0Bh |
Set Border Color |
0Ch |
Write Graphics Pixel |
0Dh |
Read Graphics Pixel |
0Eh |
Write Character in TTY Mode |
0Fh |
Get Video Mode |
10h |
Set Palette Registers (EGA, VGA, SVGA) |
11h |
Character Generator (EGA, VGA, SVGA) |
12h |
Alternate Select Functions (EGA, VGA, SVGA) |
13h |
Write String |
1Ah |
Get or Set Display Combination Code (VGA, SVGA) |
1Bh |
Get Functionality Information (VGA, SVGA) |
1Ch |
Save or Restore Video State (VGA, SVGA) |
4Fh |
VESA BIOS Extension Functions (SVGA) |
|
11h |
Returns equipment list |
12h |
Return conventional memory size |
13h |
Low Level Disk Services
AH |
Description |
00h |
Reset Disk Drives |
01h |
Check Drive Status |
02h |
Read Sectors |
03h |
Write Sectors |
04h |
Verify Sectors |
05h |
Format Track |
08h |
Get Drive Parameters |
09h |
Init Fixed Drive Parameters |
0Ch |
Seek To Specified Track |
0Dh |
Reset Fixed Disk Controller |
15h |
Get Drive Type |
16h |
Get Floppy Drive Media Change Status |
17h |
Set Disk Type |
18h |
Set Floppy Drive Media Type |
41h |
Extended Disk Drive (EDD) Installation Check |
42h |
Extended Read Sectors |
43h |
Extended Write Sectors |
44h |
Extended Verify Sectors |
45h |
Lock/Unlock Drive |
46h |
Eject Media |
47h |
Extended Seek |
48h |
Extended Get Drive Parameters |
49h |
Extended Get Media Change Status |
4Eh |
Extended Set Hardware Configuration |
|
14h |
Serial port services
AH |
Description |
00h |
Serial Port Initialization |
01h |
Transmit Character |
02h |
Receive Character |
03h |
Status |
|
15h |
Miscellaneous system services
AH |
AL |
Description |
00h |
|
Turn on cassette drive motor |
01h |
|
Turn off cassette drive motor |
02h |
|
Read data blocks from cassette |
03h |
|
Write data blocks to cassette |
4Fh |
|
Keyboard Intercept |
83h |
|
Event Wait |
84h |
|
Read Joystick |
85h |
|
Sysreq Key Callout |
86h |
|
Wait |
87h |
|
Move Block |
88h |
|
Get Extended Memory Size |
89h |
|
Switch to Protected Mode |
C0h |
|
Get System Parameters |
C1h |
|
Get Extended BIOS Data Area Segment |
C2h |
|
Pointing Device Functions |
C3h |
|
Watchdog Timer Functions - PS/2 systems only |
C4h |
|
Programmable Option Select - MCA bus PS/2 systems only |
D8h |
|
EISA System Functions - EISA bus systems only |
E8h |
01h |
Get Extended Memory Size (Newer function, since 1994). Gives results for memory size above 64 Mb. |
E8h |
20h |
Query System Address Map. The information returned from E820 supersedes what is returned from the older AX=E801h and AH=88h interfaces. |
|
16h |
Keyboard services
AH |
Description |
00h |
Read Character |
01h |
Read Input Status |
02h |
Read Keyboard Shift Status |
05h |
Store Keystroke in Keyboard Buffer |
10h |
Read Character Extended |
11h |
Read Input Status Extended |
12h |
Read Keyboard Shift Status Extended |
|
17h |
Printer services
AH |
Description |
00h |
Print Character to Printer |
01h |
Initialize Printer |
02h |
Check Printer Status |
|
18h |
Execute Cassette BASIC: True IBM computers contain BASIC in the ROM to be interpreted and executed by this routine in the event of a boot failure (called by the BIOS) |
19h |
After POST this interrupt is used by BIOS to load the operating system. |
1Ah |
Real Time Clock Services
AH |
Description |
00h |
Read RTC |
01h |
Set RTC |
02h |
Read RTC Time |
03h |
Set RTC Time |
04h |
Read RTC Date |
05h |
Set RTC Date |
06h |
Set RTC Alarm |
07h |
Reset RTC Alarm |
|
1Ah |
PCI Services - implemented by BIOSes supporting PCI 2.0 or later
AX |
Description |
B101h |
PCI Installation Check |
B102h |
Find PCI Device |
B103h |
Find PCI Class Code |
B106h |
PCI Bus-Specific Operations |
B108h |
Read Configuration Byte |
B109h |
Read Configuration Word |
B10Ah |
Read Configuration Dword |
B10Bh |
Write Configuration Byte |
B10Ch |
Write Configuration Word |
B10Dh |
Write Configuration Dword |
B10Eh |
Get IRQ Routine Information |
B10Fh |
Set PCI IRQ |
|
1Bh |
Ctrl-Break handler - called by INT 09 when Ctrl-Break has been pressed |
1Ch |
Timer tick handler - called by INT 08 |
1Dh |
Not to be called; simply a pointer to the VPT (Video Parameter Table), which contains data on video modes |
1Eh |
Not to be called; simply a pointer to the DPT (Diskette Parameter Table), containing a variety of information concerning the diskette drives |
1Fh |
Not to be called; simply a pointer to the VGCT (Video Graphics Character Table), which contains the data for ASCII characters 80h to FFh |
41h |
Address pointer: FDPT = Fixed Disk Parameter Table (1st hard drive) |
46h |
Address pointer: FDPT = Fixed Disk Parameter Table (2nd hard drive) |
4Ah |
Called by RTC for alarm |
70h |
IRQ8: Called by RTC |
74h |
IRQ12: Called by mouse |
75h |
IRQ13: Called by math coprocessor |
76h |
IRQ14: Called by primary IDE controller |
77h |
IRQ15: Called by secondary IDE controller |
DOS hooks [edit]
On MS-DOS systems IO.SYS hooks INT 13 for floppy disc change detection, tracking formatting calls, correcting DMA boundary errors, working around problems in IBM's ROM BIOS "01/10/84" with model code 0xFC before the first call.
INT 18h: execute BASIC [edit]
INT 18h traditionally jumped to an implementation of BASIC stored in ROM. This call would typically be invoked if the BIOS was unable to identify any bootable volumes on startup. (At the time the original IBM PC was released in 1981, the BASIC in ROM was a key feature.) As time went on and BASIC was no longer shipped on all PCs, this interrupt would simply display an error message indicating that no bootable volume was found (famously, "No ROM BASIC", or more explanatory messages in later BIOS versions); in other BIOS versions it would prompt the user to insert a bootable volume and press a key, and then after the user did so it would loop back to the bootstrap loader to try booting again.
See also [edit]
References [edit]
- The x86 Interrupt List (a.k.a. RBIL, Ralf Brown's Interrupt List)
- Embedded BIOS User’s Manual
- PhoenixBIOS 4.0 User's Manual
- HTML version of Ralf Brown Interrupt List
- IBM Personal System/2 and Personal Computer BIOS Interface Technical Reference, IBM, 1988, ISBN 999857739X
- System BIOS for IBM PCs, Compatibles, and EISA Computers, Phoenix Technologies, 1991, ISBN 0201577607
- Programmer's Guide to the AMIBIOS, American Megatrends, 1993, ISBN 0070015619
- The Programmer's PC Sourcebook by Thom Hogan, Microsoft Press, 1991 ISBN 155615321X