Yet another Microdrive emulator...

For experts to discuss very technical stuff and newbies to ask why the Spectrum they bought off ebay doesn't work.
User avatar
xelalex
Dizzy
Posts: 50
Joined: Sat Mar 17, 2018 6:13 pm

Yet another Microdrive emulator...

Post by xelalex »

Hi there,

I just got a prototype of a Microdrive emulator working. I know, there are a few solutions already out there, and while those are great, I wanted to approach things from a slightly different angle: Instead of using something like an SD card for storage, data is served directly from a PC. So this emulator is actually more of a protocol converter. The advantages I see:

Usability:

- By managing the Microdrives and images on the PC side, I can get a better user interface.

- I don't need to transfer cartridge images to/from a storage card. So for example, I can download an image, right click and choose the Microdrive slot. Then on the Spectrum just do LOAD.

- I can get automated backups of cartridge images, i.e. keep the last x versions of an image to revert accidental writes & formatting.


Transparency:

Now this one is certainly opinionated and debatable, but I wanted to keep things "historically correct". On the Sinclair side, operating the emulated Microdrives should feel exactly the same as using the real thing (minus the unreliability, but some flakiness could be added in the software ;-) So hooking into the Sinclair ROM and providing new functionality was not what I wanted. The emulation should be totally transparent, also to provide maximum compatibility with existing software.


I'm quite happy with the reliability of the prototype. I recently discussed this approach and got somewhat reserved feedback. In particular, the fact that you would need to keep your Sinclair hooked up to the PC was considered uncool. I'm wondering whether that's really such a drawback. I'm looking into using a phone as the host, which could maybe alleviate this concern.

So what do you think? Worth pursuing any further? Is there any need for this kind of emulator? Once this graduates from the prototyping stage, I would consider getting the adapter manufactured. BTW, this should also work with a QL. Trying that out is right next on my TODO list.

Alex
User avatar
RMartins
Manic Miner
Posts: 776
Joined: Thu Nov 16, 2017 3:26 pm

Re: Yet another Microdrive emulator...

Post by RMartins »

This is really interesting, specially, if it runs fatefully to the original.
Nice work,

Can you share any pictures of the prototype ?

If the prototype, uses Bluetooth or similar, it would be much easier to use, since there are no wires, and bluetooth is available everywhere, mobile, PC, etc...
User avatar
xelalex
Dizzy
Posts: 50
Joined: Sat Mar 17, 2018 6:13 pm

Re: Yet another Microdrive emulator...

Post by xelalex »

Here's a picture of of prototypes I and II. It's really just an Arduino Nano with an edge connector.

Image

I put this into a box for protection. It's much larger than what it should be, but at least it's Spectrum black ;-) In the end I'd like this to be just a plug.

Image

I'll experiment with Bluetooth, but I need a steady 1Mbit/s serial connection. Not sure whether that can be obtained with Bluetooth.
User avatar
xelalex
Dizzy
Posts: 50
Joined: Sat Mar 17, 2018 6:13 pm

Re: Yet another Microdrive emulator...

Post by xelalex »

And here it is in action :)
Image
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Yet another Microdrive emulator...

Post by Nomad »

Nice work! Good to see the microdrive getting some sweet luvin'
User avatar
xelalex
Dizzy
Posts: 50
Joined: Sat Mar 17, 2018 6:13 pm

Re: Yet another Microdrive emulator...

Post by xelalex »

Here's a video of loading the demo cartridge. I placed the console over the video grabber window, so you can see what's going on in the Microdrive daemon. Every 'g' is a 'get sector'.

https://www.dropbox.com/s/gsai8cj11aayp ... o.mp4?dl=0

Image

Would that time-wise be comparable to loading from a real Microdrive? I actually don't have a Microdrive myself. Do the s/w emulators behave truthfully when loading from Microdrive? If so, I could use that to compare.
fulcrumb
Drutt
Posts: 1
Joined: Tue Jan 26, 2021 5:08 am

