Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ref:cterm [2024/02/09 13:37] – checkpoint deuce | ref:cterm [2024/09/25 23:16] (current) – The wiki sucked... link to new asciidoctor generated page. deuce | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== CTerm ====== | ====== CTerm ====== | ||
- | CTerm is the ANSI parsing code maintained as part of ciolib (and used by SyncTERM). | + | CTerm is the ANSI parsing code maintained as part of ciolib (and used by SyncTERM). |
- | + | ||
- | The text file is still the normative reference, but this may serve as a friendlier source. | + | |
- | + | ||
- | ===== CTerm terminal characteristics ===== | + | |
- | + | ||
- | ==== End of line behaviour (wrapping) ==== | + | |
- | + | ||
- | The cursor is moved to the first character of the next line as soon as a character is written to the last column of the current line, not on the next character. | + | |
- | + | ||
- | There are two settable flags that will impact the default behaviour. | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | If the '' | + | |
- | + | ||
- | Specifically, | + | |
- | '' | + | |
- | + | ||
- | ===== Control Characters ===== | + | |
- | + | ||
- | ^ Name ^ Hex ^ Description ^ | + | |
- | | NUL | '' | + | |
- | | BEL | '' | + | |
- | | BS | '' | + | |
- | | HT | '' | + | |
- | | LF | '' | + | |
- | | CR | '' | + | |
- | | ESC | '' | + | |
- | + | ||
- | ===== Control Codes ===== | + | |
- | + | ||
- | Control codes are in the following format: | + | |
- | '' | + | |
- | + | ||
- | ^ Mnemonic ^ Name ^ Sequence | + | |
- | | NEL | Next Line | '' | + | |
- | | HTS | Set Tab | '' | + | |
- | | RI | Reverse Line Feed | '' | + | |
- | | DCS | Device Control String | + | |
- | | SOS | Start of String | + | |
- | | CSI | Control Sequence Introducer | '' | + | |
- | | ST | String Terminator | + | |
- | | OSC | Operating System Command | + | |
- | | PM | Privacy Message | + | |
- | | APS | Application Program String | + | |
- | | RIS | Reset to Initial State | '' | + | |
- | + | ||
- | ==== Supported DCS string values ==== | + | |
- | === CTerm loadable font === | + | |
- | **Sequence: | + | |
- | Indicates the string is a loadable font. (CTerm 1.213) | + | |
- | + | ||
- | p1 is a font slot number, which must be higher than the last default defined font (See CSI sp D for list of predefined fonts). <b64> is the base64 encoded font data. Font size is deduced from the size of the data. This replaces the now deprecated '' | + | |
- | + | ||
- | === Sixel Sequence === | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Indicates the string is a sixel sequence. | + | |
- | + | ||
- | p1 selects the vertical height of a single pixel. | + | |
- | + | ||
- | Supported values | + | |
- | ^ Value ^ Vertical Size ^ | + | |
- | | 0,1,5,6 | 2 pixels | + | |
- | | 2 | 5 pixels | + | |
- | | 3,4 | 3 pixels | + | |
- | | 7,8,9 | 1 pixel | | + | |
- | + | ||
- | p2 indicates if unset sixels should be set to the current background colour. | + | |
- | + | ||
- | Any additional parameters are ignored. | + | |
- | + | ||
- | The rest of the string is made up of sixel data characters and sixel control functions. | + | |
- | + | ||
- | == Sixel Control Functions == | + | |
- | ^ String | + | |
- | | '' | + | |
- | | '' | + | |
- | | ''# | + | |
- | | ''# | + | |
- | | '' | + | |
- | | '' | + | |
- | + | ||
- | === Request Status String (DECRQSS) === | + | |
- | **Sequence: | + | |
- | pt is the intermediate and/or final characters of a control function to query the status of. The terminal will send a response in the format '' | + | |
- | + | ||
- | p1 is 1 if the terminal supports querying the control function and 0 if it does not. | + | |
- | + | ||
- | pt is the characters in the control function except the CSI characters. | + | |
- | + | ||
- | Currently supported values of p1: | + | |
- | ^ Value ^ Description ^ | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | + | ||
- | === Define Macro (DECDMAC) === | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Sets a macro to be replayed using '' | + | |
- | + | ||
- | p1 is the macro number to set, and make be between 0 and 63 inclusive. | + | |
- | + | ||
- | If p2 is zero, the macro numbered p1 will be deleted. If p2 is one, all macros are deleted. | + | |
- | + | ||
- | If p3 is zero, the macro is defined using ASCII characters (0x20 - 0x7e and 0xa0 - 0xff only) if p3 is one, the macro is defined using hex pairs. | + | |
- | + | ||
- | When the macro is defined using hex pairs, a repeat sequence may be included in the format of '' | + | |
- | + | ||
- | ==== Supported OSC string values ==== | + | |
- | + | ||
- | === Palette Redefinition === | + | |
- | **Sequence: | + | |
- | Specifies one or more palette redefinitions. pX is the palette index, and pY is the colour definition | + | |
- | Color format: '' | + | |
- | + | ||
- | ==== Supported APS string values ==== | + | |
- | + | ||
- | SyncTERM implements the following APS commands: | + | |
- | + | ||
- | === Store File === | + | |
- | **Sequence: | + | |
- | Where Ps1 is a filename and Ps2 is the base64 encoded contents of the file. The named file is stored in the cache directory for the current connection. | + | |
- | + | ||
- | === List Files in Cache === | + | |
- | **Sequence: | + | |
- | List files in cache. | + | |
- | + | ||
- | And additional argument can be specified as a glob(3) pattern (defaults to " | + | |
- | + | ||
- | === Set Font === | + | |
- | **Sequence: | + | |
- | Where Pn is a font slot number (max 255) and Ps is a filename in the cache. | + | |
- | + | ||
- | === Draw PPM === | + | |
- | **Sequence: | + | |
- | Draws a PPM from the cache directory on the screen. Ps2 is the filename and is required. | + | |
- | + | ||
- | ^ Option | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | + | ||
- | The PPM file may be raw (preferred) or text. SyncTERM does not support more than 255 values per colour channel and assumes it is correctly using the BT.709 gamma transfer. | + | |
- | + | ||
- | === Load PPM === | + | |
- | **Sequence: | + | |
- | Loads a PPM to a buffer. | + | |
- | | '' | + | |
- | + | ||
- | === Load PBM === | + | |
- | **Sequence: | + | |
- | Loads a PBM to a buffer. | + | |
- | + | ||
- | === Copy === | + | |
- | **Sequence: | + | |
- | Copies a portion of the screen into an internal buffer for use with the Paste function. | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | + | ||
- | === Paste === | + | |
- | **Sequence: | + | |
- | Pastes from the copied buffer. | + | |
- | | '' | + | |
- | + | ||
- | ===== Control Sequences ===== | + | |
- | Control sequences are in the following format: | + | |
- | '' | + | |
- | There may be multiple characters from the {' | + | |
- | + | ||
- | Legal combinations not handled are silently dropped. | + | |
- | Illegal combinations are displayed. | + | |
- | + | ||
- | ==== Sequence Parameters ==== | + | |
- | Parameters are expressed by the {' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | + | ||
- | If a default is defined, the parameter is optional | + | |
- | + | ||
- | ==== Insert Character(s) (ICH) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Moves text from the current position to the right edge '' | + | |
- | + | ||
- | ==== Scroll Left (SL) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Shifts the contents of the screen left Pn columns(s) with leftmost columns going off-screen and the resulting hole being filled with the current attribute. ECMA-48 | + | |
- | + | ||
- | ==== Cursor Up (CUU) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Moves the cursor position up Pn lines from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary. ECMA-48 | + | |
- | + | ||
- | ==== Scroll Right (SR) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Shifts the contents of the screen right Pn columns(s) with rightmost columns going off-screen and the resulting hole being filled with the current attribute. ECMA-48 | + | |
- | + | ||
- | ==== Cursor Down (CUD) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Moves the cursor position down Pn lines from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary. ECMA-48 | + | |
- | + | ||
- | ==== Cursor Right (CUF) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Moves the cursor position right Pn columns from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary. ECMA-48 | + | |
- | + | ||
- | ==== Cursor Left (CUB) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Moves the cursor position left Pn columns from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary. ECMA-48 | + | |
- | + | ||
- | ==== Font Selection (FNT) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Sets font Ps1 to be the one indicated by Ps2. Currently four fonts are supported. | + | |
- | + | ||
- | Supported Ps1 values: | + | |
- | | 0 | Default font | | + | |
- | | 1 | Font selected by the high intensity bit when '' | + | |
- | | 2 | Font selected by the blink intensity bit when '' | + | |
- | | 3 | Font selected by both the high intensity and blink bits when both CSI ? 31 h and CSI ? 34 h are enabled| | + | |
- | + | ||
- | Currently included fonts are: | + | |
- | | 0 | Codepage 437 English | | + | |
- | | 1 | Codepage 1251 Cyrillic, (swiss) | | + | |
- | | 2 | Russian koi8-r | | + | |
- | | 3 | ISO-8859-2 Central European | | + | |
- | | 4 | ISO-8859-4 Baltic wide (VGA 9bit mapped) | | + | |
- | | 5 | Codepage 866 (c) Russian | | + | |
- | | 6 | ISO-8859-9 Turkish | | + | |
- | | 7 | haik8 codepage (use only with armscii8 screenmap) | | + | |
- | | 8 | ISO-8859-8 Hebrew | | + | |
- | | 9 | Ukrainian font koi8-u | | + | |
- | | 10 | ISO-8859-15 West European, (thin) | | + | |
- | | 11 | ISO-8859-4 Baltic (VGA 9bit mapped) | | + | |
- | | 12 | Russian koi8-r (b) | | + | |
- | | 13 | ISO-8859-4 Baltic wide | | + | |
- | | 14 | ISO-8859-5 Cyrillic | | + | |
- | | 15 | ARMSCII-8 Character set | | + | |
- | | 16 | ISO-8859-15 West European | | + | |
- | | 17 | Codepage 850 Multilingual Latin I, (thin) | | + | |
- | | 18 | Codepage 850 Multilingual Latin I | | + | |
- | | 19 | Codepage 885 Norwegian, (thin) | | + | |
- | | 20 | Codepage 1251 Cyrillic | | + | |
- | | 21 | ISO-8859-7 Greek | | + | |
- | | 22 | Russian koi8-r (c) | | + | |
- | | 23 | ISO-8859-4 Baltic | | + | |
- | | 24 | ISO-8859-1 West European | | + | |
- | | 25 | Codepage 866 Russian | | + | |
- | | 26 | Codepage 437 English, (thin) | | + | |
- | | 27 | Codepage 866 (b) Russian | | + | |
- | | 28 | Codepage 885 Norwegian | | + | |
- | | 29 | Ukrainian font cp866u | | + | |
- | | 30 | ISO-8859-1 West European, (thin) | | + | |
- | | 31 | Codepage 1131 Belarusian, (swiss) | | + | |
- | | 32 | Commodore 64 (UPPER) | | + | |
- | | 33 | Commodore 64 (Lower) | | + | |
- | | 34 | Commodore 128 (UPPER) | | + | |
- | | 35 | Commodore 128 (Lower) | | + | |
- | | 36 | Atari | | + | |
- | | 37 | P0T NOoDLE (Amiga) | | + | |
- | | 38 | mO' | + | |
- | | 39 | MicroKnight Plus (Amiga) | | + | |
- | | 40 | Topaz Plus (Amiga) | | + | |
- | | 41 | MicroKnight (Amiga) | | + | |
- | | 42 | Topaz (Amiga) | | + | |
- | + | ||
- | Not all fonts are supported in all modes. | + | |
- | + | ||
- | ==== Cursor Next Line (CNL) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Moves the cursor to the first column of the line Pn down from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary. ECMA-48 | + | |
- | + | ||
- | ==== Cursor Preceding Line (CPL) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Moves the cursor to the first column of the row Pn up from the current position. | + | |
- | + | ||
- | ==== Cursor Character Absolute (CHA) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Movies the cursor to column Pn of the current row. ECMA-48 | + | |
- | + | ||
- | ==== Cursor Position (CUP) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Moves the cursor to the Pn2th column of the Pn1th line. ECMA-48 | + | |
- | + | ||
- | ==== Cursor Forward Tabulation (CHT) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Move the cursor to the Pn-th next tab stop. Basically the same as sending TAB Pn times. ECMA-48 | + | |
- | + | ||
- | ==== Erase in Page (ED) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Erases from the current screen according to the value of Ps | + | |
- | | 0 | Erase from the current position to the end of the screen. | | + | |
- | | 1 | Erase from the current position to the start of the screen. | | + | |
- | | 2 | Erase entire screen. | + | |
- | Erased characters are set to the current attribute. ECMA-48 | + | |
- | + | ||
- | ==== Erase in Line (EL) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Erases from the current line according to the value pf Ps | + | |
- | | 0 | Erase from the current position to the end of the line. | | + | |
- | | 1 | Erase from the current position to the start of the line. | | + | |
- | | 2 | Erase entire line.| | + | |
- | Erased characters are set to the current attribute. | + | |
- | + | ||
- | ==== Insert Line(s) (IL) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Inserts Pn lines at the current line position. | + | |
- | + | ||
- | ==== Delete Line(s) / "ANSI Music" (DL) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Deletes the current line and the Pn - 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. If the cursor is not currently inside the scrolling margins, has no effect. If " | + | |
- | + | ||
- | ==== CTerm Set ANSI Music (CTSAM) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Sets the current state of ANSI music parsing. | + | |
- | | 0 | Only '' | + | |
- | | 1 | Both '' | + | |
- | | 2 | '' | + | |
- | + | ||
- | ==== BananaCom ANSI Music (BCAM) ==== | + | |
- | **Sequence: | + | |
- | If " | + | |
- | + | ||
- | ==== Delete Character (DCH) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | 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. | + | |
- | + | ||
- | ==== Scroll Up (SU) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Scrolls the screen up Pn lines. | + | |
- | + | ||
- | ==== XTerm Set or Request Graphics Attribute (XTSRGA) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | If Ps1 is 2, and Ps2 is 1, replies with the graphics screen information in the following format: '' | + | |
- | + | ||
- | ==== Scroll Down (SD) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Scrolls all text on the screen down Pn lines. | + | |
- | + | ||
- | ==== Erase Character (ECH) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Erase p1 characters starting at the current character. | + | |
- | + | ||
- | ==== Cursor Line Tabulation (CVT) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Move the cursor to the Pn-th next tab stop. Basically the same as sending TAB Pn times. ECMA-48 | + | |
- | + | ||
- | ==== Cursor Backward Tabulation (CBT) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Move the cursor to the p1th preceding tab stop. Will not go past the start of the line. ECMA-48 | + | |
- | + | ||
- | ==== Character Position Absolute (HPA) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Move the cursor to the specified position on the current row. Will not go past the end of the line. ECMA-48 | + | |
- | + | ||
- | ==== Cursor Position Forward (HPR) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Moves the cursor position forward Pn columns from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary. ECMA-48 | + | |
- | + | ||
- | ==== Repeat (REP) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Repeats the previous graphic character Pn times. | + | |
- | + | ||
- | ==== Device Attributes (DA) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | If Ps is 0, CTerm will reply with the sequence: '' | + | |
- | + | ||
- | ==== CTerm Device Attributes (CTDA) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | If Pn is 0, CTerm will reply with the sequence: '' | + | |
- | + | ||
- | Possible values for Ps: | + | |
- | | 1 | Loadable fonts are availabe via Device Control Strings | | + | |
- | | 2 | Bright Background (ie: DECSET 32) is supported | | + | |
- | | 3 | Palette entries may be modified via an Operating System Command string | | + | |
- | | 4 | Pixel operations are supported (currently, sixel and PPM graphics) | | + | |
- | | 5 | The current font may be selected via '' | + | |
- | | 6 | Extended palette is available | | + | |
- | | 7 | Mouse is available | | + | |
- | + | ||
- | ==== Line Position Absolute (VPA) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Moves to row specified by Pn. ECMA-48 | + | |
- | + | ||
- | ==== Tab Stop Remove (TSR) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Removes a tab stop at postion Pn. ECMA-48 | + | |
- | + | ||
- | ==== Line Position Forward (VPR) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Moves forward Pn rows. ECMA-48 | + | |
- | + | ||
- | ==== Character and Line Position (HVP) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Moves the cursor to the Pn2th column of the Pn1th line. ECMA-48 | + | |
- | + | ||
- | ==== Tabulation Clear (TBC) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Deletes tab stops according to the values of Ps: | + | |
- | | 0 | Deletes tab stop at current position. | | + | |
- | | 3 | Deletes all tab stops. | | + | |
- | | 5 | Deletes all tab stops. | | + | |
- | ECMA-48 | + | |
- | + | ||
- | ==== Enable DoorWay Mode (BCST) / CTerm Set (CTSET) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Sets the mode specified by Ps | + | |
- | | 4 | Enable Last Column Flag mode (CTELCF) | | + | |
- | | 5 | Enabled Forced Last Column Flag mode (CTFLCF) | | + | |
- | | 255 | Enable DoorWay Mode (BDRWY) | | + | |
- | + | ||
- | ==== DEC Private Mode Set (DECSET) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Sets one or more mode. The following modes are supported: | + | |
- | ^ Value ^ Mnemonic ^ Default ^ Description ^ | + | |
- | | 6 | DECOM | reset | Enable origin mode. In this mode, position parameters are relative to the top left of the scrolling region, not the screen. | | + | |
- | | 7 | DECAWM | + | |
- | | 9 | | reset | X10 compatible mouse reporting. Mouse button presses will send a '' | + | |
- | | 25 | DECTCEM | + | |
- | | 31 | + | |
- | | 32 | + | |
- | | 33 | + | |
- | | 34 | + | |
- | | 35 | + | |
- | | 69 | + | |
- | | 80 | + | |
- | | 1000 | + | |
- | | 1002 | + | |
- | | 1003 | + | |
- | | 1006 | + | |
- | | 2004 | + | |
- | + | ||
- | ==== Character Position Backward (HPB) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Moves the cursor position left Pn columns from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary. ECMA-48 | + | |
- | + | ||
- | ==== Line Position Backward (VPB) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Moves the cursor position up Pn lines from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary. | + | |
- | + | ||
- | ==== Disable DoorWay Mode (BCRST) / CTerm Set (CTRSET) ==== | + | |
- | **Sequence: | + | |
- | **Defaults: | + | |
- | Resets the mode specified by Ps | + | |
- | | 4 | Disable Last Column Flag mode (CTDLCF) | | + | |
- | | 255 | Disable DoorWay Mode (BDDRWY) | | + | |
===== See Also ===== | ===== See Also ===== | ||
* [[: | * [[: | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
{{tag>}} | {{tag>}} | ||