Search This Blog

Friday, May 18, 2012

Interrupts Types

They are divided into the group of 3.
Type 0 – Type 4: these perform fixed operation so are called dedicated interrupts.
Type 5 – type 31 are reserved for higher processors like 80386 etc etc.
Type 32 – type 255 are user defined interrupts. These can be hardware or software or can be acticvated by INTR line.

They are namely

Interrupt type
Description
Type 0 – divide error
8086 performs a complicated instruction like IDIV and DIV. so for connivance 8086 automatically does a divide by zero interrupt if the result of DIV and IDIV operation is too large to fit in the destination register or the divisor is 0.
For type 0 interrupt, the 8086 pushes the flag register on the stack, resets IF and TF and pushes return address(CS and IP) on the stack.
As this is automatic and cannot be disabled in any way, then you have to account for it whenever one uses IDIV and DIV. one way is to make sure results ever become larger than the register. Another way is to simply write an ISP which takes the desired action.
Type 1 – single step
When we tell a system to single step. It will execute 1 instruction then it will stop. We can then examine the contents of the registers and the memory. Basically it’s a debugging of our program. If we are statisfied we can tell the system to move on to the next instruction.
In this system waits for our direction. The trap flag makes it easy to implement a single step feature.
When trap flag is set =, it automatically does a type 1 interrupt. It pushes flag register on the stack, resets TF and IF and pushes CS and IP values for the next instruction on the stack.
Type 2 – non maskable
8086 automatically does a type 2 interrupt when it receives a low to high transition on its NMI pin. Again when acknowledged, it pushes flag register on the stack, resets TF and IF and pushes CS and IP values for the next instruction on the stack.
The name nonmaskable given means that it cannot be disabled by any program instruction. If activated must be acknowledged by the processor. As this pin cannot be activated accidentally so we use it to signal the 8086 that some external condition needs to be taken care of.
Type 3 – breakpoint interrupt
This interrupt is produced by execution of INT 3 instruction. The main use is to implement a breakpoint function in a system.
When we insert a breakpoint, the system executes all the instructions upto the inserted breakpoint then stops. CCh is the code for INT 3 instructions.
We can use it to check our program execution in blocks. Or in simple system we can give control back to user. Or in a complicated system all execution summary can be displayed on a screen.
Type 4 – overflow
The overflow flag will be set if the signed result of an arithmetic operation on two signed numbers is too large to be represented in the destination register or the memory.
There are 2 major ways to detect and respond to the overflow. One way is to put a jump instruction i.e jump on overflow right after the arithmetic operation so that it will jump to an error routine to show that overflow error has occurred.
The second way of detecting is to put an interrupt on the overflow instruction, INTO immediately after arithmetic operation. If OF is not set it will work as NOP, but if its set it will give type 4 interrupt after it does INTO instruction.

Interrupt priority
Interrupt
Priority
DIVIDE ERROR, INTO, INT n
Highest
NMI

INTR

SINGLE STEP
Lowest

No comments:

Post a Comment