Professional Documents
Culture Documents
Interrupt Mechanism
Main Program
Instruction N
Interrupt 32 occurs
during execution of
instruction N in the
main Program
Instruction N+1
:
:
End of Program
Service Subroutine
Service routine
for interrupt 32
Return
Processors & Assembly Language
Interrupt Priority
Increasing
Priority
Reset
Internal interrupts & Exceptions
Software interrupts
Nonmaskable interrupts
External interrupts
Answer
Up to 256 interrupts
Divided into five groups:
A 16 bit register to hold indicator bits. Not all bits are used.
11
10
OF
DF
IF
TF
SF
ZF
AF
PF
CF
Carry Flag
Parity Flag
Auxiliary Carry
Zero
Sign Flag
Trap Flag
Interrupt Enable
Direction Flag
Overflow Flag
On interrupt:
1.
2.
3.
4.
5.
1Kbyte ROM
06
CS1
04
IP1
02
CS0 Base
00
IP0 offset
Example 2,
What is the address of the interrupt INT 50, find
the CS and IP address
Answer:
Software Interrupts
INT n:
Software interrupt instruction.
Program will transfer the the subroutine pointed to by
vectors.
IRET
Interrupt Return
Must be used at the end of each ISR
Causes old value of flags to be popped
CS & IP are popped
A 16 bit register to hold indicator bits. Not all bits are used.
11
10
OF
DF
IF
TF
SF
ZF
AF
PF
CF
Carry Flag
Parity Flag
Auxiliary Carry
Zero
Sign Flag
Trap Flag
Interrupt
Enable
Direction Flag
Overflow Flag
16
Nonmaskable Interrupt
NMI:
1. Cannot be masked out with the interrupt
flag
2. Apply logic 1 at the NMI input, not INTR
input.
3. NMI input is positive edge-triggered
Reset Interrupt
Divide Error:
IDIV or DIV larger than specified destination
Type 0 interrupt
Overflow Error:
INTO
Interrupt-on-overflow
Must be included after arithmetic instructions
Type 4 interrupt
IP at 0010H & CS at 00012H
Single Step:
Breakpoint:
CC instructions
Cause execution to stop at a certain location
A 16 bit register to hold indicator bits. Not all bits are used.
11
10
OF
DF
IF
TF
SF
ZF
AF
PF
CF
Carry Flag
Parity Flag
Auxiliary Carry
Zero
Sign Flag
Trap Flag
Interrupt Enable
Direction Flag
Overflow Flag
24
Interrupt Instructions
Symbol
Meaning
Format
Operation
Flags affected
CLI
CLI
0 (IF)
IF
STI
STI
1 (IF)
IF
INT n
Type n software
interrupt
INT n
Flag ((SP)-2)
0 TF, IF
CS ((SP)-4)
(2 + 4.n) (CS)
(IP) ((SP) 6)
(4.n) (IP)
TF, IF
IRET
Interrupt Return
IRET
(SP) (IP)
((SP) + 2 ) (CS)
((SP) + 4 ) (Flags)
((SP) + 6 ) (SP)
All
INTO
Interrupt on overflow
INTO
INT 4 steps
TF, IF
HLT
Halt
HLT
None
WAIT
Wait
WAIT
None