The story of the ZX-HD

V0.5 – 7 January 2017 (will be completed)

On 18 June 2015 I shared an idea with Imre Jakli, who is an academic genius, great in developing very creative things from scratch.
The idea was this:

mail-imre-18-june-2015b

We didn’t do anything with that idea back then, as we were working on lots of other developments, and this one was way out of reach for that time.
But on 26 November 2015 Imre introduced the very cheap ($5) Raspberry Pi Zero to me:

mail-imre-26-november-2015b

I replied:

mail-imre-27-november-2015b

I had no experience with programming on a Raspberry Pi (I didn’t even own one), but Imre had a lot of experience with the Raspberry Pi, programming microcontrollers, and using linux, which is used as OS on the Raspberry Pi.
Imre embraced the idea and started working on firmware for the Raspberry Pi Zero.
He quickly noticed it should be a bare-metal solution: without running an OS on the Raspberry Pi which would slow it down drastically, and increase boot time by a lot.
The bare-metal programming was new for him, but in 6 weeks we had a working firmware, though not perfect and not completely synchrone to the ZX Spectrum ULA yet.

He developed a prototype using only a Raspberry Pi he had in stock.
Photos from 14 and 16 January 2016:

dsc_0837bdsc_0856b

In the meantime I started developing CPLD firmware, as the voltage levels of the Raspberry Pi and the ZX Spectrum aren’t completely compatible, and because the Raspberry Pi would have to do all I/O decoding which would take precious CPU time – a CPLD could do that much more efficiently.
Also a CPLD would create more flexibility and make future enhancements more easy.

After finishing my prototype, I plugged in a Raspberry Pi I ordered to be able to test Imre’s prototype firmware:

20160209_203652b

In February 2016 we were brainstorming about a proper name:

  • ZX HDMI
  • ZX HD
  • ZX DTV
  • ZX-PI-TV

We agreed to “ZX-HD”.

During 2016 we continued fine-tuning the firmware and CPLD.

Imre developed a routine to auto-detect the exact clock speed of the ZX Spectrum that is connected, and to know which ZX Spectrum model is used.
He thought of an On Screen Display to show this information:

dsc_1245b

A lot of experiments followed, like over-clocking the Raspberry Pi B (which is officially possible by default without any side-effects) to see if more features can be implemented, and other experiments.

After a while we both ordered the Raspberry Pi Zero.
The benefits of it are that it’s cheap and small, and the standard clock speed is higher than other Raspberry Pi boards that were available back then, but the downside is that it still only has a single CPU core.

Imre was able to make the firmware much more efficiënt, hence running at its nominal speed, the Raspberry Pi Zero is able to process all video changes on the ZX Spectrum without skipping any.
This is an excellent job knowing the Raspberry Pi does this realtime: it ‘listens’ to changes by the ZX Spectrum, writes to video ‘mirror’ buffers in it’s internal memory and builds up a HDMI output buffer all with one CPU!

Also we wanted the ZX-HD to be synchrone to the ZX Spectrum ULA, as a lot of games and demos use so-called ‘border effects’.
One of the first well-known demos who does that is the Shock Megademo, which is already demonstrated in one of the pictures above (at the time it was not running perfectly).
We used that and a lot of other demos and games to test this.

After we got 100% video changes processing and ULA synchronisation, Imre started looking at ways of implementing 128K video pages support: the ZX Spectrum 128K models (toastrack, +2, +2A, +3) have actually 2 places in memory where screen data can be stored.
Many demos use both of these video pages, so the ZX-HD should support that.
It wasn’t easy: the ZX Spectrum 128K models can swap pages 50 times per second, by simply having the ULA look at the other video memory page.
But as the ZX-HD builds up an HDMI buffer, it would imply that the buffer should be built up again with the other video mirror within 1/50th of a second!
That was impossible.
But as a genius Imre is, he came up with a very clever workaround: the Interlaced mode!

