* Unified COM1/COM2 mice handling.

* Corrected COM mouse detection.
* Mouse cursor can now be at right and bottom screen sides.
* Normal handling of "desktop background redraw" event.
  (Background redraw is faster now.)
* Fixed error in stretch background function for VESA 2.0.

git-svn-id: svn://kolibrios.org@473 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Evgeny Grechnikov (Diamond) 2007-05-02 12:06:10 +00:00
parent 0cca9c7b8c
commit 441fcf143a
9 changed files with 204 additions and 341 deletions

View File

@ -48,7 +48,7 @@ iglobal
times 12 dd unknown_interrupt
dd irq0 , irq_serv.irq_1, p_irq2 , p_irq3 ;irq_serv.irq_3
dd irq_serv.irq_4 ,irq_serv.irq_5,p_irq6,irq_serv.irq_7
dd p_irq4 ,irq_serv.irq_5,p_irq6,irq_serv.irq_7
dd irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10
dd irq_serv.irq_11,p_irq12,irqD ,p_irq14,p_irq15
@ -245,7 +245,9 @@ p_irq3:
mov es, ax
cmp [com2_mouse_detected],0
je old_irq3_handler
call check_mouse_data_com2
mov esi, com2_mouse
mov dx, 2F8h ;[COMPortBaseAddr]
call check_mouse_data_com
jmp p_irq3_1
old_irq3_handler:
mov edi,3
@ -261,7 +263,9 @@ p_irq4:
mov es, ax
cmp [com1_mouse_detected],0
je old_irq4_handler
call check_mouse_data_com1
mov esi, com1_mouse
mov dx, 3F8h ;[COMPortBaseAddr]
call check_mouse_data_com
jmp p_irq4_1
old_irq4_handler:
mov edi,4

View File

@ -21,20 +21,14 @@ Detect_COM_Mouse:
cmp AL,'M'
jne @f
mov [com1_mouse_detected],1
pusha
mov eax,4
shl eax,2
mov [irq_owner+eax], 1
inc dword [RESERVED_PORTS]
mov edi,[RESERVED_PORTS]
shl edi,4
mov [RESERVED_PORTS+edi+0],dword 1
mov [RESERVED_PORTS+edi+4],dword 0x3f0
mov [RESERVED_PORTS+edi+8],dword 0x3ff
popa
mov [irq_owner+4*4], 1 ; IRQ4 owner is System
mov eax, [RESERVED_PORTS]
inc eax
mov [RESERVED_PORTS], eax
shl eax, 4
mov [RESERVED_PORTS+eax+0], dword 1
mov [RESERVED_PORTS+eax+4], dword 0x3F8
mov [RESERVED_PORTS+eax+8], dword 0x3FF
mov esi,boot_setmouse_type+22
call boot_log
@@:
@ -43,20 +37,14 @@ Detect_COM_Mouse:
cmp AL,'M'
jne @f
mov [com2_mouse_detected],1
pusha
mov eax,3
shl eax,2
mov [irq_owner+eax], 1
inc dword [RESERVED_PORTS]
mov edi,[RESERVED_PORTS]
shl edi,4
mov [RESERVED_PORTS+edi+0],dword 1
mov [RESERVED_PORTS+edi+4],dword 0x2f0
mov [RESERVED_PORTS+edi+8],dword 0x2ff
popa
mov [irq_owner+3*4], 1 ; IRQ3 owner is System
mov eax, [RESERVED_PORTS]
inc eax
mov [RESERVED_PORTS], eax
shl eax, 4
mov [RESERVED_PORTS+eax+0], dword 1
mov [RESERVED_PORTS+eax+4], dword 0x2F8
mov [RESERVED_PORTS+eax+8], dword 0x2FF
mov esi,boot_setmouse_type+44
call boot_log
@@:
@ -94,22 +82,24 @@ MouseSearch:
; мышью типа MSMouse
; Отключить питание мыши и прерывани
mov DX,[COMPortBaseAddr]
add DX,4 ;ðåãèñòð óïðàâëåíèÿ ìîäåìîì
add EDX,4 ;ðåãèñòð óïðàâëåíèÿ ìîäåìîì
mov AL,0 ;сбросить DTR, RTS и OUT2
out DX,AL
; Ожидать 5 "тиков" (0,2 с)
mov ecx,0xffff
dT_1:
dec ecx
cmp ecx,0
jne dT_1
mov ecx,0xffff
mov ecx, 0xFFFF
loop $
; Включить питание мыши
mov al, 1
out dx, al
mov ecx, 0xFFFF
loop $
; Î÷èñòèòü ðåãèñòð äàííûõ
sub edx, 4
in AL,DX
add edx, 4
mov AL,11b ;установить DTR и RTS
out DX,AL
; Î÷èñòèòü ðåãèñòð äàííûõ
mov DX,[COMPortBaseAddr]
in AL,DX
mov ecx, 0x1FFFF
; Цикл опроса порта
WaitData:
; Ожидать еще 10 "тиков"

