The comp.sys.sinclair Crap Games Competition 2021 - 25th edition!

 

COMPETITION BONUS: MAGIAPOTAGIA 1977

Author:  Jim Waterman Models:  Apple II,
Commodore PET 2001,
TRS-80 Model I
Formats:    .AWS.YAML (Apple II)
 .TAP (PET)
 .CAS   .BAS (TRS-80)
Submission date:  27 November 2021
(released 19 December 2021)
Documentation:  listings for all versions, background, emulator guide, loading instructions Tested on:   AppleWin 1.30.6.0
VICE 3.3
TRS-80GP 2.4.4
(In another reality this might have been) AN ENTRY FOR THE GREEN CHALLENGE
Recycled from Magiapotagia by Daniel "McFly" Aguilar
(In another reality this might also have been) THREE ENTRIES FOR THE WHITE CHALLENGE

Download it here

All right, I admit it, this isn't actually being entered for the Green Challenge, for some obvious reasons:

  • the competition has ended;
  • I wouldn't enter my own competition anyway;
  • no Sinclair or Sinclair-derived computers are involved.

This is a bonus offering, and this isn't an accompanying review - it's a blow-by-blow account of my experience with three computers I'd never previously tried to program, one of which was totally unfamiliar.

Back in May, Daniel "McFly" Aguilar sent me Magiapotagia, a program that would have worked on the 16K Spectrum if only the graphics hadn't been hard-poked to 65368. I speculated that it was simple enough to be de-converted for the three computers that were collectively known as Byte magazine's 1977 Trinity: the Apple II, the Commodore PET, and the TRS-80 Model I. Towards the end of November, with over 50 CSSCGC entries in the bag and reviewed, I thought I'd tackle this challenge myself and make this bonus package. I intended to have a determined attempt to remake Magapotagia on all three computers, but if any turned out to be impossible, no biggie, as long as it could be done on one of them.

APPLE II INTEGER BASIC VERSION:

After reading a summary of the BASIC of each computer and assessing the suitability of each one for the task, I tried the Apple II first. As the most expensive of the three, at $1,298 for the 4 KB base model, this is the only one of the Trinity that had colour and sound. For my purposes, the first of these could be discarded instantly - colour is only available on the low-resolution graphics screen that allows only three lines of text at the bottom (vaguely similar to putting a 128K Spectrum into "Screen" mode on the EDIT menu). Sound was possible, but only via repeated POKEs to or PEEKs from address -16336, and it wasn't worth trying. Getting the essentials of Daniel's original program in and displaying the cards in a way similar to what he'd done was the target.

There were, of course, complications due to the primitive nature of any BASIC that's five years older than the Spectrum. Apple Integer BASIC is the oldest of the three, launched in 1976 on the Apple I but had to be loaded from an external source; at least the Apple II has it in ROM. Daniel's original program used four string arrays to hold the pack and the left, middle and right columns; Apple Integer BASIC requires every string variable to have its own DIM, and it's treated like a Spectrum string array with only one element. This meant ditching what I thought of as arrays and moving the cards via string slicing, and if you thought Spectrum BASIC had a strange way of doing it, Apple Integer BASIC is ever weirder in both handling and concatenation.

Once I'd cracked that, and made the cards move in the correct way, displaying them couldn't be done the way I wanted; never mind that fancy GR mode with its HLIN and VLIN which would have been ideal, I was stuck with ASCII art instead. The Apple II's keyboard was based on a Teletype machine and has no underline character, nor any non-cheaty shortcuts for it, but a PC keyboard does and the AppleWin emulator will allow access to it. But a strange quirk of Integer BASIC is that PRINT "_" returns a syntax error - and there's no CHR$ function to access it that way, either! And with the graphics mode also out of the question, I had to make do with +, - and ! symbols instead.

The upshot of this is that the version of Magiapotagia written on the most expensive computer of the Trinity is the one that looks the most primitive. And to add insult to injury, I've had to present it as a memory snapshot; AppleWin only has provision for a disc drive, which would not be added to the Apple II until 1978 - the syntax for tape recording is still intact, but it doesn't do anything and I can't create a tape image. Still, I considered that a success; one computer from 1977 did accept the cut-down version of Magiapotagia and I could have left it at that... but it was worth a shot on the other two, surely?

COMMODORE PET 2001 VERSION:

Due to production problems (see, those weren't exclusive to Sinclair!), the PET was launched in December 1977, mostly in its 8 KB form with only a few 4 KB machines escaping into the wild, and cost $795. The Apple II project had shown me that Daniel's original was very inefficiently programmed to the point that it took over 4 KB; with these 1977 computers all being available with 4 KB of RAM in their base specification, I had to take that as a maximum size. So, taking the Apple II listing as the basis, which was around 1.2 KB, the aim was to convert it for the 8 KB PET 2001-8N, but make sure it would fit into the near-mythical 4 KB model. VICE is the emulator of choice for all Commodore 8-bits from the PET to the C128, and just about every PET model is selectable.

With the benefit of hindsight, this was the easiest computer to write for, and not just because I already had a tenuous grasp of Commodore BASIC's weird method of moving the PRINT position around on screen with visible control characters ("why is this listing full of hearts, brackets and Qs?"). BASIC 1.0, which was only available on the PET 2001, is no different to the C64 on this front, and joy of joys, it can handle string arrays - so Daniel's original method of moving the cards around this way was how I did it. The display, control characters aside, was enhanced by the graphics that are available with shifted characters - there are all sorts of lines and boxes that can be drawn if you know what you're doing with the SHIFT key. Unfortunately, someone at VICE HQ decided that SHIFT+P, which would otherwise have drawn one of these line-graphics directly, was an excellent shortcut for "pause" (and you can imagine my further frustration every time I went for that shortcut trying to print a quotation mark... curse you, muscle memory!) Hence, to draw the graphic characters, I had to resort to a lot of CHR$ calls, lumping them into spare variables, and then shunt these around on screen with the Qs and brackets.

It performs as well as the Apple II version - but it looks better, and at two-thirds of the cost of Steve Wozniak's machine. There is only one slight problem, and that is that VICE's emulation of the PET 2001 looks like it has a bugged loading process; the .TAP file is correct, and was saved from a PET 2001, but neither this nor anything else with more than two lines of BASIC will load on it. It will, however, load on the PET 3008, the 1979 model with BASIC 2.0; to prove that it is capable of running on the PET 2001, I've provided the listing (as I have for all three versions). Type it in yourself and see that I am not cheating!

TRS-80 MODEL I VERSION:

As for the third machine of the Trinity, the Tandy/Radio Shack Z80 Computer, or TRS-80 for short, was the second to be launched, in August 1977. Retrospectively known as the Model I, its base model was available from your friendly local branch of Radio Shack at "only" $399, putting it just about within reach of the ordinary people, in the same way that a BMW 5-Series is more within financial reach than a Rolls-Royce. Much like the other two more expensive competitors, its base model sported 4 KB of RAM, but you could forget about colour and sound - and you'd be stuck with Level I BASIC, which is a bit like taking a ZX81-shaped knife to a C64 and Amstrad CPC gunfight.

There was floating-point arithmetic, but barely any functions available to use it. And there were graphics that could combine with the text, but they were similar to the ZX81's PLOT and UNPLOT, albeit divided into six blocks per character square, like the much more powerful BBC Micro. But what really put the biscuit crumbs in the bed as far as I was concerned was the variables; here was the point at which the "Trash-80" really lived up to its unfortunate nickname. You get 26 numerical variables, A to Z, two string variables, A$ and B$, which can only handle 16 characters each, and one numerical array, A(N), whose maximum size is 255 - but there's no DIM command; the maximum accessible size is determined by how much memory your program hasn't used.

So, far from being the easiest of the three due to my many experiments on my brother's Dragon 32 back in the day (which was a later TRS-80 Color Computer 1 with a Welsh accent), this was the greatest challenge. The weird screen layout didn't help either - the text was divided into 16 rows and 64 columns, rather than the 24 rows and 40 columns of the Apple II and PET. That was easily solved, at least once I'd worked out that PRINT commands were likely to wipe out large chunks of the screen without very careful use of semicolons, but the array was more of a challenge. It required 84 of the numerical elements available storing values 1-14 instead of strings, translating them to Daniel's original set of cards with some IF...THENs in a subroutine, and it was a right pain trying to work out which value went where, when the cards were redistributed - they all had to be done in pairs. Fortunately, when the program was finished and looking the way I wanted it to, I wasn't given a nasty surprise by running out of space for the array. The program itself was compact enough that, even expanded out into a legible form, there was still room for as much of the array as I needed.

As if to ram home the TRS-80's position as the ZX81-equivalent of its day, memory can be saved by deleting unnecessary spaces, and even using in-built shorthand (such as P. for PRINT and G. for GOTO), rendering the listing about as instantly understandable as a 1K ZX81 listing full of NOT PIs, VALs and CODEs. And, to top it all off - this is by far the slowest-running of the three programs, though that's mainly because I decided to use the low-resolution graphics to draw the cards; they were available, so why not? At least with my emulator of choice, TRS-80GP, you can hold F12 to speed up the process of grinding out the card frames. As an added bonus, it was the only emulator that accepted .BAS files, so I could do all my editing in Notepad++, and because this was the hardest challenge of the three, I was very grateful for that. TRS-80GP emulates everything in the original TRS-80 range; if you want a CoCo, the Dragon 32 emulator, XRoar, will do that.

SUMMARY:

This was an interesting challenge, as well as an educational foray into technology that's even older than I am. If only there was a Crap Games Competition somewhere out there for pre-1980 computers, after this experience I'd have the entries rolling in. It's not as if I'm ever going to make the TRS-80's answer to Chromatrons Attack! or de-convert a title from one of the four C64CGCs (here's the 2001 edition, for instance) for the PET, but once you POP, you can't stop... unless you forgot to PUSH first.

*** STR OVFL ERR
STOPPED AT 62
>

APPLE II VERSION

COMMODORE PET VERSION

TRS-80 MODEL I VERSION