home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Crawly Crypt Collection 1
/
crawlyvol1.bin
/
bbs
/
qansi
/
qansi.doc
next >
Wrap
Text File
|
1989-11-06
|
14KB
|
316 lines
--------------------------------------------------------------------------
--- The QuickBBS ST Ansi Emulator ---
--- (and related topics) ---
--------------------------------------------------------------------------
[1] What is Ansi?
ANSI is short for American National Standards Institute. The ANSI
organisation develops and documents standards, especially in the area
data communications. One of those standars is Ansi X3.64, which is a
terminal emulation protocol. It helps a host computer, or a program
running locally, use the intelligent console, with features such as
cursor movement, advanced text attributes etc.
ANSI is also the name of the screen and keyboard driver used on MS-
Dos machines (ANSI.SYS). The choice of name is not rather idiotic,
because ANSI.SYS is neither a complete implementation of X3.64, nor
a subset of X3.64. Anyway, when I refer to ANSI in this document, I
mean the MicroSoft version. Some communication programs (such as
ProComm and Telix) call it Ansi-BBS.
[2] What has Ansi got to do with QuickBBS ST?
A hell of a lot of PC communications packages have an Ansi mode. It's
fairly easy for 'them', because they can just re-route the incoming
characters straight to the console driver. To make it possible for PC
users with such packages to have 'fancy' screens and menus in
QuickBBS ST, a graphics mode called 'Ansi-BBS' is available. Due to
the fact that I have to do my own screen driving, it is *much* slower
than the VT-52 modes when used locally, but on-line it shouldn't make
too much difference. When operating in Ansi mode QuickBBS will use an
MS-Dos style font, so you can create box graphic text files.
[3] Ansi compared to VT-52.
Both Ansi and VT-52 use things called Escape Sequences. An Escape
Sequence is a string of characters which starts with an ESC character
(27), followed by one or more parameters. An example of an Ansi
escape sequence is
<ESC> [ 10; 20 H
Where <ESC> is the an escape, and the spaces are only for clarity (as
in the rest of this document). This particular escape sequence makes
the cursor move to line 10, column 20, and is defined by the 'H' at
the end.
The VT-52 version of this escape sequence is
<ESC> Y * 4
The '<ESC> Y' indicates that the cursor has to be moved, and is
followed by two characters whose ASCII codes are Y and X plus 32
(10+32 = 42 = "*", 20+32 = 52 = "4").
Note that the VT-52 sequence is much more efficient for two reasons:
1) The code is 4 bytes instead of 8.
2) The command is followed by the parameters, instead of parameters
followed by command. For practical reasons this is much easier
to implement.
So, if possible, use one of the VT-52 modes of QuickBBS ST instead of
Ansi.
[4] Limitations and differences.
Due to the structural differences between the screen of a PC and that
of an ST, the Ansi driver in QuickBBS ST has some 'differences'...
1) A PC with CGA monitor can display 8 colours for foreground and
8 colours for background, whereas the ST can only display 4
each on a colour monitor. See the 'change attributes' escape
sequence to see how Quick handles colours.
2) A PC can underline, highlight, blink and reverse text. An ST
using BIOS/GEMDOS for output can only use reverse. See the
'change attributes' escape sequence.
3) I have not found any way of changing the scroll region X, Y,
and Width for TOS output.
4) All escape sequences that QuickBBS ST doesn't know will be
ignored. They WILL however be sent to the user on-line.
The implementation in QuickBBS ST also has some escape sequences not
found in ANSI.SYS, but which are part of X3.64, or frequently used by
Unix machines.
[5] Recognised Escape Sequences.
QuickBBS ST recognises and reacts to the following escape
sequences. All characters in <brackets> should be replaced, and
spaces should be removed...
Name : CUU - Cursor Up
Escape : <ESC> [ <n> A
Example : <ESC> [ 5 A
This sequence moves the cursor up <n> lines. If parameter <n> is
ommited, the cursor moves up one line. The cursor will not move off
the screen, nor will the screen scroll down. The cursor remains on
the same column.
Name : CUD - Cursor Down
Escape : <ESC> [ <n> B
Example : <ESC> [ 3 B
CUD is the same as CUU (cursor up), but the cursor is moved down
instead.
Name : CUF - Cursor Forward (right)
Escape : <ESC> [ <n> C
Example : <ESC> [ 8 B
This moves the cursor <n> columns to the right. If the cursor reaches
column 80, it will stay there. The cursor remains on the same line.
If <n> is ommited, the cursor moves one column.
Name : CUB - Cursor Backward (left)
Escape : <ESC> [ <n> D
Example : <ESC> [ 7 D
Is identical to CUF (cursor forward), exept that the cursor is moved
to the left, as far as the left hand side of the screen.
Name : CUP - Cursor Position
Escape : <ESC> [ <y> ; <x> H
Example : <ESC> [ 10 ; 20 H
This escape moves the cursor to location (x,y), where X is between 1
and 80, and Y between 1 and 24. If <y> and <x> are ommited, the
cursor is moved to the top left-hand corner (1,1). The sequences
<ESC> [ <y> ; <x> H
<ESC> [ <y> ; <x> f
<ESC> [ <y> ; <x> j
are identical, but the first is recommended.
Name : SCP - Save Cursor Position
Escape : <ESC> [ s
SCP tells the Ansi driver to note down the current cursor position
for future use. If an RCP is received the cursor will be returned to
this position. The SCP and RCP escapes are not nestable.
Name : RCP - Restore Cursor Position
Escape : <ESC> [ u
RCP places the cursor at the location noted down by SCP.
Name : ED - Erase Display
Escape : <ESC> [ <n> J
Example : <ESC> [ 2 J
ED erases all or part of the screen depending on the parameter <n>.
If this parameter is ommited, it is assumed to be '0'...
<n> = 0 : The screen is erased between the current cursor
location and the lower right corner of the screen,
inclusive. The cursor doesn't move.
<n> = 1 : The screen is erased between the upper left corner of
the screen and the current cursor location, inclusive.
The cursor doesn't move.
<n> = 2 : The whole screen is erased and the cursor is moved to
the upper left corner.
The screen is cleared using the current background colour.
Name : EL - Erase Line
Escape : <ESC> [ <n> K
Example : <ESC> [ 0 K
All or part of the current line is erased, depending on parameter
<n>. The cursor is never moved by this escape. If <n> is ommited, it
is assumed to be '0'...
<n> = 0 : All characters to the right of the cursor are erased.
<n> = 1 : All characters to the left of the cursor are erased.
<n> = 2 : All characters on the current line are erased.
The line is cleared using the current background colour.
Name : IL - Insert Lines
Escape : <ESC> [ <n> L
Example : <ESC> [ 3 L
IL inserts <n> lines at the current cursor location. The current line
and all lines below it are moved down. Lines at the bottom of the
screen will be lost. If <n> is omitted, one line is inserted. The
cursor doesn't move. The new line will be displayed in the current
background colour.
Name : DL - Delete Lines
Escape : <ESC> [ <n> M
Example : <ESC> [ 9 M
DL deletes <n> lines, starting with the current cursor line. All
lines underneath the line(s) to be deleted will be moved up. New
lines, in the current background colour, will appear at the bottom of
the screen. The cursor doesn't move.
Name : DECSC - DEC Private, Save Cursor Parameters
Escape : <ESC> 7
This is supposed to be a DEC Private escape, but is used on other
systems as well. It saves the current cursor position (like SCP), but
also stores the current text attributes and colours. With DECRC these
parameters can be restored. THIS IS NOT IMPLEMENTED IN ANSI.SYS!!!
Name : DECRC - DEC Private, Restore Cursor Parameters
Escape : <ESC> 8
DECRC is the opposite of DECSC, and restores the saved cursor
parameters. THIS IS NOT IMPLEMENTED IN ANSI.SYS!!!
Name : RIS - Reset to Initial State
Escape : <ESC> c
This 'resets' the Ansi driver: the colours are set to default values,
all text attributes are switched off and the screen is cleared. It is
the same as doing an SGR 0 followed by ED 2. THIS IS NOT IMPLEMENTED
IN ANSI.SYS!!!
Name : NEL - Next Line
Escape : <ESC> E
This moves the cursor to the first position on the next line,
scrolling the screen up if neccesary. It is effectively the same as
Carriage Return followed by Line Feed, and is NOT IMPLEMENTED IN
ANSI.SYS.
Name : SGR - Set Graphics Rendition
Escape : <ESC> [ <n> ; <n> ; ... ; <n> m
Example : <ESC> [ 1 ; 37 m
Now this is the good stuff... With this escape you can control three
things:
- The text foreground colour,
- The text background colour,
- The text attributes.
There can be any number of parameters, separated by ';' characters.
The effect is cumulative. If no parameters are passed, '0' is
assumed. The following parameters are available:
0 - Reset colours and attributes
1 - Bold (*)
4 - Underlined (*)
5 - Blink (*)
7 - Reverse Video
30 - Foreground Black
31 - Foreground Red
32 - Foreground Green
33 - Foreground Yellow
34 - Foreground Blue
35 - Foreground Magenta
36 - Foreground Cyan
37 - Foreground White
40 to 47 - Background Colours
Attributes marked by (*) are ignored by Quick. When running on a
monochrome monitor the colours are also ignored. On a colour monitor
colour 30 is black (register 0), colour 37 is white (register 3), and
all colours inbetween are alternated Blue (register 1) and Red
(register 2). Of course this depends on your screen settings, but the
above are the QuickBBS defaults. If foreground and background turn
out to be the same, Quick will adjust the background colour.
Some examples...
Bold, White on Blue : <ESC>[0;1;37;44m
Blink, Red on Yellow : <ESC>[0;5;31;43m
Normal, White on Black : <ESC>[m or <ESC>[0m
Bold, Underlined, Green : <ESC>[0;1;4;32m
Note that setting - say - Bold does not effect any of the other
attributes, nor the colours. To make sure you've got the right mode,
you could add a '0' at the beginning, but that depends on how
intelligent your Ansi editor is, which brings us to...
[6] How to create your Ansi screens.
Well, there are basically three options. You can do it all by hand in
a text editor like Tempus, you can buy a PC and use TheDraw or
AnsiPaint, or you can use a little VT-52 to Ansi converter I've
written called... QANSI. The convertor can only handle a screen at a
time, but then most VT-52 editors can only create one screen at a
time. Operation is simple, you just specify input and output files,
and QANSI does the rest.
[7] Box Graphics
The MS-Dos character set has a number of BOX GRAPHICS which are very
nice for making logo screens, boxes around texts and such. Here is a
list of some often-used characters.
« = 174 » = 175 ã = 176 õ = 177 Ø = 178 ø = 179
œ = 180 Œ = 181 À = 182 à = 183 Õ = 184 ¨ = 185
´ = 186 † = 187 ¶ = 188 © = 189 ® = 190 ™ = 191
ij = 192 IJ = 193 א = 194 ב = 195 ג = 196 ד = 197
ה = 198 ו = 199 ז = 200 ח = 201 ט = 202 י = 203
כ = 204 ל = 205 מ = 206 נ = 207 ס = 208 ע = 209
פ = 210 צ = 211 ק = 212 ר = 213 ש = 214 ת = 215
ן = 216 ך = 217 ם = 218 ף = 219
ץ = 220 § = 221 ∧ = 222 ∞ = 223
To print this out on a printer without MS-Dos character set: display
the file in QuickBBS with Ansi Graphics, and just do a screen dump.
Perhaps someone has time to write a proper VT-52 and ANSI editor???