ANSI-BBS2 Control Sequences List

Control Sequences:

Control Sequence Format

Control sequences make up the bulk of the ANSI-BBS spec. And contain four distinct parts which are, in order:

Control Sequence Introducer (CSI)
The two-character CSI consists of the ESC character (0x1b) followed by the '[' character (0x5b)
Parameter Bytes (PBs)
Parameter bytes consist of zero of more of the characters from '0' (0x30) to '?' (0x3f)
Intermediate Bytes (IBs)
Intermediate bytes consist of zero or more of the charaters from ' ' (0x20) to '/' (0x2f)
Final Byte (FB)
The final byte consists of one of the characters from '@' (0x40) to '~' (0x7e)

All control sequences begin with a CSI, are followed by a series of zero or more PBs which are followed by zero or more IBs and terminated with a FB. The IBs and the FB together make a string which defines the Control Function CF.

Parameter Byte Formats

If a parameter byte string consists of only characters from '0' to ';' inclusive ("0123456789:;") then it is interpreted as a list of semi-colon (';') separated numeric values. The meaning of a colon in a value must be defined by the control function. If it is not so defined, anything between a colon and the end of that sub-parameter is ignored (ie: up to the next semi-colon, IB, or FB).

If a parameter byte string begins with one of the chrarcters from '<' to '?' inclusive ("<=>?") then it is part of an extension which will be defined in another document.

If a parameter byte string begins with one of the characters from '0' to ';' inclusive ("01234567890:;") but contains one of the characters from '<' to '?' ("<=>?"), it is deemed to be an illegal sequence and should be handled accordingly.

Unhandled sequences

If a legal sequence which the terminal does not support is encountered, that sequence should be silently ignored. If one item in a parameter list is not handled, only that single unhandled parameter should be ignored. All other parameters from the list should be handled.

Illegal sequences

An illegal sequence is defined as:

  1. A sequence which begins with a CSI but has any IB character before any PB character.
  2. A sequence which begins with a CSI and contains a character which is not a legal PB, IB, or FB
  3. A sequence which begins with a CSI, is followed by a PB from the set of charaters from '0' to ';' inclusive, and contains a PB from the set of characters from '<' to '?' inclusive.

When an illegal sequence is encountered, the terminal should attempt to make this known to the user in some manner. Commonly all or part of the sequence itself is displayed, however, the effects on the local screen and terminal state are not defined by this standard.

Defined Control Sequences (in alphabetical order by FB)

Please feel free to comment on this item.

The following is a list of all defined control sequences for ANSI-BBS conformance. Parameters will be indicated by one of:

IBs and FBs will be shown Like this.

Please feel free to comment on this item.

CSIp1 @
Scroll Left (SL)
Intermediate Bytes: 0x20 (space)
Defaults: p1 = 1
Scrolls all text on the screen left p1 columns. New columns emptied at the right are filled with the current attribute.
Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1 A
Scroll Right (SR)
Intermediate Bytes: 0x20 (space)
Defaults: p1 = 1
Scrolls all text on the screen right p1 columns. New columns emptied at the left are filled with the current attribute.
Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1@
Insert Character (ICH)
Defaults: p1 = 1
Moves text from the current position to the right edge p1 characters to the right, with rightmost charaters going off-screen and the resulting hole being filled with the current attribute.
Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1A
Cursor Up (CUU)
Defaults: p1 = 1
Moves the cursor position up p1 lines from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary.
Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1B
Cursor Down (CUD)
Defaults: p1 = 1
Moves the cursor position down p1 lines from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary.
Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1C
Cursor Right (CUF)
Defaults: p1 = 1
Moves the cursor position right p1 columns from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary.
Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1D
Cursor Left (CUB)
Defaults: p1 = 1
Moves the cursor position left p1 columns from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary.
Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1;p2H
CSIp1;p2f
Cursor Position (CUP)
Defaults: p1 = 1 p2 = 1
Moves the cursor to the p2th column of the p1th line.
The for with a FB of f is highly discouraged. Whenever feasible, it is reccomended that this be converted to a FB of H. The f for is supposed to effect the data position, not the presentation position. As the presentation position is what we are actually changing, this is incorrect usage. However, due to legacy reasons, the HVP code should be supported. Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1J (Subject to discussion)
Erase in Page (ED)
Defaults: p1 = 0
Erases from the current screen according to the value of p1
  1. Erase from the current position to the end of the screen.
  2. Erase from the current position to the start of the screen.
  3. Erase entire screen. As a violation of ECMA-048, also moves the cursor to position 1/1 as a number of BBS programs assume this behaviour.
