Ps/2 Compatible Mouse Driver -
Standard PS/2 mice report 3 bytes. However, support for the scroll wheel (IntelliMouse protocol) extends the packet to 4 bytes. To activate this, the driver must perform a specific "magic knock" sequence:
// Check Sign bits (Bit 4 and 5 of Byte 1) if (packet[0] & 0x10) x_movement |= 0xFF00; // Extend sign for 16-bit int if (packet[0] & 0x20) y_movement |= 0xFF00; ps/2 compatible mouse driver