English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 08 December 2018, 00:08   #1
guy lateur
Registered User
 
guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
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?
guy lateur is offline  
Old 08 December 2018, 04:49   #2
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,039
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.
a/b is offline  
Old 08 December 2018, 11:07   #3
guy lateur
Registered User
 
guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
Quote:
Originally Posted by a/b View Post
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!
guy lateur is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to measuring the CPU cycles/instr ! (A500) amilo3438 Coders. Asm / Hardware 20 31 August 2017 20:22
measuring in layout - lightwave source support.Apps 7 25 June 2016 00:20
Measuring/comparing display latency mark_k support.WinUAE 2 02 March 2016 16:15
Measuring speed with pixels Lonewolf10 Coders. General 19 18 November 2011 09:31
Frames Twistin'Ghost HOL data problems 16 20 September 2003 10:26

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09425 seconds with 13 queries