PS/2 Mouse: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
→‎Mouse Device Over PS/2: Added command 0xE7 to table (per my own research)
→‎Mouse Device Over PS/2: Simplified mouse data packet table
Line 81:
! BYTE!!7!!6!!5!!4!!3!!2!!1!!0
|- align="center"
| 0 || yo || xo || ys || xs || ao1 || bm || br || bl
|- align="center"
| 1 || colspan="8" | xmX-Axis Movement Value
|- align="center"
| 2 || colspan="8" | ymY-Axis Movement Value
|}
{| class="wikitable"
Line 98:
| xs || X-Axis Sign Bit (9-Bit X-Axis Relative Offset)
|-
| ao1 || Always One
|-
| bm || Button Middle (Normally Off = 0)
Line 105:
|-
| bl || Button Left (Normally Off = 0)
|-
| xm || X-Axis Movement Value
|-
| ym || Y-Axis Movement Value
|}
 
Line 118 ⟶ 114:
''Being these 9-bit values are signed the above pseudo would work.''
 
Also, if you simply read the ''xm''X- or ''ym''Y-Axis Movement Value fields you will get an 8-bit unsigned value. Which, if used as unsigned will yield incorrect behavior. If you convert it into a signed 8-bit value you will get behavior that is similar to correct, but strange artifacts will appear when the mouse is moved fast. The correct way to produce a 9-bit or greater signed value is as follows:
<pre>
state = first_byte