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?
Ability to switch keyboard input to scan-code-only mode?
Re: Ability to switch keyboard input to scan-code-only mode?
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?
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.
- desertfish
- Posts: 1123
- Joined: Tue Aug 25, 2020 8:27 pm
- Location: Netherlands
Re: Ability to switch keyboard input to scan-code-only mode?
Docs say
Wouldn't that suffice?In order to prevent the KERNAL from handling the scan code, let .A = 0 on returning from the handler.
Re: Ability to switch keyboard input to scan-code-only mode?
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.
Where in the docs was that? I swear I checked them up and down and couldn't find anything that said that.
- desertfish
- Posts: 1123
- Joined: Tue Aug 25, 2020 8:27 pm
- Location: Netherlands
Re: Ability to switch keyboard input to scan-code-only mode?
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
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?
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.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
Re: Ability to switch keyboard input to scan-code-only mode?
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.
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.
- desertfish
- Posts: 1123
- Joined: Tue Aug 25, 2020 8:27 pm
- Location: Netherlands
Re: Ability to switch keyboard input to scan-code-only mode?
I agree that this description is in a quite obscure location...