[Video] RPIKB: IKBD emulator for USB keyboard, mouse + joysticks

This chat forum will appear to guests and bots. IE will appear on search engines etc. If you do not want your appearing publicly then please use the original chat forum.
User avatar
sporniket
Site sponsor
Site sponsor
Posts: 1164
Joined: 26 Sep 2020 21:12
Location: France

Re: [Video] RPIKB: IKBD emulator for USB keyboard, mouse + joysticks

Post by sporniket »

Badwolf wrote: 16 Sep 2022 21:57 It's flapping around a bit at the moment -- being on a breadboard with dodgy power leads doesn't help -- so I don't know how much is down to enumeration failing and how much is down to shoddy construction.
These days I am experimenting with a TFT screen through SPI, I took a substancial time to troubleshoot a supposedly working example. It turned out that the continuity on the breadboard were "suboptimal" to stay polite. I ended up using only a custom set of dupont connectors and flying leads (at least my crimping tool is proving usefull) (Anyway, an ESP32 dev board is too wide to be comfortable on a breadboard.)
User avatar
JezC
Posts: 2783
Joined: 28 Aug 2017 23:44

Re: [Video] RPIKB: IKBD emulator for USB keyboard, mouse + joysticks

Post by JezC »

Badwolf wrote: 16 Sep 2022 21:57
JezC wrote: 16 Sep 2022 21:53 @Badwolf Do you have the part numbers for the various components/level shifter etc.?
No, sorry, just eyeballed them from eBay. The OLED is the 0.96" variant, though, which may help.
Ok, thanks - I'll have a look. Any chance you could PM me the links for the ones you bought (just to be sure the ones I choose are compatible)?
User avatar
Badwolf
Site sponsor
Site sponsor
Posts: 3043
Joined: 19 Nov 2019 12:09

Re: [Video] RPIKB: IKBD emulator for USB keyboard, mouse + joysticks

Post by Badwolf »

JezC wrote: 17 Sep 2022 11:50
Badwolf wrote: 16 Sep 2022 21:57 No, sorry, just eyeballed them from eBay. The OLED is the 0.96" variant, though, which may help.
Ok, thanks - I'll have a look. Any chance you could PM me the links for the ones you bought (just to be sure the ones I choose are compatible)?
https://www.ebay.co.uk/itm/203653375472 ... 4439045647

https://www.ebay.co.uk/itm/202855579246

Nowt special between them and the other sellers.

BW
DFB1 Open source 50MHz 030 and TT-RAM accelerator for the Falcon
Smalliermouse ST-optimised USB mouse adapter based on SmallyMouse2
FrontBench The Frontier: Elite 2 intro as a benchmark
User avatar
JezC
Posts: 2783
Joined: 28 Aug 2017 23:44

Re: [Video] RPIKB: IKBD emulator for USB keyboard, mouse + joysticks

Post by JezC »

Thanks @Badwolf - I'll have a look for equivalents later today.

Much appreciated.
Asprinwizard
Posts: 3
Joined: 06 Jul 2024 10:24

Re: [Video] RPIKB: IKBD emulator for USB keyboard, mouse + joysticks

Post by Asprinwizard »

This is very interesting. I realise this thread is old but perhaps someone might read this and be able to help me out. What I've been working on is basically the opposite of this where I want to use original hardware with an emulated system, so converting the Atari ST keyboard to USB HID device. There was already a library for this and I forked it so I could add the mouse and joystick ports. The repo is here in case anyone is interested: https://github.com/asprinwizard/arduino ... d-keyboard

The one remaining thing was enabling the mouse port to work as a joystick, i.e. for two player games. My assumption here is that the ST sent a command for the IKBD chip to switch to 'joystick mode' when loading a game that supported two joysticks. My thoughts then were that if I use my microcontroller (an arduino leonardo in my case) to tranmit this command then the IKBD will start outputting joystick type data for this port. I can then add a switch or something to allow the user to switch the 'role' of that port.

ChatGPT tells me the Atari sends the following commands to the IKBD:
0xF8: Set mouse to relative position reporting
0xF9: Set mouse to absolute position reporting
0xFA: Set mouse off (disable)
0xFB: Set mouse on

