I once had a Sinclair ZX81 Microcomputer

I purchased a “Sinclair ZX81 Microcomputer” not long after it hit the market in the early 1980s — my first real home computer. I spent hours and hours on this thing, learning to program in Sinclair BASIC and Z80 machine code to squeeze the most out of my 1K (later 3K) of RAM. Eventually I moved up to a BBC Model B Microcomputer, but the ZX81 definitely whetted my appetite for computing. I’ve recently uncovered a variety of cassette tapes from my ZX81 days, along with my old unit itself. Still works!

The ZX81

A compact, efficient use of technology for the time, the ZX81 was a 3.5MHz Z80-based computer made by Sinclair Research Limited in the UK. It started with 8K ROM and 1K RAM on board, the video output was generated by the CPU (interleaved with executing BASIC and machine code programs). The entire unit was a single box with membrane keyboard, 9V DC input, TV video output, and cassette audio ports. There was an expansion port at the back for devices such as printers, 16K RAM packs, etc.

More detailed technical specs (and a whole lot more) can be found at Retroaisle’s “Sinclair ZX81” website.

My own ZX81

My particular ZX81 started with 1K RAM (using a single 4118 chip rather than the earlier design with 2 x 2114 chips), but was eventually upgraded to 2K and then 3K RAM onboard. My ZX81 didn’t suffer much by way of expansion (unlike my Beeb) — I limited myself to a more secure power lead, jury-rigged 3K RAM and a rainbow cable bringing out the keyboard connector for an external keypad.

My jury-rigged RAM expansion

The photos above reveal a small birds-nest of wiring on the right side of the circuit board. This was my RAM upgrade. Initially I’d replaced the unit’s 4118 RAM chip (1K x 8) with a 6116 equivalent (2K x 8, using the same pinout). Then, I realised that I could piggy-back the original 4118 chip on top of the 6116 (literally, mechanically on top) and get 3K of RAM by ensuring the CE (chip enable) lines were driven separately. This was achieved with three NAND gates of a quad NAND 74LS00 chip (see diagram here) using the motherboard’s CE and A11 address lines to decide which RAM chip’s CE line would be active. The 6116 chip then took care of the first 2K of RAM, and the 4118 took care of the next 1K (actually it would appear twice in the 2nd 2K block of memory space, but that didn’t matter). The result looks a little messy, but it worked 😉

Emulating a ZX81

In July 2011 I discovered “EightyOne“, a quite comprehensive and functional emulator for a wide variety of old Sinclair computers, including the ZX81. I have successfully used EightyOne v1.0a under 64-bit Windows 7 Enterprise edition and under PC-BSD 8.2 using Wine 1.3.21 (specifically the PC-BSD PBI for Wine). In case it disappears from the internet, here is a local copy (1.9MB).

Extracting software from old cassette tapes.

I had kept many old cassettes from my ZX81 programming era… turns out to be relatively straightforward to extract the old programs into a form usable by emulators such as EightyOne. (Well, straightforward once you find a cassette tape player!)  I had reasonable success using the following steps:

  • Capture the cassette’s audio using Audacity 1.3.13beta (I successfully utilised both the Win32 version under 64-bit Windows 7 Enterprise, and the unix version as a 64-bit PC-BSD8.2 PBI). Set Audacity to capture at 11025Hz sample rate. Plug your tape player’s output into PC’s sound card input, adjust levels so there’s no distortion but you’re using 60-80% of full signal range.
  • Extract the audio representing individual programs (using Audacity cut-n-paste) by visually inspecting the waveform for periods of quiet followed by the tell-tale tones of a ZX81 program.  Save as a “.wav” file using 8-bit unsigned format (“Export”->”Other uncompressed files”,then select “Options” and select 8-bit PCM WAV format).
  • Decode the 8-bit .wav file using TSCON3.3,which will extract the SAVE’d program into a “.P” file — binary images of individual ZX81 programs that are then LOAD’able into EightyOne emulator. Note that the TSCON3-3.EXE executable wont run under Windows 7 or Wine — you’ll need to use something like DOSBox (I had success with DOSBox 0.74 under 64-bit Windows 7 Enterprise and as a PBI under 64-bit PC-BSD 8.2).In case TSCON disappears from the internet, here is a local copy (62KB).
  • From time to time, you may need to post-processthe audio using Audacity to apply a 600Hz high-pass filter and 4000Hz low-pass filter, and then re-run TSCON to extract the .P file. (I found there could easily be random bit-flip errors creeping into the decoding process even if TSCON believes the file has been extracted correctly.)

Some of my own software

I worked on a range of projects for my own entertainment back in the early 1980s. Here are some examples. I was a teenager, so of course the games sucked 😉

  • Frog” (Inspired by Frogger, but nothing like it.)
    • Use EightyOne in ZX81 emulation mode with 2K Ram pack
    • Use File->OpenTape to open the FROG.P file. It should automatically launch into a menu with simple instructions
  • Maniac” — roamaround a small maze ‘eating’ dots while avoiding two randomly wanderingenemies. (Inspired by PacMan, but nothing like it.)
    • Use EightyOne in ZX81 emulation mode with 2K Ram pack
    • Use File->OpenTape to open the MANIAC.Pfile. Itshould automatically launch into a menu with simple instructions
  • LIFE” (of course)
    • Use EightyOne in ZX81 emulation mode with no RAM pack or 2K Ram pack
    • Use File->OpenTape to open the LIFE.P file, then “GOTO 1” (do not use RUN).
    • Enter single-digit coordinates as xy pairs(e.g. 3,2 would be “32”) to populate the 6×5 grid, then “00” to initiate the simulation.
    • Yes, it is terribly slow and limited.
  • Flier” — a side-scroller, ‘fly’ your plane while dodging mountains and floating objects, shoot the objects if you can
    • Use EightyOne in ZX81 emulation mode with 2K Ram pack
    • Use File->OpenTape to open the FLIER.P file. It should automatically launch into a menu with simple instructions

Historical note: This blog entry was actually made on June 11th 2012, to archive a web page I wrote on July 24th 2011.  Although largely for my own benefit, I’ve archived it in the hope it will be useful to others (like you, if you’re reading this page and you aren’t me).

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