|
|
1.1 root 1: CTerm terminal chariteristics:
2: ------------------------------
3:
4: End of line behaviour (wrapping):
5: The cursor is moved to the first character of the next line
6: as soon as a character is written to the last column of the
7: current line, not on the next character. A tab will wrap
8: to the next line only if the current cursor position is the
9: last character on the line.
10:
11: Control characters:
12:
13: CR:
14: Move cursor position to column 1 of the current line
15:
16: LF:
17: Move cursor position to same column of the next row.
18: If current row is the last row, scrolls the screen up
19: and fills the new row with the current attribute.
20:
21: BS:
22: Non-destructive backspace. Moves cursor position to
23: the previous column unless the current column is the
24: first, in which case no operation is performed.
25:
26: 0x07:
27: Beep
28:
29: TAB:
30: Moves to the next tab stop. Does not overwrite any
31: characters in between. If the starting position is
32: last column, advances to next line. If starting
33: position is the last column of the last line, performs
34: a scroll, filling the new line at bottom with the
35: current attribute and moves to the first character in
36: the new line.
37:
38: Control Codes:
39: --------------
40:
41: Control codes are in the following format:
42: ESC {SPACE to '/'}{'0' (ZERO) to '~'}
43: There may be multiple characters from the {SPACE to '/'} set
44: before the terminating '0' to '~'
45:
46: Legal combinations which are not handled are silently dropped.
47:
48: ESC D (Disabled in current code)
49: Scrolls window up one line filling the bottom line with the
50: current attribute.
51: SOURCE: BANSI.TXT
52:
53: ESC M (Disabled in current code)
54: Scrolls window down one line filling the top line with the
55: current attribute
56: SOURCE: BANSI.TXT
57:
58: Control Sequences:
59: ------------------
60:
61: Control sequences start with the Control Sequence Introducer which is
62: ESC [ CSI will be used to express this from now on.
63:
64: Control sequences are in the following format:
65: CSI {'0' (ZERO) to '?'}{SPACE to '/'}{'@' to '~'}
66: There may be multiple characters from the {'0' (ZERO) to '?'}
67: and {SPACE to '/'} before the terminating {'@' to '~'} character.
68:
69: Legal combinations not handled are silently dropped.
70: Illegal combinations are displayed.
71:
72: Sequence Parameters:
73: Parameters are expressed by the {'0' (ZERO) to '?'} character set.
74: Sequences which use parameters use decimal parameters separated by
75: a ';'. The use of a ':' from the set is reserved.
76: If the parameter string begins with '<', '=', '>', or '?' then
77: this is a non-standard extension to the ANSI spec.
78:
79: Parameters will be shown as pX where X will be a decimal position
80: number. Surrounded by [] indicates the parameter is optional.
81:
82: CSI = [p1] M
83: NON-STANDARD EXTENSION.
84: Defaults: p1 = 0
85: Sets the current state of ANSI music parsing.
86: 0 - Only CSI | will introduce an ANSI music string.
87: 1 - Both CSI | and CSI N will introduce an ANSI music string.
88: 2 - CSI |, CSI N, and CSI M will all intriduce and ANSI music string.
89: In this mode, Delete Line will not be available.
90:
91: SOURCE: CTerm only.
92:
93: CSI = [ p1 [ ; p2 ] ] {
94: NON-STANDARD EXTENSION.
95: Defaults: p1 = 255 p2 = 0
96: Indicates that a font block is following.
97: p1 indicates the font slot to place the loaded font into. This must
98: be higher than the last default defined font (See CSI sp D for list
99: of predefined fonts) p2 indicates font size according to the
100: following table:
101: 0 - 8x16 font, 4096 bytes.
102: 1 - 8x14 font, 3586 bytes.
103: 2 - 8x8 font, 2048 bytes.
104:
105: SOURCE: CTerm only.
106:
107:
108: CSI [ p1 [ ; p2 ] ] * r
109: NON-STANDARD EXTENSION.
110: Set the output emulation speed.
111: If p1 or p2 are omitted, causes output speed emulation to stop
112: p1 may be empty.
113: Sequence is ignored if p1 is not empty, 0, or 1.
114: The value of p2 sets the output speed emulation as follows:
115:
116: Value Speed
117: ----- -----
118: empty, 0 Unlimited
119: 1 300
120: 2 600
121: 3 1200
122: 4 2400
123: 5 4800
124: 6 9600
125: 7 19200
126: 8 38400
127: 9 57600
128: 10 76800
129: 11 115200
130:
131: SOURCE: VT4xx Specification from http://www.vt100.net/
132:
133: CSI [ p1 ] @
134: Insert Character(s)
135: Defaults: p1 = 1
136: Moves text from the current position to the right edge p1 characters
137: to the right, with rightmost charaters going off-screen and the
138: resulting hole being filled with the current attribute.
139:
140: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
141:
142: CSI [ p1 ] A
143: Cursor Up
144: Defaults: p1 = 1
145: Moves the cursor position up p1 lines from the current position.
146: Attempting to move past the screen boundaries stops the cursor
147: at the screen boundary.
148:
149: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
150:
151: CSI [ p1 ] B
152: Cursor Down
153: Defaults: p1 = 1
154: Moves the cursor position down p1 lines from the current position.
155: Attempting to move past the screen boundaries stops the cursor
156: at the screen boundary.
157:
158: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
159:
160: CSI [ p1 ] C
161: Cursor Right
162: Defaults: p1 = 1
163: Moves the cursor position right p1 columns from the current position.
164: Attempting to move past the screen boundaries stops the cursor
165: at the screen boundary.
166:
167: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
168:
169: CSI [ p1 ] D
170: Cursor Left
171: Defaults: p1 = 1
172: Moves the cursor position left p1 columns from the current position.
173: Attempting to move past the screen boundaries stops the cursor
174: at the screen boundary.
175:
176: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
177:
178: CSI [ p1 [ ; p2 ] ] sp D
179: Font Selection
180: Defaults: p1 = 0 p2 = 0
181: "sp" indicates a single space character.
182: Sets font p1 to be the one indicated bu p2. Currently only the primary
183: font (Font zero) is supported. p2 must be between 0 and 255. Not all
184: output types support font selection. Only X11 and SDL currently do.
185: Currently included fonts are:
186: 0 - Codepage 437 English
187: 1 - Codepage 1251 Cyrillic, (swiss)
188: 2 - Russian koi8-r
189: 3 - ISO-8859-2 Central European
190: 4 - ISO-8859-4 Baltic wide (VGA 9bit mapped)
191: 5 - Codepage 866 (c) Russian
192: 6 - ISO-8859-9 Turkish
193: 7 - haik8 codepage (use only with armscii8 screenmap)
194: 8 - ISO-8859-8 Hebrew
195: 9 - Ukrainian font koi8-u
196: 10 - ISO-8859-15 West European, (thin)
197: 11 - ISO-8859-4 Baltic (VGA 9bit mapped)
198: 12 - Russian koi8-r (b)
199: 13 - ISO-8859-4 Baltic wide
200: 14 - ISO-8859-5 Cyrillic
201: 15 - ARMSCII-8 Character set
202: 16 - ISO-8859-15 West European
203: 17 - Codepage 850 Multilingual Latin I, (thin)
204: 18 - Codepage 850 Multilingual Latin I
205: 19 - Codepage 885 Norwegian, (thin)
206: 20 - Codepage 1251 Cyrillic
207: 21 - ISO-8859-7 Greek
208: 22 - Russian koi8-r (c)
209: 23 - ISO-8859-4 Baltic
210: 24 - ISO-8859-1 West European
211: 25 - Codepage 866 Russian
212: 26 - Codepage 437 English, (thin)
213: 27 - Codepage 866 (b) Russian
214: 28 - Codepage 885 Norwegian
215: 29 - Ukrainian font cp866u
216: 30 - ISO-8859-1 West European, (thin)
217: 31 - Codepage 1131 Belarusian, (swiss)
218: Not all fonts are supported in all modes. If a font is not supported in
219: the current mode, no action is taken.
220:
221: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
222:
223: CSI [ p1 ] E
224: Cursor Next Line
225: Defaults: p1 = 1
226: Moves the cursor position down p1 columns from the current position.
227: Moving past the bottom of the screen scrolls the screen up the remaining
228: number of lines filling newly added lines with the current attribute.
229:
230: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
231:
232: CSI [ p1 [ ; p2 ] ] H
233: CSI [ p1 [ ; p2 ] ] f
234: Cusror Position
235: Defaults: p1 = 1 p2 = 1
236: Moves the cursor to the p2th column of the p1th line.
237:
238: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
239:
240: CSI [ p1 ] J
241: Erase in Page
242: Defaults: p1 = 0
243: Erases from the current screen according to the value of p1
244: 0 - Erase from the current position to the end of the screen.
245: 1 - Erase from the current position to the start of the screen.
246: 2 - Erase entire screen. As a violation of ECMA-048, also moves
247: the cursor to position 1/1 as a number of BBS programs assume
248: this behaviour.
249: Erased characters are set to the current attribute.
250:
251: SOURCE BANSI.TXT
252:
253: CSI [ p1 ] K
254: Erase in Line
255: Defaults: p1 = 0
256: Erases from the current line according to the value pf p1
257: 0 - Erase from the current position to the end of the line.
258: 1 - Erase from the current position to the start of the line.
259: 2 - Erase entire line.
260: Erased characters are set to the current attribute.
261:
262: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
263:
264: CSI [ p1 ] L
265: Insert Line(s)
266: Defaults: p1 = 1
267: Inserts p1 lines at the current line position. The current line and
268: those after it are scrolled down and the new empty lines are filled with
269: the current attribute.
270:
271: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
272:
273: CSI [ p1 ] M
274: Delete Line(s) / "ANSI" Music
275: Defaults: p1 = 1
276: Deletes the current line and the p1 - 1 lines after it scrolling the
277: first non-deleted line up to the current line and filling the newly
278: empty lines at the end of the screen with the current attribute.
279: If "ANSI" Music is fully enabled (CSI = 2 M), performs "ANSI" music
280: instead.
281: See "ANSI" MUSIC section for more details.
282:
283: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
284: SOURCE: BANSI.TXT
285:
286: CSI N
287: "ANSI" Music / Not implemented.
288: If "ANSI" Music is set to BananaCom (CSI = 1 M) or fully enabled
289: (CSI = 2 M) performs "ANSI" muisic. See "ANSI" MUSIC section for more
290: details.
291:
292: SOURCE: BANSI.TXT
293:
294: CSI [ p1 ] P
295: Delete Character
296: Defaults: p1 = 1
297: Deletes the character at the current position by shifting all characters
298: from the current column + p1 left to the current column. Opened blanks
299: at the end of the line are filled with the current attribute.
300:
301: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
302:
303: CSI [ p1 ] S
304: Scroll Up
305: Defaults: p1 = 1
306: Scrolls all text on the screen up p1 lines. New lines emptied at the
307: bottom are filled with the current attribute.
308:
309: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
310:
311: CSI [ p1 ] T
312: Scroll Down
313: Defaults: p1 = 1
314: Scrolls all text on the screen down p1 lines. New lines emptied at the
315: top are filled with the current attribute.
316:
317: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
318:
319: CSI U
320: NON-STANDARD (Disabled in current code)
321: Clear screen with default attribute.
322: This code is *supposed* to go to the "next page" according to the
323: ANSI/ECMA specs with CSI V going to "previous page"
324:
325: SOURCE: BANSI.TXT
326:
327: CSI [ p1 ] Z
328: Cursor Backward Tabulation
329: Defaults: p1 = 1
330: Move the cursor to the p1th preceeding tab stop. Will not go past the
331: start of the line.
332:
333: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
334:
335: CSI [ p1 ] c
336: Device Attributes
337: Defaults: p1 = 0
338: If p1 is 0, CTerm will reply with the sequence:
339: CSI [ = 67;84;101;114;109;pN... c
340: 64;84;101;114;109 is the ASCII values of the "CTerm" string. pN is the
341: CVS revision ID of CTerm with dots converted to semi-colons.
342: Use the CVS revision to detect if a specific feature is available. If
343: you are adding features to a forked version of cterm, please do so by
344: adding an extra parameter to the end, not by incrementing any existing
345: one!
346:
347: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
348:
349: CSI [ p1 [ ; pX ... ] ] m
350: Select Graphic Rendition
351: Defaults: p1 = 0
352: Sets or clears one or more text attributes. Unlimited parameters are
353: supported and are applied in received order. The following are
354: supoprted:
355: Blink Bold FG BG (Modified)
356: 0 - Default attribute, white on black X X X X
357: 1 - Bright Intensity X
358: 2 - Dim intensty X
359: 5 - Blink (By definition, slow blink) X
360: 6 - Blink (By definition, fast blink) X
361: NOTE: Both blinks are the same speed.
362: 7 - Negative Image - Reverses FG and BG X X
363: 8 - Concealed characters, sets the X
364: forground colour to the background
365: colour.
366: 22 - Normal intensity X
367: 25 - Steady (Not blinking) X
368: 27 - Positive Image - Reverses FG and BG X X
369: NOTE: This should be a separate
370: attribute than 7 but this
371: implementation makes them equal
372: 30 - Black foreground X
373: 31 - Red foreground X
374: 32 - Green foreground X
375: 33 - Yellow foreground X
376: 34 - Blue foreground X
377: 35 - Magenta foreground X
378: 36 - Cyan foreground X
379: 37 - White foreground X
380: 39 - Default foreground (same as white) X
381: 40 - Black background X
382: 41 - Red background X
383: 42 - Green background X
384: 43 - Yellow background X
385: 44 - Blue background X
386: 45 - Magenta background X
387: 46 - Cyan background X
388: 47 - White background X
389: 49 - Default background (same as black) X
390:
391: All others are ignored.
392:
393: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
394:
395: CSI [ p1 ] n
396: Device Status Report
397: Defaults: p1 = 0
398: A request for a status report. CTerm handles the following three
399: requests:
400: 5 - Request a DSR
401: CTerm will always reply with CSI 0 n indicating
402: "ready, no malfunction detected"
403: 6 - Request active cursor position
404: CTerm will reply with CSI y ; x R where y is the current line
405: and x is
406: the current row.
407: 255 - NON-STANDARD EXTENSION
408: Replies as though a CSI [ 6 n was recieved with the cursor in
409: the bottom right corner. ie: Returns the terminal size as a
410: position report.
411:
412: SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
413: (parameters 5 and 6 only)
414: SOURCE: BANSI.TXT (parameter 255)
415:
416: CSI s
417: NON-STANDARD EXTENSION
418: Save Current Position
419: Saves the current cursor position for later restoring with CSI u
420: although this is non-standard, it's so widely used in the BBS world that
421: any terminal program MUST implement it.
422:
423: SOURCE: ANSI.SYS
424:
425: CSI u
426: NON-STANDARD EXTENSION
427: Restore Cursor Position
428: Move the cursor to the last position saved by CSI s. If no position has
429: been saved, the cursor is not moved.
430:
431: SOURCE: ANSI.SYS
432:
433: "ANSI" Music
434: ============
435: This is the place where the BBS world completely fell on it's face in ANSI
436: useage. A programmer with either TeleMate or QModem (the first two programs to
437: support "ANSI" music as far as I can tell) decided they needed a method of
438: playing music on a BBS conenction. They decided to add an "unused" ANSI code
439: and go their merry way. Since their product didn't implement CSI M (Delete
440: line) they assumed it was unused and blissfully broke the spec. They defined
441: "ANSI" music as:
442: CSI M <music string> 0x0a
443:
444: They used a subset of IBM BASICs PLAY statement functionality for ANSI music
445: strings which oftem start with "MF" or "MB", so the M after the CSI was often
446: considered as part of the music string. You would see things such as:
447: CSI MFABCD 0x0a and the F would not be played as a note. This just added
448: further confusion to the mess.
449:
450: Later on, BananaCom realized the conflict between delete line and music, so they
451: added *another* broken code CSI N (Properly, erase in field... not implemented
452: in many BBS clients) which was to provide an "unbroken" method of playing music
453: strings. They also used CSI Y to disambiguate delete line, CSI Y is supposed
454: to be a vertical tab (also not implemented in very many clients). BananaCom
455: also introduced many more non-standard and stardard-breaking control sequences
456: which are not supported by CTerm.
457:
458: CTerm has further introduced a standard compliant ANSI music introducer CSI |
459:
460: By default, CTerm allows both CSI N and CSI | to introduce a music string.
461: Allowed introducers are set by CSI = p1 M as defined above.
462:
463: The details of ANSI music are as follows then:
464: The following characters are allowed in music strings:
465: "aAbBcCdDeEfFgGlLmMnNoOpPsStT0123456789.-+#<> "
466: If any character not in this list is present, the music string is ignored as
467: is the introducing code.
468:
469: If the introducing code is CSI M the first char is examined, and if it is
470: a one of "BbFfLlSs" or if it is "N" or "n" and is not followed by a decimal
471: digit, then the music string is treated as though an M is located in front
472: of the first character.
473:
474: The music string is then parsed with the following sequences supported:
475: Mx sets misc music parameters where x is one of the following:
476: F - Plays music in the foreground, waiting for music to complete
477: playing before more characters are processed.
478: B - Play music in the background, allowing normal processing to
479: continue.
480: N - "Normal" not legato, not stacatto
481: L - Play notes legato
482: S - Play notes stacatto
483: T### Sets the tempo of the music where ### is one or more decimal digits.
484: If the decimal number is greater than 255, it is forced to 255.
485: If it is less than 32, it is forced to 32. The number signifies
486: quarter notes per minute.
487: The default tempo is 120.
488: O### Sets the octave of the music where ### is one or more decimal digits.
489: If the decimal number is greater than 6, it is forced to 6.
490: The default octave is 4.
491: N### Plays a single note by number. Valid values are 0 - 71. Invalid
492: values are played as silence. Note zero is C in octave 0.
493: See following section for valid note modifiers.
494: A, B, C, D, E, G, or P Plays the named note or pause from the current
495: octave. An "Octave" is the rising sequence of the following notes:
496: C, C#, D, D#, E, F, F#, G, G#, A, A#, B
497: This is contrary to normal music terminology.
498: The special note "P" is a pause.
499: Notes may be followed by one or more modifier characters which
500: are applied in order. If one overrides a previous one, the last
501: is used. The valid modifiers are:
502: + - Sharp. The next highest semitone is played.
503: Each sharp character will move up one semitone, so "C++"
504: is equivilent to "D".
505: # - Sharp. The next highest semitone is played.
506: Each sharp character will move up one semitone, so "C##"
507: is equivilent to "D".
508: - - Flat. The next lowest semitone is played.
509: Each flat character will move down one semitone, so "D--"
510: is equivilent to "C".
511: . - Duration is 1.5 times what it would otherwise be. Dots are not
512: cumulative, so "C.." is equivilent to "C."
513: ### - Notelength as a reciprical of the fraction of a whole note to
514: play the note for. For example, 4 would indicate a 1/4 note.
515: The default note length is 4.
516: L### Set the notelength parameter for all following notes which do not have
517: one specified (ie: override the quarter-note default) Leval note lengths
518: are 1-64 indicating the recibrical of the fraction (ie: 4 indicates a 1/4
519: note).
520: < Move the the next lowest octave.
521: Octave cannot go above six or below zero.
522: > Move to the next highest octave.
523: Octave cannot go above six or below zero.
524:
525: The lowest playable character is C in octave zero. The frequencies for the
526: six C notes for the seven octaves in rising order are:
527: 65406, 130810, 261620, 523250, 1046500, 2093000, 4186000
528:
529: Purists will note that the lower three octaves are not exactly one half of
530: the next higher octave in frequency. This is due to lost resolution of
531: low frequences. The notes *sound* correct to me. If anyone can give me
532: an excellent reason to change them (and more correct integer values for all
533: notes) I am willing to do that assuming the notes still sound "right".
534:
535: !!!PLEASE NOTE!!! If you are playing some ANSI Music then ask the user if they
536: heard it, ALWAYS follow it with an 0x0b 0x0a is the shift lock character which
537: *will* cause people with anything but an ANSI-BBS terminal (ie: *nix users using
538: the bundled telnet app) to have their screen messed up. 0x0b "undoes" the 0x0a.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.