VT100.net Installing and Using the VT320 Video Terminal

E VT320 Programming Summary

This appendix is a summary of the control functions and commands described in the VT320 Programmer Reference Manual. If you are a programmer, you can use this appendix as a quick-reference tool to program the VT320.

The appendix is divided into sections that correspond to the chapters of the programmer reference manual. For example, to find out more about 2 Character Encoding, you would go to Chapter 2 of the programmer reference manual.

2 Character Encoding

Character Sets and Codes

Computer systems store characters as a series of bits, usually 7 bits or 8 bits long. A bit is a binary digit. The VT320 can work with 7-bit or 8-bit systems. The VT320 provides the following character sets.

An 8-bit system can use any of these character sets. A 7-bit system can use any set except the supplemental graphic sets.

Each character set has two types of characters, graphic characters and control characters. Graphic characters are the characters you can display on the screen. Control characters make the terminal perform a special function. See "Control Functions" in this appendix.

A code table is a convenient way of showing all the characters in a character set with their codes. Characters appear in rows and columns. One way of finding a character in a character set is by its column/row position. For example, in the ASCII character set the character H is at 4/8 (column 4, row 8).

Each character in a row uses the same binary code for its four least significant bits. This value appears at the left or right of each row. Each character in a column uses the same binary code for its three (or four) most significant bits. This value appears at the top of each column.

Next to each character appears the octal, decimal, and hexadecimal code for the character. Different programmers may prefer using octal, decimal, or hexadecimal values for different purposes.

DEC Multinational Character Set

Left Half – ASCII Set
Right Half – DEC Supplemental Graphic Set

National Replacement Character Sets (NRCs)

This table shows the characters in each NRC set that differ from the ASCII set.

National Replacement Character Sets
Character Set 2/3 4/0 5/11 5/12 5/13 5/14 5/15 6/0 7/11 7/12 7/13 7/14
ASCII # @ [ \ ] ^ _ ` { | } ~
United Kingdom £ @ [ \ ] ^ _ ` { | } ~
Dutch £ ¾ ÿ ½ | ^ _ ` ¨ f ¼ '
Finnish # @ Ä Ö Å Ü _ é ä ö å ü
French £ à ° ç; § ^ _ ` é ù è ¨
French Canadian # à â ç ê î _ ô é ù è û
German # § Ä Ö Ü ^ _ ` ä ö ¨ ß
Italian £ § ° ç é ^ _ ù à ò è ì
Norwegian/ Danish # @ Æ Ø Å ^ _ ` æ ø å ~
Portuguese # @ Ã Ç Õ ^ _ ` ã ç õ ~
Spanish £ § ¡ Ñ ¿ ^ _ ` ` ° ñ ç
Swedish # É Ä Ö Å Ü _ é ä ö å ü
Swiss ù à é ç ê î è ô ä ö ü û

ISO Latin Alphabet Nr 1 Supplemental Set

This is the right half of the ISO Latin-1 multinational character set. The left half is the ASCII character set.

DEC Special Graphic Character Set

Display Controls Font

You can have the terminal display the characters in your control functions, rather than performing the function. This is useful for debugging programs. To display control characters, you use the Controls feature in the Display Set-Up screen (Chapter 4).

Display Controls Font (Left Half)
Display Controls Font (Right Half)

Control Functions

Programmers use control functions to make the VT320 perform a range of special actions, from the simple (moving the cursor) to the complex (emulating another terminal). The way you enter control functions in an application depends on two factors: your computing system and the programming language you use.

There are two types of control functions, single-character and multiple-character. Single-character functions, called control characters, perform simpler functions. There are two groups of control characters, C0 and C1. C0 characters appear in columns 0 and 1 of the code tables. C1 characters appear in columns 8 and 9. C1 characters are not available in 7-bit systems. The next section lists the function of each control character.

Control functions can perform more complex functions. There are three types of multiple-character control functions: escape sequences, control sequences, and device control strings. Each type begins with a certain control character.

Escape Sequences

An escape sequence begins with the C0 character ESC, followed by one or more graphic characters from the ASCII set. The ESC character tells the system that the graphic characters are part of a control function, not characters to be displayed. For example,

ESC # 6

is an escape sequence that changes the current line of text to double-width characters. Escape sequences use only 7-bit characters, and can be used in 7-bit or 8-bit systems.

Control Sequences

