Search This Blog


Friday, May 18, 2012

Interrupts in 8086

The meaning of ‘interrupts’ is to break the sequence of operation. While the cpu is executing a program, on ‘interrupt’ breaks the normal sequence of execution of instructions, diverts its execution to some other program called Interrupt Service Routine (ISR).
After executing ISR , the control is transferred back again to the main program.
CPU checks for interrupts after every step.

Purpose of Interrupts
Interrupts are very helpful in data input output. CPU uses interrupts to communicate with I/o devices that provide data at a relatively low transfer rate.

Interrupt sources
There are 2 basic interrupt sources first is the hardware and second Is the software.

Hardware Interrupts include NMI and INTR.
Software Interrupts include interrupts in form of software instructions like INT etc .

AS 8086 is an advanced processor so it also has a third source of interrupt that is a error interrupt. It occurs when executing the instruction of the processor error condition is produced in 8086.
Like divide by zero error, or overflow error etc.
Due to inclusion of instruction of signed division and multiplication in the 8086 processor these types of error condition interrupts where necessary for helping programmer out.

Interrupt Response
As said earlier 8086 checks for interrupts after executing each instructions. These checking can be organized in following steps:
1)      Decrements the stack pointer by 2 and pushes the flag register.
2)      Disables INTR interrupt input by clearing IF flag.(interrupt flag)
3)      Resets the trap flag(TF).
4)      Decrements the stack by 2 and pushes current code segment register onto the stack.
5)      Decrements the stack by 2 and pushes instruction pointer IP onto the stack.
6)      Does an indirect far jump to the start of the procedure to respond to the interrupt.


  1. Let's see: processor executes instruction at address 0100H. Prefetch unit filled up the queue and IP now is 0106H. Now an interrupt arrives. Processor should save instruction pointer on stack, but prefetch unit already changed IP! And processor at the end of interrupt can't return to next instruction, it can return only to address 0106H! Where am i wrong?

  2. what is the sequence for its execution??