How does an interrupt work? The 8086 reserves the lowest 1024 bytes of memory for a table containing the addresses for each of the 256 possible interrupts. When an interrupt occurs (hardware or software), the processor multiplies its number by 4 and looks at the resulting memory location to find the address of the piece of code which handles the interrupt. It then places the current address in the program and the processor flags on the stack, and jumps to the beginning of the interrupt handler. When the interrupt handler finishes, it invokes a special instruction to return from the interrupt. This instruction takes the previously saved flags and program address off of the stack and places them back in the appropriate registers in the CPU. The interrupt handler has to be careful to preserve any registers that it uses which are not used to communicate results to the program that invoked the interrupt. If the interrupt can be triggered by a hardware interrupt (only certain ones can on IBM PC's, XT's, and AT's), then the interrupt handler has to preserve ALL registers, since the interrupt could have happened anywhere. .