Re: Yet another Microdrive emulator...

Post by fulcrumb »

Hi,
I'm also working on a similar project: Replace the Microdrive casette unit with an arduino. I try to find some open source projects, but no success. I have few ideas, I tested the formatting command on the Interface 1 Microdrive connector with a scope. It seems not too complicated, but if somebody has any results on this topic, that would be welcome. I would like to discuss and share my ideas with other experienced peoples.

Thank You,
Regards,
f
User avatar
Hedge1970
Manic Miner
Posts: 388
Joined: Mon Feb 18, 2019 2:41 pm

Re: Yet another Microdrive emulator...

Post by Hedge1970 »

I am just rolling off a three week project where I exclusively used my vDriveZX Microdrive. Also about 2-3 years ago I used real Microdrives for about a year, continually buying disks off eBay, getting perhaps 1 or 2 good ones from a pack of 4, but even these eventually failed which is when I discovered vDriveZX.

The issue with Microdrive in general is that they are write once only, you cannot write over like you can with today’s modern stuff. My work around - while the programs are small enough - is to save progress iteratively to drive 1, then each day or when it’s full save the latest version of the software to drives 2-7 and then format drive 1.

While this is true to the originals providing the option of overwrite would be cool.

Apart from that use the existing format MDR I think it is so you can use emulator or real Speccy depending on the need.

As to being hooked up to the PC for me that’s not a problem but others may have issues with it.
User avatar
xelalex
Dizzy
Posts: 50
Joined: Sat Mar 17, 2018 6:13 pm

Re: Yet another Microdrive emulator...

Post by xelalex »

Sorry for the late reply. I've recently done some more work on the emulator, after a long pause. I have it working now with both Interface 1 & QL, running the same firmware on the adapter. It automatically recognizes what it's connected to. I'm planning to publish the project on GitHub, hopefully within the next couple of months.

As for improvements over the original such as overwrite: since the cartridges are managed on the PC, a lot of features would be possible. You could also do revision control of your cartridges, e.g. keep that last x versions around.
User avatar
xelalex
Dizzy
Posts: 50
Joined: Sat Mar 17, 2018 6:13 pm

Re: Yet another Microdrive emulator...

Post by xelalex »

The project is finally available on GitHub. Happy Hacking ;-)
User avatar
xelalex
Dizzy
Posts: 50
Joined: Sat Mar 17, 2018 6:13 pm

Re: Yet another Microdrive emulator...

Post by xelalex »

New OqtaDrive release 0.1.2 is out.

What's new:

This release contains important bug fixes, so upgrading is strongly recommended. It requires re-flashing the adapter. The circuit also has small but important changes.

- circuit update

- several major & minor bug fixes, documentation updates & correction

- auto-save of cartridges in daemon

- support FORMAT for Spectrums with early ROMs (Issue 3 and older). This one was quite interesting. The FORMAT routine on these earlier machines is different. It's more similar to the QL, in the sense that longer records than usual are written. This is to test more of the tape area between two headers that could potentially be used later on during writes. It also does only one verification round. This was changed on later models to writing standard records and doing two verification rounds.

- versioning of serial protocol

- reject loading of corrupted cartridges; added repair flag to load action - this can fix check sums & sector ordering on the fly when loading a cartridge

...and other stuff. More details in the change log.
User avatar
TomD
Manic Miner
Posts: 367
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: Yet another Microdrive emulator...

Post by TomD »

Just noticed the bug you've found in Z80onMDR regarding the .z80 vs. .Z80. Easy for me to fix that if it helps with your daemon?

TomD
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
User avatar
xelalex
Dizzy
Posts: 50
Joined: Sat Mar 17, 2018 6:13 pm

Re: Yet another Microdrive emulator...

Post by xelalex »

