alxlabs welcomes you

Page
Menu
News

ZX-Spectrum 128K on FPGA

Full repository is here https://alxlabs.ca/speccy.php

08-MAR-2024

Having ZX spectrum implemented on FPGA boards is a cool project while I've been looking for a cheaper solution as it currently works on ~$100 boards. I don't need a high gate count, the entire design just takes ~4000 ones while I need a static RAM onboard or if SDRAM is populated then there should be hardware support for it on FPGA, not another "soft" module as those are slow. While I still have not decided if I want to make my own PCB for that - I found a good one price-wise even though FPGA has a gate count for enough for 10 speccies, those boards are available from Aliexpress and made by QMTECH, board cost is just $41

QMTECH

 Now trying to get everything done, so traced then ordered PCB for it, here is how it looks:

PCB

Now experimenting with bits and pieces, leftover from some other designs while I have built a working speccy out of that:

board

 

19-FEB-2024

I've been thinking for a while about why only some small quantity of ZX 128 games/demos on my version of AY8912 produces some weird sounds on the FPGA board but it works perfectly fine in SW simulations while the vast majority works well on both... It was extremely hard to debug as every time the game had to be loaded, then some tests done, then the game reloaded, etc... Until I found a way to write a Basic program, just a few lines, to play a simple tone that plays just some noise on my Speccy and found that I was processing BDIR and BC1 signals incorrectly, the proper way is shown on the pictures below. Now everything works and plays perfectly 🙂 I also put everything in one place for easier download should anyone want it. Bonus: one nice thing I developed from scratch was an Arduino (I use Seeduino as it has the smallest form factor among other Arduino boards) loader for downloading the sw from SD card into Speccy. Note that I developed my own format named "fst" for fast downloads (x8 speed) so all files that have the extension "fst" are treated this way. If you want to convert TZX/etc files then those should be converted into plain .wav (I use winTZX converter) and then processed via audio converter which is written by me as well, sources are available along with other things mentioned above at the link below.
Source code repository: https://alxlabs.ca/speccy.php

Contact me on Facebook
Do you like it?
Buy me a coffee
Error
 
 
27-FEB-2023

Attempts to re-create128K ZX on Gowin FPGA have failed due to lack of support from Gowin on the ports IO issue. On the positive side I have completed ZX 128K + AY-8912 on the Altera while Altera is a bit expensive. If anyone is interested in that:
 
 
09-SEP-2022
 
ULA and perfect timing
 
I never thought that mimicking it will become such a big hassle, however after asking in this wonderful group I was pointed out into two issues. Fisrt - improper border timing visible in the Aquaplane game and Sidewize game did not work at all.
 
To start with I looked at he border timing - the fact that I've implemented my ZX Spectrum based 60Hz for VGA monitor played a huge role in this. I searched and found one multy-sync monitor which supports 50Hz timing and re-worked a bit a border generation, I had to use PLL to divide exisitng 50MHz by 1.2 to get to 50Hz from a 60Hz. On top of that I had to work a bit on the border generation and I've got correct timing:
 
How it was
 
How it is now with 50Hz option
 
The second problem I've got - Sidewaze game did not work at all. It turns out that issue is (so called "floating bus") that on the original ZX Spectrum any read back from an unused port, i.e. FF, returns the current byte being fetched from the video ram and returns 0xFF if the border is processed at the time of this operation. Some games use this method for synchronization of what is drawn and when it is actually drawn on the screen. I did implement this functionality and all the games dependent on this functionality work, however, Sidewize works not really smoothly as they rely not only on general synchronization but synchronization between sprites drawn. In my case output is implemented to the VGA monitor and even if I use 50fps (this is not a standard timing, but multisync monitors support it) "paper" lines have to be doubled and this itself results in each line being read back twice and this is differently interpreted by CPU at 3.5MHz readbacks which results in some flicker in sprites. The way around of this would be to implement a double buffer, first, one is being processed on standard PAL timing, and output on PAL timing is used as fill up for the second buffer which can be used to generate any VGA timing. Another option would be to ignore this flicker as this is the only game that behaves not 100% correctly known to the moment. After fiddling with this issue for a while I solved it to the point that the Retroleum test passes without any issue and I've decided to stop at this point as having only one game not perfect is not an issue. All other known games which use this feature work without problem.

Retroleum test:

...Phew.. :) Link as always to the https://alxlabs.ca/speccy.php

05-SEP-2022

I was thinking about Kempston joystick and searched what is available. I found this one on Amazon for a very decent price ~$16, hooked it up, and voila, I played Exolon on a joystick. It took me a little while to figure out that it comes with strict and direct logic without an inversion on the original ZX Spectrum so I had to follow this pattern. Joystick from Amazon has a nice DB-9 connector at the end of the cable so it was no problem to connect it. Here is how it looks like:
board and joystick
 
And here is the snapshot of the Verilog code: https://alxlabs.ca/speccy.php

01-SEP-2022
 
I had a PC in the '80s when I was a kid. It was nothing close to the PCs that we have now, while at one point definitely, it was a top computer. And some time ago before this given moment, I decided to re-create this wonderful machine based on the modern FPGA. I did a lot of research and found two suitable implementations of the Z80 core, one was T80 and the other one was A-Z80. I did implement it on both, it works on both cores but A-Z80 is the smallest among them and I've got great support from it's creator Goran Davic, so this is the one I've chosen.
 
I also was puzzled about copyright protection until I found this information, basically, it says that Amstrad, the current owners of the Sinclair ZX Spectrum, don't mind the free distribution of the ZX Spectrum ROMs. Therefore, the emulation of the machine is not illegal.
Currently, my implementation is based on Alinx Altera FPGA board and it is kind of expensive, the board itself costs about 100$ and it requires some add-on boards which will make everything even more expensive, like USB for a keyboard. I decided to try to make it on Gowin FPGA boards (as they are cheap) and then produce my own add-on board to Gowin's FPGA. Altogether it will be small in size and very cute 🙂 I plan to make an entire setup with a USB port and FPGA board suitable for implementing various computers and of course ZX spectrum. All the FPGA code will be free of charge
Source code repository:   https://alxlabs.ca/speccy.php
 
This is what it looks like now :)

Here couple of screenshots:

Ramparts start screen and music

Krakout loading

Krakout playing game

Writing a simple brogram on a BASIC


« prev top next »
Page
Menu
News
Page
Menu
News

Powered by CMSimple | Template: ge-webdesign.de | Login