small optimization. reduce code size

git-svn-id: svn://kolibrios.org@501 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-05-16 19:12:34 +00:00
parent fef3689506
commit 59eaa9f2bd
3 changed files with 126 additions and 95 deletions

View File

@ -83,14 +83,23 @@ szEXPORTS db 'EXPORTS',0
szIMPORTS db 'IMPORTS',0 szIMPORTS db 'IMPORTS',0
firstapp db '%sys%/LAUNCHER',0 firstapp db '%sys%/LAUNCHER',0
char dd 0,0,0
dd 2560 if 0
dd FONT_I char dd 0,0,0
db '%sys%/FONTS/CHAR.MT',0 dd 2560
char2 dd 0,0,0 dd FONT_I
dd 2560 db '%sys%/FONTS/CHAR.MT',0
dd FONT_II
db '%sys%/FONTS/CHAR2.MT',0 char2 dd 0,0,0
dd 2560
dd FONT_II
db '%sys%/FONTS/CHAR2.MT',0
else
char db '%sys%/FONTS/CHAR.MT',0
char2 db '%sys%/FONTS/CHAR2.MT',0
end if
bootpath db '/KOLIBRI ' bootpath db '/KOLIBRI '

View File

@ -13,13 +13,15 @@ locals
param rb 60 param rb 60
val rb 60 val rb 60
tmpsrc rb 60 ; ¢à¥¬¥­­®¥ åà ­¥­¨¥ ¯à¥®¡à §®¢ ­¨ï tmpsrc rb 60 ; ¢à¥¬¥­­®¥ åà ­¥­¨¥ ¯à¥®¡à §®¢ ­¨ï
endl endl
pushad pushad
mov esi,[sourc] mov esi,[sourc]
mov edi,ebp ; mov edi,ebp
add edi,tmpsrc-ebp ; add edi,tmpsrc-ebp
lea edi, [tmpsrc]
@@: @@:
lodsb lodsb
stosb stosb
@ -29,55 +31,62 @@ endl
mov al,[conf_file_loaded] ; âॡã¥âáï ¯à¨ ®¡à é¥­¨¨ ª ¯¥à¢®¬ã ä ©«ã (ª®­ä¨£ã) mov al,[conf_file_loaded] ; âॡã¥âáï ¯à¨ ®¡à é¥­¨¨ ª ¯¥à¢®¬ã ä ©«ã (ª®­ä¨£ã)
or al,al or al,al
jnz @use_replace jnz @use_replace
jmp full_file_name_exit jmp full_file_name_exit
;-------------------------------- ;--------------------------------
@use_replace: @use_replace:
xor eax,eax xor eax,eax
.loop: .loop:
push eax push eax
mov ebx,ebp ; mov ebx,ebp
add ebx,param-ebp ; add ebx,param-ebp
mov ecx,ebp ; mov ecx,ebp
add ecx,val-ebp ; add ecx,val-ebp
lea ebx, [param]
lea ecx, [val]
invoke ini.get_par,sect, ebx, ecx, eax invoke ini.get_par,sect, ebx, ecx, eax
mov bl,[param] mov bl,[param]
or bl,bl or bl,bl
jz .done jz .done
mov eax,ebp ; mov eax,ebp
add eax,tmpsrc-ebp ; add eax,tmpsrc-ebp
mov ebx,ebp ; mov ebx,ebp
add ebx,param-ebp ; add ebx,param-ebp
mov ecx,ebp ; mov ecx,ebp
add ecx,val-ebp ; add ecx,val-ebp
mov edx,[dest] lea eax, [tmpsrc]
lea ebx, [param]
lea ecx, [val]
mov edx,[dest]
stdcall full_file_name_parse, eax,edx,ebx,ecx stdcall full_file_name_parse, eax,edx,ebx,ecx
mov esi,[dest] mov esi,[dest]
mov edi,ebp ; mov edi,ebp
add edi,tmpsrc-ebp ; add edi,tmpsrc-ebp
lea edi, [tmpsrc]
@@: @@:
lodsb lodsb
stosb stosb
or al,al or al,al
jnz @b jnz @b
pop eax pop eax
inc eax inc eax
jmp .loop jmp .loop
.done: .done:
pop eax pop eax
full_file_name_exit: full_file_name_exit:
mov eax,ebp ; mov eax,ebp
add eax,tmpsrc-ebp ; add eax,tmpsrc-ebp
lea eax, [tmpsrc]
stdcall full_file_name_parse , eax , [dest], sysdir_ , sys_path stdcall full_file_name_parse , eax , [dest], sysdir_ , sys_path
popad popad
ret ret
@ -104,7 +113,7 @@ proc full_file_name_parse stdcall,sourc,dest,def,dval
je @@bad_s je @@bad_s
cmp dl,0 cmp dl,0
je @@good je @@good
or cl,0x20 or cl,0x20
or dl,0x20 or dl,0x20
cmp cl,dl cmp cl,dl
@ -116,8 +125,8 @@ proc full_file_name_parse stdcall,sourc,dest,def,dval
@@bad_s: @@bad_s:
cmp dl,0 cmp dl,0
je @@good je @@good
@@bad: @@bad:
mov edi,[dest] mov edi,[dest]
mov esi,[sourc] mov esi,[sourc]
@ -136,23 +145,23 @@ proc full_file_name_parse stdcall,sourc,dest,def,dval
lodsb lodsb
stosb stosb
or al,al or al,al
jnz @b jnz @b
@@goodl: @@goodl:
pop esi pop esi
dec edi dec edi
@@: @@:
lodsb lodsb
stosb stosb
or al,al or al,al
jnz @b jnz @b
@@ret_ok: @@ret_ok:
popad popad
ret ret
endp endp
sys_dir_mess: db 'System dir is ' sys_dir_mess: db 'System dir is '
sys_path: db '/HD0/1/KOLIBRI',0,0 sys_path: db '/HD0/1/KOLIBRI',0,0
sysdir_ db '%sys%',0 sysdir_ db '%sys%',0
@ -176,8 +185,8 @@ Parser_params:
mov [sys_path+6],dword '/KOL' mov [sys_path+6],dword '/KOL'
mov [sys_path+10],dword 'IBRI' mov [sys_path+10],dword 'IBRI'
mov [sys_path+14],word 0 ;0x002F mov [sys_path+14],word 0 ;0x002F
.done: .done:
popad popad
ret ret

