Page 1 of 1
Ability to switch keyboard input to scan-code-only mode?
Posted: Tue Mar 07, 2023 10:16 pm
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?
Re: Ability to switch keyboard input to scan-code-only mode?
Posted: Tue Mar 07, 2023 11:09 pm
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.
Re: Ability to switch keyboard input to scan-code-only mode?
Posted: Sat Mar 11, 2023 8:05 pm
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.
Re: Ability to switch keyboard input to scan-code-only mode?
Posted: Sun Mar 12, 2023 12:15 am
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?
Re: Ability to switch keyboard input to scan-code-only mode?
Posted: Sun Mar 12, 2023 3:38 am
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.
Re: Ability to switch keyboard input to scan-code-only mode?
Posted: Sun Mar 12, 2023 1:18 pm
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
Re: Ability to switch keyboard input to scan-code-only mode?
Posted: Sun Mar 12, 2023 5:19 pm
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
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.
Re: Ability to switch keyboard input to scan-code-only mode?
Posted: Sun Mar 12, 2023 6:32 pm
by DragWx
Ahh, it was the editor page. I was fixated on checking the kernal page and the ROM itself.
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.
Re: Ability to switch keyboard input to scan-code-only mode?
Posted: Sun Mar 12, 2023 7:28 pm
by desertfish
I agree that this description is in a quite obscure location...