BIOS Interrupts

INT 10h video services, INT 16h keyboard.

Mohith N
Updated: 19 March 2026
10 min read

BIOS interrupts provide a hardware-independent software interface that allows assembly programs to control video display and keyboard input without writing directly to hardware ports. The Basic Input/Output System (BIOS) stores these services in ROM and makes them available through software interrupts. Two of the most frequently used BIOS interrupt services in 8086 programming are INT 10h for video and INT 16h for keyboard, both of which are essential for practical examinations and assembly language labs.

BIOS Interrupt Services Overview: INT 10h and INT 16hINT 10h - Video ServicesAH = function numberINT 16h - Keyboard ServicesAH = function numberAH=00hSet video modeAL = mode numberAH=02hSet cursor positionDH=row, DL=col, BH=pageAH=03hGet cursor positionReturns DH=row, DL=colAH=0EhTeletype char outputAL = char, BL = colorAH=00hRead key with waitAL=ASCII, AH=scan codeAH=01hCheck key (no wait)ZF=0: key ready, ZF=1: noneAH=02hGet shift statusAL = shift flag byteINT 10h AH=06hScroll window upAL=lines, BH=attribINT 10h AH=00h Video ModesAL=03h: 80x25 color text (most common)AL=02h: 80x25 monochrome textAL=13h: 320x200 256-color graphics
Figure 1: BIOS INT 10h video services and INT 16h keyboard services with AH function numbers and register usage

Core Concept Explanation

BIOS services sit between the hardware and the operating system, providing a consistent interface regardless of the underlying hardware differences. When a program calls INT 10h or INT 16h, the BIOS code stored in ROM handles the actual hardware interaction. This means the same assembly code can run on different hardware configurations as long as the BIOS conforms to the standard interface. In the 8086 programming model, BIOS interrupts are invoked the same way as DOS interrupts: load function number into AH, set other registers as needed, execute the interrupt.

INT 10h provides all video-related services. Function AH=00h sets the video mode. The mode value in AL controls the screen resolution, number of colors, and text/graphics mode. Mode 03h is the standard 80 columns by 25 rows color text mode used in most assembly programs. Function AH=02h moves the cursor to a specific screen position: DH holds the row (0-24), DL holds the column (0-79), and BH selects the display page (normally 0). Function AH=03h reads the current cursor position back into DH and DL.

Function AH=0Eh is the teletype output function of INT 10h. It prints the character in AL at the current cursor position and advances the cursor automatically, just like a teletype machine. BL holds the foreground color attribute. This function respects backspace, carriage return, and linefeed characters, making it useful for basic text output with formatting. Function AH=06h scrolls a defined window region upward by a specified number of lines, which is used for building scrollable text displays.

INT 16h Keyboard Services

INT 16h handles keyboard input at the BIOS level. Function AH=00h waits for a key to be pressed and returns with AL = ASCII code and AH = scan code of the key. The scan code is a hardware-level code assigned to each physical key position on the keyboard, independent of which character the key produces. For special keys (function keys, arrow keys) that have no ASCII value, AL is returned as 00h and AH holds the extended scan code.

Function AH=01h of INT 16h checks whether a key is waiting in the keyboard buffer without removing it and without waiting. If a key is ready, ZF is cleared and AL/AH are set. If no key is available, ZF is set. This is useful for non-blocking keyboard polling in games or real-time programs. Function AH=02h returns the current state of shift keys (Shift, Ctrl, Alt, Caps Lock) in AL as a bit field.

Mathematical Expression

For the cursor position functions, the screen is modeled as a 2D grid. In 80x25 text mode, row values range from 0 (top) to 24 (bottom) and column values from 0 (left) to 79 (right). The linear video memory offset for a character at row R and column C in a text mode with W columns per row is given by: Offset = (R x W + C) x 2, where the factor 2 accounts for the two bytes per character cell (one for ASCII code, one for attribute). For 80-column mode: Offset = (R x 80 + C) x 2. This formula helps understand direct video memory access at segment B800h in color text mode.

Practical Understanding

