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. These are the Commodore-16 and Plus/4 Matrices keyboard.
They are a 8×8 matrix, making 16 connectors. That means there are 64 different keys. Shift Lock which is only a mechanical lock for the Shift key. The only differences between them, are the pin numbers at the connector, besides having Plus/4 also the LED in it.
The Commodore-16 Keyboard
THE COMMODORE PLUS/4 KEYBOARD
Warning: The C-64 and C-16 keyboards are physically the same, but NOT electrically. That’s why they are different «Keymmodore» projects fo each one of them!!
Note: The Keymmodore-264 project uses DB-9 Atari standard joysticks, not the DIN connector type found in C-264 computers.
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. Emulatos 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
Combining the keyboard matrix with the joysticks matrices, 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. (only C-16 matrix is shown)
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 boards.
To achieve this, we can «hack» the C-16 and Plus/4 Keyboards, repurposing columns and rows, adding Joysticks 1 to a new Row X and Joystick 2 to a Column Y, so we only need two more pins (only C-16 matrix is shown)
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.
How to connect the joysticks using an ATmel32u4 chip boards (optional)
According the diagram above, to connect the Joysticks in those boards, you need to build twelve parallel (so called «Y» or «T«) connections over the Keyboard connector. Pins are different for C-16 and Plus/4. Look at the diagrams below.
Pins 1, 2, 6, 10, 12, 13, 14, 15,17 and 18 need to be connected in parallel to the joysticks DB-9 connectors. Also X and Y have to be connected to the board.
Pins 1, 3, 7, 11, 13, 14, 15, 16, 18 and 19 need to be connected in parallel to the joysticks DB-9 connectors. Also X and Y have to be connected to the board.