1
0
mirror of https://github.com/mcgurk/Arduino-USB-HID-RetroJoystickAdapter synced 2024-12-04 14:52:23 -05:00
Arduino-USB-HID-RetroJoysti.../C64_keyboard/README.md

140 lines
5.0 KiB
Markdown
Raw Normal View History

2019-02-13 02:40:01 -05:00
# Poor man's "Keyrah" to connect C64 keyboard to USB (for BMC64 emulator)
2019-02-12 14:16:24 -05:00
2019-02-13 02:32:12 -05:00
![Controller](https://github.com/mcgurk/Arduino-USB-HID-RetroJoystickAdapter/raw/master/C64_keyboard/Soarer_controller_for_C64.jpg)
2019-02-12 14:15:45 -05:00
## Building
- Solder all keyboard connector pins to Arduino Pro Micro.
2019-02-18 03:31:41 -05:00
- 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](https://github.com/mcgurk/Arduino-USB-HID-RetroJoystickAdapter/blob/master/C64_keyboard/README.md#pins-i-used).
2019-02-12 14:17:44 -05:00
- You can also connect LED of C64 to VCC/GND of Arduino. I used 220ohm resistor.
2019-02-12 14:15:45 -05:00
## Firmware/flashing
2019-03-11 04:19:13 -04:00
- Download Soarer controller firmware (Soarer_Controller_v1.20_beta4.zip): https://geekhack.org/index.php?topic=50437.0 (or https://deskthority.net/workshop-f7/soarer-s-keyboard-controller-firmware-t6767.html)
- Extract /firmware/Soarer_Controller_v1.20_beta4_atmega32u4.hex from Soarer_Controller_v1.20_beta4.zip
2019-02-12 14:15:45 -05:00
- Install Arduino IDE
- Connect RST to GND couple of times to get Arduino Pro Micro to programming mode (notice that com-port is different in programming mode in Windows)
- Flash firmware
```
2023-02-11 14:49:52 -05:00
# 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
2019-02-12 14:15:45 -05:00
```
## Setup
2019-02-18 03:30:26 -05:00
- Download [config file](https://github.com/mcgurk/Arduino-USB-HID-RetroJoystickAdapter/raw/master/C64_keyboard/C64_matrix.sc). Check pin order to match your setup.
2019-02-12 14:18:25 -05:00
- Compile and upload config file to Arduino Pro Micro
2019-02-12 14:15:45 -05:00
```
.\scas C64_matrix.sc C64_matrix.bin
.\scwr C64_matrix.bin
```
2019-03-04 07:20:25 -05:00
2019-02-12 14:24:26 -05:00
## Testing
- https://keycode.info/
2019-02-09 05:23:03 -05:00
2019-02-12 14:15:45 -05:00
## Pins I used
2019-02-09 05:23:03 -05:00
```
2019-02-18 03:27:25 -05:00
// 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)
2019-02-18 03:49:31 -05:00
// 8(4) A0(A0/PF7)
// 7(5) A1(A1/PF6)
// 6(6) A2(A2/PF5)
// 5(7) A3(A3/PF4)
2019-02-09 05:23:03 -05:00
// 4 N/C
2019-02-18 03:27:25 -05:00
// 3(8) TX(D1/PD3)
2019-02-09 05:23:03 -05:00
// 2 N/C
2019-02-18 03:27:25 -05:00
// 1(I) 8(D8/PB4)
2019-02-12 14:32:21 -05:00
```
2023-02-11 16:18:30 -05:00
## Links
- https://geekhack.org/index.php?topic=50437.0
- https://deskthority.net/workshop-f7/soarer-s-keyboard-controller-firmware-t6767.html
- Newest I found was Soarer_Controller_v1.20_beta4.zip from 26.10.2013
- Soarer config file documentation: https://deskthority.net/download/file.php?id=8833 (Soarer_Converter_v1.12_docs.zip)
- Keynames used in config file from https://deskthority.net/download/file.php?id=8833 (Soarer_Converter_v1.12_docs.zip): /docs/codes.html
- https://www.waitingforfriday.com/wp-content/uploads/2017/01/C64_Keyboard_Schematics_PNG.png
- http://kookye.com/wp-content/uploads/2016/02/Pinout-ProMicro.jpg
- I used this as starting point: https://github.com/abzman/Keyboard-config-file/blob/master/C64_matrix.sc
- C64-emulator for Raspberry Pi 2/3: http://accentual.com/bmc64/
- For bigger matrices use Arduino Micro (24 usable IO pins) https://www.40percent.club/2017/10/green-arduino-micro.html (The largest matrix you can do with a Pro Micro with its 18 pins is 9x9, 81 keys.)
2023-02-13 06:39:36 -05:00
- Example macros: https://sharktastica.co.uk/guides/soarers_2
2019-02-09 05:23:03 -05:00
2023-02-11 16:15:35 -05:00
## Macro without modifier key
2023-02-11 16:29:15 -05:00
Even though modifier key is mandatory, it can be replaced with unpressed modifiers. This writes shifted A when only a-key is pressed:
2023-02-11 16:16:07 -05:00
```
2023-02-11 16:15:35 -05:00
macroblock
2023-02-11 16:29:15 -05:00
macro A -ALL
2023-02-11 16:15:35 -05:00
SET_META LSHIFT
PRESS A
CLEAR_ALL
endmacro
endblock
2023-02-11 16:16:07 -05:00
```
2023-02-11 16:15:35 -05:00
2024-02-06 15:14:00 -05:00
## TheC64 Maxi Orange Pi PC
Buttons that needs modification:
```
+ 12
- 13
@ 26
* 27
^ 111
: 39
; 40
= 43
£ 110
C= 29
CTRL 15
RESTORE 104
INS/DEL 14
```
2024-02-06 15:14:29 -05:00
Copy theC64-sym-CLASSIC.vkm to /usr/lib/vice/C64/theC64-sym-CLASSIC.vkm in ext4 partition of firmware-image. (THEC64_for_OPI.img or THE_VIC_20_for_OPI.img)
2024-02-06 15:14:00 -05:00
## OBSOLETE: Issues (all issues are fixed in newer BMC64 versions)
2019-08-07 03:14:36 -04:00
2023-02-11 16:17:14 -05:00
### Issue with Menu key (fixed in newer BMC64 versions)
2019-08-07 03:14:36 -04:00
- .crt-files doesn't work with C= + F7, so as workaround LSHIFT + F7 is F12.
2023-02-11 16:17:14 -05:00
### Issue with shift (fixed in newer BMC64 versions)
2019-02-13 02:25:59 -05:00
- "+", "-", "£", "@" and "*" doesn't produce GFX-chars when shifted
2019-02-12 14:15:45 -05:00
2019-03-20 05:32:42 -04:00
#### "Repair" rpi_sym.vkm (1.0.9)?
2019-03-20 05:31:13 -04:00
- 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
```
2023-02-13 05:56:54 -05:00
## Stuff
2023-02-13 05:57:15 -05:00
Ultimate keybindings?
2023-02-13 05:56:54 -05:00
```
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
2023-02-13 05:58:58 -05:00
LSHIFT+LCTRL+LWIN+LALT = Reset
2023-02-13 06:14:34 -05:00
Buttons: Freeze-Menu-Reset
2023-02-13 05:56:54 -05:00
```