The ZX81 from the Ground Up

As a young computer hobbyist, I was forged by the Commodore 64 and DOS systems, starting with the ill-fated PCjr and moving on to a VGA-based DOS system in the early 1990s. The first home computer I ever actually interacted with, at a point where I was so young that it is lost in the hazy mists of memory, was the even more ill-fated Timex Sinclair 1000. This was the American release of the Sinclair ZX81. It did rather better in the UK than it did here; it was the predecessor of the ZX Spectrum, which was a tremendously big deal in the UK and an utter dead letter in the US. I suspect that the dramatic failure of the TS1000 poisoned the well for any attempt to introduce the Spectrum. They were very inexpensive, but the home computer market in the US was such that paying that much less didn’t justify losing that much capability. Even the Sinclair fansites more or less acknowledge that there wasn’t much worth saving about the ZX81.

It’s hard to disagree, really. But I do still have my parents’ old books, and World of Spectrum has reproduced a number of the ZX81 manuals, and the links section of the sz81 emulator provides quite a bit more, including to some people who have managed feats I do not yet comprehend.

I think we can make this thing dance a little bit. Maybe I’ll even understand the more wizardly tricks at the end of our journey.

Emulating the ZX81

I’ve found two emulators that I like, and as I work my way through all this, I’ll be using both.

  • EightyOne is a truly excellent emulator of not merely the ZX81 but also basically the entire Sinclair line, plus its clones and many peripherals and hardware extensions. It comes with a variety of impressive demo programs. Its disadvantages are that it’s Windows-only, and that it also correctly emulates the way the ZX81 couldn’t quite produce a stable display and thus would occasionally cause your television set to lose vertical hold.
  • sz81 is SDL-based and runs very well on Linux. I haven’t tested it on Mac but it should run fine there too, but official binaries aren’t available. The author of this emulator, “Thunor”, has assembled a wealth of information and also some excellent additional games and demos.
  • Getting started

    Let’s fire up our system get right into it.

    zx81hello_0

    Here we are, with a cursor ready for input. The “K” means we are in “keyword” mode. If we start typing PRINT “BUMBERSHOOT SOFTWARE”, things don’t quite go to plan…

    zx81hello_1

    Just hitting P put the whole word PRINT out. In fact, we must enter our text this way. You know how we’ve started all our Commodore 64 programs with a tiny BASIC stub that uses hex code 9E to represent the SYS command? On Sinclair systems—not just the ZX81, but all of the Spectrums as well up through the 128—this is how you enter everything.

    Notice that after that the K turned into an L. We are now in “letter” mode where we’re entering ordinary text. We backspace over the extra RINT (with shift-0) and then finish the line (with shift-P for the quote marks).

    zx81hello_2

    So far, so good. The ZX81 has two other entrymodes besides keyword and letter. Shift-ENTER will give us an F cursor, which puts us into Function mode. P in keyword mode was PRINT; shifted P is the double-quote; in function mode P is the modifier TAB, which advances the cursor to the specified column.

    The final mode is Graphics mode, which is toggled with Shift-9; this turns the cursor into a G. Most keys produce their letter-mode equivalents in graphics mode but in inverse video, but some of them have block graphics options which appear when shifted. (As a rule, if shifting a letter gives you a symbol, you get that symbol in inverse video; if shifting a letter gets you a keyword or function of some kind, then shifting it in graphics mode gets you a special graphics character.

    Sinclair BASIC was a bit freer about applying modifiers to its PRINT statements, too. Let’s make use of AT—available as Function Mode C:

    zx81hello_3

    We’re using all four modes here. (Each key has the five or so things it’s good for printed on or near it, so all of these combinations aren’t quite as preposterous as they sound… but they are still pretty preposterous and all emulators include a separate window for displaying an image of the keyboard for reference.) AT relocates the cursor arbitrarily, so running this command gives us a neat little crosshair effect:

    zx81hello_4

    Not bad! The “0/0” in the corner there has been happening after every command, actually; it’s reporting error code 0 (that is, success) on line number 0 (that is, a command typed in directly instead of part of a program). Later versions of Sinclair BASIC kept the report codes but also provided their meaning in text.

    We’re going places! Next time I’ll try to actually write a program of some sort.

    Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s