Apple II Technical Notes _____________________________________________________________________________ Developer Technical Support Mouse #4: Mouse Firmware Bug Affecting ServeMouse Revised by: Matt Deatherage November 1988 Revised by: Rilla Reynolds January 1985 This Technical Note documents a bug in the mouse firmware on the AppleMouse card which affects the way ServeMouse works. _____________________________________________________________________________ There is a bug in the AppleMouse II 6805 firmware which may affect the way ServeMouse works in an application. If the application takes more than one video cycle (normally about 16 ms) to respond to a mouse-generated interrupt, then ServeMouse will not claim the interrupt. The 6805 returns an interrupt status byte of $00 (i.e., no mouse interrupt pending), and the 6502 firmware sets the carry bit (although the interrupt is also cleared by the ServeMouse call). This situation can be confusing, and under ProDOS or Pascal it can be lethal. We have identified the following solutions, any of which should work: If you are not working under an established operating system (i.e., ProDOS or Pascal): 1. Do not allow unclaimed interrupts to be fatal to your application. Ignore them. 2. Always service mouse interrupts within 1/60 of a second. If you are forced to disable interrupts for a longer period, first use SetMouse to set the mouse mode to 0, then call ServeMouse to clear any existing mouse interrupt. After interrupts are re-enabled, restore the mouse mode. If you are working under an established operating system (i.e., ProDOS or Pascal) for which unclaimed interrupts are fatal and the mouse is not the only interrupting device: 1. Write the mouse interrupt handler to claim all unclaimed interrupts and make sure the mouse interrupt handler is installed last, otherwise the interrupt will never get through to any interrupt handlers which follow that of the mouse. Note: This solution may cause cursor flicker by delaying the application's response to VBL interrupts. 2. Write a spurious interrupt handler (also known as a "daemon"), not associated with any device, which claims all unclaimed interrupts (i.e., clears the carry bit then exits). For the reason just mentioned, this interrupt handler must be installed last. Note: Under ProDOS, this limits the number if interrupting devices to three. This bug exists in the AppleMouse card, therefore you must deal with it when you are writing eight-bit programs for the Apple ][+, IIe, IIc and IIGS which use the mouse. The Apple IIGS does not have this bug in its internal mouse firmware, so sixteen-bit "native" mode programs are not affected by it.