Sunday, 18 September 2022

Minstrel 2 Pixel Synchronisation (Part 1)

This is a compilation of several Patreon posts covering a series of questions I posed to myself.

The first one came when I sold the second last Minstrel 2 PCB on my sell my retro store (https://www.sellmyretro.com/store/tynemouth-software)

"Have I got any more of those?"

I had a bit of a search through various boxes of bits.

I didn't find any more PCBs, but I did find a few partially complete kits of parts. I presume these were extras packed when I did the final editions, but weren't turned into full kits because I ran out of one or more parts at the time.

"I wonder if I could get the missing bits now?"

it is six months later, so I had a bit of a look around.

Whilst I was doing that, I received an email from the person that ordered the Minstrel 2 PCB. They were having problems locating some of the parts, would I sell them a complete kit of parts?

Well, that was good timing. I was only short of a few parts, and I could temporarily steal those from one of my Minstrels, so I gave them a price, and they paid.

Right, I unpacked the PCB and re packed it with a kit of parts. Printed the new postage and booked the collection.

Then I got another email, how much would I charge to build the kit? I gave them a price, and they paid. For the second time, I unpacked their order and for the first time in quite a while, I built up a Minstrel 2.

It was whilst I was building the kit, that I had some more thoughts.

"Why did I put all the chips the wrong way around?"

"I wonder if I could do a better job of routing this board?"

I persuaded myself not to get carried away and got on with testing the Minstrel 2.

During the testing, I was looking at the small glitches you always get on the ZX80 output.

I wonder if that could be fixed?

The glitches in the output are caused by the series of events that happen towards the end of the 8th pixel of each character. First, the "invert this character" signal is reset. Then the next character is loaded into the shift register and the "invert this character" signal is set based on the invert status of that next character.

The ZX80 has 128 characters, which is implemented as 64 characters and an invert signal which gives a second 64 inverse characters.

The slight gap between invert being cleared, and then set again is noticeable when you have a series of inverted characters. You also see a vertical line when an inverted character is followed by a non-inverted one.

Breakout is a good example of this, with clear "jail bars" being visible.

Here the inverse goth battenburg is followed by a space and you get the vertical line. This does not happen with the non-inverted version.

It is less obvious, but the white vertical line at the end results in the 8th pixel appearing thinner than the others.

In the 1980s, this was probably less of a problem as the RF modulation in the ZX80 and then the RF demodulation, the video circuits and CRT itself of the TV all form low pass filters. By the time you see the screen, those are barely visible on a black and white TV. It is only noticeable on a modern LCD display. (Hold that thought until part 2)

There are ways around this, and the final stage on the Minstrel 3, 4th, 4D and the Mini PETs, I added a D type flip flop. This is clocked by the pixel clock, and has the effect of sampling the video signal once every clock cycle.

This does two things, firstly it means the output will always have pixels of exactly the same size, and secondly, any glitches that occur between clock pulses will be removed.

"Why didn't I add this to the Minstrel 2?"

Well, I was trying to keep it close to the ZX80 design. On the first board, (the Minstrel 1 as it wasn't called at the time), all I did was add an emitter follower to the video signal that would have fed the RF modulator.

That was not good with modern TVs as it was missing the back porch signal. This is a short section after the horizontal sync pulse which sets the black level for the rest of the line.

The second version of the board became the Minstrel 2, and for that I added an extra 74LS08 chip to add this missing section to the output. More about that in the blog post I wrote at the time.

http://blog.tynemouthsoftware.co.uk/2017/01/minstrel-zx80-clone-video-output.html

This 74LS08 did a few jobs with the video signal, firstly it buffered the sync signal (to avoid altering the cassette save signal), and secondly it used a pulse stretched version of the sync to add the back porch black section at the start of the line.

Over the course of production, I tweaked that circuit a bit. It's output was a bit high for som TV inputs, so I added an optional 3K3 resistor to reduce the level a bit.

During the development of the Minstrel 3, I looked at various composite video output circuits and settled on this design, which I have used on all of the kits since then.

On the last revision to the Minstrel 2, the V2.8 boards, I implemented this revised video amplifier circuit, combined with the 74LS08 back porch circuit

"Can I add pixel synchronisation to the Minstrel 2?"

The simple option would be to add an extra 74LS74 flip flop to the output. I didn't want to do that as I was trying not to add too many extra parts to the ZX80 design, and more importantly, there wasn't any space left on the board.

Ideally this would be the circuit:

The sync signal is buffered for the video mixer, and also for the pulse stretcher. The video is synchronised via the flip flop and combined with the stretched sync pulse to generate the back porch.

"I wonder if I could do that with one chip?"

For this to be viable, I would ideally replace the 74LS08 with another chip to keep the board looking the same.

One trick I could use is one I used in the other Minstrels and Mini PETs. The /PRE input of the flip flop is used to set the output low, and keep it low until /PRE is released. Feeding the stretched sync pulse into there means I can do without the AND gate.

That reduced the requirements to buffering the sync signal and the flip flop.

I tried building the circuit without the buffering, so see if that would work, but this it was too much for of a load on the sync pin, and it was doing odd things such as not counting lines correctly.

I had a bit of a think and came up with this.

It had to look at that for a long time to convince myself it would work. When sync is generated, there is an inverted version, /sync which is generated, but not used anywhere. I use the two versions of sync to drive the /CLR and /PRE inputs on the flip flop. When sync goes low, /CLR causes the output to go low. When sync goes high, the output remains where it is, but at the same time /sync goes low, /PRE causes the output to go high. I went through the various conditions, It should only ever see low high or high low as the signals are the inverse of each other. At the transition point, there may be a brief low low or high high. If it is high high, then the output will remain as is, not a problem. If it is low low, the output state is not defined, but I don't mind if it is low or high, because it will be almost immediately followed by a low high or high low input which will set it appropriately.

Is that right?

The changes were not too big, so I patched it together on a breadboard.

"Is this going to work?"

Excellent, that has fixed the problem.

I tried various things, and all were showing no issues.

Breakout was now solid black, the jailbars were gone.

That seemed to resolve all the issues. Sorted.

I that looks like it is a viable option.

"Should I do a new version of the Minstrel 2 PCB with this fix?"

Find out in part 2:

http://blog.tynemouthsoftware.co.uk/2022/09/minstrel-2-pixel-synchronisation-part-2.html


Advertisements

A small spoiler for the next post, but the updated Minstrel 2 PCBs are available from my SellMyRetro store:

https://www.sellmyretro.com/offer/details/minstrel-2-zx80-compatible-computer-pcb-(green)-62001

See also the full range on Minstrel and Mini PET kits - http://blog.tynemouthsoftware.co.uk/2023/09/minstrel-and-mini-pet-kit-updates.html

Patreon

You can support me via Patreon, and get access to advance previews of posts like this and behind the scenes updates. This now also includes access to my new Patreon only Discord server for even more regular updates.

https://www.patreon.com/tynemouthsoftware