🖥️ Interrupt Program

Understanding Programmed I/O & Interrupt Cycles

📋 What is Program Interrupt?

Program interrupt is a method of programmed control transfer where the computer continuously checks the flag bit for input-output device readiness.

Key Feature: The computer can process other tasks while waiting for I/O device readiness, periodically checking the flag bit.

⚡ Transfer Rates

Slow Transfer: When flag bit = 1, transfer occurs at maximum 10 characters/second.

Fast Transfer: Computer processes information at much higher rates.

This speed difference allows the computer to handle other tasks between transfers.

🎯 Interrupt Control

The interrupt flip-flop IEN can be set and cleared with two instructions:

  • ION: Set IEN to 1 (enable interrupts)
  • IOF: Clear IEN to 0 (disable interrupts)

🔄 Interactive Interrupt Cycle

Interrupt Handling Flow

Flowchart of Interrupt

Interrupt Cycle Process

The interrupt cycle is triggered after the execute phase when R = 1, IEN = 1, and the flag bit is set.

🔄 What Happens During Interrupt?

  1. Store Context: Return address is saved to location 0
  2. Branch to Handler: Program jumps to interrupt service routine at location 1
  3. Clear Flags: IEN = 0 and R = 0
  4. Process Interrupt: Execute service routine
  5. Return: Use indirect branch to resume main program
Example: Address 255 executing any instruction
Interrupt occurs → PC = 256
After interrupt cycle:
   - Return address 256 stored in location 0
   - IEN and R cleared to 0
   - Program jumps to location 1, execute service routine
Int Cycle

Register Transfer Statements

The interrupt cycle involves the following sequence of operations:

Timing Signals and Operations: T₀'T₁'T₂'(IEN)(FGO + FGI): R ← 1

First Timing Signal (R = 1, T₀):
RT₀: AR ← 0, TR ← PC

Second Timing Signal (R = 1, T₁):
RT₁: M[AR] ← TR, PC ← 0

Third Timing Signal (R = 1, T₂):
RT₂: PC ← PC + 1, IEN ← 0, R ← 0, SC ← 0

Explanation:

  • T₀: Transfer PC to TR, set AR to 0
  • T₁: Store return address in memory location 0, clear PC
  • T₂: Increment PC to 1, disable interrupts, return to instruction cycle
💡 Key Point: The control goes through fetch phase with PC=0, then indirect phase to read effective address from location 0, jumping to the interrupt service routine.

🎓 Summary

Program interrupt provides an efficient mechanism for handling I/O operations by:

Start Learning Complete Computer Description