{{:oq-banner.png?400|}} ====== OqtaDrive ====== //**A Sinclair Microdrive Emulator**//, **Alexander Vollschwitz** {{:oq-microdrive.jpg?310&direct |Microdrive}} 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. {{ :oq-cartridge.jpg?350&direct|Microdrive cartridge}} {{ :oq-cart-cass.jpg?350&direct|size comparison}} 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//. ===== Profile ===== ==== Original ==== {{:oq-cartridge_and_case.jpg?250&direct |Microdrive cartridge from QL software suite}} ^ Manufacturer | Sinclair Research | ^ Model Name | ZX Microdrive | ^ Year of introduction | 1983 | ^ Country | Great Britain | ^ Price at time of introduction | £49.95 | ^ Technology | endless magnetic tape | ^ Capacity | max. 128KB, typ. 70-80KB | ^ Tape | 1.9mm x 5m, 76cm/s | ^ Format | 2 tracks | For use with //ZX Spectrum//, an //Interface 1// adapter is required. Price at introduction was £49.95. Later, bundles were offered at £79.95. ==== Emulator ==== ^ Hardware | //Arduino Nano// | ^ Software | firmware in //C//, daemon in //Golang//, web UI based on //Bootstrap// | ^ Project Home | [[https://oqtadrive.org|Home]], [[https://codeberg.org/xelalexv/oqtadrive|Codeberg]] | ^ Contributors | Alexander Vollschwitz (developer/maintainer), Tom Dalby (PCB & case design, testing), Stephan Preuß (testing) | ^ License | GPL-3.0 | {{ :oq-family.jpg?680&direct |family gathering}} Here are a few members of the "//OqtaDrive// family" (built by [[https://www.tomdalby.com/|Tom Dalby]]) - left and rear: standalone config in original and 3D printed case, front: minimal configuration for connecting to PC ===== Development ===== ==== Approach ==== {{ :oq-inside.jpg?320&direct|inside (QL)}} 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. ==== Format ==== {{ :oq-bits.jpg?320&direct|1 and 0 bits}} 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). {{:oq-first-contact.png?400&direct |first success}} Next up was the logical format, for which the [[https://worldofspectrum.org/archive/books/spectrum-microdrive-book|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. ==== Prototypes ==== 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//. {{:oq-prototypes.jpg?420&direct |first two prototypes}}{{ :oq-prototype-3b.jpg?224&direct|prototype 3}} {{:oq-patched-prototype.jpg?224&direct |patches}}{{ :oq-prototype-2.jpg?360&direct|prototype 2}} ==== Support for the QL ==== After the prototyping phase, I suspended work on the project for quite some time, due to changed priorities. In early 2021 though, [[https://worldofspectrum.org/forums/discussion/58474/strange-microdrive-format|two]] [[https://worldofspectrum.org/forums/discussion/58258/microdrive-logic-flow|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//. {{:oq-ql-format-dir.png?400&direct |first success with QL}} 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//. ==== Open Sourcing ==== {{ ::oq-pcbs.jpg?300&direct|from standalone to micro}} 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 [[https://codeberg.org/xelalexv/oqtadrive|publishing]]. 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. :-D ===== Status ===== Since the initial publication in May there have already been 7 releases, and //OqtaDrive// has a sizeable feature set by now: * Supports all Microdrive operations on //Spectrum// and //QL// * Can co-exist with actual hardware Microdrive units, which can be mapped on demand to any slot in the drive chain or turned off * Daemon can run on Linux, MacOS, and Windows * Control daemon via command line interface and web UI * Load & save from/to //MDR// and //MDV// formatted cartridge files * For //Spectrum//, //Z80// snapshot files can be directly loaded * Store your cartridge collection on the daemon host and search & load from any client * List virtual drives & contents of cartridges * Connect a //rumble motor// for authentic sound ;-) * Hex dump cartridge contents for inspection * Install script for Linux {{ :oq-standalone.jpg?640&direct |standalone}} ===== Virtual Exhibition Desk ===== {{ ::oq-micro.jpg?280&direct|micro}} [[https://bbb.vcfb.de/b/xel-c5e-y6s-m3u|To the virtual exhibition desk]] ==== Availability Times ==== ^ Day ^ Time ^ |Saturday | 10:00 - 12:30 / 13:30 - 19:00 | |Sunday | 10:00 - 18:00 | ==== Demo Times ==== {{ ::oq-config-internal.jpg?400&direct|built-in in Interface 1}} {{ ::oq-config-external.jpg?400&direct|standalone}} 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 :-P ^ Day ^ Time ^ Demo ^ |Saturady | xx:xx | xxx | |Sunday | xx:xx | yyy |