Tag Archives: VICE

Everything about the Open Source VICE Emulator for Commodore 8bit machines.

How to map your Commodore Keyboard in VICE 2.4

Commodore-Logo-PaddedVICE 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:

Screen Shot 2014-09-01 at 15.25.56

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:

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:

Screen Shot 2014-09-01 at 15.34.50

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:

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.

How to load a .PRG file in VICE

Commodore LogoUsually you’d attach a disk image to the VICE emulator and load one of several files from your virtual disk. Occasionally though you’ll come across single files ending in .PRG – those are the files that are contained on a disk image.

Remember those weird three letter abbreviations on the right hand side when you list your floppy directory?

DIrectory

Those are the extensions of single files (there’s PRG, SEQ, USR and REL), and the actual file name appears on the left.

VICE can attach disk images, but it can also display lose files we may have stored in a directory. All we need to do is tell VICE where that directory is and it will make it accessible to the virtual machine.

To do this, start your favourite emulator and head over to Settings – Peripheral Settings. Next pick the drive you’d like to attach the directory to (say Drive 8) and tick the box that reads “Use IEC Device”. Now pick the desired directory and you’re all set!

This will turn the entire directory into a disk image on the fly. Now you can list whatever is in said directory either with DIRECTORY or LOAD”$”,8 followed by LIST. Load and run your .PRG as you usually would.

Capture

This works fine on the C64 and C128 emulators. The Plus/4 seems to have a problem with this approach as of VICE version 2.4.