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 »

This one worked during test for me - as far as I know (maybe 3 years ago working with this - requires JAVA):
http://www.zx81stuff.org.uk/zx81/tapeut ... rview.html

The ZXp2wav should work as well:
http://www.zx81stuff.org.uk/zx81/tapeut ... rview.html

ZXputil - I think I never tried, describe and download link in this posting:
viewtopic.php?t=1177#p12293
http://www.zxprojects.com/images/storie ... 1putil.zip


So with ZX-IDE you should have 4 different tools to work with. Good luck and have fun ... ;)
User avatar
mahjongg
Posts: 181
Joined: Tue Nov 24, 2015 10:25 pm

Re: ZX81 Clone

Post by mahjongg »

PokeMon wrote:First, congratulations to your success ! 8-)
mahjongg wrote: funny thing, I would not have believed, but loading a file even works when running at 6.5 MHz (with my turbo enabled).
I don't think it is loading with 6.5 MHz. LOAD and SAVE operate in FAST mode only and switch off NMI which switch off your turbo for the duration of LOAD or SAVE.
Yeah I think you are right, at least it does explain why my clone can load a file fine even when in turbo mode

For creating WAVs I can point you to the ZX-IDE which is for development purposes with mixed BASIC/Assembly for ZX81 but has facilities to transfer files directly via the sound card or create WAVs. This may not be very convenient depending on your desires but a first start to create WAVs. I may take a look later on my hard disk where I have some tools which are working as well and allow command line operation. The ZX-IDE is a WIN 32 bit application but should work with WINE on Linux and or OS X as well.

http://sinclairzxworld.com/viewtopic.php?f=6&t=1064

So I will come back later with some other tools.
PS: I am not sure if FAST loading will give success, depending on exact clock frequency but worth a try. It speeds up and is a two stage loader and will create one single WAV file. Also read the instructions for audio transfer. I think I did not have much success with VLC player controlled directly.
So when creating a .wav ZX-IDE creates a loader that first loads quick load code with the standard ZX81 method, then uses that fast load to load the contents of the .P file. What kind of modulation method uses the fast loader, "kansas city standard" (FSK) what is the speedup factor? something like 4 times? We will see if it works.

P.S. I've looked at a generated wave file, and it does look like FSK, at full level (the scope function of VLC suggested the signal is much smaller than the standard ZX81 signal, but according to a wave viewer I used this isn't the case, so I'm hopeful my interface will handle it, as long as not too much signal is filtered by the input cap, but I don't think it will be a problem.
Last edited by mahjongg on Sun Mar 27, 2016 6:46 pm, edited 1 time in total.
User avatar
mahjongg
Posts: 181
Joined: Tue Nov 24, 2015 10:25 pm

Re: ZX81 Clone

Post by mahjongg »

PokeMon wrote:This one worked during test for me - as far as I know (maybe 3 years ago working with this - requires JAVA):
http://www.zx81stuff.org.uk/zx81/tapeut ... rview.html
Found this one, but I thought that Java would be a problem, it was not I have java installed, and it worked fine.
It plays files directly without having to first generate a .WAV file
It "works" in the sense that it generates an audio file, unfortunately no player I have could play these files, I found and tried this one earlier.
ZXputil - I think I never tried, describe and download link in this posting:
viewtopic.php?t=1177#p12293
http://www.zxprojects.com/images/storie ... 1putil.zip


So with ZX-IDE you should have 4 different tools to work with. Good luck and have fun ... ;)
I tried ZXputil, but both from the GUI, and from the command line Windows gives an error message when executing the program.
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81 Clone

Post by PokeMon »

My fast loader ist about 25 times faster I think and can load about 1kB per second versus typical 38 Bytes/second with standard speed. This is not very good tested and works with my ZX81 without problems but there maybe issues on other ZX81 depending on exact frequency. Not sure about this. Also there maybe problems with some larger files depending on file contents (many zero or many $FF). I tried the maximum I could achieve which is not much tolerant against transmission errors. I ever wanted to rework this FAST loader but didn't the time for it over the years ...

About the tools, don't know if ZXputil was working for me as I downloaded several tools to compare.
User avatar
mahjongg
Posts: 181
Joined: Tue Nov 24, 2015 10:25 pm

Re: ZX81 Clone

Post by mahjongg »

okay, even though my interface worked, with a short program, I was worried why more signal made the loading stop working, so I made a new, much more sophisticated LTSPICE model, that generated 6 pulses ( an average between 4 and 9 pulses rounded to the nearest integer) interspersed with a low signal with a 4 pulse-width duration ( so 1200 uS, instead of 1300 uS), as a much more realistic approximation of the real TRS81 cassette signal, and I let it run for a much longer interval, so I could see what happened over longer periods.

With quite small signals all went well,but not above bout 0.4V p/p and with an about 1V p/p (peak/peak) signal I clearly saw why the load failed, the average DC level between burst kept creeping up until it ended up above the logic 1 threshold of HCT MOS, see this picture, note that red is VOUT, and green is the (partially obscured) input voltage. This means that longer and louder loads will fail!
average value after 0,15 sec with 10uF cap.png
average value after 0,15 sec with 10uF cap.png (47.87 KiB) Viewed 3528 times
so now I understand why a lower capacitor is better.
It took some experimenting with various input voltage levels, and capacitors, and after several hours I ended up with 4.7 nF as the best value!
With double that, 10nF, and loud signals the last pulse of a burst became much wider, with capacitors far below 4.7 nF, for example 0.5nF (500pF) the circuit became very insensitive 4.7 nF is the optimal value!

So here is a picture of the LTSPICE setup, and the result, showing the last pulses after a period of about 150mS (0.15s), enough to detect longer term effects:
average value after 0,15 sec with 4.7nF cap.png
(46.83 KiB) Downloaded 336 times
the output signal is clean with an 1V p/p signal, but far smaller (0.3Vp/p) signals also work well, and even a 3V p/p signal works with only marginal widening of the last peak, and no "level creep up" problem, So I think I found the ideal set-up.

I also tried a permanent signal with a tenfold higher frequency to see how this circuit would cope with fast-load type of signals, and I can say it seemed to work fine.
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81 Clone

Post by PokeMon »

Nice work. I guessed before that the Sinclair artists measured it out for the input characteristics for an LS type circuit or later the ULA. Blocking capacitors are always a problem with asymmetric AC signals like the load data. In professional TVs there is always a clamp circuit used to get rid of moving DC levels. But I think this is overhead here. ;)

Another approach could be connecting a higher resistor (100k-1M) in parallel to the capacitor to eliminate increasing DC level. This would protect your circuit for higher DC levels as well. 100k would eliminate most DC level in less than 1ms (for 4.7nF). But this may influence the transistor base setting depending on the DC level. Anyway I won't think that there is much DC level when connecting any audio output.
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81 Clone

Post by PokeMon »

Thinking further, it is clear why larger signals and larger capacitors will have a negative effect on your function circuit. The capacitor is loaded more with a higher input amplitude while it can not unload the capacitor if it doesn't get much above 1V (or 0.8V of the base). The higher the capacitor is in value, the more load it stores internally. Will increase slowly but over the time getting higher and higher.

I have another proposal which could make your circuit much better. I would omit the base input resistor R1 as you can expect any audio output will have an output impedance of 1k or at least a few 100 ohms and I won't expect very high levels here. Anyway you would need much load over the time to really destroy the transistor. The capacitor of 4.7nF limits the load massively. Even if the is no resistor at all it will be full very fast.

load is 1F=1V*1A*1s

So with 1V and 1mA load it would be full in 4.7 us. If you take 5V and 10 mA the source can deliver you would have a time of about 250us. So the base must take 10mA for a very small amount of time in worst case. A BC847 can take a peak base current of 100mA for about 1ms. I don't think that any audio output can deliver this. You maybe think about power amplifiers can do so but they won't deliver a significant DC level to protect speakers from destruction. So in my eyes nothing to worry about.

But I would spend a schottky diode (BAT42, BAT46) with low forward voltage in parallel to your capacitor. This will limit the possible DC offset at the capacitor to maximum of 0.25-0.30V (connected in the right way ;) ). This way you should be able to use larger input capacitors as well. So worth a try - up to you.
User avatar
mahjongg
Posts: 181
Joined: Tue Nov 24, 2015 10:25 pm

Re: ZX81 Clone

Post by mahjongg »

I will test my interface in practice, and if it works well I will consider it finished. you can always continue improving your design, but "better is the enemy of good enough". for now I have no incentive to try to "improve" my interface, or to solve non existing "problems".

with a 4.7 nF cap the charge stored into the cap disappears in the time between two pulses through the available resistors, that is why there is no charge buildup.
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81 Clone

Post by PokeMon »

When you read carefully I made just proposals - not more. It was just some general discussion about your design (what the thread is about).
User avatar
mahjongg
Posts: 181
Joined: Tue Nov 24, 2015 10:25 pm

Re: ZX81 Clone

Post by mahjongg »

yes, I know that what you wrote were just proposals, and don't think I have not read them. some ideas are good, and might come in handy when they are needed. I think R1 will still be necessary to protect against ESD pulses, so I don't consider leaving it out, A normal PC/Tablet sound output should be capable of driving a headset, so it will have a low output impedance, less than 100 Ohm. so 4K7 will not diminish the signal level much more than the 1K terminating resistor I also added. charge on C1 can flow out during the alternate phase of the pulse, and 1300uS the pauses between each bit, through the resistors connected to it, and through GND. I don't think there is much if any charge up, and if there is, its because of the Diode in the transistor, your idea of putting a discharge resistor over C1 is a good one, but the resistors in place are less than 100K (82K+4K7+1K) so to make much difference the parallel resistor should be (much) lower than 100K. But I don't think charging up of C1 is much of a problem anymore. Anyhow, I have fitted the components already in the layout, where there is barely place for them, another resistor there would be a problem. But I'm not concerned now that it will be necessary to change the circuit. I will test it tomorrow with some longer programs, and obviously will keep you informed, thanks.
Post Reply