I'm trying to check wether I get everything done inside the duration of a frame (ie, in a 50th of a second). Assuming I had a way of measuring time sufficiently accurately, I could measure the time before I 'do my stuff', and then again at the end. Within each frame, I mean.
This is for application in a demo, so the measuring would preferably have as small an influence as possible. I'm using Photon's frame loop, btw, so this is what it would look like:
Code:
;-- main loop start
mainLoop:
waitFrame1:
btst.b #0,$dff005
bne.s waitFrame1
cmp.b #$2a,VHPOSR
bne.s waitFrame1
waitFrame2:
cmp.b #$2a,VHPOSR
beq.s waitFrame2
;-- frame loop start
;TODO: timeStart = current time
;do my stuff
;TODO: timeStop = current time
;TODO: duration = timeStop - timeStart
;TODO: assert that duration < 20 milliseconds
;-- frame loop end
;-- main loop end
btst #CIAB_GAMEPORT0,CIAAPRA ;LMB pressed?
bne.b mainLoop
If this is not an option (and I honestly don't think it will be), I could probably measure the duration of the whole mainLoop and count the frames, I guess, and assert the 'mean frame execution duration' is fast enough.
So anyway, does anybody have any other thoughts on how to go about this?