LineJewels: One BASIC Listing for the Atari, C64, BBC Micro, CPC and PC
In late January 2024 la1n, who signs the game "chludens.ch (experimental archaeology)", posted a public beta of LineJewels 0.6. It is a deliberately old-fashioned experiment: a small action-puzzle game written as one BASIC listing that should run on as many 8-bit (and early PC) BASICs as possible. The target list is the Atari XL, Commodore 64, MS-DOS GW-BASIC, Amstrad CPC and BBC Micro, with notes for MSX and the PET as well. The author calls it a "neo listing", a new type-in.
The game
LineJewels is a one-button take on Bejeweled. Each turn a row is printed one stone at a time, using the symbols #, X, O and .. Press A to step forward to the next stone, or S to set the current stone and end the line. If the stone completes a run of three or more matching stones (vertically or diagonally with the lines above, or horizontally within its own line), you score, and two runs at once score more. You have 50 lines to get the best score, and the delay between stones shrinks as you go.
Writing BASIC for five machines
The interesting part is how the listing copes with the differences:
- No graphics commands, not even CLS. Everything is drawn with
PRINTandPRINT ;, and the screen is "cleared" by printing 40 blank lines. - Two-character variable names, so Dartmouth-style interpreters that only see two characters don't confuse variables.
- Keyboard reading is the main machine-specific code. At start-up you pick your computer, and the program jumps to its own key routine. On the Atari it reads the last key pressed from location 764 (
PEEK(764), keycodes 63 for A and 62 for S) and resets it withPOKE 764,255. - Random numbers differ. The program first tries
RND(4)as an integer generator, as some BASICs treat it. If the result isn't a whole number 0–3, it falls back toINT(RND(1)*4), which works on the Atari. - Strings are the Atari's sore point. Atari BASIC needs every string
DIMmed and cannot join strings with+, so Atari-specific lines append withRE$(LEN(RE$)+1)=...instead.
That last point is where the beta stumbles. Testers on the Atari (and in BASIC XE) found that the lines using + concatenation are rejected as syntax errors when the listing is entered. The author's advice was to ignore them, and a corrected version was promised. Anyone typing it in should expect to patch those lines.
Why it matters
LineJewels is a small, friendly demonstration of why "portable BASIC" was always harder than it looked, and of how much Atari BASIC's string handling differs from the Microsoft family. It is also a good exercise for anyone who likes type-ins: the whole game fits in about 200 short lines.
Getting it
The full listing is posted in the AtariAge thread "NEW RELEASE: LINEJEWELS 0.6 (Public Beta)". Paste or type it into Atari BASIC on an XL/XE (or in an emulator), RUN it, and choose 2 for the Atari 800XL at the computer prompt.
Credits
- AtariAge — NEW RELEASE: LINEJEWELS 0.6 (Public Beta) - CROSS PLATFORM BASIC GAME — AtariAge forum members
