Com mouse cod moved to driver.

Begin of reorganization interrupts handlers Part 1.
Some dead code deleted.

git-svn-id: svn://kolibrios.org@769 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Rus 2008-03-13 20:23:15 +00:00
parent 88d5b111cd
commit 07985443ea
11 changed files with 711 additions and 730 deletions

View File

@ -1,7 +1,7 @@
@echo off
set languages=en ru ge et
set drivers=sound sis infinity ensoniq ps2mouse uart ati2d vmode
set drivers=sound sis infinity ensoniq ps2mouse com_mouse uart ati2d vmode
set targets=all kernel drivers skins clean
call :Check_Target %1

View File

@ -16,20 +16,29 @@ DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT
align 4
proc attach_int_handler stdcall, irq:dword, handler:dword
mov ebx, [irq] ;irq num
test ebx, ebx
jz .err
cmp ebx, 15 ; hidnplayr says: we only have 16 IRQ's
ja .err
mov eax, [handler]
test eax, eax
jz .err
mov [irq_tab+ebx*4], eax
stdcall enable_irq, [irq]
ret
mov ebx, [irq] ;irq num
test ebx, ebx
jz .err
cmp ebx, 15 ; hidnplayr says: we only have 16 IRQ's
ja .err
mov eax, [handler]
test eax, eax
jz .err
cmp [irq_owner + 4 * ebx], 0
jne .err
mov [irq_tab+ebx*4], eax
;push eax
;mov eax, [TASK_BASE]
;mov eax, [eax + TASKDATA.pid]
mov [irq_owner + 4 * ebx], 1
;pop eax
stdcall enable_irq, [irq]
ret
.err:
xor eax, eax
ret
xor eax, eax
ret
endp
align 4
@ -59,89 +68,75 @@ align 16
irq_serv:
.irq_1:
push eax
mov eax, 1
push 1
jmp .main
align 4
.irq_2:
push eax
mov eax, 2
push 2
jmp .main
align 4
.irq_3:
push eax
mov eax, 3
push 3
jmp .main
align 4
.irq_4:
push eax
mov eax, 4
push 4
jmp .main
align 4
.irq_5:
push eax
mov eax, 5
push 5
jmp .main
align 4
.irq_6:
push eax
mov eax, 6
push 6
jmp .main
align 4
.irq_7:
push eax
mov eax, 7
push 7
jmp .main
align 4
.irq_8:
push eax
mov eax, 8
push 8
jmp .main
align 4
.irq_9:
push eax
mov eax, 9
push 9
jmp .main
align 4
.irq_10:
push eax
mov eax, 10
push 10
jmp .main
align 4
.irq_11:
push eax
mov eax, 11
push 11
jmp .main
align 4
.irq_12:
push eax
mov eax, 12
push 12
jmp .main
align 4
.irq_13:
push eax
mov eax, 13
push 13
jmp .main
align 4
.irq_14:
push eax
mov eax, 14
push 14
jmp .main
align 4
.irq_15:
push eax
mov eax, 15
push 15
jmp .main
align 16
.main:
save_ring3_context
mov eax, [esp + 32]
mov bx, app_data ;os_data
mov ds, bx
mov es, bx
cmp [v86_irqhooks+eax*8], 0
jnz v86_irq
cmp [v86_irqhooks+eax*8], 0
jnz v86_irq
mov ebx, [irq_tab+eax*4]
test ebx, ebx
@ -151,16 +146,17 @@ align 16
mov [check_idle_semaphore],5
.exit:
restore_ring3_context
cmp eax, 8
cmp dword [esp + 32], 8
mov al, 0x20
jb @f
out 0xa0, al
@@:
out 0x20, al
pop eax
restore_ring3_context
add esp, 4
iret
align 4
@ -183,7 +179,7 @@ endp
align 4
proc pci_read32 stdcall, bus:dword, devfn:dword, reg:dword
push ebx
push ebx
xor eax, eax
xor ebx, ebx
mov ah, byte [bus]
@ -191,13 +187,13 @@ proc pci_read32 stdcall, bus:dword, devfn:dword, reg:dword
mov bh, byte [devfn]
mov bl, byte [reg]
call pci_read_reg
pop ebx
pop ebx
ret
endp
align 4
proc pci_read16 stdcall, bus:dword, devfn:dword, reg:dword
push ebx
push ebx
xor eax, eax
xor ebx, ebx
mov ah, byte [bus]
@ -205,13 +201,13 @@ proc pci_read16 stdcall, bus:dword, devfn:dword, reg:dword
mov bh, byte [devfn]
mov bl, byte [reg]
call pci_read_reg
pop ebx
pop ebx
ret
endp
align 4
proc pci_read8 stdcall, bus:dword, devfn:dword, reg:dword
push ebx
push ebx
xor eax, eax
xor ebx, ebx
mov ah, byte [bus]
@ -219,13 +215,13 @@ proc pci_read8 stdcall, bus:dword, devfn:dword, reg:dword
mov bh, byte [devfn]
mov bl, byte [reg]
call pci_read_reg
pop ebx
pop ebx
ret
endp
align 4
proc pci_write8 stdcall, bus:dword, devfn:dword, reg:dword, val:dword
push ebx
push ebx
xor eax, eax
xor ebx, ebx
mov ah, byte [bus]
@ -234,13 +230,13 @@ proc pci_write8 stdcall, bus:dword, devfn:dword, reg:dword, val:dword
mov bl, byte [reg]
mov ecx, [val]
call pci_write_reg
pop ebx
pop ebx
ret
endp
align 4
proc pci_write16 stdcall, bus:dword, devfn:dword, reg:dword, val:dword
push ebx
push ebx
xor eax, eax
xor ebx, ebx
mov ah, byte [bus]
@ -249,13 +245,13 @@ proc pci_write16 stdcall, bus:dword, devfn:dword, reg:dword, val:dword
mov bl, byte [reg]
mov ecx, [val]
call pci_write_reg
pop ebx
pop ebx
ret
endp
align 4
proc pci_write32 stdcall, bus:dword, devfn:dword, reg:dword, val:dword
push ebx
push ebx
xor eax, eax
xor ebx, ebx
mov ah, byte [bus]
@ -264,7 +260,7 @@ proc pci_write32 stdcall, bus:dword, devfn:dword, reg:dword, val:dword
mov bl, byte [reg]
mov ecx, [val]
call pci_write_reg
pop ebx
pop ebx
ret
endp
@ -363,30 +359,30 @@ endp
align 4
proc reg_service stdcall, name:dword, handler:dword
xor eax, eax
xor eax, eax
cmp [name], eax
je .fail
cmp [name], eax
je .fail
cmp [handler], eax
je .fail
cmp [handler], eax
je .fail
push ebx
push ebx
mov eax, SRV_SIZE
call malloc ;call alloc_service
pop ebx
pop ebx
test eax, eax
jz .fail
push ebx
push esi
push edi
push ebx
push esi
push edi
mov edi, eax
mov esi, [name]
mov esi, [name]
mov ecx, 16/4
rep movsd
pop edi
pop esi
pop edi
pop esi
mov [eax+SRV.magic], ' SRV'
mov [eax+SRV.size], SRV_SIZE
@ -398,13 +394,13 @@ proc reg_service stdcall, name:dword, handler:dword
mov [ebx+SRV.fd], eax
mov [edx+SRV.bk], eax
mov ecx, [handler]
mov ecx, [handler]
mov [eax+SRV.srv_proc], ecx
pop ebx
ret
pop ebx
ret
.fail:
xor eax, eax
ret
ret
endp
align 4
@ -1051,12 +1047,12 @@ proc stop_all_services
cmp [edx+SRV.size], SRV_SIZE
jne .next
mov ebx, [edx+SRV.entry]
mov ebx, [edx+SRV.entry]
mov edx, [edx+SRV.fd]
test ebx, ebx
jz .next
test ebx, ebx
jz .next
push edx
push edx
stdcall ebx, dword -1
pop edx
jmp .next

