Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 33 → Rev 32

/kernel/trunk/scin_v2.7z
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/kernel/trunk/core/sys32.inc
325,7 → 325,7
jmp irq_c
}
 
irqh 2,5,7,8,9,10,11,14,15
irqh 2,3,4,5,7,8,9,10,11,12,14,15
 
irq_c:
push ds es
344,57 → 344,15
mov ds, ax
mov es, ax
call fdc_irq
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
mov [check_idle_semaphore],5
mov al, 0x20
out 0x20, al
 
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
815,7 → 773,7
 
 
pusha ; remove all port reservations
mov [deleted_process],esi
 
mov edx,esi
shl edx, 5 ;imul edx,0x20
add edx,0x3000
871,13 → 829,7
; 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
886,45 → 838,20
mov [0xfff5],byte 0 ; draw mouse
 
mov [application_table_status],0
 
mov esi,process_terminated
call sys_msg_board_str
ret
 
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
;* 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
 
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
boot_sched_2 db 'Building IDT table',0
/kernel/trunk/kernel.asm
86,7 → 86,7
putpixel dd __sys_putpixel
; } mike.dld
 
version db 'Kolibri OS version 0.5.2.9 ',13,10,13,10,0
version db 'Kolibri OS version 0.5.2.1 ',13,10,13,10,0
;dd endofcode-0x10000
 
;db 'Boot02'
582,12 → 582,6
; mov cr4,eax
; fail_fpu:
 
;The CPU to this moment should be already in PM,
;and bit MP of the register cr0 should be installed in 1.
finit ;reset of the FPU (finit, instead of fninit)
fsetpm ;enable PM of the FPU
finit ;reset the registers, contents which are still equal RM
;Now FPU too in PM
; DETECT DEVICES
 
mov esi,boot_devices
605,6 → 599,9
mov al,0x2e ; msb
out 0x40,al
 
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;include 'detect/commouse.inc'
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
; SET MOUSE
 
mov esi,boot_setmouse
713,7 → 710,6
; LOAD DEFAULT SKIN
 
call load_default_skin
call load_default_skin_1
 
; MTRR'S
 
752,12 → 748,11
call kb_write
 
; wait until 8042 is ready
; xor ecx,ecx
; @@:
; in al,64h
; and al,00000010b
; loopnz @b
call Wait8042BufferEmpty
mov ecx,0
@@:
in al,64h
and al,00000010b
loopnz @b
 
; mov al, 0xED ; svetodiody - only for testing!
; call kb_write
812,29 → 807,30
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; MAIN OS LOOP START ;
; MAIN OS LOOP ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 32
osloop:
 
call check_mouse_data
call [draw_pointer]
 
call checkbuttons
call main_loop_sys_getkey
call checkwindows
call check_window_move_request
 
call checkmisc
call checkEgaCga
 
call stack_handler
 
call checkidle
call check_fdd_motor_status
jmp osloop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; MAIN OS LOOP END ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
checkidle:
pushad
 
1043,14 → 1039,14
cnvl:
 
pushad
; mov ecx,[0xfb0a]
; cmp ecx,[novesachecksum]
; jne novesal
; popad
; ret
mov ecx,[0xfb0a]
cmp ecx,[novesachecksum]
jne novesal
popad
ret
 
novesal:
; mov [novesachecksum],ecx
mov [novesachecksum],ecx
mov ecx,0
movzx eax,word [0xfb0c]
cmp eax,100
2047,7 → 2043,6
detect_devices:
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
include 'detect/commouse.inc'
include 'detect/ps2mouse.inc'
;include 'detect/dev_fd.inc'
;include 'detect/dev_hdcd.inc'
;include 'detect/sear_par.inc'
2125,10 → 2120,8
; i.e. if window is not already active
 
;* start code - get active process (1) - Mario79
cli
mov [window_minimize],2
; mov [active_process],edi
sti
mov [active_process],edi
;* end code - get active process (1) - Mario79
 
mov [0xff01],edi ; activate
2153,6 → 2146,7
;!!!!!!!!!!!!!!!!!!!!!!!!
include 'blkdev/rdsave.inc'
;!!!!!!!!!!!!!!!!!!!!!!!!
;* start code - get active process (2) - Mario79
cmp eax,7
jnz nogetactiveprocess
mov eax,[active_process]
2250,6 → 2244,7
mov [esp+36],dword 0
ret
no_mouse_centered:
;* end code - get active process (2) - Mario79
cmp eax,16
jnz no_get_free_space
mov eax,[MEM_FreeSpace]
2271,7 → 2266,7
 
