commanderx16 / x16-rom

Other
153 stars 44 forks source link

Find a mapping from remaining PS/2 keys (e.g. PGDN/PGUP/END/...) to PETSCII control codes #21

Closed mist64 closed 2 years ago

mist64 commented 5 years ago

We have already mapped lots of the PS/2 keys to their equivalents in PETSCII codes (Break = RUN/STOP, Home = HOME etc.) and added a few control codes from the C128 and the C65 (ESC, TAB, F9-F12).

But there are some more keys on a PS/2 keyboard that don't have a direct PETSCII control code equivalent for yet:

It would be best to map them to keys found on other Commodore 8 bit computers, if it makes sense.

The C128 has the following extra keys (compared to the C64):

The C65 has the following extra keys:

The overlap of these two (that is, the more important, more canonical keys):

->

Kroc commented 5 years ago

The Windows' "MENU" key could be HELP?

mist64 commented 5 years ago

The MENU key is quite prominent and easy to hit by mistake. But that's true on Windows as well. I never really understood the point of this key on PCs...

Kroc commented 5 years ago

Accessibility, given that there's no easy way to invoke context menus without a mouse.

mobluse commented 5 years ago

Compact and notebook keyboards often do not have a dedicated Pause/Break key. https://en.wikipedia.org/wiki/Break_key#Keyboards_without_Break_key

I think there should be an alternative way to hit Pause/Break if it doesn't exist. My compact keyboard (the official Raspberry Pi Keyboard with UK layout) has ScrLk, SysRq, Home, End, PgUp, PgDn, F11, F12, and Insert reachable via the Fn key. These keys are missing: Pause, Super R (Right Windows key), Menu, Enter (on the num pad). Shift+F10 is an alternative to Menu, but doesn't send the Menu scan code.

Kroc commented 5 years ago

I have a Lenovo laptop with no Pause/Break key, but this is mapped to Fn+P/B. That said, I do agree. Perhaps an option to use the right Ctrl key?

mobluse commented 5 years ago

Fn+P givs me num pad -. Fn+B just gives me b. I tested using xev. I use the official Raspberry Pi Keyboard with UK layout.

kktos commented 5 years ago

Question: I guess most of those keys are useful for basic. So what about their use with a ASM program ? In other words, could those special keys have an address handler, used by basic by default, but you can overridde when running as ASM program to avoid any side effects ? Sorry if my question doesn't make any sense :)

mist64 commented 4 years ago

@kktos When querying the keyboard using jsr GETIN ($FFE4), you'll get the raw key codes without triggering any side effects. All keys on the standard PS/2 keyboard are planned to generate some PETSCII control code that you can intercept.

mist64 commented 4 years ago

The X16 Team has made the following decision about mapping standard PS/2 keys:

We decided against having a dedicated NO SCROLL key, because the Alt key (C64: Commodore key) already serves this purpose, and with faster machines, it's a less and less useful feature anyway (if the machine prints text too fast for you to reach the NO SCROLL key, it's not useful). Most of the other PS/2 keys keps their meaning, so X16 text processors can be more similar to modern computers.

Kroc commented 4 years ago

How does the 40/80 switch work, if in 22 (VIC-20) screen mode?

Kroc commented 4 years ago

Also, would it not make more sense to make PAUSE/BREAK use the NMI? It would after-all allow the user to interrupt any long-running code; i.e. for debugging. The name is already there, as it breaks into operation. The BASIC could allow you to pause the running program at any time.

mobluse commented 4 years ago

Should CAPS LOCK work as SHIFT LOCK or as CAPS LOCK on modern keyboards according to their layout? I think it would be better if it worked as on modern keyboards and e.g. if SV-SE layout CAPS LOCK would affect ÅÄÖ keys, but not the number keys, but maybe on some layouts CAPS LOCK works as a SHIFT LOCK and affects the number keys.

Maybe RESTORE could generate an NMI if the PS/2 port is connected to VERA and VERA listens for the PrtScn scan code and then generates an NMI to the WDC65C02.

The names are different on the X16 keyboard so e.g. PrtScn key will have RESTORE printed on it.

I'm not sure X16 has a VIC20 screen mode, but if it has it would be great, and how it would work with the 40/80 key TBD. Maybe pressing 40/80 key in 22 mode would go to 40 if unshifted and 80 if shifted.

Dooshco commented 4 years ago

There hasn't been update on this for more than 5 months and many of the Commander X16 keys are still not mapped. We now even have official X16 keyboard that has many "dead" keys when used with Emulator. Any plan to get this cleaned up?

mist64 commented 2 years ago

New PETSCII Codes

These are the new codes for the currently unsupported PS/2 keys:

Key Code Comment Shifted Code Comment
Page Down $02 C128: underline (same)
Page Up $82 C128: underline off (same)
End $04 $84 C128: HELP
Menu $06 (same)
Fwd Del $19 (same)

Comments:

Special Keys

The following keys don't produce PETSCII codes:

PS/2 Scroll Lock

This key is "40/80 DISPLAY" on the X16. It is a toggle key, like on the C128, and has an LED, so it is treated like CAPS LOCK: It does not produce a PETSCII code, but an application can read its state using kbdbuf_get_modifiers (bit 5).

PS/2 Print Screen

This key is "RESTORE" on the X16. The microcontroller that manages the PS/2 bus will raise an NMI on key down.

More TODOs

The following keys are dead right now and need to be added:

mist64 commented 2 years ago

Created https://github.com/commanderx16/x16-rom/issues/292 for "40/80 DISPLAY".