Interrupts

The DOS operating system provides a number of useful I/O functions.

When a program wants to execute one of these functions it executes:

int ZZh

where ZZh is the 8-bit hex number of the desired function.

The processor saves the state of the current program, looks up the address of the desired function from the ID number, then loads the IP with this address.

Some I/O functions have sub-functions. In this case the AH register contains the 8-bit hex of the desired sub-function:

mov ah, XXh
int ZZh

Further, an 8-bit argument can be passed to this function through the AL register:

mov ah, XXh
mov al, YYH
int ZZh

Here's a complete list of the I/O functions and their sub-functions:

8088 Interrupts

Examples:

To print a single character to stdout:

mov ah, 02h
mov al, 'X'
int 21h

To read a character from stdin and load it into the al register:

mov ah. 01h
int 21h