View File

@ -552,27 +552,18 @@ no_lib_load:
; LOAD FONTS I and II ; LOAD FONTS I and II
; mov esi,char
; xor ebx,ebx
; mov ecx,2560
; mov edx,FONT_I
; call fs_RamdiskRead
; mov esi,char2 ; pushad
; xor ebx,ebx ; push eax
; mov ecx,2560;26000 ; mov eax,char
; mov edx,FONT_II ; call file_system_lfn
; call fs_RamdiskRead ; mov eax,char2
; call file_system_lfn
pushad ; pop eax
push eax ; popad
mov eax,char
call file_system_lfn
mov eax,char2
call file_system_lfn
pop eax
popad
stdcall read_file, char, FONT_I, 0, 2560
stdcall read_file, char2, FONT_II, 0, 2560
mov esi,boot_fonts mov esi,boot_fonts
call boot_log call boot_log
@ -657,10 +648,10 @@ no_lib_load:
mov esi,boot_setostask mov esi,boot_setostask
call boot_log call boot_log
mov eax, fpu_data xor eax, eax
mov dword [SLOT_BASE+APPDATA.fpu_state], eax mov dword [SLOT_BASE+APPDATA.fpu_state], fpu_data
mov dword [SLOT_BASE+APPDATA.fpu_handler], 0 mov dword [SLOT_BASE+APPDATA.fpu_handler], eax
mov dword [SLOT_BASE+APPDATA.sse_handler], 0 mov dword [SLOT_BASE+APPDATA.sse_handler], eax
; name for OS/IDLE process ; name for OS/IDLE process
@ -680,9 +671,8 @@ no_lib_load:
cld cld
rep movsd rep movsd
mov dword [SLOT_BASE+256+APPDATA.fpu_handler], 0 mov dword [SLOT_BASE+256+APPDATA.fpu_handler], eax
mov dword [SLOT_BASE+256+APPDATA.sse_handler], 0 mov dword [SLOT_BASE+256+APPDATA.sse_handler], eax
mov dword [SLOT_BASE+256+APPDATA.cursor], ebx
mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
mov dword [SLOT_BASE+256+APPDATA.fd_obj], ebx mov dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
@ -766,19 +756,13 @@ no_lib_load:
; LOAD FIRST APPLICATION ; LOAD FIRST APPLICATION
cli cli
if 0
cmp byte [BOOT_VAR+0x9030],1 cmp byte [BOOT_VAR+0x9030],1
jne no_load_vrr_m jne no_load_vrr_m
; mov ebp, vrr_m
; xor ebx, ebx
; xor edx, edx
; call fs_execute
; cmp eax,2 ; if vrr_m app found (PID=2)
; je first_app_found
stdcall kernel_alloc, 0x100 stdcall kernel_alloc, 0x100
push eax push eax
mov ebx,eax mov ebx,eax
stdcall full_file_name,vrr_m,eax stdcall full_file_name,vrr_m,eax
mov ebp, eax mov ebp, eax
@ -790,21 +774,14 @@ no_lib_load:
push eax push eax
stdcall kernel_free, ebx stdcall kernel_free, ebx
pop eax pop eax
cmp eax,2 ; if vrr_m app found (PID=2) cmp eax,2 ; if vrr_m app found (PID=2)
je first_app_found je first_app_found
no_load_vrr_m: no_load_vrr_m:
; mov ebp, firstapp
; xor ebx, ebx
; xor edx, edx
; call fs_execute
; cmp eax,2 ; continue if a process has been loaded
; je first_app_found
; mov eax, 0xDEADBEEF ; otherwise halt
; hlt
stdcall kernel_alloc, 0x100 stdcall kernel_alloc, 0x100
push eax push eax
mov ebx,eax mov ebx,eax
stdcall full_file_name,firstapp,eax stdcall full_file_name,firstapp,eax
mov ebp, eax mov ebp, eax
@ -820,8 +797,44 @@ no_load_vrr_m:
mov eax, 0xDEADBEEF ; otherwise halt mov eax, 0xDEADBEEF ; otherwise halt
hlt hlt
first_app_found:
else
sub esp, 0x100
cmp byte [BOOT_VAR+0x9030],1
jne no_load_vrr_m
mov ebp, esp
stdcall full_file_name,vrr_m,ebp
xor ebx, ebx
xor edx, edx
call fs_execute
cmp eax,2 ; if vrr_m app found (PID=2)
je first_app_found
no_load_vrr_m:
mov ebp, esp
stdcall full_file_name,firstapp,ebp
xor ebx, ebx
xor edx, edx
call fs_execute
cmp eax,2 ; continue if a process has been loaded
je first_app_found
mov eax, 0xDEADBEEF ; otherwise halt
hlt
first_app_found: first_app_found:
add esp, 0x100
end if
cli cli
;mov [TASK_COUNT],dword 2 ;mov [TASK_COUNT],dword 2
@ -2423,8 +2436,8 @@ sys_background:
cmp eax,2 ; SET PIXEL cmp eax,2 ; SET PIXEL
jnz nosb2 jnz nosb2
mov edx,[mem_BACKGROUND] mov edx,[mem_BACKGROUND]
cmp edx,ebx cmp edx,ebx
jbe nosb2 jbe nosb2
mov edx,[ebx] mov edx,[ebx]
and edx,0xFF000000 ;255*256*256*256 and edx,0xFF000000 ;255*256*256*256
@ -3446,10 +3459,10 @@ checkmisc:
cmp [ctrl_alt_del], 1 cmp [ctrl_alt_del], 1
jne nocpustart jne nocpustart
stdcall kernel_alloc, 0x100 stdcall kernel_alloc, 0x100
push eax push eax
mov ebx,eax mov ebx,eax
stdcall full_file_name,cpustring,eax stdcall full_file_name,cpustring,eax
mov ebp, eax mov ebp, eax
@ -3462,7 +3475,7 @@ checkmisc:
push eax push eax
stdcall kernel_free, ebx stdcall kernel_free, ebx
pop eax pop eax
mov [ctrl_alt_del], 0 mov [ctrl_alt_del], 0
nocpustart: nocpustart: