English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. Asm / Hardware (http://eab.abime.net/forumdisplay.php?f=112)
-   -   Measuring time/frames (http://eab.abime.net/showthread.php?t=95396)

guy lateur 08 December 2018 00:08

Measuring time/frames
 
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?

a/b 08 December 2018 04:49

Code:

waitFrame1:
    move.w #$0f0,$dff180  ; new
...
    beq.s  waitFrame2
    move.w #$000,$dff180  ; new

If the entire screen is blinking in green color it takes more than 1 frame.

guy lateur 08 December 2018 11:07

Quote:

Originally Posted by a/b (Post 1289566)
Code:

waitFrame1:
    move.w #$0f0,$dff180  ; new
...
    beq.s  waitFrame2
    move.w #$000,$dff180  ; new

If the entire screen is blinking in green color it takes more than 1 frame.

Excellent idea, thanks! :great


All times are GMT +2. The time now is 21:29.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.

Page generated in 0.04574 seconds with 11 queries