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.

Coding > Timers problem?

#17592 - corranga - Wed Mar 10, 2004 8:46 pm

I am trying to code a frame counter. the timer I am using is supposed to loop at 59.595ns (thus reaching 59595 and reseting to 0, or is this where i'm wrong?!)

The problem is, when using visualboy advance, the counter goes as high as 64000+ thus making the frame counter a bit crap and inaccurate really.

Is this because vba doesn't emulate the timer well, or am I doing something drastic?

Chris
_________________
If virtual reality is ever on a par with reality, I want to be Bomberman! :D

#17596 - DekuTree64 - Wed Mar 10, 2004 9:33 pm

The timers just run until they get to 65535, and then set back to 0 when they overflow. If you want to loop 59595 times before overflow, set the timer data to 65536 - 59595 before you start it up and it will reset to that value instead of 0 when it overflows.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku