============================================================================ Using Amiga ANSI Codes With CNet Amiga, v3.0c (and Higher) v1.20 ============================================================================ Written by Dotoran of Frontiers BBS (716)/823-9892 No doubt, if you've been using bulletin boards for any length of time, you've heard of ANSI Escape Code Sequences. What you may NOT have known is that you can use them with the CNet Amiga BBS Package. I don't simply mean that CNet can read and interpret these codes, as in a door, but that you and your users can actually enter them right into either of CNet's resident editors. This file will explain all the known ANSI codes I could locate, and I'll attempt to update this file when and if new ANSI codes have been found. For those of you NOT familiar with ANSI Escape Codes, what they are is nothing more than a series of characters which will have some sort of affect on either the cursor, the screen, or the text which appears ON the screen. All ANSI codes initially start with the ESC (Escape) Character. This is Ascii Code 27, HEX Code 1B. This character will appear to look like a small arrow pointing to the left if using CED or AZ, or will appear as a tilde ~ if in one of the CNet Editors. The "Ed" and "MEmacs" programs are NOT good choices to use when using ANSI codes as the ESC key is used to activate certain commands within these programs. I suggest using CED or AZ as your external editor if you'll be using something BESIDES the CNet internal editors. ============================================================================ When using the Line Editor or Visual Editor within CNet, you will need to Press the ESC key TWICE to create the ~ (ESC char). Keep this in mind. ============================================================================ Following this ESC character, which will be referred to as ESC from now on, you must use an Open Bracket character: [ (to thr RIGHT of "P") Following the Open Bracket MAY come one, or several numbers separated by semicolons, and finally a Command Character. The Command Character may be an UPPER Case Letter, a lower case letter, or a punctuation symbol. When the Command Character is a LETTER, the CASE of that letter is VERY important, as there are a few ANSI codes that carry a different meaning, depending on whether or not the letter is UPPER Case or lower case. Before we start with the long descriptions, let me say that the following ANSI Codes will work on BOTH Amiga and IBM Machines, although only the ANSI Codes that work under the Amiga environment will be listed. ALL of these will also function under the IBM, but there are a few IBM ANSI Codes which will NOT function under the Amiga, so these codes have been LEFT OUT of this list. Alright, so much for the introductory paragraphs, let's get into seeing what these ANSI Codes are all about. In the following descriptions, ESC will mean you should press your ESC (Escape) key. Remember, if using one of the CNet internal editors, you'll need to press ESC TWICE to get the ~ char. ============================================================================ Long Descriptions of Amiga ANSI Escape Codes. ============================================================================ ESC [ x A <--- MUST end in CAPITAL Letter "A". DESCRIPTION: Will move the cursor UP "x" rows, while staying in the same column. EXAMPLES: ESC[5A - Move UP 5 rows, but STAY in the SAME column. ESC[10A - Move UP 10 rows, but STAY in the SAME column. ---------------------------------------------------------------------------- ESC [ x B <--- MUST end in CAPITAL Letter "B" DESCRIPTION: Will move the cursor DOWN "x" rows, while staying in the same column. EXAMPLES: ESC[3B - Move DOWN 3 rows, but STAY in the SAME column. ESC[17B - Move DOWN 17 rows, but STAY in the SAME column. ---------------------------------------------------------------------------- ESC [ x C <--- MUST end in CAPITAL Letter "C" DESCRIPTION: Will move the cursor to the RIGHT "x" columns, but will stay on the same row. EXAMPLES: ESC[7C - Move RIGHT 7 columns, but STAY on the SAME row. ESC[38C - Move RIGHT 38 columns, but STAY on the SAME row. ---------------------------------------------------------------------------- ESC [ x D <--- MUST end in CAPITAL Letter "D" DESCRIPTION: Will move the cursor to the LEFT "x" columns, but will stay on the same row. EXAMPLES: ESC[3D - Move LEFT 3 columns, but STAY on the SAME row. ESC[15D - Move LEFT 15 columns, but STAY on the SAME row. ---------------------------------------------------------------------------- ESC [ x E <--- MUST end in CAPITAL Letter "E" DESCRIPTION: Will move the cursor DOWN "x" rows, and will place the cursor in column 1 of that row. EXAMPLES: ESC[3E - Move to column 1, 3 rows BELOW current row. ESC[12E - Move to column 1, 12 rows BELOW current row. ---------------------------------------------------------------------------- ESC [ x F <--- MUST end in CAPITAL Letter "F" DESCRIPTION: Will move the cursor UP "x" rows, and will place the cursor in column 1 of that row. EXAMPLES: ESC[9F - Move to column 1, 9 rows ABOVE current row. ESC[20F - Move to column 1, 20 rows ABOVE current row. ---------------------------------------------------------------------------- ESC [ r;c f <--- End in EITHER a LOWERCASE "f", or a CAPITAL Letter "H" DESCRIPTION: Will move the cursor to Row "r", Column "c". Row and column MUST be separated with a semicolon(;). EXAMPLES: ESC[5;15f - Move cursor to Row 5, Column 15. ESC[23;1f - Move cursor to Row 23, Column 1. ESC [ r f <--- End in EITHER a LOWERCASE "f", or a CAPITAL Letter "H" DESCRIPTION: Specifying ONLY the Row "r" will move the cursor to Column 1 of Row "r". EXAMPLES: ESC[5f - Move cursor to Row 5, Column 1. ESC[18f - Move cursor to Row 18, Column 1. ESC [ ;c f <--- End in EITHER a LOWERCASE "f", or a CAPITAL Letter "H" DESCRIPTION: Specifying ONLY the Column "c" will move the cursor to Column "c" of Row 1. EXAMPLES: ESC[;7f - Move cursor to Row 1, Column 7. ESC[;35f - Move cursor to Row 1, Column 35. NOTES: When specifying ONLY the Column, use a semicolon(;) BEFORE the Column value to differentiate it from the Row value. ---------------------------------------------------------------------------- ESC [ r;c H <--- End in EITHER a CAPITAL Letter "H", or a LOWERCASE "f" DESCRIPTION: Will move the cursor to Row "r", Column "c". Row and column MUST be separated with a semicolon(;). EXAMPLES: ESC[5;15H - Move cursor to Row 5, Column 15. ESC[23;1H - Move cursor to Row 23, Column 1. ESC [ r H <--- End in EITHER a CAPITAL Letter "H", or a LOWERCASE "f" DESCRIPTION: Specifying ONLY the Row "r" will move the cursor to Column 1 of Row "r". EXAMPLES: ESC[5H - Move cursor to Row 5, Column 1. ESC[18H - Move cursor to Row 18, Column 1. ESC [ ;c H <--- End in EITHER a CAPITAL Letter "H", or a LOWERCASE "f" DESCRIPTION: Specifying ONLY the Column "c" will move the cursor to Column "c" of Row 1. EXAMPLES: ESC[;7H - Move cursor to Row 1, Column 7. ESC[;35H - Move cursor to Row 1, Column 35. NOTES: When specifying ONLY the Column, use a semicolon(;) BEFORE the Column value to differentiate it from the Row value. ---------------------------------------------------------------------------- ESC [ 1 J <--- MUST end in CAPITAL Letter "J" DESCRIPTION: Will Clear(Erase) the screen STARTING at the HOME Position, Row 1 / Column 1, and ENDING at the current cursor location. EXAMPLES: ESC[1J - Blank everything ABOVE and to the LEFT of the current cursor location. ---------------------------------------------------------------------------- ESC [ 2 J <--- MUST end in CAPITAL Letter "J" DESCRIPTION: Will Clear(Erase) the ENTIRE screen, then place the cursor at the HOME Position(Row 1, Column 1). EXAMPLES: ESC[2J - Blank the WHOLE Screen, then move the cursor to the UPPER LEFT corner of the screen. ---------------------------------------------------------------------------- ESC [ 3 J <--- MUST end in CAPITAL Letter "J" DESCRIPTION: Will Clear(Erase) the screen STARTING at the current cursor location, and ENDING at the BOTTOM of the screen. EXAMPLES: ESC[3J - Blank everything BELOW and to the RIGHT of the current cursor location. NOTES: You can also use this command by leaving the "3" OUT of the command, like this: ESC [ J (Example: ESC[J ) ---------------------------------------------------------------------------- ESC [ 1 K <--- MUST end in CAPITAL Letter "K" DESCRIPTION: Will Clear(Erase) from the BEGINNING of the line to the Column the cursor is sitting in. EXAMPLES: ESC[1K - Blank everything UNDER and to the LEFT of the current cursor location. ---------------------------------------------------------------------------- ESC [ 2 K <--- MUST end in CAPITAL Letter "K" DESCRIPTION: Will Clear(Erase) the ENTIRE line the cursor is sitting on, but will NOT delete the line. EXAMPLES: ESC[2K - Blank everything UNDER, LEFT, and RIGHT of the current cursor location. ---------------------------------------------------------------------------- ESC [ 3 K <--- MUST end in CAPITAL Letter "K" DESCRIPTION: Will Clear(Erase) from the current cursor location to the END of the line. EXAMPLES: ESC[3K - Blank everything to the RIGHT of the current cursor location. NOTES: You can also use this command by leaving the "3" OUT of the command, like this: ESC [ K (Example: ESC[K ) ---------------------------------------------------------------------------- ESC [ x L <--- MUST end in CAPITAL Letter "L" DESCRIPTION: Will INSERT "x" new lines BELOW the cursor. EXAMPLES: ESC[4L - Insert 4 blank lines below the line the cursor is currently sitting on. NOTES: ALL rows BELOW the cursor will be moved DOWN the screen to make room for the inserted lines. Rows will be pushed OUT the BOTTOM of the screen IF NEED BE. The UPPER rows will NOT scroll UP to make room. ---------------------------------------------------------------------------- ESC [ x M <--- MUST end in CAPITAL Letter "M" DESCRIPTION: Will DELETE "x" rows, starting at the Cursor's row. EXAMPLES: ESC[5M - Delete the row the cursor is on and the 4 rows BELOW the cursor. (5 rows in all) NOTES: The rows left over will be PULLED UP to meet the row above the current cursor's row. No GAPS will be shown. ---------------------------------------------------------------------------- ESC [ s;f;b m <--- MUST end in LOWERCASE Letter "m" DESCRIPTION: See the END of this List for the FULL DESCRIPTION on using this command. ---------------------------------------------------------------------------- ESC [ x P <--- MUST end in CAPITAL Letter "P" DESCRIPTION: Will Delete(Pull) "x" characters to the RIGHT of the cursor INTO the cursor, so as not to leave a GAP. EXAMPLES: ESC[3P - Erase the 3 characters to the RIGHT of the cursor by PULLING the line INTO the cursor. ---------------------------------------------------------------------------- ESC [ x S <--- MUST end in CAPITAL Letter "S" DESCRIPTION: Will Move(Slide) the ENTIRE Screen UP "x" Rows. EXAMPLES: ESC[5S - Bump the screen UP 5 rows. ESC[23S - Bump the screen UP 23 rows. NOTES: Any text at the TOP of the screen will be PUSHED OUT the top of the screen and CAN'T be gotten back. ---------------------------------------------------------------------------- ESC [ s <--- MUST end in LOWERCASE Letter "s" DESCRIPTION: Will Save(Remember) the cursor's current Row and Column. EXAMPLES: ESC[s - Remember the Row and Column the cursor is presently sitting in. NOTES: Use the "u" command to place the cursor BACK to this "saved" screen position. ---------------------------------------------------------------------------- ESC [ r t <--- MUST end in LOWERCASE Letter "t" DESCRIPTION: Will make Row "r" the new BOTTOM of Screen. ALL text BELOW this row will be LOCKED in place, as all scrolling will only occur ABOVE this row. EXAMPLES: ESC[13t - Set Row 13 as the BOTTOM of the screen. Line scrolling will BEGIN on this row, so as not to disturb any rows BELOW this line. ---------------------------------------------------------------------------- ESC [ x T <--- MUST end in CAPITAL Letter "T" DESCRIPTION: Will Move(Slide) the ENTIRE Screen DOWN "x" Rows. EXAMPLES: ESC[8T - Bump the screen DOWN 8 rows. ESC[15T - Bump the screen DOWN 15 rows. NOTES: Any text at the BOTTOM of the screen will be PUSHED OUT the bottom of the screen and CAN'T be gotten back. ---------------------------------------------------------------------------- ESC [ u <--- MUST end in LOWERCASE Letter "u" DESCRIPTION: Will place the cursor at the last Saved screen location, or use current location if no location was saved previously. EXAMPLES: ESC[u - Move the cursor to the row and column that were last "remembered" by the "s" command. NOTES: Use the ESC [ s command FIRST to SAVE a screen location. NOTES2: Also, I've found that if an ESC [ s was NOT used in the file before hand, that the cursor will disappear if used right before a prompt. If the ESC [ s command IS ever used, then this CURSOR HIDE is disabled. I'm still trying to figure out how to reinitialize the "s" command to a NULL state, which would reenable the "u" HIDING feature. ---------------------------------------------------------------------------- ESC [ p x <--- MUST end in LOWERCASE Letter "x" DESCRIPTION: Will move the Pixel Cursor "p" Pixels to the RIGHT of it's current position. EXAMPLES: ESC[4x - Moves 4 Pixels to the RIGHT. This is about one half the distance between characters on a 640 by 200 screen. NOTES: This, and the "y" command, are those used by the IFF to ANSI Conversion programs. The "Pixel" cursor appears to be located on the TOP Pixel row of the cursor character. ---------------------------------------------------------------------------- ESC [ p y <--- MUST end in LOWERCASE Letter "y" DESCRIPTION: Will move the Pixel Cursor "p" Pixels BELOW it's current position. EXAMPLES: ESC[10y - Moves 10 Pixels DOWN. This is about the size of one row on the screen. NOTES: This, and the "x" command, are those used by the IFF to ANSI Conversion programs. The "Pixel" cursor appears to be located on the TOP Pixel row of the cursors character. ---------------------------------------------------------------------------- ESC [ x @ <--- MUST end in SYMBOL Character "@" DESCRIPTION: Will INSERT "x" characters AFTER the Cursor. EXAMPLES: ESC[5@ - Pushes the character AFTER the cursor, and any other characters on that line to the RIGHT 5 spaces. A GAP is made when using this command. ---------------------------------------------------------------------------- ESC [ s;f;b m <--- MUST end in LOWERCASE Letter "m" DESCRIPTION: This command is used to modify the way TEXT appears on your screen. The Style, ForeGround, and BackGround, of the Text can be modified using this command. NOTES: Style "s", ForeGround "f", and BackGround "b". ALL values are separated using the semicolon (;). You may include as MANY, or as FEW of the following within this command. Text Styles: 0 - Normal Text (White Text On Black BackGround) 1 - Bright Text (The High 8 Colors: 9-f MCI's) 4 - UnderLined Text (Sometimes Called UnderScored) 5 - Bold Text (Flashing Text on IBM's) 7 - Reverse Text (ForeGround & BackGround Switch) ForeGrounds: 30 - Black Text BackGrounds: 40 - Black Field 31 - Red Text 41 - Red Field 32 - Green Text 42 - Green Field 33 - Yellow Text 43 - Yellow Field 34 - Blue Text 44 - Blue Field 35 - Purple Text 45 - Purple Field 36 - Cyan Text 46 - Cyan Field 37 - White Text 47 - White Field NOTES: As you can see, the BackGround values are simply 10 higher than their ForeGround counterparts. Values can be placed in ANY order within the "m" command, as shown in these examples: EXAMPLES: ESC[1;31;44m - Text appearing AFTER this command will be in BRIGHT RED on a BLUE BackGround. Note that the "Bright" colors coincide with the upper 8 MCI Colors: 8, 9, a, b, c, d, e, f. ESC[5;33;42m - Text appearing AFTER this command will be in BOLD YELLOW on a GREEN BackGround. Text will FLASH, instead of BOLD on IBM's. ESC[1;5;35;47m - Text appearing AFTER this command will be in BRIGHT, BOLD PURPLE on WHITE BackGround, or BRIGHT, FLASHING PURPLE on WHITE for IBM Machines. ESC[33;45m - Text appearing AFTER this command will be in YELLOW on a PURPLE BackGround. ESC[7;33;45m - Text appearing AFTER this command will be in PURPLE on YELLOW BackGround. Note that COLORS "33" and "45" are the same as in the above example, except "7" (Inverse) is being used. ESC[1;7;31;44m - NEAT TRICK! Text appearing AFTER this one will be BLUE on a BRIGHT RED BackGround. This emulates the MCI: \z9\c4, IF the "Z" MCI command would support numbers greater than 7. Only way to do this is through ANSI coding! Again, NEAT TRICK! ESC[0m - This command will TERMINATE ALL Styles, -or ForeGrounds, and BackGrounds, and return ESC[m to a WHITE on BLACK initial state. NOTES: Keep in mind that the "Styles" are ENABLE Only. By this, I mean the ONLY way to DISABLE a Style is with the ESC[0m command. This isn't so bad, but that it will ALSO DISABLE ALL other Styles. This can kind of be a nuisance when you wish to mix Bright and Regular colors, like this: ESC[1;32mMESC[0;32main ESC[1;32mPESC[1;32mromptESC[1;37m: This long ANSI Line creates: Main Prompt: Where the "M" and "P" are in BRIGHT GREEN, other letters are in regular GREEN, and the colon is in BRIGHT WHITE. Notice that you have to use the "0" parameter to select regular GREEN, then back to "1" for BRIGHT GREEN again. ============================================================================ Well, that completes the list of KNOWN (by me) Amiga ANSI Codes. As I mentioned earlier, if I find any other ANSI codes, I'll be sure to add them into this list sometime in the future. Lastly, I'd like to mention ANSI Macros, aka Signature Files. I've made numerous ones for myself over the past few years using my favorite IBM ANSI drawing program, BBS Draw, v4.0. Once created, I toss a copy of my signature in my uploads directory for my term program. Whenever I call another bbs, I use the .Z (Zip Upload) command to send my new signature to that bbs. Use Xmodem proto, instead of Ascii as CNet will strip the ESC codes if sent via ASCII(This is because sending via Ascii is the same as emulating yourself as having actually typed this text in, and if you'll recall from above, when we TYPE ANSI codes into the editor, we need to press the ESC key TWICE in order for it to appear. If you created an ANSI picture using double ESC codes, then this Ascii problem would not exist!). I've never had a problem uploading ANSI files using Xmodem. Give it a try! YOUR bbs should NOT be the ONLY place you use your CUSTOM Signature Files! The codes referred to in this article have been FULLY TESTED using my copy of CNet Amiga, and SHOULD function as prescribed on ALL versions of CNet from 3.05c to the present. If you know of another ANSI Amiga Code that is NOT part of this list, PLEASE let me know. I'd LOVE to add it to this list. I feel this to be the most complete Amiga ANSI Code listing available. Finally, as yet another help, I created a QUICK ANSI Listing, which has short descriptions of ALL ANSI Codes covered above. This listing was written to fit nicely on ONE sheet of paper, roughly 60 to 64 lines, PICA or ELITE. This listing can be found as the filename "ANSI_List2" in this archive. For the ARexx Programmers out there, check the "ANSI_Rexx" file, which is also located in this archive. This file is an article on how to use ANSI in your programs. Things like how to read the cursor arrow keys, the ESC key, the ENTER key, etc. can all be done through Arexx. Read it and find out now! - Dotoran ============================================================================ Call Frontiers BBS (716)/823-9892 Today! ============================================================================