Control Functions


Control functions cause Verastream to perform certain actions, such as move the text cursor, add a line of text, assign character attributes, and change character sets. Typically, the host application sends control functions to Verastream to perform the desired actions. There are three symbols used in this section that describe a sequence:

Control Function Notation

The following notation is used throughout this section:

Single-Character Control Functions

A single-character control function is made up of one control character (in contrast to multiple-character control functions). There are two sets of single-character control functions available on VT200, VT300, and VT400 terminals:

In 7-bit operating environments, C1 characters must be converted to a two-character escape sequence equivalent.

Recognized C0 (7-Bit) Control Characters

The following table lists the C0 control characters that Verastream recognizes. C0 controls can be used in both 7-bit and 8-bit environments. To represent C0 controls in a Verastream macro, use the Chr$(<n>) syntax, where <n> is the decimal value of the C0 control. See the “Decimal” column in the following table:

Name Character Octal Keystroke Action
Null NUL 0 ^@ Ignored when received
Enquiry ENQ 5 ^E Transmits the answerback message
Bell BEL 7 ^G Sounds a bell
Backspace BS 10 ^H Moves cursor left one position on the current line
Horizontal tab HT 11 ^I Moves cursor to the next tab stop, or to the right margin.
Linefeed LF 12 ^J Causes a linefeed or new line operation.
Vertical tab VT 13 ^K Same as linefeed
Form feed FF 14 ^L Same as linefeed
Carriage return CR 15 ^M Moves the cursor to the left margin of the current line
Shift out
(locking shift 1)
SO 16 ^N Maps the G1 character set into GL. G1 is designated by using a Select Character Set (SCS) sequence.
Shift in
(locking shift 0)
SI 17 ^O Maps the G0 character set into GL. G0 is designated by using a Select Character Set (SCS) sequence.
Device control 1 (XON) DC1 21 ^Q Continues sending characters when transmit is set to Xon/Xoff.
Device control 3 (XOFF) DC3 23 ^S Stops sending characters when transmit is set to Xon/Xoff.
Cancel CAN 30 ^X Cancels the sequence when received during an escape or control sequence.
Substitute SUB 32 ^Z Same as cancel;displays a backwards question mark.
Escape ESC 33 ^[ Introduces an escape sequence and cancels any escape sequence or control sequence in progress.
Delete DEL 177 (none) Ignored when received.

Recognized C1 (8-Bit) Control Characters

In 8-bit environments, C1 controls can be sent directly. In a 7-bit environment, you can send an 8-bit C1 control character by converting it to an equivalent 7-bit escape sequence. The 8-bit controls are single character codes (such as CSI), whereas their 7-bit equivalents are two-character sequences (such as ESC[).

To form an equivalent 7-bit escape sequence from an 8-bit control character:

  1. Subtract the hexadecimal value 40 from the C1 control code’s value.

  2. Precede the result with the ESC character.

For example, the IND character (decimal 132) has a hexadecimal value of 84. To convert IND to a 7-bit equivalent, first subtract hexadecimal 40:
84 hex - 40 hex = 44 hex. Hexadecimal 44 is the letter D. Therefore, to represent the IND character in a 7-bit environment, you would use ESCD.

The following table lists the C1 control characters that Verastream recognizes:


Multiple-Character Control Functions

The C0 and C1 codes listed in the Recognized C0 (7-Bit) Control Characters and Recognized C1 (8-Bit) Control Characters tables are single-character control functions, performing simple functions.

Multiple-character control functions, in contrast, can perform many more functions than the C0 and C1 controls, and are formed by a sequence of characters. There are three types of multiple-character control functions, introduced by the following single-character C0 and C1 controls:

Multiple-character control functions include both control characters and normal ASCII text, such as letters, numbers, and punctuation. For example, the multiple character device control string DCSØ!u%5ST assigns a user-preferred supplemental character set.

Escape Sequences

An escape sequence begins with the C0 character ESC (decimal 27). To enter the ESC character in the Design Tool, press the ESC key. After receiving an ESC character, Verastream interprets the next characters as part of the sequence.

Control Sequences

A control sequence begins with the C1 control character CSI (decimal 155). To enter the CSI character in the Design Tool, press the ESC key plus the [ key.

Control sequences usually include variable parameters. The format is:

CSI P...P I...I F

P...P Zero or more parameters. You can have up to 16 parameters per sequence, using a semicolon (;) to separate each one.
I...I Zero or more intermediate characters.
F The final character indicating the end of the control sequence.

For example, the following control sequence sets the scrolling region, where the top margin is at line 7 and the bottom margin is at line 18:


In this example, 7 and 18 are the parameters and r is the final character. This sequence does not have any intermediate characters.

Device Control Strings

A device control string begins with the C1 control character DCS (decimal 144). To enter the CSI character in the Design Tool, press the ESC key plus the P key. Device control strings always include a data string. The format is:

DCS P...P I...I F <data string> ST

P...P Zero or more parameters. You can have up to 16 parameters per sequence, using a semicolon (;) to separate each one.
I...I Zero or more intermediate characters.
F The final character indicating the end of the device control string.
<data string> A data string of zero or more characters. Use a semicolon to separate individual strings. The particular range of characters included in a data string is determined by the individual device control string. Any character except ST (decimal 156) can be included in a data string.

The string terminator. Type Chr$(27)& "Ë for 7-bit mode, or Chr$(156) for the 8-bit equivalent. (You can also press e-\ in the terminal window.)

APC, OSC, and PM

The application program command (APC), operating system command (OSC), and privacy message (PM) are also C1 controls. However, VT terminals—and Verastream—ignore them. The controls have the same format as device control strings and end with an ST. When Verastream receives an APC, OSC, or PM introducer, it discards all following characters until receiving a string terminator (so the whole sequence is discarded).

Interrupting Control Sequences

You can use the following C0 control characters to interrupt a control function or recover from an error:

ESC Cancels a sequence in progress, and begins a new sequence.
CAN Cancels a sequence in progress. Verastream interprets the characters that follow the CAN character as usual.
SUB Same as CAN, except displays a backwards question mark.


Related Topics
Bullet Model debug messages
Bullet Control functions sorted by sequence
Bullet Character mode configuration options