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
This commit is contained in:
parent
435676e6a4
commit
333b0bbae6
@ -325,7 +325,7 @@ macro irqh [num]
|
||||
jmp irq_c
|
||||
}
|
||||
|
||||
irqh 2,3,4,5,7,8,9,10,11,12,14,15
|
||||
irqh 2,5,7,8,9,10,11,14,15
|
||||
|
||||
irq_c:
|
||||
push ds es
|
||||
@ -344,15 +344,57 @@ p_irq6:
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
call fdc_irq
|
||||
|
||||
mov [check_idle_semaphore],5
|
||||
mov al, 0x20
|
||||
out 0x20, al
|
||||
|
||||
call ready_for_next_irq
|
||||
pop es ds
|
||||
popad
|
||||
iret
|
||||
|
||||
p_irq3:
|
||||
pushad
|
||||
push ds es
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
call check_mouse_data_com2
|
||||
pop es ds
|
||||
popad
|
||||
iret
|
||||
|
||||
p_irq4:
|
||||
pushad
|
||||
push ds es
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
call check_mouse_data_com1
|
||||
pop es ds
|
||||
popad
|
||||
iret
|
||||
|
||||
p_irq12:
|
||||
pushad
|
||||
push ds es
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
call check_mouse_data_ps2
|
||||
pop es ds
|
||||
popad
|
||||
iret
|
||||
|
||||
ready_for_next_irq:
|
||||
mov [check_idle_semaphore],5
|
||||
mov al, 0x20
|
||||
out 0x20, al
|
||||
ret
|
||||
|
||||
ready_for_next_irq_1:
|
||||
mov [check_idle_semaphore],5
|
||||
mov al, 0x20
|
||||
out 0xa0,al
|
||||
out 0x20, al
|
||||
ret
|
||||
|
||||
irqD:
|
||||
pushad
|
||||
push ds es
|
||||
@ -773,7 +815,7 @@ terminate: ; terminate application
|
||||
|
||||
|
||||
pusha ; remove all port reservations
|
||||
|
||||
mov [deleted_process],esi
|
||||
mov edx,esi
|
||||
shl edx, 5 ;imul edx,0x20
|
||||
add edx,0x3000
|
||||
@ -829,7 +871,13 @@ terminate: ; terminate application
|
||||
; movzx ecx,word [dlxe]
|
||||
; movzx edx,word [dlye]
|
||||
call calculatescreen
|
||||
|
||||
cli
|
||||
mov eax,[deleted_process]
|
||||
cmp eax,[active_process]
|
||||
jne no_activate_process
|
||||
call read_active_process_stack
|
||||
no_activate_process:
|
||||
sti
|
||||
xor eax, eax
|
||||
xor esi, esi
|
||||
call redrawscreen
|
||||
@ -838,19 +886,44 @@ terminate: ; terminate application
|
||||
mov [0xfff5],byte 0 ; draw mouse
|
||||
|
||||
mov [application_table_status],0
|
||||
|
||||
mov esi,process_terminated
|
||||
call sys_msg_board_str
|
||||
|
||||
;* start code - fix error redraw for terminate (2) - Mario79
|
||||
; cmp [draw_present],1
|
||||
; je no_draw_background_temp
|
||||
; mov [0xfff0],byte 1
|
||||
;no_draw_background_temp:
|
||||
; mov [draw_present],0
|
||||
ret
|
||||
;draw_present db 0
|
||||
;* end code - fix error redraw for terminate (2) - Mario79
|
||||
|
||||
save_active_process_stack:
|
||||
cmp [active_proc_stack_coun],0xa400+0x400-4
|
||||
jne @f
|
||||
mov [active_proc_stack_coun],0xa400-4
|
||||
@@:
|
||||
push eax
|
||||
push ebx
|
||||
mov eax,[active_process]
|
||||
shl eax,5
|
||||
add eax,0x3000
|
||||
mov [eax-twdw+31],byte 1
|
||||
add [active_proc_stack_coun],4
|
||||
mov eax,[active_process]
|
||||
mov ebx,[active_proc_stack_coun]
|
||||
mov [ebx],eax
|
||||
pop ebx
|
||||
pop eax
|
||||
ret
|
||||
|
||||
read_active_process_stack:
|
||||
cmp [active_proc_stack_coun],0xa400-4
|
||||
jne @f
|
||||
mov [active_proc_stack_coun],0xa400+0x400-4
|
||||
@@:
|
||||
push eax
|
||||
push ebx
|
||||
mov ebx,[active_proc_stack_coun]
|
||||
mov eax,[ebx]
|
||||
mov [0xff01],eax ; activate
|
||||
sub [active_proc_stack_coun],4
|
||||
mov [active_process_flag],1
|
||||
pop ebx
|
||||
pop eax
|
||||
ret
|
||||
|
||||
iglobal
|
||||
boot_sched_1 db 'Building gdt tss pointer',0
|
||||
|
@ -7,9 +7,28 @@
|
||||
; Автор исходного текста Кулаков Владимир Геннадьевич.
|
||||
; Адаптация и доработка Mario79
|
||||
|
||||
MSMouseSearch:
|
||||
Detect_COM_Mouse:
|
||||
pusha
|
||||
; ÏÎÈÑÊ ÌÛØÈ ×ÅÐÅÇ COM-ÏÎÐÒÛ
|
||||
call MSMouseSearch
|
||||
cmp AL,'M'
|
||||
jne @f
|
||||
mov [com1_mouse_detected],1
|
||||
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 esi,boot_setmouse_type+44
|
||||
call boot_log
|
||||
@@:
|
||||
popa
|
||||
jmp end_detecting_mouse
|
||||
|
||||
MSMouseSearch:
|
||||
; ÏÎÈÑÊ ÌÛØÈ ×ÅÐÅÇ COM-ÏÎÐÒÛ
|
||||
MouseSearch:
|
||||
; Устанавливаем скорость
|
||||
; приема/передачи 1200 бод
|
||||
@ -48,7 +67,7 @@ dT_1:
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
jne dT_1
|
||||
mov ecx,0xffff
|
||||
mov ecx,0xffff
|
||||
; Включить питание мыши
|
||||
mov AL,11b ;установить DTR и RTS
|
||||
out DX,AL
|
||||
@ -70,46 +89,19 @@ WaitData:
|
||||
; Ввести данные
|
||||
mov DX,[COMPortBaseAddr]
|
||||
in AL,DX
|
||||
; Óñòðîéñòâî ÿâëÿåòñÿ ìûøüþ?
|
||||
cmp AL,'M'
|
||||
je EndDetect
|
||||
NoMouse:
|
||||
inc [COMPortNum]
|
||||
cmp [COMPortNum],1
|
||||
ja EndDetect
|
||||
sub [COMPortBaseAddr],100h
|
||||
jmp MouseSearch
|
||||
ret
|
||||
|
||||
iglobal
|
||||
COMPortBaseAddr dw 3F8h
|
||||
COMPortNum dw 0
|
||||
;COMPortNum dw 0
|
||||
endg
|
||||
|
||||
iglobal
|
||||
boot_setmouse_type db 'No COM mouse, set PS2',0
|
||||
boot_setmouse_type db 'Detected - PS2 mouse',0
|
||||
db 'Detected - COM1 mouse',0
|
||||
db 'Detected - COM2 mouse',0
|
||||
|
||||
endg
|
||||
|
||||
EndDetect:
|
||||
cmp [COMPortNum],0 ;íîìåð ïîðòà ìåíüøå 0?
|
||||
jl ComMouseNotFound ;ìûøü íå íàéäåíà
|
||||
cmp [COMPortNum],1 ;íîìåð ïîðòà áîëüøå 1?
|
||||
ja ComMouseNotFound ;ìûøü íå íàéäåíà
|
||||
mov ax,[COMPortNum]
|
||||
add al,2
|
||||
jmp set_detecting_mouse
|
||||
ComMouseNotFound:
|
||||
mov al,1
|
||||
set_detecting_mouse:
|
||||
mov [0xF604],al
|
||||
dec al
|
||||
movzx eax,al
|
||||
imul eax,22
|
||||
mov esi,boot_setmouse_type
|
||||
add esi,eax
|
||||
call boot_log
|
||||
popa
|
||||
|
||||
end_detecting_mouse:
|
||||
|
||||
|
65
kernel/trunk/detect/ps2mouse.inc
Normal file
65
kernel/trunk/detect/ps2mouse.inc
Normal file
@ -0,0 +1,65 @@
|
||||
MouseSearch_PS2:
|
||||
|
||||
pusha
|
||||
|
||||
mov bl,0xa8 ; enable mouse cmd
|
||||
call kb_cmd
|
||||
cmp ah,1
|
||||
je @@DataInputError
|
||||
|
||||
mov bl,0xd4 ; for mouse
|
||||
call kb_cmd
|
||||
cmp ah,1
|
||||
je @@DataInputError
|
||||
mov al,0xeb ;
|
||||
call kb_write
|
||||
cmp ah,1
|
||||
je @@DataInputError
|
||||
call kb_read ; Acknowledge
|
||||
call kb_read
|
||||
mov [ps2_mouse_detected],0
|
||||
test al,8
|
||||
jz @f
|
||||
mov [ps2_mouse_detected],1
|
||||
@@:
|
||||
call kb_read ;
|
||||
call kb_read ;
|
||||
|
||||
mov bl,0x20 ; get command byte
|
||||
call kb_cmd
|
||||
cmp ah,1
|
||||
je @@DataInputError
|
||||
call kb_read
|
||||
cmp ah,1
|
||||
je @@DataInputError
|
||||
or al,3 ; enable interrupt
|
||||
mov bl,0x60 ; write command
|
||||
push eax
|
||||
call kb_cmd
|
||||
pop eax
|
||||
call kb_write
|
||||
cmp ah,1
|
||||
je @@DataInputError
|
||||
|
||||
mov bl,0xd4 ; for mouse
|
||||
call kb_cmd
|
||||
cmp ah,1
|
||||
je @@DataInputError
|
||||
mov al,0xf4 ; enable mouse device
|
||||
call kb_write
|
||||
cmp ah,1
|
||||
je @@DataInputError
|
||||
call kb_read ; read status return
|
||||
cmp ah,1
|
||||
je @@DataInputError
|
||||
cmp AL,0FAh
|
||||
jnz @@DataInputError ;íåò ïîäòâåðæäåíèÿ
|
||||
|
||||
@@DataInputError:
|
||||
cmp [ps2_mouse_detected],0
|
||||
je @f
|
||||
mov esi,boot_setmouse_type
|
||||
call boot_log
|
||||
@@:
|
||||
popa
|
||||
|
@ -532,7 +532,6 @@ checkbuttons:
|
||||
|
||||
call checkidle
|
||||
|
||||
call check_mouse_data
|
||||
call [draw_pointer]
|
||||
|
||||
pushad
|
||||
@ -552,53 +551,52 @@ checkbuttons:
|
||||
buttonid dd 0x0 ;here a will backup the eax value
|
||||
afterbuttonid:
|
||||
|
||||
pusha
|
||||
mov eax,[buttonid]
|
||||
; mouse x >= button x ?
|
||||
movzx ebx,word [eax+0]
|
||||
shl ebx,5
|
||||
add ebx,window_data
|
||||
movzx ecx,word [ebx+0] ; window x start
|
||||
movzx edx,word [eax+4] ; button x start
|
||||
add edx,ecx
|
||||
mov cx,[0xfb0a]
|
||||
cmp edx,ecx
|
||||
jg no_on_button ;if we release the pointer out of the button area
|
||||
pusha
|
||||
; mouse x >= button x ?
|
||||
movzx ebx,word [eax+0]
|
||||
shl ebx,5
|
||||
add ebx,window_data
|
||||
movzx ecx,word [ebx+0] ; window x start
|
||||
movzx edx,word [eax+4] ; button x start
|
||||
add edx,ecx
|
||||
mov cx,[0xfb0a]
|
||||
cmp edx,ecx
|
||||
jg no_on_button ;if we release the pointer out of the button area
|
||||
|
||||
movzx ebx,word [eax+6] ; button x size
|
||||
add edx,ebx
|
||||
cmp ecx,edx
|
||||
jg no_on_button
|
||||
movzx ebx,word [eax+6] ; button x size
|
||||
add edx,ebx
|
||||
cmp ecx,edx
|
||||
jg no_on_button
|
||||
|
||||
; mouse y >= button y ?
|
||||
movzx ebx,word [eax+0]
|
||||
shl ebx,5
|
||||
add ebx,window_data
|
||||
movzx ecx,word [ebx+4] ; window y start
|
||||
movzx edx,word [eax+8] ; button y start
|
||||
add edx,ecx
|
||||
mov cx,[0xfb0c]
|
||||
cmp edx,ecx
|
||||
jg no_on_button
|
||||
; mouse y >= button y ?
|
||||
movzx ebx,word [eax+0]
|
||||
shl ebx,5
|
||||
add ebx,window_data
|
||||
movzx ecx,word [ebx+4] ; window y start
|
||||
movzx edx,word [eax+8] ; button y start
|
||||
add edx,ecx
|
||||
mov cx,[0xfb0c]
|
||||
cmp edx,ecx
|
||||
jg no_on_button
|
||||
|
||||
movzx ebx,word [eax+10] ; button y size
|
||||
add edx,ebx
|
||||
cmp ecx,edx
|
||||
jg no_on_button
|
||||
popa
|
||||
mov [0xf500],byte 1 ; no of buttons in buffer
|
||||
pop ebx
|
||||
mov [0xf501],ebx ; lets put the button id in buffer
|
||||
push ebx
|
||||
pusha
|
||||
jmp yes_on_button
|
||||
movzx ebx,word [eax+10] ; button y size
|
||||
add edx,ebx
|
||||
cmp ecx,edx
|
||||
jg no_on_button
|
||||
popa
|
||||
mov [0xf500],byte 1 ; no of buttons in buffer
|
||||
pop ebx
|
||||
mov [0xf501],ebx ; lets put the button id in buffer
|
||||
push ebx
|
||||
pusha
|
||||
jmp yes_on_button
|
||||
no_on_button:
|
||||
mov [0xf500],byte 0 ; no of buttons in buffer
|
||||
mov [0xf500],byte 0 ; no of buttons in buffer
|
||||
yes_on_button:
|
||||
mov [0xfb44],byte 0 ; mouse down -> do not draw
|
||||
popa
|
||||
pop ebx
|
||||
popa
|
||||
ret
|
||||
;..................................... end 2/2 : modified by vhanla ................................
|
||||
mov [0xfb44],byte 0 ; mouse down -> do not draw
|
||||
popa
|
||||
pop ebx
|
||||
popa
|
||||
ret
|
||||
|
||||
;..................................... end 2/2 : modified by vhanla ................................
|
||||
|
@ -170,28 +170,76 @@ load_default_skin:
|
||||
mov edi, eax
|
||||
mov esi, 0x90000
|
||||
call bmp2raw
|
||||
mov eax, [0x90000+bmp_header.height]
|
||||
mov [_skinh], eax
|
||||
popad
|
||||
|
||||
ret
|
||||
|
||||
; mov eax, [0x90000+bmp_header.height]
|
||||
; imul eax, [0x90000+bmp_header.width]
|
||||
; imul eax, 3
|
||||
; add eax, raw_data ; now eax points to the last line of image
|
||||
|
||||
; mov ecx, [eax]
|
||||
; mov [_coloroutborder], ecx
|
||||
; mov [_colorborder], ecx
|
||||
; sub eax, 2*3
|
||||
; mov ecx, [eax]
|
||||
; mov [_colorframe], ecx
|
||||
load_default_skin_1:
|
||||
pushad
|
||||
mov eax, _fileleft_1
|
||||
call load_bmp_file
|
||||
mov eax, [0x90000+bmp_header.width]
|
||||
mov [_skinleftw], eax
|
||||
mov [_skinleft_1], 0
|
||||
mov edi, raw_data+1000h
|
||||
mov [_refleft_1], edi
|
||||
mov esi, 0x90000
|
||||
call bmp2raw
|
||||
mov eax, [_bmp_bpl]
|
||||
imul eax, [0x90000+bmp_header.height]
|
||||
push eax
|
||||
|
||||
mov eax, _filebase_1
|
||||
call load_bmp_file
|
||||
mov eax, [0x90000+bmp_header.width]
|
||||
mov [_skinbasew], eax
|
||||
mov eax, [_skinleftw]
|
||||
mov [_skinbase], eax
|
||||
pop eax
|
||||
add eax, [_refleft_1]
|
||||
; align to 32-byte boundary
|
||||
test eax, 11111b
|
||||
jz @f
|
||||
shr eax, 5
|
||||
inc eax
|
||||
shl eax, 5
|
||||
@@:
|
||||
; save base address
|
||||
mov [_refbase_1], eax
|
||||
; convert
|
||||
mov edi, eax
|
||||
mov esi, 0x90000
|
||||
call bmp2raw
|
||||
mov eax, [_bmp_bpl]
|
||||
imul eax, [0x90000+bmp_header.height]
|
||||
push eax
|
||||
|
||||
mov eax, _fileoper_1
|
||||
call load_bmp_file
|
||||
mov eax, [0x90000+bmp_header.width]
|
||||
mov [_skinoperw], eax
|
||||
neg eax
|
||||
mov [_skinoper], eax
|
||||
pop eax
|
||||
add eax, [_refbase_1]
|
||||
; align to 32-byte boundary
|
||||
test eax, 11111b
|
||||
jz @f
|
||||
shr eax, 5
|
||||
inc eax
|
||||
shl eax, 5
|
||||
@@:
|
||||
mov [_refoper_1], eax
|
||||
mov edi, eax
|
||||
mov esi, 0x90000
|
||||
call bmp2raw
|
||||
mov eax, [0x90000+bmp_header.height]
|
||||
mov [_skinh], eax
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
|
||||
drawwindow_IV:
|
||||
|
||||
pusha
|
||||
@ -241,7 +289,15 @@ drawwindow_IV:
|
||||
mov ecx,[_skinleftw]
|
||||
shl ecx,16
|
||||
add ecx,[_skinh]
|
||||
|
||||
cmp [aw_yes],1
|
||||
; cmp [esp+32+4+2], word 1
|
||||
jne @f
|
||||
mov ebx,[_refleft]
|
||||
jmp no_aw_3
|
||||
@@:
|
||||
mov ebx,[_refleft_1]
|
||||
no_aw_3:
|
||||
call sys_putimage
|
||||
|
||||
mov esi,[esp]
|
||||
@ -256,7 +312,14 @@ drawwindow_IV:
|
||||
|
||||
inc eax
|
||||
|
||||
cmp [aw_yes],1
|
||||
; cmp [esp+32+4+2], word 1
|
||||
jne @f
|
||||
mov ebx,[_refbase]
|
||||
jmp no_aw_2
|
||||
@@:
|
||||
mov ebx,[_refbase_1]
|
||||
no_aw_2:
|
||||
mov ecx,[_skinbasew]
|
||||
shl ecx,16
|
||||
add ecx,[_skinh]
|
||||
@ -281,7 +344,14 @@ drawwindow_IV:
|
||||
sub edx,[_skinoperw]
|
||||
inc edx
|
||||
shl edx,16
|
||||
cmp [aw_yes],1
|
||||
; cmp [esp+32+4+2], word 1
|
||||
jne @f
|
||||
mov ebx,[_refoper]
|
||||
jmp no_aw_1
|
||||
@@:
|
||||
mov ebx,[_refoper_1]
|
||||
no_aw_1:
|
||||
mov ecx,[_skinoperw]
|
||||
shl ecx,16
|
||||
add ecx,[_skinh]
|
||||
@ -383,6 +453,7 @@ drawwindow_IV:
|
||||
|
||||
add esp,4
|
||||
popa
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
@ -32,6 +32,9 @@ iglobal
|
||||
_fileleft db 'LEFT.BMP '
|
||||
_filebase db 'BASE.BMP '
|
||||
_fileoper db 'OPER.BMP '
|
||||
_fileleft_1 db 'LEFT_1.BMP '
|
||||
_filebase_1 db 'BASE_1.BMP '
|
||||
_fileoper_1 db 'OPER_1.BMP '
|
||||
endg
|
||||
|
||||
uglobal
|
||||
@ -39,6 +42,10 @@ uglobal
|
||||
_refbase dd 0
|
||||
_refleft dd 0
|
||||
_skinleft dd 0
|
||||
_skinwinw dd 0
|
||||
; _skinwinw dd 0
|
||||
_refoper_1 dd 0
|
||||
_refbase_1 dd 0
|
||||
_refleft_1 dd 0
|
||||
_skinleft_1 dd 0
|
||||
endg
|
||||
|
||||
|
@ -401,7 +401,6 @@ check_window_move_request:
|
||||
|
||||
mov ecx,10 ; wait 1/10 second
|
||||
wmrl3:
|
||||
call check_mouse_data
|
||||
call [draw_pointer]
|
||||
mov eax,1
|
||||
call delay_hs
|
||||
@ -722,8 +721,7 @@ windowactivate:
|
||||
; esi = abs mem position in stack 0xC400+
|
||||
|
||||
pushad
|
||||
|
||||
push esi
|
||||
push esi
|
||||
movzx eax, word [esi] ; ax <- process no
|
||||
movzx eax, word [0xC000+eax*2] ; ax <- position in window stack
|
||||
|
||||
@ -749,7 +747,22 @@ windowactivate:
|
||||
mov [0xC000+eax*2], bx ; this is the last (and the upper)
|
||||
|
||||
;* start code - get active process (4) - Mario79
|
||||
mov [active_process],eax
|
||||
cli
|
||||
cmp [active_process_flag],1
|
||||
jne @f
|
||||
mov [active_process_flag],0
|
||||
jmp end_save_active_process
|
||||
@@:
|
||||
call save_active_process_stack
|
||||
end_save_active_process:
|
||||
mov [active_process],eax
|
||||
push eax
|
||||
mov eax,[active_process]
|
||||
shl eax,5
|
||||
add eax,0x3000
|
||||
mov [eax-twdw+31],byte 1
|
||||
pop eax
|
||||
sti
|
||||
;* end code - get active process (4) - Mario79
|
||||
|
||||
; update on screen -window stack
|
||||
@ -763,10 +776,8 @@ windowactivate:
|
||||
mov [ebx*2 + 0xC400], si
|
||||
jmp waloop2
|
||||
wacont2:
|
||||
|
||||
mov [0xf400], byte 0 ; empty keyboard buffer
|
||||
mov [0xf500], byte 0 ; empty button buffer
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
@ -902,8 +913,8 @@ waredraw: ; if redraw necessary at activate
|
||||
.waitflagdown:
|
||||
dec ecx
|
||||
jz .nowait
|
||||
mov eax, 2
|
||||
call delay_hs
|
||||
; mov eax, 2
|
||||
; call delay_hs
|
||||
cmp [edi+31], byte 0 ; wait flag to drop
|
||||
jnz .waitflagdown
|
||||
.nowait:
|
||||
@ -950,8 +961,8 @@ checkwindows:
|
||||
call waredraw
|
||||
|
||||
;* start code - get active process (2) - Mario79
|
||||
mov eax,[0xff01]
|
||||
mov [active_process],eax
|
||||
; mov eax,[0xff01]
|
||||
; mov [active_process],eax
|
||||
;* end code - get active process (2) - Mario79
|
||||
|
||||
mov [0xff01],dword 0 ; activated
|
||||
@ -1163,7 +1174,6 @@ checkwindows:
|
||||
|
||||
mov [0xfff4],byte 0
|
||||
|
||||
call check_mouse_data
|
||||
call [draw_pointer]
|
||||
|
||||
pushad
|
||||
@ -1460,7 +1470,6 @@ checkwindows:
|
||||
|
||||
mov ecx,100 ; wait to avoid mouse residuals
|
||||
waitre2:
|
||||
call check_mouse_data
|
||||
mov [0xfff5],byte 1
|
||||
call checkidle
|
||||
cmp [edi+31],byte 0
|
||||
|
118
kernel/trunk/hid/m_com1.inc
Normal file
118
kernel/trunk/hid/m_com1.inc
Normal file
@ -0,0 +1,118 @@
|
||||
; Номер принимаемого от мыши байта
|
||||
MouseByteNumber DB 0
|
||||
; Трехбайтовая структура данных, передаваемая мышью
|
||||
FirstByte DB 0
|
||||
SecondByte DB 0
|
||||
ThirdByte DB 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 [0xfb40],al
|
||||
mov [mouse_active],1
|
||||
; Прибавить перемещение по X к координате X
|
||||
mov AL,[FirstByte]
|
||||
shl AL,6
|
||||
or AL,[SecondByte]
|
||||
cbw
|
||||
shl ax,1
|
||||
add AX,[0xFB0A] ;[XCoordinate]
|
||||
; Курсор не должен выходить за левую или
|
||||
; правую границу экрана
|
||||
js @@X1
|
||||
cmp AX,[0xFE00] ;ScreenLength
|
||||
jb @@X2
|
||||
; Установить координату X по правой границе
|
||||
mov AX,[0xFE00] ;ScreenLength-1
|
||||
dec ax
|
||||
jmp @@X2
|
||||
@@X1:
|
||||
; Установить координату X по левой границе
|
||||
xor AX,AX
|
||||
@@X2:
|
||||
mov [0xFB0A],AX ;[XCoordinate]
|
||||
; Прибавить перемещение по Y к координате Y
|
||||
mov AL,[FirstByte]
|
||||
and AL,00001100b
|
||||
shl AL,4
|
||||
or AL,[ThirdByte]
|
||||
cbw
|
||||
shl ax,1
|
||||
add AX,[0xFB0C] ;[YCoordinate]
|
||||
; Курсор не должен выходить за верхнюю или
|
||||
; нижнюю границу экрана
|
||||
js @@Y1
|
||||
cmp AX,[0xFE04] ;ScreenHeigth
|
||||
jb @@Y2
|
||||
; Установить координату X по нижней границе
|
||||
mov AX,[0xFE04] ;ScreenHeigth-1
|
||||
dec ax
|
||||
jmp @@Y2
|
||||
@@Y1:
|
||||
; Установить координату X по верхней границе
|
||||
xor AX,AX
|
||||
@@Y2:
|
||||
mov [0xFB0C],AX ;[YCoordinate]
|
||||
jmp @@EndMouseInterrupt
|
||||
|
||||
@@Error:
|
||||
; Произошел сбой в порядке передачи информации от
|
||||
; мыши, обнулить счетчик байтов пакета данных
|
||||
mov [MouseByteNumber],0
|
||||
@@EndMouseInterrupt:
|
||||
call ready_for_next_irq
|
||||
ret
|
||||
|
118
kernel/trunk/hid/m_com2.inc
Normal file
118
kernel/trunk/hid/m_com2.inc
Normal file
@ -0,0 +1,118 @@
|
||||
; Номер принимаемого от мыши байта
|
||||
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
|
||||
|
157
kernel/trunk/hid/m_ps2.inc
Normal file
157
kernel/trunk/hid/m_ps2.inc
Normal file
@ -0,0 +1,157 @@
|
||||
; Номер принимаемого от мыши байта
|
||||
MouseByteNumber_2 DB 0
|
||||
; Трехбайтовая структура данных, передаваемая мышью
|
||||
FirstByte_2 DB 0
|
||||
SecondByte_2 DB 0
|
||||
ThirdByte_2 DB 0
|
||||
|
||||
;**************************************
|
||||
;* ОБРАБОТЧИК ПРЕРЫВАНИЯ ОТ МЫШИ PS/2 *
|
||||
;**************************************
|
||||
check_mouse_data_ps2:
|
||||
cmp [ps2_mouse_detected],0
|
||||
je @@EndMouseInterrupt_2
|
||||
call Wait8042BufferEmpty ;очистка буфера
|
||||
in AL,0x60 ;получить скэн-код
|
||||
; Выбирать порядковый номер принимаемого байта
|
||||
cmp [MouseByteNumber_2],0
|
||||
je @@SaveFirstByte
|
||||
cmp [MouseByteNumber_2],1
|
||||
je @@SaveSecondByte
|
||||
cmp [MouseByteNumber_2],2
|
||||
je @@SaveThirdByte
|
||||
jmp @@Error_2
|
||||
; Записать первый байт посылки
|
||||
@@SaveFirstByte:
|
||||
test AL,1000b ;первый байт посылки?
|
||||
jz @@Error_2 ;сбой синхронизации
|
||||
mov [FirstByte_2],AL
|
||||
inc [MouseByteNumber_2]
|
||||
jmp @@EndMouseInterrupt_2
|
||||
; Записать второй байт посылки
|
||||
@@SaveSecondByte:
|
||||
mov [SecondByte_2],AL
|
||||
inc [MouseByteNumber_2]
|
||||
jmp @@EndMouseInterrupt_2
|
||||
; Записать третий байт посылки
|
||||
@@SaveThirdByte:
|
||||
mov [ThirdByte_2],AL
|
||||
mov [MouseByteNumber_2],0
|
||||
; (пакет данных от мыши принят полностью)
|
||||
; Записать новое значение байта состояния кнопок
|
||||
mov al,[FirstByte_2] ;[0xfb01]
|
||||
and eax,3
|
||||
mov [0xfb40],al
|
||||
mov [mouse_active],1
|
||||
; Вычислить новую X-координату курсора
|
||||
; Занести в AX перемещение по X
|
||||
mov AH,0 ;дублируем знак во все разряды AH
|
||||
mov AL,[FirstByte_2]
|
||||
test AL,10000b
|
||||
jz @@M0
|
||||
mov AH,0FFh
|
||||
; Занести в AL младший байт
|
||||
@@M0:
|
||||
mov AL,[SecondByte_2]
|
||||
shl ax,1
|
||||
; Вычислить новое значение координаты
|
||||
; курсора по X
|
||||
add AX,[0xFB0A] ;[XCoordinate]
|
||||
cmp AX,0
|
||||
jge @@M1
|
||||
mov AX,0
|
||||
jmp @@M2
|
||||
@@M1:
|
||||
cmp AX,[0xFE00] ;ScreenLength
|
||||
jl @@M2
|
||||
mov AX,[0xFE00] ;ScreenLength-1
|
||||
dec ax
|
||||
@@M2:
|
||||
mov [0xFB0A],AX ;[XCoordinate]
|
||||
|
||||
; Вычисляем новую Y-координату курсора
|
||||
; Занести в AX перемещение по Y
|
||||
mov AH,0 ;дублируем знак во все разряды AH
|
||||
mov AL,[FirstByte_2]
|
||||
test AL,100000b
|
||||
jz @@M3
|
||||
mov AH,0FFh
|
||||
; Занести в AL младший байт
|
||||
@@M3:
|
||||
mov AL,[ThirdByte_2]
|
||||
shl ax,1
|
||||
; Вычислить новое значение координаты курсора
|
||||
; по Y (Y-координата мыши PS/2 направлена
|
||||
; противоположно экранной)
|
||||
neg AX
|
||||
add AX,[0xFB0C] ;[YCoordinate]
|
||||
cmp AX,0
|
||||
jge @@M4
|
||||
mov AX,0
|
||||
jmp @@M5
|
||||
@@M4:
|
||||
cmp AX,[0xFE04] ;ScreenHeigth
|
||||
jl @@M5
|
||||
mov AX,[0xFE04] ;ScreenHeigth-1
|
||||
dec ax
|
||||
@@M5:
|
||||
mov [0xFB0C],AX ;[YCoordinate]
|
||||
|
||||
; Показать курсор в новой позиции
|
||||
jmp @@EndMouseInterrupt_2
|
||||
|
||||
; Обнаружен сбой в порядке передачи информации от мыши
|
||||
@@Error_2:
|
||||
mov [MouseByteNumber_2],0
|
||||
; Нормальное завершение прерывания
|
||||
@@EndMouseInterrupt_2:
|
||||
call ready_for_next_irq_1
|
||||
ret
|
||||
|
||||
;***********************************************
|
||||
;* ОЖИДАНИЕ ОЧИСТКИ ВХОДНОГО БУФЕРА I8042 *
|
||||
;* При выходе из процедуры: *
|
||||
;* флаг ZF установлен - нормальное завершение, *
|
||||
;* флаг ZF сброшен - ошибка тайм-аута. *
|
||||
;***********************************************
|
||||
Wait8042BufferEmpty:
|
||||
; push CX
|
||||
; mov CX,0FFFFh ;задать число циклов ожидания
|
||||
;@@kb:
|
||||
; in AL,64h ;получить статус
|
||||
; test AL,10b ;буфер i8042 свободен?
|
||||
; loopnz @@kb ;если нет, то цикл
|
||||
; pop CX
|
||||
push ecx
|
||||
xor ecx,ecx
|
||||
@@:
|
||||
in al,64h
|
||||
test al,00000010b
|
||||
loopnz @b
|
||||
pop ecx
|
||||
;Если при выходе из подпрограммы сброшен
|
||||
;флаг ZF - ошибка
|
||||
ret ;возврат в подпрограмму
|
||||
|
||||
;***************************************
|
||||
;* ОЖИДАНИЕ ПОСТУПЛЕНИЯ ДАННЫХ ОТ МЫШИ *
|
||||
;***************************************
|
||||
WaitMouseData:
|
||||
; push CX
|
||||
; mov CX,0FFFFh ;задать число циклов ожидания
|
||||
;@@mouse:
|
||||
; in AL,64h ;опросить регистр статуса
|
||||
; test AL,100000b ;данные поступили?
|
||||
; loopz @@mouse ;если нет, то цикл
|
||||
; pop CX
|
||||
push ecx
|
||||
mov ECX,0FFFFh
|
||||
@@:
|
||||
in al,64h
|
||||
test al,100000b
|
||||
loopz @b
|
||||
pop ecx
|
||||
;Если при выходе из подпрограммы установлен
|
||||
;флаг ZF - ошибка
|
||||
ret
|
||||
|
408
kernel/trunk/hid/mousedrv.inc
Normal file
408
kernel/trunk/hid/mousedrv.inc
Normal file
@ -0,0 +1,408 @@
|
||||
; check mouse
|
||||
;
|
||||
;
|
||||
; FB00 -> FB0F mouse memory 00 chunk count - FB0A-B x - FB0C-D y
|
||||
; FB10 -> FB17 mouse color mem
|
||||
; FB21 x move
|
||||
; FB22 y move
|
||||
; FB30 color temp
|
||||
; FB28 high bits temp
|
||||
; FB4A -> FB4D FB4A-B x-under - FB4C-D y-under
|
||||
; FC00 -> FCFE com1/ps2 buffer
|
||||
; FCFF com1/ps2 buffer count starting from FC00
|
||||
|
||||
uglobal
|
||||
mousecount dd 0x0
|
||||
mousedata dd 0x0
|
||||
endg
|
||||
|
||||
include 'm_ps2.inc'
|
||||
include 'm_com1.inc'
|
||||
include 'm_com2.inc'
|
||||
|
||||
|
||||
;test_mario79:
|
||||
; push esi
|
||||
; push eax
|
||||
; mov [write_error_to],process_test_m79+43
|
||||
; movzx eax,al ;[DevErrorCode]
|
||||
; call writehex
|
||||
; mov esi,process_test_m79
|
||||
; call sys_msg_board_str
|
||||
; pop eax
|
||||
; pop esi
|
||||
; ret
|
||||
;process_test_m79 db 'K : Process - test Mario79 error 00000000',13,10,0
|
||||
|
||||
draw_mouse_under:
|
||||
|
||||
; return old picture
|
||||
|
||||
pushad
|
||||
|
||||
xor ecx,ecx
|
||||
xor edx,edx
|
||||
|
||||
;cli ; !!!****
|
||||
align 4
|
||||
mres:
|
||||
|
||||
movzx eax,word [0xfb4a]
|
||||
movzx ebx,word [0xfb4c]
|
||||
|
||||
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
|
||||
|
||||
;;;push edi
|
||||
mov edi, 1 ;force
|
||||
call [putpixel]
|
||||
;;;pop edi
|
||||
|
||||
pop edx
|
||||
pop ecx
|
||||
|
||||
inc ecx
|
||||
cmp ecx, 16
|
||||
jnz mres
|
||||
xor ecx, ecx
|
||||
inc edx
|
||||
cmp edx, 24
|
||||
jnz mres
|
||||
;sti ; !!!****
|
||||
|
||||
popad
|
||||
|
||||
ret
|
||||
|
||||
save_draw_mouse:
|
||||
pushad
|
||||
; save & draw
|
||||
|
||||
mov [0xfb4a],ax
|
||||
mov [0xfb4c],bx
|
||||
push eax
|
||||
push ebx
|
||||
mov ecx,0
|
||||
mov edx,0
|
||||
|
||||
;cli ; !!!****
|
||||
align 4
|
||||
drm:
|
||||
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
|
||||
; helloworld
|
||||
push ecx
|
||||
; push eax ebx ecx
|
||||
add eax,ecx ; save picture under mouse
|
||||
add ebx,edx
|
||||
push ecx
|
||||
call getpixel
|
||||
mov [0xfb30],ecx
|
||||
pop ecx
|
||||
mov eax,edx
|
||||
shl eax,6
|
||||
shl ecx,2
|
||||
add eax,ecx
|
||||
add eax,mouseunder
|
||||
mov ebx,[0xfb30]
|
||||
mov [eax],ebx
|
||||
; pop ecx ebx eax
|
||||
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,[0xf200] ; we have our str address
|
||||
mov esi, edi
|
||||
add esi, 16*24*3
|
||||
push ecx
|
||||
mov ecx, [0xfb30]
|
||||
call combine_colors
|
||||
mov [0xfb10], 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 edi
|
||||
push ecx
|
||||
mov ecx, [0xfb10]
|
||||
mov edi, 1
|
||||
call [putpixel]
|
||||
pop ecx
|
||||
; pop edi ecx
|
||||
|
||||
; mnext:
|
||||
|
||||
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
|
||||
|
||||
pop ebx
|
||||
pop eax
|
||||
|
||||
;sti ; !!!****
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
combine_colors:
|
||||
|
||||
; in
|
||||
; ecx - color ( 00 RR GG BB )
|
||||
; edi - ref to new color byte
|
||||
; esi - ref to alpha byte
|
||||
;
|
||||
; out
|
||||
; ecx - new color ( roughly (ecx*[esi]>>8)+([edi]*[esi]>>8) )
|
||||
|
||||
push eax
|
||||
push ebx
|
||||
push edx
|
||||
push ecx
|
||||
xor ecx, ecx
|
||||
; byte 2
|
||||
mov eax, 0xff
|
||||
sub al, [esi+0]
|
||||
mov ebx, [esp]
|
||||
shr ebx, 16
|
||||
and ebx, 0xff
|
||||
mul ebx
|
||||
shr eax, 8
|
||||
add ecx, eax
|
||||
; xor eax, eax
|
||||
; xor ebx, ebx
|
||||
; mov al, [edi+0]
|
||||
; mov bl, [esi+0]
|
||||
movzx eax, byte [edi+0]
|
||||
movzx ebx, byte [esi+0]
|
||||
mul ebx
|
||||
shr eax, 8
|
||||
add ecx, eax
|
||||
shl ecx, 8
|
||||
; byte 1
|
||||
mov eax, 0xff
|
||||
sub al, [esi+1]
|
||||
mov ebx, [esp]
|
||||
shr ebx, 8
|
||||
and ebx, 0xff
|
||||
mul ebx
|
||||
shr eax, 8
|
||||
add ecx, eax
|
||||
; xor eax, eax
|
||||
; xor ebx, ebx
|
||||
; mov al, [edi+1]
|
||||
; mov bl, [esi+1]
|
||||
movzx eax, byte [edi+1]
|
||||
movzx ebx, byte [esi+1]
|
||||
mul ebx
|
||||
shr eax, 8
|
||||
add ecx, eax
|
||||
shl ecx, 8
|
||||
; byte 2
|
||||
mov eax, 0xff
|
||||
sub al, [esi+2]
|
||||
mov ebx, [esp]
|
||||
and ebx, 0xff
|
||||
mul ebx
|
||||
shr eax, 8
|
||||
add ecx, eax
|
||||
; xor eax, eax
|
||||
; xor ebx, ebx
|
||||
; mov al, [edi+2]
|
||||
; mov bl, [esi+2]
|
||||
movzx eax, byte [edi+2]
|
||||
movzx ebx, byte [esi+2]
|
||||
mul ebx
|
||||
shr eax, 8
|
||||
add ecx, eax
|
||||
|
||||
pop eax
|
||||
pop edx
|
||||
pop ebx
|
||||
pop eax
|
||||
ret
|
||||
|
||||
|
||||
__sys_disable_mouse:
|
||||
|
||||
cli
|
||||
pushad
|
||||
cmp dword [0xf204],dword 0
|
||||
jne no_mouse_disable
|
||||
|
||||
cmp [0x3000],dword 1
|
||||
je disable_m
|
||||
|
||||
mov edx,[0x3000]
|
||||
shl edx,5
|
||||
add edx,window_data
|
||||
|
||||
movzx eax, word [0xfb0a]
|
||||
movzx ebx, word [0xfb0c]
|
||||
|
||||
mov ecx,[0xfe00]
|
||||
inc ecx
|
||||
imul ecx,ebx
|
||||
add ecx,eax
|
||||
add ecx, display_data
|
||||
|
||||
movzx eax, byte [edx+twdw+0xe]
|
||||
|
||||
movzx ebx, byte [ecx]
|
||||
cmp eax,ebx
|
||||
je yes_mouse_disable
|
||||
movzx ebx, byte [ecx+16]
|
||||
cmp eax,ebx
|
||||
je yes_mouse_disable
|
||||
|
||||
; mov ebx,[0xfe00]
|
||||
; inc ebx
|
||||
; imul ebx,10
|
||||
; add ecx,ebx
|
||||
; movzx ebx, byte [ecx]
|
||||
; cmp eax,ebx
|
||||
; je yes_mouse_disable
|
||||
|
||||
mov ebx,[0xfe00]
|
||||
inc ebx
|
||||
imul ebx,10
|
||||
add ecx,ebx
|
||||
movzx ebx, byte [ecx]
|
||||
cmp eax,ebx
|
||||
je yes_mouse_disable
|
||||
|
||||
movzx ebx, byte [ecx+16]
|
||||
cmp eax,ebx
|
||||
je yes_mouse_disable
|
||||
|
||||
jmp no_mouse_disable
|
||||
|
||||
yes_mouse_disable:
|
||||
|
||||
mov edx,[0x3000]
|
||||
shl edx,5
|
||||
add edx,window_data
|
||||
|
||||
movzx eax, word [0xfb0a]
|
||||
movzx ebx, word [0xfb0c]
|
||||
|
||||
mov ecx,[edx+0] ; mouse inside the area ?
|
||||
add eax,14
|
||||
cmp eax,ecx
|
||||
jb no_mouse_disable
|
||||
sub eax,14
|
||||
|
||||
add ecx,[edx+8]
|
||||
cmp eax,ecx
|
||||
jg no_mouse_disable
|
||||
|
||||
mov ecx,[edx+4]
|
||||
add ebx,20
|
||||
cmp ebx,ecx
|
||||
jb no_mouse_disable
|
||||
sub ebx,20
|
||||
|
||||
add ecx,[edx+12]
|
||||
cmp ebx,ecx
|
||||
jg no_mouse_disable
|
||||
|
||||
disable_m:
|
||||
cmp dword [0xf204],dword 0
|
||||
jne @f
|
||||
call draw_mouse_under
|
||||
; @@:
|
||||
mov [0xf204],dword 1
|
||||
; inc dword [0xf204]
|
||||
@@:
|
||||
|
||||
no_mouse_disable:
|
||||
popad
|
||||
sti
|
||||
ret
|
||||
|
||||
__sys_draw_pointer:
|
||||
cli
|
||||
pushad
|
||||
m_pause_1:
|
||||
cmp [mouse_pause],0
|
||||
je @f
|
||||
; call change_task
|
||||
; jmp m_pause_1
|
||||
jmp nodmp
|
||||
@@:
|
||||
; cli
|
||||
cmp dword [0xf204],dword 0 ; mouse visible ?
|
||||
je chms00
|
||||
|
||||
mov [0xf204], dword 0
|
||||
movzx ebx,word [0xfb0c]
|
||||
movzx eax,word [0xfb0a]
|
||||
call save_draw_mouse
|
||||
|
||||
nodmu2:
|
||||
popad
|
||||
sti
|
||||
ret
|
||||
|
||||
chms00:
|
||||
|
||||
movzx ecx,word [0xfb4a]
|
||||
movzx edx,word [0xfb4c]
|
||||
|
||||
movzx ebx,word [0xfb0c]
|
||||
movzx eax,word [0xfb0a]
|
||||
|
||||
cmp eax,ecx
|
||||
jne redrawmouse
|
||||
|
||||
cmp ebx,edx
|
||||
jne redrawmouse
|
||||
|
||||
jmp nodmp
|
||||
|
||||
redrawmouse:
|
||||
|
||||
call draw_mouse_under
|
||||
call save_draw_mouse
|
||||
|
||||
nodmp:
|
||||
|
||||
popad
|
||||
sti
|
||||
ret
|
File diff suppressed because it is too large
Load Diff
@ -96,6 +96,7 @@ include "blkdev/cdrom.inc"
|
||||
; Character devices
|
||||
|
||||
include "hid/keyboard.inc"
|
||||
include "hid/mousedrv.inc"
|
||||
|
||||
; setting date,time,clock and alarm-clock
|
||||
|
||||
|
@ -54,11 +54,15 @@
|
||||
; 6000 -> 68FF free
|
||||
; 6900 -> 6EFF saved picture under mouse pointer
|
||||
;
|
||||
; 6F00 -> 7FFF free
|
||||
; 6F00 -> 6FFF free
|
||||
;
|
||||
; 7000 -> 7FFF used CD driver
|
||||
;
|
||||
; 8000 -> A3FF used FLOPPY driver
|
||||
;
|
||||
; A400 -> B0FF free
|
||||
; A400 -> A7FF used active process stack
|
||||
;
|
||||
; A800 -> B0FF free
|
||||
|
||||
; B100 -> B2FF IDT
|
||||
|
||||
|
BIN
kernel/trunk/scin_v2.7z
Normal file
BIN
kernel/trunk/scin_v2.7z
Normal file
Binary file not shown.
@ -325,6 +325,7 @@ __sys_putpixel:
|
||||
call dword [0xe020] ; call the real put_pixel function
|
||||
.exit:
|
||||
popad
|
||||
|
||||
ret
|
||||
|
||||
align 4
|
||||
@ -376,7 +377,7 @@ ret
|
||||
|
||||
align 4
|
||||
__sys_draw_line:
|
||||
|
||||
inc [mouse_pause]
|
||||
call [disable_mouse]
|
||||
|
||||
; draw a line
|
||||
@ -512,6 +513,7 @@ align 4
|
||||
.exit:
|
||||
add esp, 6*4
|
||||
popa
|
||||
dec [mouse_pause]
|
||||
ret
|
||||
|
||||
|
||||
@ -587,6 +589,7 @@ align 4
|
||||
; edx ye
|
||||
; edi color
|
||||
vesa20_drawbar:
|
||||
|
||||
pushad
|
||||
call [disable_mouse]
|
||||
|
||||
@ -616,6 +619,7 @@ vesa20_drawbar:
|
||||
popad
|
||||
xor eax, eax
|
||||
inc eax
|
||||
|
||||
ret
|
||||
@@:
|
||||
cmp ebx, [drbar.bar_sx]
|
||||
@ -632,6 +636,7 @@ vesa20_drawbar:
|
||||
popad
|
||||
xor eax, eax
|
||||
inc eax
|
||||
|
||||
ret
|
||||
@@:
|
||||
cmp ebx, [drbar.bar_sy]
|
||||
@ -775,6 +780,7 @@ draw_bar_end_32:
|
||||
add esp, drbar.stack_data
|
||||
popad
|
||||
xor eax, eax
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
@ -57,7 +57,8 @@ paletteVGA:
|
||||
|
||||
|
||||
vga_putimage:
|
||||
|
||||
; pushad
|
||||
call [disable_mouse]
|
||||
push ebp ;
|
||||
push esi ;
|
||||
push edi ;
|
||||
@ -225,7 +226,10 @@ pimvga:
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebp
|
||||
|
||||
|
||||
; call [draw_pointer]
|
||||
; call [disable_mouse]
|
||||
; popad
|
||||
ret
|
||||
|
||||
|
||||
@ -251,7 +255,7 @@ VGA_putpixel:
|
||||
and ecx,0x07 ; bit no. (modulo 8)
|
||||
|
||||
setvgapixel:
|
||||
|
||||
cli
|
||||
; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8)
|
||||
|
||||
push eax
|
||||
@ -300,11 +304,13 @@ p13cont:
|
||||
mov al,[edi] ; dummy read
|
||||
mov [edi],dl
|
||||
|
||||
sti
|
||||
ret
|
||||
|
||||
|
||||
vga_drawbar:
|
||||
|
||||
; pushad
|
||||
call [disable_mouse]
|
||||
sub edx,ebx ; edx:=Yend-Ystart=H
|
||||
sub ecx,eax ; ecx:=Xend-Xstat=B
|
||||
|
||||
@ -492,12 +498,12 @@ vga_drawbar:
|
||||
|
||||
;pop edx
|
||||
;pop ecx
|
||||
|
||||
; popad
|
||||
ret
|
||||
|
||||
|
||||
vga_drawbackground_tiled:
|
||||
|
||||
call [disable_mouse]
|
||||
push ebp
|
||||
push eax
|
||||
push ebx
|
||||
@ -639,7 +645,7 @@ vga_drawbackground_tiled:
|
||||
|
||||
|
||||
vga_drawbackground_stretch:
|
||||
|
||||
call [disable_mouse]
|
||||
|
||||
push ebp
|
||||
push eax
|
||||
|
Loading…
Reference in New Issue
Block a user