Dec 092017
Ansi driver. Can be loaded before DESQview to supply ansi services to all DV windows via shared program. Supports 4DOS ver 4.0 KSTACK command i.e. does not have to be loaded. ULTRAVISION aware. Can be loaded and
File DGANSI.ZIP from The Programmer’s Corner in
Category Alternate Operating Systems
Ansi driver. Can be loaded before DESQview to supply ansi services to all DV windows via shared program. Supports 4DOS ver 4.0 KSTACK command i.e. does not have to be loaded. ULTRAVISION aware. Can be loaded and
File Name File Size Zip Size Zip Type
DGANSI.COM 7366 5414 deflated
DGANSI.DOC 29688 8804 deflated
DGANSI.SHP 992 734 deflated
DGANSI18.COM 7478 5478 deflated
STEST.EXE 20052 12352 deflated
TPCREAD.ME 199 165 deflated

Download File DGANSI.ZIP Here

Contents of the DGANSI.DOC file

Copyright By:
Don E. Groves, Jr.
2915 West Ox Rd.
Herndon, VA 22071

CIS Number [71310,3702]

I. Background

When I first got DESQview, I noticed that none of my ANSI
drivers would work properly with it, and the supplied DVANSI.COM
required more memory than I was willing to sacrifice.

DgAnsi is the result. It requires less than 3.8 kilobytes
of memory to load, and requires as little as 1 kilobyte in a
DESQview window. DgAnsi is a superset of the IBM PC
implementation of the ANSI X3.64-1979 specification, implementing
several extensions and enhancements to that specification.

DgAnsi can be safely loaded in an Upper Memory Block, will
not double load, and will not load if any other ANSI driver is
loaded. After loading it can be reconfigured, disabled, or
uninstalled. DgAnsi can be invoked with different parameters in
different DESQview windows.

A note of thanks should be given to:

PC Magazine and Michael J. Mefford. Providing and
documenting the source code of ANSI.COM gave me a big
"jump-start" in writing this program.

Borland Turbo Assembler 2.50 and TLink. DgAnsi is written
in TASM ideal mode.

Mike Bessy and Edward Phillips for putting up with some of
my earlier versions. Their willingness to try the next ones was
a great encouragement to keep trying.

DgAnsi.Com, DgAnsi18.Com, DgAnsi.Shp, and DgAnsi.Doc were written
by and are Copyright (c) 1990-91 by Don E. Groves, Jr. All
rights reserved.

II. Files Included In This Distribution Archive

DgAnsi.Com -- the basic DgAnsi program. This version
will run on any computer using PC- or
MS-DOS 3.1 or above.

DgAnsi18.Com -- optimized version of DgAnsi.Com using the
80186 instruction set. This version will
run on any computer equipped with a
V20/V30,, 80286 or higher cpu, and using
PC- or MS-DOS 3.1 or above. DgAnsi18.Com
is slightly smaller and slightly faster
than DgAnsi.Com.

In this document we shall refer only to the
command "DgAnsi;" if you are using the
186-optimized version make the appropriate
substitution. You may prefer to delete
DgAnsi.Com and rename DgAnsi18.Com to

DgAnsi.Shp -- "DESQview-aware" shared program module for
use in DESQview windows. To use DgAnsi.Shp
you must load DgAnsi.Com before DESQview.
This enables DgAnsi.Shp to use the code of
DgAnsi.Com, while maintaining its own data
space in the DESQview window.

DgAnsi.Doc -- This documentation.

III. Running DgAnsi.Com

The syntax for loading or configuring DgAnsi is as follows:

DgAnsi [commands] [/switches]

Entering "DgAnsi" without commands or switches will load
DgAnsi in its default configuration.

The commands are:

? | /? Displays the DgAnsi help screen.

ON By default, DgAnsi is loaded with all functions
enabled. Use this command to reenable DgAnsi
after turning it off.

OFF | OF Temporarily disables DgAnsi functions. DgAnsi OFF
leaves DgAnsi loaded in memory, and it may be
reenabled by issuing DgAnsi ON.

FAST | FAS | FA | F+ Direct screen writing mode. This is
the default.

SLOW | SLO | SL | F- Screen writes via the BIOS. If you
are experiencing display problems, DgAnsi SLOW
should cure them. This mode is noticeably slower
than the default screen writing method.

K+ Enable keyboard reassignments. This is the

K- Disable keyboard reassignments. Disabling
keyboard reassignments disables any key
reassignments previously made.

P+ Enable new key reassignments. This is the

