Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!maverick.ksu.ksu.edu!altair!jxf From: jxf@altair.cis.ksu.edu (Jerry Frain) Newsgroups: comp.sys.mac.programmer Subject: Solution: swapping keys on extended keyboard Message-ID: <1991Jan3.084459.24275@maverick.ksu.ksu.edu> Date: 3 Jan 91 08:44:59 GMT Sender: news@maverick.ksu.ksu.edu (The News Guru) Organization: Kansas State University Lines: 41 A while back I posted a request for help swapping the control key and caps lock key on the Apple extended keyboard. I didn't receive any replies on how to _logically_ swap the keys (I did receive one very helpful reply on how to physically swap the lock-down mechanism), so I thought I'd post the solution in case anyone else is interested. The only references I found were Apple Tech Note #160, and IM-V, pages 190-193. They proved to be quite adequate (once I found them). Basically, there is a KMAP resource in the System file which maps the raw key codes to "virtual" key codes. The fourth byte offset of the KMAP resource ID #2 in the System file begins a 128-byte array of virtual key codes (see tech note #160). The raw key code is used as an index to this array. The eighth line of this resource (from ResEdit) looks like this: 000038 3435 3B37 38B9 3A7B Swap the fourth and sixth bytes so that the line looks like this: 000038 3435 B937 383B 3A7B ^^ ^^ These two bytes are the "virtual key codes" for the control key, and caps lock key, respectively. That's all there is to it. --Jerry -- Jerry Frain -- Systems Programmer Kansas State University Department of Computing & Info Sciences Internet : jxf@cis.ksu.edu Manhattan, Kansas UUCP : ...!rutgers!ksuvax1!jxf