timers - GameBoy Advance Programming Timers Common Practice...

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

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

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

View Full DocumentRight Arrow Icon
Common Practice Game timing is normally synchronized with the vertical blank. For certain applications such as precise DMA transfers involving sound, timers are used. Timers are also sometimes used in profiling studies, that is, determining how much time is spent in executing different portions of code.
Background image of page 2
GBA Timers Trigger an event after a duration, or hold the elapsed time since started 4 timers available 4 different speeds/frequencies each timer can use any frequency Can be chained together to create longer timers
Background image of page 3

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

View Full DocumentRight Arrow Icon
Timer Layout FREQ OV IR ON 0 0 0 0 0 0 0 0 0000000000000000 REG_TMxCNT REG_TMxD 0 0 0 0 0 0 0 0 0000000000000000 0 0 0 0 0 0 0 0 0000000000000000 0 0 0 0 0 0 0 0 0000000000000000 0 1 2 3
Background image of page 4
Timer Registers Timer register holds number of elapsed timer ticks 16 bits 0 through 65535 ticks, then overflow or reset Timer control register sets frequency, overflow, and enables timers
Background image of page 5

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

View Full DocumentRight Arrow Icon
REG_TMxCNT Bits 0-1: Frequency See next slides 2: Toggle overflow from previous timer #define TM_CASCADE (1<<2) 6: Generate interrupt when timer register is full #define TM_IRQ (1<<6) 7: Enable timer #define TM_ON (1<<7)
Background image of page 6
Frequency, etc. Bits 0-1
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.

Page1 / 22

timers - GameBoy Advance Programming Timers Common Practice...

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