The DEC VT100 was the first ANSI X3.64 standard compliant terminal ever. Released in 1978, the VT100 was powered by an Intel 8085 microprocessor and weighed 41 pounds. Like a primordial iMac, the unit consisted of a bulky monitor case that housed the logic board, plus a detached keyboard. The VT100 allowed one to connect to the outside world at speeds as low as 75 bps all the way up to 19200 bps.

While the VT100 was capable of understanding the DEC VT52 control codes, the new VT100 ANSI sequences became much more widely supported. Since the VT100, almost all terminals and terminal emulation programs handle the base VT100 ANSI control sequences.

The following is a summary of the most important control sequences. ESC represents the escape character, 0x1B, and spaces are added for clarity and are not part of the sequences.

Cursor Movement Commands

Cursor up                     ESC [ n A
Cursor down                   ESC [ n B
Cursor forward (right)        ESC [ n C
Cursor backward (left)        ESC [ n D
Direct cursor addressing      ESC [ y ; x H  or
                              ESC [ y ; x f
Save cursor & attributes      ESC 7
Restore cursor & attributes   ESC 8

n is replaced by the number of positions to move. y and x represent the line and column number to move to.

Line Size (Double-Height and Double-Width) Commands

Line to double-height top half     ESC # 3
Line to double-height bottom half  ESC # 4
Line to single-width single-height ESC # 5
Line to double-width single-height ESC # 6

Character Attributes

Set current attribute         ESC [ a;a;a;...;a m

The a characters refers to a selective parameter. Multiple parameters are separated by the semicolon character. The parameters are executed in order and have the following meanings:

0 or None All Attributes Off
1 Bold on
4 Underscore on
5 Blink on
7 Reverse video on

Erasing

To end of line                ESC [ K  or
                              ESC [ 0 K
From beginning of line        ESC [ 1 K
Entire line                   ESC [ 2 K
To end of screen              ESC [ J  or
                              ESC [ 0 J
From beginning of screen      ESC [ 1 J
Entire screen                 ESC [ 2 J

Character Sets (G0 and G1 Designators)

The G0 and G1 character sets are designated as follows:

Character set                 G0 designator   G1 designator
United Kingdom (UK)           ESC ( A         ESC ) A
United States (USASCII)       ESC ( B         ESC ) B
Special graphics characters   ESC ( 0         ESC ) 0
and line drawing set
Alternate character ROM       ESC ( 1         ESC ) 1
Alternate character ROM       ESC ( 2         ESC ) 2
special graphics characters

Scrolling Region

Set scrolling region          ESC [ t ; b r

t is the number of the top line of the scrolling region; b is the number of the bottom line of the scrolling region and must be greater than t.

Tab Stops

Set tab at current column     ESC H
Clear tab at current column   ESC [ g or ESC [ 0 g
Clear all tabs                ESC [ 3 g

Modes

Mode Name                     To Set                  To Reset
Line feed/new line New line   ESC [20h      Line feed ESC [20l
Cursor key mode Application   ESC [?1h         Cursor ESC [?1l
ANSI/VT52 mode                ESC [?2l
Column mode 132 Col           ESC [?3h         80 Col ESC [?3l
Scrolling mode Smooth         ESC [?4h           Jump ESC [?4l
Screen mode Reverse           ESC [?5h         Normal ESC [?5l
Origin mode Relative          ESC [?6h       Absolute ESC [?6l
Wraparound On                 ESC [?7h            Off ESC [?7l
Auto repeat On                ESC [?8h            Off ESC [?8l
Interlace On                  ESC [?9h            Off ESC [?9l
Keypad mode Application       ESC =           Numeric ESC >

Reset

Reset causes the power-up reset routine to be executed.

Reset                         ESC c