L12_interrupts - GameBoy Advance Programming Interrupts...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
GameBoy Advance Programming Interrupts
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Responding How can we know when something has happened that requires attention? Polling: Periodically checking if something has happened Interrupts: Additional circuitry allows an outside I/O event to stop what the processor is doing, branch to code written to handle the event and then return to normal execution as if nothing had ever happened.
Background image of page 2
Polling waitForVblank() KEY_DOWN_NOW(BUTTON_START)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Processing interrupts Device requests an interrupt If interrupts are enabled (both overall and for that device) Processor saves the current value of registers Processor starts executing code at a pre-specified address: The Interrupt Handler (For us a C function) When handler is finished, processor restores the registers and goes back to the code it was working on when it was interrupted Optionally interrupt handlers may be interrupted by other interrupts.
Background image of page 4
The GBA interrupts You use REG_IE (interrupt enable register) to to tell the GBA which events you want to be interrupted by. Same bit are used by REG_IF Bit Description 0 VB – vertical blank interrupt 1 HB – horizontal blank interrupt 2 VC – vertical scanline count interrupt 3 T0 – timer 0 interrupt 4 T1 – timer 1 interrupt 5 T2 – timer 2 interrupt 6 T3 – timer 3 interrupt 7 COM – serial communication interrupt 8 DMA0 – DMA0 finished interrupt 9 DMA1 – DMA1 finished interrupt 10 DMA2 – DMA2 finished interrupt 11 DMA3 – DMA3 finished interrupt 12 BUTTON – button interrupt 13 CART – game cartridge interrupt 14-15 unused
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Steps for setting up an interrupt Disable all interrupts Set the interrupts you want to pay attention to Set the subordinate interrupt control register for your specific interrupts Set up the entry point for your interrupt handling routine Reenable interrupts
Background image of page 6
REG_IME The interrupt master enable register – the master switch
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/23/2011 for the course COMPUTER S 1372 taught by Professor Smith,david during the Spring '11 term at Georgia Institute of Technology.

Page1 / 21

L12_interrupts - GameBoy Advance Programming Interrupts...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online