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
|
2007-05-02 14:06:10 +02:00
|
|
|
|
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
|
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
|
2007-05-02 14:06:10 +02:00
|
|
|
|
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
|
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]
|
2007-05-02 14:06:10 +02:00
|
|
|
|
add EDX,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>
|
2005-10-06 19:56:22 +02:00
|
|
|
|
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>)
|
2007-05-02 14:06:10 +02:00
|
|
|
|
mov ecx, 0xFFFF
|
|
|
|
|
loop $
|
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>
|
2007-05-02 14:06:10 +02:00
|
|
|
|
mov al, 1
|
|
|
|
|
out dx, al
|
|
|
|
|
mov ecx, 0xFFFF
|
|
|
|
|
loop $
|
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>
|
2007-05-02 14:06:10 +02:00
|
|
|
|
sub edx, 4
|
2005-10-06 19:56:22 +02:00
|
|
|
|
in AL,DX
|
2007-05-02 14:06:10 +02:00
|
|
|
|
add edx, 4
|
|
|
|
|
mov AL,11b ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DTR <EFBFBD> RTS
|
|
|
|
|
out DX,AL
|
|
|
|
|
mov ecx, 0x1FFFF
|
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
|
|
|
|
|