Dec 112017
Quick Basic routines that emulate the ANSI.SYS driver. | |||
---|---|---|---|
File Name | File Size | Zip Size | Zip Type |
PANSI.BAS | 16781 | 5226 | deflated |
PANSI.BI | 346 | 168 | deflated |
PANSI.DOC | 3834 | 1764 | deflated |
PANSI2.BAS | 522 | 321 | deflated |
PANSI3.BAS | 520 | 372 | deflated |
TPCREAD.ME | 199 | 165 | deflated |
Download File PANSI.ZIP Here
Contents of the PANSI.DOC file
Here it is! The long awaited ANSI emulator for QuickBASIC
4.5! It emulates DOS's "ANSI.SYS" driver. This version is in
pure QB- but once I get it working to everybody's satisfaction
I'll code it in assembly and re-post it. It'll be one hell of an
ANSI emulator...
ANSI.SYS is a device driver that comes with DOS. It replaces
the normal "CON" driver with an extended, more versatile one.
ANSI.SYS recognizes special escape code sequences- a string starting
with a CHR$(27) and a bracket "[". For instance, sending the
following string to ANSI.SYS will enable bold characters to be
printed:
ESC[1m
...and this will turn it off:
ESC[0m
ANSI.SYS can really only recognize a small subset of the ANSI
protocol developed by the American National Standards Institute (hee
hee A.N.S.I.) The escape codes ANSI.SYS "sees" are:
-long name- -short name- -escape sequence-
Cursor Position CUP ESC[y;xH or ESC[y;xf
Cursor Up CUU ESC[#A
Cursor Down CUD ESC[#B
Cursor Forward CUF ESC[#C
Cursor Backward CUB ESC[#D
Device Status Reprt DSR ESC[6n or ESC[n
Cursor Position. Report CPR ESC[y;xR
Restore Cursor Position RCP ESC[u
Save Cursor Position SCP ESC[s
Erase In Line EL ESC[K
Erase In Display ED ESC[2J or ESC[J
Set Graphics Redition SGR ESC[#;#;...#m
The following are supported by ANSI.SYS, but are not supported by
PANSI.BAS:
Set Mode SM ESC[=#h
Reset Mode RM ESC[=#l
Keyboard Reassign IBMKKR ESC["str"p
# is a optional number(if a number is omitted then it is assumed to
be 1). "y;x" are optional X and Y coordinates of the screen.
Again, if none are given, they are assumed to be 1;1. For instance,
the following escape commands have the same effect:
ESC[H moves cursor to upper-left hand corner of screen
ESC[1;1H " "
Also, one operand may be omitted (the X coordinate):
ESC[5H moves cursor to line 5 column 1
ESC[5;1H " "
Notes on the "DSR" sequence...
Did you know that there is a way to detect if a remote terminal has
ANSI or not? If the receiver responds with ESC[y;xR when the
following sequence is sent:
ESC[6n
Then it has ANSI. I have used a couple of BBS's and doors which use
this method of detecting ANSI.
Using PANSI.BAS:
PANSI.BAS is modular, and all functions are in procedures. I
programed it with ease of use in mind. To make PANSI.BAS into a
.QLB file, use:
bc /t pansi.bas
link /q pansi.obj,pansi.qlb,,bqlb45.lib+qb.lib
(assuming bqlb45.lib and qb.lib are in your current directory)
All of the procedures are documented at the start of the program.
If you discover any bugs(I'm still not sure if I handled monochrome
adaptors correctly), then please let me know so I can fix them.
That's one of the reasons why I'm posting it.
Have fun! There are 4 programs:
PANSI.BAS -main program Ultra-cool K_Rad ANSI emulator
PANSI2.BAS -example #1 okay ANSI file printer
PANSI3.BAS -example #2 dorky terminal program
PANSI.BI -include file it's only an include file not much to say
(but as include files go this sucker
ranks with the elite!)
*********
NOTE: You must change the SendStatus procedure in PANSI.BAS to
output the status string to your comm package!!! Don't forget that!
*********
No more "OPEN "CON" FOR OUTPUT AS #1" ! Life's great, isn't it?
Rich Geldreich
4.5! It emulates DOS's "ANSI.SYS" driver. This version is in
pure QB- but once I get it working to everybody's satisfaction
I'll code it in assembly and re-post it. It'll be one hell of an
ANSI emulator...
ANSI.SYS is a device driver that comes with DOS. It replaces
the normal "CON" driver with an extended, more versatile one.
ANSI.SYS recognizes special escape code sequences- a string starting
with a CHR$(27) and a bracket "[". For instance, sending the
following string to ANSI.SYS will enable bold characters to be
printed:
ESC[1m
...and this will turn it off:
ESC[0m
ANSI.SYS can really only recognize a small subset of the ANSI
protocol developed by the American National Standards Institute (hee
hee A.N.S.I.) The escape codes ANSI.SYS "sees" are:
-long name- -short name- -escape sequence-
Cursor Position CUP ESC[y;xH or ESC[y;xf
Cursor Up CUU ESC[#A
Cursor Down CUD ESC[#B
Cursor Forward CUF ESC[#C
Cursor Backward CUB ESC[#D
Device Status Reprt DSR ESC[6n or ESC[n
Cursor Position. Report CPR ESC[y;xR
Restore Cursor Position RCP ESC[u
Save Cursor Position SCP ESC[s
Erase In Line EL ESC[K
Erase In Display ED ESC[2J or ESC[J
Set Graphics Redition SGR ESC[#;#;...#m
The following are supported by ANSI.SYS, but are not supported by
PANSI.BAS:
Set Mode SM ESC[=#h
Reset Mode RM ESC[=#l
Keyboard Reassign IBMKKR ESC["str"p
# is a optional number(if a number is omitted then it is assumed to
be 1). "y;x" are optional X and Y coordinates of the screen.
Again, if none are given, they are assumed to be 1;1. For instance,
the following escape commands have the same effect:
ESC[H moves cursor to upper-left hand corner of screen
ESC[1;1H " "
Also, one operand may be omitted (the X coordinate):
ESC[5H moves cursor to line 5 column 1
ESC[5;1H " "
Notes on the "DSR" sequence...
Did you know that there is a way to detect if a remote terminal has
ANSI or not? If the receiver responds with ESC[y;xR when the
following sequence is sent:
ESC[6n
Then it has ANSI. I have used a couple of BBS's and doors which use
this method of detecting ANSI.
Using PANSI.BAS:
PANSI.BAS is modular, and all functions are in procedures. I
programed it with ease of use in mind. To make PANSI.BAS into a
.QLB file, use:
bc /t pansi.bas
link /q pansi.obj,pansi.qlb,,bqlb45.lib+qb.lib
(assuming bqlb45.lib and qb.lib are in your current directory)
All of the procedures are documented at the start of the program.
If you discover any bugs(I'm still not sure if I handled monochrome
adaptors correctly), then please let me know so I can fix them.
That's one of the reasons why I'm posting it.
Have fun! There are 4 programs:
PANSI.BAS -main program Ultra-cool K_Rad ANSI emulator
PANSI2.BAS -example #1 okay ANSI file printer
PANSI3.BAS -example #2 dorky terminal program
PANSI.BI -include file it's only an include file not much to say
(but as include files go this sucker
ranks with the elite!)
*********
NOTE: You must change the SendStatus procedure in PANSI.BAS to
output the status string to your comm package!!! Don't forget that!
*********
No more "OPEN "CON" FOR OUTPUT AS #1" ! Life's great, isn't it?
Rich Geldreich
December 11, 2017
Add comments