iglobal
version_inf:
db 0,5,2,9 ; version 0.5.2.9
db 0,5,2,1 ; version 0.5.2.1
db UID_KOLIBRI
db 'Kolibri',0
version_end:
2794,52 → 2789,29
 
cmp edi,0 ; type I - original style
jne nosyswI
inc [mouse_pause]
call sys_set_window
call drawwindow_I
dec [mouse_pause]
ret
nosyswI:
 
cmp edi,1 ; type II - only reserve area, no draw
jne nosyswII
inc [mouse_pause]
call sys_set_window
call sys_window_mouse
dec [mouse_pause]
ret
nosyswII:
 
cmp edi,2 ; type III - new style
jne nosyswIII
inc [mouse_pause]
call sys_set_window
call drawwindow_III
dec [mouse_pause]
ret
nosyswIII:
 
cmp edi,3 ; type IV - skinned window
jne nosyswIV
 
cli
mov edi,[0x3010]
sub edi,0x3000
shr edi,5
cmp edi,[active_process]
jne @f
mov [aw_yes],1
jmp aw_yes_end
@@:
mov [aw_yes],0
aw_yes_end:
sti
 
inc [mouse_pause]
call sys_set_window
call drawwindow_IV
dec [mouse_pause]
mov [aw_yes],0
ret
nosyswIV:
 
3286,6 → 3258,708
 
ret
 
; 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
 
 
check_mouse_data:
 
pushad
 
cmp [0xF604],byte 1
jne no_ps2_mouse
mov [mousecount],dword 0x2e0000+12*4096
mov [mousedata],dword 0x2e0000+12*4096+0x10
jmp uusicheckmouse
no_ps2_mouse:
cmp [0xF604],byte 2
jne no_com1_mouse
mov [mousecount],dword 0x2e0000+4*4096
mov [mousedata],dword 0x2e0000+4*4096+0x10
jmp uusicheckmouse
no_com1_mouse:
mov [mousecount],dword 0x2e0000+3*4096
mov [mousedata],dword 0x2e0000+3*4096+0x10
 
uusicheckmouse:
 
mov ebx,[mousecount] ; anything at buffer for mouse
cmp dword [ebx], 0 ; !!!
jz checkmouseret
 
; first byte of comX or ps2 ?
 
cmp [0xF604],byte 1
je ps2mousefirst
 
; ******************************************
; *********** COMX mouse driver ************
; ******************************************
 
com1mousefirst:
 
mov edi,[mousedata]
mov dl,byte [edi] ; first com1 ?
test dl,64
jz @f
mov [0xfb00],byte 0 ; zero mouse block count
@@:
xor ebx,ebx
 
mov bl,[0xfb00]
inc bl
mov [0xfb00],bl
mov eax,0xfb00
add eax,ebx
mov edi,[mousedata]
mov dl,byte [edi]
mov [eax],byte dl
cmp bl,3 ; three ?
jnz decm
 
; buttons
 
;* change right and left button by places - start code - Mario79
mov al,[0xfb01]
mov ah,al
shr al,3
and al,2
shr ah,5
and ah,1
add al,ah
;* change right and left button by places - end code - Mario79
 
mov [0xfb40],al
 
; com1 mouse
; x
 
mov dl,[0xfb01] ; x high bits
movzx eax,dl
and al,3
shl al,6
mov dl,byte[0xfb02] ; x low bits
add al,dl
mov [0xfb21],byte al
movzx ebx,word[0xfb0a]
 
mov al,byte [0xfb01] ; + or - ?
test al,2
jz x_add
 
x_sub: ; x-
sub bx,255
sub bx,255
x_add: ; x+
movzx eax,byte [0xfb21]
add bx,ax
add bx,ax
push ebx
mov [0xfb00],byte 0
 
; y
 
 
my_event:
 
mov dl,[0xfb01] ; y high bits
movzx eax,dl
and al,12
shl al,4
mov dl,byte[0xfb03] ; y low bits
add al,dl
mov [0xfb22],byte al
movzx ebx,word[0xfb0c]
 
mov al,byte [0xfb01] ; + or - ?
test al,8
je y_add
 
y_sub: ; y-
sub bx,255
sub bx,255
y_add: ; y+
movzx eax,byte [0xfb22]
add bx,ax
add bx,ax
push ebx
mov [0xfb00],byte 0
jmp mdraw
 
; end of com1 mouse
 
 
; ******************************************
; ******** PS2 MOUSE DRIVER **************
; ******************************************
 
ps2mousefirst:
movzx edx,byte [0x2E0000+4096*12+0x10] ; first ps2 ?
cmp edx,40
jne @f
mov [0xfb00],byte 0 ; zero mouse block count
@@:
 