A control sequence begins with the C1 character CSI, followed by one or more ASCII graphic characters. You can also express CSI as two 7-bit characters, ESC [. So you can express control sequences as escape sequences. For example, the following two sequences perform the same function -- they change the display from 80 to 132 columns per line.

CSI ? 3 h

ESC [ ? 3 h

Whenever possible use CSI instead of ESC [ to introduce a control sequence. You can only use CSI in 8-bit systems.

Device Control Strings

A device control string begins with the C1 character DCS, followed by one or more ASCII graphic characters, a data string, and the C1 character ST (string terminator). For an example of a device control string, see "Down-Line-Loading a Soft Character Set" in this appendix.

For 7-bit systems, you can express DCS as ESC P. You can express ST as ESC \.

C0 (7-Bit) Control Characters Recognized

Name Mnemonic Function
Null NUL Ignored.
Enquiry ENQ Sends the answerback message.
Bell BEL Sounds the bell tone if the bell is enabled in set-up.
Backspace BS Moves the cursor one character position to the left. If the cursor is at the left margin, no action occurs.
Horizontal tab HT Moves the cursor to the next tab stop. If there are no more tab stops, the cursor moves to the right margin. HT does not cause text to auto wrap.
Line feed LF Causes a line feed or a new line operation, depending on the setting of line feed/new line mode.
Vertical tab VT Treated as LF.
Form feed FF Treated as LF.
Carriage return CR Moves the cursor to the left margin on the current line.
Shift out
(Locking shift 1)
SO (LS1) Maps the G1 character set into GL. You designate G1 by using a select character set (SCS) sequence. See the VT320 Programmer Reference Manual, Chapter 5.
Shift in
(Locking shift 0)
SI (LS0) Maps the G0 character set into GL. You designate G0 by using a select character set (SCS) sequence. See the VT320 Programmer Reference Manual, Chapter 5.
Device control 1
(XON)
DC1 Also known as XON. If XON/XOFF flow control is enabled in set-up, DC1 clears DC3 (XOFF). This action causes the VT320 to continue sending characters.
Device control 3
(XOFF)
DC3 Also known as XOFF. If XON/XOFF flow control is enabled in set-up, DC3 causes the VT320 to stop sending characters. The terminal cannot resume sending characters until it receives a DC1 control character.
Cancel CAN Immediately cancels an escape sequence or control sequence in progress. The VT320 does not display any error characters.
Substitute SUB Immediately cancels an escape sequence or control sequence in progress. The VT320 displays a reverse question mark for an error character.
Escape ESC Introduces an escape sequence. ESC also cancels any escape sequence or control sequence in progress.
Delete DEL Ignored when received. DEL is not used as a fill character. Digital does not recommend using DEL as a fill character. Use NUL instead.

C1 (8-Bit) Control Characters Recognized

Name Mnemonic Function
Index IND Moves the cursor down one line in the same column. If the cursor is at the bottom margin, data on the screen scrolls up.
Next line NEL Moves the cursor to the first position on the next line. If the cursor is at the bottom margin, data on the screen scrolls up.
Horizontal tab set HTS Sets a horizontal tab stop at the column where the cursor is.
Reverse index RI Moves the cursor up one line in the same column. If the cursor is at the top margin, data on the screen scrolls down.
Single shift 2 SS2 Temporarily maps the G2 character set into GL, for the next graphic character. You designate the G2 set by using a select character set (SCS) sequence. See the VT320 Programmer Reference Manual, Chapter 5.
Single shift 3 SS3 Temporarily maps the G3 character set into GL, for the next graphic character. You designate the G3 set by using a select character set (SCS) sequence. See the VT320 Programmer Reference Manual, Chapter 5.
Device control string DCS Introduces a device control string.
Control sequence introducer CSI Introduces a control sequence.
String terminator ST Ends a control string. You use ST in combination with DCS, APC, OSC, PM, or SOS control strings.
Operating system command OSC Introduces an operating system command.*
Privacy message PM Introduces a privacy message string.*
Application program command APC Introduces an application program command.*
* The VT320 ignores all following characters, until it receives an ST control character. ESC, CAN, and SUB no longer cancel device control strings.

8-Bit Control Characters and Their 7-Bit Equivalents

Name 8-Bit Character 7-Bit Sequence
Index IND ESC D
Next line NEL ESC E
Horizontal tab set HTS ESC H
Reverse index RI ESC M
Single shift 2 SS2 ESC N
Single shift 3 SS3 ESC O
Device control string DCS ESC P
Control sequence introducer CSI ESC [
String terminator ST ESC \
Operating system command OSC ESC ]
Privacy message PM ESC ^
Application program command APC ESC _

3 Keyboard Codes

Codes Sent by Editing Keys

Key Code Sent
VT300 Mode VT100, VT52 Modes
Find CSI 1 ~ The editing keys do not send codes in these two modes.
Insert Here CSI 2 ~
Remove CSI 3 ~
Select CSI 4 ~
Prev Screen CSI 5 ~
Next Screen CSI 6 ~

Codes Sent by Arrow Keys

Key Cursor Key Mode Setting (DECCKM)
ANSI Mode* VT52 Mode*
Cursor Application Cursor or Application
Up CSI A SS3 A ESC A
Down CSI B SS3 B ESC B
Right CSI C SS3 C ESC C
Left CSI D SS3 D ESC D
* ANSI mode applies to VT300 and VT100 modes. VT52 mode is not compatible with ANSI mode.

Codes Sent by Numeric Keypad Keys

Key ANSI Mode* VT52 Mode*
Numeric Application Numeric Application
0 0 SS3 p 0 ESC ? p
1 1 SS3 q 1 ESC ? q
2 2 SS3 r 2 ESC ? r
3 3 SS3 s 3 ESC ? s
4 4 SS3 t 4 ESC ? t
5 5 SS3 u 5 ESC ? u
6 6 SS3 v 6 ESC ? v
7 7 SS3 w 7 ESC ? w
8 8 SS3 x 8 ESC ? x
9 9 SS3 y 9 ESC ? y
- (minus) - SS3 m - ESC ? m
, (comma) , SS3 l , ESC ? l†‡
. (period) . SS3 n . ESC ? n
Enter CR or CR LF§ SS3 M CR or CR LF§ ESC ? M
PF1 SS3 P SS3 P ESC P ESC P
PF2 SS3 Q SS3 Q ESC Q ESC Q
PF3 SS3 R SS3 R ESC R ESC R
PF4 SS3 S SS3 S ESC S ESC S
* ANSI mode applies to VT300 and VT100 modes. VT52 mode is not compatible with ANSI standards.
† The last character in the sequence is a lowercase L.
‡ You cannot use these sequences on a VT52 terminal.
§ Keypad numeric mode. Enter sends the same codes as Return. You can use line feed/new line mode (LNM) to change the code sent by Return. When LNM is reset, pressing Return sends one control character (CR). When LNM is set, pressing Return sends two control characters (CR, LF).

Codes Sent by the Top-Row Function Keys

Name on Legend Strip Key Number Code Sent
VT300 Modes VT100, VT52 modes
Hold Screen (F1)* -- --
Print Screen (F2)* -- --
Set-Up (F3)* -- --
F4 (F4)* -- --
Break (F5)* -- --
F6 F6 CSI 1 7 ~ --
F7 F7 CSI 1 8 ~ --
F8 F8 CSI 1 9 ~ --
F9 F9 CSI 2 0 ~ --
F10 F10 CSI 2 1 ~ --
F11 (ESC) F11 CSI 2 3 ~ ESC
F12 (BS) F12 CSI 2 4 ~ BS
F13 (LF) F13 CSI 2 5 ~ LF
F14 F14 CSI 2 6 ~ --
Help F15 CSI 2 8 ~ --
Do F16 CSI 2 9 ~ --
F17 F17 CSI 3 1 ~ --
F18 F18 CSI 3 2 ~ --
F19 F19 CSI 3 3 ~ --
F20 F20 CSI 3 4 ~ --
* These keys do not send codes. They are local function keys.

Keys Used to Send 7-Bit Control Characters

Control Character Mnemonic Code Table Position Key Pressed With Ctrl (All Modes) Dedicated Function Key
NUL 0/00 2 or space bar --
SOH 0/01 A --
STX 0/02 B --
ETX 0/03 C --
EOT 0/04 D --
ENQ 0/05 E --
ACK 0/06 F --
BEL 0/07 G --
BS 0/08 H F12 (BS)*
HT 0/09 I Tab
LF 0/10 J F13 (LF)*
VT 0/11 K --
FF 0/12 L --
CR 0/13 M Return
SO 0/14 N --
SI 0/15 O --
DLE 1/00 P --
DC1 1/01 Q† --
DC2 1/02 R --
DC3 1/03 S† --
DC4 1/04 T --
NAK 1/05 U --
SYN 1/06 V --
ETB 1/07 W --
CAN 1/08 X --
EM 1/09 Y --
SUB 1/10 Z --
ESC 1/11 3 or [ F11 (ESC)*
FS 1/12 4 or / --
GS 1/13 5 or ] --
RS 1/14 6 or ~ --
US 1/15 7 or ? --
DEL 7/15 8 Delete
* 7-bit control characters sent in VT100 and VT52 modes only.
† 7-bit control codes sent only when XON/XOFF support is off.

4 Emulating VT Series Terminals

Selecting an Operating Level (DECSCL)

NOTE: Select VT300 mode to run all VT200 applications.

Sequence Level Selected
Level 1
CSI 6 1 " p VT100 mode
Level 2 or 3
CSI 6 3 " p VT300 mode, 8-bit controls
CSI 6 3 ; 0 " p VT300 mode, 8-bit controls
CSI 6 3 ; 2 " p VT300 mode, 8-bit controls
CSI 6 2 " p VT300 mode, 8-bit controls
CSI 6 2 ; 0 " p VT300 mode, 8-bit controls
CSI 6 2 ; 2 " p VT300 mode, 8-bit controls
CSI 6 3 ; 1 " p VT300 mode, 7-bit controls (D)
CSI 6 2 ; 1 " p VT300 mode, 7-bit controls
(D) = default

Sending C1 Controls to the Host

ESC sp F Select 7-bit C1 controls.
ESC sp G Select 8-bit C1 controls.

National Replacement Character Set Mode (DECNRCM)

Default: Multinational

Mode Sequence Function
Set
(national)
CSI ? 4 2 h The terminal uses 7-bit characters from an NRC set.
Reset
(multinational)
CSI ? 4 2 l* The terminal uses 7-bit and 8-bit characters from the DEC Multinational or ISO Latin-1 set.
* The last character in the sequence is a lowercase L.

5 Using Character Sets

Selecting Graphic Character Sets

  1. Designate the set as G0, G1, G2, or G3.
  2. Map the designated set into the in-use table.

Designating Character Sets (SCS Sequences)

ESC Intermediate Final

To Select Use
Intermediate
94-Character Sets
G0 (
G1 )
G2 *
G3 +
96-Character Sets
G1 -
G2 .
G3 /
Final
ASCII B
DEC Supplemental Graphic % 5
ISO Latin-1 supplemental A
User-preferred supplemental <
DEC Special Graphic 0
NRC Sets*
British A
Dutch 4
Finnish† 5 or C
French R
French Canadian Q
German K
Italian Y
Norwegian/Danish† ` or E or 6
Portuguese % 6
Spanish Z
Swedish† 7 or H
Swiss =
* Only one NRC set is available at a time. You must select national mode to use NRC sets. See "National Replacement Character Set Mode" in Section 4.
† Digital recommends using the first code shown.

Mapping Character Sets

With Locking Shifts (LS)

Locking Shift Code Function
LS0 (locking shift 0) SI Map G0 into GL. (D)
LS1 (locking shift 1) SO Map G1 into GL.

NOTE: The following locking shift functions are available only in VT300 mode.

LS1R (locking shift 1, right) ESC ~ Map G1 into GR.
LS2 (locking shift 2) ESC n Map G2 into GL.
LS2R (locking shift 2, right) ESC } Map G2 into GR.
LS3 (locking shift 3) ESC o Map G3 into GL.
LS3R (locking shift 3, right) ESC | Map G3 into GR.

With Single Shifts (SS)

SS2 (single shift 2) ESC N Maps G2 into GL for the next character.
SS3 (single shift 3) ESC O Maps G3 into GL for the next character.

Assign User-Preferred Supplemental Set (DECAUPSS)

Default: DEC Supplemental Graphic

Sequence Function
DCS 0 ! u % 5 ST Assigns the DEC Supplemental Graphic set as the preferred supplemental set.
DCS 1 ! u A ST Assigns the ISO Latin-1 Supplemental set as the preferred supplemental set.

Soft Character Sets

You can only load soft character sets in VT300 mode.

Guidelines for Designing Soft Characters

Character Dimension 80-Column Font 132-Column Font
Cell width 15 pixels 9 pixels
Cell height 12 12
Body width 12 7
Body height 7 7
Ascender height 3 3
Descender height 2 2
Spacing before character 2 1
Spacing after character 1 1

Converting Binary Code to an ASCII Character

Binary
Value
Hex
Value
Hex Value
+ 3F Offset
Character
Equivalent
000000  00 3F ?
000001 01 40 @
000010 02 41 A
000011 03 42 B
000100 04 43 C
 
000101 05 44 D
000110 06 45 E
000111 07 46 F
001000 08 47 G
001001 09 48 H
 
001010 0A 49 I
001011 0B 4A J
001100 0C 4B K
001101 0D 4C L
001110 0E 4D M
 
001111 0F 4E N
010000 10 4F O
010001 11 50 P
010010 12 51 Q
010011 13 52 R
 
010100 14 53 S
010101 15 54 T
010110 16 55 U
010111 17 56 V
011000 18 57 W
 
011001 19 58 X
011010 1A 59 Y
011011 1B 5A Z
011100 1C 5B [
011101 1D 5C \
 
011110 1E 5D ]
011111 1F 5E ^
100000 20 5F _
100001 21 60 `
100010 22 61 a
 
100011 23 62 b
100100 24 63 c
100101 25 64 d
100110 26 65 e
100111 27 66 f
 
101000 28 67 g
101001 29 68 h
101010 2A 69 i
101011 2B 6A j
101100 2C 6B k
 
101101 2D 6C l
101110 2E 6D m
101111 2F 6E n
110000 30 6F o
110001 31 70 p
 
110010 32 71 q
110011 33 72 r
110100 34 73 s
110101 35 74 t
110110 36 75 u
 
110111 37 76 v
111000 38 77 w
111001 39 78 x
111010 3A 79 y
111011 3B 7A z
 
111100 3C 7B {
111101 3D 7C |
111110 3E 7D }
111111 3F 7E ~

Down-Line-Loading a Soft Character Set (DECDLD)

DCS Pfn ; Pcn ; Pe ; Pcmw ; Pw ; Pt ; Pcmh ; Pcss { Dscs Sxbp1 ; Sxbp2 ; ... ; Sxbpn ST

DECDLD Parameter Characters

Parameter Name Description
Pfn Font number

Selects the DRCS font buffer to load.

The VT320 has one DRCS font buffer. Pfn has two valid values, 0 and 1. Both values refer to the same DRCS buffer.

Pcn Starting character

Selects where to load the first character in the DRCS font buffer. The location corresponds to a location in the ASCII code table (Section 2).

Pcn is affected by the character set size. (See Pcss below.) In a 94-character set, a Pcn value of 0 or 1 means that the first soft character is loaded into position 2/1 of the character table. In a 96-character set, a Pcn value of 0 means the first character is loaded into position 2/0 of the character table. The greatest Pcn value is 95 (position 7/15).

Pe Erase control

Selects which characters to erase from the DRCS buffer before loading the new font.

0 = erase all characters in the DRCS buffer with this number, width and rendition.
1 = erase only characters in locations being reloaded.
2 = erase all renditions of the soft character set (normal, bold, 80-column, 132-column).
Pcmw Character matrix width

Selects the maximum character cell width.

VT300 modes
0 = 15 pixels wide for 80 columns, 9 pixels wide for 132 columns. (D)
1 = illegal.
2 = 5 × 10 pixel cell | VT220 compatible
3 = 6 × 10 pixel cell |
4 = 7 × 10 pixel cell |
5 = 5 pixels wide.
6 = 6 pixels wide.
.
.
15 = 15 pixels wide.

If you omit a Pcmw value, the terminal uses the default character width. Any Pcmw value over 15 is illegal.

Use Pcmw values 2 through 4 with VT220 compatible software. Remember that VT220 fonts appear different on the VT320. Fonts designed specifically for the VT320 should use values 5 through 15.

Pw Font width Selects the number of columns per line (font set size).
0 = 80 columns. (Default)
1 = 80 columns.
2 = 132 columns.
Pt Text or full-cell Defines the font as a text font or full-cell font.
0 = text. (Default)
1 = text.
2 = full cell.

Full-cell fonts can individually address all pixels in a cell.

Text fonts cannot individually address all pixels. If you specify a text cell, the terminal automatically performs spacing and centering of the characters.

Pcmh Character matrix height Selects the maximum character cell height.
0 or omitted = 12 pixels high. (Default)
1 = 1 pixel high.
2 = 2 pixels high.
3 = 3 pixels high.
.
.
12 = 12 pixels high.

Pcmh values over 12 are illegal. If the value of Pcmw is 2, 3 or 4, Pcmh is ignored.

Pcss Character set size Defines the character set as a 94- or 96-character graphic set.
0 = 94-character set. (Default)
1 = 96-character set.

The value of Pcss changes the meaning of the Pcn (starting character) parameter above.

If Pcss = 0 (94-character set)

The terminal ignores any attempt to load characters into the 2/0 or 7/15 table positions.

Pcn Specifies
1 column 2/row 1
.
.
94 column 7/row 14
If Pcss = 1 (96-character set)
Pcn Specifies
0 column 2/row 0
.
.
95 column 7/row 15

Dscs defines the character set name. You use this name in the select character set (SCS) escape sequence. You use the following format for the Dscs name

I I F

where

Sxbp1 ; Sxbp2 ; ... ; Sxbpn are the sixel bit patterns for individual characters, separated by semicolons (3/11). Your character set can have 1 to 94 patterns or 1 to 96 patterns, depending on the setting of the character set size parameter (Pcss). Each sixel bit pattern is in the following format:

S...S/S...S

where

Valid DECDLD Parameter Combinations

Pcmw Pt Pcmh Pw
80-Column Fonts
0 to 12 0, 1 0 to 12 0, 1
0 to 15 2 0 to 12 0, 1
132-Column Fonts
0 to 7 0, 1 0 to 12 2
0 to 9 2 0 to 12 2

Clearing a Soft Character Set

You can clear a soft character set that you loaded into the terminal by using the following DECDLD control string.

DCS 1;1;2 { sp @ ST

Any of the following actions also clear the soft character set:

6 Screen Display Commands

Display Control Functions

Name Mnemonic Sequence
Send/receive mode SRM Set: CSI 12 h
Local echo off.
Reset: CSI 12 l*
Local echo on. (D)
Screen mode DECSCNM Set: CSI ? 5 h
Light background.
Reset: CSI ? 5 l*
Dark background. (D)
Scrolling mode DECSCLM Set: CSI ? 4 h
Smooth scroll. (D)
Reset: CSI ? 4 l*
Jump scroll.
Select active status display† DECSASD CSI Ps $ }
Ps = 0, main display.
Ps = 1, status line.
Select status line type† DECSSDT CSI Ps $ ~
Ps = 0, none.
Ps = 1, indicator.
Ps = 2, host-writable.
(D) = default.
* The last character in the sequence in a lowercase L.
† Available in VT300 mode only.

Format Sequences

Name Mnemonic Sequence
Column mode DECCOLM Set: CSI ? 3 h
132 columns.
Reset: CSI ? 3 l*
80 columns. (D)
Set top and bottom margins DECSTBM CSI Pt ; Pb r
Pt = top line.
Pb = bottom line.
Origin mode DECOM Set: CSI ? 6 h
Move within margins.
Reset: CSI ? 6 l*
Move outside margins. (D)
(D) = default.
* The last character in the sequence in a lowercase L.

7 Visual Character and Line Attributes

Character and Line Attribute Sequences

Name Mnemonic Sequence
Select graphic rendition SGR CSI Ps...Ps m
Ps = character attribute value(s).
(See list below.)
Single-width, single-height line DECSWL ESC # 5
Double-width, single-height line DECDWL ESC # 6
Double-width, double-height line DECDHL ESC # 3 (top half)
ESC # 4 (bottom half)

Visual Character Attribute Values

Ps Attribute
VT300 and VT100 Modes
0 All attributes off
1 Bold
4 Underline
5 Blinking
7 Reverse video
VT300 Mode Only
22 Bold off
24 Underline off
25 Blinking off
27 Reverse video off

8 Editing

Inserting and Deleting Text

Name Mnemonic Sequence
Insert/replace mode IRM Set: CSI 4 h
Insert characters.
Reset: CSI 4 l*
Replace characters.
Delete line DL CSI Pn M
Pn lines.
Insert line IL CSI Pn L
Pn lines.
Delete character DCH CSI Pn P
Pn characters.
Insert character† ICH CSI Pn @
Pn characters.
(D) = default
* The last character in the sequence in a lowercase L.
† Available in VT300 mode only.

Erasing Text

Name Mnemonic Sequence
Erase in display ED CSI Ps J
Ps = 0, cursor to end. (D)
Ps = 1, beginning to cursor.
Ps = 2, complete display.
Erase in line EL CSI Ps K
Ps = 0, cursor to end. (D)
Ps = 1, beginning to cursor.
Ps = 2, complete line.
Erase character† ECH CSI Pn X
Pn characters.
(D) = default
* Available in VT300 mode only.

Selectively Erasing Text

Name Mnemonic Sequence
Select character attribute* DECSCA CSI Ps " q
Ps = 0 or 2, erasable
Ps = 1, not erasable
Selective erase in display* DECSED CSI ? Ps J
Ps = 0, cursor to end. (D)
Ps = 1, beginning to cursor.
Ps = 2, complete display.
Selective erase in line* DECSEL CSI ? Ps K
Ps = 0, cursor to end. (D)
Ps = 1, beginning to cursor.
Ps = 2, complete line.
(D) = default
* Available in VT300 mode only.

9 Controlling the Cursor

Enabling the Cursor

Name Mnemonic Sequence
Text cursor enable mode DECTCEM Set: CSI ? 25 h
Visible cursor. (D)
Reset: CSI ? 25 l*
Invisible cursor.
(D) = default.
* The last character in the sequence is a lowercase L.

Moving the Cursor*

Name Mnemonic Sequence
Cursor position CUP CSI Pl ; Pc H
Line Pl, column Pc.
Horizontal and vertical position HVP CSI Pl ; Pc f
Line Pl, column Pc.
Cursor forward CUF CSI Pn C
Pn columns right.
Cursor backward CUB CSI Pn D
Pn columns left.
Cursor up CUU CSI Pn A
Pn lines up.
Cursor down CUD CSI Pn B
Pn lines down.
(D) = default.
* In these sequences, the default value for Pn, Pl, and Pc is 1.

10 Keyboard and Printing Commands

Keyboard Control Sequences

Mode Mnemonic Sequence
Set Reset
Keyboard action mode KAM CSI 2 h
Locked.
CSI 2 l*
Unlocked. (D)
Line feed/ new line mode LNM CSI 20 h
New line.
CSI 20 l*
Line feed. (D)
Autorepeat mode DECARM CSI ? 8 h
Repeat. (D)
CSI ? 8 l*
No repeat.
Autowrap mode DECAWM CSI ? 7 h
Autowrap.
CSI ? 7 l*
No autowrap. (D)
Cursor keys mode DECCKM CSI ? 1 h
Application.
CSI ? 1 l*
Cursor. (D)
Keypad application/ numeric modes DECKPAM
DECKPNM
ESC =
Application.
ESC >
Numeric. (D)
Keyboard usage mode DECKBUM CSI ? 68 h
Data processing.
CSI ? 68 l*
Typewriter. (D)
(D) = default.
* The last character in the sequence is a lowercase L.

Programming UDKs

Definable Keys

DECUDK Device Control String Format

DCS Pc ; Pl | Ky1/St1; ... Kyn/Stn ST

Pc is the clear parameter.
0 or none = Clear all keys before loading new values (default).
1 = Clear one key at a time, before loading a new value.
Pl is the lock parameter.
0 or none = Lock the keys.
1 = Do not lock the keys. (D)

Ky1/St1;...Kyn/Stn are the key definition strings.

The key selector number (Kyn) indicates which key you are defining.

Key Value Key Value Key Value
F6 17 F11 23 Do 29
F7 18 F12 24 F17 31
F8 19 F13 25 F18 32
F9 20 F14 26 F19 33
F10 21 Help 28 F20 34

The string parameters (Stn) are the key definitions, encoded as pairs of hex codes.

3/0 through 3/9 (0 through 9)

4/1 through 4/6 (A through F)

6/1 through 6/6 (a through f)

Printing Control Sequences

Name Mnemonic Sequence
Printer extent mode DECPEX Set: CSI ? 19 h
Screen.
Reset: CSI ? 19 l
Scrolling region. (D)
Print form feed mode DECPFF Set: CSI ? 18 h
Form feed.
Reset: CSI ? 18 l*
No form feed. (D)
Auto print mode MC On: CSI ? 5 i
Off: CSI ? 4 i
Printer controller mode MC On: CSI 5 i
Off: CSI 4 i
Print screen MC CSI i or CSI 0 i
Print cursor line MC CSI ? 1 i
(D) = default.
* The last character in the sequence is a lowercase L.

11 Reports

Sequences for VT320 Reports

Primary Device Attributes
Name Mnemonic Sequence
Primary DA request
(Host to VT320)
DA CSI c or CSI 0 c
Primary DA response
(VT320 to Host)
DA CSI ? Psc; Ps1; ... Psn c
Psc = operating level.
61 = level 1 (VT100 mode).
62,63 = level 3 (VT300 mode).
Ps1...Psn = extensions.
1 = 132 columns.
2 = printer port.
6 = selective erase.
7 = soft character set.
8 = user-defined keys.
9 = NRC sets.
See Table 1 in this section.
Secondary Device Attributes
Name Mnemonic Sequence
Secondary DA request
(Host to VT320)
DA CSI > c or CSI > 0 c
Secondary DA response
(VT320 to Host)
DA CSI > Pp ; Pv ; Po c
Pp = identification code.
24 = VT320 terminal.
Pv = firmware version.
Po = hardware options.
0 = no options.
Device Status Reports
Name Mnemonic Sequence
VT320 Operating Status
Request
(Host to VT320)
DSR CSI 5 n
Report
(VT320 to Host)
DSR CSI 0 n
No malfunction.
CSI 3 n
Malfunction.
Cursor Position Report
Request
(Host to VT320)
DSR CSI 6 n
Report
(VT320 to Host)
CPR CSI Pl; Pc R
Pl = line number.
Pc = column number.
Printer Status
Request
(Host to VT320)
DSR CSI ? 15 n
Report
(VT320 to host)
DSR CSI ? 13 n
No printer.
CSI ? 10 n
Printer ready.
CSI ? 11 n
Printer not ready.
UDK Status (VT300 Mode Only)
Name Mnemonic Sequence
Request
(Host to VT320)
DSR CSI ? 25 n
Report
(VT320 to host)
DSR CSI ? 20 n
UDKs unlocked.
CSI ? 21 n
UDKs locked.
Keyboard Dialect
Name Mnemonic Sequence
Request
(Host to VT320)
DSR CSI ? 26 n
Report
(VT320 to host)
DSR CSI ? 27; Pd n
Pd = keyboard dialect.
1 = North American.
2 = British.
3 = Flemish.
4 = French Canadian.
5 = Danish.
6 = Finnish.
7 = German.
8 = Dutch.
9 = Italian.
10 = Swiss (French).
11 = Swiss (German).
12 = Swedish.
13 = Norwegian.
14 = French/Belgian.
15 = Spanish.
16 = Portuguese.
Terminal State Reports (VT300 Mode Only)
Name Mnemonic Sequence
Request (Host to VT320) DECRQTSR CSI Ps $ u
Ps = report requested.
0 = ignored.
1 = terminal state report.
Terminal state report
(VT320 to host)
DECTSR DCS 1 $ s D...D <checksums 1 and 2> ST
D...D = report data.
Restore terminal state DECRSTS DCS Ps $ p D...D ST
Ps = data string format.
0 = error.
1 = terminal state report.
D...D = restored data.
Presentation State Reports (VT300 Mode Only)
Name Mnemonic Sequence
Request
(Host to VT320)
DECRQPSR CSI Ps $ w
Ps = report requested.
0 = error.
1 = cursor information report.
2 = tab stop report.
Cursor information report
(VT320 to Host)
DECCIR DCS 1 $ u D...D ST

D...D = data string. See text for description.

Tab stop report
(VT320 to host)
DECTABSR DCS 2 $ u D...D ST
D...D = tab stops.
Restore presentation state DECRSPS DCS Ps $ t D...D ST
Ps = data string format.
0 = error.
1 = cursor information report.
2 = tab stop report.
D...D = data string.
Mode Settings (VT300 Mode Only)
Name Mnemonic Sequence
Request mode
(Host to VT320)
DECRQM CSI Pa $ p
Pa = ANSI mode. (Table 2)
CSI ? Pd $ p
Pd = DEC private mode. (Table 3)
Report mode
(VT320 to host)
DECRPM CSI Pa; Ps $ y
Pa = ANSI mode. (Table 2)
Ps = mode state.
0 = unknown mode.
1 = set.
2 = reset.
3 = permanently set.
4 = permanently reset.
Set mode SM CSI Pa; ... Pa h
Pa = ANSI mode(s). (Table 2)
CSI ? Pd; ... Pd h
Pd = DEC private mode(s). (Table 3)
Reset mode RM CSI Pa; ... Pa l*
Pa = ANSI mode(s). (Table 2)
CSI ? Pd; ... Pd l*
Pd = DEC private mode(s). (Table 3)
* The last character in the sequence is a lowercase L.
Control Function Settings (VT300 Mode Only)
Name Mnemonic Sequence
Request
(Host to VT320)
DECRQSS DCS $ q D...D ST
D...D = intermediate and/or final characters of function. (Table 4)
Report
(VT320 to host)
DECRPSS DCS Ps $ r D...D ST
Ps = 0, valid request.
Ps = 1, invalid request.
D...D = intermediate and/or final characters of function. (Table 4)
Saving and Restoring the Cursor State
Name Mnemonic Sequence
Save cursor state DECSC ESC 7
Restore cursor state DECRC ESC 8
User-Preferred Supplemental Set (VT300 Mode)
Name Mnemonic Sequence
Request
(Host to VT320)
DECRQUPSS CSI & u
Report
(VT320 to host)
DECAUPSS DCS 0 ! u % 5 ST
DEC Supplemental Graphic
DCS 1 ! u A ST
ISO Latin-1 Supplemental
Table 1 Alias Primary DA Responses from the VT320*
Terminal Identification Sequence Meaning
VT100 DA ESC [ ? 1; 2 c VT100 terminal
VT101 DA ESC [ ? 1; 0 c VT101 terminal
VT102 DA ESC [ ? 6 c VT102 terminal
VT220 DA ESC [ ? 62; 1; 2; 6; 7; 8; 9; 11; 14 c VT220 terminal
* To change these alias responses, you must use the General Set-Up screen. See Chapter 4 of Installing and Using the VT320 Video Terminal.
Table 2 ANSI Modes for DECRQM, DECRPM, SM, and RM
Mode Mnemonic Pa
Keyboard action KAM 2
Control representation CRM* 3
Insert/replace IRM 4
Horizontal editing HEM† 10
Send/receive SRM 12
Line feed/new line LNM 20
* The host cannot change the setting of CRM. You can only change CRM from set-up. If CRM is set, the terminal ignores DECRQM and most other control functions.
† The HEM control function is permanently reset.
Table 3 DEC Private Modes for DECRQM, DECRPM, SM, and RM
Mode Mnemonic Pd
Cursor keys DECCKM 1
ANSI DECANM 2
Column DECCOLM 3
Scrolling DECSCLM 4
Screen DECSCNM 5
Origin DECOM 6
Autowrap DECAWM 7
Autorepeat DECARM 8
Print form feed DECPFF 18
Printer extent DECPEX 19
Text cursor enable DECTCEM 25
National replacement character set DECNRCM 42
Numeric keypad DECNKM 66
Keyboard usage DECKBUM 68
Table 4 Control Functions for DECRQSS Requests
Control Function Mnemonic Intermediate and Final Character(s)
Select active status display DECSASD $ }
Set character attribute DECSCA " q
Set conformance level DECSCL " p
Set status line type DECSSDT $ ~
Set top and bottom margins DECSTBM r
Select graphic rendition SGR m

12 Resetting and Testing

Resetting and Testing Sequences

Name Mnemonic Sequence
Resetting the Terminal
Soft terminal reset* DECSTR CSI ! p
Hard terminal reset RIS ESC c
Not recommended.
Tabulation clear TBC CSI 0 g
Clear tab at cursor position.
CSI 3 g
Clear all tabs.
Testing the Terminal
Invoke confidence test DECTST CSI 4; Ps; Ps; ... y
Power-up self-test.
Screen alignment pattern DECALN ESC # 8
* Available in VT300 mode only.

Soft Terminal Reset (DECSTR) States

Mode Mnemonic State After DECSTR
Text cursor enable DECTCEM Cursor enabled.
Insert/replace IRM Replace.
Origin DECOM Absolute (cursor origin at upper-left of screen).
Autowrap DECAWM No autowrap.
National replacement character set DECNRCM Multinational set.
Keyboard action KAM Unlocked.
Numeric keypad DECKPNM Numeric characters.
Cursor keys DECCKM Normal (arrow keys).
Set top and bottom margins DECSTBM Top margin = 1.
Bottom margin = 24.
All character sets G0, G1, G2, G3, GL, GR VT320 default settings.
Select graphic rendition SGR Normal rendition.
Selective erase attribute DECSCA Normal (erasable by DECSEL and DECSED).
Save cursor state DECSC Home position with VT320 defaults.
Assign user-preferred supplemental set DECAUPSS Set selected in set-up.
Select active display DECSASD Main display (first 24 lines).

Effects of a Hard Terminal Reset (RIS)

Invoke Confidence Test (DECTST) -- Power Up Self-Test

CSI 4 ; Ps; ... Ps y

where Ps indicates a particular test to run.

Ps Test to Run
0 All tests (1, 2, 3, 6)
1 Power-up self-test
2 RS232 port data loopback test
3 Printer port loopback test
6 RS232 port control line loopback test
7 DEC-423 port loopback test
9 Repeat other tests in the string

Screen Alignment Pattern (DECALN)

ESC # 8
1/11 2/3 3/8

A. VT52 Mode Control Codes

Entering VT52 Mode

CSI ? 2 l*

* The last character in the sequence is a lowercase L.

Exiting VT52 Mode

ESC <

VT52 Escape Sequences

Sequence Action
ESC A Cursor up.
ESC B Cursor down.
ESC C Cursor right.
ESC D Cursor left.
ESC F Enter graphics mode.
ESC G Exit graphics mode.
ESC H Cursor to home position.
ESC I Reverse line feed.
ESC J Erase from cursor to end of screen.
ESC K Erase from cursor to end of line.
ESC Y Pl Pc Move cursor to line Pl and column Pc.
ESC Z Identify. (host to terminal)
ESC / Z Report. (terminal to host)
ESC = Enter alternate keypad mode.
ESC > Exit alternate keypad mode.
ESC < Exit VT52 mode. (Enter VT100 mode.)
ESC ^ Enter autoprint mode.
ESC _ Exit autoprint mode.
ESC W Enter printer controller mode.
ESC X Exit printer controller mode.
ESC ] Print screen.
ESC V Print the line with the cursor.