Synchronet v3.19b-Win32 (install) has been released (Jan-2022).

You can donate to the Synchronet project using PayPal.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ref:cterm [2024/02/09 13:37] – checkpoint deuceref:cterm [2024/02/12 10:12] (current) – [DEC Private Mode Set (DECSET)] Add DECBKM deuce
Line 1: Line 1:
 ====== CTerm ====== ====== CTerm ======
-CTerm is the ANSI parsing code maintained as part of ciolib (and used by SyncTERM).  This page is basically a pretty version of the [[https://gitlab.synchro.net/main/sbbs/-/raw/master/src/conio/cterm.txt?ref_type=heads|cterm.txt file in git]], as of 72305c4cfe7afe31064422694beac53a9fe8e5f3+CTerm is the ANSI parsing code maintained as part of ciolib (and used by SyncTERM).  This page is basically a pretty version of the [[https://gitlab.synchro.net/main/sbbs/-/raw/master/src/conio/cterm.txt?ref_type=heads|cterm.txt file in git]], as of 7a8edde4c8ccdedd1556895eec3ed265a4f615bf
  
 The text file is still the normative reference, but this may serve as a friendlier source. The text file is still the normative reference, but this may serve as a friendlier source.
Line 50: Line 50:
 ==== Supported DCS string values ==== ==== Supported DCS string values ====
 === CTerm loadable font === === CTerm loadable font ===
-**Sequence:** ''CTerm:Font:p1:<b64>''\\ +**Sequence:** ''DCS CTerm:Font:p1:<b64> ST''\\ 
 Indicates the string is a loadable font. (CTerm 1.213) Indicates the string is a loadable font. (CTerm 1.213)
  
Line 56: Line 56:
  
 === Sixel Sequence === === Sixel Sequence ===
-**Sequence:** ''[ p1 [ ; p2 ] ] q''\\ +**Sequence:** ''DCS [ p1 [ ; p2 ] ] q ST''\\ 
 **Defaults:**  p1 = 0  p2 = 0\\  **Defaults:**  p1 = 0  p2 = 0\\ 
 Indicates the string is a sixel sequence. Indicates the string is a sixel sequence.
Line 85: Line 85:
  
 === Request Status String (DECRQSS) === === Request Status String (DECRQSS) ===
-**Sequence:** ''$ q pt''\\ +**Sequence:** ''DCS $ q pt ST''\\ 
 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 ''DCS p1 $ r pt ST'' 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 ''DCS p1 $ r pt ST''
  
Line 102: Line 102:
  
 === Define Macro (DECDMAC) === === Define Macro (DECDMAC) ===
-**Sequence:** ''p1 [ ; p2 [ ; p3 ] ! z''\\ +**Sequence:** ''DCS p1 [ ; p2 [ ; p3 ] ! z ST''\\ 
 **Defaults:** p2 = 0  p3 = 0\\  **Defaults:** p2 = 0  p3 = 0\\ 
 Sets a macro to be replayed using ''CSI Pn * z'' Sets a macro to be replayed using ''CSI Pn * z''
Line 117: Line 117:
  
 === Palette Redefinition === === Palette Redefinition ===
-**Sequence:** ''4;(pX;pY)...''\\ +**Sequence:** ''OSC 4;(pX;pY)... ST''\\ 
 Specifies one or more palette redefinitions. pX is the palette index, and pY is the colour definition Specifies one or more palette redefinitions. pX is the palette index, and pY is the colour definition
-Color format: ''rgb:R/G/B'' Where R, G, and B are a sequence of one to four hex digits representing the value of the red, green, and blue channels respectively. xterm+Color format: ''rgb:R/G/B'' Where R, G, and B are a sequence of one to four hex digits representing the value of the red, green, and blue channels respectively.
  
 ==== Supported APS string values ==== ==== Supported APS string values ====
Line 136: Line 136:
  
 === Set Font === === Set Font ===
-**Sequence:** ''APS SyncTERM:C;SetFont Pn Ps''\\ +**Sequence:** ''APS SyncTERM:C;SetFont Pn Ps ST''\\ 
 Where Pn is a font slot number (max 255) and Ps is a filename in the cache.  This sets font slot Pn to use the specified font file. Where Pn is a font slot number (max 255) and Ps is a filename in the cache.  This sets font slot Pn to use the specified font file.
  
 === Draw PPM === === Draw PPM ===
-**Sequence:** ''APS SyncTERM:C;DrawPPM Ps... Ps2''\\ +**Sequence:** ''APS SyncTERM:C;DrawPPM Ps... Ps2 ST''\\ 
 Draws a PPM from the cache directory on the screen. Ps2 is the filename and is required.  Arguments for Ps are optional.  The following options can be included (separated by semi-colons): Draws a PPM from the cache directory on the screen. Ps2 is the filename and is required.  Arguments for Ps are optional.  The following options can be included (separated by semi-colons):
  
Line 161: Line 161:
  
 === Load PPM === === Load PPM ===
-**Sequence:** ''APS SyncTERM:C;LoadPPM Ps... Ps0''\\ +**Sequence:** ''APS SyncTERM:C;LoadPPM Ps... Ps0 ST''\\ 
 Loads a PPM to a buffer.  Ps0 is the filename Loads a PPM to a buffer.  Ps0 is the filename
 | ''B=#'' | Selects the buffer (0 or 1 only) to paste from. | | ''B=#'' | Selects the buffer (0 or 1 only) to paste from. |
  
 === Load PBM === === Load PBM ===
-**Sequence:** ''APS SyncTERM:C;LoadPBM Ps... Ps0''\\ +**Sequence:** ''APS SyncTERM:C;LoadPBM Ps... Ps0 ST''\\ 
 Loads a PBM to a buffer.  Ps0 is the filename Loads a PBM to a buffer.  Ps0 is the filename
  
 === Copy === === Copy ===
-**Sequence:** ''APS SyncTERM:P;Copy Ps...''\\ +**Sequence:** ''APS SyncTERM:P;Copy Ps... ST''\\ 
 Copies a portion of the screen into an internal buffer for use with the Paste function.  Defaults to copying the entire screen. Copies a portion of the screen into an internal buffer for use with the Paste function.  Defaults to copying the entire screen.
 | ''B=#'' | Selects the buffer (0 or 1 only) to copy to. | | ''B=#'' | Selects the buffer (0 or 1 only) to copy to. |
Line 179: Line 179:
  
 === Paste === === Paste ===
-**Sequence:** ''APS SyncTERM:P,Paste Ps...''\\ +**Sequence:** ''APS SyncTERM:P,Paste Ps... ST''\\ 
 Pastes from the copied buffer.  Supports the same options as the Cache DrawPPM command except for the filename, and adds the B= option. Pastes from the copied buffer.  Supports the same options as the Cache DrawPPM command except for the filename, and adds the B= option.
 | ''B=#'' | Selects the buffer (0 or 1 only) to paste from. | | ''B=#'' | Selects the buffer (0 or 1 only) to paste from. |
Line 205: Line 205:
 **Sequence:** ''CSI Pn @''\\  **Sequence:** ''CSI Pn @''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-Moves text from the current position to the right edge ''Pn'' characters to the right, with rightmost characters going off-screen and the resulting hole being filled with the current attribute. ECMA-48+Moves text from the current position to the right edge ''Pn'' characters to the right, with rightmost characters going off-screen and the resulting hole being filled with the current attribute.
  
 ==== Scroll Left (SL) ==== ==== Scroll Left (SL) ====
 **Sequence:** ''CSI Pn SP @''\\  **Sequence:** ''CSI Pn SP @''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-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+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.
  
 ==== Cursor Up (CUU) ==== ==== Cursor Up (CUU) ====
 **Sequence:** ''CSI Pn A''\\  **Sequence:** ''CSI Pn A''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-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+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.
  
 ==== Scroll Right (SR) ==== ==== Scroll Right (SR) ====
 **Sequence:** ''CSI Pn SP A''\\  **Sequence:** ''CSI Pn SP A''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-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+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.
  
 ==== Cursor Down (CUD) ==== ==== Cursor Down (CUD) ====
 **Sequence:** ''CSI Pn B''\\  **Sequence:** ''CSI Pn B''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-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+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.
  
 ==== Cursor Right (CUF) ==== ==== Cursor Right (CUF) ====
 **Sequence:** ''CSI Pn C''\\  **Sequence:** ''CSI Pn C''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-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+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.
  
 ==== Cursor Left (CUB) ==== ==== Cursor Left (CUB) ====
 **Sequence:** ''CSI Pn D''\\  **Sequence:** ''CSI Pn D''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-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+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.
  
 ==== Font Selection (FNT) ==== ==== Font Selection (FNT) ====
Line 293: Line 293:
 | 42 | Topaz (Amiga) | | 42 | Topaz (Amiga) |
  
-Not all fonts are supported in all modes.  If a font is not supported in the current mode, no action is taken, but there should be a non-zero 'Font Selection result' value in the Font State Report. ECMA-48+Not all fonts are supported in all modes.  If a font is not supported in the current mode, no action is taken, but there should be a non-zero 'Font Selection result' value in the Font State Report.
  
 ==== Cursor Next Line (CNL) ==== ==== Cursor Next Line (CNL) ====
 **Sequence:** ''CSI Pn E''\\  **Sequence:** ''CSI Pn E''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-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+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.
  
 ==== Cursor Preceding Line (CPL) ==== ==== Cursor Preceding Line (CPL) ====
 **Sequence:** ''CSI Pn F''\\  **Sequence:** ''CSI Pn F''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-Moves the cursor to the first column of the row Pn up from the current position.  Attempting to move past the screen boundaries stops the cursor at the screen boundary. ECMA-48+Moves the cursor to the first column of the row Pn up from the current position.  Attempting to move past the screen boundaries stops the cursor at the screen boundary.
  
 ==== Cursor Character Absolute (CHA) ==== ==== Cursor Character Absolute (CHA) ====
 **Sequence:** ''CSI Pn G''\\  **Sequence:** ''CSI Pn G''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-Movies the cursor to column Pn of the current row. ECMA-48+Movies the cursor to column Pn of the current row.
  
 ==== Cursor Position (CUP) ==== ==== Cursor Position (CUP) ====
 **Sequence:** ''CSI Pn1 ; Pn2 H''\\  **Sequence:** ''CSI Pn1 ; Pn2 H''\\ 
 **Defaults:** Pn = 1, Pn2 = 1\\  **Defaults:** Pn = 1, Pn2 = 1\\ 
-Moves the cursor to the Pn2th column of the Pn1th line. ECMA-48+Moves the cursor to the Pn2th column of the Pn1th line.
  
 ==== Cursor Forward Tabulation (CHT) ==== ==== Cursor Forward Tabulation (CHT) ====
 **Sequence:** ''CSI Pn I''\\  **Sequence:** ''CSI Pn I''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-Move the cursor to the Pn-th next tab stop. Basically the same as sending TAB Pn times. ECMA-48+Move the cursor to the Pn-th next tab stop. Basically the same as sending TAB Pn times.
  
 ==== Erase in Page (ED) ==== ==== Erase in Page (ED) ====
Line 327: Line 327:
 | 1 | Erase from the current position to the start of the screen. | | 1 | Erase from the current position to the start of the screen. |
 | 2 | Erase entire screen.  As a violation of ECMA-48, also moves the cursor to position 1/1 as a number of BBS programs assume this  behaviour. | | 2 | Erase entire screen.  As a violation of ECMA-48, 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. ECMA-48+Erased characters are set to the current attribute.
  
 ==== Erase in Line (EL) ==== ==== Erase in Line (EL) ====
Line 341: Line 341:
 **Sequence:** ''CSI Pn L''\\  **Sequence:** ''CSI Pn L''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-Inserts Pn 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.  If the cursor is not currently inside the scrolling margins, has no effect. ECMA-48+Inserts Pn 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.  If the cursor is not currently inside the scrolling margins, has no effect.
  
 ==== Delete Line(s) / "ANSI Music" (DL) ==== ==== Delete Line(s) / "ANSI Music" (DL) ====
 **Sequence:** ''CSI Pn M''\\  **Sequence:** ''CSI Pn M''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-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 "ANSI" Music is fully enabled (''CSI = 2 M''), performs "ANSI" music instead. See "ANSI" MUSIC section for more details. ECMA-48, BANSI+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 "ANSI" Music is fully enabled (''CSI = 2 M''), performs "ANSI" music instead. See "ANSI" MUSIC section for more details.
  
 ==== CTerm Set ANSI Music (CTSAM) ==== ==== CTerm Set ANSI Music (CTSAM) ====
Line 358: Line 358:
 ==== BananaCom ANSI Music (BCAM) ==== ==== BananaCom ANSI Music (BCAM) ====
 **Sequence:** ''CSI N''\\  **Sequence:** ''CSI N''\\ 
-If "ANSI" Music is set to BananaCom (''CSI = 1 M'') or fully enabled (''CSI = 2 M'') performs "ANSI" music.  See "ANSI" MUSIC section for more details. BANSI+If "ANSI" Music is set to BananaCom (''CSI = 1 M'') or fully enabled (''CSI = 2 M'') performs "ANSI" music.  See "ANSI" MUSIC section for more details.
  
 ==== Delete Character (DCH) ==== ==== Delete Character (DCH) ====
 **Sequence:** ''CSI Ps P''\\  **Sequence:** ''CSI Ps P''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 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.  If the cursor is not currently inside the scrolling margins, has no effect. ECMA-48+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.  If the cursor is not currently inside the scrolling margins, has no effect.
  
 ==== Scroll Up (SU) ==== ==== Scroll Up (SU) ====
 **Sequence:** ''CSI Ps S''\\  **Sequence:** ''CSI Ps S''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-Scrolls the screen up Pn lines.  New lines emptied at the bottom are filled with the current attribute. ECMA-48+Scrolls the screen up Pn lines.  New lines emptied at the bottom are filled with the current attribute.
  
 ==== XTerm Set or Request Graphics Attribute (XTSRGA) ==== ==== XTerm Set or Request Graphics Attribute (XTSRGA) ====
 **Sequence:** ''CSI ? Ps1 ; Ps2 S''\\  **Sequence:** ''CSI ? Ps1 ; Ps2 S''\\ 
 **Defaults:** None\\  **Defaults:** None\\ 
-If Ps1 is 2, and Ps2 is 1, replies with the graphics screen information in the following format: ''CSI ? 2 ; 0 ; Px ; Py S'' Where Px is the width of the screen in pixels and Py is the height. XTERM+If Ps1 is 2, and Ps2 is 1, replies with the graphics screen information in the following format: ''CSI ? 2 ; 0 ; Px ; Py S'' Where Px is the width of the screen in pixels and Py is the height.
  
 ==== Scroll Down (SD) ==== ==== Scroll Down (SD) ====
 **Sequence:** ''CSI Pn T''\\  **Sequence:** ''CSI Pn T''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-Scrolls all text on the screen down Pn lines.  New lines emptied at the top are filled with the current attribute. ECMA-48+Scrolls all text on the screen down Pn lines.  New lines emptied at the top are filled with the current attribute.
  
 ==== Erase Character (ECH) ==== ==== Erase Character (ECH) ====
 **Sequence:** ''CSI Pn X''\\  **Sequence:** ''CSI Pn X''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-Erase p1 characters starting at the current character.  Will not erase past the end of line. Erased characters are set to the current attribute. This can erase across scroll margins. ECMA-48+Erase p1 characters starting at the current character.  Will not erase past the end of line. Erased characters are set to the current attribute. This can erase across scroll margins.
  
 ==== Cursor Line Tabulation (CVT) ==== ==== Cursor Line Tabulation (CVT) ====
 **Sequence:** ''CSI Pn Y''\\  **Sequence:** ''CSI Pn Y''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-Move the cursor to the Pn-th next tab stop. Basically the same as sending TAB Pn times. ECMA-48+Move the cursor to the Pn-th next tab stop. Basically the same as sending TAB Pn times.
  
 ==== Cursor Backward Tabulation (CBT) ==== ==== Cursor Backward Tabulation (CBT) ====
 **Sequence:** ''CSI Pn Z''\\  **Sequence:** ''CSI Pn Z''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-Move the cursor to the p1th preceding tab stop.  Will not go past the start of the line. ECMA-48+Move the cursor to the p1th preceding tab stop.  Will not go past the start of the line.
  
 ==== Character Position Absolute (HPA) ==== ==== Character Position Absolute (HPA) ====
 **Sequence:** ''CSI Pn `''\\  **Sequence:** ''CSI Pn `''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-Move the cursor to the specified position on the current row. Will not go past the end of the line. ECMA-48+Move the cursor to the specified position on the current row. Will not go past the end of the line.
  
 ==== Cursor Position Forward (HPR) ==== ==== Cursor Position Forward (HPR) ====
 **Sequence:** ''CSI Pn a''\\  **Sequence:** ''CSI Pn a''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-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+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.
  
 ==== Repeat (REP) ==== ==== Repeat (REP) ====
 **Sequence:** ''CSI Pn b''\\  **Sequence:** ''CSI Pn b''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-Repeats the previous graphic character Pn times.  Will not repeat escape sequences. ECMA-48+Repeats the previous graphic character Pn times.  Will not repeat escape sequences.
  
 ==== Device Attributes (DA) ==== ==== Device Attributes (DA) ====
 **Sequence:** ''CSI Ps c''\\  **Sequence:** ''CSI Ps c''\\ 
 **Defaults:** Ps = 0\\  **Defaults:** Ps = 0\\ 
-If Ps is 0, CTerm will reply with the sequence: ''CSI = 67;84;101;114;109;pN c''. ''67;84;101;114;109'' is the ASCII values of the "CTerm" string.  pN is the revision ID of CTerm with dots converted to semi-colons (e.g. "1;156").  Use the revision to detect if a specific feature is available.  If you are adding features to a forked version of cterm, please do so by adding an extra parameter to the end, not by incrementing any existing one! ECMA-48+If Ps is 0, CTerm will reply with the sequence: ''CSI = 67;84;101;114;109;pN c''. ''67;84;101;114;109'' is the ASCII values of the "CTerm" string.  pN is the revision ID of CTerm with dots converted to semi-colons (e.g. "1;156").  Use the revision to detect if a specific feature is available.  If you are adding features to a forked version of cterm, please do so by adding an extra parameter to the end, not by incrementing any existing one!
  
 ==== CTerm Device Attributes (CTDA) ==== ==== CTerm Device Attributes (CTDA) ====
Line 432: Line 432:
 **Sequence:** ''CSI Pn d''\\  **Sequence:** ''CSI Pn d''\\ 
 **Defaults:** Ps = 1\\  **Defaults:** Ps = 1\\ 
-Moves to row specified by Pn. ECMA-48+Moves to row specified by Pn.
  
 ==== Tab Stop Remove (TSR) ==== ==== Tab Stop Remove (TSR) ====
 **Sequence:** ''CSI Pn SP d''\\  **Sequence:** ''CSI Pn SP d''\\ 
 **Defaults:** None\\  **Defaults:** None\\ 
-Removes a tab stop at postion Pn. ECMA-48+Removes a tab stop at postion Pn.
  
 ==== Line Position Forward (VPR) ==== ==== Line Position Forward (VPR) ====
 **Sequence:** ''CSI Pn e''\\  **Sequence:** ''CSI Pn e''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-Moves forward Pn rows. ECMA-48+Moves forward Pn rows.
  
 ==== Character and Line Position (HVP) ==== ==== Character and Line Position (HVP) ====
 **Sequence:** ''CSI Pn1 ; Pn2 f''\\  **Sequence:** ''CSI Pn1 ; Pn2 f''\\ 
 **Defaults:** Pn1 = 1, Pn2 = 1\\  **Defaults:** Pn1 = 1, Pn2 = 1\\ 
-Moves the cursor to the Pn2th column of the Pn1th line. ECMA-48+Moves the cursor to the Pn2th column of the Pn1th line.
  
 ==== Tabulation Clear (TBC) ==== ==== Tabulation Clear (TBC) ====
Line 456: Line 456:
 | 3 | Deletes all tab stops. | | 3 | Deletes all tab stops. |
 | 5 | Deletes all tab stops. | | 5 | Deletes all tab stops. |
-ECMA-48 
  
 ==== Enable DoorWay Mode (BCST) / CTerm Set (CTSET) ==== ==== Enable DoorWay Mode (BCST) / CTerm Set (CTSET) ====
Line 480: Line 479:
 | 34                  | reset | Enable blink alt character set. With this mode set, the blink (5, 6) graphic renditions selects characters from an alternate character set. | | 34                  | reset | Enable blink alt character set. With this mode set, the blink (5, 6) graphic renditions selects characters from an alternate character set. |
 | 35                  | reset | Blink Disabled.  This makes the blink (5, 6) graphic renditions not cause the character to blink.  Mostly for use with ''CSI ? 34 h'' to permit fonts to be used without blinking. | 35                  | reset | Blink Disabled.  This makes the blink (5, 6) graphic renditions not cause the character to blink.  Mostly for use with ''CSI ? 34 h'' to permit fonts to be used without blinking.
 +| 67         | DECBKM   | set   | DEC Backarrow Key Mode.  When set, backspace sends the BS code.  When reset, backspace sends DEL (0x7F). |
 | 69                  | reset | DEC Left Right Margin Mode enabled.  Enables CSI s to set the left/right margins, and disables CSI s from saving the current cursor position. | | 69                  | reset | DEC Left Right Margin Mode enabled.  Enables CSI s to set the left/right margins, and disables CSI s from saving the current cursor position. |
 | 80                  | set   | Sixel Scrolling Enabled. When this is set, the sixel active position begins in the upper-left corner of the currently active text position. When the sixel active position reaches the bottom of the page, the page is scrolled up.  At the end of the sixel string, a sixel newline is appended, and the current cursor position is the one in which the bottom sixel is in. | | 80                  | set   | Sixel Scrolling Enabled. When this is set, the sixel active position begins in the upper-left corner of the currently active text position. When the sixel active position reaches the bottom of the page, the page is scrolled up.  At the end of the sixel string, a sixel newline is appended, and the current cursor position is the one in which the bottom sixel is in. |
 | 1000                | reset | Normal tracking mode mouse reporting. Mouse button presses will send a ''CSI M <button> <x> <y>''. Where <button> is ' ' + button number (0-based). Mouse button releases will use a button number of 4 <x> and <y> are '!' + position (0-based) | | 1000                | reset | Normal tracking mode mouse reporting. Mouse button presses will send a ''CSI M <button> <x> <y>''. Where <button> is ' ' + button number (0-based). Mouse button releases will use a button number of 4 <x> and <y> are '!' + position (0-based) |
-| 1002                | reset | Button-event tracking mode mouse reporting. Mouse button presses and movement when a button is pressed will send a ''CSI M <button> <x> <y>;;, Where <button> is ' ' + button number (0-based). 32 is added to the button number for movement events. Mouse button releases will use a button number of 4 <x> and <y> are '!' + position (0-based) |+| 1002                | reset | Button-event tracking mode mouse reporting. Mouse button presses and movement when a button is pressed will send a ''CSI M <button> <x> <y>'', Where <button> is ' ' + button number (0-based). 32 is added to the button number for movement events. Mouse button releases will use a button number of 4 <x> and <y> are '!' + position (0-based) |
 | 1003                | reset | Any-event tracking mode mouse reporting Mouse button presses and movement will send a ''CSI M <button> <x> <y>''. Where <button> is ' ' + button number (0-based) 32 is added to the button number for movement events. Mouse button releases will use a button number of 4 <x> and <y> are '!' + position (0-based) If no button is pressed, it acts as though button 0 is. | | 1003                | reset | Any-event tracking mode mouse reporting Mouse button presses and movement will send a ''CSI M <button> <x> <y>''. Where <button> is ' ' + button number (0-based) 32 is added to the button number for movement events. Mouse button releases will use a button number of 4 <x> and <y> are '!' + position (0-based) If no button is pressed, it acts as though button 0 is. |
 | 1006                | reset | SGR encoded extended coordinates. Instead of the CSI M method, the format of mouse reporting is changed to ''CSI < Pb ; Px ; Py M'' for presses and ''CSI < Pb ; Px ; Py m'' for releases. Instead of ''CSI M'' Px and Py are one-based. Pb remains the same (32 added for movement). Button 3 is not used for release (separate code). | | 1006                | reset | SGR encoded extended coordinates. Instead of the CSI M method, the format of mouse reporting is changed to ''CSI < Pb ; Px ; Py M'' for presses and ''CSI < Pb ; Px ; Py m'' for releases. Instead of ''CSI M'' Px and Py are one-based. Pb remains the same (32 added for movement). Button 3 is not used for release (separate code). |
Line 491: Line 491:
 **Sequence:** ''CSI Pn j''\\  **Sequence:** ''CSI Pn j''\\ 
 **Defaults:** Pn = 1\\  **Defaults:** Pn = 1\\ 
-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+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.
  
 ==== Line Position Backward (VPB) ==== ==== Line Position Backward (VPB) ====
Line 504: Line 504:
 | 4   | Disable Last Column Flag mode (CTDLCF) | | 4   | Disable Last Column Flag mode (CTDLCF) |
 | 255 | Disable DoorWay Mode (BDDRWY) | | 255 | Disable DoorWay Mode (BDDRWY) |
 +
 +==== DEC Private Mode Reset (DECRST) ====
 +**Sequence:** ''CSI ? Ps... l''\\ 
 +**Defaults:** None\\ 
 +Resets one or more mode.  The following modes are supported:
 +^ Value      ^ Mnemonic ^ Default ^ Description ^
 +| 6          | DECOM    | reset   | Origin Mode. With this mode reset, position parameters are relative to the top left of the screen, not the scrolling region. |
 +| 7          | DECAWM   | set     | Disable auto wrap. Resetting this mode causes a write to the last column of a to leave the cursor where it was before the write occurred, overwriting anything which was previously written to the same position. |
 +| 9          |          | reset   | Disable X10 compatible mouse reporting. |
 +| 25                  | reset   | Hide the cursor. |
 +| 31                  | reset   | Disable bright alt character set. With this mode reset, the bright (1) graphic rendition does not select an alternative font. |
 +| 32                  | reset   | Bright Intensity Enable. When reset, bright intensity graphics rendition behaves normally. |
 +| 33                  | reset   | Disable Blink to Bright Intensity Background. With this mode set, the blink (5,6) graphic renditions do not affect the background colour. |
 +| 34                  | reset   |Disable blink alt character set. With this mode reset, the blink (5, 6) graphic renditions do not select characters from an alternate character set. |
 +| 35                  | reset   | Blink Enable. With this mode reset, the blink (5,6) graphic renditions behave normally (cause the characters to blink). |
 +| 69                  | reset   | DEC Left Right Margin Mode disabled. Disables CSI s from setting the left/right margins, and changes it back to saving the current cursor position.  The current left/right margins are maintained. |
 +| 80                  | set     | Sixel Scrolling Disabled. When this is reset, the sixel active position begins in the upper-left corner of the page.  Any commands that attempt to advance the sixel position past the bottom of the page are ignored.  At the end of the sixel string, the current cursor position is unchanged from where it was when the sixel string started. |
 +| 1000                | reset   | Disable Normal tracking mode mouse reporting |
 +| 1001                | reset   | Disable Highlight tracking mode mouse reporting |
 +| 1002                | reset   | Disable Button-event tracking mode mouse reporting |
 +| 1003                | reset   | Disable Any-event tracking mode mouse reporting |
 +| 1004                | reset   | Disable Focus-event tracking mode mouse reporting |
 +| 1005                | reset   | Disable UTF-8 encoded extended coordinates |
 +| 1006                | reset   | Disable SGR encoded extended coordinates |
 +| 1007                | reset   | Disable Alternate scroll mode |
 +| 1015                | reset   | Disable URXVT encoded extended coordinates |
 +| 2004                | reset   | Disable bracketed paste mode |
 +
 +==== Select Graphic Rendition (SGR) ====
 +**Sequence:** ''CSI Ps... m''\\ 
 +**Defaults:** Ps1 = 0\\ 
 +Sets or clears one or more text attributes.  Unlimited parameters are supported and are applied in received order.  The following are supported:
 +^                                         ^^  Modified                       ^^^^^^
 +^ Ps  ^ Description                                                                ^ Blink ^ Bold ^ FG  ^ BG  ^ TF  ^ TB  ^
 +| 0   | Default attribute, white on black                                          |        |  X  |  X  |  X  |  X  |
 +| 1   | Bright Intensity                                                                    |          X  |     |
 +| 2   | Dim intensity                                                              |          |          X  |     |
 +| 5   | Blink (By definition, slow blink)                                          |          |              X  |
 +| 6   | Blink (By definition, fast blink)                                          |          |              X  |
 +| 7   | Negative Image - Reverses FG and BG                                        |            |  X  |  X  |  X  |  X  |
 +| 8   | Concealed characters, sets the foreground colour to the background colour. |            |  X  |  X  |  X  |  X  |
 +| 22  | Normal intensity                                                                    |          X  |     |
 +| 25  | Steady (Not blinking)                                                      |          |              X  |
 +| 27  | Positive Image - Restores FG and BG                                        |            |  X  |  X  |  X  |  X  |
 +| 30  | Black foreground                                                                      |  X  |      X  |     |
 +| 31  | Red foreground                                                                        |  X  |      X  |     |
 +| 32  | Green foreground                                                                      |  X  |      X  |     |
 +| 33  | Yellow foreground                                                          |            |  X  |      X  |     |
 +| 34  | Blue foreground                                                            |            |  X  |      X  |     |
 +| 35  | Magenta foreground                                                                    |  X  |      X  |     |
 +| 36  | Cyan foreground                                                            |            |  X  |      X  |     |
 +| 37  | White foreground                                                                      |  X  |      X  |     |
 +| 38  | Extended Foreground (see notes)                                            |            |          X  |     |
 +| 39  | Default foreground (same as white)                                                    |          X  |     |
 +| 40  | Black background                                                                      |      X  |      X  |
 +| 41  | Red background                                                                        |      X  |      X  |
 +| 42  | Green background                                                                      |      X  |      X  |
 +| 43  | Yellow background                                                          |            |      X  |      X  |
 +| 44  | Blue background                                                            |            |      X  |      X  |
 +| 45  | Magenta background                                                                    |      X  |      X  |
 +| 46  | Cyan background                                                            |            |      X  |      X  |
 +| 47  | White background                                                                      |      X  |      X  |
 +| 48  | Extended Background (see notes)                                            |            |              X  |
 +| 49  | Default background (same as black)                                                    |      X  |      X  |
 +| 91  | Bright Red foreground                                                      |            |  X  |      X  |     |
 +| 92  | Bright Green foreground                                                    |            |  X  |      X  |     |
 +| 93  | Bright Yellow foreground                                                              |  X  |      X  |     |
 +| 94  | Bright Blue foreground                                                                |  X  |      X  |     |
 +| 95  | Bright Magenta foreground                                                  |            |  X  |      X  |     |
 +| 96  | Bright Cyan foreground                                                                |  X  |      X  |     |
 +| 97  | Bright White foreground                                                    |            |  X  |      X  |     |
 +| 100 | Bright Black background                                                    |          |      X  |      X  |
 +| 101 | Bright Red background                                                      |          |      X  |      X  |
 +| 102 | Bright Green background                                                    |          |      X  |      X  |
 +| 103 | Bright Yellow background                                                            |      X  |      X  |
 +| 104 | Bright Blue background                                                              |      X  |      X  |
 +| 105 | Bright Magenta background                                                  |          |      X  |      X  |
 +| 106 | Bright Cyan background                                                              |      X  |      X  |
 +| 107 | Bright White background                                                    |          |      X  |      X  |
 +
 +All others are ignored.
 +
 +Blink indicates the blink bit.\\ 
 +Bold indicates the bold bit.\\ 
 +FG indicates the foreground colour.\\ 
 +BG indicates the background colour.\\ 
 +TF indicates that the Tru Colour foreground is changed.\\ 
 +TB indicates that the Tru Colour background is changed.\\ 
 +
 +NOTE: For 90-97, there is no effect unless bright foreground colours are enabled.
 +
 +NOTE: For 100-107, there is no effect unless bright background colours are enabled.
 +
 +NOTE: For 38 and 48, two additional formats are supported, a palette selection and a direct colour selection.
 +
 +For palette selection, an additional two parameters are required after that value.  They are considered part of the 38/48, not separate values.  The first additional parameter must be a 5.  The second additional parameter specified the palette index to use.  To set the foreground to orange, and the background to a fairly dark grey, you would send: ''CSI 38 ; 5 ; 214 ; 48 ; 5 ; 238 m''
 +
 +The default palette is the [[https://jonasjacek.github.io/colors/|XTerm 256-colour palette]].
 +
 +For direct colour selection, an additional four parameters are required after that value.  They are considered part of the 38/48, not separate values.  The first additional parameter must be a 2.  The second, third, and fourth specify the R/G/B values respectively. CTerm handles this with an internal temporary palette, so scrollback may not have the correct colours.  The internal palette is large enough for all cells in a 132x60 screen to have unique foreground and background colours though, so the current screen should always be as expected.
 +
 +==== Device Status Report (DSR) ====
 +**Sequence:** ''CSI Ps n''\\ 
 +**Defaults:** Ps = 0\\ 
 +A request for a status report.  CTerm handles the following three requests:
 +| 5 | Request a DSR | CTerm will always reply with CSI 0 n indicating "ready, no malfunction detected" |
 +| 6 | Request active cursor position | CTerm will reply with CSI y ; x R where y is the current line and x is the current row. |
 +| 255 | NON-STANDARD EXTENSION (BCDSR) | Replies as though a CSI 6 n was received with the cursor in the bottom right corner.  i.e.: Returns the terminal size as a position report. |
 +
 +==== CTerm Sate/Mode Request/Report (CTSMRR) ====
 +**Sequence:** ''CSI = Ps n''\\ 
 +**Defaults:** Ps = 1\\ 
 +When Ps is 1, CTerm will respond with a Font State Report of the form ''CSI = 1 ;pF ;pR ;pS0 ;pS1 ;pS2 ;pS3 n'' where pF is the first available loadable-font slot number and pR is the result of the previous "Font Selection" request:
 +| 0  | successful font selection |
 +| 1  | failed font selection |
 +| 99 | no font selection request has been received |
 +pS0 - pS3 contain the font slots numbers of previously successful "Font Selection" requests into the 4 available alternate-font style/attribute values:
 +| pS0 | normal attribute font slot |
 +| PS1 | high intensity foreground attribute font slot |
 +| PS2 | blink attribute font slot |
 +| PS3 | high intensity blink attribute font slot |
 +
 +When Ps is 2, CTerm will respond with a Mode Report of the form ''CSI = 2[;pN [;pN] [...]] n'' Where pN represent zero or more mode values set previously (e.g. via '''CSI ? pN h''). Mode values cleared (disabled via ''CSI ? pN l'') will not be included in the set of values returned in the Mode Report.  If no modes are currently set, an empty parameter will be included as the first and only pN.
 +
 +When Ps is 3, CTerm will respond with a Mode Report of the form ''CSI = 3 ; pH ; pW n'' Where pH is the height of a character cell in pixels, and pW is the width of a character cell in pixels.
 +
 +When Ps is 4, CTerm will respond with a Mode Report of the form ''CSI = 4 ; pF n'' Where pF is 1 if LCF mode is enabled, and 0 if it is disabled.
 +
 +When Ps is 5, CTerm will respond with a Mode Report of the form ''CSI = 5 ; pF n'' Where pF is 1 if LCF mode is forced, and 0 if it is not.
 +
 +==== DEC Device STatus Report (DECDSR) ====
 +**Sequence:** ''CSI ? Ps [ ; Pn ] n''\\ 
 +**Defaults:** Ps = 1, Pn = 1\\ 
 +
 +When Ps is 62 (DECMSR) and there is no Pn, CTerm will respond with a Mode Report of the form ''CSI 32767 * {'' This indicates that 524,272 bytes are available for macro storage. This is not actually true, SyncTERM will use all available memory for macro storage, but some software checks this value, and some parsers don't allow more than INT16_MAX parameter values.
 +
 +When Ps is 63 (DECCKSR) Pn defaults to 1, and CTerm will respond with a checksum of the defined macros in the form ''DCS Pn ! xxxx ST'' Where xxxx is the hex checksum.
 +
 +==== DEC Set Top and Bottom Margins (DECSTBM) ====
 +**Sequence:** ''CSI Pn1 ; Pn2 r''\\ 
 +**Defaults:** Pn1 = 1, Pn2 = last line on screen\\ 
 +Selects top and bottom margins, defining the scrolling region. Pn1 is the line number of the first line in the scrolling region. Pn2 is the line number of the bottom line.
 +
 +==== DEC Select Communication Speed (DECSCS) ====
 +**Sequence:** ''CSI Ps1 ; Ps2 * r''\\ 
 +**Defaults:** Ps1 = 0, Ps2 = 0\\ 
 +Set the output emulation speed (Select Communication Speed). If Ps1 or Ps2 are omitted, causes output speed emulation to stop. Ps1 may be empty. Sequence is ignored if Ps1 is not empty, 0, or 1. The value of Ps2 sets the output speed emulation as follows:
 +
 +^ Value    ^ Speed     ^
 +| empty, 0 | Unlimited |
 +| 1        | 300       |
 +| 2        | 600       |
 +| 3        | 1200      |
 +| 4        | 2400      |
 +| 5        | 4800      |
 +| 6        | 9600      |
 +| 7        | 19200     |
 +| 8        | 38400     |
 +| 9        | 57600     |
 +| 10       | 76800     |
 +| 11       | 115200    |
 +
 +==== CTerm Save Mode Setting (CTSMS) ====
 +**Sequence:** ''CSI ? Ps... s''\\ 
 +**Defaults:** None\\ 
 +Saves the current mode states as specified by ''CSI ? l'' and ''CSI ? h'' If Ps1 is omitted, saves all such states.  If one or more values of Ps is included, saves only the specified states (arguments to ''CSI ? l'' and ''CSI ? h'').
 +
 +==== DEC Set Left and Right Margin (DECSLRM) ====
 +**Sequence:** ''CSI Pn1 ; Pn2 s''\\ 
 +**Defaults:** Pn1 = 1, Pn2 = last column on screen\\ 
 +(Only when DEC Left Right Margin Mode  - 69 - is enabled)\\ 
 +If either Pn1 or Pn2 is zero, the current setting is retained. Selects left and right margins, defining the scrolling region. Pn1 is the column number of the first column in the scrolling region. Pn2 is the column number of the right column.
 +
 +==== SCO Save Cursor ====
 +**Sequence:** ''CSI s''\\ 
 +**Defaults:** None\\ 
 +(Only when DEC Left Right Margin Mode  - 69 - is disabled)\\ 
 +Saves the current cursor position for later restoring with ''CSI u'' although this is non-standard, it's so widely used in the BBS world that any terminal program MUST implement it.
 +
 +==== CTerm 24=Bit Colour (CT24BC) ====
 +**Sequence:** ''CSI Ps ; Pn1 ; Pn2 ; Pn3 t''\\ 
 +**Defaults:** None\\ 
 +Select a 24-bit colour. If Ps is 0, sets the background colour. If Ps is 1, sets the foreground colour. Pn1, Pn2, Pn3 contains the RGB value to set. CTerm handles this with an internal temporary palette, so scrollback may not have the correct colours.  The internal palette is large enough for all cells in a 132x60 screen to have unique foreground and background colours though, so the current screen should always be as expected.
 +
 +==== CTerm Restore Mode Setting (CTRMS) ====
 +**Sequence:** ''CSI ? Ps...  u''\\ 
 +**Defaults:** None\\ 
 +Restores the mode states as saved via CSI ? s.  If Ps is omitted, restores all such states.  If one or more values of Ps is included, restores all the specified states (arguments to CSI ? l/h)
 +
 +==== SCO Restore Cursor (SCORC) ====
 +**Sequence:** ''CSI u''\\ 
 +**Defaults:** None\\ 
 +Move the cursor to the last position saved by CSI s.  If no position has been saved, the cursor is not moved.
 +
 +==== DEC Tab Stop Report (DECTABSR) ====
 +**Sequence:** ''CSI 2 $ w''\\ 
 +**Defaults:** None\\ 
 +Requests a list of tab stops. The list is in the form: ''DCS 2 $ u Pt ST''. The string Pt is a list of tab stops separated by /.
 +
 +==== DEC Request Checksum of Rectangular Area (DECRQCRA) ====
 +**Sequence:** ''CSI Pn1 ; Ps ; Pn2 ; Pn3 ; Pn4 ; Pn5 * y''\\ 
 +**Defaults:** None\\ 
 +Returns a checksum for the specified rectangular area. Pn1 is an ID that is returned in the response. Ps MUST be 1. Pn2 specifies the top row of the rectangle. Pn3 specifies the left column of the rectangle. Pn4 specifies the bottom row of the rectangle. Pn5 specifies the right column of the rectangle. The return value is in the format of ''DCS Pn1 ! ~ xxxx ST'' where xxxx is the hex value of the checksum.
 +
 +==== DEC Invoke Macro (DECINVM) ====
 +**Sequence:** ''CSI Pn1 ; Ps ; Pn2 ; Pn3 ; Pn4 ; Pn5 * y''\\ 
 +**Defaults:** None\\ 
 +Invokes a macro. Pn specifies the macro number.  If Pn is not 0..63, no action is taken.
 +
 +==== CTerm Obsolete Send Font (CTOSF) ====
 +**Sequence:** ''CSI = Ps1 ; Ps2 {''\\ 
 +**Defaults:** Ps1 = 255, PS2 = 0\\ 
 +This is a poorly defined command that violates the basic design laid out in ECMA-48.  This will be removed in the next major version of CTerm, and should not be used.
 +
 +Indicates that a font block is following. Ps1 indicates the font slot to place the loaded font into.  This must be higher than the last default defined font (See CSI sp D for list of predefined fonts)  Ps2 indicates font size according to the following table:
 +| 0 | 8x16 font, 4096 bytes. |
 +| 1 | 8x14 font, 3584 bytes. |
 +| 2 | 8x8 font, 2048 bytes. |
 +
 +The DCS font string should be used instead as of CTerm 1.213
 +
 +===== "ANSI" Music =====
 +This is the place where the BBS world completely fell on it's face in ANSI usage.  A programmer with either TeleMate or QModem (the first two programs to support "ANSI" music as far as I can tell) decided they needed a method of playing music on a BBS connection.  They decided to add an "unused" ANSI code and go their merry way.  Since their product didn't implement CSI M (Delete line) they assumed it was unused and blissfully broke the spec.  They defined "ANSI" music as:
 +''CSI M <music string> 0x0e''
 +
 +They used a subset of IBM BASICs PLAY statement functionality for ANSI music strings which often start with "MF" or "MB", so the M after the CSI was often considered as part of the music string.  You would see things such as: CSI MFABCD 0x0e and the F would not be played as a note.  This just added further confusion to the mess.
 +
 +Later on, BananaCom realized the conflict between delete line and music, so they added *another* broken code CSI N (Properly, erase in field... not implemented in many BBS clients) which was to provide an "unbroken" method of playing music strings.  They also used CSI Y to disambiguate delete line, CSI Y is supposed to be a vertical tab (also not implemented in very many clients). BananaCom also introduced many more non-standard and standard-breaking control sequences which are not supported by CTerm.
 +
 +CTerm has further introduced a standard compliant ANSI music introducer CSI |
 +
 +By default, CTerm allows both CSI N and CSI | to introduce a music string. Allowed introducers are set by CSI = p1 M as defined above.
 +
 +The details of ANSI music then are as follows:\\ 
 +The following characters are allowed in music strings:\\ 
 +"aAbBcCdDeEfFgGlLmMnNoOpPsStT0123456789.-+#<> "
 +If any character not in this list is present, the music string is ignored as is the introducing code.
 +
 +If the introducing code is CSI M the first char is examined, and if it is a one of "BbFfLlSs" or if it is "N" or "n" and is not followed by a decimal digit, then the music string is treated as though an M is located in front of the first character.
 +
 +The music string is then parsed with the following sequences supported:
 +| Mx   | sets misc. music parameters where x is one of the following: ||
 +|      | F | Plays music in the foreground, waiting for music to complete playing before more characters are processed. |
 +|      | B | Play music in the background, allowing normal processing to continue. |
 +|      | N | "Normal" not legato, not staccato |
 +|      | L | Play notes legato |
 +|      | S | Play notes staccato |
 +| T### | Sets the tempo of the music where ### is one or more decimal digits. If the decimal number is greater than 255, it is forced to 255. If it is less than 32, it is forced to 32.  The number signifies quarter notes per minute. The default tempo is 120. ||
 +| O### | Sets the octave of the music where ### is one or more decimal digits. If the decimal number is greater than 6, it is forced to 6.The default octave is 4. ||
 +| N### | Plays a single note by number.  Valid values are 0 - 71.  Invalid values are played as silence.  Note zero is C in octave 0. See following section for valid note modifiers. ||
 +| A,\\ B,\\ C,\\ D,\\ E,\\ F,\\ G,\\ P | Plays the named note or pause from the current octave.  An "Octave" is the rising sequence of the following notes: C, C#, D, D#, E, F, F#, G, G#, A, A#, B. This is contrary to normal music terminology. The special note "P" is a pause. Notes may be followed by one or more modifier characters which are applied in order.  If one overrides a previous one, the last is used.  The valid modifiers are: ||
 +|      | + | Sharp.  The next highest semitone is played. Each sharp character will move up one semitone, so "C++" is equivalent to "D". |
 +|      | # | Sharp.  The next highest semitone is played. Each sharp character will move up one semitone, so "C##" is equivalent to "D". |
 +|      | - | Flat.  The next lowest semitone is played. Each flat character will move down one semitone, so "D--" is equivalent to "C". |
 +|      | . | Duration is 1.5 times what it would otherwise be.  Dots are not cumulative, so "C.." is equivalent to "C." |
 +|      | ### | Notelength as a reciprocal of the fraction of a whole note to play the note for.  For example, 4 would indicate a ¼ note. The default note length is 4. |
 +| L### | Set the notelength parameter for all following notes which do not have one specified (ie: override the quarter-note default)  Legal note lengths are 1-64 indicating the reciprocal of the fraction (ie: 4 indicates a ¼ note). ||
 +| < | Move the next lowest octave. Octave cannot go above six or below zero. ||
 +| > | Move to the next highest octave. Octave cannot go above six or below zero. ||
 +
 +The lowest playable character is C in octave zero.  The frequencies for the six C notes for the seven octaves in rising order are:\\ 
 +65.406, 130.810, 261.620, 523.250, 1046.500, 2093.000, 4186.000
 +
 +Purists will note that the lower three octaves are not exactly one half of the next higher octave in frequency.  This is due to lost resolution of low frequencies.  The notes *sound* correct to me.  If anyone can give me an excellent reason to change them (and more correct integer values for all notes) I am willing to do that assuming the notes still sound "right".
 +
 +!!!PLEASE NOTE!!! If you are playing some ANSI Music then ask the user if they heard it, ALWAYS follow it with an 0x0f as 0x0e is the shift lock character which *will* cause people with anything but an ANSI-BBS terminal (ie: *nix users using the bundled telnet app) to have their screen messed up.  0x0f "undoes" the 0x0e.
 +
 +===== Key Sequences =====
 +While CTerm does not handle keyboard I/O, and therefore does not send any key sequences, it's only used by one piece of software (SyncTERM), which does send a set of sequences when keys are pressed.  These are listed below for reference.
 +
 +| Left Arrow    | "\033[D" |
 +| Right Arrow   | "\033[C" |
 +| Up Arrow      | "\033[A" |
 +| Down Arrow    | "\033[B" |
 +| Home          | "\033[H" |
 +| End           | "\033[K" |
 +| Delete        | "\x7f" |
 +| Page Down     | "\033[U" |
 +| Page Up       | "\033[V" |
 +| F1            | "\033[11~" |
 +| F2            | "\033[12~" |
 +| F3            | "\033[13~" |
 +| F4            | "\033[14~" |
 +| F5            | "\033[15~" |
 +| F6            | "\033[17~" (Note the jump from 15 to 17 here) |
 +| F7            | "\033[18~" |
 +| F8            | "\033[19~" |
 +| F9            | "\033[20~" |
 +| F10           | "\033[21~" |
 +| F11           | "\033[23~" (Note the jump from 21 to 23 here) |
 +| F12           | "\033[24~" |
 +| Shift + F1    | "\033[11;2~" |
 +| Shift + F2    | "\033[12;2~" |
 +| Shift + F3    | "\033[13;2~" |
 +| Shift + F4    | "\033[14;2~" |
 +| Shift + F5    | "\033[15;2~" |
 +| Shift + F6    | "\033[17;2~" |
 +| Shift + F7    | "\033[18;2~" |
 +| Shift + F8    | "\033[19;2~" |
 +| Shift + F9    | "\033[20;2~" |
 +| Shift + F10   | "\033[21;2~" |
 +| Shift + F11   | "\033[23;2~" |
 +| Shift + F12   | "\033[24;2~" |
 +| Alt + F1      | "\033[11;3~" |
 +| Alt + F2      | "\033[12;3~" |
 +| Alt + F3      | "\033[13;3~" |
 +| Alt + F4      | "\033[14;3~" |
 +| Alt + F5      | "\033[15;3~" |
 +| Alt + F6      | "\033[17;3~" |
 +| Alt + F7      | "\033[18;3~" |
 +| Alt + F8      | "\033[19;3~" |
 +| Alt + F9      | "\033[20;3~" |
 +| Alt + F10     | "\033[21;3~" |
 +| Alt + F11     | "\033[23;3~" |
 +| Alt + F12     | "\033[24;3~" |
 +| Control + F1  | "\033[11;5~" |
 +| Control + F2  | "\033[12;5~" |
 +| Control + F3  | "\033[13;5~" |
 +| Control + F4  | "\033[14;5~" |
 +| Control + F5  | "\033[15;5~" |
 +| Control + F6  | "\033[17;5~" |
 +| Control + F7  | "\033[18;5~" |
 +| Control + F8  | "\033[19;5~" |
 +| Control + F9  | "\033[20;5~" |
 +| Control + F10 | "\033[21;5~" |
 +| Control + F11 | "\033[23;5~" |
 +| Control + F12 | "\033[24;5~" |
 +| Insert        | "\033[@" |
 +| Back Tab      | "\033[Z" |
 +
  
 ===== See Also ===== ===== See Also =====
   * [[:ref:ansi:|ANSI References]]   * [[:ref:ansi:|ANSI References]]
 +  * [[https://ecma-international.org/publications-and-standards/standards/ecma-48/|ECMA-48 Standard]]
 +  * [[https://www.invisible-island.net/xterm/ctlseqs/ctlseqs.html|XTerm Control Sequences]]
 +  * [[https://vt100.net/|VT100.net]]
 +  * [[https://raw.githubusercontent.com/dse/vt/master/banana_ansi_bbs.txt|Banana ANSI]]
  
 {{tag>}} {{tag>}}