1. a little fix for scheduler + correct comments

2. refactored window activation/ process termination/ getting active process
3. deleted dead code in checkwindows
4. eliminated almost all accesses to 0x3020+...+0xe, changed to direct process number
5. cli/sti in vesa12 and vga drivers and in calculatescreen
6. skipping dead windows in some funcs in window.inc

git-svn-id: svn://kolibrios.org@102 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Ivan Poddubny 2006-07-23 14:47:32 +00:00
parent ad532cdbaa
commit c5b30426a8
10 changed files with 118 additions and 236 deletions

View File

@ -101,9 +101,13 @@ ret
; Find next task to execute
; result: ebx = number of the selected task
; [0xffff] = 1 if the task is the same
; eax = 1 if the task is the same
; edi = address of the data for the task in ebx
; [0x3000] = ebx and [0x3010] = edi
; corrupts other regs
find_next_task:
mov ebx, [0x3000]
mov edi, [0x3010]
mov [prev_slot], ebx
.waiting_for_termination:

View File

@ -796,45 +796,27 @@ terminate: ; terminate application
cld
shl esi,5
add esi,window_data
mov ax,[esi+0]
mov word [dlx],ax
add ax,[esi+8]
mov word [dlxe],ax
mov ax,[esi+4]
mov word [dly],ax
add ax,[esi+12]
mov word [dlye],ax
mov [esi+0],word 0
mov [esi+8],word 5
mov ax,[0xFE04]
mov [esi+4],ax
mov [esi+12],word 5
xor eax, eax
mov [esi+16],eax;dword 0
mov [esi+20],eax;dword 0
mov [esi+24],eax;dword 0
mov [esi+28],eax;dword 0
popa
mov eax,[esi+WDATA.left]
mov [dlx],eax
add eax,[esi+WDATA.width]
mov [dlxe],eax
mov eax,[esi+WDATA.top]
mov [dly],eax
add eax,[esi+WDATA.height]
mov [dlye],eax
pusha
mov edi,esi
shl edi,5
add edi,window_data
mov [esi+WDATA.left], 0
mov [esi+WDATA.width], 5
mov eax,[0xFE04]
mov [esi+WDATA.top],eax
mov [esi+WDATA.height], 5
xor eax, eax
mov [esi+16],eax
mov [esi+20],eax
mov [esi+24],eax
mov [esi+28],eax
lea edi, [esi-window_data+draw_data]
mov ecx,32/4
xor eax, eax
; cld
rep stosd
mov eax,[0xFE04] ; set window to start from maxy+1
add eax,2
mov edi,esi
shl edi,5
mov [edi+4+window_data],eax
add edi,draw_data
mov ecx,32/4
xor eax, eax
rep stosd
popa
@ -861,7 +843,6 @@ terminate: ; terminate application
add edi,0x80000
mov ecx,256/4
xor eax, eax
; cld
rep stosd
popa
@ -871,23 +852,31 @@ terminate: ; terminate application
add edi,0x80000
mov ecx,11
mov eax,' '
; cld
rep stosb
popa
pusha ; C000 --> C400
mov eax, 0xc000
mov esi, 0
nlc40:
add eax, 2
inc esi
cmp esi, [0x3004]
jae nlc41
movzx ecx, word [eax]
mov [0xC400 + ecx*2], si
jmp nlc40
nlc41:
popa
; activate window
movzx eax, word [0xC000 + esi*2]
cmp eax, [0x3004]
jne .dont_activate
pushad
.check_next_window:
dec eax
cmp eax, 1
jbe .nothing_to_activate
lea esi, [0xc400+eax*2]
movzx edi, word [esi] ; edi = process
shl edi, 5
cmp [0x3000 + edi + 0xa], byte 9 ; skip dead slots
je .check_next_window
add edi, window_data
call waredraw
mov [0xf400], byte 0
mov [0xf500], byte 0
.nothing_to_activate:
popad
.dont_activate:
push esi ; remove hd1 & cd & flp reservation
shl esi, 5
@ -922,7 +911,6 @@ terminate: ; terminate application
pusha ; remove all port reservations
mov [deleted_process],esi
mov edx,esi
shl edx, 5 ;imul edx,0x20
add edx,0x3000
@ -997,13 +985,6 @@ 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
@ -1014,41 +995,7 @@ terminate: ; terminate application
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
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

View File

