Sinclair ZX81 & Spectrum Replay

Inspired from the book "The ZX Spectrum ULA" I decided to go for a Sinclair computer implementation, the ZX81 to be precise: very simple video, no audio (except tape in/out...).

"How hard can it be? " (Citation: J. Clarkson, Top Gear, BBC).

First step: the ZX81

I got a C64 when I was in school and (worked hard in the summer time to collect the money for it), but I was always interested in the fuzz about the "competitor". Now, after growing old, I bought my first 48k Speccy on ebay... :-)
I might be of good use for some checks when implementing it on the replay board. Finally the "test" ZX81 port was rather easy, I used code from the "zxgate" project I found on the web - and after I get used to the video stuff (in general and specificly on the replay board) I slowly came to a state where I knew a little bit what I was doing...

I didn't use/program the on-board ARM controller for that one, it is just used to load the "replay.bin" file from the SD-card to the FPGA, which I simply replaced from a given Minimig configuration. And the "ZX81 replay" was alive!

All ZX81 I/O is re-routed to (lower) joystick port A, but I did not try yet to connect a PC as (virtual) tape recorder. The lower PS/2 port can be equipped with a keyboard. The upper joystick port is still available, maybe I'll look at one of the joystick interfaces and port it, too. But before I can't load a game, it doesn't really make sense...
The implementation uses the TV coder on the replay board, delivering a PAL (UK setting) or NTSC (US setting) composite signal on the cinch connector. I use the "inverted" video mode, as it shows no "ugly" border on the screen (may need further "twiggling" with the timing).

Second step: the Spectrum 48k

After this step was sucessfully done (more or less), I focused on the next level of complexity: the ZX Spectrum. The first release didn't have audio nor colour, but was able to run basic programs (yet another "hello world").
The second release fixed all the open items: colour video, sound, all "important" things work as 16k version!

Then I further rewrote the zxgate code so that it uses a full 16k RAM together with the video stuff - like the original setup - as "base" model. Now it was passible to add another 32k RAM to build a 48k Spectrum! The FPGA of the replay board (a xc3s1600e) has enough ressources to cope with it. But this new "zxgate" VHDL version I prepared might also fit as 16k Speccy in the common Spartan 3e Eval board - without the "urgent" need for an external memory like the old zxgate version required.

Then I implemented a simple tape interface to load a TAP file from the replay SD-card slot to the Spectrum. As you can see, I can successfully load and run a game!

Finally I went for DVI/VGA out - I had to add some patches to use the US mode (NTSC), that allows me to set up VGA out in 640x480/60Hz. The line doubler was quickly implemented (maybe not really ressource saving, but hey - the FPGA is large enough...) Below a short table of the FPGA utilization of the setup in TV/PAL mode. Including the VGA scan doubler it takes about 2000 Slice FF more for the required line buffer.

Source code:

I never cleaned up the ZX81 project, as it was just an intermediate step for the bigger Spectrum 48k, which is already in quite good shape. But I am nevertheless willing to share all code I have. If you are interested - ideally to participate development, please send me a mail via the code request page.