movzx ebx,byte [0xfb00]
add ebx,1
mov [0xfb00],bl
mov eax,0xfb00
add eax,ebx
mov dl,byte [0x2E0000+4096*12+0x10]
mov [eax],byte dl
 
cmp bl,3 ; full packet of three bytes ?
jnz decm
 
mov [0xfb00],byte 0 ; zero mouse block count
 
; buttons
 
movzx eax,byte [0xfb01]
and eax,3
mov [0xfb40],al
 
; x
 
movzx eax,word [0xfb0a]
movzx edx,byte [0xfb02]
cmp edx,128
jb ps2xp
shl edx,1
add eax,edx
cmp eax,512
jge ps2xsok
xor eax, eax
jmp ps2xready
ps2xsok:
sub eax,512
jmp ps2xready
ps2xp:
shl edx,1
add eax,edx
jmp ps2xready
ps2xready:
push eax
 
; y
 
movzx eax,word [0xfb0c]
movzx edx,byte [0xfb03]
cmp edx,128
jb ps2yp
add eax,512
shl edx,1
sub eax,edx
jmp ps2yready
ps2yp:
shl edx,1
cmp edx,eax
jb ps201
mov edx,eax
ps201:
sub eax,edx
jmp ps2yready
ps2yready:
push eax
 
;jmp mdraw
 
; end of ps2 mouse
 
 
; ****************************
; ***** CHECK FOR LIMITS *****
; ****************************
 
mdraw:
 
cmp [0xfb44],byte 0
jne mousedraw4
cmp [0xfb40],byte 0
je mousedraw4
mov [0xfff5],byte 1
 
mousedraw4:
 
pop ebx
pop eax
 
mov [mouse_active],1
 
; mov dx,0 ; smaller than zero
xor dx,dx
cmp bx,dx
jge mnb11
; mov bx,0
xor bx,bx
mnb11:
mov [0xfb0c],word bx
 
; mov dx,0
xor dx,dx
cmp ax,dx
jge mnb22
; mov ax,0
xor ax,ax
mnb22:
mov [0xfb0a],word ax
 
mov edx,[0xfe04] ; bigger than maximum
cmp ebx,edx
jb mnb1
mov bx,[0xfe04]
mnb1:
mov [0xfb0c],word bx
 
mov edx,[0xfe00]
cmp eax,edx
jb mnb2
mov ax,[0xfe00]
mnb2:
mov [0xfb0a],word ax
 
 
; **** NEXT DATA BYTE FROM MOUSE BUFFER ****
 
decm:
 
mov edi,[mousecount] ; decrease counter
dec dword [edi]
 
mov esi,[mousedata]
mov edi,esi
inc esi
; mov ecx,250
mov ecx,[mousecount]
mov ecx,[ecx]
cld
rep movsb
 
jmp uusicheckmouse
 
checkmouseret:
 
cmp [0xfb44],byte 0
jne cmret
cmp [0xfb40],byte 0
je cmret
mov [0xfff4],byte 0
mov [0xfff5],byte 0
cmret:
 
popad
 
ret
 
 
draw_mouse_under:
 
; return old picture
; cli
 
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
; sti
ret
 
 
save_draw_mouse:
 
; save & draw
; cli
 
mov [0xfb4a],ax
mov [0xfb4c],bx
push eax
push ebx
mov ecx,0
mov edx,0
 
;cli ; !!!****
 
drm:
 
push eax
push ebx
push ecx
push edx
 
; helloworld
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
 
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
mov ecx, [0xfb10]
mov edi, 1
call [putpixel]
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 ; !!!****
 
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:
 
pushad
 
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
 
no_mouse_disable:
 
popad
 
ret
 
 
 
__sys_draw_pointer:
cli
 
pushad
 
cmp dword [0xf204],dword 0 ; mouse visible ?
je chms00
 
dec dword [0xf204]
 
cmp [0xf204],dword 0
jnz nodmu2
 
movzx ebx,word [0xfb0c]
movzx eax,word [0xfb0a]
call save_draw_mouse
 
popad
sti
ret
 
nodmu2:
 
popad
sti
ret
 
chms00:
 
; popad
 
; pushad
 
; cmp [0xf204],dword 0
; jne nodmp
 
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
redrawmouse_1:
call save_draw_mouse
 
nodmp:
 
popad
sti
ret
 
 
 
calculatebackground: ; background
 
; all black
3777,17 → 4451,15
 
 
drawbackground:
inc [mouse_pause]
 
cmp [0xfe0c],word 0x12
jne dbrv12
cmp [display_data-12],dword 1
jne bgrstr12
call vga_drawbackground_tiled
dec [mouse_pause]
ret
bgrstr12:
call vga_drawbackground_stretch
dec [mouse_pause]
ret
dbrv12:
 
3796,27 → 4468,25
cmp [0xfe0c],word 0x13
je dbrv20
call vesa12_drawbackground
dec [mouse_pause]
ret
dbrv20:
cmp [display_data-12],dword 1
jne bgrstr
call vesa20_drawbackground_tiled
dec [mouse_pause]
ret
bgrstr:
call vesa20_drawbackground_stretch
dec [mouse_pause]
ret
 
 
sys_putimage:
 
sys_putimage:
cmp [0xfe0c],word 0x12
jne spiv20
call vga_putimage
ret
spiv20:
 
cmp [0xfe0c],word 0100000000000000b
jge piv20
cmp [0xfe0c],word 0x13
3836,23 → 4506,23
; edi color
 
__sys_drawbar:
inc [mouse_pause]
 
cmp [0xfe0c],word 0x12
jne sdbv20
call vga_drawbar
dec [mouse_pause]
ret
sdbv20:
 
cmp [0xfe0c],word 0100000000000000b
jge dbv20
cmp [0xfe0c],word 0x13
je dbv20
call vesa12_drawbar
dec [mouse_pause]
ret
 
dbv20:
 
call vesa20_drawbar
dec [mouse_pause]
ret
 
 
3971,24 → 4641,26
mov [0xf200],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
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
4449,9 → 5121,8
mov edx,[0x3010]
add eax,[edx-twdw]
add ebx,[edx-twdw+4]
; xor edi,edi ; no force
mov edi,1
; call [disable_mouse]
xor edi,edi ; no force
call [disable_mouse]
jmp [putpixel]
 
align 4
4886,13 → 5557,6
 
;* start code - get process (3) - Mario79
active_process dd 0
active_process_flag db 0
aw_yes db 0
deleted_process dd 0
mouse_pause dd 0
ps2_mouse_detected db 0
com1_mouse_detected db 0
com2_mouse_detected db 0
;* end code - get active process (3) - Mario79
 
wraw_bacground_select db 0
4910,7 → 5574,6
keyboard dd 0x1
sound_dma dd 0x1
syslang dd 0x1
active_proc_stack_coun dd 0xa400-4
endg
 
IncludeIGlobals
/kernel/trunk/gui/button.inc
532,6 → 532,7
 
call checkidle
 
call check_mouse_data
call [draw_pointer]
 
pushad
552,6 → 553,7
afterbuttonid:
 
pusha
mov eax,[buttonid]
; mouse x >= button x ?
movzx ebx,word [eax+0]
shl ebx,5
598,5 → 600,5
pop ebx
popa
ret
;..................................... end 2/2 : modified by vhanla ................................
 
;..................................... end 2/2 : modified by vhanla ................................
/kernel/trunk/gui/skincode.inc
170,76 → 170,28
mov edi, eax
mov esi, 0x90000
call bmp2raw
mov eax, [0x90000+bmp_header.height]
mov [_skinh], eax
popad
 
ret
 
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, [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 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 ecx, [eax]
; mov [_coloroutborder], ecx
; mov [_colorborder], ecx
; sub eax, 2*3
; mov ecx, [eax]
; mov [_colorframe], ecx
 
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
289,15 → 241,7
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]
312,14 → 256,7
 
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]
344,14 → 281,7
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]
453,7 → 383,6
 
add esp,4
popa
 
ret
 
 
/kernel/trunk/gui/skindata.inc
32,9 → 32,6
_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
42,10 → 39,6
_refbase dd 0
_refleft dd 0
_skinleft dd 0
; _skinwinw dd 0
_refoper_1 dd 0
_refbase_1 dd 0
_refleft_1 dd 0
_skinleft_1 dd 0
_skinwinw dd 0
endg
 
/kernel/trunk/gui/window.inc
401,6 → 401,7
 
mov ecx,10 ; wait 1/10 second
wmrl3:
call check_mouse_data
call [draw_pointer]
mov eax,1
call delay_hs
721,6 → 722,7
; esi = abs mem position in stack 0xC400+
 
pushad
 
push esi
movzx eax, word [esi] ; ax <- process no
movzx eax, word [0xC000+eax*2] ; ax <- position in window stack
747,22 → 749,7
mov [0xC000+eax*2], bx ; this is the last (and the upper)
 
;* start code - get active process (4) - Mario79
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
776,8 → 763,10
mov [ebx*2 + 0xC400], si
jmp waloop2
wacont2:
 
