TTYHAN: Five-Level Teletype Driver for APEX


In 1975, a group of microcomputer enthusiasts using the 6502 microprocessor in Denver Colorado formed the 6502 Group. They developed a lot of software including the Apex operating system.

Around 1980 Tommy Billings designed the TLB computer, which was 6502-based and could run Apex. Jim Phillips built one. Apex normally used the ASCII character set, but Jim didn't have an ASCII printer. He did have an old Teletype Model 28, which used the five-level Teletype character code (commonly but incorrectly referred to as Baudot). He wired a relay to automatically spin up the motor when activity on the 20 mA current loop was detected, and wrote a simple Apex device driver for it.

Around 1981, I wrote TTYHAN, a fancier Apex driver for the Model 28. It had to do code conversion from ASCII to five-level. The five-level code divides the character set into letters and figures. There are shift codes to switch between the two, so TTYHAN had to keep track of the shift state. ASCII has over a dozen printable characters not available in the five-level code; TTYHAN translated those as digraphs. A newer version, NTTYHAN, used overstrikes instead, so that they are visually distinct from sequences of normal five-level printable characters.

NTTYHAN overstrike
(with slash)
code (hexadecimal) graphic name graphic name
40 @ at sign AT A
5B [ left bracket LB ( left parenthesis
5C \ back slash BS B
5D ] right bracket RB ) right parenthesis
5E ^ caret or up arrow UA U
5F _ underscore or left (back) arrow BA . period
25 % percent PC : colon
2A * asterisk or star ST & ampersand
2B + plus PL - hyphen, dash, or minus
3C < less than LT L
3D = equal EQ E
3E > greater than GT G

TTYHAN and NTTYHAN converted lower case ASCII to upper case, and did not handle the printable ASCII characters with hexadecimal codes 60 or 7B through 7F, instead treating them as if they were codes 40 or 5A through 5F.


TTYHAN is in the public domain. This is the earliest program I've written for which I have machine-readable source code. Jim Philips saved two versions of the code, which are available here:


A history and description of the Baudot, ITU ITA2, and U.S. five-level teleprinter codes may be found on Tom Jennings' excellent Annotated history of character codes page.

Tom Jennings also has developed a PIC-based ASCII-to-five-level interface, the WPS Model 02 Teletype Translator. He has made the source code available on his Project PIC source code page.

The COMWEB Museum has a Teletype Model 28 page with photographs and brochures.

Last updated May 27, 2015

Copyright 2004, 2015 Eric Smith

Best Viewed With Any Browser Valid HTML 4.01! Valid CSS!

check now

check now