Reading unreadable tapes

A universal reader for mini QIC cartridges?

As you may know, I have an unhealthy fascination with QIC tape cartridges, and offer a service to recover the data from these cartridges. Hopefully this will be my last post about this subject for a while, because this post represents a sort of “ultimate goal” in the methods of data recovery from these tapes.

You see, about a year ago I received a box of tapes that someone wanted me to read the data from. These are DC2000 cartridges, which is one of the earliest versions of this mini form factor of quarter inch cartridge tapes. I assumed it would be an easy job; I have my tape drives that these fit into, I have my software that controls the tape drive; what could be simpler?

But I was completely wrong. It turned out that none of my drives could read any of these tapes. Not my Colorado drives, nor my Irwin drives, nor my Mountain drives, etc. Which could mean only a couple of things: either these tapes are completely blank, or erased, or perhaps degraded beyond the point of recoverability, or these tapes have some kind of nonstandard formatting which is not compatible with any of my drives. And I don’t mean the logical format of the data itself, but the physical flux formatting as it’s written to the tape. And in fact, if we look at the history of these types of cartridges, the standard formatting that they’re supposed to use (QIC-40, followed by QIC-80, and so on) only came into effect a few years after these cartridges were already on the market. This means that there was a period of time when any manufacturer could just write their own proprietary format on these cartridges, and then disappear from the world without ever leaving any documentation about their format.

So at that point, when I realized none of my drives could read these tapes, and the person who sent these to me also didn’t know what system originally wrote them, we were pretty much dead in the water, and agreed there’s nothing else to be done. Fortunately this person allowed me to keep the tapes, and I didn’t throw them away, hoping that one day it might become possible to read them.

Ever since then, I’ve had the idea in the back of my mind to make a sort of “universal” reader for these kinds of tapes, regardless of the flux formatting. There’s actually a similar project that exists already, which is actually called Universal QIC Reader, made by AJ of Forgotten Machines, but his system only works with the larger and older full-size QIC tapes like DC300, DC600 and so on. As far as I know it’s not intended to work with these mini cartridges, and I wanted to try my hand at making a reader myself to read them.

Why not Greaseweazle?

Something that might be tempting for us to use for this purpose is a Greaseweazle. If you’re unfamiliar with the Greaseweazle, it’s a USB device that connects to a floppy drive with a standard FDC ribbon cable, and “takes over” as the floppy controller, enabling you to read the raw flux transitions from any floppy disk, including disks from foreign systems that your floppy drive wasn’t necessarily designed to handle. This is great because it turns your floppy drive into a “universal reader” for disks that it was never even intended to read.

So then our first thought might be, since these tape drives also connect to a floppy controller, couldn’t we perform a similar function and let a Greaseweazle take control of the tape drive and make it output the flux transitions from the tape?

Unfortunately the nature of how these tape drives work prevents us from using them this way. The problem is: when you insert a tape into this drive, the drive itself goes through a lot of steps to detect what format of tape it is, and if it fails to detect the format, then the drive refuses to do anything else with it. It literally stops dead, until you insert another tape that the drive judges to be valid. This is very different from a floppy drive, which will obediently spin any disk you insert into it.

In other words, these tape drives are too smart for their own good. They have their own expectation of the tape format before they start outputting the flux data over the cable. This basically defeats the benefit of a Greaseweazle in this case, so we’re back to square one.

Now, if we step back and ask what we really need here, fundamentally it’s two things: we need a drive that can wind the tape without caring about the format of the tape (i.e. we need the drive to be dumber), and we need a way to read the flux data from it while it’s running.

Part 1: A dumber tape drive

I just mentioned how this drive is too smart for its own good. Well the fact is, it’s so smart that it has its own ROM chip. And what’s our first instinct when we see a ROM chip? We can unsolder it, dump it, and reverse-engineer it!

I went ahead and dumped the ROM chip using my trusty XGecu T48 programmer, and then I had Claude disassemble and reverse-engineer the ROM, and it found quite a few interesting things that can help us (see the analysis in the repo).

The most important thing is, apparently, this drive has a special “diagnostic mode” that we can activate by sending a special command over the floppy cable. And once it’s in the diagnostic mode, we can make it do basically anything we want, including remote code execution (that’s right, the drive is thoroughly pwned!).

