Date: 10 Jul 1985 19:19:24 PDT Subject: Swapping "Esc" and "~" on AT -- SWPKEYAT From: Craig Milo Rogers 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 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] ------------------------------