Keyboard input

Door Arjan

Paladin (782)

afbeelding van Arjan

23-11-2021, 14:32

I want to found out which key has been pressed (if any), or rather, the resulting ASCII character of the keypress. The easiest way seems to be using BDOS function DIRIO, but it doesn't work if the BIOS interrupt handler is disabled.

I could read the keyboard matrix and translate key presses to actual ASCII codes but I don't want to deal with all the differences in various countries' keyboard matrices.

Is there any good alternative?

Aangemeld of registreer om reacties te plaatsen

Van Grauw

Ascended (10707)

afbeelding van Grauw

23-11-2021, 15:51

To my knowledge, if you disable the BIOS interrupt handler you’re on your own I’m afraid… I don’t know the details of your specific situation, but I suggest to enable them if you need free-form text input.

If you only need to handle specific key presses for keys that don’t really differ between countries, or it would not be a big problem if it is mapped to a different key, you can probably get away with reading the key matrix without considering country specific differences.

Van santiontanon

Paragon (1770)

afbeelding van santiontanon

23-11-2021, 16:56

I think so too. As far as I know, the BIOS is the only one that actually knows the keyboard layout of the specific machine you are using. So, without the BIOS, I wouldn't know how to do this.

Van Arjan

Paladin (782)

afbeelding van Arjan

23-11-2021, 18:32

There's no way to set up system variables in a way that makes DIRIO properly?

Oh well, in the part of the program I need this I don't really need a custom interrupt handler, so it's probably easier to just switch back to the BIOS interrupt handler.

Van santiontanon

Paragon (1770)

afbeelding van santiontanon

23-11-2021, 19:15

I am only speculating here (some one please correct me), but I think the problem is that only the specific BIOS built-in in each particular MSX machine knows the keyboard layout of that specific machine, and hence how to map from the key matrix to ASCII characters.

Van Arjan

Paladin (782)

afbeelding van Arjan

23-11-2021, 19:27

Yeah, apparently even knowing the keyboard type is not enough to convert the keyboard matrix to key presses corresponding to the actual keyboard layout.