1ced1382c9
git-svn-id: svn://kolibrios.org@381 a494cfbc-eb01-0410-851d-a64ba20cac60
131 lines
4.0 KiB
PHP
131 lines
4.0 KiB
PHP
; Íîìåð ïðèíèìàåìîãî îò ìûøè áàéòà
|
|
MouseByteNumber_1 DB 0
|
|
; Òðåõáàéòîâàÿ ñòðóêòóðà äàííûõ, ïåðåäàâàåìàÿ ìûøüþ
|
|
FirstByte_1 DB 0
|
|
SecondByte_1 DB 0
|
|
ThirdByte_1 DB 0
|
|
timer_ticks_com_1 dd 0
|
|
;***************************************
|
|
;* ÍÎÂÛÉ ÎÁÐÀÁÎÒ×ÈÊ ÏÐÅÐÛÂÀÍÈß ÎÒ ÌÛØÈ *
|
|
;***************************************
|
|
check_mouse_data_com2:
|
|
; cmp [com2_mouse_detected],0
|
|
; je @@EndMouseInterrupt_1
|
|
; Ïðîâåðèòü íàëè÷èå äàííûõ
|
|
mov DX,2F8h ;[COMPortBaseAddr]
|
|
add DX,5 ;xFDh
|
|
in AL,DX
|
|
test AL,1 ;Äàííûå ãîòîâû?
|
|
jz @@Error_1
|
|
; Ââåñòè äàííûå
|
|
mov DX,2F8h ;[COMPortBaseAddr] ;xF8h
|
|
in AL,DX
|
|
; Ñáðîñèòü ñòàðøèé íåçíà÷àùèé áèò
|
|
and AL,01111111b
|
|
|
|
; Îïðåäåëèòü ïîðÿäêîâûé íîìåð ïðèíèìàåìîãî áàéòà
|
|
cmp [MouseByteNumber_1],0
|
|
je @@FirstByte_1
|
|
cmp [MouseByteNumber_1],1
|
|
je @@SecondByte_1
|
|
cmp [MouseByteNumber_1],2
|
|
je @@ThirdByte_1
|
|
jmp @@Error_1
|
|
|
|
; Ñîõðàíèòü ïåðâûé áàéò äàííûõ
|
|
@@FirstByte_1:
|
|
test AL,1000000b ;Ïåðâûé áàéò ïîñûëêè?
|
|
jz @@Error_1
|
|
mov [FirstByte_1],AL
|
|
inc [MouseByteNumber_1] ;óâåëè÷èòü ñ÷åò÷èê
|
|
jmp @@EndMouseInterrupt_1
|
|
; Ñîõðàíèòü âòîðîé áàéò äàííûõ
|
|
@@SecondByte_1:
|
|
test AL,1000000b
|
|
jnz @@Error_1
|
|
mov [SecondByte_1],AL
|
|
inc [MouseByteNumber_1] ;óâåëè÷èòü ñ÷åò÷èê
|
|
jmp @@EndMouseInterrupt_1
|
|
; Ñîõðàíèòü òðåòèé áàéò äàííûõ
|
|
@@ThirdByte_1:
|
|
test AL,1000000b
|
|
jnz @@Error_1
|
|
mov [ThirdByte_1],AL ;óâåëè÷èòü ñ÷åò÷èê
|
|
mov [MouseByteNumber_1],0
|
|
; (Ïàêåò äàííûõ îò ìûøè ïðèíÿò ïîëíîñòüþ).
|
|
; Çàïèñàòü íîâîå çíà÷åíèå ñîñòîÿíèÿ êíîïîê ìûøè
|
|
mov al,[FirstByte_1] ;[0xfb01]
|
|
mov ah,al
|
|
shr al,3
|
|
and al,2
|
|
shr ah,5
|
|
and ah,1
|
|
add al,ah
|
|
mov [BTN_DOWN],al
|
|
mov [mouse_active],1
|
|
; Ïðèáàâèòü ïåðåìåùåíèå ïî X ê êîîðäèíàòå X
|
|
mov AL,[FirstByte_1]
|
|
shl AL,6
|
|
or AL,[SecondByte_1]
|
|
cbw
|
|
call mouse_acceleration_com2
|
|
add AX,[MOUSE_X] ;[XCoordinate]
|
|
; Êóðñîð íå äîëæåí âûõîäèòü çà ëåâóþ èëè
|
|
; ïðàâóþ ãðàíèöó ýêðàíà
|
|
js @@X1_1
|
|
cmp AX,[ScreenWidth] ;ScreenLength
|
|
jb @@X2_1
|
|
; Óñòàíîâèòü êîîðäèíàòó X ïî ïðàâîé ãðàíèöå
|
|
mov AX,[ScreenWidth] ;ScreenLength-1
|
|
dec ax
|
|
jmp @@X2_1
|
|
@@X1_1:
|
|
; Óñòàíîâèòü êîîðäèíàòó X ïî ëåâîé ãðàíèöå
|
|
xor AX,AX
|
|
@@X2_1:
|
|
mov [MOUSE_X],AX ;[XCoordinate]
|
|
; Ïðèáàâèòü ïåðåìåùåíèå ïî Y ê êîîðäèíàòå Y
|
|
mov AL,[FirstByte_1]
|
|
and AL,00001100b
|
|
shl AL,4
|
|
or AL,[ThirdByte_1]
|
|
cbw
|
|
call mouse_acceleration_com2
|
|
add AX,[MOUSE_Y] ;[YCoordinate]
|
|
; Êóðñîð íå äîëæåí âûõîäèòü çà âåðõíþþ èëè
|
|
; íèæíþþ ãðàíèöó ýêðàíà
|
|
js @@Y1_1
|
|
cmp AX,[ScreenHeight] ;ScreenHeigth
|
|
jb @@Y2_1
|
|
; Óñòàíîâèòü êîîðäèíàòó X ïî íèæíåé ãðàíèöå
|
|
mov AX,[ScreenHeight] ;ScreenHeigth-1
|
|
dec ax
|
|
jmp @@Y2_1
|
|
@@Y1_1:
|
|
; Óñòàíîâèòü êîîðäèíàòó X ïî âåðõíåé ãðàíèöå
|
|
xor AX,AX
|
|
@@Y2_1:
|
|
mov [MOUSE_Y],AX ;[YCoordinate]
|
|
mov eax,[timer_ticks]
|
|
mov [timer_ticks_com_1],eax
|
|
jmp @@EndMouseInterrupt_1
|
|
|
|
@@Error_1:
|
|
; Ïðîèçîøåë ñáîé â ïîðÿäêå ïåðåäà÷è èíôîðìàöèè îò
|
|
; ìûøè, îáíóëèòü ñ÷åò÷èê áàéòîâ ïàêåòà äàííûõ
|
|
mov [MouseByteNumber_1],0
|
|
@@EndMouseInterrupt_1:
|
|
call ready_for_next_irq
|
|
ret
|
|
|
|
mouse_acceleration_com2:
|
|
push eax
|
|
mov eax,[timer_ticks]
|
|
sub eax,[timer_ticks_com_1]
|
|
cmp eax,[mouse_delay]
|
|
pop eax
|
|
ja @f
|
|
imul ax,[mouse_speed_factor]
|
|
@@:
|
|
ret
|