View File

@ -575,24 +575,28 @@ get_event_for_app:
no_eventoccur3:
;mov edi,[TASK_BASE] ; mouse event
mov eax, [CURRENT_TASK]
shl eax, 8
add eax, SLOT_BASE
test [edi+TASKDATA.event_mask],dword 00100000b
jz no_mouse_event
mov eax, [CURRENT_TASK]
shl eax, 8
test [eax+SLOT_BASE+APPDATA.event_mask],dword 00100000b
test [eax+APPDATA.event_mask],dword 00100000b
jz no_mouse_event
and [eax+SLOT_BASE+APPDATA.event_mask],dword (not 00100000b)
and [eax+APPDATA.event_mask],dword (not 00100000b)
popad
mov eax,6
ret
no_mouse_event:
;mov edi,[TASK_BASE] ; DESKTOP BACKGROUND REDRAW
test [edi+TASKDATA.event_mask],dword 16
test [edi+TASKDATA.event_mask], 16
jz no_eventoccur5
cmp [REDRAW_BACKGROUND],byte 2
jnz no_eventoccur5
; cmp [REDRAW_BACKGROUND],byte 2
; jnz no_eventoccur5
test [eax+APPDATA.event_mask], 16
jz no_eventoccur5
and [eax+APPDATA.event_mask], not 16
popad
mov eax,5
ret
@ -601,11 +605,9 @@ no_eventoccur5:
;mov edi,[TASK_BASE] ; IPC
test [edi+TASKDATA.event_mask],dword 01000000b
jz no_ipc
mov eax, [CURRENT_TASK]
shl eax, 8
test [eax+SLOT_BASE+APPDATA.event_mask],dword 01000000b
test [eax+APPDATA.event_mask],dword 01000000b
jz no_ipc
and [eax+SLOT_BASE+APPDATA.event_mask],dword 0xffffffff-01000000b
and [eax+APPDATA.event_mask],dword 0xffffffff-01000000b
popad
mov eax,7
ret
@ -614,11 +616,9 @@ no_ipc:
;mov edi,[TASK_BASE] ; STACK
test [edi+TASKDATA.event_mask],dword 10000000b
jz no_stack_event
mov eax, [CURRENT_TASK]
shl eax, 8
test [eax+SLOT_BASE+APPDATA.event_mask],dword 10000000b
test [eax+APPDATA.event_mask],dword 10000000b
jz no_stack_event
and [eax+SLOT_BASE+APPDATA.event_mask],dword 0xffffffff-10000000b
and [eax+APPDATA.event_mask],dword 0xffffffff-10000000b
popad
mov eax,8
ret
@ -626,11 +626,9 @@ no_stack_event:
test byte [edi+TASKDATA.event_mask+1], 1 ; DEBUG
jz .test_IRQ
mov eax, [CURRENT_TASK]
shl eax, 8
test byte [eax+SLOT_BASE+APPDATA.event_mask+1], byte 1
test byte [eax+APPDATA.event_mask+1], byte 1
jz .test_IRQ
and byte [eax+SLOT_BASE+APPDATA.event_mask+1], not 1
and byte [eax+APPDATA.event_mask+1], not 1
popad
mov eax, 9
ret

141
kernel/trunk/hid/m_com.inc Normal file
View File