@ -205,10 +205,9 @@ sys_button:
@@:
movzx edi,word [esp]
; <Ivan Poddubny 15.08.2004>
pop edx
and edx, 0xFFFF
;;cli
.newline:
call button_dececx
push edi
@ -218,9 +217,6 @@ sys_button:
add ebx,1*65536+1 ; [ y start | y end ]
dec edx
jnz .newline
;;sti
;; pop ebx
; </Ivan Poddubny 15.08.2004>
popad
call drawbuttonframes

View File

@ -51,6 +51,7 @@ setwindowdefaults:
align 4
calculatescreen:
pushad
pushfd
cli
mov esi, 1
@ -67,6 +68,10 @@ calculatescreen:
.new_wnd:
movzx edi, word [0xC400 + esi * 2]
shl edi, 5
cmp [0x3000+edi+0xa], byte 9
je .not_wnd
add edi, window_data
test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED
jnz .not_wnd
@ -85,7 +90,7 @@ calculatescreen:
dec ebp
jnz .new_wnd
.finish:
sti
popfd
popad
ret
@ -669,13 +674,8 @@ r_bx equ [esp+18] ; y end
pushad
mov ecx,esi ; yb,xb -> yb,xe
;<<< 14.11.2004 Ivan Poddubny <faster and smaller>
; mov eax,r_eax
; shl eax,16
; mov ax,r_ax
mov eax, r_eax
rol eax, 16
;>>> 14.11.2004 Ivan Poddubny <faster and smaller>
mov ebx,r_ebx
shl ebx,16
mov bx,r_ebx
@ -809,6 +809,20 @@ windowactivate:
; esi = abs mem position in stack 0xC400+
pushad
; if type of current active window is 3,
; it must be redrawn
mov eax, [0x3004]
movzx eax, word [0xC400 + eax*2]
shl eax, 5
add eax, window_data
mov ebx, [eax + WDATA.cl_workarea]
and ebx, 0x0f000000
cmp ebx, 0x03000000
jne @f
mov [eax + WDATA.fl_redraw], byte 1
@@:
push esi
movzx eax, word [esi] ; ax <- process no
movzx eax, word [0xC000+eax*2] ; ax <- position in window stack
@ -834,25 +848,6 @@ windowactivate:
mov bx, [0x3004] ; number of processes
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
xor esi, esi
waloop2:
@ -876,16 +871,19 @@ checkwindowdraw:
; edi = position in window_data+
mov eax, [edi + WDATA.cl_workarea]
and eax, 0x0f000000
cmp eax, 0x03000000
je .return_yes ; window type 3
mov esi, edi
sub esi, window_data
shr esi, 5
; esi = process number
; <IP 15.08.2004>
movzx eax, word [0xC000 + esi * 2] ; get value of the curr process
lea esi, [0xC400 + eax * 2] ; get address of this process at 0xC400
; </IP 15.08.2004>
push esi
@ -903,34 +901,37 @@ checkwindowdraw:
movzx eax, word [esi]
shl eax, 5
add eax, window_data
mov esi, eax
cmp [0x3000 + eax + 0xa], byte 9
je .new_check ; skip dead windows
mov ebx, [edi+4]
lea esi, [eax+window_data]
mov ebx, [edi+4] ; y0
mov edx, [edi+12]
add edx, ebx
add edx, ebx ; y0e
mov ecx, [esi+4] ; y check
mov ecx, [esi+4] ; y ; y check
cmp ecx, edx
jae .new_check
jae .new_check ; y < y0e
mov eax, [esi+12]
add ecx, eax
cmp ebx, ecx
add ecx, eax ; ye
cmp ebx, ecx ; y0 >= ye
ja .new_check
mov eax, [edi+0]
mov eax, [edi+0] ; x0
mov ecx, [edi+8]
add ecx, eax
add ecx, eax ; x0e
mov edx, [esi+0] ; x check
mov edx, [esi+0] ; x ; x check
cmp edx, ecx
jae .new_check
jae .new_check ; x < x0e
mov ecx, [esi+8]
add edx, ecx
cmp eax, edx
ja .new_check
pop esi
.return_yes:
mov ecx,1 ; overlap some window
ret
@ -974,9 +975,7 @@ waredraw: ; if redraw necessary at activate
mov edi, [0x3004]
movzx esi, word [0xC400 + edi * 2]
shl esi, 5
movzx esi, byte [esi + 0x3000 + 0xE]
call setscreen ;;;calculatescreen ; setscreen
call setscreen
popad
cmp [0xff01], dword 1 ; if > 1 then activate process
@ -1048,11 +1047,6 @@ checkwindows:
lea esi, [0xC400 + esi * 2]
call waredraw
;* start code - get active process (2) - Mario79
; mov eax,[0xff01]
; mov [active_process],eax
;* end code - get active process (2) - Mario79
mov [0xff01],dword 0 ; activated
popad
@ -1062,8 +1056,6 @@ checkwindows:
cmp [0xfb40],byte 0 ; mouse buttons pressed ?
jne .mouse_buttons_pressed
; cmp [window_minimize],2
; jne .no_activate_request_1
cmp [window_minimize],0
je .no_activate_request_2
cmp [window_minimize],1
@ -1074,11 +1066,6 @@ checkwindows:
add edi, window_data
test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED
jnz .mouse_buttons_pressed
; jne .no_activate_request_2
; .no_activate_request_1:
; cmp [window_minimize],1
; jge .mouse_buttons_pressed
; jmp .mouse_buttons_pressed
.no_activate_request_2:
mov [window_minimize],0
popad
@ -1505,35 +1492,6 @@ checkwindows:
cmp [reposition],0
je retwm
pushad
mov eax,[edi+00]
mov ebx,[edi+04]
mov ecx,[edi+8]
mov edx,[edi+12]
add ecx,eax
add edx,ebx
mov edi,[0x3004]
shl edi,1
add edi,0xc400
movzx esi,byte [edi]
shl esi,5
add esi,0x3000+0xe
movzx esi,byte [esi]
sub edi,draw_data
shr edi,5
shl edi,8
add edi,0x80000+0x80
;cmp [edi],dword 0
;jne no_rect_shaped_move
call setscreen
jmp move_calculated
no_rect_shaped_move:
call calculatescreen
move_calculated:
popad
mov [edi+WDATA.fl_redraw],1
mov [0xfff5],byte 1 ; no mouse
@ -1570,11 +1528,9 @@ checkwindows:
popad
mov [window_minimize],0
; sti
ret
;temp_mouse_1 dw 0
;temp_mouse_2 dw 0
uglobal
add_window_data dd 0