In practical lab programs, INT 10h and INT 16h are used together to build interactive screen-based menus. A program might use AH=00h to initialize the video mode, AH=02h to position the cursor for each menu item, AH=0Eh to display text, AH=06h to clear the screen, and INT 16h AH=00h to wait for the user's key selection. This combination demonstrates the complete workflow of a BIOS-level interactive application.

One important distinction: INT 10h AH=0Eh displays at the current cursor position and moves the cursor forward, while INT 10h AH=09h (write character and attribute) writes at the current cursor but does NOT advance the cursor. Confusing these two is a common mistake in viva examinations. Additionally, BIOS functions work independently of DOS, so they can be used in programs running before DOS loads, such as bootloaders.

Solved Numerical Example

Using INT 10h, a programmer wants to position the cursor at row 12, column 40 (center of an 80x25 screen) on page 0, and then calculate the linear video memory byte offset of that position in color text mode (base B800h).

Example
Given:
Row (R) = 12, Column (C) = 40
Page = 0 (BH = 00h)
Screen width W = 80 columns
Color text mode base segment = B800h

Why this formula applies:
Each character cell = 2 bytes (ASCII + attribute)
Linear offset = (R x W + C) x 2

Formula:
Offset = (R x W + C) x 2

Substitution:
Offset = (12 x 80 + 40) x 2
Offset = (960 + 40) x 2

Calculation:
Offset = 1000 x 2 = 2000 decimal = 07D0h

Final Answer:
Cursor set with: DH=0Ch, DL=28h, BH=00h, AH=02h, INT 10h
Video memory byte address = B800h:07D0h
Absolute physical address = B8000h + 07D0h = B87D0h
Exam Tip: INT 16h AH=00h WAITS for a key and removes it from the buffer, while AH=01h checks for a key without waiting and without removing it. Mixing these up in MCQs is a common error. Also, scan code in AH from INT 16h is the physical key position, not the ASCII value.
BIOS Interrupt Call Mechanism and Video Memory LayoutAssembly ProgramMOV AH, 0EhMOV AL, 'A'MOV BL, 07hINT 10hDisplays 'A' on screenBIOS ROM HandlerReads AH=0EhRoutes to TTY handlerWrites char + attrVideo MemorySegment B800hChar byte + Attrib byteChar visible on monitor80x25 Text Mode Video Memory Layout (B800h)Offset = (Row x 80 + Col) x 2Row 0: Cols 0-79Offset: 0000h to 009EhRow 12: Cols 0-79Offset: 0780h to 0876hRow 24: Cols 0-79Offset: 0F00h to 0F9Eh
Figure 2: BIOS INT 10h call path from program to video memory and 80x25 text mode memory offset layout
  • INT 10h AH=00h: set video mode (AL=03h for 80x25 color text, AL=13h for 320x200 graphics).
  • INT 10h AH=02h: set cursor (DH=row, DL=col, BH=page); AH=03h reads cursor position.
  • INT 10h AH=0Eh: teletype output (AL=char, BL=color), cursor advances automatically.
  • INT 16h AH=00h: wait for key, returns AL=ASCII, AH=scan code.
  • INT 16h AH=01h: non-blocking check; ZF=0 means key ready, ZF=1 means no key.
  • Color text video memory at segment B800h; offset = (R x 80 + C) x 2.

Quick Revision

  • INT 10h = video BIOS; INT 16h = keyboard BIOS.
  • INT 10h AH=00h: video mode setup. Mode 03h = standard 80x25 color text.
  • INT 10h AH=02h: cursor position (DH=row, DL=col). AH=0Eh: display char and advance cursor.
  • INT 16h AH=00h: blocking read (waits). AH=01h: non-blocking poll (checks ZF).
  • Video memory offset formula: (Row x 80 + Col) x 2 from B800h.
  • Scan code (AH) is physical key position; ASCII (AL) is zero for special keys.
  • Exam trap: AH=0Eh moves cursor; AH=09h (write char) does NOT move cursor.

BIOS Interrupt Services

Interface with hardware level BIOS routines.

Question 1 of 3

Q1.Which BIOS interrupt handles direct video services like setting the cursor position?