When all of that was about done, Imre and I spoke about implementing other features like beeper sound, AY-3-8912 emulation and keyboard and mouse support.
But as we gave priority to having the ZX-HD run synchrone to the ZX Spectrum ULA, we decided not to implement that.
We are hoping a future Raspberry Pi (Zero) revision with more cores, will make it possible, or maybe we could think of a ZX-HD mode where sound and input devices are supported, but ULA synchronisation is disabled or has lower priority.

[to be added: info about ULAplus support]

[to be added: info about the professionally custom 3D printed case for the ZX-HD and board design]

[to be added: info about the latest / production firmware]

Current features of the ZX-HD:

  • Compatible with all ZX Spectrum models (so also with the second 128 video memory area)
  • Auto-detect of ZX Spectrum model!
  • Very cool professional custom case!
  • ULA synchrone – games and demos will run as they should!
  • ULAplus support!
  • Support for ZX Spectrum 16/48K (all issues), toastrack, +2, +2A, +3 are implemented and tested, and other machines will be added later on and the developer is thinking about adding manual configuration options for exotic machines as well
  • Fast switching between the two 128 video memory pages is implemented using the so-called ‘interlaced mode’ which automatically kicks in when needed
  • Easy firmware upgrades
  • Quality and service from ByteDelight

Limitations:

  • There is no keyboard and mouse support: this will kill the ULA synchrone output with the single core Raspberry Pi – a future revision of the ZX-HD will have a dedicated USB keyboard and mouse interface
  • No audio (same reason as not implementing USB keyboard and mouse support: the single core RPi Zero can’t handle it without losing ULA synchronisation)
  • As the RPi Zero needs a second or two to complete boot and ZX Spectrum calibration, we added a ‘Press RESET button’ message to the bootscreen
  • Low resolution: many TV’s will show the ZX-HD output just fine, but some show it a bit blurred (no idea why TV’s do that) – there is a workaround for that: forcing ‘interlaced mode’, but that could cause horizontal sprites to show a bit weird movement

ZX Spectrum Next and TK Pie

As you have read in the story above, Imre and I developed the ZX-HD straight from our own ideas, from scratch, starting around the end of 2015.
Some ask me if the ZX-HD is based up on the TK Pie, release by Victor Trucco at the end of 2016.
As said, we have never used any other sourcecode, as there simply wasn’t anything that could be compared at that time.

But there is more to the TK Pie and ZX Spectrum Next project.

On 30 March 2016 Henrique Olifiers contacted me by email.
Henrique told me he and a couple of friends were working on an ‘updated version of the ZX Spectrum’.
He asked me if I would want to assist with the development of a HDMI solution for the ZX Spectrum:
“Would you be willing to help us out? I can guarantee you we are not working on anything like the ZXHD, but a full new computer that we’ll shortly Kickstart — one that will even be compatible with the hardware you create. We would obviously share with you anything we’ve developed that might be useful for the ZXHD, and help you in any way we can should you find it appropriate. Our goal is to keep the Speccy alive and kicking, after all! ;)””

As I didn’t hear about them or that project before, and had some experience with people that hat initiatives in the past that never came to life, I didn’t at first believe it was a serious project.
But after I learned it was a commercial project, the ZX Spectrum Next project, I had to refuse as we both are developing commercial products, and I was simply careful not to give away the ideas Imre and I spent so much time in to develop.

So Imre and I were the first to develop an HDMI interface for the ZX Spectrum, not that we think that is very important, but some ask us.

During 2016 Victor Trucco, the main developer for the ZX Spectrum Next, found a way of implementing HDMI into the Next core, and the separate HDMI interface with Raspberry Pi was now a non-mandatory ‘side-product’ (which can be used as accelerator board).
Although Henrique told me: “I can guarantee you we are not working on anything like the ZXHD”, Victor released this the TK Pie at the end of 2016 as a separate interface.
Of course I didn’t like it that, but hey, it’s a free world, and I have good hopes for the ZX-HD.

I hope the ZX-HD is a success for everyone!