ZX81+35 Clone

Discussions about Sinclair ZX80 and ZX81 Hardware
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81 Clone

Post by PokeMon »

Good news. 8-)
User avatar
1024MAK
Posts: 5534
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: ZX81 Clone

Post by 1024MAK »

PokeMon wrote:Good news. 8-)
Indeed. Despite the problems, very good progress to see it working :D

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Spring approaching...
User avatar
mahjongg
Posts: 181
Joined: Tue Nov 24, 2015 10:25 pm

Re: ZX81 Clone

Post by mahjongg »

I now have the keyboard re-wired and fully working.
This enabled me to write some simple test programs, which revealed some further flukes.
It seems that white pixels are much wider than black pixels, which should not have happened, because of the d-flip/flop behind the shift register.
Its still unclear whether the width of the bits is the problem (at a digital level), or that the video combiner is to blame.
maybe the sync pulses are too large relative to the video signal (should be a ratio of 40 to 100 IRE), the sync pulses seem larger than that.
Also I wrote a program to display characters from 32 to 255, but the display became very unstable when printing characters above 127.
Could be a problem with inverse characters, but the inverse K cursor isn't unstable, just the K isn't recognizable, because the black pixels are too narrow.

Tried turbo mode too, in rest turbo mode works fine, but printing to the screen makes the screen shake vertically, it does seem that tasks are processed twice as fast though.
Next Saturday I will try to debug these problems, with oscilloscope and logic analyses, and do some further testing.
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81 Clone

Post by PokeMon »

I think the video problem is based on your circuit rather than voltage levels - most TVs can handle this easily and the effect is more in a bad contrast and not in different pixel width. The problem is your output driver and the resistors you use. T8 (BC847B) is not the best choice but anyway you can not expect high gains using the frequency range of about 5 MHz. The transition frequency is given with about 100MHz for all types - independent of the gain factor used (A/B/C).

When you look at R49 (4k9) in comparison to R50 (47R) you have a ratio of nearly 100. Not exactly but looking at the transition frequency you could expect this ratio till frequencies of about 1 MHz which is quite less than a pixel width of 154s which corresponds to a maximum frequency of about 3.2 MHz in the signal. Additionally I would expect you would have quite slow slew rates and switching the transistor on and off fast would result in different timespans.

I would first remove R50 or better replace it with a quite higher value (maybe 220-470R would be good) as this is a waste of power as well. The termination resistor of usually 75R is inside the TV or monitor and this is sufficient for normal video cable length. I got never a problem with reflections using cheap standard cables with a length of 1.5 Meter and I never used a termination resistor at the output. Anyway I did never use transistors at all but high currency logic gates - 74LVC series in ZX8-CCB video module or 74AC series in ZXmore for example. These are faster than any transistor with high frequency switching und high slew rates.

The second I would do is lower the resistors R49/R48 from 3k9 and 1k5 to 1k and 390R. This should improve the switching characteristics and the video quality with the given circuit as base current is increased by factor 4 and additionally increased output resistor will give a factor of 8 and increase the theoretical operating frequency to something around 12 MHz plus.

By the way - as this is not an ASCII charset you may use chars from 0 to 63 or inverted chars 128 to 191. Good test is also CHAR$(8) which gives alternately black and white pixel and maximum frequency possible. Good to adjust pixel width as well. Chars with bit 6 set can not be displayed and usually crash the system when written directly into the display file (using assembly for example). The PRINT statement will print just ? for the lower chars (64-127) and print the token word for the upper chars (192-255). So PRINT will never crash as chars with bit 6 set will be handled special.

I think your problem with completely inverted chars is related to the first one (different pixel width) and the effect is larger when having many black pixels set on screen.
User avatar
RetroTechie
Posts: 379
Joined: Tue Nov 01, 2011 12:16 am
Location: Hengelo, NL
Contact:

Re: ZX81 Clone

Post by RetroTechie »

