- Foreground code is running, interrupts are enabled
- Interrupt event sends an interrupt request to the CPU
- After completing the current instruction(s), the CPU begins the interrupt response
- automatically saves current program counter
- automatically saves some status (depending on CPU)
- jump to correct interrupt service routine for this request
- ISR code saves any registers and flags it will modify
- ISR services the interrupt and re-arms it if necessary
- ISR code restores any saved registers and flags
- ISR executes a return-from-interrupt instruction or sequence
- return-from-interrupt instruction restores automatically-saved status
- return-from-interrupt instruction recovers saved program counter
- Foreground code continues to run from the point it responded to the interrupt
Courtesy: http://www.scriptoriumdesigns.com/embedded/interrupts.php