INT (x86 instruction)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

INT is an assembly language instruction for x86 processors that generates a software interrupt. It takes the interrupt number formatted as a byte value.[1]

When written in assembly language, the instruction is written like this:


where X is the software interrupt that should be generated (0-255).

Depending on the context, compiler, or assembler, a software interrupt number is often given as a hexadecimal value, sometimes with a prefix 0x or the suffix h. For example, INT 21H will generate the software interrupt 0x21 (33 in decimal), causing the function pointed to by the 34th vector in the interrupt table to be executed, which is typically a DOS API call.

Real mode

When generating a software interrupt, the processor calls one of the 256 functions pointed to by the interrupt address table, which is located in the first 1024 bytes of memory while in real mode (See Interrupt vector). It is therefore entirely possible to use a far-call instruction to start the interrupt-function manually after pushing the flag register.

One of the most useful DOS software interrupts was interrupt 0x21. By calling it with different parameters in the registers (mostly ah and al) you could access various IO operations, string output and more.[2]

Most Unix systems and derivatives do not use software interrupts, with the exception of interrupt 0x80, used to make system calls. This is accomplished by entering a 32-bit value corresponding to a kernel function into the EAX register of the processor and then executing INT 0x80.


The INT 3 instruction is defined for use by debuggers to temporarily replace an instruction in a running program in order to set a breakpoint. Other INT instructions are encoded using two bytes. This makes them unsuitable for use in patching instructions (which can be one byte long); see SIGTRAP.

The opcode for INT 3 is 0xCC, as opposed to the opcode for INT immediate, which is 0xCD imm8. Since the dedicated 0xCC opcode has some desired special properties for debugging, which are not shared by the normal two-byte opcode for an INT 3, assemblers do not normally generate the generic 0xCD 0x03 opcode from mnemonics.[3]

See also


  1. ^ "Intel Architecture Software Developer's Manual, Volume 2: Instruction Set Reference Manual". Retrieved 2007-07-13.
  2. ^ Definition of: int 21
  3. ^ Intel 64 and IA-32 Architectures Software Developer's Manual Combined Volumes: 1, 2A, 2B, 2C, 3A, 3B, and 3C (PDF) (PDF). Intel. June 2013 [1997]. 325462-047US. Retrieved 2013-07-02.
Retrieved from ""
This content was retrieved from Wikipedia :
This page is based on the copyrighted Wikipedia article "INT (x86 instruction)"; it is used under the Creative Commons Attribution-ShareAlike 3.0 Unported License (CC-BY-SA). You may redistribute it, verbatim or modified, providing that you comply with the terms of the CC-BY-SA