Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Features breaking compilation in older ZXBasic programs
#1
Hello

So I've been using ZXBasic for a while, and after struggling for a while trying to compile some code finally realised some issues. To sum it up, I tried compiling Souls Remastered, since the keyboard input wasn't working on my Timex TC2048. However, while trying to compile I kept getting IF statement errors, which I attributed to the compiler itself. However, it turned out to be due to comments placed in front of the IFs, which were being recognized as one-line commands and "resolving" the IFs, creating errors with the END IFs afterwards. This seems to date back to a previous version before the one-line IF feature was implemented. In fact, many other ZXBasic games by Retrobytes and even the BerkzMan game from the tutorials page seem to expect this feature to be absent in order to compile, so providing a solution seems like a must.
So what do I propose? Well, I see two solutions: One, adding a legacy option for the compiler, say -L. This would be the easiest, and allow compilation of unmodified older code.
Two: implementing a routine that counts all IFs and END IFs in the program flow and checks if they are the same, as well as checking for comments in front of IFs. This may be a more robust solution, letting everyone program as they want without having to check some obscure command line option.

Aside from that, there seem to be a few other bugs. There seems to be no check for writing to memory above the 64k limit, since I have written a few programs that, when loaded through the BASIC loader, give an Out Of Memory error on the Spectrum. Other than that, there seems to be a bunch of data added along the print command, which I assume is a character set. But is this really necessary when the program only uses UDGs or spaces? In that case, the whole set could be left out, saving a decent amount of space. It could even be optionally left out, and swapped for the ROM character set.

Well that would be all, please say what you think
Reply


Messages In This Thread
Features breaking compilation in older ZXBasic programs - by MrKOSMOS - 06-17-2022, 06:51 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)