Article ID: 83064 - Last Review: May 12, 2003 - Revision: 2.0 Using ANSI.SYS /X to Remap Extended KeysThis article was previously published under Q83064 SUMMARY
Microsoft MS-DOS version 4.0 introduced a new feature to the ANSI.SYS
console device driver, used by specifying the /X switch. With the /X
switch, ANSI.SYS can distinguish the extended keys (RIGHT ARROW, HOME, and
so on) from the keypad keys (with NUM LOCK off) on some extended keyboards.
This allows you to redefine the keys separately using ANSI escape
sequences. Extended keyboards are also called 101- or 102-key keyboards.
If you have an extended keyboard and want to redefine an extended key (or keypad key) without also redefining the corresponding keypad key (or extended key) to another character, you must load ANSI.SYS with the /X switch. MORE INFORMATION
Non-ASCII keys (function keys, SHIFT keys, extended keys, and, when NUMLOCK
is off, the keypad keys) differ from the ASCII keys in that they send an
identifying code to the input buffer, followed by the key's value. ANSI.SYS
recognizes this and reads the input buffer a second time after receiving
the identifying scan code.
Most keyboards only send the 00H scan code for all non-ASCII keys. Many extended keyboards send a scan code of 0EH (224 decimal) for the extended keys and a 00H for the corresponding keypad keys. ANSI.SYS can only detect the difference between extended and keypad keys with the latter type of keyboard. The following example remaps both HOME keys to issue the DIR command on an extended keyboard. In CONFIG.SYS: device=c:\dos\ansi.sys set prompt= $e[0;71;"dir";13p $p$g device=c:\dos\ansi.sys /x set prompt= $e[0;71;"dir";13p $e[224;71;"CLS";13p $p$g REFERENCES
"Microsoft MS-DOS User's Guide and Reference," version 5.0, page 593
APPLIES TO
| Article Translations
|

Back to the top
