Looking at the schematic and explanation of how the C64 joystick
ports work, it seems clear that the stick direction and button
JOYA3 for port 1 and
JOYB3 for port 2) can also be used as outputs by having the attached
device sense the levels of those lines (5V and 0V) and programming the
CIA to pull the levels high and low in the same way as is done for
keyboard scanning. (Or, for that matter, manually pressing appropriate
keys on the keyboard to bring the levels low.)
This should also work on the VIC-20, and perhaps other Commodore computers with joystick ports.
Were any devices that used this technique manufactured and sold? If so, what were they, and how did they deal with keyboard interference with the scanning?
(This question was inspired by a comment on the pagetable.com blog post NES and SNES Controllers on a 6502 (like the C64). It seems to me that you could use the same technique with NES/SNES controllers plugged into the joystick ports instead of the user port, albeit you'd need to deal with the issue of keys pressed on the keyboard interfering with the I/O.)