gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Resetting timer

#173943 - Pete_Lockwood - Sun May 09, 2010 1:09 pm

Got a timer firing every second:

Code:

    TIMER_CR(1) = 0;
    TIMER_DATA(1) = 32768;
    TIMER_CR(1) = TIMER_ENABLE | TIMER_DIV_1024 | TIMER_IRQ_REQ;
    irqSet(IRQ_TIMER1, somefn);
    irqEnable(IRQ_TIMER1);



I want to reset it, say, 3/4 of a second into a tick so that the next tick will be 1 second later instead of 1/4 of a second later. I tried a pair of likely looking addresses off GBATEK but no dice. Anyone?
_________________
It's not an illusion, it just looks like one.

#173950 - Dwedit - Sun May 09, 2010 8:31 pm

Stop, then restart the timer. That copies the reload value into the timer value.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#173951 - Pete_Lockwood - Sun May 09, 2010 8:43 pm

ty.
Thought I'd tried that and it hadn't worked. But looks good.
_________________
It's not an illusion, it just looks like one.