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.
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.
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.