randyrossi / bmc64

A bare metal Commodore 64 emulator for the Raspberry Pi with true 50hz/60hz smooth scrolling, low input latency and better audio/video sync.
GNU General Public License v3.0
488 stars 59 forks source link

Files .crt error #15

Closed usadav72 closed 5 years ago

usadav72 commented 5 years ago

first of all sincere congratulations for the excellent work done. I would like to suggest the failure of various .crt files, for example the game "the simpson arcade" but there are many others ... which, once mounted, return a reset and return to the basic ... these .crt files work easily on other emulators such as viceX64, combian, vicepc and C64 mini .... thanks for your attention and many more thanks from us lovers of commodore 64

randyrossi commented 5 years ago

I am able to attach the simpsons arcade cartridge without issue. Maybe try renaming the cartridge file to 8.3 format (8 characters name and 3 character extension) to see if that's the issue?

On Wed, Mar 20, 2019 at 4:06 PM usadav72 notifications@github.com wrote:

first of all sincere congratulations for the excellent work done. I would like to suggest the failure of various .crt files, for example the game "the simpson arcade" but there are many others ... which, once mounted, return a reset and return to the basic ... these .crt files work easily on other emulators such as viceX64, combian, vicepc and C64 mini .... thanks for your attention and many more thanks from us lovers of commodore 64

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/randyrossi/bmc64/issues/15, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGzqGCQ7z4x1hwlze_rq0kuetehlApuks5vYpS9gaJpZM4cAKOq .

-- Randy Rossi

C:(+1)416-605-5112 (Canada)

lroby74 commented 5 years ago

I saw that same .CRT files works perfectly with only a classic USB keyboard connected (and pressing F12 for show up menú) and don't works if i use Keyrah instead.. Maybe there is a bug in code when using Keyrah?

mcgurk commented 5 years ago

I tested Commando and Simpsons Arcade crt and if I go to menu with C= + F7 (Ctrl + F7 from my normal USB-keyboard or C= + F7 from my Arduino Pro Micro C64 keyboard) those doesn't work. I couldn't get GPIO16+GND to work (menu flashes but doesn't stay put) so I couldn't test with that. When F12 is used to open menu, those crt works.

randyrossi commented 5 years ago

I saw that same .CRT files works perfectly with only a classic USB keyboard connected

Very interesting. I will try the same cartridge with my keyrah. I have a v2, same for you?

randyrossi commented 5 years ago

I couldn't get GPIO16+GND to work (menu flashes but doesn't stay put)

Yah, I have to de-bounce that input. You can usually get it to stay on the menu if you try long enough.

So you saw that the menu keys don't work only after attaching that CRT? Or do they just never work?

mcgurk commented 5 years ago

I couldn't get GPIO16+GND to work (menu flashes but doesn't stay put)

Yah, I have to de-bounce that input. You can usually get it to stay on the menu if you try long enough.

So you saw that the menu keys don't work only after attaching that CRT? Or do they just never work?

I tried press long and short and many times and it only flickers. GPIO16+GND doesn't work for me in any circumstances.

If you go to menu with normal USB-keyboard with CTRL+F7 and select Attach cartridge and select .crt, emulator goes to some strange state. It doesn't boot to cart, but does normal reset. After that, cartridge cannot be attached successfully even with going menu with F12.

One detail: I tested same thing with Jiffydos (d1541II/kernal) installed and after CTRL+F7 -> Attach cartridge -> Select .crt -> boot to normal startup screen (not crt), screen have some text "@ S:". If you don't use CTRL+F7 at all, everything works. Maybe CTRL+F7 -keypress goes to some keyboard buffer and makes this annoyance?

mcgurk commented 5 years ago

Problem is C= (LCTRL). Even if C= (or LCTRL) is pressed with F12, .crt's don't work. So if C= (or LCTRL) is pressed when going to menu, .crt's don't work. I changed C= to SHIFT in my C64-keyboard-controller and now SHIFT+F7 works as menu button and now .crt-files work.

https://github.com/mcgurk/Arduino-USB-HID-RetroJoystickAdapter/blob/master/C64_keyboard/C64_matrix.sc

randyrossi commented 5 years ago

Thanks! Problem might be here:

https://github.com/randyrossi/bmc64/blob/c6456769b6eb0124e55a1cdf45ff2e26fc5a1a74/third_party/vice-3.2/src/arch/raspi/kbd.c#L241