Ah, cool! Didn't know how to report that issue, and wanted a quick fix for it. It's really just a few extra lines in the load command, so no big deal. But in general, it would be nice if Z80onMDR could accept both extensions on Linux. Great tool by the way! Thanks for putting this out!
User avatar
TomD
Manic Miner
Posts: 367
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: Yet another Microdrive emulator...

Post by TomD »

xelalex wrote: Wed May 26, 2021 10:03 am Ah, cool! Didn't know how to report that issue, and wanted a quick fix for it. It's really just a few extra lines in the load command, so no big deal. But in general, it would be nice if Z80onMDR could accept both extensions on Linux. Great tool by the way! Thanks for putting this out!
Will make the change and upload next version today (hopefully).

Also I've just bought the parts to make my own version of your interface, looking forward to testing it out :)

One thought is would it possible to use a WeMos D1 Mini Arduino and make use of the wi-fi?

TomD
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
User avatar
xelalex
Dizzy
Posts: 50
Joined: Sat Mar 17, 2018 6:13 pm

Re: Yet another Microdrive emulator...

Post by xelalex »

The WeMos D1 Mini Arduino has a completely different controller, so the current adapter firmware will not work there. It also uses 3.3V logic, so level conversion would be required to interface with the 5V logic Microdrive bus. In general though, other boards can be supported in the future, but require a partial or complete re-implementation of the adapter firmware. The integration point with the daemon is the serial protocol (which I still need to document).

This could be extended in the future to also work via network. One thing to keep in mind though: boards without enough RAM to hold a complete cartridge, as the Nano and the WeMos D1, need to stream the data back and forth as needed. This requires a steady 1Mbps serial connection. That's no problem via USB, but may be tough to achieve over a network. This is not so much about the network speed. Even home networks are often 1Gbps already. It's more about guaranteed max latency, i.e., reliability. With WiFi, this gets even worse. So when integrating with the daemon over network, moving complete cartridges between adapter and daemon would be inevitable, so that read/write could be done locally on the adapter. But that requires enough RAM for at least one cartridge.
User avatar
TomD
Manic Miner
Posts: 367
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: Yet another Microdrive emulator...

Post by TomD »

xelalex wrote: Wed May 26, 2021 11:29 am The WeMos D1 Mini Arduino has a completely different controller, so the current adapter firmware will not work there. It also uses 3.3V logic, so level conversion would be required to interface with the 5V logic Microdrive bus. In general though, other boards can be supported in the future, but require a partial or complete re-implementation of the adapter firmware. The integration point with the daemon is the serial protocol (which I still need to document).

This could be extended in the future to also work via network. One thing to keep in mind though: boards without enough RAM to hold a complete cartridge, as the Nano and the WeMos D1, need to stream the data back and forth as needed. This requires a steady 1Mbps serial connection. That's no problem via USB, but may be tough to achieve over a network. This is not so much about the network speed. Even home networks are often 1Gbps already. It's more about guaranteed max latency, i.e., reliability. With WiFi, this gets even worse. So when integrating with the daemon over network, moving complete cartridges between adapter and daemon would be inevitable, so that read/write could be done locally on the adapter. But that requires enough RAM for at least one cartridge.
Good to know, guess the best option would be a board with some RAM to allow for buffering of the cartridge but not even sure if those exist. Other than building a few projects like Greaseweazle & gbscontrol and following the instructions to the letter I've never really looked into how these boards work, so thanks for the detailed explanation. Something to add to the project list and if you ever do expand this project I'll be happy to test.

Once I get my board set-up I'll post the results, I'm also looking to build an enclosure for it like I did for the vDrive (https://www.thingiverse.com/thing:4648303)

TomD
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
User avatar
TomD
Manic Miner
Posts: 367
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: Yet another Microdrive emulator...

Post by TomD »

New version of Z80onMDR uploaded fixing the capital Z in z80 issue. I also corrected a typo in the help which had -s for screen instead of -l

Grab from the usual place https://tomdalby.com/other/z80onmdr.html

TomD
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
User avatar
TomD
Manic Miner
Posts: 367
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: Yet another Microdrive emulator...

Post by TomD »

Had a lot of fun messing with this over the weekend including getting it up and running with a Raspberry Pi Zero W so I basically now have a wireless Microdrive (well other than power) which would have blown my mind back in the 80s :-). Am wondering if the Pi & Nano could be powered from the Spectrum but probably pushing it especially with older PSUs.

