MSX keyboard layout - simultaneous key press

By Eugeny_Brychkov

Paragon (1232)

Аватар пользователя Eugeny_Brychkov

25-09-2022, 00:06

Did you know that MSX keyboards are not designed to have any key combination press possible?

I did not consider this closely, and had the belief that MSX is super gaming design where pressing any key combination reliably gives proper key scan. I was wrong, it is not the case. MSX keyboards, at least those I analyzed recently, are NOT designed for any key press, and if you press, for example, G, O and W keys on international keyboard simultaneously, it will cause electrical conflict on the keyboard lines.

Did you ever think why MG2 uses arrow keys, and odd N and M keys? It appeared that arrows are in scan bits [7:4] and N/M are in bits [3:2].

Various keyboards "protect" the control keys from this conflict (for example by diode): SHIFT, CTRL, KANA, GRAPH etc - depending on the BIOS. If you look at YIS805, it protects SHIFT and GRAPH only as RUS and CAPS are both toggle keys. For some reason CTRL is not protected, therefore pressing CTRL-E causes electrical problem, but keyboard still works as expected because keyboard uses TTL chips with high level output current much less than low level output current - and low level keeps being low level even when there's another output connected being at high level.

I have designed an universal circuit diagram (below), but at the end it seems to be a real overkill !

Для того, чтобы оставить комментарий, необходимо регистрация или !login

By pgimeno

Champion (328)

Аватар пользователя pgimeno

25-09-2022, 11:59

I think it is well known.

https://en.wikipedia.org/wiki/Rollover_(key)

I can't see the picture, by the way.

By Eugeny_Brychkov

Paragon (1232)

Аватар пользователя Eugeny_Brychkov

25-09-2022, 12:30

pgimeno wrote:

I think it is well known.

It was discovery for me regarding MSX. Current solution is generally ok - working and cost effective, but not universal. And developers of the software must mind this when developing multiple keypress control.

By Pencioner

Scribe (1611)

Аватар пользователя Pencioner

25-09-2022, 21:40

pgimeno wrote:

I can't see the picture, by the way.

I can see picture
@Eugeny if you have problems with proper pics hosting there's a resource dedicated to hosting the MSX related pic, namely https://msx.pics/

By pgimeno

Champion (328)

Аватар пользователя pgimeno

30-09-2022, 19:43

OK, I can see the image now and it indeed looks overkill.

What's wrong with using one diode per key (in series with the switch), and maybe pullup resistors if the inputs are not TTL? Wouldn't that be cheaper?

As an aside, doesn't this belong in the Hardware forum more than here?

By Grauw

Ascended (10821)

Аватар пользователя Grauw

01-10-2022, 01:57

One that often trips me up, if I type “cd ” too quickly it moves the cursor back to the start of the prompt because it also triggers the HOME key bit in the keyboard matrix.

This particular example could be solved by software, it should be possible to detect a potential rollover combination and not updating those bits in the key matrix read-out for that frame when that is the case. It would prevent extra keys from being triggered like that, but of course there is a computational cost to that, and it won’t fix the problem for e.g. games where you want the exact inputs every frame.

There is a section on it on the MAP: Keyboard matrices - Key ghosting

pgimeno wrote:

I can't see the picture, by the way.

Google Chrome does not show http images on https sites nowadays unfortunately. Works in Firefox.

By st1mpy

Paladin (947)

Аватар пользователя st1mpy

01-10-2022, 12:51

What I find funny is that, in BASIC prompt, if you want to type MSX it sometimes doesn't work.

It's lower case by default, so you need to press:
Shift + M S X (while not letting go of shift).

If you do this slowly, you get MSX.
If you do this quickly, you get ...

By pgimeno

Champion (328)

Аватар пользователя pgimeno

01-10-2022, 13:14

Grauw wrote:

This particular example could be solved by software, it should be possible to detect a potential rollover combination and not updating those bits in the key matrix read-out for that frame when that is the case.

I think what you're describing is key jamming, which is what most PC keyboards do to prevent ghosting. When they detect a key combo of 4 keys that form a rectangle in the keyboard matrix, they ignore the last two presses, because one of them is a ghost key and it's impossible for the KB controller to know which one.

Funnily enough, the "ZX Spectrum Recreated" keyboard has N-key rollover, i.e. no ghosting, and for compatibility, when I added support for that keyboard in the MiSTer Spectrum FPGA core, I implemented optional ghosting. Some emulators also implement ghosting on purpose; not sure if OpenMSX does.

I also had a PC keyboard which supported N-key rollover. An old one; I bought it with a Pentium IIRC, but liked it so much that I bought a spare. I opened it and indeed it had a diode per key. Unfortunately I can't use it nowadays because it uses the DIN 5-pin 180° connector; also the key contacts turned out to be worse than I expected. My current one also has NKRO but it's one of those obnoxious "gaming" keyboards with colours and without a right OS key which I miss so much. Apparently no one makes normal (non-gaming) keyboards with NKRO anymore.