Interrupt Handler

From SnesLab
Jump to: navigation, search

An Interrupt Handler is a subroutine which the CPU automatically runs when an interrupt occurs.

ISR stands for "interrupt service routine." Interrupts are never serviced when an instruction is only partially finished running (except if you count MVP/MVN which can be interrupted once every 7 cycles), but only after the instruction completes.

Use BRK to force a software interrupt.

When an interrupt occurs, the following are pushed to the stack in this exact order:

  1. program bank register
  2. program counter high byte
  3. program counter low byte
  4. status register

Return control back with RTI when on the 65c816 or RETI when on the SPC700.

See Also