Page 1 of 1

How to read raw keyboard codes?

Posted: Fri May 28, 2021 2:37 pm
by iljitsch

Ever since I got a mechanical keyboard with hot swappable switches I find it very useful to have an app that will show me which key(s) I'm pressing. So I've made several (!) keyboard test programs. I also want to make one for the X16. But... how do I read the raw keycodes produced by the keyboard?

AFAIK on the C64 the KERNAL API only gives you the character a keypress produces, and obviously the C64 tricks for lower level access don't work on the X16 because it uses a completely different keyboard interface.


How to read raw keyboard codes?

Posted: Fri May 28, 2021 2:53 pm
by Elektron72

There's a section in the Programmer's Reference Guide about custom scan code handlers: https://github.com/commanderx16/x16-docs/blob/master/Commander X16 Programmer's Reference Guide.md#custom-keyboard-scan-code-handler

However, I believe this only works using the latest version of the ROM built from source (what will eventually become r39).


How to read raw keyboard codes?

Posted: Fri May 28, 2021 8:36 pm
by iljitsch

Thanks!


How to read raw keyboard codes?

Posted: Wed Jun 02, 2021 3:28 pm
by svenvandevelde


On 5/28/2021 at 4:53 PM, Elektron72 said:




There's a section in the Programmer's Reference Guide about custom scan code handlers: https://github.com/commanderx16/x16-docs/blob/master/Commander X16 Programmer's Reference Guide.md#custom-keyboard-scan-code-handler



However, I believe this only works using the latest version of the ROM built from source (what will eventually become r39).



Thank you. Was also looking into this.