But I've tried sending these and it makes no difference. In the repo used in this project (https://github.com/fieldofcows/atari-st-rpikb/) I see methods for `get_mouse_enabled` and `set_mouse_enabled` which seems to suggest a toggle between mouse and joystick modes. So I was hoping somebody here who understands the code better than me might be able to advise what I need to send to the IKBD from the arduino to trigger the change of mode. Would really appeciate any help you can give. Thanks.
User avatar
Badwolf
Site sponsor
Site sponsor
Posts: 3043
Joined: 19 Nov 2019 12:09

Re: [Video] RPIKB: IKBD emulator for USB keyboard, mouse + joysticks

Post by Badwolf »

Asprinwizard wrote: 16 Jul 2025 14:39 This is very interesting. I realise this thread is old but perhaps someone might read this and be able to help me out. What I've been working on is basically the opposite of this where I want to use original hardware with an emulated system, so converting the Atari ST keyboard to USB HID device.

...

The one remaining thing was enabling the mouse port to work as a joystick, i.e. for two player games. My assumption here is that the ST sent a command for the IKBD chip to switch to 'joystick mode' when loading a game that supported two joysticks.
HI Asprinwizard,

I can't say I'm much of an expert, but I think those calls just affect the reporting to the OS. I don't think the port gets reconfigured in any way.

I think if you could waggle your joystick at a few hundred times per second it would behave like a mouse pointer. And, in reverse, moving the mouse just looks like you pressing different directions on the joystick in various quadrature patterns.

You may be interested in this project, BTW:

https://www.atarikit.co.uk/imposter/imposter.html

I don't think it's open source, but it does input controller translation bidirectionally, which sounds like what you want. Not as satisfying as working it out yourself, but may give you a shortcut!

BW
DFB1 Open source 50MHz 030 and TT-RAM accelerator for the Falcon
Smalliermouse ST-optimised USB mouse adapter based on SmallyMouse2
FrontBench The Frontier: Elite 2 intro as a benchmark
ijor
Posts: 825
Joined: 30 Nov 2018 20:45

Re: [Video] RPIKB: IKBD emulator for USB keyboard, mouse + joysticks

Post by ijor »

Asprinwizard wrote: 16 Jul 2025 14:39 The one remaining thing was enabling the mouse port to work as a joystick, i.e. for two player games. My assumption here is that the ST sent a command for the IKBD chip to switch to 'joystick mode' when loading a game that supported two joysticks.
There is no such a thing ... There is a joystick mode. But there is no IKBD joystick emulation.
ChatGPT tells me the Atari sends the following commands to the IKBD:
Why you ask ChatGPT? Why not checking the official Atari IKBD documentation? AI will probably tell you where you can find the IKBD documentation. Or you can go to dev-docs and search for IKBD.
http://github.com/ijor/fx68k 68000 cycle exact FPGA core
FX CAST Cycle Accurate Atari ST core
http://pasti.fxatari.com
Asprinwizard
Posts: 3
Joined: 06 Jul 2024 10:24

Re: [Video] RPIKB: IKBD emulator for USB keyboard, mouse + joysticks

Post by Asprinwizard »

Thanks for the replies. I had no idea there was IKBD documentation and I suspect it might well be above my head. But my reasoning for the change of mode was this: the output from the mouse port was such that it would output the mouse status whenever something changed, and it would output button status, x-axis and y-axis in three packets. From that it's easy to translate into mouse instruction via the Arduino library for the mouse. However when a joystick is connected it effectively does the same thing which would be no problem except that it does not output anything when the joystick returns to the centre and if you put the joystick to, say, top left it will output two packet sets, one for top and one for left. In each case the axis not being changed is set to 0 meaning moving the joystick up and then left will output the same as top left. It takes no account of which direction buttons are already pressed when outputting a change, and as I said if the joysick moves back to the centre it outputs nothing.

As such there are definite gaps in the instruction set output by port 0 for joysticks and I had assumed that something within the software would trigger an instruction somewhere to treat the port 0 as a joystick, thus it would output an identifier followed by the numerical description of the direction of the joystick, as how port 1 operates.

I appreciate the link to the Imposter project. I would hope they may be able to help me get to the bottom of it. Thanks for taking the time to reply.

Return to “CHAT FORUM PUBLIC”

Who is online

Users browsing this forum: ClaudeBot, petal [bot] and 1 guest