@ -0,0 +1,141 @@
$Revision$
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
struc COM_MOUSE_DATA {
; Íîìåð ïðèíèìàåìîãî îò ìûøè áàéòà
.MouseByteNumber db ?
; Òðåõáàéòîâàÿ ñòðóêòóðà äàííûõ, ïåðåäàâàåìàÿ ìûøüþ
.FirstByte db ?
.SecondByte db ?
.ThirdByte db ?
.timer_ticks_com dd ?
}
virtual at 0
COM_MOUSE_DATA COM_MOUSE_DATA
end virtual
uglobal
com1_mouse COM_MOUSE_DATA
com2_mouse COM_MOUSE_DATA
endg
;***************************************
;* ÍÎÂÛÉ ÎÁÐÀÁÎÒ×ÈÊ ÏÐÅÐÛÂÀÍÈß ÎÒ ÌÛØÈ *
;***************************************
check_mouse_data_com:
; in: esi -> COM_MOUSE_DATA struc, dx = base port (xF8h)
add edx, 5 ; xFDh
in al, dx
test al, 1 ; Äàííûå ãîòîâû?
jz .Error
; Ââåñòè äàííûå
sub edx, 5
in al, dx
; Ñáðîñèòü ñòàðøèé íåçíà÷àùèé áèò
and al, 01111111b
; Îïðåäåëèòü ïîðÿäêîâûé íîìåð ïðèíèìàåìîãî áàéòà
cmp [esi+COM_MOUSE_DATA.MouseByteNumber], 2
ja .Error
jz .ThirdByte
jp .SecondByte
; Ñîõðàíèòü ïåðâûé áàéò äàííûõ
.FirstByte:
test al, 1000000b ; Ïåðâûé áàéò ïîñûëêè?
jz .Error
mov [esi+COM_MOUSE_DATA.FirstByte], al
inc [esi+COM_MOUSE_DATA.MouseByteNumber]
jmp .EndMouseInterrupt
; Ñîõðàíèòü âòîðîé áàéò äàííûõ
.SecondByte:
test al, 1000000b
jnz .Error
mov [esi+COM_MOUSE_DATA.SecondByte], al
inc [esi+COM_MOUSE_DATA.MouseByteNumber]
jmp .EndMouseInterrupt
; Ñîõðàíèòü òðåòèé áàéò äàííûõ
.ThirdByte:
test al, 1000000b
jnz .Error
mov [esi+COM_MOUSE_DATA.ThirdByte], al
mov [esi+COM_MOUSE_DATA.MouseByteNumber], 0
; (Ïàêåò äàííûõ îò ìûøè ïðèíÿò ïîëíîñòüþ).
; Çàïèñàòü íîâîå çíà÷åíèå ñîñòîÿíèÿ êíîïîê ìûøè
mov al, [esi+COM_MOUSE_DATA.FirstByte]
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, [esi+COM_MOUSE_DATA.FirstByte]
shl al, 6
or al, [esi+COM_MOUSE_DATA.SecondByte]
call mouse_acceleration_com
; mouse acceleration
mov ecx, [timer_ticks]
sub ecx, [esi+COM_MOUSE_DATA.timer_ticks_com]
cmp ecx, [mouse_delay]
ja @f
imul ax, [mouse_speed_factor]
@@:
add ax, [MOUSE_X]
; Êóðñîð íå äîëæåí âûõîäèòü çà ëåâóþ èëè ïðàâóþ ãðàíèöó ýêðàíà
js .x1
cmp ax, [ScreenWidth]
jb .x2
; Óñòàíîâèòü êîîðäèíàòó X ïî ïðàâîé ãðàíèöå
mov ax, [ScreenWidth]
jmp .x2
.x1:
; Óñòàíîâèòü êîîðäèíàòó X ïî ëåâîé ãðàíèöå
xor eax, eax
.x2:
mov [MOUSE_X], ax
; Ïðèáàâèòü ïåðåìåùåíèå ïî Y ê êîîðäèíàòå Y
mov al, [esi+COM_MOUSE_DATA.FirstByte]
and al, 00001100b
shl al, 4
or al, [esi+COM_MOUSE_DATA.ThirdByte]
call mouse_acceleration_com
add ax, [MOUSE_Y]
; Êóðñîð íå äîëæåí âûõîäèòü çà âåðõíþþ èëè íèæíþþ ãðàíèöó ýêðàíà
js .y1
cmp ax, [ScreenHeight]
jb .y2
; Óñòàíîâèòü êîîðäèíàòó Y ïî íèæíåé ãðàíèöå
mov ax, [ScreenHeight]
jmp .y2
.y1:
; Óñòàíîâèòü êîîðäèíàòó Y ïî âåðõíåé ãðàíèöå
xor eax, eax
.y2:
mov [MOUSE_Y], ax
mov eax, [timer_ticks]
mov [esi+COM_MOUSE_DATA.timer_ticks_com], eax
jmp .EndMouseInterrupt
.Error:
; Ïðîèçîøåë ñáîé â ïîðÿäêå ïåðåäà÷è èíôîðìàöèè îò
; ìûøè, îáíóëèòü ñ÷åò÷èê áàéòîâ ïàêåòà äàííûõ
mov [esi+COM_MOUSE_DATA.MouseByteNumber],0
.EndMouseInterrupt:
jmp ready_for_next_irq
mouse_acceleration_com:
cbw
mov ecx, [timer_ticks]
sub ecx, [esi+COM_MOUSE_DATA.timer_ticks_com]
cmp ecx, [mouse_delay]
ja @f
imul ax, [mouse_speed_factor]
@@:
ret