Erased characters are set to the current attribute.
DISCUSSION:
Should ESC 2 J violate the spec?
Source: BANSI.TXT

Please feel free to comment on this item.

CSIp1K
Erase in Line (EL)
Defaults: p1 = 0
Erases from the current line according to the value of p1
  1. Erase from the current position to the end of the line.
  2. Erase from the current position to the start of the line.
  3. Erase entire line.
Erased characters are set to the current attribute.
Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1L
Insert Line (IL)
Defaults: p1 = 1
Inserts p1 lines at the current line position. The current line and those after it are scrolled down and the new empty lines are filled with the current attribute.
Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1M
Delete Line (DL)
Defaults: p1 = 1
Deletes the current line and the p1 - 1 lines after it scrolling the first non-deleted line up to the current line and filling the newly empty lines at the end of the screen with the current attribute. Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1P
Delete Character (DCH)
Defaults: p1 = 1
Deletes the character at the current position by shifting all characters from the current column + p1 left to the current column. Opened blanks at the end of the line are filled with the current attribute.
Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1S
Scroll Up (SU)
Defaults: p1 = 1
Scrolls all text on the screen up p1 lines. New lines emptied at the bottom are filled with the current attribute.
Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1T
Scroll Down (SD)
Defaults: p1 = 1
Scrolls all text on the screen down p1 lines. New lines emptied at the top are filled with the current attribute.
Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1X
Erase Character (ECH)
Defaults: p1 = 1
Erases p1 characters starting at the corrent position. Will not go past the end of the line. Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1Z
Cursor Backward Tabulation (CBT)
Defaults: p1 = 1
Move the cursor to the p1th preceeding tab stop. Will not go past the start of the line. Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1b
Repeat (REP)
Defaults: p1 = 1
The last character recieved is repeated p1 times if it was a normal character. If the last recieved character was a control character, part of a control function, or part of a control sequence, this sequence is ignored. If it occures before the last byte of a control function or sequence, that function or sequence is deemed illegal and not continued after the b.
Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIpXm
Select Graphic Rendition (SGR)
Defaults: pX = 0
Sets or clears one or more text attributes. Unlimited parameters are supported and are applied in received order. The following are supoprted:
Modifies
pXDescriptionBlinkBoldFGBG
0 Default attribute, white on black X X X X
1 Bright Intensity X
2 Dim Intensity X
5 Blink (slow) X
6 Blink (fast) X
7 Negative Image - Reverses FG and BG X X
8 Concealed characters. Sets the FG to the BG X
22 Normal intensity X
25 Steady (not blinking) X
30 Black foreground X
31 Red foreground X
32 Green foreground X
33 Yellow foreground X
34 Blue foreground X
35 Magenta foreground X
36 Cyan foreground X
37 White foreground X
40 Black background X
41 Red background X
42 Green background X
43 Yellow background X
44 Blue background X
45 Magenta background X
46 Cyan background X
47 White background X
Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIp1n
Device Status Report (DSR)
Defaults: p1 = 0
A request for a status report. ANSI-BBS terminals should handle at least the following values for p1
  1. Request active cursor position
    terminal must reply with CSIp1;p2R where p1 is the current line number counting from one, and p2 is the current column.
NOTE: This sequences should not be present in saved ANSI-BBS files
Source: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Please feel free to comment on this item.

CSIs
Save Current Cursor Position
No parameters
Saves the current cursor position for later restoring with CSIu.
Source: DOS ANSI.SYS Documentation

Please feel free to comment on this item.

CSIu
Restore Cursor Position
No parameters
Move the cursor to the last saved position. If no position has been saved, the cursor is not moved.
Source: DOS ANSI.SYS Documentation

Please feel free to comment on this item.