P- Disable new key reassignments. Disabling further
key reassignments retains any key reassignments
previously made, while disabling additional

Q+ Enable Extended Unique Keys on. This is the
default. On enhanced keyboards, using DOS 4.0 or
above, the gray keys generate different scan codes
than their white key equivalents.

Q- Disable Extended Unique Keys on enhanced
keyboards. Disabling unique keys will make the
gray keys on enhanced keyboards behave exactly as
their white key equivalents.

The switches are:

/@filename Issue ANSI commands, at initial load or after,
contained in a file. The entire command sequence
must be entered in the file, including the leading
ESCape [.

The contents of the configuration file are typed
to standard output, and have the same effect as

TYPE filename

Very little checking for a valid filename is done.
If the file is not found, the switch is ignored.

/Bnnnn Buffer size in bytes for key reassignments. The
value for nnnn is from 0 to approximately 61000
bytes; the default is 200 bytes. Specifying /b0
will save 192 bytes in the resident load size.

This switch may be specified only when loading
DgAnsi; once a buffer size has been set it may not
be changed.

Since DgAnsi.Shp establishes it own data area, you
may set different buffer sizes, using DgAnsi.Shp,

in each DESQview window.

The buffer size may also be independently set for
any secondary shell copy of DgAnsi (/w).

/C Clear Reassignment Buffer. This clears all key

/Dm Set display colors from command line. The color
specification is a standard ANSI sequence (see
below). For example,

dgansi /d0;1;33;40m

will load or reconfigure DgAnsi to display bright
yellow on black. This overcomes the
limitation of not allowing the entry of the Escape
character from this command line. If you are
using 4DOS, this is equivalent to entering

echo e[0;1;33;40m

from the command line.

/T Tests whether DgAnsi is installed. In addition to
displaying this information on the screen, DgAnsi
returns the following errorlevels:

0 DgAnsi is loaded; will not install.
1 DgAnsi is not loaded; safe to install.
255 DgAnsi is not loaded in the current
DESQview window but is loaded prior to

/U Uninstall DgAnsi. If DgAnsi is not the last
loaded memory-resident program ("TSR") it cannot
be uninstalled; instead, it will be turned off but
will remain in memory.

/W Create a secondary resident copy. This switch is
positional and should be specified before any of
the above options. Its purpose is to allow the
creation of a "shell copy" in any environment.
This can be useful if you wish to create a
specially defined set of ANSI sequences for a
limited purpose, and then return easily and
quickly to the original configuration.

Creating a secondary copy of DgAnsi turns the
parent copy off. Uninstalling the shell copy does
not automatically turn the parent copy back on; it
must be specifically reenabled by DgAnsi ON.

Note: DgAnsi directly supplies the KSTACK.COM functions for
the KEYSTACK command in 4DOS version 4.0. It is therefore not
nessecary (and will waste memory) to load both KSTACK.COM and DGANSI.COM.

IV. DgAnsi.Shp

DgAnsi.Shp is a "Shared Program" for DESQview. It can be
used in place of loading DgAnsi.Com a second time in a DESQview

There are three advantages to using DgAnsi.Shp with
DESQview. First, it loads faster. Second, DgAnsi and a program
can be started together directly from DESQview, instead of via a
batch file which first loads DgAnsi and then loads the
application. This avoids the overhead of loading another
instance of the command processor and occupies less memory.

Third, DgAnsi.Shp works by utilizing the code of DgAnsi.Com,
while maintaining its own data space in the DESQview window.
This means that each DESQview window can set DgAnsi's buffer size
independently of the DgAnsi.Com's initial buffer size, or of the
buffer size in any other DESQview window.

DgAnsi.Com must be loaded before starting DESQview if you
plan to use DgAnsi.Shp. If DgAnsi has not been installed,
DESQview will refuse to open any window in which DgAnsi.Shp is
specified and an error message will advise you that DgAnsi.Com
must be loaded.

Valid commands and switches for DgAnsi.Shp are the same as
for DgAnsi.Com.

Upon shelling out of the program or upon reaching the DOS
prompt in the DESQview window, DgAnsi.Com can be used to change
the default settings in the same manner as outside DESQview.

To specify DgAnsi.Shp in a DESQview window, open the "Change
a Program" window. In the "Advanced Options" screen (F1 from the
opening "Change a Program" screen), specify at least 2 kilobyte
in the "System Memory" field.

Use the tab key to advance to the "Shared Program" section
of the screen. In the "Pathname" field, specify the full name of
DgAnsi.Shp, including the path. Commands and switches may be
entered in the "Data" field.

Two kilobyte of system memory is adequate for the DgAnsi.Com
default configuration. If you install DgAnsi with a larger
keyboard reassignment buffer, you may need to specify more system
memory. Excessively large "System Memory" values will produce
unpredictable results.

V. Compatibility

DgAnsi has been tested on a wide variety of computers, under
many configurations. It should be compatible with any IBM
compatible running DOS 3.1 or above.

DgAnsi hooks Interrupts 16h, 21h, 29h, and 2Fh. You may
experience conflicts if other TSRs loaded on your computer hook
any of these interrupts.

In particular, many keyboard enhancers also hook Int 16h.
In most cases this and other conflicts can be resolved simply by
assuring that DgAnsi is loaded after the conflicting program.

4DOS, the replacement command processor, includes a KEYSTACK
command for feeding keystrokes to other applications. Its use
requires that KSTACK.COM, a TSR which is part of the 4DOS
distribution package, be loaded in order to enable the KEYSTACK
command. KSTACK.COM also hooks Interrupt 16h.

DgAnsi.Com has been extensively tested with 4DOS Version
4.0, and we have found no incompatibilities. Some systems
require that DgAnsi.Com be loaded after KSTACK.COM in order for
the key redefinitions to work properly.

VI. DgAnsi Command Sequences

DgAnsi includes a number of command sequences which are
neither part of the ANSI X3.64-1979 specification nor of the IBM
ANSI implementation. In the command listing which follows the
ANSI X3.64-1979 mnemonic, if it exists, is provided in
parentheses (e.g., CUP).

Cursor Functions

Esc[l;cH Cursor Position (CUP)
Esc[l;cV Horizontal and Vertical Position (HVP)
HVP and CUP move the cursor to the position
specified. The first parameter (l) specifies the line
number; the second (c) specifies the column number.
When no parameters are specified the cursor moves to
the home position (the upper left-hand corner of the

Esc[nA Cursor Up (CUU)
This sequence moves the cursor up without changing
columns. The value of n sets the number of lines
moved. When no parameter is specified the cursor
moves up one line. It the cursor is already on the
top line, the CUU sequence is ignored.

Esc[nB Cursor Down (CUD)
This sequence moves the cursor down without changing
columns. The value of n sets the number of lines
moved. When no parameter is specified the cursor
moves down one line. It the cursor is already on the
bottom line, the CUD sequence is ignored.

Esc[nC Cursor Forward (CUF)
This sequence moves the cursor forward without
changing lines. The value of n sets the number of
columns moved. When no parameter is specified the
cursor moves forward one column. It the cursor is
already on the far right column, the CUF sequence is

Esc[nD Cursor Backward (CUB)
This sequence moves the cursor backward without
changing lines. The value of n sets the number of
columns moved. When no parameter is specified the
cursor moves backward one column. It the cursor is
already on the far left column, the CUB sequence is

Esc[6n Device Status Report (DSR)
The console driver outputs a Cursor Position Report
sequence when it receives a DSR sequence.
ANSI X3.64-1979 defines this sequence as containing
any decimal number in the range 0 to 9, or a
semi-colon (ASCII code 48 to 57, or 59 decimal); most
versions of DOS specify the integer 6. Using DgAnsi,
any number in the range 1 to 254 will return a Cursor
Position Report.

Esc[255n Device Status Report (maximum)
Parameter 255 in a DSR sequence reports the maximum
screen size, in line and columns, of the current
screen mode. The output is in the same format as the
Cursor Position Report, except that maximum values
instead of current values are reported.

Esc[s Save Cursor Position (SCP)
The console driver saves the current cursor position.
This position can be restored by the Restore Cursor
Position sequence.

Esc[u Restore Cursor Position (RCP)
This sequence restores the cursor position to the
value it had when the console driver received the
Save Cursor Position sequence. If no SCP sequence
was received, RCP is ignored.

Esc[l;cR Cursor Position Report (CPR)
The console driver outputs a CPR sequence when it
receives a Device Status Report sequence.

Erase Functions

Esc[2J Erase Display (ED)
This sequence erases the entire screen and returns
the cursor to the home position.

Esc[K Erase Line (EL)
This sequence erases everything from the current
cursor position to the end of the line, including the
current cursor position.

Esc[0J Erase Display from Cursor Forward
This sequence erases everything from the current
cursor position to the bottom of screen, including
the current cursor position. The cursor position is
not updated.

Esc[1J Erase Display from Cursor Backward
This sequence erases everything from the current
cursor position to the top of screen, including the
current cursor position. The cursor position is not

Esc[] Erase next Carriage Return and Line Feed
This sequence erases the next carriage return / line
feed pair without repositioning the cursor. This
makes it possible to issue an ECHO without generating
a carriage return / line feed.

Modes of Operation

Esc[sm Set Graphics Rendition (SGR)
This sequence invokes graphic rendition specified by
the parameters in the following list. These
functions are cumulative and remain in effect until
the next SGR sequence; multiple parameters are
delimited by semi-colons.

Graphics Functions

0 All attributes off (normal, white on black)
1 Bold on (high intensity)
4 Underscore On (monochrome displays only)
5 Blink on
7 Reverse Video on
8 Concealed on (invisible)
30 Black foreground
31 Red foreground
32 Green foreground
33 Yellow foreground
34 Blue foreground
35 Magenta foreground
36 Cyan foreground
37 White foreground
40 Black background
41 Red background
42 Green background
43 Yellow background
44 Blue background
45 Magenta background
46 Cyan background
47 White background

Esc[sh Select Mode (SM)
This sequence selects the screen width or type

Graphics Modes

0 40 x 25 monochrome text
1 40 x 25 color text
2 80 x 25 monochrome text
3 80 x 25 color text
4 320 x 200 graphics 4-color
5 320 x 200 graphics 2-color
6 640 x 200 graphics 2-color
7 wrap at end of line (word wrap)

The following parameters were added to the IBM subset
with DOS 4.0. DgAnsi supports them with earlier
versions of DOS, but they are hardware dependent:

13 320 x 200 graphics 16-color
14 640 x 200 graphics 16-color
15 640 x 350 graphics 2-color
16 640 x 350 graphics 16-color
17 640 x 480 graphics 2-color
18 640 x 480 graphics 16-color
19 320 x 200 graphics 256-color

All numbers except 7 are passed to the BIOS, Int 10h.
Depending on your hardware and other software,
specifying higher numbers may produce interesting
results. For this reason, DgAnsi makes no attempt to
trap invalid numbers; if your hardware does not trap
unsupported Int 10h functions, proceed at your own

Esc[sl Reset Mode (RM)
This sequence resets the screen width or type
specified; the parameters are the same as for SM.
Setting mode 7 with an "h" command (SM) tells DgAnsi
to wrap text to the next line when it passes the end
of a line; setting mode 7 with an "l" (RM) command
tells ANSI not to wrap text; the line is truncated.
For all other modes the SM and RM commands are

IBM PC Keyboard Reassignment

Keyboard reassignment uses an undefined ANSI X3.64-1979 code
sequence to define a character or set of characters sent by the
console whenever a given key is pressed on an IBM PC compatible.
The sequence is:

or Esc["string";"string"p
or Esc[#;"string"p
or Esc["string";#p

The first # is the ASCII character code for the key to be
reassigned. It is followed by a single key code or string of
codes that are to replace it. If the first parameter is 0 or
224, then the first and second parameters make up an extended
ASCII code and the third parameter becomes the reassignment

Enclosing a string in single or double quotes permits the
entry of standard keys. For example:


assigns the key Alt-D (0;32) to the string "dir" followed by a
carriage return (13).

For a complete listing of ASCII key codes, see the Appendix.

To control keyboard reassignments using DgAnsi sequences:

Esc[=1P Turn Keyboard Reassignments On
Any digit other than 1 will turn keyboard
reassignments off.

Esc[?1P Enable Keyboard Reassignments
Any digit other than 1 will disable keyboard

Esc[=1q Enable Extended Keyboard support
Any digit other than 1 will disable extended
keyboard support.

VII. License and Disclaimer
Copyright By:
Don E. Groves, Jr.
2915 West Ox Rd.
Herndon, VA 22071

CIS Number [71310,3702]

DgAnsi and all files contained in this distribution archive
are copyright 1990-1992 by Don E. Groves, Jr. Support is
available from the author via CompuServe Information Service

If you find DgAnsi useful, your gift of $15, or any amount,
would be greatly appreciated.

You may distribute copies of DgAnsi to friends, computer
clubs or users' groups, and to computer bulletin boards, so long
as (1) no fee is charged (other than a nominal media fee), and
(2) all files are included without modification. You may not
sell or charge any fee for providing DgAnsi other than a nominal
media fee not exceeding $5.00, or $10.00 if other programs are
supplied on the same distribution diskette.

The author has taken extensive precautions to use standard,
documented programming calls and DOS functions, and to test the
software with a wide variety of hardware and software
combinations. If you discover any bugs in the program, please
notify the author via CompuServe Mail.

If you feel that bugs in the program have caused you any
damages, I'll sympathize with you and attempt to correct any
programming errors. It won't do you any good to sue me, though,
because I'm just a struggling computer programmer and consultant
who doesn't have enough money to make it worth your time and
legal costs.

The lawyers tell me I'm supposed to say it this way:




Appendix - ASCII Key Codes

Standard Keys (All keyboards). Codes included in parentheses
require DOS 4.0 or above.

Key Code Shift Ctrl Alt

A 97 65 1 0;30
B 98 66 2 0;48
C 99 67 3 0;46
D 100 68 4 0;32
E 101 69 5 0;18
F 102 70 6 0;33
G 103 71 7 0;34
H 104 72 8 0;35
I 105 73 9 0;23
J 106 74 10 0;36
K 107 75 11 0;37
L 108 76 12 0;38
M 109 77 13 0;50
N 110 78 14 0;49
O 111 79 15 0;24
P 112 80 16 0;25
Q 113 81 17 0;16
R 114 82 18 0;19
S 115 83 19 0;31
T 116 84 20 0;20
U 117 85 21 0;22
V 118 86 22 0;47
W 119 87 23 0;17
X 120 88 24 0;45
Y 121 89 25 0;21
Z 122 90 26 0;44
1 49 33 -- 0;120
2 50 64 0 0;121
3 51 35 -- 0;122
4 52 36 -- 0;123
5 53 37 -- 0;124
6 54 94 30 0;125
7 55 38 -- 0;126
8 56 42 -- 0;127
9 57 40 -- 0;128
0 48 41 -- 0;129
- 45 95 -- 0;130
= 61 43 31 0;131
[ 91 123 27 0;26
] 93 125 29 0;27
\ 92 124 28 0;43
: 59 58 -- 0;39
' 39 34 -- 0;40
, 44 60 -- 0;51
. 46 62 -- 0;52
/ 47 63 -- 0;53
` 96 126 -- (0;41)

Enter (keypad) 13 -- 10 (0;166)
/ (keypad) 47 47 (0;142) (0;74)
* (keypad) 42 (0;144) (0;78) --
- (keypad) 45 45 (0;149) (0;164)
+ (keypad) 43 43 (0;150) (0;55)
5 (keypad) (0;76) 53 (0;143) --

F1 0;59 0;84 0;94 0;104
F2 0;60 0;85 0;95 0;105
F3 0;61 0;86 0;96 0;106
F4 0;62 0;87 0;97 0;107
F5 0;63 0;88 0;98 0;108
F6 0;64 0;89 0;99 0;109
F7 0;65 0;90 0;100 0;110
F8 0;66 0;91 0;101 0;111
F9 0;67 0;92 0;102 0;112
F10 0;68 0;93 0;103 0;113
F11 0;133 0;135 0;137 0;139
F12 0;134 0;136 0;138 0;140

Home 0;71 55 0;119 --
Up 0;72 56 (0;141) --
PgUp 0;73 57 0;132 --
Left 0;75 52 0;115 --
Right 0;77 54 0;116 --
End 0;79 49 0;117 --
Down 0;80 50 (0;145) --
PgDn 0;81 51 0;118 --
Ins 0;82 48 (0;146) --
Del 0;83 46 (0;147) --

Extended Keys (Enhanced keyboards only).

Home (gray key) (224;71) (224;71) (224;119) (224;151)
Up (gray key) (224;72) (224;72) (224;141) (224;152)
PgUp (gray key) (224;73) (224;73) (224;132) (224;153)
Left (gray key) (224;75) (224;75) (224;115) (224;155)
Right (gray key) (224;77) (224;77) (224;116) (224;157)
End (gray key) (224;79) (224;79) (224;117) (224;159)
Down (gray key) (224;80) (224;80) (224;145) (224;154)
PgDn (gray key) (224;81) (224;81) (224;118) (224;161)
Ins (gray key) (224;82) (224;82) (224;146) (224;162)
Del (gray key) (224;83) (224;83) (224;147) (224;163)
PrScr (gray key) -- -- 0;114 --
Pause (gray key) -- -- 0;0 --
Bksp (gray key) 8 8 127 (0)
Enter (gray key) 13 -- 10 --
Tab (gray key) 9 0;15 (0;148) (0;165)
Null (gray key) 0;3 -- -- --

 December 9, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>