View File

@ -18,6 +18,8 @@ iglobal
szAttachIntHandler db 'AttachIntHandler',0
szFpuSave db 'FpuSave',0
szFpuRestore db 'FpuRestore',0
szReservePortArea db 'ReservePortArea',0
szBoot_Log db 'Boot_Log',0
szPciApi db 'PciApi', 0
szPciRead32 db 'PciRead32', 0
@ -33,7 +35,7 @@ iglobal
szGetPgAddr db 'GetPgAddr',0
szMapPage db 'MapPage',0
szMapSpace db 'MapSpace',0
szMapIoMem db 'MapIoMem',0
szMapIoMem db 'MapIoMem',0
szCommitPages db 'CommitPages',0
szReleasePages db 'ReleasePages',0
@ -88,6 +90,8 @@ kernel_export:
dd szAttachIntHandler, attach_int_handler
dd szFpuSave , fpu_save
dd szFpuRestore , fpu_restore
dd szReservePortArea , r_f_port_area
dd szBoot_Log , boot_log
dd szPciApi , pci_api
dd szPciRead32 , pci_read32
@ -102,7 +106,7 @@ kernel_export:
dd szFreePage , free_page
dd szMapPage , map_page ;stdcall
dd szMapSpace , map_space
dd szMapIoMem , map_io_mem ;stdcall
dd szMapIoMem , map_io_mem ;stdcall
dd szGetPgAddr , get_pg_addr
dd szCommitPages , commit_pages ;not implemented
dd szReleasePages , release_pages

View File

@ -183,20 +183,12 @@ macro irqh [num]
{
forward
p_irq#num :
save_ring3_context
mov edi, num
jmp irq_c
jmp irqhandler
}
irqh 2,5,7,8,9,10,11
irqh 2,3,4,5,7,8,9,10,11
irq_c:
mov ax, app_data ;os_data
mov ds, ax
mov es, ax
call irqhandler
restore_ring3_context
iret
p_irq6:
save_ring3_context
@ -208,41 +200,6 @@ p_irq6:
restore_ring3_context
iret
p_irq3:
save_ring3_context
mov ax, app_data ;os_data
mov ds, ax
mov es, ax
cmp [com2_mouse_detected],0
je old_irq3_handler
mov esi, com2_mouse
mov dx, 2F8h ;[COMPortBaseAddr]
call check_mouse_data_com
jmp p_irq3_1
old_irq3_handler:
mov edi,3
call irqhandler
p_irq3_1:
restore_ring3_context
iret
p_irq4:
save_ring3_context
mov ax, app_data ;os_data
mov ds, ax
mov es, ax
cmp [com1_mouse_detected],0
je old_irq4_handler
mov esi, com1_mouse
mov dx, 3F8h ;[COMPortBaseAddr]
call check_mouse_data_com
jmp p_irq4_1
old_irq4_handler:
mov edi,4
call irqhandler
p_irq4_1:
restore_ring3_context
iret
p_irq14:
save_ring3_context
@ -303,7 +260,6 @@ irqhandler:
cmp [v86_irqhooks+edi*8], 0
jnz v86_irq2
push edi
mov esi,edi ; 1
shl esi,6 ; 1
@ -312,8 +268,6 @@ irqhandler:
add edi,IRQ_SAVE
mov ecx,16
mov [check_idle_semaphore],5
irqnewread:
dec ecx
js irqover
@ -368,15 +322,6 @@ irqhandler:
irqfull:
irqover:
mov al,0x20 ; ready for next irq
out 0x20,al
pop ebx
cmp ebx,7
jbe noa0
out 0xa0,al
noa0:
ret

