VT220 Programmer Reference Manual

3 Transmitted Codes

3.1 General

This chapter describes the codes that the terminal sends to a program. The chapter assumes that you are familiar with the character encoding concepts described in Chapter 2.

Key codes generated in VT52 mode are listed if they differ from those generated in the ANSI-compatible (VT200 and VT100) modes.

The terminal can use 15 different national keyboards. This chapter describes significant differences among the keyboards.

3.2 Keyboard Codes

The terminal keyboard (Figure 3-1) consists of a main keypad, an editing keypad, an auxiliary keypad, and the top-row function keys.

VT220 Keyboard HoldScreen PrintScreen Set-Up Data/Talk Break F6 F7 F8 F9 F10 F11(ESC) F12(BS) F13(LF) F14 Hold Screen Lock Compose Wait F17 F18 F19 F20 Help Do `~ 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ Find InsertHere Re-move PF1 PF2 PF3 PF4 Tab Q W E R T Y U I O P [{ ]} Return Select PrevScreen NextScreen 7 8 9 - Ctrl Lock A S D F G H J K L ;: '" \| 4 5 6 , Shift <> Z X C V B N M ,, .. /? Shift 1 2 3 Enter ComposeCharacter 0 . TOP ROWFUNCTION KEYS MAINARRAY EDITINGKEYPAD AUXILIARYKEYPAD MA-0967-83
Figure 3-1 Key Groupings (North American Keyboard)

3.2.1 Main Keypad

The main keypad consists of standard keys (used to generate letters, numbers, and symbols) and function keys (used to generate special function codes).

3.2.1.1 Standard Keys

The standard keys generate alphanumeric characters, either singly or in combination with other keys.

On the North American keyboard, the standard keys show only ASCII characters and generate only ASCII codes. There are no DEC supplemental characters among the standard keys. This is a special case, since most keyboards have some standard keys that generate DEC supplemental characters as well as ASCII characters.

The standard-key patterns vary among keyboards. Some graphic characters (either special symbols or characters with diacritical marks) may or may not be available as standard keys on particular keyboards. However, you can create any DEC multinational graphic character that is not available on a standard key, by typing a valid compose sequence.

Regardless of which keyboard you use and how you create a graphic character, each character is represented by a unique code. The code is based on the character's position in the code table. You can use all GL characters in both 7-bit (VT52 mode, VT100 mode, or 7-bit host line) and 8-bit (VT200 mode, 8-bit host line) environments. You can only use GR characters in an 8-bit environment.

All keyboards (except the North American Keyboard) have one or more standard keys that send different graphic characters (and corresponding codes). The graphic character sent depends on whether you selected "Typewriter Keys" or "Data Processing Keys" in the Keyboard Set-Up screen. (See Figure 3-2 for an example).

All keys affected by "Typewriter Keys" or "Data Processing Keys" have more than two characters shown on their keycaps. The key sends the character on the right side of the keycap when you select "Data Processing Keys", and the character on the left side of the keycap when you select "Typewriter Keys". You can select either shifted (upper) or unshifted (lower) character codes for these keys in the same way as for other nonalphabetic keys.

Figure 3-2 French/Belgian Keyboard

3.2.1.2 Function Keys

This section describes the main keypad function keys. The column/row notation used in the descriptions refers to Table 2-1.

Key Function
<X] The <X] (Delete) key sends a DEL character (7/15).
Tab The Tab key sends an HT character (0/9).
Return The Return key sends either a CR character (0/13) or a CR character (0/13) and an LF character (0/10), depending on the set/reset state of line feed/new line mode (LNM). (See Chapter 4).
Ctrl The Ctrl key alone does not send a code. It is always used in combination with another key to send a control code.
Lock The Lock key alone does not send a code. It is used in combination with the "Caps Lock" and "Shift Lock" field selected in the Keyboard Set-Up screen. Lock sets or clears the "Caps Lock" (or "Shift Lock") state.
Shift
(2 keys)
The Shift key alone does not send a code. It is used in combination with other standard keys to generate uppercase characters. Shift is also used in combination with nonalphabetic keys to send the top character shown on those keys.
Space bar The space bar sends an SP character (2/0).
Compose Character The Compose Character key does not send a code. Pressing Compose Character starts a compose sequence, which is used to create characters that cannot be typed directly from the keyboard.

3.2.2 Editing Keypad

The editing keypad includes editing keys and cursor control keys. Table 3-1 defines the codes generated by the editing keys, and Table 3-2 defines the codes sent by the cursor control keys.

Table 3-1 Codes Generated by Editing Keys
Code Generated
Key VT200 Mode VT100, VT52 Modes
FIND
9/11 3/1  7/14
CSI  1    ~
--
INSERT HERE
9/11 3/2  7/14
CSI  2    ~
--
REMOVE
9/11 3/3  7/14
CSI  3    ~
--
SELECT
9/11 3/4  7/14
CSI  4    ~
--
PREV SCREEN
9/11 3/5  7/14
CSI  5    ~
--
NEXT SCREEN
9/11 3/6  7/14
CSI  6    ~
--
In VT100 or VT52 modes the editing keys do not generate codes.
Table 3-2 Codes Generated by Cursor Control Keys
ANSI Mode* VT52 Mode*
Key Cursor Key Mode Reset
Normal
Cursor Key Mode Set
(Application)
Normal Application
↑
9/11  4/1
CSI   A
8/15  4/1
SS3   A
1/11  4/1
ESC   A
1/11  4/1
ESC   A
↓
9/11  4/2
CSI   B
8/15  4/2
SS3   B
1/11  4/2
ESC   B
1/11  4/2
ESC   B
→
9/11  4/3
CSI   C
8/15  4/3
SS3   C
1/11  4/3
ESC   C
1/11  4/3
ESC   C
←
9/11  4/4
CSI   D
8/15  4/4
SS3   D
1/11  4/4
ESC   D
1/11  4/4
ESC   D
* ANSI mode applies to VT200 and VT100 modes. VT52 mode is an ANSI-incompatible mode.

3.2.3 Auxiliary Keypad

The characters sent by the auxiliary keypad keys depend on the setting of two features, the operating mode (ANSI or VT52) and the keypad (application or numeric) features. The application keypad feature is usually selected only by the computer, but can be selected in the General Set-Up screen. See Chapter 4 for more information about keypad character selection.

Table 3-3 lists the character codes generated by the auxiliary keypad in ANSI (VT100, VT200) mode and in VT52 mode.

Table 3-3 Codes Generated by Auxiliary Keypad Keys
VT100/VT200
ANSI Mode*
VT52 Mode*
Key Keypad
Numeric Mode
Keypad
Application Mode
Keypad
Numeric Mode
Keypad
Application Mode
0
3/0
0
8/15  7/0
SS3   p
3/0
0
1/11  3/15  7/0
ESC   ?     p
1
3/1
1
8/15  7/1
SS3   q
3/1
1
1/11  3/15  7/1
ESC   ?     q
2
3/2
2
8/15  7/2
SS3   r
3/2
2
1/11  3/15  7/2
ESC   ?     r
3
3/3
3
8/15  7/3
SS3   s
3/3
3
1/11  3/15  7/3
ESC   ?     s
4
3/4
4
8/15  7/4
SS3   t
3/4
4
1/11  3/15  7/4
ESC   ?     t
5
3/5
5
8/15  7/5
SS3   u
3/5
5
1/11  3/15  7/5
ESC   ?     u
6
3/6
6
8/15  7/6
SS3   v
3/6
6
1/11  3/15  7/6
ESC   ?     v
7
3/7
7
8/15  7/7
SS3   w
3/7
7
1/11  3/15  7/7
ESC   ?     w
8
3/8
8
8/15  7/8
SS3   x
3/8
8
1/11  3/15  7/8
ESC   ?     x
9
3/9
9
8/15  7/9
SS3   y
3/9
9
1/11  3/15  7/9
ESC   ?     y
-
2/13
- (minus)
8/15  6/13
SS3   m
2/13
-
1/11  3/15  6/13†
ESC   ?     m
,
2/12
, (comma)
8/15  6/12
SS3   l
2/12
,
1/11  3/15  6/12†
ESC   ?     l
.
2/14
. (period)
8/15  6/14
SS3   n
2/14
.
1/11  3/15  6/14
ESC   ?     n
Enter‡
0/13
CR
8/15  4/13
SS3   M
0/13
CR
1/11  3/15  4/13
ESC   ?     M
or
0/13  0/10
CR    LF
or
0/13  0/10
CR    LF
PF1
8/15  5/0
SS3   P
8/15  5/0
SS3   P
1/11  5/0
ESC   P
1/11  5/0
ESC   P
PF2
8/15  5/1
SS3   Q
8/15  5/1
SS3   Q
1/11  5/1
ESC   Q
1/11  5/1
ESC   Q
PF3
8/15  5/2
SS3   R
8/15  5/2
SS3   R
1/11  5/2
ESC   R
1/11  5/2
ESC   R
PF4
8/15  5/3
SS3   S
8/15  5/3
SS3   S
1/11  5/3
ESC   S
1/11  5/3‡
ESC   S
* ANSI mode applies to VT200 and VT100 modes. VT52 mode is an ANSI-incompatible mode.
You cannot generate these sequences on a VT52 terminal.
Keypad Numeric Mode. ENTER generates the same codes as RETURN. You can change the code generated by RETURN with the Linefeed/New Line Mode. When reset, the Linefeed/New Line Mode causes RETURN to generate a single control character (CR). When set, the mode causes RETURN to generate two control characters (CR, LF).

3.2.4 Top-Row Function Keys

There are 20 top-row function keys, F1 through F20. The first five keys (F1 through F5) labeled Hold Screen, Print Screen, Set-Up, Data/Talk, and Break, do not send codes; they are local function keys. Keys F6 through F20 send the codes defined in Table 3-4.

Table 3-4 Codes Generated by Top Row Function Keys
Code Generated
Name on Legend Strip Generic Name VT200 Mode VT100, VT52 Modes
HOLD SCREEN (F1)* -- --
PRINT SCREEN (F2)* -- --
SET-UP (F3)* -- --
DATA/TALK (F4)* -- --
BREAK (F5)* -- --
F6 F6
9/11  3/1   3/7  7/14
CSI   1     7    ~
--
F7 F7
9/11  3/1   3/8  7/14
CSI   1     8    ~
--
F8 F8
9/11  3/1   3/9  7/14
CSI   1     9    ~
--
F9 F9
9/11  3/2   3/0  7/14
CSI   2     0    ~
--
F10 F10
9/11  3/2   3/1  7/14
CSI   2     1    ~
--
F11 (ESC) F11
9/11  3/2   3/3  7/14
CSI   2     3    ~
1/11
ESC
F12 (BS) F12
9/11  3/2   3/4  7/14
CSI   2     4    ~
0/8
BS
F13 (LF) F13
9/11  3/2   3/5  7/14
CSI   2     5    ~
0/10
LF
F14 F14
9/11  3/2   3/6  7/14
CSI   2     6    ~
--
HELP (F15)
9/11  3/2   3/8  7/14
CSI   2     8    ~
--
DO (F16)
9/11  3/2   3/9  7/14
CSI   2     9    ~
--
F17 F17
9/11  3/3   3/1  7/14
CSI   3     1    ~
--
F18 F18
9/11  3/3   3/2  7/14
CSI   3     2    ~
--
F19 F19
9/11  3/3   3/3  7/14
CSI   3     3    ~
--
F20 F20
9/11  3/3   3/4  7/14
CSI   3     4    ~
--
* F1 through F5 are local function keys and do not generate codes.

3.2.5 Control Codes

Table 3-5 lists the keys and key combinations used to send control codes. These keys and combinations are valid on all keyboards. The control codes are C0 7-bit control characters; there is no similar mechanism for sending C1 8-bit control characters.

Table 3-5 Keys Used to Generate 7-Bit Control Characters
Control Character Mnemonic Code Key Pressed with CTRL (All Modes) Dedicated Function Key
NUL 0/00 2, space
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,[ F11 (ESC)*
FS 1/12 4,/
GS 1/13 5,]
RS 1/14 6,~
US 1/15 7,?
DEL 7/15 8 DELETE
* Keys F11, F12, and F13 generate these 7-bit control characters only when the terminal is operated in VT100 mode or VT52 mode.
** These keystrokes are enabled only if XOFF support is disabled. If XOFF support is enabled, then CTRL-S is a "hold screen" local function and CTRL-Q is an "unhold screen" local function.

3.3 Enabling and Disabling Auto Repeat

You can enable and disable the auto repeat feature from the keyboard, using the Keyboard Set-Up screen or the DECARM escape sequence (Chapter 4). If the terminal receives the DECARM sequence to turn auto repeat off while an auto repeat is in progress, the key stops auto repeating. If the terminal receives the escape sequence to turn auto repeat on while a key that has been auto repeating is still held down, the key immediately auto repeats. Keys which can auto repeat usually start auto repeating after a delay of 0.5 seconds.

The auto repeat speed is a function of the host transmit speed. This gives a constant repeat rate at all transmit speeds. At speeds of 2400 baud or above, all keys auto repeat at 30 keystrokes per second. For the purpose of the auto repeat feature, the keyboard is divided into the following three groups.

    Group A  Main typing array
    Group B  Cursor keys and keypad keys
    Group C  Top-row function keys and editing keys

Every key in each group auto repeats at the fixed rate set by the transmit speed, regardless of how many codes the key actually sends.

Host Transmit Speed (Baud) Auto Repeat Rate (Keys/Sec)
Group A Group B Group C
>=2400 30 30 30
1200 30 30 24
600 30 20 12
300 30 12 12
150 6 6 6
110 6 6 6
75 6 6 6

In general, the "Transmit Rate Limit" feature (in the Communications Set-Up screen) does not affect auto repeat rates, since all 5 codes can be sent at the limited speed of 150 characters per second at most baud rates. In local mode, keys will auto repeat at 30 keystrokes per second.

The following keys do not auto repeat: Hold Screen, Print Screen, Set-Up, Data/Talk, Break, Compose Character, Shift, Return, Lock, and Ctrl. Shifted or controlled keys will auto repeat.

3.4 Keyboard Lock and Unlock

The following conditions may cause the keyboard to lock.

When the keyboard is locked, all keyboard keys except Hold Screen, Print Screen, Set-Up, Data/Talk, and Break are disabled, and the keyboard Wait indicator turns on.

If the keyboard is locked, any of the following events can unlock it.