There's probably a case where I'm sending an up event to the emulator when there was no down (or vice versa). I've noticed the emulator is very picky about key up/down events. I'll try to reproduce here.

lroby74 commented 5 years ago

Problem is C= (LCTRL). Even if C= (or LCTRL) is pressed with F12, .crt's don't work. So if C= (or LCTRL) is pressed when going to menu, .crt's don't work. I changed C= to SHIFT in my C64-keyboard-controller and now SHIFT+F7 works as menu button and now .crt-files work.

https://github.com/mcgurk/Arduino-USB-HID-RetroJoystickAdapter/blob/master/C64_keyboard/C64_matrix.sc

Nice! Is possible to map "CONTROL" or "RUN/STOP" or "RESTORE" key of C64 real to press together "F7" key for showing up menú?

If so, which file should be edited?

Thank you

lroby74 commented 5 years ago

Yes, but problem is same as when pressing CTRL + F7 on normal USB Keyboard, it's needed to find another combination of keys that not present the issue.. Is possible to do something like RESTORE + F1? Would be nice to could 2 near keys so i can use only one hand for opening menú while in other hand i have joystyck

Il giorno mar 26 mar 2019 alle ore 14:25 randyrossi < notifications@github.com> ha scritto:

I saw that same .CRT files works perfectly with only a classic USB keyboard connected

Very interesting. I will try the same cartridge with my keyrah. I have a v2, same for you?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/randyrossi/bmc64/issues/15#issuecomment-476632379, or mute the thread https://github.com/notifications/unsubscribe-auth/AJPoevUtnFss7c5iOlUc4kiZWfIjCMk1ks5vah_XgaJpZM4cAKOq .

randyrossi commented 5 years ago

This is a strange one. Still trying to determine the cause of this....

usadav72 commented 5 years ago

Thank you !!!

lroby74 commented 5 years ago

This is a strange one. Still trying to determine the cause of this....

I believe that i could found that! On real C64 if you turn on it with C= pressed, it will ignore any cartridges inserted (i saw in this moment on my real C64 while was testing some CRT games). If for some strange reason emulator thinks that C= is still pressed when you choose a CRT file, then emulated C64 will ignore CRT file.. This may be reason because using only a USB keyboard with F12 key for opening menù, this issue not happen. It's needed to change C= key to another one for opening menù (i hope near F7 so we can use one hand for opening it)

randyrossi commented 5 years ago

Ah, yes. That's exactly what's going on. The problem is the code submits the up event to the emulator key queue but transitions to the ui immediately. Then the cartridge is attached while the emulator thinks the commodore key is still down and only after the emulator gets control back does it process the up event, which is too late.

I'll bet if you put things back and press F7 then Commodore, then lift Commodore then lift F7, it will work.

35 years, and I never knew the Commodore key could be used to ignore cartridge at boot!

I'll have a fix for this in the next release. Thanks!

randyrossi commented 5 years ago

Actually, reversing them with the code as it is doesn't work. But I just verified that's what's happening. Have a fix already.

mcgurk commented 5 years ago

I thought same thing when I noticed C= -button was involved. Then I tested with real C64 and Ultima II+ and couldn't reproduce. But I made mistake and didn't test same games. Now I tested with more games and more real original cartridges and noticed that C= -button disabled only EasyFlash crt's and it doesn't appear to be hardware/kernal feature. So at the moment I came to conlusion that maybe it is EasyFlash feature and affects only EasyFlash crt's. That would be good explanation why I haven't either never heard about it :).

lroby74 commented 5 years ago

Ah, yes. That's exactly what's going on. The problem is the code submits the up event to the emulator key queue but transitions to the ui immediately. Then the cartridge is attached while the emulator thinks the commodore key is still down and only after the emulator gets control back does it process the up event, which is too late.

I'll bet if you put things back and press F7 then Commodore, then lift Commodore then lift F7, it will work.

35 years, and I never knew the Commodore key could be used to ignore cartridge at boot!

I'll have a fix for this in the next release. Thanks!

This issue of C= seen as pressed from BMC64 may be same thing that disturbs GPIO16 and GND from opening menú , flashing it instead of keep it open. When you test new fixed version, please check it too.. I forgot to specify that i am trying only Easy Flash cartridges, sorry :)