Nintendo 1504166 Programming Manual - Page 161
Multiple Interrupts
View all Nintendo 1504166 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 161 highlights
AGB Programming Manual Interrupt Control 15.2.2 Multiple Interrupts 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). à If multiple interrupts occur, SPSR_irq will be overwritten, so you must save before enabling IRQ. 03007F00 USR Stack 03007FA0 SP_usr 03007F00 IRQ Stack 6 WORDS SPSR_irq SP_irq 03007FE0 03007FA0 SVC Stack SP_svc à The Stack problem is solved* (CPU mode is changed to user mode with system mode = privilege here.) and IRQ is enabled. à With user interrupt processing, user stack is used because the CPU is in system mode. When calling the subroutine, save LSR_usr as well. 03007F00 USR Stack LR_usr User Interrupt Processing SP_usr 03007FA0 03007F00 IRQ Stack 6 WORDS SPSR_irq SP_irq 03007FE0 03007FA0 SVC Stack SP_svc ©1999 - 2001 Nintendo of America Inc. 161 D.C.N. AGB-06-0001-002B4