mov [0xf400], byte 0 ; empty keyboard buffer
mov [0xf500], byte 0 ; empty button buffer
 
popad
ret
 
913,8 → 902,8
.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:
961,8 → 950,8
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
1174,6 → 1163,7
 
mov [0xfff4],byte 0
 
call check_mouse_data
call [draw_pointer]
 
pushad
1470,6 → 1460,7
 
mov ecx,100 ; wait to avoid mouse residuals
waitre2:
call check_mouse_data
mov [0xfff5],byte 1
call checkidle
cmp [edi+31],byte 0
/kernel/trunk/memmap.inc
54,15 → 54,11
; 6000 -> 68FF free
; 6900 -> 6EFF saved picture under mouse pointer
;
; 6F00 -> 6FFF free
; 6F00 -> 7FFF free
;
; 7000 -> 7FFF used CD driver
;
; 8000 -> A3FF used FLOPPY driver
;
; A400 -> A7FF used active process stack
;
; A800 -> B0FF free
; A400 -> B0FF free
 
; B100 -> B2FF IDT
 
/kernel/trunk/hid/m_com1.inc
File deleted
/kernel/trunk/hid/m_com2.inc
File deleted
/kernel/trunk/hid/mousedrv.inc
File deleted
/kernel/trunk/hid/m_ps2.inc
File deleted
/kernel/trunk/kernel32.inc
96,7 → 96,6
; Character devices
 
include "hid/keyboard.inc"
include "hid/mousedrv.inc"
 
; setting date,time,clock and alarm-clock
 
/kernel/trunk/detect/ps2mouse.inc
File deleted
/kernel/trunk/detect/commouse.inc
7,27 → 7,8
; Àâòîð èñõîäíîãî òåêñòà Êóëàêîâ Âëàäèìèð Ãåííàäüåâè÷.
; Àäàïòàöèÿ è äîðàáîòêà Mario79
 
Detect_COM_Mouse:
MSMouseSearch:
pusha
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:
; Óñòàíàâëèâàåì ñêîðîñòü
89,19 → 70,46
; Ââåñòè äàííûå
mov DX,[COMPortBaseAddr]
in AL,DX
; Óñòðîéñòâî ÿâëÿåòñÿ ìûøüþ?
cmp AL,'M'
je EndDetect
NoMouse:
ret
inc [COMPortNum]
cmp [COMPortNum],1
ja EndDetect
sub [COMPortBaseAddr],100h
jmp MouseSearch
 
iglobal
COMPortBaseAddr dw 3F8h
;COMPortNum dw 0
COMPortNum dw 0
endg
 
iglobal
boot_setmouse_type db 'Detected - PS2 mouse',0
boot_setmouse_type db 'No COM mouse, set PS2',0
db 'Detected - COM1 mouse',0
db 'Detected - COM2 mouse',0
endg
 
end_detecting_mouse:
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
 
 
/kernel/trunk/video/vesa20.inc
325,7 → 325,6
call dword [0xe020] ; call the real put_pixel function
.exit:
popad
 
ret
 
align 4
377,7 → 376,7
 
align 4
__sys_draw_line:
inc [mouse_pause]
 
call [disable_mouse]
 
; draw a line
513,7 → 512,6
.exit:
add esp, 6*4
popa
dec [mouse_pause]
ret
 
 
589,7 → 587,6
; edx ye
; edi color
vesa20_drawbar:
pushad
call [disable_mouse]
 
619,7 → 616,6
popad
xor eax, eax
inc eax
ret
@@:
cmp ebx, [drbar.bar_sx]
636,7 → 632,6
popad
xor eax, eax
inc eax
ret
@@:
cmp ebx, [drbar.bar_sy]
780,7 → 775,6
add esp, drbar.stack_data
popad
xor eax, eax
 
ret
 
 
/kernel/trunk/video/vga.inc
57,8 → 57,7
 
 
vga_putimage:
; pushad
call [disable_mouse]
 
push ebp ;
push esi ;
push edi ;
227,9 → 226,6
pop esi
pop ebp
; call [draw_pointer]
; call [disable_mouse]
; popad
ret
 
 
255,7 → 251,7
and ecx,0x07 ; bit no. (modulo 8)
 
setvgapixel:
cli
 
; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8)
 
push eax
304,13 → 300,11
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
 
498,12 → 492,12
 
;pop edx
;pop ecx
; popad
 
ret
 
 
vga_drawbackground_tiled:
call [disable_mouse]
 
push ebp
push eax
push ebx
645,8 → 639,8
 
 
vga_drawbackground_stretch:
call [disable_mouse]
 
 
push ebp
push eax
push ebx