kristofer sweger Home
ANSIPLUS Home


Driver Status and Control

Esc [#;#n  Query ANSIPLUS status

The ANSI.sys Esc [6n cursor position report function is supported by ANSIPLUS. ANSIPLUS also accepts extended options to return other information about its current state. The available ANSIPLUS Esc [#n queries are shown in the following table:

ANSIPLUS Status Query Selectors
Query
Returned Report
129
Current text cursor position: row and column
130
Total text rows and columns (current scrolling region)
131
Character height and width in pixels
132
Screen height in scan lines and width in pixels
133
Current display page and total number of pages
134
Offset and segment address of current video display page
135
Current foreground and background as BIOS color attribute codes
136
Current ANSIPLUS feature settings (first 32 bits)
137
Video mode description and number of screen colors
138
Current foreground and background ANSIPLUS color numbers
139
Default foreground and background ANSIPLUS color numbers
140
Definition for a color: PAL/DAC, red, green and blue
141
Offset and segment of the ANSIPLUS beep tone definition
142
Offset and segment of the reassignment for a key
143
Current and default text treatment options
144
Current ANSIPLUS feature settings (second 32 bits)
145
Keyboard repeat rate in characters per second
146
Total text rows and columns (actual screen)
147
Minimum row and column for current scrolling region
148
Maximum row and column for current scrolling region
149
Offset and segment of ANSIPLUS local clipboard data
150
Current and maximum bytes stored in ANSIPLUS clipboard

Each status report returns two or four integers as part of an escape sequence supplied to DOS keyboard input; the R in the report is followed by a carriage return:

Esc [#;#R Enter or Esc [#;#;#;#R Enter

Option 136 reports the first 32 ANSIPLUS features settings as two 16-bit numbers bit-encoded in the same order as the features listed under " Enable or disable driver features " below. Thus, for example, bright key echo, if enabled, adds one to the first result, and smooth scrolling, if enabled, adds 4096.

Option 137’s video mode description sums two nibbles. The high order nibble value describes the video board: 16=EGA, 32=VGA, 0=other. The low order nibble describes the current operating mode: 0=text mode, 1=CGA/other graphics, 2=VGA/EGA 16 color or monochrome graphics, 3=VGA 256-color graphics.

Options 138 and 139 can be used to save and restore colors. The color codes returned may be passed directly to Esc [m later to set the colors. The foreground is returned with either 128 or 256 added, and the background is returned with either 192 or 512 added.

Option 140 returns the current or default color, VGA/EGA palette or VGA DAC definition of the color selected by a second parameter. See the adjacent table for the color selectors acceptable for the second parameter. Four numbers are reported: the EGA palette or VGA DAC code used to obtain the color definition, and red, green and blue color intensities from 0 to 255.

Option 141 returns a pointer to the current ANSIPLUS beep tone definition. The tone definition consists of a list of 16-bit word pairs containing frequency in Hertz and duration in milliseconds, terminated by two words of zeros. The data at the memory location returned must not be modified.

Color, PAL and DAC Selectors
Selector Meaning
0-15 Current color 0-15
16 Current border color
32-47 Default color 0-15
48 Default border color
128-191 Current VGA/EGA palette register 0-63
192-255 Default VGA/EGA palette register 0-63
256-511 Current VGA DAC register 0-255
512-767 Default VGA DAC register 0-255

Option 142 returns a pointer to the reassignment of a key selected by a second (or for function-type keys, a second and third) parameter. If the key is not currently reassigned, both the offset and segment returned will be zero. The reassignment pointed to consists of a 16-bit word length, followed by a character string of that length. The data at the memory location returned must not be modified.

Option 143 reports text treatment settings as two 16-bit numbers bit-encoded according to the table to the right.

Option 144 reports the second 32 ANSIPLUS features settings bit-encoded like Option 136.

Options 146 to 148 support screen scrolling regions by reporting the actual screen size and the minimum and maximum limits for the current scrolling region.

Text Treatment Bits
Bit Mask Meaning
0 01h Bold
1 02h Italics/slant
2 04h Black shadow
3 08h Underline
4 10h Blink
5 20h Black outline
6 40h Reverse video
7 80h reserved

Esc [!#;... #g  Define Ctrl+G beep tone

The Esc [!g control sequence defines the Ctrl+G beep tone by a series of up to 10 pairs of parameters (the limit is configurable). Each pair consists of a frequency in Hertz, and a duration in milliseconds. A frequency of zero is interpreted as silence. If no parameters are supplied, a default tone of 880 Hz is installed. For example:

Esc [!g Restore the default tone of 880Hz for 385 ms
Esc [!1397,110,1047,165g Install a two-tone beep
Esc [!0,55g Install a silent beep

Esc [#;... #p  Define key reassignment

The Esc [p control sequence is used to define key reassignment. The first parameter defines the key to be reassigned (or the first two for Alt or function keys), and all remaining parameters define the key reassignment character string. If a key parameter is not followed by a reassignment string, then any existing reassignment for that key is deleted. If Esc [p is supplied with no parameters at all, then all key reassignments will be deleted. For example:

Esc [0;17;"Hello World!";13p Make the Alt+W key enter "Hello World!"

The dark gray keys on enhanced keyboards ( PgUp, Home, etc.) may be reassigned independently from the corresponding keys on the numeric keypad. Any key code that starts with 224 before the scan code instead of 0 will reassign the gray key only, and not the key on the numeric keypad. A key code that starts with zero will reassign both keys, unless the gray key has its own independent reassignment. So, for example:

Esc [224;71;"Gray Home"p Reassign Gray Home key only
Esc [0;71;"Home"p Reassign either Home or Gray Home

The gray keys on the numeric keypad may also be reassigned using the following codes:

Esc [224;13;"Gray Enter"p Reassign Gray Enter key
Esc [224;43;"Gray Plus"p Reassign Gray "+" key
Esc [224;45;"Gray Minus"p Reassign Gray "-" key
Esc [224;42;"Gray Times"p Reassign Gray "*" key
Esc [224;47;"Gray Divide"p Reassign Gray "/" key

Esc [!#;... #k  Add keys to keyboard buffer

The Esc [!k control sequence is used to add keys to the keyboard input buffer, simulating keystrokes by the user. Each parameter defines a keystroke. A parameter value of -1 indicates that the next parameter will be a time delay in 55 millisecond timer ticks before returning the next key. For example:

Esc [!"Hello";-1;18;" World!"k Enter "Hello", wait 1 second, then " World!"

Esc [!#w  Wait for specified time delay to elapse>

The Esc [!w control sequence is used to insert a time delay during console output. Its intended use is for displaying ANSI data (eg., ANSI animation) to cause pauses without user intervention or more complicated programming. A single parameter value is accepted: the time delay in 55 millisecond timer ticks before returning. For example:

Esc [!36w Wait 2 seconds before proceeding

The Esc [w wait loop can be aborted at any time by hitting either Esc or Ctrl+Break.

Esc [!#;... #d  Enable or disable driver features

Several ANSIPLUS features may be turned on or off by programs with the Esc [!d ANSIPLUS control sequence, which accepts zero or more control codes from the following. A parameter value of zero resets all ANSIPLUS features to default settings. The same thing occurs if no parameters are supplied.

ANSIPLUS Feature Control Codes
Disable
Code
Enable
Code
Default
Setting
Feature Description
1
2
On
Highlighted (bright) keystroke echo
3
4
On
Input keystroke reassignment
5
6
Off
Treat Ctrl+C keystrokes as Ctrl+Breaks
7
8
Off
Non-destructive input reads last key in buffer
9
10
On
Install ANSIPLUS colors on mode sets
11
12
On
Turn off blinking on color text mode sets
13
14
Off
Show pseudo-cursor in graphics modes
15
16
Off
Emulate VGA monochrome monitor
17
18
Off 
Wait for retrace before setting palette registers
19
20
Off
Trap ANSI control in BIOS Int 10h Write TTY
21
22
On
Use VGA/EGA screen saver
23
24
Off
Use smooth scrolling
25
26
Off
Allow smooth scrolling under Windows
27
28
Off
Speed up smooth scroll when delaying the computer
29 
30
On
Use ANSIPLUS Ctrl+G beep tone generator
31
32
On
Allow ANSIPLUS Ctrl+G beep tone under Windows
33
34
Off
Caps unlock on Shift +alphabetic key
35
36 
Off
Caps relock on Enter after Shift +alphabetic unlock
37
38
On 
Use MS mouse Int 33h polling in screen saver
39
40
On
Use PS/2 Int 74h mouse event interrupt in saver
41
42
On
Allow Scroll Lock to freeze screen
43
44
Off
Require Alt+Scroll-Lock when freezing screen
45
46
On
Enable scroll-back of lines scrolled off top
47
48
Off
Allow video RAM for Windows scroll-back
49
50
Off
Protect 2nd display page from scroll-back storage
51
52
Off
Capture lines scrolled by BIOS call
53
54
Off
Capture erased pages never scrolled up
55
56
Off
Generate pseudo-cursor in 256-color graphics modes
57
58
Off
Use BIOS calls for text mode scrolling
59
60
On
Load colors on DOS 256-color mode sets
61
62
Off
Load colors on Windows 256-color mode sets
63
64
Off
Prevent ANSI key reassignment redefinition
65
66
On
Enable key stacking
67
68
Off
Preserve scroll-back data using XMS/HMA memory
69
70
Off
Prevent palette/DAC color changes by programs
71
72
Off
Read key controller scan codes in screen saver
73
74
Off
Apply key reassignment at BIOS Int 16h level
75
76
On
Use expanded memory for DOS scroll-back
77
78
On
Use expanded memory for Windows scroll-back
79
80
Off
Use alternative method for blanking VGA screen
81
82
Off
Capture lines scrolled from subscreen regions
83
84
Off
Require Scroll Lock for full screen mouse copy/paste
85
86
Off
Allow zero-key to repeat
87
88
Off
Use VESA power management in screen saver
89
90
Off
Allow 32-bit block moves for text scrolling
91
92
Off
Enable sticky shift keys
93
94
Off
Suppress NUL output characters
95 96 Off Lock screen size BIOS variables

© Copyright 2000-2007, Kristofer Sweger. All rights reserved.
Rev. 10/16/07