&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.
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.
From a software point of view, just read the port and add its value to your position variable.
== Downloads ==