A USB Loader for the Cidco MailStation

posted on mar 31st, 2020 with tags hardware, mailstation, and z80

Last year I wrote about the Cidco MailStation and how I was using it as a Z80 development platform. One of the biggest hurdles to running code on them is that it must be uploaded over the MailStation’s parallel port with a LapLink cable and some custom software (although it’s certainly easier than having to pull and flash a chip).

I recently created a USB data loader device that allows for easier development from a modern computer and implements the MailStation’s custom data encoding routines in its firmware.

Parallel Interfaces

While USB-to-serial adapters are easily found and widely supported, there are hardly any analogs for parallel ports. There are USB printer adapters but these work by implementing specific printing functionality through a USB driver rather than exposing each of the pins to the operating system.

Connecting to the MailStation also requires a LapLink cable with its custom pinout, similar to a null-modem adapter for a serial port.

Since none of my modern computers have legacy parallel ports, I’ve had to rely on an older computer to act as a hardware proxy, listening on the network for code uploads and then sending it over its parallel port. I started with an HP Omnibook 800CT and then a ThinkPad X61 in an UltraBase dock.

Later I acquired a Thunderbolt PCI card enclosure and installed a PCI parallel port card in it:

This was all such a hassle and I heard from other people interested in MailStation development that it was hard to find LapLink cables and computers with parallel ports.

Teensy

I recently purchased a Teensy 3.2 which is a small 32-bit ARM board with a bunch of I/O pins. The Teensy is Arduino-compatible which makes it easy to write code for and interface with.

Normally the LapLink cable between the MailStation and a computer only connects five data pins for output and five for input, so I mapped out ten wires between the Teensy and a DB25 breakout board connected to the back of the MailStation.

For reference, the pinout (which is arbitrary on the Teensy side) is:

Teensy MailStation/DB25
Pin 1 Pin 2 (Data 0)
Pin 2 Pin 3 (Data 1)
Pin 3 Pin 4 (Data 2)
Pin 4 Pin 5 (Data 3)
Pin 5 Pin 6 (Data 4)
Pin 7 Pin 10 (Ack)
Pin 8 Pin 11 (Busy)
Pin 9 Pin 12 (Paper Out)
Pin 10 Pin 13 (Select)
Pin 11 Pin 15 (Error)
GND Pin 25 (Ground)

Once everything was connected, I wrote some firmware to get it sending and receiving data over those pins using the MailStation’s proprietary data-transfer routines. Since there are only five data pins to work with, a single byte is split up into three chunks and reassembled on the receiving side.

Serial-to-Parallel

Using the Teensy’s USB libraries, I enabled its serial port mode which makes it appear to the computer as a USB serial port:

umodem0 at uhub0 port 4 configuration 1 interface 0 "jcs Mailstation Loader" rev 1.10/2.75 addr 9
ucom0 at umodem0

Now any software can open the serial device (/dev/ttyU0 on OpenBSD) and just write bytes to it. Each byte is received by the Teensy firmware and then split up into three chunks and sent over its pseudo-parallel interface to the MailStation. This way the sender doesn’t have to be concerned with any data transfer routines or do expensive polling over USB.

The firmware code for my Teensy loader can be downloaded on GitHub along with a compiled version for uploading with teensyloader.

I’m no good with PCB design, but it would be awesome if someone could design a custom board that integrates the Teensy with a DB25 interface to do all of this without any external wires.