Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5074 → Rev 5075

/drivers/mouse/commouse.asm
31,6 → 31,9
; 2nd byte 0 X5 X4 X3 X2 X1 X0
; 3rd byte 0 Y5 Y4 Y3 Y2 Y1 Y0
 
; optional: (logitech extension protocol)
; 4th byte 0 MB 0 0 0 0 0
 
struct com_mouse_data
 
port dw ?
244,24 → 247,23
sub dx, 5
in al, dx
and al, 01111111b ; clear MSB (use 7 bit words)
test al, 01000000b ; First byte indicator set?
jnz .FirstByte
 
; Check which data byte we are reading
cmp [esi + com_mouse_data.offset], 2
ja .reset
cmp [esi + com_mouse_data.offset], 1
jb .SecondByte
je .ThirdByte
jp .SecondByte
ja .FourthByte
 
; read first data byte
test al, 01000000b ; First byte indicator set?
jz .reset
.FirstByte:
mov [esi + com_mouse_data.data+0], al
inc [esi + com_mouse_data.offset]
mov [esi + com_mouse_data.offset], 0
jmp .read_loop
 
; read second data byte
.SecondByte:
test al, 01000000b ; First byte indicator set?
jnz .reset
mov [esi + com_mouse_data.data+1], al
inc [esi + com_mouse_data.offset]
jmp .read_loop
268,13 → 270,12
 
; read third data byte
.ThirdByte:
test al, 01000000b ; First byte indicator set?
jnz .reset
mov [esi + com_mouse_data.data+2], al
inc [esi + com_mouse_data.offset]
 
; Data packet is complete, parse it and set mouse data
 
; Buttons
; Left and Right Buttons
mov al, [esi + com_mouse_data.data+0]
mov ah, al
shr al, 3 ; right mouse button
303,8 → 304,18
 
invoke SetMouseData, [BTN_DOWN], [MOUSE_X], [MOUSE_Y], 0, 0
 
.reset:
mov [esi + com_mouse_data.offset], 0
pop esi
mov al, 1
ret
 
.FourthByte:
inc [esi + com_mouse_data.offset]
 
test al, 00100000b
jz .end
or [BTN_DOWN], 100b
invoke SetMouseData, [BTN_DOWN], [MOUSE_X], [MOUSE_Y], 0, 0
 
.end:
pop esi
mov al, 1
311,6 → 322,8
ret
 
 
 
 
; End of code
 
data fixups