-
Notifications
You must be signed in to change notification settings - Fork 14
TheC64 + tang_nano_20k_c64: How to send the menu open command? #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @vanfanel , |
Many thanks for the response! Not in a hurry at all, don't worry :) |
@vanfanel , you could also use one of the spare FPGA pins that i don't use for the DS2 interface for a Key F12 button. But the issue of forwarding the pin press into the firmware will remain. There is some work to do... |
Does that keyboard have a different key you could re-purpose? Maybe some rarely used one? Or a long press on restore or the like? That could be done inside the FPGA Companion firmware and would not need any special support on FPGA side. |
The keyboard doesn't have any special keys I know of, other than being a plain C64 keyboard.
I think the key should be remapped to the "pound" symbol before being used for menu toggling however? |
Hi @vanfanel , |
Ah ... yes, of course. And one could actually make a little firmware for a pico (or pico zero) that implements a hid keyboard with just F12, the cursor keys and the return key as a 'mistery menu controller'. This would be super cheap but also flexible. |
Thanks for thinking this alongside me, guys! |
@vanfanel , |
So it's impossible to define |
@vanfanel , Maybe you compile for your own purposes a modified Version and try it. |
Ah, yes, that's promising. I see this line: However, after building the latest FPGA-companion core from latest GIT code, it doesn't work with the latest stable tang_nano_20k_c64 release (1.9.1) to complete this experiment. Can you please point me to the exact commit in https://github.com/harbaum/FPGA-Companion/commits/main/ that corresponds to the FPGA-Companion release 1.2? NVM: It should be the last one in March 3 here: harbaum/FPGA-Companion@36982cc |
@vossstef Well, latest commit from March 3 doesn't build:
Can you please point me to a GIT code commit that builds and works with latest stable tang_nano_20k_c64 release (1.9.1)? |
@vanfanel , i am doing very big changes to both SDK and FPGA-companion bl616 section at the moment to add WIFI functions and i tested now almost daily againt an unpublised SDK locally stored. Hopefully the build instruction over here: https://github.com/harbaum/FPGA-Companion/tree/main/src/bl616 are good enough to understand what to do. My latest code uses usbh_hid_get_report_descriptor(usb->hid_info[i].class, report_desc[i], 128); and that means native Cherry 1.4.3 is needed. Your SDK need to be latest version out of the harbaum repo location as it includes additions i did for latest native USB stack. Following SDK's will not work anymore ! https://github.com/CherryUSB/bouffalo_sdk only this one: |
@vossstef I am using: Latest GIT code in https://github.com/harbaum/FPGA-Companion.git DOES build correctly, but does not work with the latest core in https://github.com/vossstef/tang_nano_20k_c64/releases What I need is a version of the source in https://github.com/harbaum/FPGA-Companion.git that works with the latest release in https://github.com/vossstef/tang_nano_20k_c64/releases |
@vanfanel, |
@vossstef When you have time (I know you are busy with all those improvements!) I could use a version of the core that goes with the current Companion firmware, so please upload the core build you use and I will use that for now. |
I am considering to add a setting to the ini file stored on SD card which will allow to change the menu hotkey on a per core basis. Something similar was needed for the original mist when the acorn Archimedes core came which actually has a real F12 key and needs that itself. I am currently porting misterynano to the efinix Trion T20 fpga and do the menu key config and a few other small things after that. |
That would be an ideal solution, of course! :) |
@vossstef I use Linux only (I wouldn't touch a Windows machine if my life depended on it). |
@vanfanel, |
@vossstef, |
@vanfanel , |
@vossstef Ok! Can you please upload the core build that you have working with current Companion GIT sources? |
@vanfanel https://github.com/harbaum/FPGA-Companion/releases/tag/v1.2.1 and the C64 core Did only a very brief check and USB hub, xbox360 controller, the RII key combo and WIFI working fine. |
Thanks, that version of the core does work with the current companion code! I changed 0x45 in https://github.com/harbaum/FPGA-Companion/blob/dc5af8d6a0e69a1a1df5227406d4f1e999a6da47/src/hid.c#L131 for 0x53 which corresponds to the scancode of the "TheC64" labeled key on the keyboard, and also tried 0x0c which is the scancode for the "pound" key, then rebuilt the companion and re-flashed it. |
@harbaum can you pls. advise about the Scancodes and how to replace the F12 by 'Pound' code |
These USB HID codes like these: https://gist.github.com/MightyPork/6da26e382a7ad91b5496ee55fdc73db2 But I cannot tell you what those special keys deliver. Which key e.g. detects your PC if you press the C64 pound key? |
When connected to a GNU/Linux desktop PC, the pound key produces the single quote character (this one --> ' ) and according to In the file you pointed (thanks for that!) I guess it should be: So I used 0x34 in the comparason here: On the other hand, when connected to the TangNano+Companion, the pound key produces "-" (minus) on the C64 screen. However, an small issue remains: some keys in the TheC64 keyboard don't correspond to the symbols they produce on screen. Most keys are right, but there are like 5 that are wrong. |
Ah, I should do the adjustments around here, it seems: |
It seems that the keymaps in https://github.com/harbaum/FPGA-Companion/blob/dc5af8d6a0e69a1a1df5227406d4f1e999a6da47/src/core_c64.c#L162 are ununsed. Apparently they were used for "legacy cores" but not anymore. |
@vanfanel, https://github.com/vossstef/tang_nano_20k_c64/blob/main/src/misc/c64_keymap.v I tried to replicate the Keyboard mapping on my German Keyboard (RII Mini Keyboard i8) like (MISTer): |
@vossstef Thanks for pointing me to the right place, it seems the keyboard mapping has been traveling back and forth from core to companion and back to core! ✈ Now, looking at tang_nano_20k_c64/src/misc/c64_keymap.v Line 119 in c2c5245
...since I am getting ":" in "", I should change: (code == 7'h55)?{ 3'd7,3'd1}: // 55: KP * ...to this instead: (code == 7'h55)?{ 3'd5,3'd5}: // 55: KP * ...But that doesn't work because physical "" becomes backspace... What a puzzle! Where's the ":" key there in the keymap code? Is it ";" or is it "." like in european keyboards? |
@vanfanel sorry but you need to try. Keyboard mapping for C64 / VIC20 was if i recall right horrible and took endless time. Apart from the fact that in VHDL-2008 the Verilog structure was not possible and i had to circumvent the interfaces. |
Ok, thanks! I am slowly building a keymap for the TheC64 keyboard. When its ready I will post It here :) |
@vossstef I'm almost there with the correct mapping! I am only missing the RESTORE key code to send. tang_nano_20k_c64/src/misc/c64_keymap.v Line 96 in c2c5245
I see it's sending 3'd7,3'd1 which is the code for LSHIFT.
What's the code I should send for RESTORE? |
Restore is used for triggering nmi interrupt in c64 |
Yes, I know. But where is it mapped? In the core? Or in the Companion? |
@vanfanel, |
Can you point me to the code of that hard mapping, please? |
@vanfanel , |
This exact line is where F11 is assigned to RESTORE: |
@vossstef Now, RESTORE (0x2b) seems to activate both RESTORE and LSHIFT, as in: restore.mp4So, to prevent that, I changed this: ...and now, RESTORE is working as intended! Yeah! restore2.mp4 |
@vanfanel, have not much time for core at the moment but think as keymapping is inside the core it should be easier possible to extract Numpad and those extra handlings like restore. Need to dig into that... |
@vossstef Another small question if you don't mind. So, is there a way for me to detect that SHIFT is pressed? I see you compare the value in |
@vanfanel , same idea i had also more than a year ago but didn' found time to think about. |
@vossstef Ok, no hurries, thanks for the answer! What about SHIFT LOCK? Using a normal USB keyboard, the CAPS LOCK key doesn't work as it does on a real C64: it acts as LSHIFT. |
I just commited a change to the FPGA Companion that will allow you to specify the key in the ini file:
|
Thanks!! To make it work correctly, I had to change this: |
@vanfanel i need to adjust the c64 / vic20 core a bit |
@vanfanel let me first update the core to cover the shift cursor and shift Fx Key topc and will look then into the RESTORE too. |
@vanfanel CAPS Lock need also a fix and still need to do a refactoring in the Numpad area. |
Thanks a lot!! I am using latest pre-release now on the TheC64 :) For power on/off, the TheC64 uses this small button: ...Which connects to the main board with this simple 2 wire cable: Do you happen to know if there are there any pins on the TangNano20K or the Companion board that I can use to power on/off using this button? |
Hi there!
I don't know it someone had tried before, but I connected the TheC64 keyboard to the TangNano20k+misteryshield20k, and it woks perfectly well.
(TheC64 is a full size C64 replica running an small GNU/Linux system with the VICE emulator on top: https://www.c64-wiki.com/wiki/THEC64)
...So my dream of gutting a TangNano20k+misteryshield20k inside TheC64 is near.
However, since the C64 has no F12 key, there's no way to enter the core menu.
Is there a couple of pins somewhere on the TangNano20k or on the misteryshield20k that I can use to attack a switch to them so I can enter the core menu with that?
Thanks!
The text was updated successfully, but these errors were encountered: