Saturday, 29 July 2017

ZX Spectrum tape master creator

The Future Was 8 Bit has recently begun releasing software on cassette. The first was Pentagorat for the VIC20, which with then followed by Pilot Attack for the ZX Spectrum, both by Misfit.
These are producing using a cassette duplicate, such as this one and a larger bank of Sony units.
This takes one master tape and duplicates it onto multiple copies. This of course requires a master tape, a clean copy of the game files on tape. The are a few options for producing those.
The master tapes for the first Spectrum release were written using an MP3 player board, as used in the DivMMC programmer. There is some extra circuitry added to that to get the level right. The level is always a tricky thing with the Spectrum, unless you are using a Spectrum +2 where the level are preset with the built in tape deck.
A new master tape is required, so I have been tasked with producing a new 'master tape creator' box. I've been looking at using the +2 tape drive to write master tapes, given a TLL level signal from the ULA, it sets the level correctly and writes to the tape. It is also mono which is ideal for this application.
I've also been looking into the TZXduino recently, an Arduino based project which can be used to load files into a Spectrum. However my plan was to use it to write to tapes instead. It didn't take long to build a test version, I built this up whilst discussing the idea on the phone. It's an Arduino UNO, with 5 buttons wired up, and an Adadfruit microSD board which has level shifters and a voltage regulator to run the card correctly at 3.3V.
There are two bundles of wires coming out of that . One is connected to an I2C LCD display, the second plugs into the cassette connector on the +2.
That seems to work, I tried writing a few .tzx and .tap files out to tape and loading them back and had no problems.
That looks promising, but is a bit impractical, time to build a permanent version. I started with a +2 from the 'broken' pile.
This one is particularly discoloured, where as beige plastics go yellow, grey plastic appears to go green. It's also missing various bits inside, so is an ideal candidate to start with. Now I needed an Arduino board (or just an ATmega328P or similar microcontroller), and an SD card with level shifters on.
Searching through the junk pile, I found some boards for an early version of the PET microSD. This had the requisite microcontroller and microSD card with voltage regulator and level shifters. Most of the rest of the IO pins were taken out to the edge connector, which would have plugged into the Commodore PET.
With a load of wires attached, and a few minor pin changes, that is ready to mount in the case. I said there were some bits missing inside.
I found a board that I built for testing something else years ago that has six buttons on, so I used that and wired the sixth switch as reset.
I also found a power and USB input board with a 5V regulator on from my USB keyboard parts bin. That will allow this to be powered from USB or from a 9V DC supply, gives a bit of flexibility.
With the keyboard removed, the case lid goes back on and the buttons and display are accessible through the hole where the keyboard was. The microSD can also be accessed from here.
I added some labels below the buttons, root folder, move up, move down, play/pause, stop, and reset. Time for some more testing.
You can certainly see how 'greened' that case was compared to the +2 at the back I was using for testing the tapes. I had some initial problems with this version, which was down to a duff tape deck, so I replaced that with another spare unit and that worked fine.
We have been putting multiple copies of the games saved on each side of the tape, so I added a feature to the TZXduino V1.5 code to allow selection of the number of copies by pressing the stop button when not playing.
It then plays the same file multiple times with a few seconds gap in between. I also fixed a buffer overflow that was causing random characters to appear on the top line when scrolling.
I've written a few tapes and various files of different types and they are all loading first time without any problem. Job done. Game over.

Update:

This turned out to be quite a useful thing to have, so after I shipped that one off to the TFW8B Mansion, I decided to build another one for myself. I'll probably do a PCB for this in slow time, but for the moment, I went for a quick solution, I chose an Arduino Ethernet board I had lying around. That was bought for a project a while ago that went in a different direction.
The Arduino Ethernet has a built in SPI Ethernet chip (which I am not using here), but more importantly, an onboard microSD socket and level shifters. The only issue with this was the CS pin for the SD card was hard wired to pin 4, so I needed to change the code (which used the default pin 10).
The other issue was the I2C LCD module. I bought two at the same time, but when I assembled this second, apparently identical, module, it didn't work. It turned out this one used a different I2C address (0x3F instead of 0x27). Another code change and it was working.
This time I used a spare +2A case, one that had all the plastic pillars cracked off in transit. Thank you ebay seller who thought a black binbag was sufficient packaging.
Currently testing V1.1 of Pilot Attack using the tape I have just written.

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