home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MS DOS Archives 1
/
MS-DOS_Archives_Volume_One_Walnut_Creek.iso
/
msdos
/
at
/
swpkeyat.arc
/
SWPKEYAT.DOC
< prev
Wrap
Text File
|
1989-02-26
|
6KB
|
140 lines
Date: 10 Jul 1985 19:19:24 PDT
Subject: Swapping "Esc" and "~" on AT -- SWPKEYAT
From: Craig Milo Rogers <ROGERS@USC-ISIB.ARPA>
I've recently gotten an IBM-PC/AT. Boy, am I burned by the
ill-positioned "Esc" key. So, I decided to "fix" things.
I started by prying up the key tops of the "Esc" and "~" (tilde)
keys, and swapping them. Of course, that didn't really fix anything,
but it did show me what my goal looked like.
Next, I decided to write a low-level BIOS extension which intercepts
and swaps key codes to implement the key cap swap I described above. The
result was SWPKEYAT.ASM, which has been submitted to the INFO-IBMPC library.
SWPKEYAT swaps by intercepting the keyboard hardware interrupt, since
I thought that would fool as much software as possible. The program is
rather ugly, though: after swapping key scan codes it jumps into the
AT's ROM BIOS keyboard hardware interrupt routine.
So far, so good. DOS is perfectly happy, and so are any programs
which do DOS or BIOS keyboard I/O. In particular, both VDTE and KERMIT
run OK.
But, what about programs that do their own sub-BIOS keyboard
scan conversions? Luckily for me, I don't run many programs like that.
However, I absolutely had to fix my copy of Lugaru Epsilon. So, I used
DEBUG to disassemble and trace Epsilon until I found the (single) location
where it was reading the keyboard port.
It takes several instructions to swap the keyboard scan codes.
I couldn't find an easy way to insert the entire sequence into Epsilon.
So, I added an additional interrupt handler to SWPKEYAT. The new interrupt
does an IN AL,60 (reading the keyboard port) and swaps the appropriate
pair of scan codes. I selected INT 3FH from the end of the "Reserved for
DOS" range for this function.
The appropriate location to patch in Epsilon 2.02 is offset
BDBE. I copied EPSILON.EXE to EPSILON.XXX and ran DEBUG on EPSILON.XXX.
The .EXE-file offset became C4BE. I patched that location, wrote the
file back out, and renamed the result to XXX.EXE. Once I had confirmed
that my patched version worked, I renamed XXX.EXE to EPSILON.EXE.
So much for this hack. If you use SWPKEYAT and run into a program
which doesn't see the swap (CodeSmith ((tm) Visual Age) may be a candidate),
I'll be interested in hearing about the problem (but probably won't fix it).
Craig Milo Rogers
------------------------------
Date: 11 Jul 85 15:26:00 EDT
From: TD9H@CMU-CC-TE.ARPA <TD9H@CMU-CC-TE>
To: rogers%usc-isib@USC-MAILNET
cc: brackenridge%usc-isib@USC-MAILNET
Subject: Epsilon Patch for SWPKEYAT
Epsilon 3.0 allows you to remap keys at the level of the keyboard
interrupt (far below the command/key binding level). It sounds like
your patch will do till then.
Todd Doucet
Lugaru Software Ltd.
[Todd informs me version 3.0 of Epsilon will be released "real soon now". -wab]
------------------------------
To: kpetersen@wsmr-simtel20.army.mil
From: jrv@mitre-bedford.arpa
Subject: SWPKEYAT
-------
Keith:
I am submitting SWPKEYAT.ARC, which includes updated versions of two
files listed in "nodescr.idx":
"PD1:","<MSDOS.KEYBOARD>","SWPKEYAT.ASM",1,7140,7,850710,""
"PD1:","<MSDOS.KEYBOARD>","SWPKEYAT.DOC",1,2966,7,850715,""
SWPKEYAT swaps the escape and tilde (~) keys on the AT keyboard. The
version in the library conflicts with QuickBasic. Therein lies a tale...
In SWPKEYAT, Craig Milo Rogers at USC/ISI implemented a new interrupt
which acts like an IN from the keyboard data port with the appropriate
scan codes swapped. The new interrupt is for use in patching programs
like EPSILON that have their own keyboard interrupt handlers. For
this, he picked interrupt 3FH, and states:
"INT 3FH is the last 'Reserved for DOS' interrupt. DOS 3.10
doesn't use it, but that's no guarantee about future availability."
From the phrase 'Reserved for DOS' I assumed that I needed to worry
about compatibility only when upgrading to a new version of DOS.
However, I eventually discovered conflicts with QuickBasic and QuickC.
It turns out that they use interrupts 3DH, 3EH, and 3FH. Apparently
the warning should have been 'reserved for Microsoft'!
I rewrote SWPKEYAT to implement 3CH. I also rewrote it so that
SWPKEYAT itself never invokes that interrupt. Now it would fail only
if:
1) some program changes 3CH,
2) that program doesn't restore 3CH
3) you run some third program which was patched to invoke 3CH.
SWPKEYAT runs on early ATs (BIOS ROM date 01/04/84), and finishes scan
processing by jumping into the ROM at a magic address. This is clearly
not portable to other ROM BIOSs. It was also the only reasonable way
to accomplish the function.
Newer ATs implements a "keyboard intercept" feature (function 4FH of
INT 15H) which make scan code swapping much cleaner. To switch the
escape and tilde keys on such a machine, see the program SWAPKEY in the
same ARC file.
Here's the ARC file contents:
Filename Length Date
-------- ------ ----
SWAPKEY.ASM 2269 01-18-89 swap escape and tilde on new ATs
SWAPKEY.COM 70 01-13-89 with keyboard intercept feature
SWPKEYAT.ASM 7783 01-18-89 swap escape and tilde
SWPKEYAT.COM 131 07-07-88 on old ATs (BIOS
SWPKEYAT.DOC 2894 02-26-89 dated 1/4/84)
---- ------
0005 13147
I suggest the following entry for SIMIBM.IDX:
"PD1:","<MSDOS.KEYBOARD>","SWPKEYAT.ARC",1,,,,"swap ESC and tilde on AT kbd"
- Jim Van Zandt