We don’t really need to go as far as remote code execution, since there is another diagnostic command that disables the format check when inserting a tape. This is precisely what we’re looking for: make the drive spin the tape without caring about the format of the tape. (In QIC parlance, this disables reference burst detection. A “reference burst” is literally a burst of flux pulses on the tape that indicates the logical start of a track.)

So now, we have a drive that accepts any tape and winds it from beginning to end. We can also control the head motion, with the “fine” resolution of the stepper motor that moves the head from one track to another. (For all we know, these foreign tapes could have a totally different track layout than the QIC standard, so we need to be able to move the head to arbitrary positions, too.)

Part 2: Reading the flux

Now that we’ve got the tape spinning, how do we get the flux data from it? When the drive is running in the “dumbed-down” diagnostic mode, it does not emit any flux data over the floppy cable (another reason we can’t use a Greaseweazle), so we need another way of getting the flux.

I am an absolute novice with circuits and PCB components, but I know a few minimal things to get started. Inside a QIC tape drive, any time the tape is winding, it travels across the read head. So if we could somehow probe the output of the read head directly, or shortly after, we can grab the flux signal before it even reaches the logic of the drive itself. Let’s have a look at the relevant portion of the PC board of the drive again:

The read head connects directly to the J4 connector at the top. However, the signal that literally comes out of the read head is very weak, on the order of millivolts, so it would be futile to probe it directly. This is why the signal must first be amplified, which is probably the job of the U3 chip (the IC labeled 820-068) next to the connector. We can see some traces going from the connector directly to the chip. (Annoyingly these ICs are labeled only with Colorado’s internal numbering system, so we don’t know the “actual” identity of these chips.)

After the signal is amplified, it’s still an analog signal. This could be acceptable if all else fails; we could potentially sample this analog signal at a very high rate and construct a digital signal from it. But we might not need to: one of the other chips at the top (U1 or U2) is very likely a pulse qualifier, i.e. a pulse detector that takes an analog signal and outputs digital pulses at TTL levels. And hopefully this portion of the circuitry is dumb enough that it’s always active, that is, always outputting the flux signal regardless of the logical state of the drive.

The remaining manual labor is now very manageable: probe around the pins of U1 and U2 while the drive is winding a tape, and see which pin is outputting something that looks like flux signals. And before long, I found that pin 22 on chip U2 is looking very promising:

I soldered a lead onto that pin, as well as a ground lead, and secured them with a little hot glue, so that I could attach the leads to a logic analyzer. (Pay no attention to the third (orange) lead; this was some sort of clock signal that I thought might be useful, but turned out to be unnecessary.)

So then the last step is to actually capture the flux data onto our PC for analysis, and for this we can use a logic analyzer. But not just any logic analyzer; the cheapest possible logic analyzer that I found for $5 on AliExpress!

If it really does what it claims (8 channels, 24 MHz), it should be more than enough for our purposes. It worked without any issues in Linux, after installing the correct firmware driver for its controller chip: sudo apt install sigrok-firmware-fx2lafw
Capturing an initial sample trace is very encouraging. That sure looks like a genuine flux signal:

We can even see brief “pauses” in the flux signal, which very likely delineates “segments” of data on the tape. With all of the hardware in place and working, we’ve got a solid technique for reading the flux from the tape, with the drive motor and head position fully under our control.

Part 3: Decoding the flux

Spoilers: Claude did most of the decoding of the flux formatting. Once I gave Claude the binary capture of the flux (literally the initial trace seen above), it decoded the flux with the unnerving effortlessness we’ve come to expect at this point. Claude determined that this is definitely not standard QIC-40 formatting, with a different segmentation and CRC scheme, which confirms our initial suspicion that these tapes were written by a long-forgotten and undocumented manufacturer. It actually got as far as decoding some real, if tiny, fragments of data!

But our work is not yet done. The initial capture had tons of CRC errors in it, much more errors than data, which likely means that the head wasn’t aligned on a track, which is not surprising. Recall that these tapes contain much more than just a single track; in fact the QIC-40 standard uses 20 tracks (and QIC-80 uses 28 tracks!), all squeezed into the quarter-inch width of the tape.

