Ability to switch keyboard input to scan-code-only mode?

If you have feature requests, this is the place to post them. Please note your idea may already be something we have already discussed and decided against, or something we are working on privately, and we cannot be held responsible for any similarities in such instance. Whilst we cannot respond to every suggestion, your idea will be read and responded to where possible. Thank you for your input!
Post Reply
DragWx
Posts: 362
Joined: Tue Mar 07, 2023 9:07 pm

Ability to switch keyboard input to scan-code-only mode?

Post by DragWx »

It's already possible for a program to receive scancode keydown/keyup events (via vector), it's just that there's no (safe) way to bypass the rest of the input-to-character logic that happens afterwards, and that's a potentially expensive operation that the software may not even care about (e.g., when using the keyboard joystick).

So, I think it'd be beneficial for a program to have a way to disable the text-input portion of the kernal's keyboard scanning routine, to save on CPU time for when the program wants to know about keypress events for game logic but not for text.

What do you think?
kelli217
Posts: 541
Joined: Sun Jul 05, 2020 11:27 pm

Re: Ability to switch keyboard input to scan-code-only mode?

Post by kelli217 »

You *can,* but you have to throw the baby out with the bathwater. The keyboard and mouse input are handled by system interrupts, and so if you disable those, or redirect them, you can do whatever you want.
DragWx
Posts: 362
Joined: Tue Mar 07, 2023 9:07 pm

Re: Ability to switch keyboard input to scan-code-only mode?

Post by DragWx »

Sure, I'm comfortable rolling my own low-level input handler, but the reason I'm bringing it up is because this sounds like something which other developers could use too, plus if the kernal handles it, then that helps with forwards compatibility.
User avatar
desertfish
Posts: 1123
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: Ability to switch keyboard input to scan-code-only mode?

Post by desertfish »

Docs say
In order to prevent the KERNAL from handling the scan code, let .A = 0 on returning from the handler.
Wouldn't that suffice?
DragWx
Posts: 362
Joined: Tue Mar 07, 2023 9:07 pm

Re: Ability to switch keyboard input to scan-code-only mode?

Post by DragWx »

You're right, I just checked the ROM again, and for some reason, it never occurred to me to just set A to 0 before returning from a custom keyboard handler vector, but it would indeed work.

Where in the docs was that? I swear I checked them up and down and couldn't find anything that said that.
User avatar
desertfish
Posts: 1123
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: Ability to switch keyboard input to scan-code-only mode?

Post by desertfish »

Now this is weird, I can't find that particular phrase myself anymore!?

Anyway I *thought* I took it from here:

https://github.com/X16Community/x16-doc ... de-handler

But it says "To remove a keypress so that it is not added to the keyboard queue, return .A = 0."

Means the same thing ofcourse but where did I get the other sentence from :roll:
BruceRMcF
Posts: 224
Joined: Sat Jan 07, 2023 10:33 pm

Re: Ability to switch keyboard input to scan-code-only mode?

Post by BruceRMcF »

desertfish wrote: Sun Mar 12, 2023 1:18 pm Now this is weird, I can't find that particular phrase myself anymore!?

Anyway I *thought* I took it from here:

https://github.com/X16Community/x16-doc ... de-handler

But it says "To remove a keypress so that it is not added to the keyboard queue, return .A = 0."

Means the same thing ofcourse but where did I get the other sentence from :roll:
Might it have been an earlier version of the documentation? At least to me, that explanation above seems to be the clearer of the two.
DragWx
Posts: 362
Joined: Tue Mar 07, 2023 9:07 pm

Re: Ability to switch keyboard input to scan-code-only mode?

Post by DragWx »

Ahh, it was the editor page. I was fixated on checking the kernal page and the ROM itself. :P

And yeah, I'm sure the text got revised at some point, but I found a downside to the fact that we use a forked repository now: Github search doesn't work in forks. :(

Anyway, thank you for your help and to pointing me towards the correct documentation page; it's nice to know the thing I wanted was supported all along. :D
User avatar
desertfish
Posts: 1123
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: Ability to switch keyboard input to scan-code-only mode?

Post by desertfish »

I agree that this description is in a quite obscure location...
Post Reply