Douglas Crockford

About

Books

Videos

2019 Appearances

Blog

JSLint

JSON

Github

How JavaScript Works

ASCII

The American Standard Code for Information Interchange was developed in the 1960s for use in teletype machines and similar devices. It also anticipated use by computers, although computer networking at the time was still largely theoretical. It was not intended to be used as an internal computer character set, but it became the standard character set, partly due to the influence of UNIX. It still exists today as the first 128 code points of Unicode.

hex 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 nul soh stx etx eot enq ack bel bs tab lf vt ff cr so si
1 dle dc1 dc2 dc3 dc4 nak syn etb can em sub esc fs gs rs us
2   ! " # $ % & ' ( ) * + , - . /
3 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
4 @ A B C D E F G H I J K L M N O
5 P Q R S T U V W X Y Z [ \ ] ^ _
6 ` a b c d e f g h i j k l m n o
7 p q r s t u v w x y z { | } ~ del

The first 32 characters and the last character are control codes. Each control code has a very specific function.

Paper Tape:

nul
null. ASCII was designed specifically for use with punched paper tape. Each row contains one character. A hole in the tape represented a 1 bit. A row with no punches was empty tape, or leader. A row with no punches was considered null and should be ignored by the receiver.
del
delete. To delete a character on a tape, punch out all of the holes in the row. A character containing only 1 bits should be ignored by the receiver.
dc1
device control one. Turn the paper tape reader on.
dc2
device control two. Turn the paper tape puncher on.
dc3
device control three. Turn the paper tape reader off.
dc4
device control four. Turn the paper tape puncher off.

Format Effectors:

bs
backspace. Move the print head back one space. This was not a deletion. Deletion is done on the paper tape with del.
tab
tabulation. Advance to the next tabstop. ASCII did not provide a way to define tabstops, nor did it define a default tab spacing. We still do not have an international tabstop standard. tab was not intended to be a data separator. That was what us was for.
cr
carriage return. Move the print head to the left edge. cr and lf were usually used together.
lf
line feed. Roll the paper ahead one line.
ff
form feed. Eject the current page, advancing to the top of the next page.
vt
vertical tabulation. Roll the paper ahead to the next vertical tabstop. Again, ASCII did not provide a way to define vertical tabstops, nor did it define a default vertical spacing.

Protocol:

soh
start of heading. A message could have an optional header that could include delivery or routing information.
stx
start of text. A message starts with this character.
etx
end of text. A message ends with this character.
etb
end of tranmission block. This allowed for breaking a long message into smaller blocks that could be individually acknowledged.
ack
acknowledge. The message was received.
nak
negative acknowledge. The message was not received correctly.
eot
end of transmission.
em
end of medium. This could mark the end of a tape.
enq
enquiry. Ask the other station to identify itself. Some teletypes, on receiving this character, would automatically reply with a preprogrammed string.
bel
bell. Ring the bell to get the operator's attention.
syn
synchronous idle. In the synchronous transmission mode, the channel is given a steady stream of bits with no framing bits around the characters. The two stations synchronize a character clock, so that they agree on when it is time to start the next character. When a sender has nothing to send, it sends the syn character. The receiver can look for a pattern of syn characters for synchronization.
can
cancel. The remainder of the message will not be sent. Oops.
sub
substitute. The character that was supposed to be sent was somehow lost. Oops.

Escapement:

so
shift out. Switch to an alternate character set. Early in the design of ASCII, this was going to be used to access lower case, similar to the use of shift on keyboards. so and si were retained for accessing an alternate character set. It was sometimes used to select the ribbon color.
si
shift in.
esc
escape. esc was another way of accessing an alternate character set. One use of esc was to add an eight bit to the next character.
dle
data link escape. Do not treat the next character as a control character.

Information Separators:

us
unit separator.
rs
record separator.
gs
group separator.
fs
file separator.

Some of these codes are still reflected in modern keyboards (del bs tab esc) but now have very different meanings. The original purpose of the ctrl key was to generate these control characters