||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.
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.)
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)
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.
Miguel’s ULA implementation:
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:
Jozsef Laszlo (joco), 2013-07-01