I have been referring to this as the "Minstrel 3 Snowball edition" because the feature creep has somewhat snowballed.
But it is now all done and available now, and looks rather splendid.
There are a few egregious changes (one of them is bright red), but allow me from a few months ago on Patreon to explain how a minor change led to rather a lot of less obvious changes, and how a simple fix was eschewed for a better result.
It started with a simple plan to make the minimal changes as I had run out of boards and thought I could slip in some small changes when I ordered some new boards.
That was V3.5.9, I only made two changes, the first was the rounded corners to match the rest of the range.
The second had an unfortunate bug.
I produced an updated video output circuit for the recent updates to the Minstrel 4th and Mini PETs (separate blog post on that to follow).
As I that had worked out very nicely on those systems, I thought I would roll that into this design. It is a small change, but gives better output levels on the composite video signal.
I have glued three scope traces together to show you three versions of the video output.
The top trace is the current Minstrel 3 output, it is running at about 1.5V, when it would ideally be 1.0V.
The middle trace shows what I was aiming for, the more correct levels of 0V for sync, about 0.3V for the black level and 1.0V for for the video level.
The bottom trace shows what the V3.5.9 boards produced. It is wrong. The white level is 1.0V. The black level is 0.3V. Both good.
The problem is the sync, the is also 0.3V, not 0V.
What did I do wrong?
Looking at the two signals which generate the video signal, I see the problem.
The top trace is the output, the middle trace is the pixel data, and the bottom is the sync pulse.
Unlike the Minstrel 4th and Mini PETs, the character data on the Minstrel 3 does not go low during sync, only the backporch, so the output never went down to 0V, so it did not appear to have any sync signals.
The old video circuit (with the high output) had used a diode to pull the output low during the sync pulse, so it did not matter that the pixel data was high.
An easy fix then, is to reinstate that diode. I did so and generated a V3.5.10 design.
This again was minimal changes and just fixed that bug by shuffling around the composite video mixer and adding back the diode to ensure sync pulled the output low.
I also added in the DC input protection diode that I had meant to add to the previous version, again bringing it inline with the new Minstrel 4th and Mini PET.
I didn't order that at the time as funds were running low. September has been an exceptionally quiet month for orders. Or I should say order, singular.
Whilst waiting to order the PCBs, I had a couple of days where I was running low on energy but my brain seemed to be working, so I had another look at the Minstrel 3, to see if I could stretch the "minimal changes" rule a bit and see if I can do it without adding the diode back in.
Well, it turned out to be a stretching it rather lot.
Minimal Changes He Says...
The only outstanding thing on the "really should do" list was a bus pullup resistor. This is something the ZX81 had, but the Minstrel 3 didn't, as that was derived from the ZX80 design.
There is already a pullup on the D6 line, as that is used for "end of line" detection. I would need to add seven more resistors, and there is no space. It might fit if I were to use a resistor array, as I have done on the new Minstrel 4th. I was planning to replace a run of 10KΩ resistors which are pullups on the keyboard and related signals with one array and a second array for the bus pullup.
Of course, once I go down that route, I may as well swap out the ROM jumpers for DIP switches, as that will use a resistor array as well.
And so the snowball continues to grow as it rolls down the mountainside....
DIP Switches Return
The very first Minstrel 3 board did actually have DIP switches.
Although there was too much going on there, that version was never released.
That had seven switches, including one to control a "Turbo" option, which added about 5% speed increase for slow mode, but was finally dropped as it broke compatibility.
I would need seven switches again to replace the existing jumpers:
- Normal / Inverted video
- PAL / NTSC
- Plain / Grey border
- Slow mode enable / disable
- ROM A15
- ROM A14
- ROM A13
That includes the three ROM address jumpers. I am not sure there is much point in having all three, how many ROM options are there? The alternatives like Tree Forth don't work very well due to the way they do video.
However, I think I now have up to four ROMs planned for the updated release, so it seems sensible to support up to eight with three DIP switches to leave room for expansion.
The main thing that stopped me previously was the need to use the ROM jumper block for the ZXpand interface.
Now I have the Minstrel ZXpand II, that does not need to tap into the ROM select block, so I can get away without that and replace it with DIP switches.
Unlike the board shown above, the newer ones have the option to fit a Minstrel Expansion Bus socket below the edge connector, so limit the space available for a DIP switch, maybe a 5 way would fit?
(N.B. that turns out to be wrong, more on that when I get around to the PCB in the next part. What do you mean there is a next part? We are only 10% into this one!)
I am not sure the plain / grey border is that much use, likewise the option to disable the NMI slow mode to act like a ZX80, so maybe I could do without those?
It was only really useful for things like demonstrating that the SCROLL command switches to a collapsed display file, even on 16K systems, as seen here in Perilous Swamp.
The PAL/NTSC select and ROM select signals are easy to convert. They are jumpers with 5V on one side and 0V on the other, so the line is either 0V or 5V. I can replace that with a DIP switch, one which has a pullup resistor to 5V when off, and is switched to 0V when on. That means the default of all switches off would be PAL and the highest addressed ROM. Which is correct.
The normal / inverse text is a bit more complicated, as the jumper currently selects between the Q and /Q outputs of the 74HC165. The character set is stored in ROM as 0 for background, 1 for pixels that make up the character. The inverted /Q is actually the normal output for a ZX81, 1 for a white background and 0's for the black text.
(I added the comments with the dots and zeroes so they show up nicely in the code preview scroll bar on the right in Visual Studio Code. Guess the version of BASIC?)
The obvious way to select between normal and inverse using a DIP switch would be to use something like a 74HC157 multiplexor, although that would mean a new chip, 3/4 of which was not usable. An alternative is to use an XOR gate, that works like a configurable inverter, when the inputs are the same, the output is 0, and when they differ, the output is a 1, so if the control signal is low, the output is the same as the input, if the control signal is a 1, the output is the inverse of the input.
That's great, however I don't have a spare XOR gate.
Or do I ... ?
Currently I have a 74HC86 quad XOR gate chip. Two gates of which are used for the crystal oscillator, which I would rather not fiddle with as it works. A third is used as described above to invert the character data for character codes where bit 7 is set.
The forth XOR gate is used to generate the chequer board background pattern that can be selected by the grey background jumper.
This again is not a straightforward to convert to a DIP switch as it would need an extra AND gate or yet another 157 chip. Neither of which I can justify.
What if I get rid of that feature? I would need one fewer DIP switch and I get one spare XOR gate so I can add the DIP switch option that I actually want to keep.
Done.
In a similar way, if I get rid of the option to disable slow mode (i.e. to act like a ZX80 - don't worry, I have a plan to retain that feature, more on that in another post), then I free up an AND gate.
I already had a plan for the spare AND gate...
More Changes
I would like to revisit the video generation so that it works in a similar way to the other systems, with the video signal low during the non-visible sections for the sync etc.
I would also like to do something about the tape loading, but I will cover that in a separate post as I am sure this one will go on long enough already.
The Existing Design
The current system uses a counter which counts along each line using the 3.25 MHz clock.
When it gets to 207, it resets. 208 steps at 3.25MHz, 1/3,250,000 * 208 = 64µs.
This only happens in the top and bottom borders on slow mode when the user code is running.
When the Z80 is involved in drawing the screen by clocking through the display file and executing NOPs, an interrupt is generated when the A6 line goes low, which is set to coincide with the final character on the line.
The A6 line is wired to the /INT pin on the Z80, so that causes an interrupt and the Z80 generates an INTACK (interrupt acknowledge) signal. This also resets the counter and makes sure it is in sync with the character generation.
This shows a whole frame, each frame starts with a /VSync pulse. You can see the section where IntAck pulses are generated at the end of lines in the central visible portion of the screen, and the Count=207 pulses when user code is running at the top and bottom of the screen. This is a close up of that region.
The counter also controls a three stage flip-flop. This is triggered by the /Counter_Reset signal at the start of each line on the display.
The third stage of the 207 line counter, Q3 is toggling every 16 cycles, which at 3.25MHz is 4.92µs, which is near enough to the 4.7µs required for the horizontal sync signal.
The NAND gate flip-flop on the left is triggered by /Counter_Reset and starts things moving. When the inverted version of Q3 goes high after 16 cycles, the second flip-flop clocks in the Frontporch signal, which is high and transfers that to it's Q output, the horizontal sync signal. The /Q output, the /HSync signal, goes low and that resets the first flip-flop, which will stay off until the next line.
16 cycles later, Q3 clocks again. The Frontporch signal is now low, so that is clocked through the second flip-flop and HSync goes low, ending the horizontal sync after 4.92µs.
The third flip-flop now clocks through the old HSync signal and generates the Backporch which itself goes high for 4.92µs until Q3 clocks again and all the Q output are now low until the next line.
Blanking
I thought about various options, and I was particularly pleased with one that I came up with.
The plan was to replace the 74HC74 used for two of the stages of the flip-flop with a 74HC175, which is a quad flip-flop, and re-purpose the NAND gate flip-flop to generate a Blanking signal, active from the start of the front porch until the end of the back porch. Perfect symetry.
In the 175, there is a common clock and reset to all the flip-flops, but they have separate D, Q and /Q pins.
When the counter is reset, all the flip-flops are reset, and /Frontporch goes low, as do Q outputs of the HSync, Backporch and "Start of the Visible Line" stages. This sets the NAND gate flipflop and turns on the Blanking signal.
The flip-flops in the 175 are now clocked by Q3 from the 74HC393 207 line counter. Previously that was /Q3, which means I now have a spare inverter. I am sure that will come in handy at some point.
This means that rather the coming after 16 cycles, the first clock comes after eight.
Mmmm, After Eights.
Sorry, where was I.
That ripples all the values down the line as before. /Frontporch now goes high, and stays high until the next reset as it's D input is tied high.
HSync goes high at this point.
The second clock pulse is now at 24 cycles, and that sets HSync low and raises Backporch.
The third pulse is at 40 cycles, and that clears Backporch and sets a new signal, StartOfVisibleLine. The inverse of this is used to reset the NAND gate flip-flop and clear the blanking signal.
I now have two useful signals, Blanking which starts at 0 and runs to 39 cycles, and HSync which starts and 8 and runs to 23 cycles.
The timing is pretty good.
Checking on the scope, it looked good.
The blanking signal at the bottom gives the video signal at the top a front and back porch at 0.3V black level, and the horizontal sync pulse in the middle takes the video signal to the 0V mark.
The monitor, however, told rather a different story.
Oh dear.
The picture was rolling and the top was bending to the left.
Oh right, I forgot about VSync.
Vertical Sync
During the vertical sync, the video signal was still active, so it was confusing the monitor.
That's fine, I have that spare AND gate. Let's set the video output to be blanked by the /Blanking pulse and also by /VSync.
That fixed the VSync issue.
Let's check the monitor again.
Oh, sorry about that, there is a hair in the gate.
Hang on, I am not shooting this on film?
Why is there a thin line on the top right?
Time for the test program.
Oh...
My usual test program was showing a lean to the left at the top.
But overall, the whole picture was shifted to the right, and there was still a hair in the gate on the very top line of the visible display.
Hmmm.
Something Odd is Going On
Time to dig out the logic analyser, and this time, I have gone for the Ikalogic SP259i. I have had issues in the past with this, mostly when I have been working with clock signals. It seems to get clogged up when sampling multiple lots of high frequency clock signals.
Here it was wired up to all the video and control signals, multiple times on several different Minstrel 3 boards and I have to say it has been working flawlessly all week.
(full disclosure, I was sent that to evaluate, and I have been honest when I have used it in the past and had problems, but it has been really useful here)
Well, there's ya problem.
This is the first visible line, the first time the line end is terminated by an INTACK.
The high section of all of the other lines is about 58.8µs. That one line is notably shorter, 56.3µs.
That's not much, is it?
Well, the dot clock is 6.5MHz, so each pixel is 0.15µs. Eight of those make one character so each character is 1.23µs. That means 2.5µs is two whole characters wrong.
But why?
This one took me a while.
The penny finally dropped when I thought about how that INTACK happens, or rather when.
It was happening about 2.5µs early. That's about 8 cycles of the 3.5MHz clock.
Ah, of course, I have changed the timing of the HSync pulse, It would previously start after 16 cycles and it is now starting after 8.
Mmmm, After Eights....
I had not thought that would have been a problem, but the HSync signal is used to generate the NMI pulses, and the final NMI is the one which kicks of generating that first line, which is now happening 8 cycles earlier.
That causes the short line, which gives the hair in the gate glitch on the top right of the screen.
The subsequent lines then appear to start too late and cause the shift to the right. The monitor gradually adjusts to the shorter line, giving the bend to the top row of characters.
NMI Fix
I figured that I needed to move the NMI pulse back so it started at 16 cycles.
The current pulse runs from 8-23 cycles, so I ANDed it with the Q4 clock, which is high from 16-31 cycles to give an NMI pulse from 16-23 cycles. Half the duration, but it's the falling edge that is important, isn't it?
All I need now is an AND gate ...
I am still keeping to the plan of not adding any chips, as there isn't space. So far the 74 has been changed for a 175 and everything else is just rewiring.
Lots of rewiring.
I have used green wire, so I am sure you can hardly see it.
I scoured the circuit again for an AND gate I could steal and found this.
The input to the mux chip is high only when /3.25MHz is high (3.25MHz is low) and /MREQ is low. Otherwise the output is low.
I do have a sort of spare NOR gate, it is inverting the /Counter_Reset signal, but a NOT gate could do that just as well, so if I take that NOR gate and use it here, that would free up the AND gate,
I took the non-inverted 3.25MHz clock, so now the input is high only when 3.25MHz is low and /MREQ is low. The same as before, and I now have an inverter to replace the NOR gate and a spare AND gate.
I put that immediately to use to generate the /NMI signal by ANDing HSync with Q4. (N.B. that has to stay as two gates as the intermediate NMI signal is used elsewhere).
I wired all that up and ....
... it made no difference.
I think the pulse from 16-23 cycles is not long enough.
I guess I had better put it back to a full HSync / NMI pulse at 16-31 cycles.
Front Porch
HSync is offset because I changed the clock from /Q3 to Q3, so the rising edges were at 8, 24, 40 cycles etc. rather than 16, 32, 48 etc.
An easy fix to that cost me the spare inverter, which is a shame as I had plans for that.
I reinstated the inverter so the clock was back to /Q3 and the back porch was back to 16-31 cycles.
That left the new front porch at 16 cycles rather than 8, which is not ideal, but at least the blanking signal still covers the sync so I don't need to save that diode.
Was all of this really about avoiding adding one diode?
Yay ...
... oh.
That has fixed most of the problems, but there is now a solid black line down the right hand side of the visible lines only.
Ah, OK, so the front porch is now happening too early and blanking some of the actual visible display.
Two choices here, I can either move the blanking so it covers only HSync and the back porch, or I could try and fix it so the front porch is the correct size again.
I recovered the AND gate from the NMI circuit, as I didn't need that.
What I needed was an OR gate, and there was one of those buffering the clock signal, so I swapped that for the AND gate.
Phew, this is exhausting. Are you keeping up?
That is my final (at time of writing) version of the HSync and Blanking generator.
Here the /FrontPorch signal is generated by ORing the /Start_of_Line signal (cycles 0-15) with the /Q3 clock. That is low from 8-15 cycles and 24 to 31 etc., so the /Frontporch signal is low from 8-15 cycles.
- The counter resets at 207 cycles
- Frontporch runs from 8-15 cycles
- HSync runs from 16-31 cycles
- Backporch runs from 32-47 cycles
- StartOfVisibleLine runs from 48-63 cycles
- The video circuitry draws the screen up to 207 cycles and it all begins again.
And guess what?
It works!
Here is the composite scope picture again. This time with the old Minstrel 3, the one I was aiming for, and finally the one I have achieved in the new design.
Correct 0V/0.3V/1.0V levels, and front and back porches around the sync signal and no spike on the transition from sync to back porch.
More Changes
As well as the tape loading changes, I was also able to check out a few other things, including a minor change to the memory map.
There were two options for the 32K of RAM, 8K-40K, or 16K-48K. The 8K-40K seemed the most useful, so that was what I implemented, but I have now modified the memory map to make 32K-40K a mirror of 8K-16K, so if any software needs that, it is available.
A last minute change extended that to have mirrors in the 48K-64K range as well, which better matches the ZX81.
I have added the bus pullup resistors and that does not seem to have affected anything. I will do more testing to make sure that is working, and compare against an older board.
Likewise, I have removed the D6 pullup and changed the BusReq pullup to 10KΩ to support the move to resistor arrays.
I tried various flicker-free and high-resolution games, including Paul Farrow's Against The Elements.
ASZMIC assembler is working, with it's unusual video mode.
ZX Forth, Tree Forth et al are all still not working right. I'm afraid. Just flickering with occasional runs of strange characters.
They do not appear to be generating any VSync or IntAck signals?
It turns out that was due to the RAM not being mirrored at the top, so after I had changed that, the original ROM did run, although still with video corruption and the last character missing.
It had also previously not been working as the bus pullups get around the missing IM 1 statement in the ZX Forth code. See George Beckett's reverse engineering for more info. I will be revisiting this again at some point to try to get it working correctly.
Conclusion
That is all looking good, quite a lot of changes, but I think it is worth it to tidy up the video. No extra chips added, just the change of a 74HC74 to a 74HC175.
The timings are now all spot on across the various boundaries.
The timing of the various elements of the line are also looking good.
And that is one of the most correct looking monochrome video waveforms I have generated.
Front and back porches and good levels.
For now, I need to lie down in a dark room for a while. And for some reason, I have a strange craving for some After Eights?
Option 1
You could make these changes to your own Minstrel 3 if you like.
It should take no longer than a week or two, with at least a 10% chance of success.
Option 2
(yes, I am still using that caption)
You can order a new Minstrel 3 V3.6 from me, available now, kit or assembled, with or without Minstrel ZXpand II SD card and joystick interface.
£150 kit, £190 built (£250 kit with Minstrel ZXpand II, £300 built).
I still have most of the things I make in stock, and can ship worldwide, but be quick as the postal system gets slower and slower the further into December we get.
The easiest way these days is to contact me using the link at the top of the page. Tell me what you want to order and your address so I can get a quote for shipping and duties etc.
Also a short run of Mini PET 40/80s with keyboard, with a few updates. Available now, £450 kit / £500 built.
The Mini PET 40/80 internal PET replacement boards are also available now, £350 kit / £375 built.
Patreon
If you enjoy posts like this, you can support me via Patreon, and get access to advance previews of blog posts, and exclusive posts.
You also get progress updates on new projects and other behind the scenes updates, as well as access to my Patreon only Discord server for even more regular updates, and to discuss your own projects.













