home *** CD-ROM | disk | FTP | other *** search
/ Cuteskunk BBS / cuteskunk.zip / cuteskunk / Folklore / ASCII < prev    next >
Internet Message Format  |  2003-06-29  |  8KB

  1. From: jones@pyrite.cs.uiowa.edu (Douglas W. Jones)
  2. Newsgroups: alt.folklore.computers
  3. Subject: Re: ASCII control codes
  4. Date: 31 Aug 1995 19:37:58 GMT
  5.  
  6. From article <4239uk$ko1@metro.ucc.su.OZ.AU>,
  7. by adrianw@cassius (Adrian Whichello):
  8.  
  9. > Some are obviously still used for their original purpose (CR, LF, the
  10. > tabbing codes etc.) but what did ENQ, EM, SUB, FS, etc. do? Thanks,
  11.  
  12.  - - - here's a reply I posted a year ago in June - - -
  13.  
  14.  Subject: Re: original uses of ASCII control codes
  15.  Newsgroups: alt.folklore.computers
  16.  References: <1994Jun02.064649.131411@ua1ix.ua.edu>
  17.  
  18. To understand the original intent of the ASCII control codes, you have
  19. to think of teletypes, using paper tape, configured in a multidrop
  20. system with relay logic used to turn on or off individual teletypes in
  21. the bunch, and you have to remember that the designers were pretty
  22. smart and they anticipated future developments, but they also managed
  23. to include provisions for things that never happened.  Here are the
  24. ASCII control characters, and a few others, with comments on how they
  25. were supposed to be used and how this relates to current popular uses:
  26.  
  27.   NAME    HEX/CTL    USE
  28.  
  29.   NULL    00 ^@    always ignored -- leader and trailer on paper tape
  30.         systems was typically made of sequences of NULLs.
  31.  
  32.   SOH    01 ^A    start of heading -- imagine a heading containing, for
  33.         example, the address of the recipient.  You could have
  34.         relay logic that scans for SOH, then enables the print
  35.         mechanism if the following character matches this
  36.         station's address.  In early documentation, this was
  37.         called start of message.
  38.  
  39.   STX    02 ^B    start of text -- if the heading matched, start printing
  40.         with the following character.  In early documentation,
  41.         this was called end of address.
  42.  
  43.   ETX    03 ^C    end of text -- now is a good time to stop printing.
  44.         Your message might continue after this with a checksum
  45.         or other administrative stuff.  In early documentation,
  46.         this was called end of message.  The common use of
  47.         control C as a kill character stems from this -- it
  48.         indicates the end of your text addressed to some
  49.         application.
  50.  
  51.   EOT    04 ^D    end of transmission -- relay logic could decode this
  52.         and, if there is a tape in the tape reader, it could
  53.         begin transmitting its own message.
  54.  
  55.   ENQ    05 ^E    enquire -- on receiving this, local relay logic would
  56.         generate a response.  In early documentation, this was
  57.         called WRU or who are you.  Teletypes had programmable
  58.         response sequences that were encoded on a music box
  59.         mechanism, and it was up to the customer to break
  60.         plastic fingers off the drum to code how it responded
  61.         to an ENQ.
  62.  
  63.   ACK    06 ^F    acknowledge -- one possible response to ENQ.  In early
  64.         documentation, this was called RU or are you.
  65.  
  66.   BEL    07 ^G    bell -- ring the bell in the terminal.  Teletypes had
  67.         real bells where most modern terminals have beepers of
  68.         some kind.  A sequence of BEL characters sent to a
  69.         teletype sounded very much like a telephone ringing.
  70.  
  71.   BS    08 ^H    backspace.
  72.  
  73.   HT    09 ^I    horizontal tab.
  74.  
  75.   LF    0A ^J    linefeed.
  76.  
  77.   VT    0B ^K    vertical tab.
  78.  
  79.   FF    0C ^L    formfeed -- page eject.
  80.  
  81.   CR    0D ^M    carrage return -- on many mechanical devices, CR was
  82.         slow.  The sequence CR LF was always sent in that order
  83.         so that the linefeed could be handled while the carriage
  84.         was returning; a well adjusted Teletype could just finish
  85.         the CR in this time (0.2 seconds), and a common sign that
  86.         it was time to call the service man was that the first
  87.         letter printed after a CR LF was printed "on the fly" on
  88.         the way back to the margin.
  89.  
  90.   SO    0E ^N    shift out -- if you've got a two-color ribbon, shift to
  91.         the alternate color, usually red.  There are obvious
  92.         extensions of this to alternate character sets.
  93.  
  94.   SI    0F ^O    shift in -- undo whatever SO does.  For mysterious reasons
  95.         that have no apparent connection to old or modern ASCII
  96.         standards, DEC liked to use control O as a break character
  97.         to suppress teletype output.
  98.  
  99.   DLE    10 ^P    data link escape -- an escape character is generally a
  100.         prefix for something else.  DLE was expected to be used
  101.         as a prefix on characters in the user data stream that
  102.         might otherwise be interpreted as data link control
  103.         characters, for example, flow control characters.  In
  104.         some early documentation, this was called DC0 or device
  105.         control zero.
  106.  
  107.   DC1    11 ^Q    device control 1 -- turn on the paper tape reader.
  108.         In early documentation, this was called XON.
  109.  
  110.   DC2    12 ^R    device control 2 -- turn on the paper tape punch.
  111.  
  112.   DC3    13 ^S    device control 3 -- turn off the paper tape reader.
  113.         In early documentation, this was called XOFF, The use
  114.         of XON/XOFF (DC1/DC3) for flow control stems from their
  115.         use to control the flow of data from the paper tape
  116.         reader attached to a Teletype.
  117.  
  118.   DC4    14 ^T    device control 4 -- turn off the paper tape punch.
  119.  
  120.   NAK    15 ^U    negative acknowledge -- another possible response to ENQ.
  121.         One flow control mechanism is to use ENQ to ask if the
  122.         receiver has buffer space, and require the receiver to
  123.         respond with either ACK (yes) or NAK (no).  ENQ could
  124.         also be used to enquire about whether a retransmission
  125.         is required after sending a checksum.  The popular use of
  126.         control U to delete the current input line is only vaguely
  127.         grounded in this definition.
  128.  
  129.   SYN    16 ^V    synchronous idle -- if you're using a synchronous
  130.         transmission protocol, and you have no data to send, you
  131.         send SYN characters to keep the clocks synchronized.
  132.         The receiver should ignore these, and the transmitter may
  133.         have to insert them into the data stream once in a while.
  134.  
  135.   ETB    17 ^W    end of transmission block -- used when a transmission must
  136.         be broken into many blocks for some reason, for example,
  137.         to place a checksum after each block.  Early documentation
  138.         called this logical end of media.
  139.  
  140.   CAN    18 ^X    cancel -- take that back, what I just sent you is a
  141.         mistake, ignore it.
  142.  
  143.   EM    19 ^Y    end of medium -- there's nothing left on this reel of
  144.         (paper) tape.
  145.  
  146.   SUB    1A ^Z    substitute -- the next character is from an alternate
  147.         character set.  SUB X might be equivalent to SO X SI,
  148.         or it might be an alternate mechanism for extending the
  149.         character set.  The common use of control Z as an end
  150.         of file character has no obvious relation to the standard.
  151.  
  152.   ESC    1B ^[    escape -- the next character is to be interpreted as
  153.         something other than text, for example, it might be an
  154.         extended control character of some kind.
  155.  
  156.   FS    1C ^\    file separator -- useful if you have multiple logical
  157.         files in one transmission.
  158.  
  159.   GS    1D ^]    group separator -- useful if files are made of groups
  160.         of records.
  161.  
  162.   RS    1E ^^    record separator -- COBOL anyone?
  163.  
  164.   US    1F ^_    unit separator -- are records made of units?
  165.  
  166.   ALT    7D }    Some early teletypes had an ALT MODE key that generated
  167.         this code instead of ESC.  This was interpreted as an
  168.         escape code, which was no problem when nobody had lower
  169.         case printers, but with the advent of full 96 character
  170.         ASCII, there were obvious compatability problems.
  171.  
  172.   PRE    7E ~    A few terminals had a PREFIX key that generated this code
  173.         instead of ALT MODE, with all the same problems.
  174.  
  175.   DEL    7F    delete -- remember, paper tape uses a hole to record each
  176.         one and no hole to record each zero.  DEL is all holes,
  177.         so it can be punched over any other character to rub it
  178.         out (on old teletypes, it was the RUB or RUB OUT key).
  179.         If you mispunch a character, just back up the tape and
  180.         overpunch it with a DEL.  Software is expected to ignore
  181.         DEL the same way it ignores NULL.
  182.  
  183.