Getting data out of an old computer often means reaching for (or making up) a serial cable. Here’s an example, transferring files from a Tatung Einstein to a Windows 10 computer using a USB to Serial adapter and a custom cable. Most of the details apply to other computers making it possible to swap files between retro and new machines relatively easily.
Connecting Over Serial
The RS-232 Standard (literally, the Recommended Standard number 232) was defined in 1960, a couple of decades before home computers really took off. That meant that by the time hobbyist computers started arriving often in completely incompatible forms, there was at least a common agreed method to send data between them. Of course that doesn’t mean there weren’t alternatives and some dead-end experiments, but a “Serial Interface” became a staple - either built into a machine, or as a later add-on, and RS-232 was supported in one form or another by even the most obscure home computers.
By today’s standards, RS-232 is slow, inefficient and uses bulky connectors. Microsoft officially deprecated support for it a little over twenty years ago (at the same time as introducing purple and green PS/2 connectors, themselves now consigned to history). The ubiquitous nine pin D connector may have vanished from the side of your laptop, replaced by a faster USB socket, but happily adaptors are readily available and Windows still supports serial communications with minimal fuss.
Here’s an example of connecting a classic retro computer, the Tatung Einstein to a PC to transfer files.
Building a Cable
The Einstein has an RS-232 port built in and supported by the later versions of it’s operating system. So far so good. Unfortunately, the designers of the machine decided to use a circular 5 pin DIN socket to make the connection, which is far from standard. It’s therefore necessary, but not difficult to make up a custom cable to connect to a PC. Perhaps the biggest challenge is to find a compatible plug. Happily though, Ebay offers Deltron 5 Pin Domino DIN Plugs at a reasonable price, and these can also be found in various online electronic retailers.
The Female 9 pin D-type socket is readily available, and a short length of multicore cable (at least five wires) is enough to make up the connector.
The key information about RS-232 is that you must connect a minimum of three wires between computers for them to be able to communicate back and forth. These are identified as GROUND, Tx (Transmit) and Rx (Receieve). This is enough for many machines to negotiate a connection, but it’s common to use an additional two wires to allow the hardware to synchronise messages (known as hardware flow control). The additional connections are usually marked RTS (Request To Send) and CTS (Clear To Send). Most machines support a five wire link and this allows half-duplex (one direction at a time) communication.
This is the case for the Einstein. However, we must take care which signals are connected on each side of the cable. Whilst we connect the two ground pins on each plug, we must swap the Tx and Rx signals, and also swap the CTS and RTS signals. Why is this? Well, if you think that the transmitting computer needs to be connected to a receiving device, it makes sense that we connect Tx (transmit) on one side to Rx (receive) on the other and vice versa. Similarly, the CTS and RTS signals indicate that one side is requesting permission to send and the other indicates that they are clear to do so.
The wiring diagram looks like this:
And here’s the cable:
Plugging In
Once we’ve made up a cable, the next job is to find something to plug it into. The Einstein socket is unfortunately completely symmetrical, so it’s necessary to make sure it is plugged in the right way round of the two possible orientations. Marking the plug, or using a convention that the screw on the plug always faces the rear of the machine ensures that it is put in the right way round.
On a modern PC though, we won’t find the needed 9 pin male serial socket so we need to find a USB to Serial adaptor. These are readily available on Amazon and other retailers - search for a USB to Serial RS232 Adapter, checking that it is compatible with your operating system. These are usually based on the Prolific PL-2303 chipset, which is widely supported, so it’s worth checking that the PL-2303 is mentioned in the product spec.
When this is plugged into a Windows PC, after a driver is installed, the serial link should appear as a COM port. If you search for the Device Manager and open it in Windows, you should see a Ports (COM and LPT) entry, which can be expanded to show what devices the operating system has found, and more importantly what port number they are on. In this case, Windows has found the serial adapter and has identified it as COM8
Now, we’re ready to communicate!
Setting Expectations
Unlike USB which negotiates the best way to exchange data, RS-232 requires that the machines at either end of the cable are correctly configured. If this is not the case, data will come through garbled or not at all.
The Einstein requires a mildly obscure command to change it’s default serial settings, so it’s easier to configure things at the receiving end. The four key settings are the Baud rate (speed of communication), Data bits (size of each piece of data), Parity (error checking) and Stop Bits (marking the end of each piece data). The Einstein defaults to 9600 8N2 (that is 9600 baud, 8 data bits, No parity, 2 stop bits). If we are planning to exchange binary data, eight bits are required - however it’s possible to exchange pure text files with a seven bit link.
To load text files from the older machine, Putty is a useful tool, which
has a simple user interface. For binary files, RealTerm
is available for Windows PC, or a short Python program can be written to receive data. In principle on Windows it should be possible to
use the MODE
and COPY
commands to exchange files without installing any additional software, but in practice I found that the command
line options did not work when receiving from serial devices.
Copying a File
Using Putty is fairly straightforward. Select the ‘Serial’ configuration page and set the values for your machine. Note that a minimal set up will use no flow control. A five wire cable like the one I made for the Einstein uses Hardware flow control (RTS/CTS). If you have a more advanced file transfer package on both the sending and receiving machines, you may be able to use software flow control (XON/XOFF) - but this is often harder to find with retro computers.
Make sure the ‘Serial’ connection is selected on the main Putty Connect tab and clicking Open
creates a new blank terminal ready to receive
data. On the Einstein, a text file can be sent with the COPY
command, for instance, to send a file called FILE.TXT
you enter:
COPY FILE.TXT TO SRL:
The file will appear in the Putty terminal and can be copied into a local file on your PC. This is fine for short text files, but for longer
files and binary data, a better alternative is RealTerm.
This provides a Capture
facility that saves any incoming data to a file, and will preserve binary values. Note however that the computer
sending the data must also handle binary data correctly. In the case of the Einstein, this involves using the <O>
flag on the COPY
command
to indicate that files should be sent intact:
COPY FILE.BIN TO SRL:<O>
The only problem then is that the Einstein does not then recognise the end of the file and will continue to send ‘blank’ bytes until stopped
with CTRL-BREAK
. For this case, RealTerm allows a ‘maximum byte count’ to be set on capturing data.
Python Serial
Alternatively, if you have Python installed a fairly short program can be used to configure the serial port and receive binary or text data.
The code below can be saved as reader.py
and then invoked with python reader.py output.bin
to save incoming binary data to a file
called output.bin
:
import serial
import sys
# Configure serial port here. Last parameter is timeout to stop reading data, in seconds:
s = serial.Serial('COM8', 9600, serial.EIGHTBITS, serial.PARITY_NONE, serial.STOPBITS_TWO, 10)
name = sys.argv[1] if len(sys.argv) > 1 else 'output.file'
print("Writing to file: ", name)
f = open(name, 'wb')
print("Reading")
count = 0
while True:
res = s.read()
if len(res)==0:
break
count += len(res)
if count % 256 == 0:
sys.stdout.write(".")
sys.stdout.flush()
f.write(res)
f.close()
print("\nTransfer ended, bytes read: ", count)
As with Putty and RealTerm, the software must be started before any data is sent to the PC. This code has a timeout of ten seconds, so it will
save all data it receieves, stopping once it hasn’t been sent any more data for ten seconds. The timeout and the specific port configuration can
be altered by editing the line starting s = serial.Serial(...
in the reader.py
file.
Many Options
The options above helped me to transfer files that had lain dormant on floppy disks for decades to a modern machine that has never even seen a floppy drive. Whilst other computers may need different combinations of cables, software or commands, the ubiquity of RS-232 means that it is highly likely that you can use similar methods to retrieve old files, or send data to obscure computers. A little bit of searching will usually uncover the pinout diagrams for serial sockets and the specification for configuring the link. Making up a cable is a soldering job that a beginner can tackle, and in many cases it’s possible to find a ready-made cable to do the job.
Let me know if you have any great successes, or find particular tricks for retreiving data from specific computers. If there is sufficient interest there may be a follow up article on serial links for other systems.