Sunday, 8 January 2017

Minstrel ZX80 Clone Video Output Enhancement

There has been a lot of interest in the Minstrel ZX80 clone I announced in the last blog post.
The issue 1 boards were a pretty faithful replica of the ZX80 schematic, and as such, did suffer with the same problem as a real ZX80, a non quite up to spec video signal. The plan was this would be the starting point, get the plain ZX80 working first. Now that's done, it's time to make it better.
The signal from the original ZX80 circuit resulted in the black parts of the picture not being black, but varying shades of grey, and also the whites not really being white, but also a shade of grey, so the picture varied between a reasonable dark grey on white and grey on grey, and on my monitor would cycle between the two every few minutes. Older monitors cope better, it depends on how tolerant the monitor is of the poor signal.
The reason for this is the video signal is missing an element called the 'back porch'. Basically as part of each line of the display, there is a sync pulse, and the picture information. The picture information is meant to be preceded by a short period showing the level black would be, followed by the picture data varying from that level for black to a higher level for white. This is a still from an excellent video by JoulesperCoulomb on a solution to a similar problem on the ZX81, which explains the requirements in more detail.
The signal generated by the ZX80 is lacking this, and goes straight into the video information. The analogue circuitry of older TV sets would cope with this sort of poor signal quite well, but modern LCD TVs have digital processing which needs more information. The ZX80 signal goes straight from the line synchronisation pulse into the picture information, and also the proportions are wrong, the black level is about 40% down from the white level, it should be more like 70%
On the original ZX80 circuit (this extract from Grant Searle's redrawn version), the video signal is a signal with either 0V for black and 5V for white, and sync is 0V when a sync pulse is required, 5V normally. (N.B. these are TTL, so it's not quite 0V or 5V, but good enough for the purpose). These two TTL level signals were merged together with two resistors and fed to the UHF modulator.
On the Minstrel issue 1 board, I kept the same resistors, but fed these to a single transistor amplifier to drive the video output with a 75 ohm impedance matching resistor.
There are various circuits around for solutions to this, mainly for the ZX81. There is more of a problem there as the only signal available comes out of the ULA already merged together on a single pin. On the ZX80, the sync and video signals are available separately, so is easier to do something with those.
This is part of Grant Searle's NMI mode add on for the ZX80, and adds a back porch to the ZX80 signals. It buffers the sync signal and passes it through an RC filter to generate a short negative pulse just after the sync. This in ANDed with the video, which has the effect of making the video signal black for a short period just after the sync, which is exactly what we need.
To test this, I've made some slight modifications to a Minstrel Issue 1 board. I've also added a reset button which has been quite useful.
With that in place, I get a more stable picture, no more fading in and out, but it is quite a grey picture on white. It's better, but not quite there yet.
The trace at the top is the input to the AND gate, the bottom is the new video signal. Compare that to the spec we are looking for and it is a lot better, but there are two problems, one there is a small spike at the start of the back porch, which may affect the level detection, and the ratios are still wrong as it is still using the original values for R30 and R32.
This is my version of the circuit. I have used a 74LS08 quad AND gate. Two gates form the pulse stretcher, and I have used the spare two gates to delay the sync signal slightly to get rid of the small spike. I've changed the two resistor values to make the ratio more like 70%, and reduce the overall level a bit.
The waveform is now more like the specification, there is a back porch, the spike has gone and the ratio of black to white is about 70% of the signal. The width of the back porch pulse is a bit less than 4uS, which again is close enough.
The LCD TV seems happy with this, I get a very crisp stable picture, with deep black giving excellent contrast.
This is the test pattern I have been using on the scope traces.
Trying the ZX81 Kong game again, you can see the difference. That circuit would be useful for any ZX80 style clone which needs the video signal improved.
The normal / inverse mode now looks equally good.
NTSC mode is also available. The number of lines used by the display is the same, there are just less lines at the top and bottom to cope with the lower resolution of NTSC. This does not affect the ZX80, but the ZX81 in slow mode does processing at the top and bottom of the screen, so effectively runs slower in NTSC mode.
You may have noticed from the screenshots that I have now had more success loading games. The previous problems seem to be down to the way I was generating wav files to write to tape. I am still looking for suggestions for a simple command line program which will convert .o, .p or .p81 files to .wav files to play direct or write to tape.
Lots more ZX80 / ZX81 games to try.
These all came from Paul Farrow's website.
I have added this video circuit to the next version of the Minstrel, which will be available soon. Still needs a bit more tidying up of the routing, but it's almost ready.
Other changes include:
  • Fixes from Issue 1 - A6-INT link and keyboard connector pinout now corrected
  • Edge connector - several people have asked for this, so I have added an edge connector, complete with the ROM_CS line which was not present on the ZX80.
  • Reset button - I've found this useful, so have added one, can be wired to an external switch if you prefer.
  • Integral functions list - Several keywords on the ZX80 (such as PEEK which confused me last time) need to be typed in separately. There is a list on the ZX80 case, so I have added one  to the PCB silkscreen.
  • ROM selector jumpers - There is now the option to select form up to 8 ROM images, so you can have ZX80, ZX81, Forth, Assembler etc. if you choose.
  • Regulator position - I've shuffled the power input around so it can be bolted to the board and to any random bit of metal such as a ZX81 heatsink.
The new board will be available in a two to three weeks time, if you want to order one now, you can click below. I will look at offering this as a built and tested unit, as well as bare PCB only. Price to be determined, once I've added it all up. You can preorder a board now, note this will not be dispatched until February 2017.
Issue 2 boards are available now, see the new blog post for more info and buy it now links.

I have found some TVs work better with a lower video level, so I have adjusted the values of the two summing resistors to reduce the signal level. Current revisions of the board and kit include these new values.

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