Hi there,
yesterday I took the MEGA65 to our local makerspace and did a bit more BASIC coding there. Of course, I'm mostly interested in coding games. I made use of the COLLISION command, but I noticed that I would also like to sync up my main loop to the monitor refresh rate in a way, so I got the following idea:
How about a command that helps you sync up to the raster frequency, e.g. either something like that:
SYNC 220, 400
this could tell the BASIC65 to register a raster interrupt on raster line 220, which should then GOSUB into BASIC line 400 (similar to how the COLLISION command GOSUBs to a BASIC line)
or something like that:
SYNC 220
to be used in place, e.g. instead of SLEEPing inside your main loop for a certain amount of time, you could tell the BASIC interpreter to wait until raster line 220 has been reached. Basically like reading $D012 and the high bit of $D011 and waiting for a certain number, but in a more convenient, BASIC way. Without arguments, SYNC could just wait until the off-screen interrupt for PLAY, MOVSPR and so on occurs.
maybe there are even other, better versions of how to implement this, so I'll leave that to the BASIC experts, but I think having something like this would make game programming in BASIC so much better!