# VT100 Programing Reference

## ANSI Compatible Mode

> Cursor Movement Commands
> Cursor Up | ESC [ Pn A
> Cursor Down | ESC [ Pn B
> Cursor Forward (right) | ESC [ Pn C
> Cursor Backward (left) | ESC [ Pn D
> Direct Cursor Addressing | ESC [ Pl ; Pc H
> Direct Cursor Addressing | ESC [ Pl ; Pc f
> Index | ESC D
> Next Line | ESC E
> Reverse Index | ESC M
> Save cursor and attributes | ESC 7
> Restore cursor and attributes | ESC 8

> Line Size (Double-Height and Double-Width) Commands
> Change this line to double-height top half | ESC # 3
> Chane this line to double-height bottom half | ESC # 4
> Change this line to single-width single-height | ESC # 5
> Change this line to double-width single-height | ESC # 6

> Character Attributes
> ESC [ Ps ; Ps ; Ps ; ... Ps m
> Ps = 0 or none | All attributes off
> Ps = 1 | Bold on
> Ps = 4 | Underscore on
> Ps = 5 | Blink on
> Ps = 7 | Reverse video on

> Erasing
> From cursor to end of line | ESC [ K
> From cursor to end of line | ESC [ 0 K
> From beginning of line to cursor | ESC [ 1 K
> Entire line containing cursor | ESC [ 2 K
> From cursor to end of screen | ESC [ J
> From cursor to end of screen | ESC [ 0 J
> From beginning of screen to cursor | ESC [ 1 J
> Entire Screen | ESC [ 2 J

> Programmible LEDs
> ESC [ Ps ; Ps ; Ps ; ... Ps q
> Ps = 0 | All LEDs off
> Ps = 1 | L1 on
> Ps = 2 | L2 on
> Ps = 3 | L3 on
> Ps = 4 | L4 on

> Character Sets (G0 and G1 Designators)
> Character Set | G0 Designator | G1 Designator
> --- | --- | ---
> United Kingdom (UK) | ESC ( A | ESC ) A
> United States (USASCII) | ESC ( B | ESC ) B
> Special graphics characters & line drawing set | ESC ( 0 | ESC ) 0
> Alternate character ROM | ESC ( 1 | ESC ) 1
> Alternate character ROM special graphics characters | ESC ( 2 | ESC ) 2

> Scrolling Region -- ESC [ Pb ; Pt r

> Tab Stops
> Set tab at current column | ESC H
> Clear tab at current column | ESC [ g
> Clear tab at current column | ESC [ 0 g
> Clear all tabs | ESC [ 3 g

> Modes
> Mode Name | To Set | To Reset
> --- | --- | ---
> Mode | Sequence | Mode | Sequence
> Line feed / New line | New line | ESC [ 20 h | Line feed | ESC [ 20 l
> Cursor key mode | Application | ESC [ ? 1 h | Cursor | ESC [ ? 1 l
> ANSI/VT52 mode | ANSI |  | VT52 | ESC [ ? 2 l
> Column mode | 132 column | ESC [ ? 3 h | 80 column | ESC [ ? 3 l
> Scrolling mode | Smooth | ESC [ ? 4 h | Jump | ESC [ ? 4 l
> Screen mode | Reverse | ESC [ ? 5 h | Normal | ESC [ ? 5 l
> Origin mode | Relative | ESC [ ? 6 h | Absolute | ESC [ ? 6 l
> Wraparound | On | ESC [ ? 7 h | Off | ESC [ ? 7 l
> Auro repeat | On | ESC [ ? 8 h | Off | ESC [ ? 8 l
> Interlace | On | ESC [ ? 9 h | Off | ESC [ ? 9 l
> Graphic processor option | On | ESC 1 | Off | ESC 2
> Keyboard mode | Application | ESC = | Numeric | ESC >

> * The last character of the reset sequences are a lowercase L.

> Reports
> | Invoked By | Response Is
> Cursor Position Report | ESC [ 6 n | ESC [ Pl ; Pc R
> Status Report | ESC [ c | ESC [ ? l ; Ps n
> Status Report | ESC [ 0 c | ESC [ ? l ; Ps n
> What are you? | ESC [ c | ESC [ ? l ; Ps n
> What are you? | ESC [ 0 c | ESC [ ? l ; Ps n

> Reset -- ESC c

## Keyboard Codes

> Auxilary Keyboard Codes
> Key | VT52 Numeric Mode | VT52 Application Mode | ANSI Numeric Mode | ANSI Application Mode
> --- | --- | --- | --- | ---
> 0 | 0 | ESC ? p | 0 | ESC O p
> 1 | 1 | ESC ? q | 1 | ESC O q
> 2 | 2 | ESC ? r | 2 | ESC O r
> 3 | 3 | ESC ? s | 3 | ESC O s
> 4 | 4 | ESC ? t | 4 | ESC O t
> 5 | 5 | ESC ? u | 5 | ESC O u
> 6 | 6 | ESC ? v | 6 | ESC O v
> 7 | 7 | ESC ? w | 7 | ESC O w
> 8 | 8 | ESC ? x | 8 | ESC O x
> 9 | 9 | ESC ? y | 9 | ESC O y
> - (minus) | - (minus) | ESC ? m | - (minus) | ESC O m
> , (comma) | , (comma) | ESC ? l | , (comma) | ESC O l
> . (period) | . (period) | ESC ? n | . (period) | ESC O n
> `ENTER` | Same as `RETURN` | ESC ? M | Same as `RETURN` | ESC O M
> PF1 | ESC P | ESC P | ESC O P | ESC O P
> PF2 | ESC Q | ESC Q | ESC O Q | ESC O Q
> PF3 | ESC R | ESC R | ESC O R | ESC O R
> PF4 | ESC S | ESC S | ESC O S | ESC O S

> 7-Bit ASCII Code
> Octal Code | Char | Octal Code | Char | Octal Code | Char | Octal Code | Char
> --- | --- | --- | --- | --- | --- | --- | ---
> 000 | `NUL` | 040 | `SP` | 100 | @ | 140 | `
> 001 | `SOH` | 041 | ! | 101 | A | 141 | a
> 002 | `STX` | 042 | " | 102 | B | 142 | b
> 003 | `ETX` | 043 | # | 103 | C | 143 | c
> 004 | `EOT` | 044 | $ | 104 | D | 144 | d
> 005 | `ENQ` | 045 | % | 105 | E | 145 | e
> 006 | `ACK` | 046 | & | 106 | F | 146 | f
> 007 | `BEL` | 047 | ' (apos) | 107 | G | 147 | g
> 010 | `BS` | 050 | ( | 110 | H | 150 | h
> 011 | `HT` | 051 | ) | 111 | I | 151 | i
> 012 | `LF` | 052 | . | 112 | J | 152 | j
> 013 | `VT` | 053 | + | 113 | K | 153 | k
> 014 | `FF` | 054 | , (comma) | 114 | L | 154 | l
> 015 | `CR` | 055 | - (minus) | 115 | M | 155 | m
> 016 | `SO` | 056 | . (period) | 116 | N | 156 | n
> 017 | `SI` | 057 | / | 117 | O | 157 | o
> 020 | `DLE` | 060 | 0 | 120 | P | 160 | p
> 021 | `DC1` | 061 | 1 | 121 | Q | 161 | q
> 022 | `DC2` | 062 | 2 | 122 | R | 162 | r
> 023 | `DC3` | 063 | 3 | 123 | S | 163 | s
> 024 | `DC4` | 064 | 4 | 124 | T | 164 | t
> 025 | `NAK` | 065 | 5 | 125 | U | 165 | u
> 026 | `SYN` | 066 | 6 | 126 | V | 166 | v
> 027 | `ETB` | 067 | 7 | 127 | W | 167 | w
> 030 | `CAN` | 070 | 8 | 130 | X | 170 | x
> 031 | `EM` | 071 | 9 | 131 | Y | 171 | y
> 032 | `SUB` | 072 | : | 132 | Z | 172 | z
> 033 | `ESC` | 073 | ; | 133 | | | 173 | {
> 034 | `FS` | 074 | < | 134 | \ | 174 | [
> 035 | `GS` | 075 | = | 135 | ] | 175 | }
> 036 | `RS` | 076 | > | 136 | ^ | 176 | ~
> 037 | `US` | 077 | ? | 137 | _ | 177 | `DEL`

> Note: The following control characters are generated differently from previous DIGITAL terminals.

> Code | VT100 | Previous Terminal
> --- | --- | ---
> `NUL` | CTRL - Space Bar | CTRL - @
> `RS` | CTRL - ~ | CTRL - ^
> `US` | CTRL - ? | CTRL - -

> Cursor Control Key Codes
> Cursor Key (arrow) | VT52 Mode | ANSI/Cursor Key Mode Reset | ANSI/Cursor Key Mode Set
> --- | --- | --- | ---
> Up | ESC A | ESC [ A | ESC O A
> Down | ESC B | ESC [ B | ESC O B
> Right | ESC C | ESC [ C | ESC O C
> Left | ESC D | ESC [ D | ESC O D

> Special Graphics Characters
> Octal Code | Graphics with US or UK set | Graphics with "Special Graphics" set
> --- | --- | ---
> 137 | _ | Blank
> 140 | \ | Diamond
> 141 | a | Checkerboard (error indicator)
> 142 | b | `HT` Horizontal tab
> 143 | c | `FF` Form feed
> 144 | d | `CR` Cariage return
> 145 | e | `LF` Line feed
> 146 | f | Degree symbol
> 147 | g | plus/minus
> 150 | h | `NL` New line
> 151 | i | `VT` Vertical tab
> 152 | j | Lower-right corner
> 153 | k | Upper-right corner
> 154 | l | Upper-left corner
> 155 | m | Lower-left corner
> 156 | n | Crossing lines
> 157 | o | Horizontal line -- Scan 1
> 160 | p | Horizontal line -- Scan 3
> 161 | q | Horizontal line -- Scan 5
> 162 | r | Horizontal line -- Scan 7
> 163 | s | Horizontal line -- Scan 9
> 164 | t | Left "T"
> 165 | u | Right "T"
> 166 | v | Bottom "T"
> 167 | w | Top "T"
> 170 | x | | Vertical bar
> 171 | y | Less than or equal to
> 172 | z | Greater than or equal to
> 173 | { | Pi
> 174 | | | Not equal to
> 175 | } | UK pound sign
> 176 | ~ | Centered dot