Changes
/* I/O ports */
&F996 and &F997 ports are unused.
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.
Note also that the X/Y value will saturate if not read for a long time (or if the movement is fast). It will never overflow or wrap.