View File

@ -68,7 +68,7 @@ keymap_alt:
boot_failed db 'Failed to start first app',0
boot_mtrr db 'Setting MTRR',0
if preboot_blogesc
boot_tasking db 'All set - press ESC to start',0
boot_tasking db 'All set - press ESC to start',0
end if
new_process_loading db 'K : New Process - loading',13,10,0
@ -88,6 +88,7 @@ AMD_str db "AuthenticAMD",0
;szInfinity db 'INFINITY',0
szHwMouse db 'ATI2D',0
szPS2MDriver db 'PS2MOUSE',0
szCOM_MDriver db 'COM_MOUSE',0
szUSB db 'USB',0
szSTART db 'START',0
@ -385,8 +386,7 @@ hd_entries rd 1 ;unused ? 0xfe10
mouse_active rd 1
mouse_pause rd 1
MouseTickCounter rd 1
com1_mouse_detected rb 1
com2_mouse_detected rb 1
;* end code - Mario79
img_background rd 1

View File

@ -1,135 +0,0 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$Revision$
;**************************************************
;* ÏÎÈÑÊ ÌÛØÈ ÏÎ ÏÎÑËÅÄÎÂÀÒÅËÜÍÛÌ ÏÎÐÒÀÌ *
;* Ïðîöåäóðà ïîäãîòàâëèâàåò ãëîáàëüíûå ïåðåìåííûå *
;* COMPortNum è COMPortBaseAddr äëÿ ïîäïðîãðàììû *
;* óñòàíîâêè îáðàáîò÷èêà ïðåðûâàíèÿ *
;**************************************************
; Àâòîð èñõîäíîãî òåêñòà Êóëàêîâ Âëàäèìèð Ãåííàäüåâè÷.
; Àäàïòàöèÿ è äîðàáîòêà Mario79
Detect_COM_Mouse:
pusha
call MSMouseSearch
cmp AL,'M'
jne @f
mov [com1_mouse_detected],1
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
@@:
sub [COMPortBaseAddr],100h
call MSMouseSearch
cmp AL,'M'
jne @f
mov [com2_mouse_detected],1
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
@@:
popa
jmp end_detecting_mouse
MSMouseSearch:
; ÏÎÈÑÊ ÌÛØÈ ×ÅÐÅÇ COM-ÏÎÐÒÛ
MouseSearch:
; Óñòàíàâëèâàåì ñêîðîñòü
; ïðèåìà/ïåðåäà÷è 1200 áîä
mov DX,[COMPortBaseAddr]
add DX,3
in AL,DX
or AL,80h ;óñòàíîâèòü áèò DLAB
out DX,AL
mov DX,[COMPortBaseAddr]
mov AL,60h ;1200 áîä
out DX,AL
inc DX
mov AL,0
out DX,AL
; Óñòàíîâèòü äëèíó ñëîâà 7 áèò, 1 ñòîïîâûé áèò,
; ÷åòíîñòü íå êîíòðîëèðîâàòü
mov DX,[COMPortBaseAddr]
add DX,3
mov AL,00000010b
out DX,AL
; Çàïðåòèòü âñå ïðåðûâàíè
mov DX,[COMPortBaseAddr]
inc DX
mov AL,0
out DX,AL
; Ïðîâåðèòü, ÷òî óñòðîéñòâî ïîäêëþ÷åíî è ÿâëÿåòñ
; ìûøüþ òèïà MSMouse
; Îòêëþ÷èòü ïèòàíèå ìûøè è ïðåðûâàíè
mov DX,[COMPortBaseAddr]
add EDX,4 ;ðåãèñòð óïðàâëåíèÿ ìîäåìîì
mov AL,0 ;ñáðîñèòü DTR, RTS è OUT2
out DX,AL
; Îæèäàòü 5 "òèêîâ" (0,2 ñ)
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 ecx, 0x1FFFF
; Öèêë îïðîñà ïîðòà
WaitData:
; Îæèäàòü åùå 10 "òèêîâ"
dec ecx
cmp ecx,0
je NoMouse
; Ïðîâåðèòü íàëè÷èå èäåíòèôèêàöèîííîãî áàéòà
mov DX,[COMPortBaseAddr]
add DX,5
in AL,DX
test AL,1 ;Äàííûå ãîòîâû?
jz WaitData
; Ââåñòè äàííûå
mov DX,[COMPortBaseAddr]
in AL,DX
NoMouse:
ret
iglobal
COMPortBaseAddr dw 3F8h
;COMPortNum dw 0
endg
iglobal
boot_setmouse_type db 'Detected - PS2 mouse',0
db 'Detected - COM1 mouse',0
db 'Detected - COM2 mouse',0
endg
end_detecting_mouse:

View File

@ -0,0 +1,375 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;driver sceletone
format MS COFF
API_VERSION equ 5 ;debug
include 'proc32.inc'
include 'imports.inc'
OS_BASE equ 0x80000000;
new_app_base equ 0x0
PROC_BASE equ OS_BASE+0x0080000
struc IOCTL
{ .handle dd ?
.io_code dd ?
.input dd ?
.inp_size dd ?
.output dd ?
.out_size dd ?
}
virtual at 0
IOCTL IOCTL
end virtual
public START
public version
DEBUG equ 0
DRV_ENTRY equ 1
DRV_EXIT equ -1
STRIDE equ 4 ;size of row in devices table
SRV_GETVERSION equ 0
section '.flat' code readable align 16
proc START stdcall, state:dword
cmp [state], 1
jne .exit
.entry:
;Detect_COM_Mouse:
if DEBUG
mov esi, msgInit
call Boot_Log
end if
mov bx, 0x3f8
call MSMouseSearch
cmp AL,'M'
jne @f
;mov [com1_mouse_detected],1
;mov [irq_owner+4*4], 1 ; IRQ4 owner is System
mov dx, bx
inc dx ; 0x3f8 + 1
mov al, 1
out dx, al
stdcall AttachIntHandler, 4, irq4_handler
if DEBUG
cmp eax, 0
jne .label1
mov esi, msg_error_attach_int_handler
call Boot_Log
end if
.label1:
mov eax, 0
mov ebx, 0x3F8
mov ecx, 0x3FF
call ReservePortArea
if DEBUG
cmp eax, 1
jne .go
mov esi, msg_error_reserve_ports
call Boot_Log
.go:
mov esi,boot_setmouse_type
call Boot_Log
end if
@@:
mov bx, 0x2f8
call MSMouseSearch
cmp AL,'M'
jne .resume
;mov [com2_mouse_detected],1
;mov [irq_owner+3*4], 1 ; IRQ3 owner is System
stdcall AttachIntHandler, 3, irq3_handler
mov eax, 0
mov ebx, 0x2F8
mov ecx, 0x3F8
call ReservePortArea
if DEBUG
cmp eax, 1
jne @f
mov esi, msg_error_reserve_ports
call Boot_Log
@@:
mov esi,boot_setmouse_type + 22
call Boot_Log
end if
.resume:
stdcall RegService, my_service, service_proc
if DEBUG
cmp eax, 0
jne @f
mov esi, msg_exit
call Boot_Log
end if
@@:
ret
.fail:
.exit:
if DEBUG
mov esi, msg_exit
call Boot_Log
end if
xor eax, eax
ret
endp
handle equ IOCTL.handle
io_code equ IOCTL.io_code
input equ IOCTL.input
inp_size equ IOCTL.inp_size
output equ IOCTL.output
out_size equ IOCTL.out_size
align 4
proc service_proc stdcall, ioctl:dword
mov ebx, [ioctl]
mov eax, [ebx+io_code]
cmp eax, SRV_GETVERSION
jne @F
mov eax, [ebx+output]
cmp [ebx+out_size], 4
jne .fail
mov [eax], dword API_VERSION
xor eax, eax
ret
@@:
.fail:
or eax, -1
ret
endp
align 4
MSMouseSearch:
; ÏÎÈÑÊ ÌÛØÈ ×ÅÐÅÇ COM-ÏÎÐÒÛ
MouseSearch:
; Óñòàíàâëèâàåì ñêîðîñòü
; ïðèåìà/ïåðåäà÷è 1200 áîä
; in bx COM Port Base Address
mov DX, bx
add DX,3
in AL,DX
or AL,80h ;óñòàíîâèòü áèò DLAB
out DX,AL
mov DX, bx
mov AL,60h ;1200 áîä
out DX,AL
inc DX
mov AL,0
out DX,AL
; Óñòàíîâèòü äëèíó ñëîâà 7 áèò, 1 ñòîïîâûé áèò,
; ÷åòíîñòü íå êîíòðîëèðîâàòü
mov DX, bx
add DX,3
mov AL,00000010b
out DX,AL
; Çàïðåòèòü âñå ïðåðûâàíè
mov dx, bx
inc dx
mov AL,0
out DX,AL
; Ïðîâåðèòü, ÷òî óñòðîéñòâî ïîäêëþ÷åíî è ÿâëÿåòñ
; ìûøüþ òèïà MSMouse
; Îòêëþ÷èòü ïèòàíèå ìûøè è ïðåðûâàíè
mov DX, bx
add EDX,4 ;ðåãèñòð óïðàâëåíèÿ ìîäåìîì
mov AL,0 ;ñáðîñèòü DTR, RTS è OUT2
out DX,AL
; Îæèäàòü 5 "òèêîâ" (0,2 ñ)
mov ecx, 0xFFFF
loop $
; Âêëþ÷èòü ïèòàíèå ìûøè
mov al, 1
out dx, al
mov ecx, 0xFFFF
loop $
; Î÷èñòèòü ðåãèñòð äàííûõ
mov dx, bx
in AL,DX
add edx, 4
mov AL, 1011b ;óñòàíîâèòü DTR è RTS è OUT2
out DX,AL
mov ecx, 0x1FFFF
; Öèêë îïðîñà ïîðòà
WaitData:
; Îæèäàòü åùå 10 "òèêîâ"
dec ecx
cmp ecx,0
je NoMouse
; Ïðîâåðèòü íàëè÷èå èäåíòèôèêàöèîííîãî áàéòà
mov DX, bx
add DX,5
in AL,DX
test AL,1 ;Äàííûå ãîòîâû?
jz WaitData
; Ââåñòè äàííûå
mov DX, bx
in AL,DX
NoMouse:
ret
align 4
irq3_handler:
mov dx, 0x2f8
mov esi, com2_mouse
jmp irq_handler
align 4
irq4_handler:
mov dx, 0x3f8
mov esi, com1_mouse
irq_handler:
; 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
movzx eax, al
mov [BTN_DOWN], eax
; Ïðèáàâèòü ïåðåìåùåíèå ïî X ê êîîðäèíàòå X
mov al, [esi+COM_MOUSE_DATA.FirstByte]
shl al, 6
or al, [esi+COM_MOUSE_DATA.SecondByte]
cbw
movzx eax, ax
mov [MOUSE_X], eax
; Ïðèáàâèòü ïåðåìåùåíèå ïî Y ê êîîðäèíàòå Y
mov al, [esi+COM_MOUSE_DATA.FirstByte]
and al, 00001100b
shl al, 4
or al, [esi+COM_MOUSE_DATA.ThirdByte]
cbw
movzx eax, ax
neg eax
mov [MOUSE_Y], eax
stdcall SetMouseData, [BTN_DOWN], [MOUSE_X], [MOUSE_Y], 0, 0
jmp .EndMouseInterrupt
.Error:
; Ïðîèçîøåë ñáîé â ïîðÿäêå ïåðåäà÷è èíôîðìàöèè îò
; ìûøè, îáíóëèòü ñ÷åò÷èê áàéòîâ ïàêåòà äàííûõ
mov [esi+COM_MOUSE_DATA.MouseByteNumber],0
.EndMouseInterrupt:
ret
;all initialized data place here
align 4
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
com1_mouse COM_MOUSE_DATA
com2_mouse COM_MOUSE_DATA
MOUSE_X dd 0
MOUSE_Y dd 0
BTN_DOWN dd 0
COMPortBaseAddr dw 3F8h
version dd (5 shl 16) or (API_VERSION and 0xFFFF)
my_service db 'MY_SERVICE',0 ;max 16 chars include zero
if DEBUG
msgInit db 'Preved bugoga!',13,10,0
boot_setmouse_type db 'Detected - COM1 mouse',13,10,0
db 'Detected - COM2 mouse',13,10,0
msg_error_reserve_ports db 'Error reserving ports!',13,10,0
msg_error_attach_int_handler db 'Error attach interrupt handler!',13,10,0
msg_exit db 'Exit!',13,10,0
end if
section '.data' data readable writable align 16
;all uninitialized data place here