View File

@ -1,138 +0,0 @@
$Revision$
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Íîìåð ïðèíèìàåìîãî îò ìûøè áàéòà
MouseByteNumber DB 0
; Òðåõáàéòîâàÿ ñòðóêòóðà äàííûõ, ïåðåäàâàåìàÿ ìûøüþ
FirstByte DB 0
SecondByte DB 0
ThirdByte DB 0
timer_ticks_com dd 0
;***************************************
;* ÍÎÂÛÉ ÎÁÐÀÁÎÒ×ÈÊ ÏÐÅÐÛÂÀÍÈß ÎÒ ÌÛØÈ *
;***************************************
check_mouse_data_com1:
; cmp [com1_mouse_detected],0
; je @@EndMouseInterrupt
; Ïðîâåðèòü íàëè÷èå äàííûõ
mov DX,3F8h ;[COMPortBaseAddr]
add DX,5 ;xFDh
in AL,DX
test AL,1 ;Äàííûå ãîòîâû?
jz @@Error
; Ââåñòè äàííûå
mov DX,3F8h ;[COMPortBaseAddr] ;xF8h
in AL,DX
; Ñáðîñèòü ñòàðøèé íåçíà÷àùèé áèò
and AL,01111111b
; Îïðåäåëèòü ïîðÿäêîâûé íîìåð ïðèíèìàåìîãî áàéòà
cmp [MouseByteNumber],0
je @@FirstByte
cmp [MouseByteNumber],1
je @@SecondByte
cmp [MouseByteNumber],2
je @@ThirdByte
jmp @@Error
; Ñîõðàíèòü ïåðâûé áàéò äàííûõ
@@FirstByte:
test AL,1000000b ;Ïåðâûé áàéò ïîñûëêè?
jz @@Error
mov [FirstByte],AL
inc [MouseByteNumber] ;óâåëè÷èòü ñ÷åò÷èê
jmp @@EndMouseInterrupt
; Ñîõðàíèòü âòîðîé áàéò äàííûõ
@@SecondByte:
test AL,1000000b
jnz @@Error
mov [SecondByte],AL
inc [MouseByteNumber] ;óâåëè÷èòü ñ÷åò÷èê
jmp @@EndMouseInterrupt
; Ñîõðàíèòü òðåòèé áàéò äàííûõ
@@ThirdByte:
test AL,1000000b
jnz @@Error
mov [ThirdByte],AL ;óâåëè÷èòü ñ÷åò÷èê
mov [MouseByteNumber],0
; (Ïàêåò äàííûõ îò ìûøè ïðèíÿò ïîëíîñòüþ).
; Çàïèñàòü íîâîå çíà÷åíèå ñîñòîÿíèÿ êíîïîê ìûøè
mov al,[FirstByte] ;[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]
shl AL,6
or AL,[SecondByte]
cbw
call mouse_acceleration_com1
add AX,[MOUSE_X] ;[XCoordinate]
; Êóðñîð íå äîëæåí âûõîäèòü çà ëåâóþ èëè
; ïðàâóþ ãðàíèöó ýêðàíà
js @@X1
cmp AX,[ScreenWidth] ;ScreenLength
jb @@X2
; Óñòàíîâèòü êîîðäèíàòó X ïî ïðàâîé ãðàíèöå
mov AX,[ScreenWidth] ;ScreenLength-1
dec ax
jmp @@X2
@@X1:
; Óñòàíîâèòü êîîðäèíàòó X ïî ëåâîé ãðàíèöå
xor AX,AX
@@X2:
mov [MOUSE_X],AX ;[XCoordinate]
; Ïðèáàâèòü ïåðåìåùåíèå ïî Y ê êîîðäèíàòå Y
mov AL,[FirstByte]
and AL,00001100b
shl AL,4
or AL,[ThirdByte]
cbw
call mouse_acceleration_com1
add AX,[MOUSE_Y] ;[YCoordinate]
; Êóðñîð íå äîëæåí âûõîäèòü çà âåðõíþþ èëè
; íèæíþþ ãðàíèöó ýêðàíà
js @@Y1
cmp AX,[ScreenHeight] ;ScreenHeigth
jb @@Y2
; Óñòàíîâèòü êîîðäèíàòó X ïî íèæíåé ãðàíèöå
mov AX,[ScreenHeight] ;ScreenHeigth-1
dec ax
jmp @@Y2
@@Y1:
; Óñòàíîâèòü êîîðäèíàòó X ïî âåðõíåé ãðàíèöå
xor AX,AX
@@Y2:
mov [MOUSE_Y],AX ;[YCoordinate]
mov eax,[timer_ticks]
mov [timer_ticks_com],eax
jmp @@EndMouseInterrupt
@@Error:
; Ïðîèçîøåë ñáîé â ïîðÿäêå ïåðåäà÷è èíôîðìàöèè îò
; ìûøè, îáíóëèòü ñ÷åò÷èê áàéòîâ ïàêåòà äàííûõ
mov [MouseByteNumber],0
@@EndMouseInterrupt:
call ready_for_next_irq
ret
mouse_acceleration_com1:
push eax
mov eax,[timer_ticks]
sub eax,[timer_ticks_com]
cmp eax,[mouse_delay]
pop eax
ja @f
imul ax,[mouse_speed_factor]
@@:
ret

