ANSI, DEC controls, anonymous FTP (was Re: ANSI x3.64-1979)

ANSI, DEC controls, anonymous FTP (was Re: ANSI x3.64-1979)

Post by Richard Shufo » Fri, 11 Nov 1994 07:28:43


> Is there a site that I can download or FTP the complete ANSI 3.64-1979
> Standard?

This question has come up a lot; I believe that the answer is still "no".

ANSI seems to be registered as a non-profit organization, but it
historically has insisted on getting financial return for distributing
its standards documents.  If this has changed, I'm not aware of it.

The complete document describing the standard,  "ANSI X3.64-1979:
Additional Controls for Use with the American National Standard
Code for Information Interchange," can be ordered for $13.50 (plus
$4 postage) from

    Standards Sales Department
    American National Standards Institute
    1430 Broadway
    New York, NY 10018
    +1 212/354-3300

It's best to read the full standard before using it in any complex
way.  It also helps to have copies of the related standards "X3.4-1977:
American National Standard Code for Information Interchange" (the
ASCII standard) and "X3.41.1974: Code-Extension Techniques for Use
with the 7-Bit Coded Character Set of American National Standard for
Information Interchange."

By the way, note that the standard is "X3.64", not just "3.64", because
"X3" is the name of the committee that sponsored it.  I seem to recall
that the subcommittee that actually did the work was "X3L2".

While we are at it, I'll point out some things about X3.64 and give an
Internet source for a subset of the standard's contents.


The control sequences recognized by the Digital Equipment Corporation
VT100, VT200, VT300, VT400, and VT500-family character-cell video
terminals are an extended variant of the control sequences specified
by the ANSI standard, ANSI X3.64.  (ISO DP-6429 is the international

The generic sequence introducer is a code element called CSI (Control
Sequence Introducer).  If you are using 8-bit communication, you
can use the hexadecimal value 9Bh to represent this (but be sure
you understand the side effects thereof).  Otherwise, use the 7-bit
equivalent: the Escape character (1Bh) followed by [  (the left
bracket character).

For instance, the canonical form of the "scroll-region" command is

    CSI xx ; yy r

or in 7-bit style

    Esc [ xx ; yy r

(where xx and yy are decimal digits expressed in ASCII/IA5; you do not
actually use a space between sequence elements, this is for clarity.
Be careful with the notation here--sometimes a space character _is_
a sequence element, as in the SR Scroll Right editing function.)

In an X3.64 control sequence, the numeric arguments may default to an
arbitrary value specific to the device function being controlled.  Do
not assume that the default always will be 0 or 1. (Or there may be
no default allowed.)  For example, the numeric arguments in the GSM
(Graphic Size Modify) sequence have the default values 100, 100.

As a private extension to X3.64, DEC defines the DECSTBM (Set Top and
Bottom Margins) command as follows:

        CSI Pt ; Pb r

    Selects top and bottom margins defining the scrolling region.
    Pt is the line number of the first line in the scrolling region.
    Pb is the line number of the bottom line.
    If you do not select either Pt or Pb, they default to the top
    and bottom respectively.  Lines are counted from 1.

(See \VT220 Programmer Pocket Guide/, part EK-VT220-HR-002, page 37.)

Screen clearing should not depend on scrolling.

Erasing parts of the display (EL and ED) in the VT100 is performed thus:

     Erase from cursor to end of line           Esc [ 0 K    or Esc [ K
     Erase from beginning of line to cursor     Esc [ 1 K
     Erase line containing cursor               Esc [ 2 K
     Erase from cursor to end of screen         Esc [ 0 J    or Esc [ J
     Erase from beginning of screen to cursor   Esc [ 1 J
     Erase entire screen                        Esc [ 2 J

Some poorly planned terminal/emulators respond to Esc [ J as if it were
Esc [ 2 J (here the default is 0), and _some_ versions of Microsoft's
MS-DOS ANSI.SYS contain a bug requiring software to send Esc [ k
(instead of the uppercase).  Of course, you would never make this mistake.

The VT200 and later terminals have the ECH control sequence:

    ECH  Erase Character           Esc [ Pn X

(where Pn is a numeric parameter in ASCII digits).  This erases the
cursor position and the next (Pn-1) positions, but this is not part of
the least common denominator VT100.

Another common thing that people want to do it position the cursor:

first to some absolute screen position

    CUP  Cursor Position           Esc [ Pl ; Pc H

where Pl is the line number and Pc is the column (depends on origin mode)

and then cursor relative positioning

    CUB  Cursor Backward           Esc [ Pn D
    CUD  Cursor Down               Esc [ Pn B
    CUF  Cursor Forward            Esc [ Pn C
    CUU  Cursor Up                 Esc [ Pn A
    CVT  Cursor Vertical Tab       Esc [ Pn Y

The above screen-control codes are NOT what the terminal's arrows keys
send; in normal 7-bit mode you'll see the VT100 keys emit

    arrow-up                       Esc [ A
    arrow-down                     Esc [ B
    arrow-right                    Esc [ C
    arrow-left                     Esc [ D

 - - - - - -

Now as to what is available online:

A file containing a list of defined control sequences called
"ansi_x3_64.txt" is available via anonymous FTP from the host

    CS.UTK.EDU  []

look in the directory


To successfully connect to "", your own Internet host must
be registered in the Domain Name Service for reverse mapping from
IP number to domain name.

Other information on various character-cell video terminals is also
available from this source.

 - - - - - -

VT, Flip Chip, BLISS, and Rainbow are trademarks of Digital Equipment

 ...Richard S. Shuford  | "By justice a ruler gives a country stability,

 ...Info-Stratus contact|  Proverbs 29:4