dillon@cory.Berkeley.EDU (02/11/88)
[This is Bryce Nesbitt, posting via remote-control] ---------------------------------------------------------------------------- Technical Note #9 A sample keymap SUMMARY $ 9/0 A sample keymap $ release $ 01-Feb-88 Bryce Nesbitt / TVD $ devs:keymaps, setmap, keymap $ See Also: AmigaMail July/August 1987, AmigaLine #8 This note gives a sample keymap. It can be customized to map the keyboard in any manner desired. ---------------------------------------------------------------------------- * * Sample keymap. Can assemble to be identical to "usa1", or to do some * other neat tricks like turn the numeric pad into a hex keypad. * For the DVORAK layout, you will need to look at the "usa2" map (not * provided). * * This file was generated from a binary image that is Copyright (C)1987 * Commodore-Amiga, Inc. It is distributed as an example with the * expressed written permission of Commodore-Amiga, Inc. * * The A500/A2000 can have the numeric keypad changed into a hex * keypad. The layout is: * * A B C D * 7 8 9 E * 4 5 6 F * 1 2 3 | * 0 . | * * The ESCAPE key and the ~` key may be reversed. * The RETURN key may be set to repeat (the ENTER key still will not). * * This file also can fix two glitches in the keymap as supplied by CBM: * * The A500/A2000 numeric pad ()/*+ keys will repeat. * The keymap no longer crashes if an attempt to execute it is made. * * This keymap supports the 5 extra keys found on the Amiga 500 and 2000 * and will work on A1000s as well. As of V1.2, Kickstart had not been * updated to know about the keys directly, or to return the "NUMERICPAD" * quailifer when they are pressed. * * Commodore-Amiga made what might be refered to as a "tactical error" with * keymaps... it is slightly easier to just use the raw keys rather than * converting them. This is *not* an excuse for not converting, however. * * File format hacked out by Bryce Nesbitt, bryce@hoser.berkeley.EDU * ucbvax!hoser!bryce (or replace "hoser" with "cogsci") BIX: mleeds * (temporarily) * * Cheers! ; ;This flag is valid with any others. ; HEXPAD EQU 1 ;Turn the numeric keypad into a hex keypad? ; ;You must set one and only one of these flags! ; OLDMAP EQU 0 ;assemble the same as usa1 keymap? FIXUP EQU 0 ;Should I fix the glitches in the CBM keymap? RETURNREP EQU 1 ;Do the above and have return repeat? SWAPESC EQU 0 ;Do the above and swap the ESC and ~` keys? * * Keymaps are loaded with the LoadSeg() function. This provides * all of the automatic relocation features. The file starts off with * a KeyMapNode structure. Since the first long of this (LN_SUCC) will * be dynamically set after the map is loaded, we can safely insert a bit of * code to drop harmlessly back to DOS in case someone tries to execute the * keymap (the unmodified keymap would crash). * ; ; STRUCTURE KeyMapNode,0 ; STRUCT kn_Node,LN_SIZE ; includes name of keymap ; STRUCT kn_KeyMap,km_SIZEOF ; I suspect) ; LABEL kn_SIZEOF ; ; STRUCTURE KeyMap,0 ; APTR km_LoKeyMapTypes ; APTR km_LoKeyMap ; APTR km_LoCapsable ; APTR km_LoRepeatable ; APTR km_HiKeyMapTypes ; APTR km_HiKeyMap ; APTR km_HiCapsable ; APTR km_HiRepeatable ; LABEL km_SIZEOF ; CODE IFNE OLDMAP DC.L $00000000 ;Crash the system. ENDC IFEQ OLDMAP MOVEQ.L #-1,D0 ;Say "I'm not a program" RTS ;return to DOS with that revelation. ENDC DC.L $00000000 DC.W $0000 DC.L KeyMapName DC.L LoKeyMapTypes DC.L LoKeyMap DC.L LoCapsable DC.L LoRepeatable DC.L HiKeyMapTypes DC.L HiKeyMap DC.L HiCapsable DC.L HiRepeatable ; ;These tables are bitmaps (bits are in the same order as everything else) ; ;LoCapsable: DC.B $00,$00,$FF,$03,$FF,$01,$FE,$00 ;HiCapsable: DC.B $00,$00,$00,$00,$00,$00,$00 ;LoRepeatable: DC.B $FF,$BF,$FF,$EF,$FF,$EF,$FF,$F7 ;HiRepeatable: DC.B $47,$F4,$FF,$03,$00,$00,$00 LoCapsable: DC.B $00,$00,$FF,$03,$FF,$01,$FE,$00 HiCapsable: DC.B $00,$00,$00,$00,$00,$00,$00 IFEQ SWAPESC LoRepeatable: DC.B $FF,$BF,$FF,$EF,$FF,$EF,$FF,$F7 ENDC IFNE SWAPESC LoRepeatable: DC.B $FE,$BF,$FF,$EF,$FF,$EF,$FF,$F7 ENDC IFNE OLDMAP HiRepeatable: DC.B $47,$F4,$FF,$03,$00,$00,$00 ENDC IFNE FIXUP HiRepeatable: DC.B $47,$F4,$FF,$7F,$00,$00,$00 ENDC IFNE RETURNREP HiRepeatable: DC.B $57,$F4,$FF,$7F,$00,$00,$00 ENDC IFNE SWAPESC HiRepeatable: DC.B $77,$F4,$FF,$7F,$00,$00,$00 ENDC ; ; What follows is the types table. This determmines how the actual ; keymap table data will be interpreted. ; ; KC_NOQUAL EQU $00 ; KCF_SHIFT EQU $01 ; KCF_ALT EQU $02 ; KCF_CONTROL EQU $04 ; KC_VANILLA EQU $07 ; note that SHIFT+ALT+CTRL is VANILLA ; KCF_DOWNUP EQU $08 ; ???Don't know... gives "qQ" if applied to q. ; KCF_DEAD EQU $20 ; Indicates dead information is available ; KCF_STRING EQU $40 ; Key may actually print out a string ; KCF_NOP EQU $80 ; Don't map this key ; LoKeyMapTypes: IFNE SWAPESC DC.B $02,$03,$07,$03,$03,$03,$07,$03 ; ` 1 2 3 4 5 6 7 ENDC IFEQ SWAPESC DC.B $07,$03,$07,$03,$03,$03,$07,$03 ; ` 1 2 3 4 5 6 7 ENDC DC.B $03,$03,$03,$07,$01,$07,$80,$00 ; 8 9 0 - = \ (0) DC.B $07,$07,$27,$07,$07,$27,$27,$27 ; q w e r t y u i DC.B $27,$07,$07,$07,$80,$00,$00,$00 ; o p [ ] (1)(2)(3) DC.B $27,$07,$07,$27,$27,$27,$27,$27 ; a s d f g h j k DC.B $07,$01,$01,$80,$80,$00,$00,$00 ; l ; ' (4)(5)(6) DC.B $03,$07,$07,$07,$07,$07,$27,$07 ; z x c v b n m DC.B $01,$01,$01,$80,$00,$00,$00,$00 ; , . / . (7)(8)(9) HiKeyMapTypes: IFNE SWAPESC DC.B $22,$00,$41,$00,$04,$07,$00,$80 ;SPC BS TAB ENTR RETN ESC DEL NONE ENDC IFEQ SWAPESC DC.B $22,$00,$41,$00,$04,$02,$00,$80 ;SPC BS TAB ENTR RETN ESC DEL NONE ENDC DC.B $80,$80,$00,$80,$41,$41,$41,$41 ; - UP DOWN RGHT LEFT DC.B $41,$41,$41,$41,$41,$41,$41,$41 ;F1 F2 F3 F4 F5 F6 F7 F8 DC.B $41,$41,$03,$03,$03,$03,$03,$40 ;F9 F10 HELP DC.B $80,$80,$80,$80,$80,$80,$80,$80 ;LSFT RSFT CAPS CTRL LALT RALT LAMG RAMG DC.B $80,$80,$80,$80,$80,$80,$80,$80 ; DC.B $80,$80,$80,$80,$80,$80,$80,$80 ; ; ;The actual map! 4 bytes per key. This may be data or a pointer, depending ;on the types table entry for it (see above). ; LoKeyMap: IFNE SWAPESC DC.L $00009B1B,$21B92131 ; '~`~`!',$B9,'!1' ENDC IFEQ SWAPESC DC.L $7E607E60,$21B92131 ; '~`~`!',$B9,'!1' ENDC DC.L $40B24032,$23B32333 ; '@',$B2,'@2#',$B3,'#3' DC.L $24A22434,$25BC2535 ; '$',$A2,'$4%',$BC,'%5' DC.L $5EBD5E36,$26BE2637 ; '^',$BD,'^6&',$BE,'&7' DC.L $2AB72A38,$28AB2839 ; '*',$B7,'*8(',$AB,'(9' DC.L $29BB2930,$5F2D5F2D ; ')',$BB,')0_-_-' DC.L $2B3D2B3D,$7C5C7C5C ; '+=+=|\|\' DC.L $00000000,$00000030 ; $00,$00,$00,$00,$00,$00,$00,'0' DC.L $C5E55171,$B0B05777 ; $C5,$E5,'Qq',$B0,$B0,'Ww' DC.L keydata12e DC.L $AEAE5272,$DEFE5474 ; $AE,$AE,'Rr',$DE,$FE,'Tt' DC.L keydata15y DC.L keydata16u DC.L keydata17i DC.L keydata18o DC.B $B6,$B6,$50,$70,$7B,$5B,$7B,$5B ; $B6,$B6,'Pp{[{[' DC.B $7D,$5D,$7D,$5D,$00,$00,$00,$00 ; '}]}]',$00,$00,$00,$00 DC.B $00,$00,$00,$31,$00,$00,$00,$32 ; $00,$00,$00,'1',$00,$00,$00,'2' DC.B $00,$00,$00,$33 ; $00,$00,$00,'3' DC.L keydata20a DC.B $A7,$DF,$53,$73,$D0,$F0,$44,$64 ; $A7,$DF,'Ss',$D0,$F0,'Dd' DC.L keydata23f DC.L keydata24g DC.L keydata25h DC.L keydata26j DC.L keydata27k DC.B $A3,$A3,$4C,$6C,$3A,$3B,$3A,$3B ; $A3,$A3,'Ll:;:;' DC.B $22,$27,$22,$27,$00,$00,$00,$00 ; '"'"'',$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$34 ; $00,$00,$00,$00,$00,$00,$00,'4' DC.B $00,$00,$00,$35,$00,$00,$00,$36 ; $00,$00,$00,'5',$00,$00,$00,'6' DC.B $BB,$AB,$3E,$3C,$AC,$B1,$5A,$7A ; $BB,$AB,'><',$AC,$B1,'Zz' DC.B $F7,$D7,$58,$78,$C7,$E7,$43,$63 ; $F7,$D7,'Xx',$C7,$E7,'Cc' DC.B $AA,$AA,$56,$76,$BA,$BA,$42,$62 ; $AA,$AA,'Vv',$BA,$BA,'Bb' DC.L keydata36n DC.B $BF,$B8,$4D,$6D,$3C,$2C,$3C,$2C ; $BF,$B8,'Mm<,<,' DC.B $3E,$2E,$3E,$2E,$3F,$2F,$3F,$2F ; '>.>.?/?/' DC.B $00,$00,$00,$00,$00,$00,$00,$2E ; $00,$00,$00,$00,$00,$00,$00,'.' DC.B $00,$00,$00,$37,$00,$00,$00,$38 ; $00,$00,$00,'7',$00,$00,$00,'8' DC.B $00,$00,$00,$39 ; $00,$00,$00,'9' HiKeyMap: DC.L keydata40space ;SPC DC.L $00000008 ;DEL DC.L keydata42tab ;TAB DC.L $0000000D,$00000A0D ;ENT RET IFNE SWAPESC DC.L $7E607E60,$0000007F ;ESC DEL ENDC IFEQ SWAPESC DC.L $00009B1B,$0000007F ;ESC DEL ENDC DC.L $00000000,$00000000 DC.L $00000000 IFEQ HEXPAD DC.L $0000002D ; - ENDC IFNE HEXPAD DC.L $2D2D4565 ; --Ee ENDC DC.L $00000000 DC.L keydata4Cup DC.L keydata4Ddown DC.L keydata4Eright DC.L keydata4Fleft DC.L L00001B ; F1 DC.L L00001C ; ... DC.L L00001D DC.L L00001E DC.L L00001F DC.L L000020 DC.L L000021 DC.L L000022 DC.L L000023 ; ... DC.L L000024 ; F10 ; ;These are the definitions for the 5 extra keys the A500/A2000 have, ;but the A1000 does not. ; IFEQ HEXPAD DC.B $28,$28,$28,$28,$29,$29,$29,$29 ; '(((())))' DC.B $2F,$2F,$2F,$2F,$2A,$2A,$2A,$2A ; '////****' DC.B $2B,$2B,$2B,$2B ; '++++' ENDC IFNE HEXPAD DC.B $28,$28,$41,$61,$29,$29,$42,$62 ; '((Aa))Bb' DC.B $2F,$2F,$43,$63,$2A,$2A,$44,$64 ; '//Cc**Dd' DC.B $2B,$2B,$46,$66 ; '++Ff' ENDC DC.L keydata5Fhelp DC.L $00000000,$00000000 DC.L $00000000,$00000000 DC.L $00000000,$00000000 DC.L $00000000,$00000000 DC.L $00000000,$00000000 DC.L $00000000,$00000000 DC.L $00000000,$00000000 DC.L $00000000,$00000000 DC.L $00000000,$00000000 DC.L $00000000,$00000000 DC.L $00000000,$00000000 DC.L $00000000,$00000000 ; ;"dead" keys let you add accents to charaters. From a CLI press Alt-K. ;Notice the "dead" response. Now type "a". It should come out with ;an umlaut. ; ;The "k" is one of the dead keys. The "a" is a deadable key. ; ;------ Dead Prefix Bytes ; DPB_MOD EQU $00 ; DPF_MOD EQU $01 ; DPB_DEAD EQU $03 ; DPF_DEAD EQU $08 ; ; DP_2DINDEXMASK EQU $0F ; mask for index for 1st of two dead keys ; DP_2DFACSHIFT EQU $04 ; shift for factor for 1st of two dead keys ; ; For a full description of Dead keys, see AmigaMail July/August 1987 ; ; ; These are all of the dead keys. ; keydata23f: ;accent acute=1 DC.B $00,$66,$00,$46,$08,$01,$08,$01 ; $00,'f',$00,'F',$08,$01,$08,$01 DC.B $00,$06,$00,$06,$00,$86,$00,$86 keydata24g: ;accent grave=2 DC.B $00,$67,$00,$47,$08,$02,$08,$02 ; $00,'g',$00,'G',$08,$02,$08,$02 DC.B $00,$07,$00,$07,$00,$87,$00,$87 keydata25h: ;caret=3 DC.B $00,$68,$00,$48,$08,$03,$08,$03 ; $00,'h',$00,'H',$08,$03,$08,$03 DC.B $00,$08,$00,$08,$00,$88,$00,$88 keydata26j: ;circumflex=4 DC.B $00,$6A,$00,$4A,$08,$04,$08,$04 ; $00,'j',$00,'J',$08,$04,$08,$04 DC.B $00,$0A,$00,$0A,$00,$8A,$00,$8A keydata27k: ;umlaut=5 DC.B $00,$6B,$00,$4B,$08,$05,$08,$05 ; $00,'k',$00,'K',$08,$05,$08,$05 DC.B $00,$0B,$00,$0B,$00,$8B,$00,$8B ; ; Here follows deadable keys ; keydata20a: DC.B $01,$10 ;unshifted accent "a" table starts at $10 DC.B $01,$16 ;shifted accent "A" table starts at $16 DC.B $00,$E6,$00,$C6,$00,$01,$00,$01,$00,$81,$00,$81 ;normal keys ;dead with- nothing,accent acute,accent grave,caret,circumflex,umlaut DC.B $61,$E1,$E0,$E2,$E3,$E4 ;'a' DC.B $41,$C1,$C0,$C2,$C3,$C4 ;'A' keydata12e: DC.B $01,$10 DC.B $01,$16,$00,$A9,$00,$A9 DC.B $00,$05,$00,$05,$00,$85,$00,$85 DC.B $65,$E9,$E8,$EA,$65,$EB,$45,$C9 ; 'e',$E9,$E8,$EA,'e',$EB,'E',$C9 DC.B $C8,$CA,$45,$CB ; $C8,$CA,'E',$CB keydata17i: DC.B $01,$10,$01,$16,$00,$A1,$00,$A6 DC.B $00,$09,$00,$09,$00,$89,$00,$89 DC.B $69,$ED,$EC,$EE,$69,$EF,$49,$CD ; 'i',$ED,$EC,$EE,'i',$EF,'I',$CD DC.B $CC,$CE,$49,$CF ; $CC,$CE,'I',$CF keydata36n: DC.B $01,$10,$01,$16,$00,$AD,$00,$AF DC.B $00,$0E,$00,$0E,$00,$8E,$00,$8E DC.B $6E,$6E,$6E,$6E,$F1,$6E,$4E,$4E ; 'nnnn',$F1,'nNN' DC.B $4E,$4E,$D1,$4E ; 'NN',$D1,'N' keydata18o: DC.B $01,$10,$01,$16,$00,$F8,$00,$D8 DC.B $00,$0F,$00,$0F,$00,$8F,$00,$8F DC.B $6F,$F3,$F2,$F4,$F5,$F6,$4F,$D3 ; 'o',$F3,$F2,$F4,$F5,$F6,'O',$D3 DC.B $D2,$D4,$D5,$D6 keydata16u: DC.B $01,$10,$01,$16,$00,$B5,$00,$B5 DC.B $00,$15,$00,$15,$00,$95,$00,$95 DC.B $75,$FA,$F9,$FB,$75,$FC,$55,$DA ; 'u',$FA,$F9,$FB,'u',$FC,'U',$DA DC.B $D9,$DB,$55,$DC ; $D9,$DB,'U',$DC keydata15y: DC.B $01,$10,$01,$16,$00,$A4,$00,$A5 DC.B $00,$19,$00,$19,$00,$99,$00,$99 DC.B $79,$FD,$79,$79,$79,$FF,$59,$DD ; 'y',$FD,'yyy',$FF,'Y',$DD DC.B $59,$59,$59,$59 ; 'YYYY' keydata40space: DC.B $01,$04,$00,$A0,$20,$B4,$60,$5E ; $01,$04,$00,$A0,' ',$B4,'`^' DC.B $7E,$A8 ; '~',$A8 ; ; Miscelaneous string output keys ; ; keydata42tab: DC.B $01,$04,$02,$05,$09,$9B,$5A ; $01,$04,$02,$05,$09,$9B,'Z' keydata4Cup: ;(Cursor up) DC.B $02,$04,$02,$06,$9B,$41,$9B,$54 ; $02,$04,$02,$06,$9B,'A',$9B,'T' keydata4Ddown: DC.B $02,$04,$02,$06,$9B,$42,$9B,$53 ; $02,$04,$02,$06,$9B,'B',$9B,'S' keydata4Eright: DC.B $02,$04,$03,$06,$9B,$43,$9B,$20 ; $02,$04,$03,$06,$9B,'C',$9B,' ' DC.B $40 ; '@' keydata4Fleft: DC.B $02,$04,$03,$06,$9B,$44,$9B,$20 ; $02,$04,$03,$06,$9B,'D',$9B,' ' DC.B $41 ; 'A' ; ; Here start the function keys. These are all string output keys ; ; The first byte is the length of the string. ; The second byte is the offset where the string starts at. ; This is repeated for each needed string. ; Then follows the actual data. ; L00001B: DC.B $03,$04 ; 3 bytes long, 4 bytes from start (0~) DC.B $04,$07 ; 4 bytes long, 7 bytes from start (10~) DC.B $9B,$30,$7E ; 0~ DC.B $9B,$31,$30,$7E ; 10~ L00001C: DC.B $03,$04,$04,$07,$9B,$31,$7E,$9B ; $03,$04,$04,$07,$9B,'1~',$9B DC.B $31,$31,$7E ; '11~' L00001D: DC.B $03,$04,$04,$07,$9B,$32,$7E,$9B ; $03,$04,$04,$07,$9B,'2~',$9B DC.B $31,$32,$7E ; '12~' L00001E: DC.B $03,$04,$04,$07,$9B,$33,$7E,$9B ; $03,$04,$04,$07,$9B,'3~',$9B DC.B $31,$33,$7E ; '13~' L00001F: DC.B $03,$04,$04,$07,$9B,$34,$7E,$9B ; $03,$04,$04,$07,$9B,'4~',$9B DC.B $31,$34,$7E ; '14~' L000020: DC.B $03,$04,$04,$07,$9B,$35,$7E,$9B ; $03,$04,$04,$07,$9B,'5~',$9B DC.B $31,$35,$7E ; '15~' L000021: DC.B $03,$04,$04,$07,$9B,$36,$7E,$9B ; $03,$04,$04,$07,$9B,'6~',$9B DC.B $31,$36,$7E ; '16~' L000022: DC.B $03,$04,$04,$07,$9B,$37,$7E,$9B ; $03,$04,$04,$07,$9B,'7~',$9B DC.B $31,$37,$7E ; '17~' L000023: DC.B $03,$04,$04,$07,$9B,$38,$7E,$9B ; $03,$04,$04,$07,$9B,'8~',$9B DC.B $31,$38,$7E ; '18~' L000024: DC.B $03,$04,$04,$07,$9B,$39,$7E,$9B ; $03,$04,$04,$07,$9B,'9~',$9B DC.B $31,$39,$7E ; '19~' keydata5Fhelp: DC.B $03,$02,$9B,$3F,$7E ; $03,$02,$9B,'?~' KeyMapName: IFNE OLDMAP DC.B 'usa1',0 ENDC IFEQ OLDMAP DC.B 'custom_usa1',0 ENDC CNOP 0,2 END