Pluggy Keyboard Interface Specification?

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
Post Reply
sajattack
Posts: 5
Joined: 23 May 2021, 14:07

Pluggy Keyboard Interface Specification?

Post by sajattack »

Hi there, I'm trying to bring menloparkinnovation's aforementioned FPGA core to a popular FPGA platform for retrogaming, called the MiSTer project. https://github.com/MiSTer-devel/Main_MiSTer/wiki

As part of this process, I'm trying to add keyboard support, and I'm having trouble grokking the pluggy mcplugface arduino code. Could you give me a high-level specification of "given these ps/2 scancodes -> output these hex bytes to the joyport"? I've tried putting the ps/2 scancodes through raw, and tried ascii as well. The code looks like maybe it's ascii plus a few flags? If anyone has good documentation on this I would be very appreciative.
sajattack
Posts: 5
Joined: 23 May 2021, 14:07

Re: Pluggy Keyboard Interface Specification?

Post by sajattack »

I found my mistake with the ascii, I had the bits backwards and inverted xD. But I would still like to know more about the flags.
at67
Posts: 332
Joined: 14 May 2018, 08:29

Re: Pluggy Keyboard Interface Specification?

Post by at67 »

PS2.ino does all of the keyboard encoding/decoding, have you studied this file?
sajattack
Posts: 5
Joined: 23 May 2021, 14:07

Re: Pluggy Keyboard Interface Specification?

Post by sajattack »

Yeah I looked at the code but it wasn't very clear to me.
at67
Posts: 332
Joined: 14 May 2018, 08:29

Re: Pluggy Keyboard Interface Specification?

Post by at67 »

sajattack wrote: 24 May 2021, 21:20 Yeah I looked at the code but it wasn't very clear to me.
If you look at the keymaps[] array, (which is an array of keyTuple_t structs), and the lookup() function, you can see that code performs a linear search of the keymaps[] array to convert locales, modifiers and PS2 scan codes into ascii codes.

If you want to start simple, ignore the locales and modifiers and just use a look up table to convert the code field, (PS2 scan code), of the struct to the ascii field of the struct.

e.g. for '!' you would convert 0x16 to 33, for '0' you would convert 0x45 to 48.
Post Reply