# 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)
# '!UNDEF keysym'        remove keysym from table
#
# Shiftflag can have the values:
# 0      key is not shifted for this keysym/scancode
# 1      key is shifted for this keysym/scancode
# 2      left shift
# 4      right shift
# 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
# 256    key is used for an alternative keyboard mapping
#
# Negative row values:
# 'keysym -1 n' joystick #1, direction n
# 'keysym -2 n' joystick #2, 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
#

# Positional Mapping, US Layout, C128, X11

#       +-----+-----+-----+-----+-----+-----+-----+-----+
#       |Bit 0|Bit 1|Bit 2|Bit 3|Bit 4|Bit 5|Bit 6|Bit 7|
# +-----+-----+-----+-----+-----+-----+-----+-----+-----+
# |Bit 0| DEL |Retrn|C_L/R|  F7 |  F1 |  F3 |  F5 |C_U/D|
# +-----+-----+-----+-----+-----+-----+-----+-----+-----+
# |Bit 1| 3 # |  W  |  A  | 4 $ |  Z  |  S  |  E  | S_L |
# +-----+-----+-----+-----+-----+-----+-----+-----+-----+
# |Bit 2| 5 % |  R  |  D  | 6 & |  C  |  F  |  T  |  X  |
# +-----+-----+-----+-----+-----+-----+-----+-----+-----+
# |Bit 3| 7 ' |  Y  |  G  | 8 ( |  B  |  H  |  U  |  V  |
# +-----+-----+-----+-----+-----+-----+-----+-----+-----+
# |Bit 4| 9 ) |  I  |  J  |  0  |  M  |  K  |  O  |  N  |
# +-----+-----+-----+-----+-----+-----+-----+-----+-----+
# |Bit 5|  +  |  P  |  L  |  -  | . > | : [ |  @  | , < |
# +-----+-----+-----+-----+-----+-----+-----+-----+-----+
# |Bit 6|POUND|  *  | ; ] | HOME| S_R |  =  | A_UP| / ? |
# +-----+-----+-----+-----+-----+-----+-----+-----+-----+
# |Bit 7| 1 ! |A_LFT| CTRL| 2 " |SPACE|  C= |  Q  | R/S |
# +-----+-----+-----+-----+-----+-----+-----+-----+-----+

#        +-----+-----+-----+-----+-----+-----+-----+-----+
#        |Bit 0|Bit 1|Bit 2|Bit 3|Bit 4|Bit 5|Bit 6|Bit 7|
# +------+-----+-----+-----+-----+-----+-----+-----+-----+
# |Bit 8 |HELP | KP 8| KP 5| TAB | KP 2| KP 4| KP 7| KP 1|
# +------+-----+-----+-----+-----+-----+-----+-----+-----+
# |Bit 9 | ESC | KP +| KP -| LF  |KP CR| KP 6| KP 9| KP 3|
# +------+-----+-----+-----+-----+-----+-----+-----+-----+
# |Bit 10| ALT | KP 0| KP .|A.UP |A.DWN|A.LFT|A.RGT|NOSCR|
# +------+-----+-----+-----+-----+-----+-----+-----+-----+

!CLEAR
!LSHIFT 1 7
!RSHIFT 6 4
!VSHIFT RSHIFT

# Tab = CTRL
Tab 7 2 8
# Shift + Tab = CTRL
ISO_Left_Tab 7 2 8

# Control_L = CBM
Control_L 7 5 8

BackSpace 0 0 8
Delete 0 0 8
Escape 7 7 8

# escape - tab - alt - (caps lock)
# help - linefeed - (40/80) - no scroll

# escape
F1  9 0 8
# tab
F2  8 3 8
# alt
F3 10 0 8
# CAPS (ASCII/DIN) key
F4 -4 1
# help
F5  8 0 8
# lf
F6  9 3 8
# 40/80 column key
F7 -4 0
# no scroll
F8 10 7 8

F9 0 4 8
F10 0 5 8
F11 0 6 8
F12 0 3 8

Home 6 3 8
Insert 6 0 8
Return 0 1 8
Shift_L 1 7 2
Shift_R 6 4 4

Up 0 7 257
Up 10 3 8
Left 0 2 257
Left 10 5 8
Right 0 2 264
Right 10 6 8
Down 0 7 264
Down 10 4 8

End 0 7 8
Page_Down 0 2 8
Page_Down 6 6 8

ampersand 3 0 8
apostrophe 6 2 8
asciicircum 2 3 8
asciitilde 7 1 8
asterisk 3 3 8
at 7 3 8
backslash 6 5 8
bar 6 5 8
braceleft 5 6 8
braceright 6 1 8
bracketleft 5 6 8
bracketright 6 1 8
colon 5 5 8
comma 5 7 8
dollar 1 3 8
equal 5 3 8
exclam 7 0 8
grave 7 1 8
greater 5 4 1
greater 5 4 8
less 5 7 8
minus 5 0 8
numbersign 1 0 8
parenleft 4 0 8
parenright 4 3 8
percent 2 0 8
period 5 4 8
plus 5 3 8
question 6 7 8
quotedbl 6 2 8
semicolon 5 5 8
slash 6 7 8
space 7 4 8
sterling 6 0 8
underscore 5 0 8

#####################
# letters and numbers

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

KP_0 10 1 8
KP_1 8 7 8
KP_2 8 4 8
KP_3 9 7 8
KP_4 8 5 8
KP_5 8 2 8
KP_6 9 5 8
KP_7 8 6 8
KP_8 8 1 8
KP_9 9 6 8
KP_Enter 9 4 8
KP_Subtract 9 1 8
KP_Separator 10 2 8
KP_Decimal 10 2 8
KP_Add 9 2 8

# Dead keys support for those using US-International keyboard layout.
dead_circumflex 2 3 8  # &
dead_tilde      7 1 8  # A_LFT <-
dead_grave      7 1 8  # A_LFT <-
dead_acute      6 2 8  # ;
dead_diaeresis  6 2 8  # ]
