I recently managed to reactivate my dear old Epson HX-20, a retro computer released in 1983 which I used at the end of the 1980’s and early 1990’s to learn programming. Since I even could read in some BASIC programs that were still stored on the micro cassette, I wondered if I could rescue the code directly, without using OCR on printouts or even typing it off by hand. I was aware that I was very lucky that this machine still worked after all those years—the soldering seemed to have been much more rigid back then, it might cause more issues to attempt to run old PCs which are a decade younger! To be on the safe side, I invested into a new NiCd battery pack and replaced the original one.
My research first led me to the machine’s RS-232 output, internally called “COM0”. Someone had used that some years ago to directly connect an HX-20 to a PC’s serial port, using a special cable and some adapters. Sadly, it seems that this is no longer an option, since these cables disappear, and serial-to-USB adapters only seem to work with a certain chip in this case.
Then I stumbled upon the GPL software HXTape, and I was totally baffled: What, the Epson HX-20 had an external cassette interface as well? I knew that concept from our even older machine, the Texas Instruments TI-99/4A. It connected to a special music cassette recorder and encoded data into simple “magnetic bits” onto the tape:
It was quite funny to listen to the noisy sounds when playing the MCs on an ordinary player.
This bidirectional data transfer works over ordinary mono audio cables, one for each direction. And now, it turns out the HX-20 had such an interface as well, and we never used it. But the point is, one could exploit it to decode the audio signals into the original bits and bytes by connecting the HX-20’s “MIC” port to the microphone input of a PC using a simple mono audio cable with standard 3.5 mm jacks! (How tremendous the analog world was! Keep a music cassette lying around in the basement for decades and then just play it. Try this with your ¡Phone!) And that audio decoding is exactly what HXTape is doing.
So, to test this interface, I connected speakers to the HX-20’s “MIC” port, wrote a “Hello World!” BASIC program, issued
SAVE “CAS1:TEST”
on the HX-20, and—lo and behold!—I could hear those “noisy sounds” again after decades!
My next step was to try to plug an ordinary external microphone into my (shiny new) Lenovo ThinkPad P50 which only has one of those 4-pole microphone/headphones combo jacks. I had purchased a Y-splitter cable to be able to use the mono input. After more than one hour I gave up: It’s simply not possible to use a microphone that way. A USB soundcard would have worked, but our 12-year-old notebook jumped to the rescue, which still had a standalone microphone input.
HXTape is written in PHP, but you cannot simply run it on Windows, as it uses GNU/Linux’s Open Sound System (OSS). And herein lies the next stumbling block: OSS has been abandoned from modern Linux distributions some years ago (in favor of ALSA), and HXTape’s expected interface /dev/dsp simply doesn’t show up anymore. However, installing the package oss-compat provides you with some workaround tools, especially with the binary padsp which you can use as a wrapper to emulate a /dev/dsp device to the executed script. In addition, the PHP syntax used in the HXTape files is quite sloppy, you either have to configure your PHP’s config.ini correspondingly or edit the files directly, as I did: Put the constants’ names in the define() calls into single quotes and define some variables before their first use.
Finally, emulating the sound device and having the PHP scripts running, I attempted my first data transfer, but the script failed terribly by randomly repeating messages like “Start tape!”, “Volume too high!”, “Volume too low!” in arbitrary order several times. The solution was to simply --reverse the wave form! So, a successful sequence was something like
Read in a program from the micro cassette on the HX-20:
LOAD
On the Linux system, start the “listener”:
padsp ./hxload.php --format=file --reverse myprog
On the HX-20:
SAVE “CAS1:MYPROG”
Break the PHP script with Ctrl+C after the message “End of file”
Convert the captured binary data into BASIC code using
./hxbasic.php MYPROG MYPROG.BAS
Happily browse through MYPROG.BAS with a text editor on the PC
Sadly, it won’t be possible for me to actually run some of those programs on the PC, unless there’s an emulator that knows how to handle specific commands like LPRINT for the built-in line printer or WIND for winding the micro cassette tape to a certain position. There was something like a “launcher program” at the beginning of each of the tape’s sides, which showed a “table of contents” and provided a way to load a certain program from a certain tape position. An address book program seemed to store contact addresses onto another tape position. My stepdad, a pediatrician, used that machine productively in 1984 and later. E.g., he had a program that calculated dates for a vaccination plan using a child’s birth date, had the result printed onto the paper roll, ripped it off and handed it out to parents. That’s what it was like!
I could capture almost all of the micro cassette, but then the HX-20 started to crash more and more often, showing garbage on the screen even after a hard reset. In addition, the LCD contrast has become quite low due to fading components impeding its voltage supply. I’ll try once again, but I’m afraid even more retries are becoming pointless.
Anyway, for me, that was a quite interesting visit to the digital past, and an exciting case of computer archaeology!
Thanks for this article! I’m still trying to figure out how to get hxsave.php to work. I want to encode some BASIC games from http://www.geocities.ws/abcmcfarren/hx20/hx20.htm . I think I have to refresh my PHP knowledge a little bit
I’ve managed (with a lot of help from original writer of HXtape), to get this process working under Windows, so I can now convert my HX progs into text, edit/print/etc, then convert back to WAV. Great help. Fiddly process, but manageable.
Geoff