Wednesday, December 02, 2015

A Little Bit of 1980's Nostalgia

The ever enduring ZX Spectrum

Almost like the real thing!

First - a Historical Note

The first true stored programme computer nicknamed "Baby" was built in Manchester - and first ran code in July 1948.

Some 34 years later - Clive Sinclair and his Cambridge team produced the Iconic ZX Spectrum - a 1980s design classic.

Here we are another 34 years later (almost) and the Spectrum - and it's close cousins, descendants or cyborg clones are still very much alive.

Spectrums have been around for virtually half the time that there have been electronic computers in existence!

So What's New?

At the weekend I stumbled across the Recreated Spectrum - a life sized replica that appears to be a good match to 1980's Sinclair ZX Spectrum. It has been released by Elite Systems - the electronic games company behind some of the original Spectrum games.

However this keyboard is not what it appears - it is perhaps something more useful.

Rather than recreating the Z80 based hardware of the original Spectrum - based on an FPGA, this is actually a Bluetooth keyboard, intended to work with various Spectrum games apps running on a PC, Apple or Android.

The keyboard has 2 modes selectable by a switch at the back - Position A is for Spectrum mode - where each key down and key up generates a pair of "Sinclair" key codes.  This is the game playing mode - and works with the online and downloadable apps.

The second mode is for a standard qwerty keyboard - or as standard as you can get - given the limitation of 40 keys.

What I hadn't realised is that the keyboard arrives "locked" in game mode - and you have to go to the online app and run the unlocking script.  This records the electronic serial number of the keyboard and returns an unlock code - which you have to enter.

Once unlocked - it functions more or less as expected.

In the online app you have the option to access a plethora of original ZX Spectrum games  - often recreated by the original authors.

In addition there is emulation of Sinclair 48K and 128K BASICS  - so kids can have a go at learning some basic instead of Scratch or Minecraft this Christmas.

The keyboard feels just like the old one - and needs a good thump on every key  - just to be certain that it's actually sent the character.  There will be no awards for speed - touch typing on this one.

The world has moved on a lot since 1982 -and we have all got used to real keyboards, a multitude of function keys - and mice with scroll wheels.

I was never a games player back in the early 1980s - so I doubt I will be doing much gaming on this modern recreation. However if you have a spare £90 or so  - it might make some sad, middle aged "Bedroom Warriors" very happy this Christmas.

Z80 Emulation and FPGAs

The Z80 was the first microprocessor I encountered properly in my senior high school last 3 years  - and I spent an inordinate number of time in my youth working with it.

Z80's are quite rare now - and the old 16K x1 or 64K x1 DRAM memories that they were connected to are no longer commercially available.

For this reason, generally the Z80 experience has been recreated either in software on a modern PC, or in hardware on a FPGA.  Both of these routes are being voraciously pursued by a community of enthusiasts  - hell bent on keeping the 1980's  8-bit experience alive.

The key to it is creating a machine - virtual or real, which can munch it's way correctly through Z80 machine code  - in a similar way to how the Java Virtual Machine eats Java bytecode for  breakfast, dinner and tea!

A lot of the original games - that at the time really existed in cassette tape format have been transcribed into hex files or rereleased.

The Z80 appeared a year or so after the 6502, and was a more sophisticated beast.  For a start, the designers purposefully it backwardly compatible with 8080 machine code - in order to make use of the large wealth of CP/M software that existed at that time.  The Z80 and Z80A  in their time were like an 8080 on speed!   The Z80 also had a rich mix of registers - that could be paired together to handle 16 bit operations. There was a DRAM refresh controller on chip too  - that greatly simplified the refreshing cycles of  dynamic RAM.

It was a great little chip, and thanks to the prolific games programmer fraternity - an awful lot was squeezed out of a pint pot.

So I decided to have a trawl of the Z80/Spectrum community websites and there were 3 real strands of development that impressed me.

Doing it in Hardware - Soviet Style

The Spectrum was very widely cloned and copied in fact - more so than probably any other 8 bit computer in the world - especially in the former Soviet block.  To this day there exists an open source computer called the "Pentagon" - a kind of ZX Spectrum 128 copied by enthusiasts, and still available after several generations of hardware. It replaces the Z80 with a faster  Z280 and an FPGA to provide memory interface and video generation logic.  There is a standard VGA video socket,  two PS2 ports for keyboard and mouse - and several other bits of hardware that were not around in the 1980's.  The latest iteration  - the "Speccy 2010" is well covered in detail in retro hardware hacker, Matt West's blog.

Here's a couple of incarnations of the Speccy 2010

Doing it in Software - Spanish Style

The second interesting thing I came across is a very compact emulation of the Z80  - written in '86 assembly language.  At just 4Kbytes long - it rattles it's way through Z80 machine code and produces cycle accurately timed Z80 behaviour.   It has been used to good effect on several software Spectrum emulators - in particular  "Bacteria"  Here's a great links page

There's a lot more to these emulators - with several to choose from.   Several different early 1980's Z80 home computers have been emulated in this way - including several offering online emulation in Javascript.

Doing it with FPGAs

This is definitely where the technology is heading  - just recreate the whole 1980's machine complete with Z80 softcore,  ROM, RAM, peripherals and video generation hardware all on the one FPGA.
This link to the ZX-UNO will get you started.

So - in this little round-up I have shown that there's more than one way to skin a cat, and the Spectrum despite it's senior years  - refuses to lie down and die.

No comments: