Saturday, 31 December 2016

Minstrel ZX80 Clone

Issue 2 boards are available now, more info here.

Here is a new ZX80 clone that I have called the Minstrel. It is a fairly accurate clone electrically to the ZX80, using the same chips and the original schematic with only a few concessions to the modern world. All the parts are the same, the part numbers and pins are the same, other than the ROM and RAM, I've only added a few extra decoupling capacitors and a one resistor / one transistor composite video amplifier.
The first thing is that is not the same size as a ZX80, but has been designed to be the same form factor as the ZX81, with the same mounting points and connectors. The big silver box of a UM1233 UHF modulator is missing. I have replaced that with the single transistor composite video buffer. The phono connector is composite video out in the same location as the original UHF out.
The four connectors are in the same positions as on the ZX81, with the two ear and mic audio in and out jacks. In this case these are stereo with the signal taken from the tip, so either mono or stereo jacks can be used. The power jack has been replaced with a 2.1mm DC jack, with jumpers to select centre negative (ZX Spectrum style) or centre positive (everything else). This is more reliable than the 3.5 mm jack originally used.
The two 2114 RAM chips have been replaced with a single 62256 chip. This is wired for 16K. 32K is possible, but would require changes to the decoding logic, 16K just needed additional address lines wiring up. The 24 pin mask ROM or 2532 EPROM used in the original has been replaced by a 28 pin ROM socket which can accept a 27C64 up to a 27C512. Upper address lines are tied high, but two 8K ROM images can be selected by a jumper, allowing original 4K ZX80 ROM or 8K ZX81 ROM to be selected.
In the first build, I used a 7805 linear voltage regulator, but this can be replaced with a switch mode version to reduce heat and current consumption. The heatsink borrowed from a ZX81 barely gets warm, current draw is about 200mA with a 7805, 110mA with a switch mode unit. The board was designed to accept either a 6.5MHz ceramic resonator or a 6.5MHz crystal, I started with a ceramic resonator to stay true to the original.
On first power up, this is what I got. Sometimes this, sometimes no video sync at all. The ZX80 design requires the Z80 to run appropriate code to generate the screen, and that is what it does about 95% of the time. But in this case it wasn't. Logically either the original ZX80 schematic I had used was wrong (unlikely as it came from Grant Searle's excellent site), or I had transcribed it wrongly in my PCB design (possible), or messed up the build (also possible).
After an extensive check of every connection on the schematic, I finally found the bit I had missed out. There is a direct connection from A6 to INT (part of the display generation system). That was a simple fix just wire the pins together on the back of the board.
It's not perfect, there is a moving diagonal line of interference, but I finally had an inverse K on the screen. I've built a computer from a bag of TTL chips and a Z80!
The distortion seem to come and go, and on some occasions I had a really nice clear picture, although the alignment was a bit off.
I did a lot of probing around and found the frequency of the ceramic resonator was drifting around, and the closer it got to 6.5MHz, the better the picture. I swapped that out for a 6.5MHz crystal and the distortion went away.
The brightness does vary a bit on this LCD monitor, but that's due to the video signal from the ZX80 missing some parts which a modern TV needs to set the black and white levels. (Update - this is much improved in the Issue 2 Minstrel boards)
The chips used are all 74LS TTL chips. I have tried this with 74HCT parts, and it does work, but the signal isn't as strong, the design does rely on the analogue properties of these chips, so best stick to 74LS. (and no, don't use 74HC. Ever. For anything. Please). These chips are still available, as is the Z80 and the selected ROM and RAM, meaning this can be completely constructed with new modern parts.
I've tried to keep things neat with all the passives lined up neatly. One thing I was pleased with, which will only please me and people like me is I used all Texas Instruments chips, and they use the same moulding for 14 and 16 pin chips, so all the chips look lined up and matching, even though the second column has a mix of 14 and 16 pin chips. The top two on the right hand side are 14 pin 74LS05 chips which are are centred so they line up with the 16 pin chips below. No? Only me? Well at least I'm happy.
The original plan was to use a ZX81 membrane, and the connectors were setup for this. However, it didn't work out, the wrong keys were pressed. Unfortunately, it seems I messed up the pinout of the keyboard connector. Both the ZX80 and ZX81 schematics lay the connections out in one order (the one I used), but this is not the one used on the membrane, so I had to build up a small bodge board to fix the order of the rows connector.
I did get a ZX80 replacement keyboard, that uses the same ZX81 style pinout, so I will need to build a suitable board for that as well. The ZX81 keyboard has the same letters and numbers, but the keywords are on different keys  (PRINT " is O shift+Y on the ZX80, P shift+P on the ZX81. The ZX80 originally came with a 4K BASIC ROM, but later on they offered an 8K BASIC ROM and a keyboard overlay which was pretty much the same as the ZX81.
For testing, I fitted pin headers and used an RC2014 mini keyboard. It turns out that has the same pinout I had on my board, only with both the 5pin and 8pin connectors reversed. So with some twisted leads, I can use this keyboard.
A jumper on the board selects the 4K ZX80 BASIC or 8K ZX81 BASIC ROM. So this can become a ZX81, albeit with the screen flicker on every key press like a ZX80.
The ZX81 has additional hardware to generate a 'slow' mode where the CPU can run a small amount of code during the screen draw cycles (whilst the CRT beam is moving back from bottom right to top left). The ZX80 does not have that so has to stop drawing the screen when it needs to think what to do with your keypress.
ZX81 ROM, ZX81 membrane, ZX81 sized board. Guess what's coming next. Yes, the plan is this board can be installed in a ZX81 case and makes this a ZX81 replacement. This means you can take a dead ZX81 where the ULA has failed and drop in this board as a replacement. (in later versions, hopefully a superior replacement)
Anyone who has taken a ZX81 apart, or more importantly put one back together will know there are 5 screw holes on the board, but only two are screwed in from the back of the PCB, so you need to remember who two to fit and which ones to leave and screw it from the back of the case. I've put white silkscreen around the two important ones to make it clear. The membrane should connect direct, but my little bodge board is underneath.
I've fitted a reset switch on one of these as it's quite useful. I was planning to add one to the board, but decided not to. On reflection it is useful, so I will at least add pads to fit one. There is a jumper to select PAL or NTSC mode (on the original ZX80 a diode was fitted for NTSC mode and a resistor on the ZX81).
As on a ZX80, you can also select normal or inverse video. Inverse video is sometimes better if the LCD doesn't detect the black level too well, so you get white on dark blue / grey which can be more readable.
I haven't found much ZX80 software out there, but I did find some on Paul Farrow's website, including PacMan and Space Invaders.
Not all the games I tried worked. PacMan loaded successfully, but didn't run? (Update - this was due to bad audio files - read more in the Minstrel Issue 2 blog post)
Time to load some ZX81 games. You even get the old loading stripes. Simple games loaded, but anything relying on slow mode (including 3D monster maze) will not work until I add in the NMI slow mode for full ZX81 compatibility.
I've checked the RAM, although I had to switch to ZX81 mode, as I couldn't find PEEK on the ZX80 keyboard.
Thanks to Geoff Wearmouth for reminding me these are typed directly on the ZX80, as per the label on the case. I've added that list to the silk screen on the next revision of the board.
Back to the 8K ROM ZX81 mode.
PRINT PEEK 16388+256*PEEK 16389
Yes, the top of RAM is 32768, meaning 16K is working. Not sure if these simply won't work without the ZX81 fast/slow mode NMI changes? I need to investigate further.
The plan for this was always for several versions of thise board. This first run is pretty much following the original ZX80 schematic. Now that's working and I've ironed out a few little issues with the keyboard connector etc. I can get on with the next phase. I plan to rearrange the logic to use more common TTL chips (some of these are a little obscure these days), and add the ZX81 style NMI functionality. This is the current list of planned changes:
  • ZX81 fast/slow mode NMI circuit
  • Full 32K RAM (at 8K-40K for high resolution graphics mode compatibility)
  • Fix composite video with back porch black level setting by changing line counting logic
  • Reduce chip count and replace less common chips
  • Add input amp to improve tape recorder input
  • Add reset switch
  • Consider edge connector, probably not.
  • May look at joystick connector instead - but is there any software support?
There are a few things I probably won't be doing
  • Surface mount at this stage, at least one more through hole revision before size reduction
  • FPGA, lets stick with real chips for the moment
  • Jupiter Ace / ZX Spectrum video generation - the ZX81 timings would change too much
  • SD card disk drive - maybe?
  • HDMI output - probably not
  • AY3 sound chip - again, is there any software that would use it?
  • 3D monster maze in ROM - hmm, possibly.

As it stands, if anyone is interested in one of these boards, I have (now only a few) left. They take a while to build up due to all the passive components and IC sockets, so I'll probably just sell these as PCB only, rather than assembled or kits. Note the keyboard connector issue and the bodge wire on the Z80. If there is enough interest, I may respin this version with those things fixed before I progress to the optimised ZX81 design.
The issue 1 boards are now sold out. Issue 2 is available now. More issue on the issue 2 board.
I have fixed the two PCB errors on this board, and also added a back porch video circuit which gives a much better video output
I have also addressed the problems loading games, which was down to the software I was using to generate the audio files to play into the ZX80.

If you want to support this blog, you can donate via Patreon or Paypal, or buy something from my store.