Combining *REFRESH with WAIT
In attempting to write programs which run in both BBC BASIC for SDL 2.0 and Matrix Brandy I have in the past had difficulty achieving synchronisation with vertical refresh on both (without using conditional code). After some experimentation this pair of statements seems to do the trick:
*REFRESH WAITIn BBCSDL the *REFRESH waits for vSync and the WAIT does nothing, in Matrix Brandy the *REFRESH doesn't wait for vSync but the WAIT does. The end result seems to be that the same thing happens on both.
0
Comments
-
That'll be an implementation error on my part as I wasn't aware of that subtlety. I can add a WAIT call to *Refresh.0
-
That'll be an implementation error on my part as I wasn't aware of that subtlety. I can add a WAIT call to *Refresh.
Because of the nature of SDL 2.0 the 'refresh' and the 'wait for vsync' are inseparable, since both happen as a result of calling SDL_RenderPresent(), hence *REFRESH unavoidably works differently in BB4W and BBCSDL.
So I'm happy with the way things are. Anyway your proposal would result in an incompatibility with existing programs, since if you were to make that change any program (containing both *REFRESH and WAIT) would render at half speed, since both would wait for vSync!
Ensuring existing programs (of which there must be tens of thousands) continue to work properly is my number one consideration when making any changes or extensions to my BASICs, but seems not to concern you at all when making changes to Matrix Brandy! I find such a divergence of approach mystifying, and a little scary.
0 -
With Matrix Brandy being much newer, I take the approach that it's highly likely there are bugs and implementation misinterpretations, and those should be fixed - you've been working on BBC BASIC in one form or another for almost as long as I have lived so your history and background have far more breadth and depth than I could ever hope to have. But, since you have implementations of *Refresh that don't wait for vSync, then I'll leave it alone.0
-
With Matrix Brandy being much newer, I take the approach that it's highly likely there are bugs and implementation misinterpretations, and those should be fixed
Think of the poor BASIC programmer, which in this case is me. Suppose you did change Matrix Brandy to make *REFRESH wait for vSync, then for a considerable (indeed indefinite) period of time there would be users with the old version (which doesn't wait) and users with the new version (which does).
How then would I write a program with the intention of it running in Matrix Brandy? Basically I couldn't, unless the program somehow tested the version at runtime and used different code depending on what it found. I don't consider that to be an acceptable overhead.
1