VICE on the Mac isn’t without it’s vices (har har) – and one of them is the way the keyboard is mapped.
There are two approaches to choose from: positional and symbolic. Positional means that the Commodore keyboard is mapped into the physical positions of your “contemporary” keyboard. So no matter what language keyboard you are typing on, the key next to the L will be a colon, the key next to that will be a semicolon, and so forth.
Symbolic attempts to map your current keyboard’s characters to the ones you expect to appear on screen. Both approaches are of course approximations and you may need to tweak either layout to get the desired results.
You can switch which between the positional and symbolic approach under Settings – Keyboard:
Creating your own layout
You can also create your own keyboard layout by dumping the current keyset into a file (.vkm) and then selecting this file in either symbolic or positional. When you do, and every time you make a change to this file you need to reset VICE for the changes to take effect.
If you examine the file you’ll see a list of seemingly random numbers that don’t make sense at first. The top part of the file is made of comments (starting with #) and attempt to explain what’s happening here. I must admit it didn’t help me much.
The second part of the file shows you a bunch of numbers like these:
... 0 1 2 8 # R 1 1 5 8 # P 2 2 2 8 # D 3 2 5 8 # F 4 3 5 8 # H 5 3 2 8 # G 6 1 4 8 # Z 7 2 7 8 # X 8 2 4 8 # C 9 3 7 8 # V ...
I’ve added the comments, so you may only have four numbers per row. Here’s what they mean:
- the first number is the actual key on the Commodore keyboard
- the second number is the COLUMN of the Commodore Keyboard Matrix
- the third number is the ROW on the Commodore Keyboard Matrix
- the fourth number is still a total mystery to me
This mysterious Commodore Keyboard Matrix I was referring to can be found at Joe Forster’s page: http://sta.c64.org/cbm64kbdlay.html (thanks, Joe!)
In case the above link ever goes down, here’s a screenshot I’ve taken as a reference:
Both columns and rows start at zero, so if you’f like to change what is printed when you hit key number 5, change the two following numbers to the key you’d like to see.
For example, on my VICE Plus/4 emulator the backspace/delete key wasn’t working. Turns out it wasn’t mapped in either file. Looking at both the C64 and C128 keyboard mapping files I found that the key in question is number 51. I’d like the INST/DELETE key to be printed when I press my backspace/delete key, so I’ve added the following line to my custom file:
51 0 0 8 # Insert/Delete
After saving, selecting and resetting the virtual machine, I was able to use the delete key as I hoped. Result!
Note that the Mac mappings aren’t as good as the Windows ones. For example, the C128 Mac mapping always defaults to the positional layout, even when you select symbolic. It’s a bug and I’m sure it’ll be fixed at some point. International keyboards are another issue (I’m using a UK keyboard which makes things even more awkward).
But with the aforementioned tweaks it’s easy to personalise every VICE emulator just the way you like it.