-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- The (almost) Last Word on ANSI Used with the AMIGA in Telecommunications -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Prepared by: Steve Lewis Purpose : Use with setting up menus and text for BBSes Also useful in understanding the Amiga's console Date : November 30, 1988 Foreword: I've run a BBS and wanted to be able to create some really slick menus and files but no matter where I looked, I could not find any "really good" documentation on what I could and couldn't do as defined by the ANSI standard. My search included a half a dozen BBSes (both Amiga and IBM), an on-line service (GEnie) in a dozen different RT's (an Amiga user in the Atari ST area!?), and a search of the Academic American Encyclopaedia on-line via Arizona State University's computer system. EEEEEGADS! What was I to do? Thanks to some prowling around his messy bedroom, my buddy Ric Moyer came to the rescue. I don't know where he came by the information he supplied me with, but I suspect it was from documentation received when he worked with DEC a few months ago. Below is a fairly complete (99%) subset of codes, with just a few omitted because they don't work properly on anything I tried them on, and if improperly used could render a user's terminal in a near brain-dead state (and we wouldn't want to do that, would we?). I probably should take a moment and remind everyone that the Amiga CONSOLE DEVICE does not understand nearly as many of these standard sequences as we'd all like it to, plus it has a few trick sequences of its own (at the very bottom of this doc). If you are one of the lucky few that bought Bantam's AmigaDOG Ref Manual, you'll find a section in that which documents the supported CONSOLE sequences. As a reminder--- In all occurences of , the characters required to be placed before the sequence are the escape character (hex code $1B) plus left bracket ($5B). As freaky as this may seem, the terminal GT will also accept the single byte which is $9B if all 255 incoming characters are enabled. This is not the case of Access! or Online!, so 's should always be sent in the traditional two byte sequence. In all occurences of , the character required is simply the escape character ($1B). In all occurences of CTRL-, it means the character created by holding down the control key and striking the letter immediately following (generating the first 31 ascii codes, of course). In all sequences where a letter terminates the sequence, the case of the letter is important. An "H" is NOT the same as an "h" and will cause the sequence to malfunction. Many sequences have optional parameters associated with them. In all sequences where the "#" (pound sign) appears, a number is permissible (and sometimes required). Different examples of each will be given where possible. Some sequences can take two or more parameters. Where two are normally used, you'll see #;#. This means to enter the first number, followed by a semi-colon, followed by the second number. If additional paramerts may be used, each parameter is separated from the preceeding with a semi-colon. Most of you are already familiar with these conventions, so I'll not waste more time with them. Now for the fun stuff: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- TEXT ATTRIBUTES --------------- Each character on the screen has several attributes associated with it. Foreground and background colors, bold facing, italicizing, blinking, underlining and reverse video are all controlled here. The format(s) for setting ATTRIBUTES are: #m for setting one attribute #;#m for setting two attributes #;#;#m for setting three, and so forth Once an attribute is set, it will continue to be in force until changed again. FOREGROUND COLOR BACKGROUND COLOR 30 black 40 black 31 red 41 red 32 green 42 green 33 yellow 43 yellow 34 blue 44 blue 35 magenta 45 magenta 36 cyan 46 cyan 37 white 47 white CHARACTERISITIC --------------- 0 turn off all attributes - normal text with default (usually white) foreground and default (usually black) background 1 boldface 2 see below 3 italicize (doesn't work on Online!; use blink) 4 underscore 5 blink (used for italicize for Online!) 7 reverse video NOTE for 2 - the standard calls for its use like so: 21 cancel boldface 23 cancel italicize 24 cancel underscore 25 cancel blink 27 cancel reverse The 2x cancels are NOT implemented in the Amiga terminal program Online!, nor any of the others I have tested. Example useage: You want a red background with white text which is italicized boldface to really stand out... You would create it with: 41;37;1;3mText to standout goes here On screens destined to be read on an Amiga, remember to substitute the attribute for blink in place of italicize... Sorry, I didn't write the OS for the machine... -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- CURSOR MOVEMENT --------------- Positioning the cursor on the screen can make for some striking effects! I hope that I can simplify your use of these commands. Please note that there are other sequences which will move the cursor as a side effect of their operation; you'll need to experiment with them. There are two modes of cursor positioning - absolute and relative. Absolute regards movement within the entire screen, while relative concerns movement inside of the defined window. Right off the bat, I'll define the mode of movement sequence which may be required for you: ?6l -Absolute positioning on screen ?6h -Relative positioning within window Once you have a window defined, all cursor movements are relative to the window. Windows, by the way, are the full width of the screen. Now for the bad news... The only Amiga terminal programs that support the scroll window (up to this point) are Online! and Diga!. This is a shame, but there is a way to emulate it with terminals that pass the private Amiga sequences shown at almost the bottom of this document. MOVING CURSOR TO A SPECIFIED POSITION ------------------------------------- H Takes it home (1,1) #H Takes it to line # #;#H Takes it to line # and column # or... f Takes it home (1,1) #f Takes it to line # #;#f Takes it to line # and column # MOVING CURSOR AROUND (L, R, U, D) --------------------------------- Note that ALL have the option of specifying number of positions to move! A Move up one line #A Move up # lines B Move down one line #B Move down # lines C Move forward (right) one character #C Move forward (right) # characters D Move backward (left) one character #D Move backward (left) # characters MISC CURSOR MOVEMENT -------------------- CTRL-I Move to next tab stop H Set tab stop at current position g Clear current tab stops 3g Clear ALL tab stops D Equivalent to linefeed. Causes screen or window to scroll upward and off when bottom is reached. M Reverse of D. Advances cursor upward to top of screen or window and causes text to scroll off in a downward direction when limit is reached. E Equivalent of carriage return-linefeed. 7 -Save cursor position (In some documentation on the IBM ANSI.SYS handler, it is documented that [s will save the cursor position. This works with Online! but is not "standard.") 8 -Restore cursor position last saved (In some documentation on the IBM ANSI.SYS handler, it is documented that [u will restore the cursor position. This works with Online! but is not "standard.") -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- CHARACTER MOVEMENT ------------------ P Delete character under cursor. Moves remainder of line left. #P Deletes # of characters. Moves remainder of line left. @ Insert blank character at cursor position. Moves line right. #@ Insert # of blank characters. Moves line right. X -+Replaces character under cursor with blank space. #X -+Replaces # of characters under cursor with blank spaces. K Blanks all characters under and to right of cursor. 1K -Blanks all characters under and to left of cursor. 2K -Blanks all characters on current line. Cursor to left margin. LINE MOVEMENT ------------- L Insert line at cursor position. Scrolls lines below down. #L Insert # lines at cursor position. Scrolls lines below down. M Deletes line at cursor position. Scrolls lines below up. #M Deletes # lines at cursor position. Scrolls lines below up. J -Blanks all characters to right of and lines below cursor. 1J -Blanks all characters to left of and lines above cursor. 2J -Blanks all characters. Cursor to home. CTRL-L -Blanks all characters. Cursor to home. #;#r -Sets top of window to #, bottom of window to #. r -Sets window to default full screen size. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- TERMINAL MODES -------------- 2l -+Set caps lock off. 2h -+Set caps lock on. 4l - Overwrite new characters. 4h - Insert new characters. 12l Defined but misunderstood 8-). 12h ... 20l Linefeed acts as linefeed. 20h Linefeed acts as newline. ?1l - Standard arrow key sequence returns (for cursor movement). ?1h - Applications arrow key sequence returns. ?2l - VT-52 emulation. ?2h - Ya kidding? If you go into VT-52, you have to send a VT-52 sequence to get back! Use < ?3l - 80 column wide terminal. ?3h - 132 column wide terminal. ?4l -+Coarse scroll. ?4h -+Smooth scroll. ?5l -+Normal screen. ?5h -+Inverse video screen. ?6l - (Mentioned above) Absolute cursor positioning. ?6h - (Mentioned above) Relative cursor positioning. ?7l - Line wrap off. ?7h - Line wrap on. ?8l -+Key repeat (on or off, forgot to write it down 8-(...) ?8h -+Opposite of the above sequence ?25l -+Cursor off. ?25h -+Cursor on. > - Normal numeric keypad return codes. = - Applications program return codes. CTRL-N Shift out to alternate character set. CTRL-O Shift in to normal character set. Ack! Are these enough to play with to drive your users crazy? Probably! ALWAYS keep in mind that some sequences are simply not supported by the user's terminal program. SYSOPs using BBS-PC may want to verify the operation of their most bizarre sequences on various terminal programs and set up separate menu sets depending on the user's terminal program. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- PRIVATE AMIGA SEQUENCES ----------------------- These sequences are supported on the Amiga computer and may be filered out by the terminal program (Online! filters them out, but Access! and others do not). #t +Set screen length #u +Set line length #x +Set left offset in pixel positions #y +Set top offset in pixel positions p -+Turn cursor off 1p -+Turns cursor on S -+Removes line from top. Scrolls screen up. Blanks bottom line. T -+Removes bottom line. Scrolls screen down. Blanks top line. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Sequences that are NOT supported in Online! are indicated with a + Sequences that are NOT supported in Access! are indicated with a - I've tried all sequences with Online! and the documentation notation for Online is pretty damned accurate. Access! has also had a pretty fair going- over, too. GT (Baud Bandit) and AMIC have not had nearly as much confirmation and, therefore, aren't notated. Generally speaking, Access! and GT pass the private Amiga sequences to the CONSOLE for processing while Online! does not. AMIC? Who knows (their test version of what's to become the release hacks up ANSI so badly it's a wonder that it even comes close to working). With the exception of Online, a set to default text attributes (a 0m) will cause the background color register to become 40m (usually black) and the foreground color register to become 31m (except with Online where the the register becomes 37m (The standard). On all terminals that support only four colors, any printing done in 34m will turn invisible. 35m will turn into 31m, 36m will turn into 32m and 37m will turn into 33m. Fun stuff, huh? -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-