Saturn keyboard and extended keys

For anything related to IO (joypad, serial, XE...)

Moderator: BigEvilCorporation

Post Reply
Very interested
Posts: 920
Joined: Thu Apr 10, 2008 3:03 pm

Saturn keyboard and extended keys

Post by Sik » Sat Jul 13, 2019 2:56 pm

As you may know, in the West the Saturn didn't get a dedicated keyboard (unlike Japan) but an adapter that takes a PS/2 keyboard instead. This means it could potentially be taking in any keyboard layout, including keys it wasn't designed for, so it would be nice to document what it does with those keys. I don't have one of those keyboards at hand though so I'd need other people to look into them.

First of all, some quick overview: Saturn keyboard scancodes are more or less based on the PS/2 set 2 scancodes. The latter shares a the same idiosyncracy from set 1 scancodes in that some keys have a 0xE0 prefix to indicate they're "extended" (this was intended to make translation between sets easier, as a dumb look-up table would do). This is relevant since the Saturn keyboard doesn't have the concept of extended scancodes and so the adapter has to handle them in a special way, which is where things start breaking.

From information I've seen so far:
  • Simple scancodes are used as-is
  • Extended scancodes from 101/102-key keyboards (arrows, etc.) are handled in a special way and remapped to new scancodes (that don't clash with any existing set 2 scancodes)
  • Extended scancodes not caught above are passed as-is (without the prefix)… but make and break flags are never set, rendering them unusable (in a reasonable way)
The last point is annoying, but at least gives us an idea of how the scancodes should be mapped if somebody wanted to make a new adapter that does support them. A lot of the new extended scancodes are intentionally mapped to not clash with older scancodes even when the prefix is stripped (left/right Win keys, menu key, power management keys, etc.), so for those it'd make sense to strip the prefix and use them as-is. Things go to hell with the media keys though, which seem to have been made to map to letters…

Can anybody help confirm this behavior?
Sik is pronounced as "seek", not as "sick".

Chilly Willy
Very interested
Posts: 2847
Joined: Fri Aug 17, 2007 9:33 pm

Re: Saturn keyboard and extended keys

Post by Chilly Willy » Sat Jul 13, 2019 5:21 pm

Sure. I'll plug one of my Logitech keyboards into the adapter and run my controller test app on my Saturn (how I found all the key mappings I put into libyaul) and see what happens.

Post Reply