View File

@ -21,6 +21,8 @@ kernel_export \
AttachIntHandler,\
FpuSave,\
FpuRestore,\
ReservePortArea,\
Boot_Log,\
\
PciApi,\
PciRead32,\
@ -35,7 +37,7 @@ kernel_export \
FreePage,\
MapPage,\
MapSpace,\
MapIoMem,\
MapIoMem,\
GetPgAddr,\
CommitPages,\
ReleasePages,\

View File

@ -1,143 +0,0 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$Revision$
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, [Screen_Max_X]
jb .x2
; Óñòàíîâèòü êîîðäèíàòó X ïî ïðàâîé ãðàíèöå
mov ax, [Screen_Max_X]
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, [Screen_Max_Y]
jb .y2
; Óñòàíîâèòü êîîðäèíàòó Y ïî íèæíåé ãðàíèöå
mov ax, [Screen_Max_Y]
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

@ -27,12 +27,12 @@ uglobal
endg
iglobal
mouse_delay dd 10
mouse_delay dd 10
mouse_speed_factor: dd 3
mouse_timer_ticks dd 0
endg
include 'm_com.inc'
;include 'm_com.inc'
;test_mario79:
@ -49,165 +49,165 @@ include 'm_com.inc'
;process_test_m79 db 'K : Process - test Mario79 error 00000000',13,10,0
draw_mouse_under:
; return old picture
; return old picture
cmp [set_hw_cursor], 0
jz @F
pushad
movzx eax,word [X_UNDER]
movzx ebx,word [Y_UNDER]
stdcall [hw_restore], eax, ebx
popad
ret
cmp [set_hw_cursor], 0
jz @F
pushad
movzx eax,word [X_UNDER]
movzx ebx,word [Y_UNDER]
stdcall [hw_restore], eax, ebx
popad
ret
@@:
pushad
xor ecx,ecx
xor edx,edx
align 4
pushad
xor ecx,ecx
xor edx,edx
align 4
mres:
movzx eax,word [X_UNDER]
movzx ebx,word [Y_UNDER]
add eax,ecx
add ebx,edx
push ecx
push edx
push eax
push ebx
mov eax,edx
shl eax,6
shl ecx,2
add eax,ecx
add eax,mouseunder
mov ecx,[eax]
pop ebx
pop eax
mov edi, 1 ;force
call [putpixel]
pop edx
pop ecx
inc ecx
cmp ecx, 16
jnz mres
xor ecx, ecx
inc edx
cmp edx, 24
jnz mres
popad
ret
movzx eax,word [X_UNDER]
movzx ebx,word [Y_UNDER]
add eax,ecx
add ebx,edx
push ecx
push edx
push eax
push ebx
mov eax,edx
shl eax,6
shl ecx,2
add eax,ecx
add eax,mouseunder
mov ecx,[eax]
pop ebx
pop eax
mov edi, 1 ;force
call [putpixel]
pop edx
pop ecx
inc ecx
cmp ecx, 16
jnz mres
xor ecx, ecx
inc edx
cmp edx, 24
jnz mres
popad
ret
save_draw_mouse:
cmp [set_hw_cursor], 0
je .no_hw_cursor
pushad
cmp [set_hw_cursor], 0
je .no_hw_cursor
pushad
mov [X_UNDER],ax
mov [Y_UNDER],bx
movzx eax,word [MOUSE_Y]
movzx ebx,word [MOUSE_X]
push eax
push ebx
mov [X_UNDER],ax
mov [Y_UNDER],bx
movzx eax,word [MOUSE_Y]
movzx ebx,word [MOUSE_X]
push eax
push ebx
mov ecx, [Screen_Max_X]
inc ecx
mul ecx
mov ecx, [Screen_Max_X]
inc ecx
mul ecx
movzx edx, byte [display_data+ebx+eax]
shl edx, 8
mov ecx, [edx+SLOT_BASE+APPDATA.cursor]
movzx edx, byte [display_data+ebx+eax]
shl edx, 8
mov ecx, [edx+SLOT_BASE+APPDATA.cursor]
cmp ecx, [current_cursor]
je .draw
cmp ecx, [current_cursor]
je .draw
cmp [ecx+CURSOR.magic], 'CURS'
jne .fail
cmp [ecx+CURSOR.magic], 'CURS'
jne .fail
push ecx
call [select_hw_cursor]
mov [current_cursor], ecx
push ecx
call [select_hw_cursor]
mov [current_cursor], ecx
; cmp [ecx+CURSOR.size], CURSOR_SIZE
; jne .fail
.draw:
stdcall [set_hw_cursor], ecx
popad
ret
stdcall [set_hw_cursor], ecx
popad
ret
.fail:
mov ecx, [def_cursor]
mov [edx+SLOT_BASE+APPDATA.cursor], ecx
stdcall [set_hw_cursor], ecx
popad
ret
mov ecx, [def_cursor]
mov [edx+SLOT_BASE+APPDATA.cursor], ecx
stdcall [set_hw_cursor], ecx
popad
ret
.no_hw_cursor:
pushad
; save & draw
mov [X_UNDER],ax
mov [Y_UNDER],bx
push eax
push ebx
mov ecx,0
mov edx,0
align 4
pushad
; save & draw
mov [X_UNDER],ax
mov [Y_UNDER],bx
push eax
push ebx
mov ecx,0
mov edx,0
align 4
drm:
push eax
push ebx
push ecx
push edx
; helloworld
push ecx
add eax,ecx ; save picture under mouse
add ebx,edx
push ecx
call getpixel
mov [COLOR_TEMP],ecx
pop ecx
mov eax,edx
shl eax,6
shl ecx,2
add eax,ecx
add eax,mouseunder
mov ebx,[COLOR_TEMP]
mov [eax],ebx
pop ecx
mov edi,edx ; y cycle
shl edi,4 ; *16 bytes per row
add edi,ecx ; x cycle
mov esi, edi
add edi, esi
add edi, esi ; *3
add edi,[MOUSE_PICTURE] ; we have our str address
mov esi, edi
add esi, 16*24*3
push ecx
mov ecx, [COLOR_TEMP]
call combine_colors
mov [MOUSE_COLOR_MEM], ecx
pop ecx
pop edx
pop ecx
pop ebx
pop eax
add eax,ecx ; we have x coord+cycle
add ebx,edx ; and y coord+cycle
push ecx
mov ecx, [MOUSE_COLOR_MEM]
mov edi, 1
call [putpixel]
pop ecx
mov ebx,[esp+0] ; pure y coord again
mov eax,[esp+4] ; and x
inc ecx ; +1 cycle
cmp ecx,16 ; if more than 16
jnz drm
xor ecx, ecx
inc edx
cmp edx,24
jnz drm
add esp,8
popad
ret
push eax
push ebx
push ecx
push edx
; helloworld
push ecx
add eax,ecx ; save picture under mouse
add ebx,edx
push ecx
call getpixel
mov [COLOR_TEMP],ecx
pop ecx
mov eax,edx
shl eax,6
shl ecx,2
add eax,ecx
add eax,mouseunder
mov ebx,[COLOR_TEMP]
mov [eax],ebx
pop ecx
mov edi,edx ; y cycle
shl edi,4 ; *16 bytes per row
add edi,ecx ; x cycle
mov esi, edi
add edi, esi
add edi, esi ; *3
add edi,[MOUSE_PICTURE] ; we have our str address
mov esi, edi
add esi, 16*24*3
push ecx
mov ecx, [COLOR_TEMP]
call combine_colors
mov [MOUSE_COLOR_MEM], ecx
pop ecx
pop edx
pop ecx
pop ebx
pop eax
add eax,ecx ; we have x coord+cycle
add ebx,edx ; and y coord+cycle
push ecx
mov ecx, [MOUSE_COLOR_MEM]
mov edi, 1
call [putpixel]
pop ecx
mov ebx,[esp+0] ; pure y coord again
mov eax,[esp+4] ; and x
inc ecx ; +1 cycle
cmp ecx,16 ; if more than 16
jnz drm
xor ecx, ecx
inc edx
cmp edx,24
jnz drm
add esp,8
popad
ret
combine_colors:
@ -223,7 +223,7 @@ combine_colors:
push edx
push ecx
xor ecx, ecx
; byte 2
; byte 2
mov eax, 0xff
sub al, [esi+0]
mov ebx, [esp]
@ -240,7 +240,7 @@ combine_colors:
shr eax, 8
add ecx, eax
shl ecx, 8
; byte 1
; byte 1
mov eax, 0xff
sub al, [esi+1]
mov ebx, [esp]
@ -257,7 +257,7 @@ combine_colors:
shr eax, 8
add ecx, eax
shl ecx, 8
; byte 2
; byte 2
mov eax, 0xff
sub al, [esi+2]
mov ebx, [esp]
@ -321,7 +321,7 @@ yes_mouse_disable:
add edx,window_data
movzx eax, word [MOUSE_X]
movzx ebx, word [MOUSE_Y]
mov ecx,[edx+0] ; mouse inside the area ?
mov ecx,[edx+0] ; mouse inside the area ?
add eax,10
cmp eax,ecx
jb no_mouse_disable
@ -350,53 +350,53 @@ no_mouse_disable:
ret
__sys_draw_pointer:
cmp [mouse_pause],0
je @f
ret
cmp [mouse_pause],0
je @f
ret
@@:
push eax
mov eax,[timer_ticks]
sub eax,[MouseTickCounter]
cmp eax,1
ja @f
pop eax
ret
push eax
mov eax,[timer_ticks]
sub eax,[MouseTickCounter]
cmp eax,1
ja @f
pop eax
ret
@@:
mov eax,[timer_ticks]
mov [MouseTickCounter],eax
pop eax
pushad
cmp dword [MOUSE_VISIBLE],dword 0 ; mouse visible ?
je chms00
mov [MOUSE_VISIBLE], dword 0
movzx ebx,word [MOUSE_Y]
movzx eax,word [MOUSE_X]
pushfd
cli
call save_draw_mouse
popfd
mov eax,[timer_ticks]
mov [MouseTickCounter],eax
pop eax
pushad
cmp dword [MOUSE_VISIBLE],dword 0 ; mouse visible ?
je chms00
mov [MOUSE_VISIBLE], dword 0
movzx ebx,word [MOUSE_Y]
movzx eax,word [MOUSE_X]
pushfd
cli
call save_draw_mouse
popfd
nodmu2:
popad
ret
popad
ret
chms00:
movzx ecx,word [X_UNDER]
movzx edx,word [Y_UNDER]
movzx ebx,word [MOUSE_Y]
movzx eax,word [MOUSE_X]
cmp eax,ecx
jne redrawmouse
cmp ebx,edx
jne redrawmouse
jmp nodmp
movzx ecx,word [X_UNDER]
movzx edx,word [Y_UNDER]
movzx ebx,word [MOUSE_Y]
movzx eax,word [MOUSE_X]
cmp eax,ecx
jne redrawmouse
cmp ebx,edx
jne redrawmouse
jmp nodmp
redrawmouse:
pushfd
cli
call draw_mouse_under
call save_draw_mouse
popfd
pushfd
cli
call draw_mouse_under
call save_draw_mouse
popfd
nodmp:
popad
ret
popad
ret
proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword
@ -405,35 +405,35 @@ proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScro
mov eax,[XMoving]
call mouse_acceleration
add ax,[MOUSE_X] ;[XCoordinate]
add ax,[MOUSE_X] ;[XCoordinate]
cmp ax,0
jge @@M1
mov eax,0
jmp @@M2
@@M1:
cmp ax,[Screen_Max_X] ;ScreenLength
jl @@M2
jl @@M2
mov ax,[Screen_Max_X] ;ScreenLength-1
@@M2:
mov [MOUSE_X],ax ;[XCoordinate]
mov [MOUSE_X],ax ;[XCoordinate]
mov eax,[YMoving]
neg eax
call mouse_acceleration
add ax,[MOUSE_Y] ;[YCoordinate]
add ax,[MOUSE_Y] ;[YCoordinate]
cmp ax,0
jge @@M3
mov ax,0
jmp @@M4
@@M3:
cmp ax,[Screen_Max_Y] ;ScreenHeigth
jl @@M4
jl @@M4
mov ax,[Screen_Max_Y] ;ScreenHeigth-1
@@M4:
mov [MOUSE_Y],ax ;[YCoordinate]
mov [MOUSE_Y],ax ;[YCoordinate]
mov eax,[VScroll]
add [MOUSE_SCROLL_V],ax
@ -448,15 +448,15 @@ proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScro
endp
mouse_acceleration:
push eax
mov eax,[timer_ticks]
sub eax,[mouse_timer_ticks]
cmp eax,[mouse_delay]
pop eax
ja @f
;push edx
imul eax,[mouse_speed_factor]
;pop edx
push eax
mov eax,[timer_ticks]
sub eax,[mouse_timer_ticks]
cmp eax,[mouse_delay]
pop eax
ja @f
;push edx
imul eax,[mouse_speed_factor]
;pop edx
@@:
ret
ret

