Annotation of sbbs/src/conio/cterm.txt, revision 1.1.1.2

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.