Thursday 2 April 2020

Still no games.

Didn't work on it much yesterday, and fixed a few bugs. One was to do with rounding and conversion in the SDL tone generator code ; I was using (int) as a cast but casting it too early, and the consequence was that sound stopped playing after about 3 seconds on the tone channels. Another was the latency of sound, it was starting after a slight pause, so if you say hit something and had a sound effect it was slightly too late. I wrote this beeper code something like ten years ago and never noticed this before, probably because it was barely used.

Having been experimenting though I'm quite pleased. I made some mistakes, mostly due to language switching, so I'd write a != 3 rather than a <> 3 and it would barf. I thought I'd discovered half a dozen bugs when writing test code, but it turns out all of them were errors on my part, and the interpreter was doing exactly what it should, even when it crashed. One advantage of the VM design is it's almost uncrashable - some of these retro designs write the code in the target machines compiler, which means bugs can appear there. I'd forgotten that in SAVE "filename",a,b the second b was a length not an address, so I was writing out a 35k data file not a 5k one in the file I/O testing code. So when it was loaded back in - I can't check the size because it's perfectly legitimate to load into some areas - it overwrote the return stack and gave unmatched loop errors.

There is one log term bug. If I power up the ESP32 and leave it overnight it starts keyboard repeating at some point - it's after several hours. It starts typing on its own, and only a reset of the ESP32 itself fixes it. I'll code read the ESP32 interface code, but it's so simple I think it might be a fabgl bug, memory leakage maybe ?

A couple of minor tweaks to be added today ; I want to write a couple of functions to get sprite information, and add a command to kill a Sprite. Then it will be 0.61 which will hopefully be fairly stable. The token table has been changed rather a lot, which gives odd results if you load an old tokenised program in. But I reserved a group for extensions - case , input/output ports and so on, so it should now be fairly static. Being slightly pedantic I liked to keep them in order, although apart from the first 16 which are the assembler mnemonics it doesn't matter.

No comments:

Post a Comment

Breaking change

We all make mistakes. One early mistake I made was copying (partly) the old thing in Microsoft BASIC where you didn't have to declare ...