ZX Spectrum on pipistrello

This ZX spectrum implementation is based on the Pipistrello FPGA board. This board has a big FPGA (Spartan-6 LX45), which is definitely too big for a spectrum, but I wanted to realize it anyway. The main reason was to prove, that a spectrum clone can have modern HDMI video output. Pipistrello was a good choice for this, cause it has HDMI port, plus, the FPGA is large, has enough static ram to contain the Spectrum’s entire memory. Though Pipistrello also has 64M DDR ram, I’ve found too complicated to use it. And I am sure I am not the only one :-)

Well, the project is just a smart merge of other projects. You can find a good cycle exact implementation of spectrum ula on the opencores website. Many thanks to Miguel Angel Rodriguez Jodar. This spectrum implementation is complete and accurate.

The other source was a good example of VGA - DVID implementation, developed by Mike Field (hamster). He did a great job, so based on his work, I could implement my own HDMI video interface.

The problem

Well, old spectrum funs know, that timing is really important for special effects. Unfortunately, the original spectrum only had PAL composite video output (or U-V-Y), and it used 7MHz as pixel clock. It isn’t compatible with any HDMI resolution or frame rate, but close enough to one, that is 720x576@50Hz. According to the standard, this one uses 27MHz pixel clock. Which sucks, because we’d need something “compatible” with 7MHz. I took the definitions for 27MHz, and calculated everything for 28MHz (because 4*7=28, so that would be a perfect clock). I have found that HDMI TVs can handle 28MHz without any issue. (There is also a slight difference in vertical timing, because I produce 624 lines instead of 625, but the TV is happy with it, too.)

The solution

From this point it was simple.

 - port Miguel’s spectrum into the LX45, using internal Block-RAM (LX45 has more than 200K Block-RAM)

 - create a scan doubler that gets the specrum video output and generates the scanlines with the

doubled pixel rate (14MHz)

 - set up my 28MHz HDMI interface, getting the video signal from the scan doubler (and shift the screen horizontally and vertically into the correct position)

There were some more details:

- I needed a PS2 keyboard interface, that is simple, you need only 2 FPGA pins for clock and data, most of the PS2 keyboards work with 3.3V, so no additional parts necessary

- I had to create an EAR analogue input for loading original spectrum programs. For this I have simply copied the original spectrum’s EAR interface from issue6. Only one FPGA pin is taken. (clamping diodes added, thanks, Miguel)

- Audio of the spectrum is redirected to the Pipistrello audio output, using a single delta-sigma DAC.

So far so good. This hardware loads games from my laptop, using the audio output. I would say, timing is 99.5% accurate. Tested with games, like aquaplane, dark star or starion which use complex border effects. I can see some glitches with starion, left side of the screen. Perhaps this is the same on the original spectrum, but HDMI makes it visible, as you can see more of the border area. I don’t know. All in all I am happy with the result.

Now see some shots (taken by my cellphone, sorry for the quality)

Photos:

Dark Star is loading. This game uses a self-loader.

TV reports 720x576 resolution. This is not 100% correct BTW

This is the Pipistrello board with the PS2 and EAR audio interfaces.

Aquaplane with horizontal border effect.

Dark Star drawing on the border area. Perfect.

References:

Pipistrello board:

http://pipistrello.saanlima.com

Miguel’s ULA implementation:

http://opencores.org/project,zx_ula

Hamster’s DVID/HDMI solution: http://ec2-122-248-210-243.ap-southeast-1.compute.amazonaws.com/mediawiki/index.php/Dvid_test

Xilinx AppNote for delta-sigma dacs:

http://www.xilinx.com/support/documentation/ip_documentation/xps_deltasigma_dac.pdf

Jozsef Laszlo (joco), 2013-07-01

Send me a feedback
  Your name or email:  (you can leave empty)
 Your feedback/remark:
 
Code:  Enter code:
Others' feedback:

 Who: Derek Chandler When: 2016-04-08 20:36:13 

Just got my pipistrello board so I'm going to give it a go!
 
 Who: NHIYiYveD When: 2015-11-23 09:24:58 

For the love of God, keep writing these arltices.
 
 Who: Simon Brattel When: 2015-09-23 06:35:35 

It just amused me that I'm having a play with designing an FPGA-based retro computer and thought I'd have a rummage about to see if anyone had driven a HDMI display from a Spectrum clone, just as a proof of concept, and here I find an example of someone doing it and you're using Dark Star, one of my old Spectrum games to test it... <grin>
 
 Who: Dylan Smith When: 2013-07-02 23:21:19 

Even if it's VHDL (which I don't really know, Miguel Angel got me into Verilog a couple of years ago at Madrid Encounter), it'll still be very useful (and I suspect porting to the Atlys board is probably an exercise in changing the pins and adding the bits needed for the sound out). On my list of things to do is a Spartan-6 based external ULA+ board with HDMI/DVI output (which will actually be quite simple - it doesn't need to do a lot of stuff because the Spectrum's ULA will still be doing that) and a fully working project to reference will be very useful. I didn't know that HDMI TVs would sync to something useful for a Spectrum - this means my project will probably fit in the smallest and least expensive Spartan-6 since it won't need to double buffer (save perhaps a line buffer, I suspect the ZX clock re-generation is too jittery to use as a HDMI pixel clock) - it should work with just a shadow buffer of the Speccy screen (which will be exactly the same size in block RAM as what it takes up in the Speccy itself)

I'll write to you after the Vintage Computing Festival is done (this weekend)
 
 Who: Jozsef When: 2013-07-02 10:21:50 

Hi Dylan,

Well, apart from my scandoubler, everything is available, Miguel's spectrum is on the opencores website, and Mike's DVID solution is on the link above. If you drop me a private mail (joco.homeserver.hu, Contact), I can send you my stuff. It is mainly VHDL by the way.
 
 Who: Dylan Smith When: 2013-07-02 09:54:04 

Do you plan on releasing the Xilinx project files and Verilog source for this? I would like to port this to my Spartan-6 based Digilent Atlys board and have a play around with it.