Understanding ASCII Codes

Text by Robert McConnell, James Haynes, & Richard Warren

Original Source Douglas W. Jones http://www.cs.uiowa.edu/~jones/

To understand the original intent of the ASCII control codes, you have to think of teletypes, using paper tape, configured in a multidrop system with relay logic used to turn on or off individual teletypes in the bunch, and you have to remember that the designers were pretty smart and they anticipated future developments, but they also managed to include provisions for things that never happened. Here are the ASCII control characters, and a few others, with comments on how they were supposed to be used and how this relates to current popular uses:

The ASCII code system and the 33’s and 35’s were designed to be a computer interface, in addition to being a teletype code and function, and that only about 1/3rd of the possible ASCII codes had been used in the model 33’s and 35’s! Therefor, the “Escape” key was put there to “escape” from teletype communications functions and enter into computer functions as computer engineers might want to come up with.

The Control D disconnect function was put on these machines for a reason. Pushing the “end” or “disconnect” button on a TWX only had the function of killing the outgoing data set (modem) tones which either the TWX or telephone systems, whichever they were used on, would recognize as a carrier loss, a malfunction, and cause a disconnect. However this type of a disconnect took a couple or three seconds, and couldn’t be put intro the tape nor set up as a pre set code. The Control D function set up a disconnect code function both in the tape and simultaneously set up machine functions at each end to initiate the machine’s disconnect simultaneously from each end, which was instantious. This speeded up the communications process.

The ENQ was the same as a WRU key, which meant “Who Are you”, which sent an interrogation signal to the distant end which triggered it’s “Answer back” (“music box?) system which identified the terminal at the distant end. Contrary to the operator setting up this coding, this was a technician function as the operator wasn’t trained in this matter, didn’t have the ASCII code, lacked the “drum” where the code was programmed, and the operator setting this up would risk voiding the maintenance contract with the customer! This “Answer Back” enabled “proof” that a message had actually been received at the unattended distant end by exchanging “answer backs” at both the beginning and end of the message, assuming that it had sufficient paper to do the job, and that it’s “paper out” compacts were working to kill the incoming call if the paper ran out.

Control Z was a “End of File” indicator as is still used at the end of computer programs, etc. This and NNNN (4 N’s) was also an International signal that disconnected the call and turned off the radios used to convey the message in International radio message traffic. This is (or was) necessary with RCA, ITT, WUI, MacKay Radio to ships at sea, etc..

NAME HEX/CTL USE
NULL 00 ^A Always ignored-leader and trailer on paper tape systems was typically made of sequences of NULLs.
SOH 01 ^A Srart of heading-imagine a heading containing, fore xample, the address of the recipient. You could have relay logic that scans for SOH, then enables the print mechanism if the following character matches this station’s address. In early documentation, this was called start of message.
STX 02 ^B Start of text-if the heading matched, start printing with the following character. In early documentation, this was called end of address.
ETX 03 ^C Enof text-now is a good time to stop printing. Your message might continue after this with a checksum or other administrative stuff. In early documentation, this was called end of message. The common use of control C as a kill character stems from this-it indicates the end of your text addressed to some application.
EOT 04 ^D End of transmission-relay logic could decode this and, if there is a tape in the tape reader, it could begin transmitting its own message.
ENQ 05 ^E 05 ^E Enquire-on receiving this, local relay logic would generate a response. In early documentation, this was called WRU or who are you. Teletypes had programmable response sequences that were encoded on a music box mechanism, and it was up to the customer to break plastic fingers off the drum to code how it responded to an ENQ.
ACK 06 ^F Acknowledge-one possible response to ENQ. In early documentation, this was called RU or are you.
BEL 07 ^G Bell-ring the bell in the terminal. Teletypes had real bells where most modern terminals have beepers of some kind. A sequence of BEL characters sent to a teletype sounded very much like a telephone ringing.
BS 08 ^H Backspace
HT 09 ^I Horizontal Tab
LF 0A ^J Linefeed
VT B ^K vertical tab
FF 0C ^L Formfeed-page eject
CR 0D ^M carrage return-on many mechanical devices, CR was slow. The sequence CR LF was always sent in that order so that the linefeed could be handled while the carriage was returning; a well adjusted Teletype could just finish the CR in this time (0.2 seconds), and a common sign that it was time to call the service man was that the first letter printed after a CR LF was printed “on the fly” on the way back to the margin.
SO 0E ^N Shift out-if you’ve got a two-color ribbon, shift to the alternate color, usually red. There are obvious extensions of this to alternate character sets.
SI 0F ^O shift in-undo whatever SO does. For mysterious reasons that have no apparent connection to old or modern ASCII standards, DEC liked to use control O as a break character to suppress teletype output.
DLE 10 ^P data link escape-an escape character is generally a prefix for something else. DLE was expected to be used as a prefix on characters in the user data stream that might otherwise be interpreted as data link control characters, for example, flow control characters. In some early documentation, this was called DC0 or device control zero.
DC 11 ^Q Device control 1 — turn on the paper tape reader. In early documentation, this was called XON.
DC2 12 ^R Device control 2 — turn on the paper tape punch.
DC3 13 ^S Device control 3 — turn off the paper tape reader. In early documentation, this was called XOFF, The use of XON/XOFF (DC1/DC3) for flow control stems from their use to control the flow of data from the paper tape reader attached to a Teletype.
DC4 14 ^T Device control 4 — turn off the paper tape punch.
NAK 15 ^U Negative acknowledge-another possible response to ENQ. One flow control mechanism is to use ENQ to ask if the receiver has buffer space, and require the receiver to respond with either ACK (yes) or NAK (no). ENQ could also be used to inquire about whether a retransmission is required after sending a checksum. The popular use of control U to delete the current input line is only vaguely grounded in this definition.
SYN 16 ^V Synchronous idle-if you’re using a synchronous transmission protocol, and you have no data to send, you send SYN characters to keep the clocks synchronized. The receiver should ignore these, and the transmitter may have to insert them into the data stream once in a while.
ETB 17 ^W End of transmission block-used when a transmission must be broken into many blocks for some reason, for example, to place a checksum after each block. Early documentation called this logical end of media.
CAN 18 ^X Cancel-take that back, what I just sent you is a mistake, ignore it.
EM 19 ^Y End of medium-there’s nothing left on this reel of (paper) tape.
SUB 1A ^Z Substitute-the next character is from an alternate character set. SUB X might be equivalent to SO X SI, or it might be an alternate mechanism for extending the character set. The common use of control Z as an end of file character has no obvious relation to the standard.
ESC 1B ^[ Escape-the next character is to be interpreted as something other than text, for example, it might be an extended control character of some kind.
FS C ^\ File separator-useful if you have multiple logical files in one transmission.
GS 1D ^] Group separator-useful if files are made of groups of records.
RS 1E ^^ Record separator-COBOL anyone?
US 1F ^_ Unit separator-are records made of units?
ALT 7D } Some early teletypes had an ALT MODE key that generated this code instead of ESC. This was interpreted as an escape code, which was no problem when nobody had lower case printers, but with the advent of full 96 character ASCII, there were obvious compatability problems.
PRE 7E ~ A few terminals had a PREFIX key that generated this code instead of ALT MODE, with all the same problems.
DEL 7F Delete-remember, paper tape uses a hole to record each one and no hole to record each zero. DEL is all holes, so it can be punched over any other character to rub it out (on old teletypes, it was the RUB or RUB OUT key). If you mispunch a character, just back up the tape and overpunch it with a DEL. Software is expected to ignore DEL the same way it ignores NULL.

