Nintendo 1504166 Programming Manual - Page 160
Interrupt Operation, 15.2.1 Normal Interrupt, In Monitor ROM, save each register R0~R3, R12
View all Nintendo 1504166 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 160 highlights
AGB Programming Manual Interrupt Control 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. 03007F00 USR Stack 03007FA0 SP_usr IRQ Stack 6 WORDS SP_irq 03007FE0 SVC Stack SP_svc 03007F00 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. 03007F00 USR Stack 03007FA0 SP_usr IRQ Stack SP_irq 03007FE0 SVC Stack SP_svc 03007F00 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. ©1999 - 2001 Nintendo of America Inc. 160 D.C.N. AGB-06-0001-002B4