Timer Specials
These functions are the ones I talked about on the Key specials section. These functions grant you access to one of the GBA’s timers, which will accurately register seconds. You only have one Timer, so it’s impossible to create more than one timed event at one time.
None of these specials receive an argument.
Special 0x46 – Timer starter
Starts the timer, nothing more. If called after it started running, it resets the timer.
Special 0x47 – Halt timer
Halts the timer – to resume use
Special 0x48 – Resume timer
Resumes timer. Returns nothing
Special 0x49 – Stop timer
Returns the current time.
Stops the timer in a way that, if the game needed it, it would be available. Using Special 0x48 now would start an inaccurate timer.
Special 0x4a – Read timer
Returns the time counted.
Simple reader, gets the time and delivers it
Special 0x4b – Stop timer and Update time
This is a special function. This is meant to update playing time if an ASM function takes too much time to be executed (several seconds).
Special 0x4c – Update time
Updates the time with the time taken. To be used after the ASM function that took too long if you plan on using the timer until the end, like when you need the timer to keep working after the function or the script but still want to keep an accurate playing time record.
Special 0x4d – Compare timer to 0x8010
Returns 0x1 if the timer is greater or equal to the contents of 0x8010
This is one of the functions you will use the most. Just place on this variable the time limit, run a cycle that reads the timer at the end, and you got yourself a timed mini-game. Also, an interesting fact, the timer can go for a maximum of 18 hours, so you will most likely never run out of time.
Special 0x4e – Store timer
Stores the value of the timer at 0x0203f4dc, so that you can stop the timer if you need, and restore it again with the below Special
Special 0x4f – Restore timer
Restarts the timer with the value stored at 0x0203f4dc.
Special 0x50 – Store timer to variable
One argument.
0x8006 = variable to store value to
Warning: this requires Special 0x4e to be used before it
Basically this special allows you to save as many timer results as you want and put them on hold for a while, for as long as you want. That way, you can run extra timers although you have only one.