💾 Archived View for spam.works › mirrors › textfiles › programming › ansi.txt captured on 2023-11-14 at 11:47:19.

View Raw

More Information

⬅️ Previous capture (2023-06-16)

-=-=-=-=-=-=-

THE........
             ______           _______   ______                             ____
    /     / /     / /     /      /     /     /  /|  /|     /|     / /     /
   /     / /     / /     /      /     /     /  / | / |    / |    / /     /
  /_____/ /     / /     /      /     /     /  /  |/  |   /__|   /_/     /__
 /     / /     / / /|  /      /     /     /  /       |  /   |  /  \    /
/     / /_____/ /_/ |_/      /     /_____/  /        | /    | /    \  /____
                                       _____ ______
                      /|     /|    /  /        /
                     / |    / |   /  /        /
                    /__|   /  |  /  /____    /
                   /   |  /   | /       /   /
                  /    | /    |/  _____/ __/___
File By:

                  |\      |\        /     |\   |\      /| |\   |\
                  | \   / | \      /   /  | \  | \    /_| | \  | \
                  ||\\ /__|__     /   /_  |__\ |__\  /  | |__\ ||\\
                  ||// \  |      /____\   |    |    /   | | \  ||//
                  | /   \ |            \                       | /
                  |/      |                                    |/

                           Sysop of the Amiga Tele-Trader
                           1200/2400/9600/19200 Hst USR 
                           65 Megs
                           over 250 one line Documents
                           The Latest Warez.
                           406-782-3161

Ok well it is about time someone make a file on how to make Ansi. There have 
been a few made in the past but most were quite lacking! Well the first thing
you will need is a text editor that allows you to put escape into a file.
A good one is MicroEmacs on the extras disk. It has a function called 
Quote-char that allows you to put Ascii code 27 in your text file (the Escape
Key). To put an escape character in your file on MicroEmacs type Ctrl-Q then
hit the escape key. It will type a "^[" on the screen this is how the escape
code is symbolized by this text editor. Now all you need are a few codes and
your imagination and you are off. There is one thing you must know. If you
plan to use your ansi on a BBS there are two types of Ansi (Vt-100 & Vt-102)
supporting term programs. There are the 8 color ones (Online! for example)
which allow 8 colors on the screen and usually have a black background color
and then there are the 4 color term programs (Like Diga!) that only allow
4 colors on the screen and usually have a blue background. If you use 8 colors
in your Ansi graphics and someone calls you with a 4 color term program they
will not see the last four colors or the last four will be displayed as white
which is how some terms handle the extra colors. Either way they will probably
not be able to understand your graphics so it is a good idea to make two sets
of menus and/or other files that are printed on the bbs one for 8 color users
and one for 4 color users.

   First of all there are the 8 foreground color codes:
 
   30.......Black (invisible) _
   31.......Red                \
   32.......Green               |----- Use onle 30-33 for 4 color terms
   33.......Yellow            _/
   34.......Blue
   35.......Magenta
   36.......Cyan
   37.......White
   
   Then there are the 8 Background color codes:

   40.......Black (no background color) _
   41.......Red                          \
   42.......Green                         |---Use only 40-43 for 4 color terms
   43.......Yellow                      _/
   44.......Blue
   45.......Magenta
   46.......Cyan
   47.......White

Ok so lets say you want to print the word welcome in blue letters with a yellow
background. You would type (for microemacs) a CTRL-Q the the ESC key. This would
give you the ^[. Then type [43;34m. This would show up as a ^[[43;34m on the
screen. For any color changes you must put the "m" (make sure its lowercase!)
at the end this tells the term program its the end of the Ansi sequence. You 
do not always have to specify the background/forground colors. If you wanted
to change the text to Black but leave the background yellow just type
^[[30m because once you set a background or foreground it stays that way until
you set it different. So one last time if you wanted to print the word AMIGA
with each letter a different color with a black back ground it would look like
this (on MicroEmacs):

 ^[[31mA^[[32mM^[[33mI^[[34mG^[[35mA

this would give you: 

AMIGA

Ok now onto the much more fun stuff Cursor Movement. There are 2 ways to move
the cursor. 

1. To specify a Row and Column for the cursor.
2. To tell the cursor to move in relationship to its current location.

Either way is quite easy and they each have their own benefits.

Ok to place the cursor at Row 3 column 50 the sequence would look like this.

   ^[[3;50H (make sure you put an H at the end of this sequence just like the
             m for color.)

   It is quite easy to do cursor movements this way but the file can become 
quite LONG! 
 
The second way is to make cursor movements relative to the currsors last 
location. Such as moving it up 10 over 5 or something.

This is done with 4 different ansi codes :

  ^[[nA Up   ___
  ^[[nB Down    \
  ^[[nC Right    |--------- Where the n is the number of space you want to move
  ^[[nD Left ___/
   
So a ^[[30D^[[10A would move the cursor right 30 and up 10.

The final phase! Viewing your new creation.

There are a few ways you can view your new creation. If you are setting it up
for use on a bbs just logon locally and type the file from the BBS it will 
show it to you in Ansi mode. If you created a 4 color picture just open a CLI
make it full screen size if you have cursor movement so it looks right and type
it, it will show it to you in ANSI. This is also a good way to see what an 8 
color picture looks like to a 4 color term user because workbench is only 4
colors. There are just about no other ways to view an 8 color ansi file unless
you were to set up 8 color workbench with the PD program to make an 8 color
workbench.

Oh ya there are also a few other ansi codes that may help you a little:

   ^[[0m...... Normal text (resets color type style and everything else)
   ^[[1m...... Bold text
   ^[[4m...... Underline (good for making unbroken straitlines)
   ^[[5m...... Italics (will cause text to Blink on an IBM)
   ^[[7m...... Italics (will make italics on amiga and IBM)
   ...... Truns cursor off completely it does what you tell it to but
               all actions are invisible.

The above codes can be put together in a color code sequence like:

 ^[[34;41;7m would make it blue on red with italics turned on. Remember you
have to shut off the italics or ieverything after that will be printed in
italics and to turn it off you must send a ^[[0m then the colors are returned
to noramal also you must reset them back to what you were using before if you
want to stay with that color!

Ok well now you are all ready to create your masterpiece! Also to view Ansi
remember you must be set at VT-100 or VT-102 and at 8N1. 


Special note to BBS-PC! users. If you make a text file with the above codes 
it will work fine but if you want ansi in the Menu instead of putting the
CTRL-Q esc key in the title ="" lines just put a \27 it works the same.
 
So make a picture today and upload it to the special Ansi Graphics contest of
the amiga tele-trader! Your picture may be the best and be displayed on the log
off screen and you recieve 5 Upload credits!

New Contest EVERY MONTH!