View File

@ -58,7 +58,7 @@ include 'macros.inc'
$Revision$
USE_COM_IRQ equ 0 ;make irq 3 and irq 4 available for PCI devices
USE_COM_IRQ equ 1 ;make irq 3 and irq 4 available for PCI devices
include "proc32.inc"
include "kglobals.inc"
@ -638,8 +638,9 @@ no_lib_load:
mov [pci_access_enabled],1
call detect_devices
;call detect_devices
stdcall load_driver, szPS2MDriver
stdcall load_driver, szCOM_MDriver
; SET MOUSE
@ -671,7 +672,7 @@ no_lib_load:
mov esi,boot_setrports
call boot_log
call setirqreadports
;call setirqreadports
; SET UP OS TASK
@ -854,11 +855,11 @@ first_app_found:
; START MULTITASKING
if preboot_blogesc
mov esi, boot_tasking
call boot_log
.bll1: in al, 0x60 ; wait for ESC key press
cmp al, 129
jne .bll1
mov esi, boot_tasking
call boot_log
.bll1: in al, 0x60 ; wait for ESC key press
cmp al, 129
jne .bll1
end if
; mov [ENABLE_TASKSWITCH],byte 1 ; multitasking enabled
@ -1029,7 +1030,7 @@ reserve_irqs_ports:
pushad
mov [irq_owner+4*0], 1 ; timer
mov [irq_owner+4*1], 1 ; keyboard
;mov [irq_owner+4*1], 1 ; keyboard
mov [irq_owner+4*5], 1 ; sound blaster
mov [irq_owner+4*6], 1 ; floppy diskette
mov [irq_owner+4*13], 1 ; math co-pros
@ -1068,20 +1069,14 @@ reserve_irqs_ports:
popad
ret
iglobal
mouseirqtable db 12 ; ps2
db 4 ; com1
db 3 ; com2
endg
setirqreadports:
mov [irq12read+0],dword 0x60 + 0x01000000 ; read port 0x60 , byte
mov [irq12read+4],dword 0 ; end of port list
mov [irq04read+0],dword 0x3f8 + 0x01000000 ; read port 0x3f8 , byte
mov [irq04read+4],dword 0 ; end of port list
mov [irq03read+0],dword 0x2f8 + 0x01000000 ; read port 0x2f8 , byte
mov [irq03read+4],dword 0 ; end of port list
;mov [irq04read+0],dword 0x3f8 + 0x01000000 ; read port 0x3f8 , byte
;mov [irq04read+4],dword 0 ; end of port list
;mov [irq03read+0],dword 0x2f8 + 0x01000000 ; read port 0x2f8 , byte
;mov [irq03read+4],dword 0 ; end of port list
ret
@ -1998,7 +1993,7 @@ sys_midi:
detect_devices:
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
include 'detect/commouse.inc'
;include 'detect/commouse.inc'
;include 'detect/ps2mouse.inc'
;include 'detect/dev_fd.inc'
;include 'detect/dev_hdcd.inc'
@ -4187,10 +4182,12 @@ reserve_free_irq:
cmp ecx, 16
jae ril1
push ecx
lea ecx, [irq_owner + 4 * ecx]
mov edx, [ecx]
mov eax, [TASK_BASE]
mov edi, [eax + TASKDATA.pid]
pop eax
dec ebx
jnz reserve_irq
@ -4206,12 +4203,38 @@ reserve_free_irq:
cmp dword [ecx], 0
jne ril1
mov ebx, [f_irqs + 4 * eax]
stdcall attach_int_handler, eax, ebx
mov [ecx], edi
dec esi
ril1:
mov [esp+32], esi ; return in eax
ret
iglobal
f_irqs:
dd 0x0
dd 0x0
dd p_irq2
dd p_irq3
dd p_irq4
dd p_irq5
dd p_irq6
dd p_irq7
dd p_irq8
dd p_irq9
dd p_irq10
dd p_irq11
dd 0x0
dd 0x0
dd p_irq14
dd p_irq15
endg
drawbackground:
inc [mouse_pause]
cmp [SCR_MODE],word 0x12
@ -4494,92 +4517,6 @@ setmouse: ; set mousepicture -pointer
mov [MOUSE_PICTURE],dword mousepointer
cli
; mov bl,0xa8 ; enable mouse cmd
; call kb_cmd
; call kb_read ; read status
; mov bl,0x20 ; get command byte
; call kb_cmd
; call kb_read
; or al,3 ; enable interrupt
; mov bl,0x60 ; write command
; push eax
; call kb_cmd
; pop eax
; call kb_write
; mov bl,0xd4 ; for mouse
; call kb_cmd
; mov al,0xf4 ; enable mouse device
; call kb_write
; call kb_read ; read status return
; com1 mouse enable
mov bx,0x3f8 ; combase
mov dx,bx
add dx,3
mov al,0x80
out dx,al
mov dx,bx
add dx,1
mov al,0
out dx,al
mov dx,bx
add dx,0
mov al,0x30*2 ; 0x30 / 4
out dx,al
mov dx,bx
add dx,3
mov al,2 ; 3
out dx,al
mov dx,bx
add dx,4
mov al,0xb
out dx,al
mov dx,bx
add dx,1
mov al,1
out dx,al
; com2 mouse enable
mov bx,0x2f8 ; combase
mov dx,bx
add dx,3
mov al,0x80
out dx,al
mov dx,bx
add dx,1
mov al,0
out dx,al
mov dx,bx
add dx,0
mov al,0x30*2
out dx,al
mov dx,bx
add dx,3
mov al,2
out dx,al
mov dx,bx
add dx,4
mov al,0xb
out dx,al
mov dx,bx
add dx,1
mov al,1
out dx,al
ret