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 ; Find next task to execute
; result: ebx = number of the selected task ; 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: find_next_task:
mov ebx,[0x3000] mov ebx, [0x3000]
mov edi, [0x3010]
mov [prev_slot], ebx mov [prev_slot], ebx
.waiting_for_termination: .waiting_for_termination:

View File

@ -796,45 +796,27 @@ terminate: ; terminate application
cld cld
shl esi,5 shl esi,5
add esi,window_data add esi,window_data
mov ax,[esi+0] mov eax,[esi+WDATA.left]
mov word [dlx],ax mov [dlx],eax
add ax,[esi+8] add eax,[esi+WDATA.width]
mov word [dlxe],ax mov [dlxe],eax
mov ax,[esi+4] mov eax,[esi+WDATA.top]
mov word [dly],ax mov [dly],eax
add ax,[esi+12] add eax,[esi+WDATA.height]
mov word [dlye],ax mov [dlye],eax
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
pusha mov [esi+WDATA.left], 0
mov edi,esi mov [esi+WDATA.width], 5
shl edi,5 mov eax,[0xFE04]
add edi,window_data 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 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 rep stosd
popa popa
@ -861,7 +843,6 @@ terminate: ; terminate application
add edi,0x80000 add edi,0x80000
mov ecx,256/4 mov ecx,256/4
xor eax, eax xor eax, eax
; cld
rep stosd rep stosd
popa popa
@ -871,23 +852,31 @@ terminate: ; terminate application
add edi,0x80000 add edi,0x80000
mov ecx,11 mov ecx,11
mov eax,' ' mov eax,' '
; cld
rep stosb rep stosb
popa popa
pusha ; C000 --> C400
mov eax, 0xc000 ; activate window
mov esi, 0 movzx eax, word [0xC000 + esi*2]
nlc40: cmp eax, [0x3004]
add eax, 2 jne .dont_activate
inc esi pushad
cmp esi, [0x3004] .check_next_window:
jae nlc41 dec eax
movzx ecx, word [eax] cmp eax, 1
mov [0xC400 + ecx*2], si jbe .nothing_to_activate
jmp nlc40 lea esi, [0xc400+eax*2]
nlc41: movzx edi, word [esi] ; edi = process
popa 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 push esi ; remove hd1 & cd & flp reservation
shl esi, 5 shl esi, 5
@ -922,7 +911,6 @@ terminate: ; terminate application
pusha ; remove all port reservations pusha ; remove all port reservations
mov [deleted_process],esi
mov edx,esi mov edx,esi
shl edx, 5 ;imul edx,0x20 shl edx, 5 ;imul edx,0x20
add edx,0x3000 add edx,0x3000
@ -997,13 +985,6 @@ terminate: ; terminate application
; movzx ecx,word [dlxe] ; movzx ecx,word [dlxe]
; movzx edx,word [dlye] ; movzx edx,word [dlye]
call calculatescreen 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 eax, eax
xor esi, esi xor esi, esi
call redrawscreen call redrawscreen
@ -1014,41 +995,7 @@ terminate: ; terminate application
mov [application_table_status],0 mov [application_table_status],0
mov esi,process_terminated mov esi,process_terminated
call sys_msg_board_str 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 ret
iglobal iglobal

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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