Since we know that this isn’t a standard QIC-40 tape, we don’t really know the track layout of the tape. It could be entirely different from QIC-40, with a different number of tracks, different track pitch, etc. So how can we determine the track layout empirically? How about a head sweep, from top to bottom, while the tape is running? In other words, we start the tape running from the beginning, with the head positioned at the very top, and then, once per second, move the head one micro-step down, and repeat this movement every second until the head is at the bottom. In our resulting flux trace, this will give us one second’s worth of flux data at every micro-position of the head.

And with this sweep capture, we can make Claude determine the “integrity” of every second’s worth of flux data, and create a “heat map” of potential tracks at every micro-step of the head:

Bingo! As a bonus, Claude is also able to determine the direction of each track (forward or reverse) based solely on the flux characteristics.

This is definitely a different track layout than QIC-40. In the QIC-40 and QIC-80 standards the tracks are serpentine, but expanding outward from the center, such that even-numbered tracks (forward direction) are all on the upper half of the tape, and odd-numbered tracks (reverse direction) are on the lower half of the tape. Whereas this foreign format seems to have the tracks going sequentially from top to bottom, in a simple serpentine path.

We now have all the information necessary to read all the tracks on this tape. We start by positioning the head at the top, which becomes our fixed “reference” head position, then move the head by the corresponding number of micro-steps to reach the next track, as determined by the heat map of our tracks.

Putting it all together

I made a few scripts to orchestrate the whole process (see the repo): one script to put the drive into the necessary “diagnostic” mode, another script to move the read head all the way to the top, and a third script to dump all the tracks in succession, by moving the head by the appropriate amount, starting the tape motion, and calling the CLI command to perform the capture from the logic analyzer for the current track: sigrok-cli -d fx2lafw --channels D0 --config samplerate=24m -O binary --time=54s --output-file <trackN.bin>

To ensure an even better chance of recovering as much data as possible, I modified the script to read each track twice, with each read being one micro-head-step apart. Then, the scripts that Claude produced for decoding the flux data can ingest multiple flux captures for each track, combining it into a single result, and can also ingest the capture in forward or reverse direction.

Here, at last, is the “final” state of my Universal Mini QIC Reader:

The size of the raw flux captures are about 2GB per track, resulting in ~40GB (for a tape that holds about 40MB of data), but it’s well worth it because the final result was a completely successful recovery of all the data on these tapes.

That’s right: exactly 100% of the data was recovered successfully (with plenty of ECC corrections, of course), from tapes that had a completely unknown physical formatting, using a drive that was never intended to read them. Wild times.

I’ve made all of the decoding and orchestration scripts available in my repositories, for anyone who would like to check them out. The ftape repo contains the scripts for putting the Colorado drive into diagnostic mode, since these depend on the ftape kernel driver being loaded, and then the ftape-roms-doc repo contains the AI-assisted flux analysis scripts, as well as the special flux format documentation of these particular mystery tapes, in case anyone comes across a similar case in the future. The flux analysis scripts are extremely flexible and permissive: they automatically detect the sample rate, perform format detection, perform ECC correction, and will output whatever real data can be squeezed from the flux trace.

Implications

I will note an obvious caveat that I have only tested these techniques with a very specific tape drive model, the Colorado 250 MB. But I would wager that most other similar tape drives of the period could also be modified in this way, with a disassembly of their ROM and probing of their flux output.

This unlocks several very useful capabilities that were previously impossible:

  • Reading tapes that were written with nonstandard flux formatting, which is the case I’ve already described.
  • Reading tapes that are physically damaged, with arbitrary severity: Imagine a tape that is physically torn and re-spliced, particularly near the start of the tape. Or a tape that is torn and missing a length of the tape. Or a tape that was despooled and chewed, or crimped, or stretched…

All such cases would be utterly rejected by a standard drive, with no hope for any recoverable data. But with our new modified setup, we can read the flux from any surviving portion of the tape, as long as it physically passes across the read head.

And with that, we now have a long sought-after universal reader for mini QIC cartridges that (a) pre-date any kind of format standardization, or (b) thought to be damaged beyond readability. As always, if you have these kinds of tapes (or any others) lying around, and would like the data recovered from them, get in touch!