# VICE keyboard mapping file
#
# A Keyboard map is read in as patch to the current map.
#
# File format:
# - comment lines start with '#'
# - keyword lines start with '!keyword'
# - normal lines have 'keysym/scancode row column shiftflag'
#
# Keywords and their lines are:
# '!CLEAR'               clear whole table
# '!INCLUDE filename'    read file as mapping file
# '!LSHIFT row col'      left shift keyboard row/column
# '!RSHIFT row col'      right shift keyboard row/column
# '!VSHIFT shiftkey'     virtual shift key (RSHIFT or LSHIFT)
# '!SHIFTL shiftkey'     shift lock key (RSHIFT or LSHIFT)
#  for emulated keyboards that have only one shift key, set both LSHIFT
#  and RSHIFT to the same row/col and use RSHIFT for VSHIFT and SHIFTL.
# '!LCTRL row col'       left control keyboard row/column
# '!VCTRL ctrlkey'       virtual control key (LCTRL)
# '!LCBM row col'        left CBM keyboard row/column
# '!VCBM cbmkey'         virtual CBM key (LCBM)
# '!UNDEF keysym'        remove keysym from table
#
# Shiftflag can have these values, flags can be ORed to combine them:
# 0x0000      0  key is not shifted for this keysym/scancode
# 0x0001      1  key is combined with shift for this keysym/scancode
# 0x0002      2  key is left shift on emulated machine
# 0x0004      4  key is right shift on emulated machine (use only this one
#                for emulated keyboards that have only one shift key)
# 0x0008      8  key can be shifted or not with this keysym/scancode
# 0x0010     16  deshift key for this keysym/scancode
# 0x0020     32  another definition for this keysym/scancode follows
# 0x0040     64  key is shift-lock on emulated machine
# 0x0080    128  shift modifier required on host
# 0x0100    256  key is used for an alternative keyboard mapping, e.g. C64 mode in x128
# 0x0200    512  alt-r (alt-gr) modifier required on host
# 0x0400   1024  ctrl modifier required on host
# 0x0800   2048  key is combined with cbm for this keysym/scancode
# 0x1000   4096  key is combined with ctrl for this keysym/scancode
# 0x2000   8192  key is (left) cbm on emulated machine
# 0x4000  16384  key is (left) ctrl on emulated machine
#
# Negative row values:
# 'keysym -1 n' joystick keymap A, direction n
# 'keysym -2 n' joystick keymap B, direction n
# 'keysym -3 0' first RESTORE key
# 'keysym -3 1' second RESTORE key
# 'keysym -4 0' 40/80 column key (x128)
# 'keysym -4 1' CAPS (ASCII/DIN) key (x128)
# 'keysym -5 n' joyport keypad, key n (not supported in x128)
#
# Joystick direction values:
# 0      Fire
# 1      South/West
# 2      South
# 3      South/East
# 4      West
# 5      East
# 6      North/West
# 7      North
# 8      North/East
#
# Joyport keypad key layout:
# --------------------------
# |  0 |  1 |  2 |  3 |  4 |
# --------------------------
# |  5 |  6 |  7 |  8 |  9 |
# --------------------------
# | 10 | 11 | 12 | 13 | 14 |
# --------------------------
# | 15 | 16 | 17 | 18 | 19 |
# --------------------------
#
# When a bigger spaced key is used,
# it uses the upper left most key value.

# Positional Mapping, US Layout, CBM2, GTK

# Commodore cbm2 keyboard matrix:
#
# references:
#  http://www.zimmers.net/anonftp/pub/cbm/b/documents/de/keyboard-matrix.gif
#  http://www.zimmers.net/anonftp/pub/cbm/b/documents/keymap-us.gif
#  http://www.zimmers.net/anonftp/pub/cbm/schematics/computers/b/p500-keyboard.txt
#  http://www.floodgap.com/retrobits/ckb/secret/cbm-610-keyboard.jpg
#
# Keys starting with 'KP' are on the number pad. Both shifts and shift lock
# are in parallel at one point in matrix.
#
#       0        1        2        3        4        5
#   +--------+--------+--------+--------+--------+--------+
# 0 |   F9   |  9  (  |   O    |   L    |  ;  :  |  /  ?  |
#   +--------+--------+--------+--------+--------+--------+
# 1 |  F10   |  0  )  |   -    |   P    |   [    |  '  "  |
#   +--------+--------+--------+--------+--------+--------+
# 2 | c.down |  =  +  |<- pound|   ]    | return |  pi    |
#   +--------+--------+--------+--------+--------+--------+
# 3 | c.up   | c.left | c.right|del ins | CBM    |########|
#   +--------+--------+--------+--------+--------+--------+
# 4 |home/clr|KP ?    |KP 7    |KP 4    |KP 1    |KP 0    |
#   +--------+--------+--------+--------+--------+--------+
# 5 |rvs/off |KP CE   |KP 8    |KP 5    |KP 2    |KP .    |
#   +--------+--------+--------+--------+--------+--------+
# 6 | graph  |KP *    |KP 9    |KP 6    |KP 3    |KP 00   |
#   +--------+--------+--------+--------+--------+--------+
# 7 |run/stop|KP /    |KP -    |KP +    |KP enter|########|
#   +--------+--------+--------+--------+--------+--------+
# 8 |   F1   | escape |  TAB   |########| Shift  | CTRL   |
#   +--------+--------+--------+--------+--------+--------+
# 9 |   F2   |  1  !  |   Q    |   A    |   Z    |########|
#   +--------+--------+--------+--------+--------+--------+
#10 |   F3   |  2  @  |   W    |   S    |   X    |   C    |
#   +--------+--------+--------+--------+--------+--------+
#11 |   F4   |  3  #  |   E    |   D    |   F    |   V    |
#   +--------+--------+--------+--------+--------+--------+
#12 |   F5   |  4  $  |   R    |   T    |   G    |   B    |
#   +--------+--------+--------+--------+--------+--------+
#13 |   F6   |  5  %  |  6  ^  |   Y    |   H    |   N    |
#   +--------+--------+--------+--------+--------+--------+
#14 |   F7   |  7  &  |   U    |   J    |   M    | space  |
#   +--------+--------+--------+--------+--------+--------+
#15 |   F8   |  8  *  |   I    |   K    |  ,  <  |  .  >  |
#   +--------+--------+--------+--------+--------+--------+

