I've recently been on a bit of a retro-computing kick, and with Microsoft making their 6502 BASIC open-source, I was inspired to do something BASIC related in PICO-8. I originally thought about making a BASIC interpreter, but that was soon put on the back-burner when I noticed that PICO-8's dialect of Lua already has many similarities. Instead, it seemed a fun idea to convert BASIC listings to PICO-8 while trying to keep a similar feel to the code structure.
I pulled up one of the first results I could find and got to work. First, I converted the whole thing directly to Lua as closely as possible. Reverse-engineering the ZX Spectrum machine code was probably the trickiest part but a lot of fun. Next, I had to convert it into something better suited for the PCIO-8. This also gave me the opportunity to layout the code in an order that made a bit more sense to me. Finally, after some play testing and fiddling about, I copied the listing over to a mock-up of a magazine spread, and that's what is presented here!
Typing in the poke statements is a bit awkward, but I suppose that emulates the experience of typing in data statements. Speaking of which, while I didn't find a good opportunity to do so here, I think it would be interesting to use pokes/peeks to replicate data/read/restores. It would be a bit more authentic to that BASIC structure I was going for. Using pget to test screen contents instead of a table that mimics Spectrum screen attributes would also probably have less code overhead and look nicer in the listing. A limitation of this approach though is requiring that all custom characters (that need to be tested) have a reliable pixel to test.
Credit to David Millington for the original listing in Popular Computing Weekly, and to Simbax and RhythmLynx for the PCIO-8 font used in the spread.