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 beyond the end-of-data (EOD) marker on the tape, possibly recovering previously-written archives that extended beyond the most recent archive.
  • 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, using nothing more than a run-of-the-mill Colorado 250 drive and a $5 logic analyzer, 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!

Reclaiming my Sous Vide

Disclaimer: not affiliated with, or endorsed by, ChefSteps or Breville.

While cleaning out some of our kitchen drawers, I found a device that I had nearly forgotten about: the Joule sous vide immersion circulator.

We bought this device years ago, wanting to experiment with sous vide cooking. But now I suddenly remember why we abandoned it so quickly afterwards.

The Joule is a pretty clever device from a hardware perspective. Don’t let the small form factor fool you: it packs 1100 watts of power, which will bring a pot of water to the desired temperature surprisingly quickly.

However, the annoying, obnoxious, frustrating thing about the Joule is, of course, that it requires an app to operate. And the official app is, unfortunately, an abomination. First, it requires you to sign in to your account, because god forbid anyone would want to sous-vide their food anonymously! Then it pairs with the Joule over Bluetooth, then makes your Joule connect to your WiFi network, and only when the Joule is safely linked and synced to your account over WiFi, only then does it start allowing you to make the Joule do its actual job. And this is assuming the app doesn’t crash, or doesn’t randomly disconnect, or the servers aren’t down.

Well, no more of this silliness. With Claude by my side, I knocked out my own app that controls the Joule, purely over Bluetooth, without any further need to connect to WiFi or requiring any accounts. (This was based on some excellent community reverse-engineering work done years ago [1] [2], I just took it the rest of the way.) Fortunately the Joule’s Bluetooth protocol allows it to be fully controlled without any kind of WiFi handshaking. I suspect the requirement for logins and WiFi connectivity in the official app was a product management decision, not an engineering decision 😉.

I give you… OpenSousVide!

This is a deliberately feature-less app for controlling the Joule. After connecting to the Joule, the app offers two things: a temperature setting, and a Start/Stop button. That’s all it does, because that’s all I need.

Once you press Start, the Joule will start and hold the temperature at the desired level, because that’s the only thing I want it to do. It will keep holding the temperature even if you close the app, or go out of range of the Joule, or turn off your phone entirely.

The app does not have a built-in timer. If you need to run the Joule for a certain amount of time, you can set a timer yourself, using whatever timing technology you like. When the time is up, you can open the app again and press the Stop button. Or you can just unplug the Joule. I don’t care.

If you need to leave your house while the Joule is running, you will not be able to monitor it, because it’s not connected to WiFi, and that is OK. In the old days, people would sometimes leave their house while cooking things in the oven, and would need to weigh the risks of leaving the oven unattended. You, too, must weigh the risk of leaving the Joule running unsupervised.

So, if you have one of these early-generation Joule devices, and were as frustrated as I am by the official app, now you have another option! The app is built in React Native, so it will run on Android or iOS. Visit the repository if you would like to download the app for your Android device. And for iOS, I may publish it on the App Store at some point, but until then you’re welcome to build the app and deploy it to your own iPhone.

Timeline of the far future

One of my favorite articles on Wikipedia is called Timeline of the far future. The entire article is a gigantic table of events that are predicted to occur at various points in the future, based on our current understanding of everything including the environment, geology, physics, and ultimately cosmology and the fate of the universe.

Every single item in this huge table is fascinating to me, and every item can be a jumping-off point into a rabbit hole of exploration into that particular topic. It covers everything from mundane observations about lunar tides slowing down the length of our day over the next thousand years, then sometimes veers into the realm of science fiction with predictions about humanity becoming a Type II and Type III civilization, and eventually ends up in mind-bending time scales like 101026 years when all matter will quantum-tunnel into black holes, and beyond.

The only problem with this article is the presentation. It’s so boring! The matter-of-fact, wall-of-text table of events does so little justice to the profound, awe-inspiring insights contained in it. This article deserves so much better! It deserves to be seen, to be savored.

So I decided to kick it up a notch. Being a visual learner myself, and wanting an opportunity to improve my skills with three.js and typescript, I made a “reimagined” version of this article (with the help of my favorite AI assistant), giving it the visual treatment it needs so badly. Here is my take on the Timeline of the far future.

Every event in the timeline is a full-screen slide with the original text copied from the table in the article, but also includes an animation that illustrates what is being described. Many of the animations are my own artisanal code, and many are Claude-assisted but nevertheless verified to the best of my ability for accuracy and consistency.

You can scroll through the slides by scrolling your mouse wheel, or swiping on your mobile device. You can also jump to any event by selecting directly on the timeline ruler at the top.

If you want to share any of the individual slides, click the Share button at the top-right, which copies a link directly to the current slide, like this.