#   CBM2 Keyboard layout:
#
#   F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 down up left right clr rvs graph r/s
#
#   ESC 1!  2@  3#  4$  5%  6^  7&  8*  9(  0)  -   =+  arrow/pound del     ?   CE  *   /
#    TAB q   w   e   r   t   y   u   i   o   p   [   ]   return             7   8   9   -
#     SL  a   s   d   f   g   h   j   k   l   ;:  '"  pi                    4   5   6   +
#      LS  z   x   c   v   b   n   m   ,<  .>  /?  RS   CBM                 1   2   3
#       CTRL    SPACE                                                       0   .   00  enter

!CLEAR
!LSHIFT 8 4
!RSHIFT 8 4
!VSHIFT RSHIFT
!SHIFTL RSHIFT
!LCBM 3 4
!VCBM LCBM
!LCTRL 8 5
!VCTRL LCTRL

F1 8 0 8
F2 9 0 8
F3 10 0 8
F4 11 0 8
F5 12 0 8
F6 13 0 8
F7 14 0 8
F8 15 0 8
F9 0 0 8
F10 1 0 8

Down 2 0 8
Up 3 0 8
Left 3 1 8
Right 3 2 8

Home 4 0 8
F11 5 0 8
F12 6 0 8
Escape 7 0 8

####

asciicircum     8 1 0
degree          8 1 1
dead_circumflex 8 1 0

1 9 1 0
exclam 9 1 1
2 10 1 0
quotedbl 10 1 1
3 11 1 0
section 11 1 1
4 12 1 0
dollar 12 1 1
5 13 1 0
percent 13 1 1
6 13 2 0
ampersand 13 2 0
7 14 1 0
slash 14 1 1
8 15 1 0
parenleft 15 1 1
9 0 1 0
parenright 0 1 1
0 1 1 0
equal 1 1 1
ssharp 1 2 0
question 1 2 1
acute 2 1 0
grave 2 1 1
dead_acute 2 1 0
dead_grave 2 1 1
End 2 2 8
BackSpace 3 3 8

####

Tab 8 2 8
ISO_Left_Tab 8 2 1

udiaeresis 1 4 8
Udiaeresis 1 4 8
plus 2 3 8
asterisk 2 3 8
Return 2 4 0

####

Caps_Lock       8 4 64

odiaeresis 0 4 8
Odiaeresis 0 4 8
adiaeresis 1 5 8
Adiaeresis 1 5 8
numbersign 2 5 8
apostrophe 2 5 8

####

Shift_L 8 4 4

comma 15 4 8
semicolon 15 4 8
period 15 5 8
colon 15 5 8
minus 0 5 8
underscore 0 5 8
Shift_R 8 4 4
Control_R        3 4 0x2000

####

Control_L        8 5 16384
space 14 5 8

####

Page_Up 4 1 8
KP_Divide 5 1 8
KP_Multiply 6 1 8
KP_Subtract 7 1 8

KP_7 4 2 8
KP_8 5 2 8
KP_9 6 2 8
KP_Add 7 2 8

KP_4 4 3 8
KP_5 5 3 8
KP_6 6 3 8
Page_Down 7 3 8

KP_1 4 4 8
KP_2 5 4 8
KP_3 6 4 8
KP_Enter 7 4 8

KP_0 4 5 8
KP_Separator 5 5 8
KP_Decimal 5 5 8
Delete 6 5 8

a 9 3 0
b 12 5 0
c 10 5 0
d 11 3 0
e 11 2 0
f 11 4 0
g 12 4 0
h 13 4 0
i 15 2 0
j 14 3 0
k 15 3 0
l 0 3 0
m 14 4 0
n 13 5 0
o 0 2 0
p 1 3 0
q 9 2 0
r 12 2 0
s 10 3 0
t 12 3 0
u 14 2 0
v 11 5 0
w 10 2 0
x 10 4 0
z 13 3 0
y 9 4 0

A 9 3 1
B 12 5 1
C 10 5 1
D 11 3 1
E 11 2 1
F 11 4 1
G 12 4 1
H 13 4 1
I 15 2 1
J 14 3 1
K 15 3 1
L 0 3 1
M 14 4 1
N 13 5 1
O 0 2 1
P 1 3 1
Q 9 2 1
R 12 2 1
S 10 3 1
T 12 3 1
U 14 2 1
V 11 5 1
W 10 2 1
X 10 4 1
Z 13 3 1
Y 9 4 1
