1
0
mirror of https://github.com/mcgurk/Arduino-USB-HID-RetroJoystickAdapter synced 2024-11-27 11:32:19 -05:00
Arduino-USB-HID-RetroJoysti.../C64_keyboard/README.md
2023-02-13 13:39:36 +02:00

4.7 KiB

Poor man's "Keyrah" to connect C64 keyboard to USB (for BMC64 emulator)

Controller

Building

  • Solder all keyboard connector pins to Arduino Pro Micro.
  • You can solder Restore key (connector pin "I") paraller to some other pin. I soldered "I" and "G" to Arduino pin A8. (this is actually not needed, because there is one free pin left). Pins I used.
  • You can also connect LED of C64 to VCC/GND of Arduino. I used 220ohm resistor.

Firmware/flashing

# old: & "C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude" -C"C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -v -p m32u4 -c avr109 -P COM5 -b 57600 -U flash:w:firmware\Soarer_Controller_v1.20_beta4_atmega32u4.hex:i
# 11.2.2023:
& "$ENV:LOCALAPPDATA\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17\bin\avrdude.exe" -C"$ENV:LOCALAPPDATA\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17\etc\avrdude.conf" -v -p m32u4 -c avr109 -P COM9 -b 57600 -U flash:w:firmware\Soarer_Controller_v1.20_beta4_atmega32u4.hex:i

Setup

  • Download config file. Check pin order to match your setup.
  • Compile and upload config file to Arduino Pro Micro
.\scas C64_matrix.sc C64_matrix.bin
.\scwr C64_matrix.bin

Testing

Pins I used

//   Pin    Label
//   20(A)  2(D2/PD1)
//   19(B)  3(D3/PD0)
//   18(C)  4(D4/PD4)
//   17(D)  5(D5/PC6)
//   16(E)  6(D6/PD7)
//   15(F)  7(D7/PE6)
//   14(G)  8(D8/PB4)
//   13(H)  9(D9/PB5)
//   12(0)  10(D10/PB6)
//   11(1)  16(D16/PB2)
//   10(2)  14(D14/PB3)
//   9(3)   15(D15/PB1)
//   8(4)   A0(A0/PF7)
//   7(5)   A1(A1/PF6)
//   6(6)   A2(A2/PF5)
//   5(7)   A3(A3/PF4)
//   4        N/C
//   3(8)   TX(D1/PD3)
//   2        N/C
//   1(I)   8(D8/PB4)

Macro without modifier key

Even though modifier key is mandatory, it can be replaced with unpressed modifiers. This writes shifted A when only a-key is pressed:

macroblock
  macro A -ALL
    SET_META LSHIFT
	PRESS A
	CLEAR_ALL
  endmacro
endblock

Issues (all issues are fixed in newer BMC64 versions)

Issue with Menu key (fixed in newer BMC64 versions)

  • .crt-files doesn't work with C= + F7, so as workaround LSHIFT + F7 is F12.

Issue with shift (fixed in newer BMC64 versions)

  • "+", "-", "£", "@" and "*" doesn't produce GFX-chars when shifted

"Repair" rpi_sym.vkm (1.0.9)?

  • at 5 6 0 -> 5 6 8
  • minus 5 3 0 -> 5 3 8
  • plus 5 0 0 -> 5 0 8
  • sterling 6 0 0 -> 6 0 8
  • asterisk 6 1 0 -> 6 1 8
sed -i 's/5 6 0/5 6 8/g; s/5 3 0/5 3 8/g; s/5 0 0/5 0 8/g; s/6 0 0/6 0 8/g; s/6 1 0/6 1 8/g' rpi_sym.vkm

Stuff

Ultimate keybindings?

F9 = shift+return
F10 = Ultimate menu
F11 = Freeze
F12 = Restore
LCTRL = Control
LWIN = CBM
INS = Inst
HOME = Clr/home
PAUSE = run/stop
SCROLL_LOCK = Ultimate menu
BACKSPACE = Inst/del
LSHIFT+LCTRL+LWIN+LALT = Reset

Buttons: Freeze-Menu-Reset