I also wrote a quick guide if anybody fancies trying it out with a Pi Zero W which you can find on Alexander's github site https://github.com/xelalexv/oqtadrive/discussions/13
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
User avatar
xelalex
Dizzy
Posts: 50
Joined: Sat Mar 17, 2018 6:13 pm

Re: Yet another Microdrive emulator...

Post by xelalex »

New OqtaDrive release 0.1.3 is out.

Biggest new feature is hardware drive mapping. This allows you to freely move hardware Microdrives as a group within the drive chain, or turn them off completely. Also, '--port' option of oqtactl was changed to '--address', to specify full listen address, i.e. host & port. You can now expose the OqtaDrive daemon in you local network. Details as usual in the change log.
User avatar
TomD
Manic Miner
Posts: 367
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: Yet another Microdrive emulator...

Post by TomD »

Prototype PCB has arrived and working great :-)

Image
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
User avatar
TomD
Manic Miner
Posts: 367
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: Yet another Microdrive emulator...

Post by TomD »

I’ve written a set-up guide if anybody fancies having a go at putting one together http://www.tomdalby.com/other/oqtadrive.html
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
8bit-bruno
Drutt
Posts: 1
Joined: Mon Aug 30, 2021 12:43 pm

Re: Yet another Microdrive emulator...

Post by 8bit-bruno »

What a project!
My prototype is working and i'm testing a couple of hardware mods/improvements before drawing a pcb.
I also have a Vdrive but the web ui is really useful.

Hope to contribute to this project soon!

Bruno
User avatar
xelalex
Dizzy
Posts: 50
Joined: Sat Mar 17, 2018 6:13 pm

Re: Yet another Microdrive emulator...

Post by xelalex »

Cool! Happy to hear it's working for you.

> My prototype is working and I'm testing a couple of hardware mods/improvements before drawing a pcb.

Re PCBs it's probably a good idea to get [mention]TomD[/mention]'s attention. He's been doing all the PCB work so far, and has released already several layouts for different use cases.

> I also have a Vdrive but the web ui is really useful.

The web UI is at the moment still in early alpha stage, but I'm glad it can already be useful :P More features are coming up soon.

> Hope to contribute to this project soon!

Looking forward to it!

Alex
User avatar
Morpheus
Microbot
Posts: 124
Joined: Thu Nov 16, 2017 4:18 pm
Location: Hurworth-On-Tees, UK
Contact:

Re: Yet another Microdrive emulator...

Post by Morpheus »

Sorry I haven’t posted a picture of my Oqtadrive yet but I will soon, it works a treat now I have figured out what I had missed off ( turned out to be a jumper )
Toms’ PCB was really nice to build and the software was easy to install. I wonder, have you looked at the Raspberry Pi Pico instead of the Nano?
R Tape loading error, 0:1
User avatar
xelalex
Dizzy
Posts: 50
Joined: Sat Mar 17, 2018 6:13 pm

Re: Yet another Microdrive emulator...

Post by xelalex »

Morpheus wrote: Tue Oct 05, 2021 6:26 pm I wonder, have you looked at the Raspberry Pi Pico instead of the Nano?
I still have two Picos that have been loitering about my desk since I ordered them last year, that need to be put to some use. At one point during OqtaDrive development I considered switching to the Pico. I thought I had hit a performance problem that the Nano would not be able to overcome. But it turned out that after all everything was doable with the Nano.

In general it's possible to put the adapter code onto a different micro-controller. It would require a bit of tweaking though. Timing and the use of interrupts is crucial. Any reason for prefering a Pico over a Nano?
Post Reply