Yeah, interrupts are the way to go when you need to measure a time. The slowest setting should be fine for a game, since you don't need it accurate. Inside the Interrupt Service Routine you increment a variable. Since interrupt speed "6" corresponds to 118 Hz on a 83+ or to 108 Hz on a 84+, you divide by 118 or 108 to get the amount of seconds elapsed (or by 12 / 11 for tenths of a second). It is important to put the calc back to normal interrupt mode before exiting, otherwise crashes occur.
... // initializing stuff
fnInt(TMR,6) //turn on the interrupt
0->T //say T is our timer variable, reset it when the game starts.
game loop {
...// Stuff
}
T->S //save the time after the game finished
S/118->S //get the seconds elapsed
...// win display stuff
LnReg // back to normal interrupt mode, this is important
LnRegr //repair any damage done by the custom interrupt
Return //Exit
Lbl TMR //the actual interrupt service routine
T++ // increment the counter variable
Return //it's a subroutine so we return as usual
We don't need to make sure it doesn't overflow if you reset it everytime a nee game starts. Since the counter is incremented 118 a second and can only hold values up to 65535, it can run 555 seconds before it resets, that's about 9 minutes. So if a game takes longer than that, you need to use multiple variables, but I guess that shouldn't be a problem right now
Either way, good luck with your project - I'm looking forward to see it