' ******************
' KeyMap File Format
' ******************
'
' Left value:    Windows virtual key codes
'    http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx
'
' Middle value:  shift/alt/ctrl state
'
' Right value:   PETSCII value
'    http://sta.c64.org/cbm64pet.html
'

   ' **************************************************************
   ' unshiftet
   ' **************************************************************
   ' ESC
   27, 0= 27
   
   ' F-keys
   112, 0= 301	' F1
   113, 0= 302	' F2
   114, 0= 303	' F3
   115, 0= 304	' F4
   116, 0= 305	' F5
   117, 0= 306	' F6
   118, 0= 307	' F7
   119, 0= 308	' F8
   120, 0= 309	' F9
   121, 0= 310	' F10
   122, 0= 92	' F11 maps to c64 petscii pic (pound sign)
   123, 0= 94	' F12 maps to c64 '^' up arrow graphic
   
   ' PrintScreen doesn't map
   
   ' Scroll lock
   145, 0= 267
   
   ' Pause
   19, 0= 268
   
   ' first row - number keys
   192, 0= 95	' windows '`' key maps to c64 '<-' (left-arrow)
   48, 0= "0"
   49, 0= "1"
   50, 0= "2"
   51, 0= "3"
   52, 0= "4"
   53, 0= "5"
   54, 0= "6"
   55, 0= "7"
   56, 0= "8"
   57, 0= "9"
   189, 0= "+"	' windows '-' key maps to c64 '+'
   187, 0= "-"	' windows '=' key maps to c64 '-'
   
   ' Backspace
   8, 0= 8
   
   ' TAB
   9, 0= 9
   
   ' second row characters
   81, 0= "Q"
   87, 0= "W"
   69, 0= "E"
   82, 0= "R"
   84, 0= "T"
   89, 0= "Y"
   85, 0= "U"
   73, 0= "I"
   79, 0= "O"
   80, 0= "P"
   219, 0= "@"	' windows '[' maps to c64 '@'
   221, 0= "*"	' windows ']' maps to c64 '*'
   220, 0= "="	' windows '\' maps to c64 '='
   
   ' Return
   13, 0= 13
   
   ' CAPS LOCK
   20, 0= 256
   
   ' third row characters
   65, 0= "A"
   83, 0= "S"
   68, 0= "D"
   70, 0= "F"
   71, 0= "G"
   72, 0= "H"
   74, 0= "J"
   75, 0= "K"
   76, 0= "L"
   186, 0= ":"	' windows ; maps to c64 ':'
   222, 0= ";"  ' windows '" (quotes) maps to c64 ';'
   
   ' fourth row characters
   90, 0= "Z"
   88, 0= "X"
   67, 0= "C"
   86, 0= "V"
   66, 0= "B"
   78, 0= "N"
   77, 0= "M"
   188, 0= ","
   190, 0= "."
   191, 0= "/"
   
   ' Shift, Strg, Alt, Alt-Gr, Win and Menu
   16, 0= 0
   17, 0= 0
   18, 0= 0
   91, 0= 0
   92, 0= 0
   93, 0= 0
   
   ' cursor keys
   ' left
   37, 0= 257
   ' up
   38, 0= 258
   ' right
   39, 0= 259
   ' down
   40, 0= 260

   ' ins
   45, 0= 261	' I decided that windows ins key should remain as ins key
		' and not the c64 pound sign graphic (as in ccs64).
		' Since I'd like the ins key to maintain its current behaviour
		' within the application (to swap between insert and overwrite edit modes)
		' I will map the windows F11 key to be the pound sign instead

   ' del
   46, 0= 262	' I decided that windows del key should remain a delete key
		' and not the c64 '^' up arrow graphic (as in ccs64).
		' Since I'd like the delete key to maintain standard windows behaviour.
		' I will map the windows F12 key to be '^' arrow instead
   ' Home
   36, 0= 263
   ' end
   35, 0= 264
   ' PgUp
   33, 0= 265
   ' PgDown
   34, 0= 266
   
   
   ' number block
   ' NumLock
   144, 0= 269
   111, 0= "/"
   106, 0= "*"
   109, 0= "-"
   107, 0= "+"
   ' Enter = Return
   '13, 0= 13
   110, 0= ","
   ' numbers
   96, 0= "0"
   97, 0= "1"
   98, 0= "2"
   99, 0= "3"
   100, 0= "4"
   101, 0= "5"
   102, 0= "6"
   103, 0= "7"
   104, 0= "8"
   105, 0= "9"
   
   ' Space
   32, 0= " "
   
   ' **************************************************************
   ' shiftet
   ' **************************************************************
   ' ESC
   27, 1= 27 + 512
   
   ' F-Keys
   112, 1= 301 + 512
   113, 1= 302 + 512
   114, 1= 303 + 512
   115, 1= 304 + 512
   116, 1= 305 + 512
   117, 1= 306 + 512
   118, 1= 307 + 512
   119, 1= 308 + 512
   120, 1= 309 + 512
   121, 1= 310 + 512
   122, 1= 169	' shift+F11 maps to c64 petscii pic (top-left triangle)
   123, 1= 222	' shift+F12 maps to c64 pi graphic

   ' PrintScreen doesn't work
   
   ' ScrollLock
   145, 1= 267 + 512
   
   ' Pause
   19, 1= 268 + 512
   
   ' first row - number keys
   192, 1= 95	' windows '~' key maps to c64 '<-' (left-arrow)
   49, 1= "!"	' windows shift+'1' key maps to c64 '!'
   50, 1= 34	' windows shift+'2' key maps to c64 " (dbl-quote)
   51, 1= "#"	' windows shift+'3' key maps to c64 #
   52, 1= "$"	' windows shift+'4' key maps to c64 $
   53, 1= "%"	' windows shift+'5' key maps to c64 %
   54, 1= "&"	' windows shift+'6' key maps to c64 &
   55, 1= 39	' windows shift+'7' key maps to c64 `
   56, 1= "("	' windows shift+'8' key maps to c64 (
   57, 1= ")"	' windows shift+'9' key maps to c64 )
   189, 1= 219	' windows shift+'-' key maps to c64 petscii pic (crucifix)
   187, 1= 221	' windows shift+'=' key maps to c64 petscii pic (mid-vert bar)
   
   ' Backspace
   8, 1= 8 + 512
   
   ' TAB
   9, 1= 9 + 512
   
   ' second row - characters
   81, 1= "q" + 96
   87, 1= "w" + 96
   69, 1= "e" + 96
   82, 1= "r" + 96
   84, 1= "t" + 96
   90, 1= "z" + 96
   85, 1= "u" + 96
   73, 1= "i" + 96
   79, 1= "o" + 96
   80, 1= "p" + 96
   219, 1= 186	' windows shift+'[' maps to c64 petscii pic (bottom-right L-shape)
   221, 1= 192	' windows shift+']' maps to c64 petscii pic (mid-horz bar)
   220, 1= "="	' windows shift+'\' maps to c64 '='
   
   ' Return
   13, 1= 13 + 512
   
   ' CAPS LOCK
   20, 1= 256
   
   ' third row - characters
   65, 1= "a" + 96
   83, 1= "s" + 96
   68, 1= "d" + 96
   70, 1= "f" + 96
   71, 1= "g" + 96
   72, 1= "h" + 96
   74, 1= "j" + 96
   75, 1= "k" + 96
   76, 1= "l" + 96
   186, 1= "["	' windows shift+';' maps to c64 ':'
   222, 1= "]"  ' windows shift+' (dbl-quotes) maps to c64 ';'
   
   ' fourth row - characters
   90, 1= "z" + 96
   89, 1= "y" + 96 
   88, 1= "x" + 96
   67, 1= "c" + 96 
   86, 1= "v" + 96 
   66, 1= "b" + 96 
   78, 1= "n" + 96 
   77, 1= "m" + 96 
   188, 1= ";"
   190, 1= ":"
   188, 1= "<"	' windows shift+',' maps to c64 '<'
   190, 1= ">"	' windows shift+'.' maps to c64 '>'
   191, 1= "/"  ' windows shift+'/' maps to c64 '?'
   
   ' Shift, Strg, Alt, Alt-Gr, Win and Menu
   16, 1= 0
   17, 1= 0
   18, 1= 0
   91, 1= 0
   92, 1= 0
   93, 1= 0
   
   ' cursor keys
   ' left
   37, 1= 257 + 512
   ' up
   38, 1= 258 + 512
   ' right
   39, 1= 259 + 512
   ' down
   40, 1= 260 + 512
   ' ins
   45, 1= 261 + 512
   ' del
   46, 1= 262 + 512
   ' home
   36, 1= 263 + 512
   ' end
   35, 1= 264 + 512
   ' PgUp
   33, 1= 265 + 512
   ' PgDown
   34, 1= 266 + 512
   
   
   ' number block
   'NumLock
   144, 1= 269 + 512
   111, 1= "/"
   106, 1= "*"
   109, 1= "-"
   107, 1= "+"
   'Enter = Return
   '13, 1= 13
   110, 1= ","
   ' numbers
   96, 1= "0"
   97, 1= "1"
   98, 1= "2"
   99, 1= "3"
   100, 1= "4"
   101, 1= "5"
   102, 1= "6"
   103, 1= "7"
   104, 1= "8"
   105, 1= "9"
   
   ' Space
   32, 1= " "
   
   ' **************************************************************
   ' Control 
   ' **************************************************************
   ' ESC
   27, 2= 27 + 1024
   
   ' F-keys
   112, 2= 0
   113, 2= 0
   114, 2= 0
   115, 2= 0
   116, 2= 0
   117, 2= 0
   118, 2= 0
   119, 2= 0
   120, 2= 0
   121, 2= 0
   122, 2= 168	' ctrl+F11 maps to c64 petscii pic (bottom horz fine checkerboard)
   123, 2= 0
   
   ' PrintScreen lock doesn't map
   
   ' ScrollLock
   145, 2= 0
   
   ' Pause
   19, 2= 0
   
   ' first row - numbers
   220, 2= 0
   48, 2= 0
   49, 2= 0
   50, 2= 0
   51, 2= 0
   52, 2= 0
   53, 2= 0
   54, 2= 0
   55, 2= 0
   56, 2= 0
   57, 2= 0
   189, 2= 166  ' windows ctrl+'-' maps to c64 petscii pic (fine checkerboard)
   187, 2= 220  ' windows ctrl+'=' maps to c64 petscii pic (left vert fine checkerboard)
   
   ' Backspace
   8, 2= 8 + 1024
   
   ' TAB
   9, 2= 9 + 1024
   
   ' second row - characters
   81, 2= 171	' windows ctrl+'q' key maps to c64 petscii pic (right T-shape)
   87, 2= 179	' windows ctrl+'w' key maps to c64 petscii pic (left T-shape)
   69, 2= 177	' windows ctrl+'e' key maps to c64 petscii pic (up T-shape)
   82, 2= 178	' windows ctrl+'r' key maps to c64 petscii pic (down T-shape)
   84, 2= 163	' windows ctrl+'t' key maps to c64 petscii pic (top thin horz bar)
   89, 2= 183	' windows ctrl+'y' key maps to c64 petscii pic (top med horz bar)
   85, 2= 184	' windows ctrl+'u' key maps to c64 petscii pic (top thick horz bar)
   73, 2= 162	' windows ctrl+'i' key maps to c64 petscii pic (bottom horz half)
   79, 2= 185	' windows ctrl+'o' key maps to c64 petscii pic (bottom thick horz bar)
   80, 2= 175	' windows ctrl+'p' key maps to c64 petscii pic (bottom med horz bar)
   219, 2= 164	' windows ctrl+'[' key maps to c64 petscii pic (bottom thin horz bar)
   221, 2= 223	' windows ctrl+']' key maps to c64 petscii pic (top right triangle)
   220, 2= "="	' windows ctrl+'\' maps to c64 '='

   
   ' Return
   13, 2= 13 + 1024
   
   ' CAPS LOCK
   20, 2= 256 + 1024
   
   ' third row - characters
   65, 2= 176	' windows ctrl+'a' key maps to c64 petscii pic (bottom right square edge)
   83, 2= 174	' windows ctrl+'s' key maps to c64 petscii pic (bottom left square edge)
   68, 2= 172	' windows ctrl+'d' key maps to c64 petscii pic (bottom right square)
   70, 2= 187	' windows ctrl+'f' key maps to c64 petscii pic (bottom left square)
   71, 2= 165	' windows ctrl+'g' key maps to c64 petscii pic (left thin vert bar) (but still looks mid?)
   72, 2= 180	' windows ctrl+'h' key maps to c64 petscii pic (left mid vert bar)
   74, 2= 181	' windows ctrl+'j' key maps to c64 petscii pic (left thick vert bar)
   75, 2= 161	' windows ctrl+'k' key maps to c64 petscii pic (left vert half)
   76, 2= 182	' windows ctrl+'l' key maps to c64 petscii pic (right thick vert bar)
   186, 2= "["	' windows ctrl+';' key maps to c64 '['
   222, 2= "]"  ' windows ctrl+' key (dbl-quotes) maps to c64 ']'

   
   ' fourth row - characters
   90, 2= 173	' windows ctrl+'z' key maps to c64 petscii pic (top-right square edge)
   88, 2= 189	' windows ctrl+'x' key maps to c64 petscii pic (top-left square edge)
   67, 2= 188	' windows ctrl+'c' key maps to c64 petscii pic (top right square)
   86, 2= 190	' windows ctrl+'v' key maps to c64 petscii pic (top left square)
   66, 2= 191	' windows ctrl+'b' key maps to c64 petscii pic (coarse checkerboard)
   78, 2= 170	' windows ctrl+'n' key maps to c64 petscii pic (right mid vert bar)
   77, 2= 167	' windows ctrl+'m' key maps to c64 petscii pic (right thin vert bar) (but still looks mid?)
   188, 2= "<"	' windows ctrl+',' maps to c64 '<'
   190, 2= ">"	' windows ctrl+'.' maps to c64 '>'
   191, 2= "/"  ' windows ctrl+'/' maps to c64 '?'
   
   ' Shift, Strg, Alt, Alt-Gr, Win and Menu
   16, 2= 0
   17, 2= 0
   18, 2= 0
   91, 2= 0
   92, 2= 0
   93, 2= 0
   
   ' cursor keys
   ' left
   37, 2= 257 + 1024
   ' up
   38, 2= 258 + 1024
   ' right
   39, 2= 259 + 1024
   ' down
   40, 2= 260 + 1024
   ' ins
   45, 2= 261 + 1024
   ' del
   46, 2= 262 + 1024
   ' home
   36, 2= 263 + 1024
   ' end
   35, 2= 264 + 1024
   ' PgUp
   33, 2= 265 + 1024
   ' PgDown
   34, 2= 266 + 1024
   
   
   ' number block
   'NumLock
   144, 2= 269 + 1024
   111, 2= "/"
   106, 2= "*"
   109, 2= "-"
   107, 2= "+"
   'Enter = Return
   '13, 2= 13
   110, 2= ","
   ' numbers
   96, 2= "0"
   97, 2= "1"
   98, 2= "2"
   99, 2= "3"
   100, 2= "4"
   101, 2= "5"
   102, 2= "6"
   103, 2= "7"
   104, 2= "8"
   105, 2= "9"
   
   ' Space
   32, 2= " "
   
   ' **************************************************************
   ' Alt
   ' **************************************************************
   ' first row - number keys
   48, 4= 146
   49, 4= 144
   50, 4= 5
   51, 4= 28
   52, 4= 159
   53, 4= 156
   54, 4= 30
   55, 4= 31
   56, 4= 158
   57, 4= 18
   
   ' cursor keys
   ' left
   37, 4= 157
   ' up
   38, 4= 145
   ' right
   39, 4= 29
   ' down
   40, 4= 17
   ' Home
   36, 4= 19
   
   
   ' **************************************************************
   ' Shift+Alt
   ' **************************************************************
   ' Home
   36, 5= 147
