Local Area Networking on RS-232

The first microcomputers based on Intel’s 8080 and later on much better Zilog’s Z80 appeared in late 1970s and early 1980s – TRS-80 never really caught on, but Sinclair Spectrum was a great success.

However, we had a much better toy to play with in 1980s: Iskra Delta Partner with real operating system (CP/M), a floppy disk and a 10MB hard disk, and of course we tried to do all sorts of crazy stuff on those machines.

Iskra_Delta_Partner_2007.jpg
Iskra Delta Partner (Source: Wikimedia Commons)
One of my first real programming jobs was writing a backup/restore software that would allow Partner users to back up the hard disk contents to a bunch of floppies. CP/M had nothing along those lines, and PKZIP (which could do the same trick while compressing the data) was introduced years later.

Jure Špiler, my then-boss, realized you could do something really crazy: by coupling the transmit and receive pins of multiple RS-232 ports via a diode you get a (somewhat reliable) bus that allows you to transmit data from one minicomputer to everyone connected to the same bus. My challenge: build a LAN out of that.

Multidrop kludge: turning RS-232 into a shared bus
You might have noticed that the hardware we used was a nasty hack – the shared bus was floating around 0V when nobody was transmitting or when someone was transmitting a zero (which would be -12V on a regular RS-232 connection), so it was extremely prone to electromagnetic noise. We should have used proper multidrop hardware, but it was neigh impossible to get custom hardware into that computer (it had no expansion slots), and I was in the early days of my MacGyver phase anyway.

In those days, we haven’t even heard of Ethernet (yet) so I reinvented the wheel, designed my own collision avoidance scheme on RS-232, created simple packet headers using one-byte host addresses (who would ever need more than 250 hosts anyway), and implemented a file system redirector on top of that.

The whole thing was exceedingly simple:

  • My software intercepted CP/M system calls (easy, all system calls went through the same entry point);
  • You could create logical disks that would point to physical disks on other computers (extra system call);
  • Whenever a file system operation referred to a logical disk (or a file opened on that logical disk) my software simply packaged the parameters of the system call in a packet and sent the packet to remote host where the call was executed.

There was even a basic file locking scheme: the same file could not be opened by more than one user to prevent file corruption (unfortunately I never got to proper file sharing). Mission accomplished.

Well, not really. Z80 had 64K of memory and whatever operating system extension you loaded reduced the memory that could be used by regular programs. Fortunately, the Partner computer had (almost) 128K of memory organized in two banks with shared memory at the top of the address space. The second bank was used solely for disk buffers, so I decided to reduce the buffer size and use the extra memory.

Using both memory banks on an Iskra Delta Partner microcomputer

After a lot of tweaking (and nasty crashes) I finally managed to install my networking code into the second bank, reducing the code running in shared address space to less than 1K.

The “only” limitation of the solution remained the very low speed. We could clock the RS-232 ports at 38 kbps; anything beyond that didn’t work reliably. A few years later, when this underground project finally got some recognition within the company, someone designed much better hardware that used Z80 SIO with RS-422 interface and got speeds around 200 kbps.

Another slight limitation was the instability of the solution: if the remote node crashed, you lost your data… and as CP/M wasn’t a multi-user operating system, there were always a few race conditions that could help the system to crash.

You can't leave comments on this web site, but you can add them to this blog post.