What if we added a resistor to the gamepad port / PS2 adapter and allowed pass-through by default?
We could use both gamepads AND mouse + keyboard (each one port) at the same time.
With a bit of "magic" we can autodetect if it's a keyboard or mouse. (I don't remember off the top of my head what commands they'll respond to ID)
Then have the ATtiny respond to keyboard (KB_SEND_KEY 0x00 / INPUT_SEND_END 0x01) or ( MOUSE_SEND_EVENTS 0x02 / INPUT_SEND_END 0x01)
We don't need a separate end code.
If it's not the attached device just respond with no key data / no mouse deltas & mouse buttons released.
The ATtiny needs to stay as an input on its data out port by default/after INPUT_SEND_END to let the gamepad data through the resistor.
It could even check the incoming gamepad data and re-detect or force a mode (kb or mouse if detect fails) depending on buttons held (SELECT+START+something) maybe??
What if we added a resistor on the clock & latch pins uzebox-side, the ATtiny could override the gamepad then read the real gamepads after the Uzebox is done. As long as we read the gamepad only once per frame on the Uzebox side it leaves lots of time to sneak in.
Could also emulates a snes mouse instead of sending collected PS/2 mouse status. (It can still override the gamepad and send gamepad data)
Or emulate an snes gamepad from the keyboard.
With that protocol and a bigger MCU we can have both keyboard and mouse on the same port. The ATtiny doesn't have enough pins for 2x PS/2 data streams tho.
So 2 gamepads (more with multitap), 2 PS/2keyboards, 2 PS/2mice possible.
Or 2 snes mice, 2 PS/2 mice, 2 PS/2keyboards
(4 player fly-swat game?)
And I think it'd still be backward compatible.
I wonder if we could bit-bang a USB host and use USB keyboards & mice off the ATtiny85 with the little memory it has. It'd be easier to find than PS/2 keyboards/mice.
Keyboard adapter v2?
Re: Keyboard adapter v2?
At first view that could work. Would be *much* simpler than my keyboard adapter V2 (that I never published). I wanted to have both ports and the keyboard at the same time for my Uzebox retro computer. So I'll have to test that.

Without getting into the code again, this is over my head.With a bit of "magic" we can autodetect if it's a keyboard or mouse. (I don't remember off the top of my head what commands they'll respond to ID)
Then have the ATtiny respond to keyboard (KB_SEND_KEY 0x00 / INPUT_SEND_END 0x01) or ( MOUSE_SEND_EVENTS 0x02 / INPUT_SEND_END 0x01)
We don't need a separate end code.
If it's not the attached device just respond with no key data / no mouse deltas & mouse buttons released.
The ATtiny needs to stay as an input on its data out port by default/after INPUT_SEND_END to let the gamepad data through the resistor.
It could even check the incoming gamepad data and re-detect or force a mode (kb or mouse if detect fails) depending on buttons held (SELECT+START+something) maybe??
What if we added a resistor on the clock & latch pins uzebox-side, the ATtiny could override the gamepad then read the real gamepads after the Uzebox is done. As long as we read the gamepad only once per frame on the Uzebox side it leaves lots of time to sneak in.

Sure can, check https://www.obdev.at/products/vusb/index.html. Runs on an AVR with at least 2 kB of Flash and 128 bytes RAM. And it's a very good point, nice PS/2 keyboards are getting real hard to find these days.I wonder if we could bit-bang a USB host and use USB keyboards & mice off the ATtiny85 with the little memory it has. It'd be easier to find than PS/2 keyboards/mice.
Re: Keyboard adapter v2?
Did you ever try this rv6502 or anyone else?
Re: Keyboard adapter v2?
I haven't had time to get back on Uzebox stuff.
Finishing some non-Uzebox projects first, won't have time to play with that for a little while sadly.
Finishing some non-Uzebox projects first, won't have time to play with that for a little while sadly.
Re: Keyboard adapter v2?
As I mentioned back on that thread, I've made a revision to the Keyboard interface and its firmware. I can say it greatly eased the development of the last firmware version. I'm uploading the Gerbers, schematic and firmware here for those interested. I'm reworking the download section of the site which will be moved over to Github eventually. Have the keyboard interface made (and the Uzenet interface), it's worth it. 

- Attachments
-
- KeyboardFirmware.hex
- (1.03 KiB) Downloaded 21 times
-
- keyboard-adapter-V1_2-2022-09-20b.zip
- (68.27 KiB) Downloaded 24 times
Re: Keyboard adapter v2?
Does this have a passthrough for a regular gamepad, or does it use the ICSP header to avoid that, or is an either or thing (keyboard or gamepad plugged in)?
Re: Keyboard adapter v2?
What Artcfox said plus is the ATMega85 the same as the ATTiny85?
Re: Keyboard adapter v2?
You can either build a little adapter like pictured or embed it directly in a PS/2 keyboard with an SNES cable going out. In both cases it plugs in the P2 port and does not interfere with P1 port. It uses just an ATtiny25/45/85 and a couple resistors. Internally in runs at a zippy 16Mhz using the PLL. Very inexpensive too, you can have the pcb built and shipped at JLCPCB for under 10$.
- Attachments
-
- kb_adapter.jpg (36.98 KiB) Viewed 545 times
Re: Keyboard adapter v2?
Very nice!!
Re: Keyboard adapter v2?
Thanks!Very nice!!

To answer the OP, I did something like that 5 years ago (time flies!). It would have allowed to have both the P2 and keyboard on the same lines and switch between the two in software. I started working on the firwmware but the mouse gave me trouble if I recall. So it kinda fell into oblivion. Perhaps if someone gets a great project going on using a PS/2 mouse it could be revived.
- Attachments
-
- kb_mouse_adapter.JPG (109.46 KiB) Viewed 523 times