# 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 line has '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)
# '!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 the values:
# 0      key is not shifted for this keysym/scancode
# 1      key is combined with shift for this keysym/scancode
# 2      key is left shift on emulated machine
# 4      key is right shift on emulated machine
# 8      key can be shifted or not with this keysym/scancode
# 16     deshift key for this keysym/scancode
# 32     another definition for this keysym/scancode follows
# 64     key is shift-lock on emulated machine
# 128    shift modifier required on host
# 256    key is used for an alternative keyboard mapping
# 512    alt-r (alt-gr) modifier required on host
# 1024   ctrl modifier required on host
# 2048   key is combined with cbm for this keysym/scancode
# 4096   key is combined with ctrl for this keysym/scancode
# 8192   key is (left) cbm on emulated machine
# 16384  key is (left) ctrl on emulated machine
#
# to migrate older keymaps and use the CBM and/or CTRL related features:
#
# - define !LCTRL, !VCTRL, !LCBM, !VCBM
# - add 'key is (left) cbm/ctrl on emulated machine' flags to
#   all keys that map to the cbm or ctrl key respectively.
#
# after that the virtual cbm/ctrl flags and requiring host modifiers
# should work as expected. keep an eye on the error messages.
#
# 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
# 'keysym -4 1' CAPS (ASCII/DIN) key
# 'keysym -5 n' joyport keypad, key n
#
# 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.

# Symbolic Mapping, German Layout, Plus4, X11

#############################################################################
#
# Commodore 16/116/Plus-4 keyboard matrix:
#
#       0        1        2        3       4         5        6        7
#   +--------+--------+--------+--------+--------+--------+--------+--------+
# 0 |INST-DEL|RETURN  |POUND   |HELP-F7 |F1-F4   |F2-F5   |F3-F6   |@       |
#   +--------+--------+--------+--------+--------+--------+--------+--------+
# 1 |3 #     |W       |A       |4 $     |Z       |S       |E       |SHIFT   |
#   +--------+--------+--------+--------+--------+--------+--------+--------+
# 2 |5 %     |R       |D       |6 &     |C       |F       |T       |X       |
#   +--------+--------+--------+--------+--------+--------+--------+--------+
# 3 |7 '     |Y       |G       |8 (     |B       |H       |U       |V       |
#   +--------+--------+--------+--------+--------+--------+--------+--------+
# 4 |9 )     |I       |J       |0 ^     |M       |K       |O       |N       |
#   +--------+--------+--------+--------+--------+--------+--------+--------+
# 5 |DOWN    |P       |L       |UP      |. >     |: [     |-       |, <     |
#   +--------+--------+--------+--------+--------+--------+--------+--------+
# 6 |LEFT    |*       |; ]     |RIGHT   |ESC     |=       |+       |/ ?     |
#   +--------+--------+--------+--------+--------+--------+--------+--------+
# 7 |1 !     |CLR-HOME|CTRL    |2 "     |SPACE   |CBM     |Q       |RUN-STOP|
#   +--------+--------+--------+--------+--------+--------+--------+--------+
#
#############################################################################

# this is a symbolic mapping for german keyboards
#
# "special" keys are mapped like this:
#
# CTRL     -> left CTRL
# CLR/HOME -> HOME
# CBM      -> TAB
# RUN/STOP -> escape
# RESTORE  -> F12

!CLEAR
!LSHIFT 1 7
#!RSHIFT 1 7
!VSHIFT LSHIFT
!SHIFTL LSHIFT
!LCBM 7 5
!VCBM LCBM
!LCTRL 7 2
!VCTRL LCTRL

# braceleft      3 3 8
# braceright     4 0 8
# backslash      0 7 8
# bar            0 7 8
# sterling       6 0 8
# bracketright   6 6 8
# circumflex     3 1 8
# asciitilde     6 4 8
# grave          6 4 8

