AGB Programming Manual
Interrupt Control
©1999 - 2001 Nintendo of America Inc.
160
D.C.N. AGB-06-0001-002B4
15.2 Interrupt Operation
The user can arbitrarily define the Interrupt Processing Routine, but as a general rule,
the Monitor ROM handles this processing. For further details on each register, please
refer to “ARM7TDMI Data Sheet”.
15.2.1 Normal Interrupt
1) If an interrupt occurs, the CPU enters IRQ mode and control shifts to
the Monitor ROM. In Monitor ROM, save each register (R0~R3, R12,
LR_irq (former PC)) to the Interrupt Stack. The total is 6 words. Next,
call the user interrupt processing set up in 03007FFCh. Commands
called from the monitor directly must be in 32bit code format.
SP_usr
SP_irq
03007F00
IRQ Stack
SVC Stack
USR Stack
6 W O R D S
03007FA0
03007F00
SP_svc
03007FE0
03007FA0
2) User interrupt processing is done (you can reference the cause of the
interrupt with the IF Register). Also solve* problems with a stack, if
necessary.
3) Restore the registers (total of 6 words) saved to the Interrupt Stack
and return to user main processing.
SP_usr
SP_irq
03007F00
IRQ Stack
SVC Stack
USR Stack
03007FA0
03007F00
SP_svc
03007FE0
03007FA0
*Note
Only the interrupt stack is used for normal interrupt processing. Therefore,
there is a possibility of stack overflow in some cases. To solve this
problem, you can either allocate a larger interrupt stack by moving SP_usr
in advance or use user stack for both, by switching the CPU mode to the
user mode in user interrupt processing. For the latter method, see the
explanation of multiple interrupts that is discussed on the following page.