View File

@ -285,7 +285,7 @@ __sys_disable_mouse:
add ecx,eax
add ecx, display_data
movzx eax, byte [edx+twdw+0xe]
mov eax, [0x3000]
movzx ebx, byte [ecx]
cmp eax,ebx

View File

@ -2188,10 +2188,6 @@ sysfn_activate: ; 18.3 = ACTIVATE WINDOW
ja nowindowactivate
; edi = position at window_data+
mov edi, ebx ; edi = process number
;shl ebx, 1
;add ebx, 0xc000
;mov esi, [ebx] ; esi = window stack value
;and esi, 0xffff ; word
movzx esi, word [0xC000 + ebx*2]
cmp esi, [0x3004] ; number of processes
jz nowindowactivate ; continue if window_stack_value != number_of_processes
@ -2216,7 +2212,8 @@ sysfn_getcpuclock: ; 18.5 = GET TSC/SEC
;!!!!!!!!!!!!!!!!!!!!!!!!
sysfn_getactive: ; 18.7 = get active window
mov eax,[active_process]
mov eax, [0x3004]
movzx eax, word [0xC400 + eax*2]
mov [esp+36],eax
ret
@ -2885,16 +2882,14 @@ sys_drawwindow:
cmp edi,3 ; type IV - skinned window
jne nosyswIV
cli
mov edi,[0x3010]
sub edi,0x3000
shr edi,5
cmp edi,[active_process]
; parameter for drawwindow_IV
push 0
mov edi, [0x3004]
movzx edi, word [0xC400 + edi*2]
cmp edi, [0x3000]
jne @f
mov byte [esp],1
@@: ; parameter for drawwindow_IV
sti
inc dword [esp]
@@:
inc [mouse_pause]
call [disable_mouse]
@ -5119,16 +5114,13 @@ uglobal
;part2_ld dd 0x0
;* start code - get process (3) - Mario79
active_process dd 0
active_process_flag db 0
deleted_process dd 0
;* start code - Mario79
mouse_pause dd 0
MouseTickCounter dd 0
ps2_mouse_detected db 0
com1_mouse_detected db 0
com2_mouse_detected db 0
;* end code - get active process (3) - Mario79
;* end code - Mario79
wraw_bacground_select db 0
lba_read_enabled dd 0x0 ; 0 = disabled , 1 = enabled
@ -5145,7 +5137,6 @@ iglobal
keyboard dd 0x1
sound_dma dd 0x1
syslang dd 0x1
active_proc_stack_coun dd 0xa400-4
endg
IncludeIGlobals

