2007-03-21 23:58:33 +01:00
|
|
|
|
$Revision$
|
2007-03-26 14:18:08 +02:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
|
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;**************************************************
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
|
|
|
;* COMPortNum <EFBFBD> COMPortBaseAddr <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
|
|
|
;**************************************************
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mario79
|
|
|
|
|
|
2006-01-06 12:46:26 +01:00
|
|
|
|
Detect_COM_Mouse:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
pusha
|
2006-01-06 12:46:26 +01:00
|
|
|
|
call MSMouseSearch
|
|
|
|
|
cmp AL,'M'
|
|
|
|
|
jne @f
|
|
|
|
|
mov [com1_mouse_detected],1
|
2006-03-11 19:10:47 +01:00
|
|
|
|
pusha
|
|
|
|
|
|
|
|
|
|
mov eax,4
|
|
|
|
|
shl eax,2
|
|
|
|
|
mov [irq_owner+eax],byte 1
|
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
|
inc dword [RESERVED_PORTS]
|
|
|
|
|
mov edi,[RESERVED_PORTS]
|
2006-03-11 19:10:47 +01:00
|
|
|
|
shl edi,4
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov [RESERVED_PORTS+edi+0],dword 1
|
|
|
|
|
mov [RESERVED_PORTS+edi+4],dword 0x3f0
|
|
|
|
|
mov [RESERVED_PORTS+edi+8],dword 0x3ff
|
2006-03-11 19:10:47 +01:00
|
|
|
|
|
|
|
|
|
popa
|
2006-01-06 12:46:26 +01:00
|
|
|
|
mov esi,boot_setmouse_type+22
|
|
|
|
|
call boot_log
|
|
|
|
|
@@:
|
|
|
|
|
sub [COMPortBaseAddr],100h
|
|
|
|
|
call MSMouseSearch
|
|
|
|
|
cmp AL,'M'
|
2007-03-01 21:32:19 +01:00
|
|
|
|
jne @f
|
2006-01-06 12:46:26 +01:00
|
|
|
|
mov [com2_mouse_detected],1
|
2006-03-11 19:10:47 +01:00
|
|
|
|
pusha
|
|
|
|
|
|
|
|
|
|
mov eax,3
|
|
|
|
|
shl eax,2
|
|
|
|
|
mov [irq_owner+eax],byte 1
|
2007-03-01 21:32:19 +01:00
|
|
|
|
|
|
|
|
|
inc dword [RESERVED_PORTS]
|
|
|
|
|
mov edi,[RESERVED_PORTS]
|
2006-03-11 19:10:47 +01:00
|
|
|
|
shl edi,4
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov [RESERVED_PORTS+edi+0],dword 1
|
|
|
|
|
mov [RESERVED_PORTS+edi+4],dword 0x2f0
|
|
|
|
|
mov [RESERVED_PORTS+edi+8],dword 0x2ff
|
2006-03-11 19:10:47 +01:00
|
|
|
|
|
|
|
|
|
popa
|
2006-01-06 12:46:26 +01:00
|
|
|
|
mov esi,boot_setmouse_type+44
|
|
|
|
|
call boot_log
|
|
|
|
|
@@:
|
|
|
|
|
popa
|
|
|
|
|
jmp end_detecting_mouse
|
|
|
|
|
|
|
|
|
|
MSMouseSearch:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> COM-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2005-10-06 19:56:22 +02:00
|
|
|
|
MouseSearch:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1200 <EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov DX,[COMPortBaseAddr]
|
|
|
|
|
add DX,3
|
|
|
|
|
in AL,DX
|
|
|
|
|
or AL,80h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> DLAB
|
|
|
|
|
out DX,AL
|
|
|
|
|
mov DX,[COMPortBaseAddr]
|
|
|
|
|
mov AL,60h ;1200 <EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
out DX,AL
|
|
|
|
|
inc DX
|
|
|
|
|
mov AL,0
|
|
|
|
|
out DX,AL
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 7 <EFBFBD><EFBFBD><EFBFBD>, 1 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>,
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov DX,[COMPortBaseAddr]
|
|
|
|
|
add DX,3
|
|
|
|
|
mov AL,00000010b
|
|
|
|
|
out DX,AL
|
2007-03-01 21:32:19 +01:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov DX,[COMPortBaseAddr]
|
|
|
|
|
inc DX
|
|
|
|
|
mov AL,0
|
|
|
|
|
out DX,AL
|
2007-03-01 21:32:19 +01:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> MSMouse
|
2007-03-01 21:32:19 +01:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov DX,[COMPortBaseAddr]
|
|
|
|
|
add DX,4 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov AL,0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DTR, RTS <EFBFBD> OUT2
|
|
|
|
|
out DX,AL
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5 "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" (0,2 <EFBFBD>)
|
|
|
|
|
mov ecx,0xffff
|
|
|
|
|
dT_1:
|
|
|
|
|
dec ecx
|
|
|
|
|
cmp ecx,0
|
|
|
|
|
jne dT_1
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov ecx,0xffff
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov AL,11b ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DTR <EFBFBD> RTS
|
|
|
|
|
out DX,AL
|
2007-03-01 21:32:19 +01:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov DX,[COMPortBaseAddr]
|
|
|
|
|
in AL,DX
|
2007-03-01 21:32:19 +01:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2005-10-06 19:56:22 +02:00
|
|
|
|
WaitData:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> 10 "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
dec ecx
|
|
|
|
|
cmp ecx,0
|
|
|
|
|
je NoMouse
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov DX,[COMPortBaseAddr]
|
|
|
|
|
add DX,5
|
|
|
|
|
in AL,DX
|
|
|
|
|
test AL,1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
|
|
|
|
jz WaitData
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov DX,[COMPortBaseAddr]
|
|
|
|
|
in AL,DX
|
|
|
|
|
NoMouse:
|
2006-01-06 12:46:26 +01:00
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
iglobal
|
|
|
|
|
COMPortBaseAddr dw 3F8h
|
2006-01-06 12:46:26 +01:00
|
|
|
|
;COMPortNum dw 0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
endg
|
|
|
|
|
|
|
|
|
|
iglobal
|
2006-01-06 12:46:26 +01:00
|
|
|
|
boot_setmouse_type db 'Detected - PS2 mouse',0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
db 'Detected - COM1 mouse',0
|
|
|
|
|
db 'Detected - COM2 mouse',0
|
|
|
|
|
endg
|
|
|
|
|
|
2006-01-06 12:46:26 +01:00
|
|
|
|
end_detecting_mouse:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|