W^d5P:H r^	g;File KEYM2.TEXT
;_______________________________________________________________________
;
; Mac KeyPad Mapping Proc
;
; Modification History:
; 16 Feb 83  LAK  New today.
; 03 Dec 83  AJH  Added installation header
; 27 Jan 84  JTC  Swapped dot and comma for international.
;_______________________________________________________________________

            .INCLUDE tlAsm/SysEqu.Text

;_______________________________________________________________________
;
; Routine:      TranNumKey
; Arguments:      D1 (input)  --  option, alpha, shift key map bits in 2,1,0
;                 D2 (input)  --  keycode (0-63)
;                 D0 (output) --  ASCII code
;                 trashes A0 and D1
; Function:     TRANKEY is the default mapping procedure for turning raw
;               keycodes from the numeric keypad into ASCII codes.
;
;_______________________________________________________________________

            .PROC   KeyM2,0

            BRA     InstallIt

TranNumKey  LEA     KeyPadNormal,A0
            LSR     #1,D1               ; shift key down?
            BCC.S   Mask32
            LEA     KeyPadShift,A0      ; shifted keypad table
Mask32      AND.B   #$1F,D2             ; only 32 codes in the table
            MOVE.B  0(A0,D2),D0
            RTS

KeyPadNormal    ; keypad keycode to ASCII translation table - unshifted

 .BYTE  $00,$2E,$1D,$00         ; unused . right-cursor unused
 .BYTE  $00,$00,$1C,$1B         ; unused unused left-cursor CLEAR
 .BYTE  $1F,$00,$00,$00         ; down-cursor unused unused unused
 .BYTE  $03,$1E,$2D,$00         ; ENTER up-cursor - unused
 .BYTE  $00,$00,$30,$31         ; unused unused 0 1
 .BYTE  $32,$33,$34,$35         ; 2 3 4 5
 .BYTE  $36,$37,$00,$38         ; 6 7 unused 8
 .BYTE  $39,$00,$00,$00         ; 9 unused unused unused

KeyPadShift     ; keypad keycode to ASCII translation table - shifted

 .BYTE  $00,$2C,$2A,$00         ; unused , * unused
 .BYTE  $00,$00,$2B,$1B         ; unused unused + CLEAR
 .BYTE  $2E,$00,$00,$00         ; . unused unused unused
 .BYTE  $03,$2F,$2D,$00         ; ENTER / - unused
 .BYTE  $00,$00,$30,$31         ; unused unused 0 1
 .BYTE  $32,$33,$34,$35         ; 2 3 4 5
 .BYTE  $36,$37,$00,$38         ; 6 7 unused 8
 .BYTE  $39,$00,$00,$00         ; 9 unused unused unused

InstallIt
            LEA     TranNumKey,A0
            MOVE.L  A0,Key2Trans
            RTS


        .END



