cs2261_20_interrupts

cs2261_20_interrupts - Interrupts Woo woo Interrupts An...

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

View Full Document Right Arrow Icon
Interrupts Woo woo
Background image of page 1

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

View Full DocumentRight Arrow Icon
Interrupts An interrupt causes the CPU to stop what it is currently doing and execute another piece of code (process the interrupt) There are two kinds of interrupts Software interrupts – used to call low-level code that is typically provided by the OS or BIOS – called “software interrupt” because the interrupt is initiated in software. These are also sometimes called traps or system calls. Hardware interrupts – triggered by hardware events – used to let the CPU respond to asynchronous hardware events We’re only looking at hardware interrupts
Background image of page 2
Processing interrupts The CPU saves the current value of registers The CPU starts executing code at a special location, the interrupt entry point When the interrupt code is finished, the CPU restores the registers and goes back to the code it was in the middle of working on when it was interrupted We’ll only worry about processing one interrupt at a time (not processing interrupts while we’re interrupted), because we disable interrupts while one is being handled.
Background image of page 3

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

View Full DocumentRight Arrow Icon
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 4
Steps for setting up an interrupt Disable all interrupts Set the interrupts you want to pay attention to
Background image of page 5

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

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

Page1 / 17

cs2261_20_interrupts - Interrupts Woo woo Interrupts An...

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

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