Changes
/* I/O ports */
Port &F995 : 0000YYYY : Input B, mouse Y
&F996 and &F997 ports are unused.
Buttons 1, 2, 3 are the same for joystick and mouse input A/B.
Mouse register X/Y return the offset since the last read. These are 4 bit value with sign extension. The 4 values are sign extended to 8 bit, so negative value will have bit7-4 at one. In fact bit 7-4 = bit 3.