Keyboard Mapping of C64/VIC-20 on Raspbian

Keyboard mapping of the C64 Maxi keyboard.

After I integrated a Raspberry Pi 4 into a C64 Maxi, I wanted to start actually using it. Once I got my fingers onto the keyboard I realised that what is printed on the keys is not what would appear on the screen. Here is what is printed on the keys:

The layout of the C64 keyboard does not follow the ANSI standard. It even has some keys that related back to programming in BASIC, such as RESTORE and RUN STOP. Here is what a typical 60% keyboard would look like:

The difference between the two is market here:

Some keys produce the expected result while other have a very different function. Here is what the actual input is when you press the keys in Raspbian using the ANSI 104 (US) keyboard layout in the settings:

It would be great if there was an easy way to re-map the keys but this would require a little bit of work on the command line and in several configuration files. Still, it would be great to have an actual Cursor UP and Cursor LEFT key. I will look into this.