Why did many commodore 64 games require the joystick to be in port #2, despite being single-player games?
I remember being annoyed by having to unplug and plug the joystick between games.
I never really thought about that much as a kid, when I had my C-64 (we just left a joystick plugged into #2 all the time).
However, after some digging, according to Ode to Joysticks:
Which is a good point, now that I read that, I do remember that having a joystick plugged into port #1 would send bizarre key codes to the primary BASIC interpreter/command line.
The Commodore 64 keyboard was wired as an 8x8 matrix; it was read by sequentially driving one of eight "row" lines low and then reading whether that caused one of the eight "column" lines to also go low. Joystick port 1 was wired to five of the eight column lines; joystick port 2 was wired to five of the eight row lines. During the time between keyboard scans, the keyboard row containing the space bar would be left active; if when the keyboard was polled the kernel observed any columns were active, it would assume that they represented keys pressed on that row. It would have been possible for the kernel to idle with no rows active, and assume that if any column is active before it scans the keyboard the column should be ignored, but the kernel doesn't do that. Consequently, moving a joystick plugged into port 1 will cause stray characters to be typed. Moving a joystick plugged into port 2 while typing something may cause some keys to be erroneously registered as other keys, but it will not generate stray keypresses by itself.