View File

@ -1,138 +0,0 @@
$Revision$
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Íîìåð ïðèíèìàåìîãî îò ìûøè áàéòà
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

View File

@ -24,12 +24,13 @@ uglobal
mousedata dd 0x0
endg
iglobal
mouse_delay dd 10
mouse_speed_factor dw 3
endg
include 'm_ps2.inc'
include 'm_com1.inc'
include 'm_com2.inc'
include 'm_com.inc'
;test_mario79:

View File

@ -3395,8 +3395,14 @@ mouse_not_active:
jz nobackgr
cmp [background_defined], 0
jz nobackgr
mov [REDRAW_BACKGROUND],byte 2
call change_task
; mov [REDRAW_BACKGROUND],byte 2
; call change_task
xor edi, edi
mov ecx, [TASK_COUNT]
set_bgr_event:
add edi, 256
or [edi+SLOT_BASE+APPDATA.event_mask], 16
loop set_bgr_event
mov [draw_data+32 + RECT.left],dword 0
mov [draw_data+32 + RECT.top],dword 0
mov eax,[ScreenWidth]

View File

@ -890,7 +890,6 @@ vesa20_drawbackground_stretch:
push edx
mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin)
mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin)
dec ebx
mov eax,[BytesPerScanLine]
mul ebx
xchg ebp, eax ; BytesPerScanLine*(Ywin+y)