Initially there won’t be a great deal on this page as I need to re-learn what I’ve forgotten some 35 years ago when we first got a ZX Spectrum.
There will be a mix of ZX Spectrum-based and PC-based work on this page. Bear with me…
Through tools such as the excellent ZX Preview, you can ‘sniff around’ the BASIC source code of many games out there. This section will have a sample of “ooh .. look what I’ve found”.
Game Remix/Upgrades (using Boriel’s ZX BASIC Compiler)
A lot of the earliest ZX Spectrum games were written using BASIC and weren’t compiled into machine code. After having peeked into a lot of them using ZX Preview, I set myself the challenge of converting an original commercial title (written in pure BASIC) into a faster version of itself.
I started my first challenge with Leopard Lord by Kayde Software (from 1983). Initially I ported the code into BASInc to test my theory out, and it worked with only a few changes. I also fixed all of the spelling mistakes that were present in the game too.
The next stage was to get it working with Boriel’s ZX BASIC using the BorIDE front-end. This has required a lot of changes to the game code, but not the actual logic. I’ve nearly completed the removal of all of the line numbers, but only after I renamed almost all of the variables. The original coder had used I as an integer and the name of an array of the items carried. The same with Verbs, Nouns, Helptext, Locations and such like. This meant a lot of search and replace within the code to separate these variables apart.
Especially as I’ve “upgraded” the printing of text to use the PRINT42 library, allowing more text to fit on screen. Although using PRINT42 library in v1.81 showed there was a bug making it ignore any CHR$(13) – aka a linefeed – so every line followed on from each other. A patched and updated beta of v1.82 was posted in the ZX BASIC Facebook group (thanks Jorge!) and the code is working better now.
Of the original code, there aren’t any line numbers left, giver or take a few minor ones. These have been retained temporarily until I can work out exactly how the particular code is working.
The PRINT42 code works well, but initially there wasn’t a way (that I can see) to get the INPUT library to use PRINT42, it uses the standard ZX Spectrum’s PRINT command only. That means, currently, that the input line for the next command is refusing to come off the very top line of the screen. However, Jorge posted a new beta on the ZX Spectrum BASIC where he’d created a new INPUT42 library. And it works brilliantly 🙂