Com mouse driver: added support for third button.

git-svn-id: svn://kolibrios.org@5075 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2014-09-01 09:26:41 +00:00
parent bb295aca38
commit 455fe89163
6 changed files with 33 additions and 20 deletions

View File

@ -4,7 +4,7 @@
# If delay is negative, wait for termination of the spawned process. Otherwise, simply wait
#
#/SYS/CROPFLAT "XS800 YS480" 1 # set limits of screen
#/SYS/LOADDRV "COM_MOUSE" 1 # serial mouse driver
#/SYS/LOADDRV "COMMOUSE" 1 # serial mouse driver
#/SYS/DEVELOP/BOARD "" 1 # Load DEBUG board
#/SYS/refrscrn "" 1 # Refresh screen
/SYS/LOADDRV "RDC" 1 # videodriver for RDC M2010/M2012

View File

@ -4,7 +4,7 @@
# If delay is negative, wait for termination of the spawned process. Otherwise, simply wait
#
#/SYS/CROPFLAT "XS800 YS480" 1 # set limits of screen
#/SYS/LOADDRV "COM_MOUSE" 1 # serial mouse driver
#/SYS/LOADDRV "COMMOUSE" 1 # serial mouse driver
#/SYS/DEVELOP/BOARD "" 1 # Load DEBUG board
#/SYS/refrscrn "" 1 # Refresh screen
/SYS/LOADDRV "RDC" 1 # videodriver for RDC M2010/M2012

View File

@ -4,7 +4,7 @@
# If delay is negative, wait for termination of the spawned process. Otherwise, simply wait
#
#/SYS/CROPFLAT "XS800 YS480" 1 # set limits of screen
#/SYS/LOADDRV "COM_MOUSE" 1 # serial mouse driver
#/SYS/LOADDRV "COMMOUSE" 1 # serial mouse driver
#/SYS/DEVELOP/BOARD "" 1 # Load DEBUG board
#/SYS/refrscrn "" 1 # Refresh screen
/SYS/LOADDRV "RDC" 1 # videodriver for RDC M2010/M2012

View File

@ -4,7 +4,7 @@
# If delay is negative, wait for termination of the spawned process. Otherwise, simply wait
#
#/SYS/CROPFLAT "XS800 YS480" 1 # set limits of screen
#/SYS/LOADDRV "COM_MOUSE" 1 # serial mouse driver
#/SYS/LOADDRV "COMMOUSE" 1 # serial mouse driver
#/SYS/DEVELOP/BOARD "" 1 # Load DEBUG board
#/SYS/refrscrn "" 1 # Refresh screen
/SYS/LOADDRV "RDC" 1 # videodriver for RDC M2010/M2012

View File

@ -4,7 +4,7 @@
# If delay is negative, wait for termination of the spawned process. Otherwise, simply wait
#
#/SYS/CROPFLAT "XS800 YS480" 1 # set limits of screen
#/SYS/LOADDRV "COM_MOUSE" 1 # serial mouse driver
#/SYS/LOADDRV "COMMOUSE" 1 # serial mouse driver
#/SYS/DEVELOP/BOARD "" 1 # Load DEBUG board
#/SYS/refrscrn "" 1 # Refresh screen
/SYS/LOADDRV "RDC" 1 # videodriver for RDC M2010/M2012

View File

@ -31,6 +31,9 @@ include '../fdo.inc'
; 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,37 +247,35 @@ irq_handler:
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
; 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
@ -285,14 +286,14 @@ irq_handler:
movzx eax, al
mov [BTN_DOWN], eax
; X coordinate
; X coordinate
mov al, [esi + com_mouse_data.data+0]
shl al, 6
or al, [esi + com_mouse_data.data+1]
movsx eax, al
mov [MOUSE_X], eax
; Y coordinate
; Y coordinate
mov al, [esi + com_mouse_data.data+0]
and al, 00001100b
shl al, 4
@ -303,14 +304,26 @@ irq_handler:
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
ret
; End of code
data fixups