One major limitation of this presentation is that it’s based on one specific revision of the Wikipedia article. The article will almost certainly be edited in the future with new information, updated facts and figures, and many new predictions. My plan for the next iteration of this web app is to adapt dynamically to any new content added to the source article, and update the animations accordingly. Stay tuned, and as always, I welcome your feedback!

Relativity Park: taming the speed of light

Recently I finished building another thing™ that’s been on my mind for a long time. It’s a simulation of a simple real-world environment, except for one important difference: the speed of light in this environment is extremely slowed down to exactly 5 kilometers per hour, a brisk walking speed. With this crucial difference, we’re able to observe relativistic effects at more human scales, thereby developing a better intuition of what actually happens when an observer approaches the speed of light relative to their surroundings.

This was largely inspired by MIT’s OpenRelativity project, which was released around 2012, and is intended for use in the Unity engine. I, however, wanted to make something much more lightweight: plain javascript and WebGL, usable in a web app. I also wanted to make it as physically accurate as possible, while maintaining fairly good performance, paying particular attention to relativistic Doppler effects (redshift, blueshift, transverse effects) and effects from light travel delay such as Terrell rotation and temporal Doppler nuances, the latter of which OpenRelativity seems to neglect.

Naturally I made heavy use of LLMs in building this simulation (Claude Opus 5), but this was only due to my inexperience with OpenGL, not any inexperience with the mathematics of special relativity. In fact, before anyone concludes that LLMs “understand” special relativity, I will note that I had to steer and re-prompt the LLM numerous times with the proper equations to get it to work properly.

Something remarkable about this kind of simulation is that the mathematics is really not very complicated; most of it is high school level algebra. So as long as we get the math right, all of the various effects and strange phenomena emerge automatically. The thing that continues to boggle my mind, and the thing that I appreciate even deeper after finishing this app, is how Einstein could have envisioned this geometry and all its implications from first principles, without the benefit of pretty visualizations. For the rest of us, I hope this visualization can serve as a reminder of how weird our world actually is, at high enough speeds and high enough energies.

Check it out, and let me know if anything appears inaccurate, or if you’d like to see any additional features!

(on Hacker News)
(on Gizmodo)

Return to Zork: now moddable!

One of my favorite DOS games from the mid-1990s was Return to Zork. It was a bold departure from the purely text-based Zork games of old, with very nice VGA graphics and a point-and-click interface for interacting with the game’s world. My warm sentiment was not quite shared by my friends at the time, though. Professional critics also gave it mixed reviews, and with good reason.

Let’s just say I love this game more than it deserves. The biggest downfall of the game is the puzzles themselves which are woven through the story of the game. It’s clear that the intention of the creators was to make the puzzles light-hearted and whimsical, but the outcome turned out to be puzzles that are needlessly convoluted, and often frustratingly random.

Many of the puzzles require plain trial and error, seeing if any of the items in your inventory have an effect on your current surroundings. Some inventory items required to complete the game are only available at the very beginning, but if they are not obtained, the game still continues nearly to the end, until you realize that you needed the item all along, and can only obtain it by restarting the whole game. It was hardly possible to complete the game without a printed guide or walkthrough.

And yet, something about the quaintness of the game’s graphics, the corniness of the acting and dialogue, and the genuine technical impressiveness of the game’s engine makes me feel relaxed and at home in the Great Underground Empire. When not engaging with the game’s puzzles, it allows you to stroll freely through the environment in an open-ended way, which I recommend.

When I played the game in the 90s, I recall wanting to “mod” the game, in the sense of tweaking the graphics and sound (e.g. drawing graffiti on the walls of the buildings, inserting myself as one of the characters, and so on), or maybe even changing the script and the outcomes of certain actions.

Well, better late than never:

Now that we can will software into existence, here is a complete toolkit for unpacking all the assets of Return to Zork! Once unpacked, all of the graphics become PNG files, and all of the sounds become WAV files, editable as much as you like. When finished, the toolkit lets you re-pack everything, magically allowing the game to become playable with your new assets!
Look at the README in the repo for a complete breakdown of all the file formats and how they are packaged, as well as complete instructions for unpacking and rebuilding the game.

The end result? Here is me “standing in” for the character of Moadikum Moodock, the arms dealer who teaches the Player character how to play the mini-game of Survivor, vitally important for defeating the final boss Morphius:

Sorry you had to see that; it’s just a weird way in which I’ve always wanted to immerse myself in this game. No offense meant to the actor who actually portrayed Moodock (Ernie Lively, RIP) (yes, he was the father of Blake Lively!). This is meant purely as an homage, a love letter, to such a memorable character. His delivery of the line “Pull up a chair, and I’ll teach it to you!” is something I still quote to this day.
Care to try it yourself? ‘Course you do!