[TUHS] x/y/zmodem on Unix

Dan Cross crossd at gmail.com
Tue Sep 19 09:07:25 AEST 2023


On Mon, Sep 18, 2023 at 6:31 PM Paul Ruizendaal <pnr at planet.nl> wrote:
> Last december Matt brought up xmodem and recently I needed it for an almost identical use case. Studied it a bit and in the context of Unix, it is an interesting piece of software history.
>
> Although xmodem originated on CP/M in 1977, it seems to have arrived on Unix soon thereafter. The first Unix implementation seems to have gone by the name of “rbsb” and must have originated when V7 was prevalent: it uses alarm() to simulate non-blocking I/O. Over the course of the 80’s ymodem and zmodem were added and the package became lrzsz; the source continued to have a very V7-ish feel to it at least to the early 90’s. In the mid-90’s it was converted to ansi-C and had some other modernization, but it looks like it would still have run on SysIII (apart from the ansi).The last update to the upstream source package appears to be from 1998, i.e. 25 years ago.
>
> It is still packaged today for FreeBSD and major Linux distros. On Unix it must be one the oldest code bases still in regular use, with the 1980 source still recognizable in its current incarnation. Any other contenders come to mind?
>
> I had always associated x/y/zmodem with CP/M and MSDOS, not so much with Unix. Last December Clem already pointed out that it was popular for file exchange in the Unix scene as well, along with several other similar tools. Also, the ymodem approach to file metadata is very unix oriented, suggesting it originated on Unix or at least that Unix users were an important user demographic. Yet, I could find little trace of x/y/zmodem in the TUHS Unix Tree. The search tool finds it in 2.11BSD, in Minix 1.5 and 2.0 and in V10. Kermit is in those as well, and in 4.3BSD and 4.4BSD on top.
>
> Maybe these programs were commonly pulled from a bulletin board and hence not on distribution media. Not sure how that would be bootstrapped, although the 2.11BSD files for x/y/zmodem include “minirb.c”, a 175 line implementation to receive files using the ymodem protocol. It is possible that this was transferred as plain text as a first step, or even retyped.
>
> Any recollections?

xmodem was an outgrowth of Christensen's MODEM.ASM for CP/M, and is
almost criminally simple: a small block of data coupled with a little
bit of header information, wait for an acknowledgement, and repeat.
Metadata was small (a start byte, a block number, inverse block
number, and a single checksum byte), but there was no total byte
count, so it was assumed that the final block would be padded with a
throwaway character.

Chuck Forsberg did YMODEM and ZMODEM; YMODEM is sort of a
super-XMODEM: it adds a 16-bit CRC, increases the block size, and adds
a "0 block" with some metadata (total file size and file name); thus,
it no longer needed a padding byte removed from the final packet.
Otherwise, it retains most of the overall structure of XMODEM.

ZMODEM was, as I understood it, designed for transfers across telenet,
which was pretty reliable; instead of the highly synchronous
send/wait-for-ack cycle of xmodem and ymodem, zmodem relies on error
detection and correction and is basically a streaming protocol: a
packet in a sliding window could be NAK'ed, thus rewinding the
transfer, but otherwise it basically just sends data until done.

lrzsz came kind of later; I remember Forsberg's rzsz package on Unix
back in the day, and then there was a GNU reimplementation. For a
while, the Omen Technologies BBS was listed in the BSD phone numbers
files.

xmodem lives on in a lot of embedded applications because of its
overall simplicity. We used it to bootstrap kernels onto Oxide
computers, for example, while we were doing active development.

        - Dan C.


More information about the TUHS mailing list