The Commodore-64 Keyboard
A keyboard is not more or less than a X-Y matrix of switches distributed in rows and columns. You just have to detect when a switch is pressed and know what to do in every case. This is the Commodore-64 Matrix keyboard.
It’s a 9×9 matrix, making 18 connectors. That means there are 81 different keys, however you can see there is no 81 keys, the RESTORE has it’s own row and column, wasting 16 potential «keys». We will see next, that’s actually a good thing for us.
Warning: The C-64 and C-16 keyboards are physically the same, but NOT electrically. That’s why there are a Keymmodore-16 project!!
In a similar way than the keyboards, the joysticks are actually a 5×1. One common contact for the four different stick position and fire.
Every stick position and button fire can be mapped to a key of the Numeric Keypad of a standard PC Keyboard. Emulators have a «Joy-to-Key» feature so you just have to assign those NumPad keys to the virtual Joysticks.
Warning: Num_Lock must be ON in order to work properly. See User Manual.
NumPad . (dot)
Option a: The keyboard and joysticks extended matrix
Adding the keyboard matrix to the joysticks matrix, we have this extended matrix. This is the actual matrix we use in a Teensy+2.0 board, but not in other smaller boards as we can see below…
option b: The keyboard and joysticks combined matrix. (a.k.a. The number of inputs issue)
Unfortunately, only the Teensy++ 2.0 sporting the 90USB1286 chip has enough pins to connect the extended matrix of keyboard and joysticks, and also the RGB LED. The most common Atmel32u4 chip has less pins so we have to find a solution for this board.
To achieve this, we can «hack» the C-64 Keyboard, adding the Joysticks to Row I and Column 8, considering only RESTORE key uses these row and column. This way you can «merge» the Joysticks matrices to the keyboard matrix
Keep in mind this is optional therefore you don’t need to build this combined matrix if you don’t want to use original Atari or Commodore type of Joysticks.
Important Note: BMC64 Emulator allows direct connection of Joystick to Raspberry Pi’s GPIO, so if you plan to use ONLY that emulator for joystick, you can wire them to the Pi.