Tim Mann's TRS-80 Pages

 Business card from 1981



Prehistory of BinHex


Sometimes one leaves footprints in odd places on the sands of time. For instance, the BinHex format often used for transferring Macintosh files is a distant descendant of a Basic program I wrote for the TRS-80 in 1981! The current format and the current implementations bear no resemblance to the original program, but the name has remained. Here's what I know of the story. It's of no importance, but it's fun to tell.

Way back in the early 80's, microcomputer users needed some way to transfer 8-bit binary files through channels that were set up to deal only with ASCII text. Dialup channels to mainframes (including CompuServe in those early days) often could accept only seven bits per character, and they sometimes trapped and mangled certain control characters as well. A popular TRS-80 terminal package of the time, ST80-III by Lance Micklus, worked around this problem by providing two simple programs called HEX/CMD and BIN/CMD. HEX would convert any file to hexadecimal, expanding each original byte to two hex characters and adding a newline after every 60 characters. BIN would convert a hex file back to binary.

Not everyone had a copy of ST80-III, so I wrote a quickie Microsoft Basic program called BINHEX/BAS that dealt in the same format. We published this program in the LDOS Quarterly several times, so that people could type in small hex files from the Quarterly and convert them to executable binaries. We also uploaded it to the LDOS forum on CompuServe, and people there used it to upload and download files in hex format until CompuServe began supporting 8-bit binary files.

Once the program was on CompuServe, it gained a life of its own. Soon some anonymous person added a checksum feature. Later Bill Stockwell did a syntax translation for his BASIC/S compiler, compiled it, and uploaded an executable that ran much faster than the interpreted version. The executable itself was uploaded in hex format, so one needed to de-hexify it with the interpreted version to get started. Somewhere along the line BINHEX spread to Apple users and perhaps others. I was vaguely aware of this at the time, but I really didn't know or care what was happening with it.

A few years later, in 1984, the Macintosh was released. Suddenly the long-forgotten BINHEX popped back into my consciousness when I saw this message on the INFO-MAC mailing list. I didn't normally read that list, not being a Mac owner, so I don't remember how I happened to find the message. Take a look at the Basic program it contains. The vast bulk of this version of BinHex is new code, but there are a few clear signs of descent from the original. Note the wording of the comment in the first line, the functions FND1 and FND2, and the stone age user interface (enter 1 for binary to hex, 2 for hex to binary). My name has disappeared from the credits, but even at the time I didn't resent that a bit!

The path beyond that point was largely unknown to me until recently; thanks to Yves Lempereur for providing more information. To summarize, the Mac Basic program went through several revisions during 1984, culminating in BinHex 3.0. Yves then took over and rewrote the program in 68000 assembly language for greatly increased speed, producing BinHex 1.0. He followed up with BinHex 2.0 (introducing the .hcx format), BinHex 4.0 (introducing the .hqx format), and BinHex 5.0 (introducing the MacBinary format). These later formats encoded 6 bits per byte, so they were no longer "hex" at all. Coincidentally, Yves has also written a TRS-80 emulator for the Mac.

So the format is now quite different, and the new converter programs share no code with the original; nothing is left of my poor little TRS-80 program. Yet its name lives on: my one tiny mark on the world of the Macintosh!


Return to top | My home page | My work