What follows is the header for the following POSTIT!'ed file. LANSI
adds fast and complete ANSI emulation to any program. (I use it with
the TERMINAL.BAS that comes with the PB 3.2 distribution disk.) I had
to POSTIT a .ZIP because the LANSI source code includes command codes
below ASCII 32, and these choke mailers. Also, I set my tabstop to 4,
so if it comes out looking funny, just set yours to 4.
It's very simple to use. Just call LansiSystemInit, and then, as each
byte comes through the com port, send it on to LANSI like this:
LansiByteInterpret ASC(TheByte$)
The rest is fully automatic. LANSI is highly configurable, has "ANSI"
music (foreground or background), allows for keyboard redefinition in
the [nnn;"xxx"p and [nnn;xxxxp syntaxes, and even has a user
configurable beep frequency. (Or if you prefer, the speaker can be
toggled off.) LANSI can even be set to treat "ANSI" music codes the way
a TRUE ANSI interpreter would.... print trash on the screen.
I leave it up to you to see what you can do with LANSI 3.0, now that
I've ported it over to PowerBASIC 3.x code....
$IF 0
LANSI.BAS The FSA ANSI-Driver LANSI.BAS
Laleh's ANSI
Version 3.0
LANSI.BAS is now PowerBASIC Compatible!
Written by Jamshid Khoshrangi (aka "Quinn Tyler Jackson")
Copyright (C)1993,95 by AhuraMazda(tm) Software. ALL RIGHTS RESERVED.
USAGE RIGHTS:
Although Jamshid Khoshrangi reserves all rights to LANSI.BAS, he grants
others the right to use it in whole or in part as long as any product
that uses it explicitly includes in its documentation or opening screen
(this left to the discretion of the individual programmer) the notice:
"ANSI emulation provided by Laleh's ANSI (C)1993,95 by AMS."
DEDICATION:
This driver is dedicated to my wife Laleh, who has tolerated my sitting
at a yucky computer terminal for thousands of hours with little or no
direct return to her.
UPDATE NOTES: (10 SEP 95)
I have upgraded LANSI to version 3.0 from version 2.0, and it is
now compatible 100% with PowerBASIC 3.x. The upgrade consisted
mainly of changing a few dozen CONST x statements to %x, and the
like, as well as using INCR x and DECR x instead of x = x + 1
and x = x - 1. During the upgrade, I discovered a few insidious
glitches in some routines, which I have fixed....
TECHNICAL NOTES: (31 OCT 93)
LANSI.BAS was written as an exercise in my investigation into the
the complexities of Finite State Automata (FSA's). ANSI graphics
are particularly suitable to an FSA model, since they rely on a finite
set of commands and use a type of Reverse Polish Notation (RPN).
Reverse Polish Notation lends itself amazingly well to efficient
implementations of Finite State systems.
This driver includes non-ANSI "ANSI" music support, but this support
can be turned off by setting the global variable GV.Music is set to
%FALSE (0). With this variable set to %FALSE, LANSI treats music strings
in exactly the same manner a typical ANSI.SYS driver would: it prints
them to the screen. This option has been added for ANSI purists. I have
yet to call a BBS with such music anyway, but hey, why not have it all?
Note that the music supported here can be full background. A 6.5 minute
song can be downloaded as a series of music sequences in about 5 seconds
and then played over then next 6.5 minutes in the background on a typical
2400 baud modem using the system I have implemented here. This system
buffers up to 200 "lines" of music sequences. Many terminals don't allow
full background music, since they are not written in BASIC and therefore
have to emulate the PLAY metalanguage. BASIC has direct access to
"MB", so this is no problem if double-buffering is used.
Also, LANSI.BAS supports a subset of the ANSI keyboard redefinition
capabilities, unlike many other ANSI emulators that totally ignore
this part of the ANSI standard. Support for keyboard redefinition can
be toggled on and off as well. The only two formats allowed are:
ESC[{old_ascii_val};"some string"p
ESC[{old_ascii_val};{new_ascii_val}p
Since keyboard redefinition is limited to the emulator, there is
absolutely no chance of so-called ANSI bombs slipping past LANSI and
into the DOS prompt.
This code is, for the most part, raw and undocumented. I've done the
hard coding; it's up to you to figure out what I've done. My belief
is simple in this regard: if I cannot decipher the code without
detailed English comments and remarks, then I probably should NOT
be changing the code!
If you can understand the raw code, then you might want to go and
tweak it. I've found that I do best to leave code I don't "quite"
understand well-enough-alone. Be warned that FSA systems are quick,
but prone to nastiness when incorrectly tweaked. That's the nature
of the finite state paradigm.
Also, you will notice the term "VisiPlex" from time to time. Just
ignore it. This will follow much later, and is included in
LANSI.BAS just for future compatibility.
I sincerely hope you find LANSI.BAS useful!
Jamshid Khoshrangi (aka "Quinn Tyler Jackson")
$ENDIF
--- Maximus/2 2.01wb
---------------
* Origin: Sound Stage BBS - Live Via Satellite - (604)944-6476 (1:153/7070)
|