View File

@ -62,9 +62,7 @@
;
; 8000 -> A3FF used FLOPPY driver
;
; A400 -> A7FF used active process stack
;
; A800 -> B0FF free
; A400 -> B0FF free
; B100 -> B2FF IDT

View File

@ -48,6 +48,7 @@
; set_bank for S3 videocards, work on S3 ViRGE PCI (325)
; modified by kmeaw
set_bank:
pushfd
cli
cmp al,[0xfff2]
je retsb
@ -121,7 +122,7 @@ pop cx
pop dx
pop ax
retsb:
sti
popfd
ret
;Set bank function for Intel 810/815 chipsets
@ -461,8 +462,7 @@ dbpi24bit12:
mov ebx,3
div ebx
add eax,WinMapAddress
mov ebx,[0x3010]
movzx ebx,byte[ebx+0xe]
mov ebx,[0x3000]
cld
dbnp2412:
@ -553,8 +553,7 @@ dbpi24bit12:
sub eax,[0xfe80]
shr eax,2
add eax,WinMapAddress
mov ebx,[0x3010]
movzx ebx,byte[ebx+0xe]
mov ebx,[0x3000]
cld
dbnp3212:
@ -823,8 +822,7 @@ vesa12_putimage:
mov ebx,3
div ebx
add eax,WinMapAddress
mov ebx,[0x3010]
mov bl,[ebx+0xe]
mov ebx,[0x3000]
mov bh,[esp+4*4]
np2412:
@ -901,8 +899,7 @@ vesa12_putimage:
sub eax,[0xfe80]
shr eax,2
add eax,WinMapAddress
mov ebx,[0x3010]
mov bl,[ebx+0xe]
mov ebx,[0x3000]
mov bh,[esp+4*4]
np3212:

View File

@ -201,14 +201,12 @@ vesa20_putimage:
xchg eax, ebp
; get process number
mov eax, [0x3010]
mov bl, [eax+0xE]
mov ebx, [0x3000]
cmp byte [ScreenBPP], 32
je put_image_end_32
;put_image_end_24:
;cli ; !!!!!!!!!!!!!!!!!!!!!!
mov edi, [putimg.real_sy]
align 4
.new_line:
@ -244,7 +242,6 @@ vesa20_putimage:
.finish:
add esp, putimg.stack_data
popad
;sti ; !!!!!!!!!!!!!!!!!!!!!
ret
put_image_end_32:
@ -679,13 +676,11 @@ vesa20_drawbar:
xchg eax, ebp
; get process number
mov eax, [0x3010]
mov bl, [eax+0xE]
mov ebx, [0x3000]
cmp byte [ScreenBPP], 24
jne draw_bar_end_32
draw_bar_end_24:
;cli ; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
mov eax, [drbar.color] ;; BBGGRR00
mov bh, al ;; bh = BB
shr eax, 8 ;; eax = RRGG
@ -736,7 +731,6 @@ draw_bar_end_24:
add esp, drbar.stack_data
popad
xor eax, eax
;sti ; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ret
draw_bar_end_32:

View File

@ -142,8 +142,7 @@ pimvga:
push ebx ; H
push edx ; x+Xwin
mov ebx,[0x3010]
mov bl,[ebx+0xe]
mov ebx,[0x3000]
mov bh,[esp+6*4]
cld
@ -255,6 +254,7 @@ VGA_putpixel:
and ecx,0x07 ; bit no. (modulo 8)
setvgapixel:
pushfd
cli
; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8)
@ -304,7 +304,7 @@ p13cont:
mov al,[edi] ; dummy read
mov [edi],dl
sti
popfd
ret
@ -415,8 +415,7 @@ vga_drawbar:
push esi
push ecx ; x+Xwin
mov ebx,[0x3010]
movzx ebx,byte[ebx+0xe]
mov ebx,[0x3000]
cld