kolibrios/kernel/trunk/hid/m_com2.inc
Marat Zakiyanov (Mario79) 333b0bbae6 1) Parallel processing of mouses: PS2, COM1, COM2
2) Detection PS2 mouse.
3) Switching FPU in PM with reset.
4) Click on the application button - works only if during release of a up-button mouse the cursor is on the button application. Realization Victor Alberto Gil Hanla (vhanla). Version 1.1
5) Return of focus (activated window) on previous application at completion of the active application
6) Change skin of header of windows type 4, at loss and return of focus (activated window).

git-svn-id: svn://kolibrios.org@33 a494cfbc-eb01-0410-851d-a64ba20cac60
2006-01-06 11:46:26 +00:00

119 lines
3.6 KiB
PHP

; Íîìåð ïðèíèìàåìîãî îò ìûøè áàéòà
MouseByteNumber_1 DB 0
; Òðåõáàéòîâàÿ ñòðóêòóðà äàííûõ, ïåðåäàâàåìàÿ ìûøüþ
FirstByte_1 DB 0
SecondByte_1 DB 0
ThirdByte_1 DB 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 [0xfb40],al
mov [mouse_active],1
; Ïðèáàâèòü ïåðåìåùåíèå ïî X ê êîîðäèíàòå X
mov AL,[FirstByte_1]
shl AL,6
or AL,[SecondByte_1]
cbw
shl ax,1
add AX,[0xFB0A] ;[XCoordinate]
; Êóðñîð íå äîëæåí âûõîäèòü çà ëåâóþ èëè
; ïðàâóþ ãðàíèöó ýêðàíà
js @@X1_1
cmp AX,[0xFE00] ;ScreenLength
jb @@X2_1
; Óñòàíîâèòü êîîðäèíàòó X ïî ïðàâîé ãðàíèöå
mov AX,[0xFE00] ;ScreenLength-1
dec ax
jmp @@X2_1
@@X1_1:
; Óñòàíîâèòü êîîðäèíàòó X ïî ëåâîé ãðàíèöå
xor AX,AX
@@X2_1:
mov [0xFB0A],AX ;[XCoordinate]
; Ïðèáàâèòü ïåðåìåùåíèå ïî Y ê êîîðäèíàòå Y
mov AL,[FirstByte_1]
and AL,00001100b
shl AL,4
or AL,[ThirdByte_1]
cbw
shl ax,1
add AX,[0xFB0C] ;[YCoordinate]
; Êóðñîð íå äîëæåí âûõîäèòü çà âåðõíþþ èëè
; íèæíþþ ãðàíèöó ýêðàíà
js @@Y1_1
cmp AX,[0xFE04] ;ScreenHeigth
jb @@Y2_1
; Óñòàíîâèòü êîîðäèíàòó X ïî íèæíåé ãðàíèöå
mov AX,[0xFE04] ;ScreenHeigth-1
dec ax
jmp @@Y2_1
@@Y1_1:
; Óñòàíîâèòü êîîðäèíàòó X ïî âåðõíåé ãðàíèöå
xor AX,AX
@@Y2_1:
mov [0xFB0C],AX ;[YCoordinate]
jmp @@EndMouseInterrupt_1
@@Error_1:
; Ïðîèçîøåë ñáîé â ïîðÿäêå ïåðåäà÷è èíôîðìàöèè îò
; ìûøè, îáíóëèòü ñ÷åò÷èê áàéòîâ ïàêåòà äàííûõ
mov [MouseByteNumber_1],0
@@EndMouseInterrupt_1:
call ready_for_next_irq
ret