# 0 |INST-DEL|RETURN  |POUND   |HELP-F7 |F1-F4   |F2-F5   |F3-F6   |@       |
BackSpace      0 0 8
Delete         0 0 8
Return         0 1 8
udiaeresis     0 2 0
Udiaeresis     0 2 1
F7             0 3 8
F8             0 3 1
F1             0 4 8
F4             0 4 1
F2             0 5 8
F5             0 5 1
F3             0 6 8
F6             0 6 1
at             0 7 0

# 1 |3 #     |W       |A       |4 $     |Z       |S       |E       |SHIFT   |
numbersign     1 0 1
section        1 0 1
dollar         1 3 8
Shift_L        1 7 2
Shift_R        1 7 2

# 2 |5 %     |R       |D       |6 &     |C       |F       |T       |X       |
percent        2 0 8
ampersand      2 3 8

# 3 |7 '     |Y       |G       |8 (     |B       |H       |U       |V       |
apostrophe     3 0 8
parenleft      3 3 8

# 4 |9 )     |I       |J       |0 ^     |M       |K       |O       |N       |
parenright      4 0 8
asciicircum     4 3 1
dead_circumflex 4 3 1

# 5 |DOWN    |P       |L       |UP      |. >     |: [     |-       |, <     |
Down           5 0 8
Up             5 3 8
greater        5 4 1
period         5 4 0
colon          5 5 0
bracketleft    5 5 8
minus          5 6 0
comma          5 7 0
less           5 7 1

# 6 |LEFT    |*       |; ]     |RIGHT   |ESC     |=       |+       |/ ?     |
Left           6 0 8
asterisk       6 1 0
semicolon      6 2 0
Right          6 3 8
# escape = ?
equal          6 5 0
underscore     6 5 1
mu             6 5 2048
plus           6 6 0
question       6 7 8
slash          6 7 0

# 7 |1 !     |CLR-HOME|CTRL    |2 "     |SPACE   |C=      |Q       |RUN-STOP|
exclam         7 0 8
Home           7 1 8
Control_L      7 2 16384
quotedbl       7 3 8
space          7 4 8
Tab            7 5 8192
ISO_Left_Tab   7 5 8192
Escape         7 7 8

0 4 3 8
1 7 0 8
2 7 3 8
3 1 0 8
4 1 3 8
5 2 0 8
6 2 3 8
7 3 0 8
8 3 3 8
9 4 0 8
A 1 2 8
B 3 4 8
C 2 4 8
D 2 2 8
E 1 6 8
F 2 5 8
G 3 2 8
H 3 5 8
I 4 1 8
J 4 2 8
K 4 5 8
L 5 2 8
M 4 4 8
N 4 7 8
O 4 6 8
P 5 1 8
Q 7 6 8
R 2 1 8
S 1 5 8
T 2 6 8
U 3 6 8
V 3 7 8
W 1 1 8
X 2 7 8
Y 3 1 8
Z 1 4 8
a 1 2 8
b 3 4 8
c 2 4 8
d 2 2 8
e 1 6 8
f 2 5 8
g 3 2 8
h 3 5 8
i 4 1 8
j 4 2 8
k 4 5 8
l 5 2 8
m 4 4 8
n 4 7 8
o 4 6 8
p 5 1 8
q 7 6 8
r 2 1 8
s 1 5 8
t 2 6 8
u 3 6 8
v 3 7 8
w 1 1 8
x 2 7 8
y 3 1 8
z 1 4 8

# Restore key mappings
Page_Up      -3 0
F12          -3 1

#
# joyport attached keypad
#
Num_Lock    -5 0
KP_7        -5 1
KP_8        -5 2
KP_9        -5 3
KP_Divide   -5 4
Scroll_Lock -5 5
KP_4        -5 6
KP_5        -5 7
KP_6        -5 8
KP_Multiply -5 9
Sys_Req     -5 10
KP_1        -5 11
KP_2        -5 12
KP_3        -5 13
KP_Subtract -5 14
Print       -5 15
KP_0        -5 16
KP_Delete   -5 17
KP_Enter    -5 18
KP_Add      -5 19