I think one reason the computer people messed things up so badly (e.g. using ctrl-D for end of file when there is already a file separator assigned) is that the early Model 33 machines couldn’t generate all the characters. Also they didn’t like to use a three-finger combination (e.g. shift-control-X) for frequently used functions. Then the article doesn’t make a clear distinction between 1961 ASCII and 1968 ASCII. Some things like the RU answer-back present in 1961 ASCII were recognized as bad ideas by the time ASCII was revised. And some things were just never well agreed upon, so the characters were just left in there. CAN for example: does it cancel the previous character, or the previous message, or the previous line, or what?

Backspace has always been a problem. In hard-copy terminals there was the concept of backspace and strike over as a way to get some odd characters such as the Nordic o with a slash through it, or German u with an umlaut over it. But on video terminals backspacing simply moved the cursor backwards; and if you then typed another character it replaced the previous one rather than adding to the pixels that were already there.

We really needed an equivalent of the backspace-and-erase key on teletypewriters, a separate character from backspace. The choice of DEL for this purpose is of course completely wrong and resulted from some computer people who had no concept of backspacing and rubbing out paper tape.

Submitted by James Haynes:

R. W. Bemer, “The American Standard Code for Information Interchange”, DATAMATION, August 1963 p. 32 and September 1963 p. 39.

R. W. Bemer, “A View of the History of the ISO Character Code”, Honeywell Computer Journal, 1972, p. 274.

J. F. Auwaerter, “A New Standard Code for Teletypewriters”, Bell Laboratories Record, date unknown.

Fred W. Smith, “New American Standard Code for Information Interchange”, Western Union Technical Review, April 1964, p. 50.

Fred W. Smith, “Revised U.S.A. Standard Code for Information Interchange”, Western Union Technical Review, November 1967, p. 184.

Other Photos…

This entry was posted in Papers and Writings and tagged . Bookmark the permalink.

3 Responses to Understanding ASCII Codes

  1. I’m no? not sur? wh?re you’r? gett?ng your info, ?owever ?ood topic.
    I muszt spend ?ome time learning mo?e or understanding
    mor?. T?ank you for excllent info ? used to be searching f?r this inf?rmation f?r my mission.

  2. It’s a pity you don’t have a donate button! I’d certainly donate to this
    superb blog! I guess for now i’ll settle for
    book-marking and adding your RSS feed to my Google account.
    I look forward to new updates and will share this site with my Facebook group.
    Chat soon!

  3. I am actually gla? to read this b?og posts ?hi?h contains tons of valuable data, thanks for providing such information.

Leave a Reply

Your email address will not be published.