MiSTer-devel / ZX-Spectrum_MISTer

45 stars 33 forks source link

Rewrite keyboard handler #16

Closed JulianPaoloThiry closed 3 years ago

JulianPaoloThiry commented 3 years ago

The giant comment at the start of keyboard.sv explains the what and why of this rewrite. This should hopefully supersede the recent keyboard changes with more intuitive keys and satisfy the original intent of said changes by also adding support for the Recreated ZX Spectrum keyboard. Note that I cannot test that keyboard since I don't have one, but the driver should work correctly according to the developer documentation.

sorgelig commented 3 years ago

I don't get this cult of ZX keyboard rewriting. Also i've told about recreated ZX keyboard - it doesn't fit MiSTer. MiSTer is multi-core project and therefore basic input devices such as keyboard/mouse/joystick should follow standard protocols and code.

JulianPaoloThiry commented 3 years ago

I rewrote this for a few of reasons. First, I fundamentally disagree with the swapping of dot, comma, apostrophe, and quote. This creates keys that do not do what is printed on them and also do not correspond to the target system's keys. Second, state handling was a bit of a mess. Alt is one example (LAlt down, RAlt Down, LAlt Up, F1 should register as Alt+F1, but does not). The SYMBOL SHIFT and CAPS SHIFT keys being incorrectly held down after pressing symbol keys is another, and the behavior that occurs when pressing multiple keys at the same time and then releasing them is very inconsistent. Finally, as a personal curiosity, I just wanted to see if support for EXTEND MODE symbols was actually feasible.

While these things may not affect most users, why pass up the opportunity for perfection when it's perfectly possible?

As far as Recreated Spectrum goes, honestly, I just got a bit carried away. Once I had to add an option to the menu and had rewritten everything, it was trivial to add support for it, so I took a few minutes to add it. I definitely see your point about standard protocols, though. I can remove that support if it's really necessary, but I kind of wonder what harm it does?

sorgelig commented 3 years ago

First, I fundamentally disagree with the swapping of dot, comma, apostrophe, and quote.

99% users will need to type LOAD"" so swap for quote has its reason.

Adding US/UK is not reasonable because not only US and UK layouts exist. Once you add UK, why not add FR or DE or some other layouts? This is why MiSTer uses single US international layout.

As for weird recreated ZX layout - it's actual only when there is only single core build inside that keyboard. Not a problem to port ZX core to other FPGA and fine-tune it for specific HW. I don't see why MiSTer should support it as a dead code. It adds cluttering without a reason with obligation to support it in future versions.