The INTO instruction
Interrupt on overflow.
The INTO instruction format
| Instruction | Description |
|---|---|
| INTO | Generate a software interrupt with vector 4 if the OF flag = 1. |
The instruction checks the state of the overflow flag (OF). If OF = 1, it generates a software interrupt of type 4 (vector 4). If OF = 0, the instruction does nothing and execution continues with the next instruction. INTO is used to handle arithmetic errors in signed operations.
Usage example
title .model small .stack 100h code segment public ; Start of the code segment assume cs:code main proc ; Start of the code segment mov al, 127 ; AL = 7Fh (127) add al, 1 ; AL = 80h (-128), an overflow occurs (OF=1) into ; Since OF=1, interrupt 4 will occur mov ax, 4C00h ; This part will not be executed if an interrupt occurred int 21h 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
?* — On entry to the handler, TF and IF may be cleared.