Trap (ZX-81) conversion to QBasic
A downloadable wangbomb for Windows
Original by Dilwyn Jones (circa 1982?)
Conversion by John Szczepaniak
Date: July 2024
---
I'd ordered a book on ZX-81 games, thinking it would list the system's library. Since I have a fondness for the little micro. As it turns out the book was actually a limited selection of BASIC type-in listings. Seeing as I'd spent £3, I figured I should at least type in one.
I chose TRAP. A simple game where you move step by step, and with each step a wall appears at one of the four cardinal directions, chosen at random. Touch one of these walls, or an outer wall, and you die. Simple but fun idea. Time to type it in.
Or rather, see if I could make a conversion to QBasic. It should be easy, right? Whatever variant of BASIC the ZX-81 uses, it'll be less powerful than QB... Right?
Not quite.
The type-in listings cheat. They're not strictly BASIC, there's some machine code / assembly there too, via PEEK and POKE statements. Which is annoying because these aren't supported in QB. Not in the same way, at least. QB has PEEK and POKE commands, but they don't operate the same.
Frustrating.
So I figured, well, I'll port as much as I can then do the rest from scratch. The PEEK / POKE statements were for the collision detection. Which I ran into some trouble with - I had been trying to detect the X axis and Y axis as two separate statements. And it kept failing in weird ways. So I went to the QB64 and was helped by a very kind forum user, who rewrote the code, explaining that I need to check them both at the same time.
I've included a folder with older versions. The first three are my failed attempts. The fourth one is his fixed version, with added fun stuff.
I then made a fifth version, trimming out as much as possible, to make the prog as small as possible. The original was a 1K program, but sadly no matter how tight I tried to make it, 1.3K is as low as I could go. I found it fascinating that a more powerful language actually needed more raw code space to dot he same thing.
Be careful if compiling it in QB64, since it doesn't like the two IF statements on Line 55. I also jazzed up the original's graphics by swapping the + symbol for a smiley face.
I've also included photos of the book pages, so you can compare.
All in all, a fun time and the first time I'd ever attempted a system to system "conversion". I wonder if this is what it was like back in the day?
There's also a compiled EXE for use in Windows.
Published | 6 days ago |
Status | Released |
Platforms | Windows |
Author | SZCZ GAMES |
Genre | Action |
Tags | conversion, qb, qb64, qbasic, sinclair, trap, zx-81, zx81, ZX Spectrum |
Download
Install instructions
Just double click the EXE. Or compile the BAS source code.
Leave a comment
Log in with itch.io to leave a comment.