A Sinclair Microdrive Emulator, Alexander Vollschwitz
The Sinclair ZX Microdrive is a magnetic mass storage media, that uses small endless tape cartridges. It was initially released as an external drive for the ZX Spectrum in 1983. The Sinclair QL, released one year later, came with two internal Microdrives installed.
Already back then, Microdrives were regarded as somewhat unreliable, which makes working with them quite challenging today, almost 40 years later. In particular the tape cartridges are often no longer usable. This prompted the development of a Microdrive emulator. Different from existing "modern day" mass storage solutions for Spectrum & QL, the goal was to create a fully transparent and "historically correct" emulation of the Microdrive. Using this emulator should not feel different from using a real Microdrive. For that reason, it works on the level of the hardware Microdrive interface, and does not employ any system hooks on the Spectrum/QL.
|Model Name||ZX Microdrive|
|Year of introduction||1983|
|Price at time of introduction||£49.95|
|Technology||endless magnetic tape|
|Capacity||max. 128KB, typ. 70-80KB|
|Tape||1.9mm x 5m, 76cm/s|
For use with ZX Spectrum, an Interface 1 adapter is required. Price at introduction was £49.95. Later, bundles were offered at £79.95.
|Software||firmware in C, daemon in Golang, web UI based on Bootstrap|
|Contributors||Alexander Vollschwitz (developer/maintainer), Tom Dalby (PCB & case design, testing), Stephan Preuß (testing)|
Here are a few members of the "OqtaDrive family" (built by Tom Dalby) - left and rear: standalone config in original and 3D printed case, front: minimal configuration for connecting to PC
I've always been fascinated by the Microdrive technology. In particular it's the approach of using mass-produced components from other products (e.g. audio head from cassette tape decks as read/write head), to create an inexpensive solution that could -at least somewhat- compete with the much more expensive floppy disk drives common at the time. The emulator should therefore be designed in the same spirit, and use as few and cheap components as possible.
The Arduino Nano seemed to be the right choice for that. If it all possible, it should also be the only major component in the design, not counting resistors, diodes, and connectors. This design goal shaped OqtaDrive's structure: The Nano takes the part of a protocol converter between the Microdrive interface and a daemon process running on a host machine, that manages Microdrive data. One advantage with this is that no storage components (e.g. SD card reader) and no UI components (LCD screen, buttons) are needed, since the daemon can be easily controlled form the daemon host. Another advantage is that the daemon host will usually be connected to a network, opening up interesting opportunities for use and further development of the emulator.
First I had to find out how the Microdrive records data, to estimate whether this could be pulled off with a Nano in the first place. There is a lot of information available, but of course it's also fun to supplement this with a bit of research of your own. I started with the Spectrum, by looking at the signals of the Microdrive port on the Interface 1 while formatting a cartridge. Data is written on two tracks, with above mentioned stereo cassette tape head. Bytes are alternating between the two tracks, with an offset of four bits against each other. One bit is 12µs long. A 0 is signaled by no level change during the duration of the bit (ca. 41kHz), and a 1 by a level change at 6µs from start of bit (ca. 83kHz).
Next up was the logical format, for which the Spectrum Microdrive Book by Ian Logan was particularly helpful. A cartridge is organized in up to 254 sectors. Each sector consists of a 27 byte header and a 540 byte data record, separated by short gaps (3.75ms after a header, 7.0ms after a record). This was also the greatest challenge: The RAM of the Nano (2KB) is far too small to hold a complete cartridge (144KB). So data has to be continuously passed back and forth between Nano and daemon. At a bit rate of 1Mb/s over the serial connection that should at least theoretically be possible. Luckily, my first trials showed that the connection remains stable at this speed. After a few more experiments the big moment had come - for the first time I could correctly receive all sectors while formatting a cartridge.
The first success in communicating with the Microdrive interface was followed by a long phase of prototyping, both for hardware as well as firmware for the Nano and the daemon software. Over many iterations and refactorings, a first version of the emulator gradually evolved, which supported all the features of the original Microdrive, but for the time being only for the Spectrum.
After the prototyping phase, I suspended work on the project for quite some time, due to changed priorities. In early 2021 though, two discussions over at World of Spectrum sparked my interest again. I resumed work on the project and started to get it into shape for publication. The biggest still missing part was support for the Sinclair QL. My goal was to avoid creating a separate variant of the emulator. That is, the same adapter should work with both Spectrum and QL, ideally with auto detect.
This meant back to research & experimentation, since it became quickly evident that after all there are quite a few differences between Spectrum and QL Microdrives: Starting with a higher data rate (50/100kHz), swapped tracks and shorter gaps after headers and records, over a changed logical structure, all the way to a completely different format procedure, there were many surprises. OqtaDrive's architecture proved helpful in tackling all of this. Many of the necessary changes could be addressed in the daemon, which in terms of software development was much easier to do. And finally, another big moment - first successful format with the QL.
Beginning of May 2021 support for the QL was complete and the adapter could automatically detect Spectrum and QL, as desired. After many refactorings the code base was also cleaned up enough to warrant publishing on GitHub. From the start it was important to me to make this project available under a free license, so anyone interested in this could built it.
By open sourcing, OqtaDrive could also win the first contributors. Tom Dalby designed several PCBs for various configurations along with models for 3D printing cases - from a standalone config with Raspberry Pi onboard to a minimal micro version. Stephan Preuß relentlessly tested many pre-releases, on Spectrum and QL, and found quite a few bugs. And not to forget all the discussions that sprang up over the collaboration, which were important for the direction of OqtaDrive. For example, initially I wasn't really interested in an standalone config that could be controlled via a web UI. But due to Tom's and Stephan's suggestions and friendly nudging, this is today my favorite config.
Since the initial publication in May there have already been 7 releases, and OqtaDrive has a sizeable feature set by now:
|Saturday||10:00 - 12:30 / 13:30 - 19:00|
|Sunday||10:00 - 18:00|
There are no scheduled demo slots right now. We'll just decide on the spot, depending on number of visitors and interest. I'll be showing original Microdrives and various OqtaDrive configurations hands on. I'm also planning to build an OqtaDrive adapter live