Great going there, mahjongg! "First image" is a great milestone to reach (I've been there ;) ), and doing "Hello World" right after is an excellent result for a self-designed & built computer. :ugeek:
PokeMon wrote:When you look at R49 (4k9) in comparison to R50 (47R) you have a ratio of nearly 100. Not exactly but looking at the transition frequency you could expect this ratio till frequencies of about 1 MHz which is quite less than a pixel width of 154s which corresponds to a maximum frequency of about 3.2 MHz in the signal. Additionally I would expect you would have quite slow slew rates and switching the transistor on and off fast would result in different timespans.
+1, that uneven-pixel-width problem likely originates from the circuit around the output transistor. Personally I think that extra flip-flop in the output doesn't serve any purpose either. With a fixed-frequency clock, shift register produces pixels with constant interval between the edges. If you take care when to re-load that shift register, the same will be true for the edge between characters.

After that, the pixels will stay even width as long as additional logic in the path is relatively fast compared to 1 pixel duration (check), low->high and high->low transitions take roughly the same amount of time (HC family: check), and you don't try hard enough to f**k that up with things like a poorly working transistor buffer. :P
Anyway I did never use transistors at all but high currency logic gates - 74LVC series in ZX8-CCB video module or 74AC series in ZXmore for example. These are faster than any transistor with high frequency switching und high slew rates.
Again +1, I did the same in my CPLD-based ULA replacement. If you drive a 75 Ohm b/w video output directly from logic outputs, it is possible some Vcc ripple may show on screen as mild banding (in the white background, mostly). But if visible at all, it's a mild effect and easily fixed by some extra filtering on the driving gates' Vcc.
Transistor buffers are better reserved for analog video or audio outputs, imho. If you produce a video signal that's basically "0" or "1" with no levels in between (well okay, +sync), take advantage of that to simplify the output circuit.

Btw, next time you find yourself without a keyboard on a ZX81: 1) write down the ZX81 keyboard matrix on a piece of paper such that it easily 'maps' to the positioning of the keyboard connectors. 2) solder a switch between the points the "SHIFT" key sits between, 3) pick up ~10 cm. of wire, and off you go! Just slower... (as ZX81 users prefer anyway :lol: ).
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81 Clone

Post by PokeMon »

One addition to my comment regarding the maximum frequency. This is in fact 3.25 MHz but if you want quite fast edges on the signal you need at least the 3rd harmonic which gives a bandwidth needed in your transistor circuit of about 10MHz and up. So you could expect maximum gain of 10 for showing fast single pixels in an acceptable quality regarding the transition frequency of 100MHz.

I agree with retrotechie that the transistor kills the fast edges of the logic gates and gives a more or less blurred signal at the output. Anyway you should run some test on a modern HD TV with 1920x1080 pixel resolution with video in (if available) which will show much more details than a normal TV.
User avatar
1024MAK
Posts: 5534
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: ZX81 Clone

Post by 1024MAK »

The response of a single stage transistor also depends on the time it takes it to switch off. If it takes too long for the charge level on the base to fall, it will remain switched on even though there is no longer any drive to the base. So you either have to use a transistor designed for RF use, or reduce the drive to prevent the base from becoming saturated.

I was puzzled last year with a transistor used in a 3.5MHz clock circuit that fed the clock to a Z80 CPU stayed switched on. I had to increase the value of the series base resistor to reduce the drive. With the correct bias arrangements, I then got the correct square wave signal on the output.

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Spring approaching...
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81 Clone

Post by PokeMon »

I think you mean the miller effect but this is not applicable here.
The miller effect is annoying when the load is in the collector and the transistor switched with a base voltage.
Through the miller capacitance the base get still current from the collector to hold it switched.

Here we have the load in the emitter - so if the base is going down the transistor is self interlocking additionally the high load in the emitter will take the little rest of load. So the problem here is the base get not enough current, not too much. In fact it should faster close than open because need some time too to load the base with enough current. This matches to the effect that the black pixels are wider than the white ones. It is closing immediately after base go down but opening the transistor (for white pixels) takes more time.

I just looked in the data sheet off the BC547 where a Ceb (emitter-base-capacitance) is stated as 9 pF. I didn't find this for the used transistor BC848B but should be similar. Here we have an effect that this capacitor must be loaded first from the 4k resistor which gives at least a delay of about 40ns. When the transistor is "switched off" this is unloaded via the 47R emitter resistor much faster. Remember both currents move into the emitter, the collector and the base current. That would explain the visible difference in pixel width. So a 50:50 ratio with 154/154ns would turn into approximately 200/100ns.

So reducing the 3k9 resistor with 1k resistor should improve the pixel ratio black/white significantly.
User avatar
1024MAK
Posts: 5534
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: ZX81 Clone

Post by 1024MAK »

The effect that I am referring to is base storage time. This thread talks about it and some solutions.

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Spring approaching...
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81 Clone

Post by PokeMon »

Yes and that is the same as the miller effect or better base storage is mainly influenced from the miller effect. This is applicable in collector loads only - not in the emitter load like we are talking here. This is quite different. In fact with emitter load the transistor is never in a saturated state as the base current is part of the load current or lets say in other words it is consumed by the load immediately (it is not stored). Anyway the collector emitter voltage is minimum the base emitter voltage as the base can not be higher than collectors voltage (in this circuit we are talking about).

The circuit is in fact just an emitter follower. It follows the base voltage always, immediate, with no delay (except the effective base emitter capacitance which builds an r/c timing circuit due to a high impedance voltage source in this case (4k is quite high). ;)
Post Reply