View Single Post
Old 10 April 2020, 22:46   #10
Master484
Registered User
 
Master484's Avatar
 
Join Date: Nov 2015
Location: Vaasa, Finland
Posts: 525
Quote:
So which is quicker - using 4 screen height sprites or DisplayAdjust?
DisplayAdjust is a little bit quicker, for two reasons. Firstly, sprites are super fast, but not totally free, especially if they're as tall as the whole screen. And secondly, if you use DisplayAdjust, then you can use those sprites for something else, like the bird character, which would save one Blit.

But I agree that the sprites are a lot easier solution to the problem that you have.

Quote:
Is there anyway of finding out the FPS
As Daedalus mentioned, changing the background color is an easy way to evaluate program speed. But if your main loop takes more than one frame to execute, then the color changes won't produce accurate results.

This is why I usually use a more complex method to measure program performance, and it goes like this:

First make a small VBLANK interrupt routine, that looks like this:

SetInt 5
framespassed + 1
End SetInt


Put that somewhere before the main loop starts.

And then reset the "framespassed" variable to 0 just before VWait happens, like this:

framespassed = 0
VWAIT


And then, you can combine this with the "VPos" command, and print both values to screen:

VERTPOS = VPos
Print "V", VERTPOS, " F", framespassed," "
framespassed = 0
VWAIT


The "framespassed" variable tells how many frames it takes to complete one program loop. If it's 1, then your program runs at 50 FPS. If it's 2, then it runs at 25 FPS. And if it's 3, then it runs at 17 FPS, and so on.

And the "VPos" command tells the vertical line where the display beam is currently located. So this way you'll know both the FPS, and the status of the current frame.

However, notice that the print command itself is slow, and this will have an effect to program performance (each letter printed is basically one Blit). This is why I always make a key that can turn the text priting ON/OFF. And if possible I also print to a separate screen area, and not the main game screen, and do the print only once per second or something.

Also, if you want to stop the VBLANK interrupt, then "ClrInt 5" will do this.

---

So this is quite complex, but I think it's the only way to know how many frames your main loop takes. And also the VPos value is super helpful; it shows real numbers on screen instead of colors, and you can see how even small code changes will change the numbers, which really help when you're optimizing the code.

Last edited by Master484; 10 April 2020 at 23:19. Reason: fixed a small mistake
Master484 is offline  
 
Page generated in 0.04404 seconds with 11 queries