cc65/cc65 — pull request #109 by groessler (2014-04-22 14:03:14+00:00)
Title: Proposal: workaround for "phantom" key presses in the C128 "joystick" mouse driver...

I've tried to implement the "hack" done in the c64 mouse drivers on the c128, but it somehow didn't work.

Then I stepped back, thought about it, and came up with the following idea:

1) check in the regular mouse driver IRQ routine if a joystick action is active
2) run the ROM handler which scans the keyboard
3) check (before returning into the interrupted program) if a joystick action is active

If 1) and/or 3) indicated an actiive joystick action, the keypress which might have been inserted into the keyboard buffer in 2) is discarded.

This appears to work quite well. I wasn't able to simulate a "phantom" key press. I've tested on VICE and a real c128.

In order to implement it, I did some things which might be debatable (therefore tagging this pull request as "proposal"). I'm modifying the vector into the ROM IRQ handler used by irq.s to point to a routine which calls the ROM IRQ handler and then another "callback" routine in the mouse driver (which does 3) and discards the key press if needed).

If this pull request is accepted (maybe after some changes) I would change the 1351 driver similarily. The adaptations of the other drivers should be done by someone else since I haven't got the hardware to test.