Wednesday, 3 July 2013

Compiling the VICE Commodore emulator on Linux Mint 15

I've just upgraded my primary Linux box to Linux Mint 15. OK, I'm going to go off on a tangent for a moment. If you'd rather not read it, skip to the next paragraph. I really do like Mint. But the installation of version 15 was not nearly as smooth as it should have been. Getting X to run reliably at the proper resolution on my ASUS/Athlon motherboard with nVidia graphics card was far more difficult than it should have been. That along with several packages not actually working was rather frustrating. I have it all working quite well now, but that's what led me to compiling VICE from source.

I could not get the VICE Commodore emulator supplied by the Mint repository to work. I found several posts from other people having the same difficulties I was experiencing. So, since it wouldn't work and it was an old version, I decided the better option would be to download the source code and compile it myself.

The vanilla Mint 15 installation does not include a compiler or any of the other tools usually required to compile code. We also require several packages of header files as well. So, these must be installed before we can compile VICE. Install the following packages whichever way you prefer (I used the software manager):

  • build-essential
  • libxaw7-dev
  • libreadline-dev
  • libasound2-dev

VICE will compile without the libasound2-dev package (the header files for ALSA) but you won't have any sound.

With these packages installed simply follow the directions supplied with VICE to compile.

I should note here that you will not be able to run the VICE emulator without the appropriate ROM images for the computer you wish to emulate. This too is detailed in the documentation included with the source.

In my case I had an existing configuration file in ~/.vice/vicerc that had to be tweaked. Some of the old settings were incompatible with the new version. In theory a fresh install shouldn't encounter this.

In the end I had this:

So I could relive my childhood games like this:

Fixing the dead backslash and bar key on AIX 5.3

So the other day I was upgrading AIX on my IBM RS/6000 model 7046-B50 (actually, two of them) to 5300-12-05 and discovered that the system was rather rudely ignoring my attempts to type either a backslash or a bar. For a Unix system, this is quite a problem.

My system configuration is the aforementioned B50 connected through a StarTech SV831HD KVM switch to an IBM model M keyboard (built August 31, 1992 - nearly 21 years old and going strong, fantastic keyboard), a Microsoft optical mouse and an ASUS LCD monitor.

After poking around the internet for a solution I realised, unsurprisingly, that I'm not the only one to have experienced this phenomenon. What I realised subsequently was that there was very little in the way of a solution available. What I did determine was that the culprit was the wonky keymap file supplied by IBM. That was referenced a couple times. But how was I to fix it?

Step 1: What's the correct bloody keycode?

A short search led me to a tool called xev that reports on X events such as mouse movements and key presses. This will tell you what the keycode for the inactive backslash/bar key is. But first, you have to install the package that contains xev. It is not installed by default.

The package in question is X11.samples.apps.demos. I used Smit to install this from the AIX 5.3 media.

Now that xev is installed you merely need to execute it. The path is:

/usr/lpp/X11/Xamples/bin/xev

A small window pops up and you'll notice that if you move the mouse around or type keys a stream of text flows onto the shell. We're only interested in the keypress event when we type the backslash/bar key. This is the output I was interested in:

KeyPress event, serial 18, synthetic NO, window 0x3800001,
    root 0x29, subw 0x0, time 2798287790, (19,-20), root:(148,109),
    state 0x0, keycode 22 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 characters:  ""

KeyRelease event, serial 18, synthetic NO, window 0x3800001,
    root 0x29, subw 0x0, time 2798287878, (19,-20), root:(148,109),
    state 0x0, keycode 22 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 characters:  ""

And the most important part is highlighted. That's the keycode that is supposed to be mapped to the backslash/bar key.

Step 2: OK, now how do we make the key work?

Now all we need to do is correct the mapping. To do this we use xmodmap. The syntax is straightforward:

xmodmap -e 'keycode 22 = backslash bar'

Let's decipher this:

xmodmap
This is the command to execute, naturally.
-e
This indicates that what follows is an expression to be run.
keycode 22
We're going to state what keycode 22 should produce when typed.
backslash
The unshifted character to be typed is backslash.
bar
The shifted character to be typed is bar.

Note that the entire expression needs to be in quotes.

After executing the xmodmap command I had a fully functional backslash/bar key!

A couple notes about this:

  • This is a temporary fix. The next time you start X the keymapping will revert to the default. A permanent fix requires changing the keymap definition file. I haven't bothered to go that far yet.
  • This only works within the X session. If you log in from the console this will have no effect.

Because this change is transient I created a script to run. It's pretty basic:

#!/bin/sh

echo "Correct keymapping for backslash and bar."
echo "     xmodmap -e 'keycode 22 = backslash bar'"
xmodmap -e 'keycode 22 = backslash bar'

Has it been that long?

Wow! It's been nearly 5 years since I posted anything to this thing. Hokey smokes! Well, sometimes life gets in the way, particularly when it changes dramatically. However, I'm not about to get into that now. Suffice it to say, I haven't been experimenting with my collection of computers in quite some time. But I've just gotten the motivation back... and I have a couple posts.

I need to document some of this stuff. Some of it wasn't trivial to sort out. That's the reason I created this in the first place.