The cursor code strings are expressions which produce the control and escape sequences used by the terminal being defined. The expressions are similar to mvBASIC syntax, except that a blank can be used between elements in the expressions as well as a colon. Cursor code strings can consist of the following, separated by blanks or colons:
Defined control character (e.g., ESC, BS, DEL, etc.).
String literal in quotes (e.g., "A", '[0', etc.).
Character function (e.g., CHAR(21)).
Hexadecimal string (e.g., HEX(1B41)).
String function (e.g., STR(NUL,5) or STR(CHAR(12),X)).
Cursor address variable (e.g., X, Y, or Z).
The cursor address variables (X, Y, Z) cause the specified address (byte or decimal string) to be inserted into the control string at the specified position). The variable X contains the column, Y contains the row, and Z contains the row previously referenced in an @(X,Y) code (or zero if the last reference was @(-1) or @(-2).
A plus sign (+) can follow a cursor address variable to increase its value by 1. This allows for terminals which address the upper-left corner of the screen as 1,1 instead of 0,0, but do not offer a column-only addressing code. For example, if the terminal offered a forward cursor feature by the use of a CHAR(6), a column-only addressing code could be emulated by the code:
CR STR(CHAR(6),X+) |
The symbolic name for the control codes and their decimal and hexadecimal equivalents are shown in the table below. Any of these codes can be included in the cursor code string. It is often easier to reference the backspace character as BS instead of CHAR(8), or NUL instead of CHAR(0).
CODE |
DEC |
HEX |
|
CODE |
DEC |
HEX |
NUL |
0 |
00 |
|
DC1 |
17 |
11 |
SOH |
1 |
01 |
|
DC2 |
18 |
12 |
STX |
2 |
02 |
|
DC3 |
19 |
13 |
ETC |
3 |
03 |
|
DC4 |
20 |
14 |
EOT |
4 |
04 |
|
NAK |
21 |
15 |
ENQ |
5 |
05 |
|
SYN |
22 |
16 |
ACK |
6 |
06 |
|
ETB |
23 |
17 |
BEL |
7 |
07 |
|
CAN |
24 |
18 |
BS |
8 |
08 |
|
EM |
25 |
19 |
HT |
9 |
09 |
|
SUB |
26 |
1A |
LF |
10 |
0A |
|
ESC |
27 |
1B |
VT |
11 |
0B |
|
FS |
28 |
1C |
FF |
12 |
0C |
|
GS |
29 |
1D |
CR |
13 |
0D |
|
RS |
30 |
1E |
So |
14 |
0E |
|
US |
31 |
1F |
SI |
15 |
0F |
|
SP |
32 |
20 |
DLE |
16 |
10 |
|
DEL |
127 |
7F |
Special Cursor Code Strings
Most of the cursor code strings are self-explanatory and consist of control characters, escape sequences, and other obvious codes. Some of the code strings—column-only cursor positioning, clear screen and home, and embedded visual attributes—are not as obvious, and require further explanation.
Column-only Cursor Positioning
Many terminals do not support this function. There are, however, three ways to simulate it. Terminals which do support column-only cursor positioning, such as ADDS, can use the terminal’s normal control sequence, which is (CHAR(16) X).
Terminals which do not support column-only cursor positioning can do one of the following:
The cursor can be positioned to column zero of the current line (carriage return), followed by a cursor-right code for the number of columns required (e.g., CR STR(CHAR(12),X)).
A variation of 1 can be used by VT-100 type terminals. Use a sequence such as CR ESC "[" X "C" BS, where the decimal value of X is part of the cursor-right escape sequence.
This option is less desirable but may work in some cases. Use the dummy cursor address variable Z in place of the Y address in a normal X-Y cursor address code (e.g., ESC "=" Z X).
Clear Screen and Home @(-1)
This code can consist of two different terminal control sequences, one for clear screen and one for home. This is the case for VT-100 type terminals. Many other terminals combine these into one control sequence.
Embedded Visual Attributes @(-99)
This code normally disables pagination and clears the system’s line counter. It retains that function but also passes a value back to the user program which defines whether the terminal uses embedded (1) or non-embedded (0) visual attributes. This is important for application programs that require precise screen layout. If a terminal has embedded attributes (a screen location is required to turn the attribute on, and one is required to turn the attribute off), respond YES to the prompt for this field.
NOTE |
Because of this modification, if the @(-99) function is used to turn off pagination, it should be used in a variable assignment statement (DUMMY = @(-99)) instead of a print statement (PRINT @(-99)). |
See Also
Configuring and Using Terminals
Setting Terminal Characteristics
Selecting and Defining Terminal Types
Defining Your Own Terminal Types