The INT n instruction
Calling a software interrupt.
The INT n instruction format
| Instruction | Description |
|---|---|
| INT imm8 | Generate a software interrupt with the vector specified in imm8. |
The INT n instruction generates a call to the interrupt or exception handler specified by the destination operand. The destination operand specifies a vector from 0 to 255, encoded as an 8-bit unsigned intermediate value. Each vector is an index into the interrupt vector table.
Table of common interrupts
| Vector | Description |
|---|---|
| 00h | Divide by zero (automatic). |
| 01h | Debug (Step). |
| 03h | Debug (Breakpoint). |
| 08h | Timer (system clock). |
| 09h | Keyboard. |
| 10h | BIOS video service. |
| 13h | Disk input/output. |
| 16h | Keyboard input. |
| 21h | Main DOS interface. |
Usage example
The most common example is terminating a program through DOS.
title .model small .stack 100h code segment public ; Start of the code segment assume cs:code main proc ; Start of the main procedure mov ax, 4C00h ; Copy the process termination function number into ah and the return code into al int 21h ; Call the DOS interrupt main endp ; End of the main procedure code ends ; End of the code segment end main ; End of file. The main procedure is the entry point
Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".
Processor status flags
CF
?PF
?AF
?ZF
?SF
?TF
Yes*IF
Yes*DF
?OF
?* — TF and IF may be cleared by the processor on entry to the handler. The final state of the flags depends on the handler that is called.