diff --git a/kernel/trunk/core/conf_lib.inc b/kernel/trunk/core/conf_lib.inc index ed961e8db3..819a0a883a 100644 --- a/kernel/trunk/core/conf_lib.inc +++ b/kernel/trunk/core/conf_lib.inc @@ -8,16 +8,10 @@ ;------------------------------------------------------------------------- conf_file_loaded: db 0 ; флаг загрузки конфига +conf_path_sect: db 'path',0 + +conf_fname db '%sys%/sys.conf',0 -; загрузка ини файла в библиотеку -proc load_conf_file - pushad - invoke ini.load,.fname - mov [conf_file_loaded],byte 1 - popad - ret - .fname db '%sys%/sys.conf',0 -endp proc set_kernel_conf @@ -27,10 +21,9 @@ endl pushad ;[gui] ;mouse_speed - mov eax,ebp - add eax,par-ebp + lea eax,[par] push eax - invoke ini.get_str, ugui, ugui_mouse_speed, eax, ugui_mouse_speed_def + invoke ini.get_str,conf_fname, ugui, ugui_mouse_speed, eax,30, ugui_mouse_speed_def pop eax stdcall strtoint,eax push eax @@ -41,10 +34,9 @@ endl ret ;mouse_delay - mov eax,ebp - add eax,par-ebp + lea eax,[par] push eax - invoke ini.get_str, ugui, ugui_mouse_delay, eax, ugui_mouse_delay_def + invoke ini.get_str,conf_fname, ugui, ugui_mouse_delay, eax,30, ugui_mouse_delay_def pop eax stdcall strtoint,eax push eax @@ -53,10 +45,9 @@ endl ;[dev] ;sb16 - mov eax,ebp - add eax,par-ebp + lea eax,[par] push eax - invoke ini.get_str, udev, udev_sb16, eax, udev_sb16_def + invoke ini.get_str,conf_fname, udev, udev_sb16, eax,30, udev_sb16_def pop eax stdcall strtoint,eax push eax @@ -64,10 +55,9 @@ endl call _sb16 ;sound_dma - mov eax,ebp - add eax,par-ebp + lea eax,[par] push eax - invoke ini.get_str, udev, udev_sound_dma, eax, udev_sound_dma_def + invoke ini.get_str,conf_fname, udev, udev_sound_dma, eax,30, udev_sound_dma_def pop eax stdcall strtoint,eax push eax @@ -76,16 +66,16 @@ endl ;midibase - mov eax,ebp - add eax,par-ebp + lea eax,[par] push eax - invoke ini.get_str, udev, udev_midibase, eax, udev_midibase_def + invoke ini.get_str,conf_fname, udev, udev_midibase, eax,30, udev_midibase_def pop eax stdcall strtoint,eax push eax pop ecx call _midibase - + + popad ret endp @@ -104,6 +94,63 @@ udev_sound_dma_def db '1',0 udev_midibase db 'midibase',0 udev_midibase_def db '0x320',0 +proc set_network_conf +locals + par db 30 dup(?) +endl + pushad + + ;[net] + ;active + lea eax,[par] + invoke ini.get_int,conf_fname, unet, unet_active, 0 + or eax,eax + jz .do_not_set_net + call _net_up + + ;addr + lea eax,[par] + push eax + invoke ini.get_str,conf_fname, unet, unet_addr, eax,30, unet_def + pop eax + stdcall do_inet_adr,eax + push eax + pop ecx + call _net_addr + + ;mask + lea eax,[par] + push eax + invoke ini.get_str,conf_fname, unet, unet_mask, eax,30, unet_def + pop eax + stdcall do_inet_adr,eax + push eax + pop ecx + call _net_mask + + ;gate + lea eax,[par] + push eax + invoke ini.get_str,conf_fname, unet, unet_gate, eax,30, unet_def + pop eax + stdcall do_inet_adr,eax + push eax + pop ecx + call _net_gate +.do_not_set_net: + popad + ret + + +endp + +unet db 'net',0 +unet_active db 'active',0 +unet_addr db 'addr',0 +unet_mask db 'mask',0 +unet_gate db 'gate',0 +unet_def db 0 + ; конверчение строки в DWord в eax (по второму символу определяет систему счисления) proc strtoint stdcall,strs @@ -238,6 +285,39 @@ proc strtoint_hex stdcall,strs endp + ; преобразовать адрес в то что нада, если пусто то вернуть 0 +proc do_inet_adr stdcall,strs + pushad + + mov esi,[strs] + mov ebx,0 +.next: + push esi +@@: + lodsb + or al,al + jz @f + cmp al,'.' + jz @f + jmp @b +@@: + mov cl, al + mov [esi-1],byte 0 + ;pop eax + call strtoint_dec + rol eax,24 + ror ebx,8 + add ebx,eax + or cl,cl + jz @f + jmp .next +@@: + mov [esp+28],ebx + popad + ret +endp + + ; установки из setup _mouse_speed: @@ -271,4 +351,35 @@ _midibase: mov eax,21 mov ebx,1 int 0x40 + ret + +_net_addr: + mov eax,52 + mov ebx,3 + int 0x40 + ret + +_net_mask: + mov eax,52 + mov ebx,12 + int 0x40 + ret + +_net_gate: + mov eax,52 + mov ebx,11 + int 0x40 + ret + +_net_up: + mov eax,52 + mov ebx,0 + int 0x40 + and eax,0xFFFFFF80 + add eax,3 + mov ecx,eax + + mov eax,52 + mov ebx,2 + int 0x40 ret \ No newline at end of file diff --git a/kernel/trunk/fs/parse_fn.inc b/kernel/trunk/fs/parse_fn.inc index baf10e5c29..ecc80ff000 100644 --- a/kernel/trunk/fs/parse_fn.inc +++ b/kernel/trunk/fs/parse_fn.inc @@ -7,20 +7,16 @@ ; ;------------------------------------------------------------------------- +full_file_name_table dd 0 ; указатель на память для таблицы путей 4К запись 64 (32 - строка шаблон для поиска, 32 - строка шаблон для замены) + ; перебирает по файлу варианты замен proc full_file_name stdcall,sourc,dest locals - param rb 60 - val rb 60 tmpsrc rb 60 ; временное хранение преобразования endl pushad - - mov esi,[sourc] -; mov edi,ebp -; add edi,tmpsrc-ebp - lea edi, [tmpsrc] + lea edi, [tmpsrc] @@: lodsb @@ -41,34 +37,22 @@ endl xor eax,eax .loop: push eax -; mov ebx,ebp -; add ebx,param-ebp -; mov ecx,ebp -; add ecx,val-ebp - lea ebx, [param] - lea ecx, [val] - invoke ini.get_par,sect, ebx, ecx, eax - - mov bl,[param] - or bl,bl + + imul eax,eax,64 + add eax,[full_file_name_table] + mov ebx,eax + add eax,32 + + mov cl,[ebx] + or cl,cl jz .done -; mov eax,ebp -; add eax,tmpsrc-ebp -; mov ebx,ebp -; add ebx,param-ebp -; mov ecx,ebp -; add ecx,val-ebp - lea eax, [tmpsrc] - lea ebx, [param] - lea ecx, [val] + lea ecx, [tmpsrc] mov edx,[dest] - stdcall full_file_name_parse, eax,edx,ebx,ecx + stdcall full_file_name_parse, ecx,edx,ebx,eax mov esi,[dest] -; mov edi,ebp -; add edi,tmpsrc-ebp lea edi, [tmpsrc] @@: lodsb @@ -84,16 +68,12 @@ endl pop eax full_file_name_exit: -; mov eax,ebp -; add eax,tmpsrc-ebp lea eax, [tmpsrc] stdcall full_file_name_parse , eax , [dest], sysdir_ , sys_path popad ret endp -sect: db 'path',0 - ; ; Преобразовать имя в полное. Если в начале стоит ; sourc - ссылка на строку... @@ -189,4 +169,48 @@ Parser_params: .done: popad ret + +proc load_file_parse_table + pushad + stdcall kernel_alloc,0x1000 + mov [full_file_name_table],eax + + invoke ini.enum_keys,conf_fname,conf_path_sect,get_every_key + + mov eax,[loading_counter] + imul eax,eax,64 + add eax,[full_file_name_table] + mov [eax],byte 0 + popad + ret +endp + +loading_counter dd 0 +def_val_1 db 0 + +proc get_every_key stdcall,f_name, sec_name, key_name + pushad + mov esi,[key_name] + mov edi,[loading_counter] + imul edi,edi,64 + add edi,[full_file_name_table] +@@: + lodsb + stosb + or al,al + jnz @b + + mov eax,[loading_counter] + imul eax,eax,64 + add eax,[full_file_name_table] + add eax,32 + mov ebx,[key_name] + invoke ini.get_str,conf_fname,conf_path_sect,ebx,eax,32,def_val_1 + + inc dword [loading_counter] + + popad + mov eax,1 + ret +endp diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index cdd135e272..903f354a5e 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -546,8 +546,9 @@ include 'vmodeld.inc' je no_lib_load ; LOADING LIBRARES stdcall dll.Load,@IMPORT ; SPraid - чруЁєчър ЇєэъЎшюэрыр (яюър ўЄю шэш Їрщы) - call load_conf_file ; prepare configuration file + call load_file_parse_table ; prepare file parse table call set_kernel_conf ; configure devices and gui + mov byte [conf_file_loaded],1 no_lib_load: ; LOAD FONTS I and II @@ -754,6 +755,12 @@ no_lib_load: stdcall map_page,tss._io_map_1,\ (tss._io_map_1-OS_BASE), PG_MAP + mov ax,[OS_BASE+0x10000+bx_from_load] + cmp ax,'r1' ; хёыш ёЁрь фшёъ - Єю эх уЁєчшЄ№ сшсышюЄхъш + je no_st_network + call set_network_conf + no_st_network: + ; LOAD FIRST APPLICATION cli diff --git a/kernel/trunk/lib_func.inc b/kernel/trunk/lib_func.inc index b0e2a61b76..2ff82895bf 100644 --- a/kernel/trunk/lib_func.inc +++ b/kernel/trunk/lib_func.inc @@ -13,9 +13,10 @@ @IMPORT: library \ - libini,'inifiles.obj' + libini,'libini.obj' import libini, \ - ini.load,'ini.load',\ + lib_init,'lib_init',\ ini.get_str,'ini.get_str',\ - ini.get_par,'ini.get_par' \ No newline at end of file + ini.enum_keys,'ini.enum_keys',\ + ini.get_int,'ini.get_int' \ No newline at end of file diff --git a/kernel/trunk/sys.conf b/kernel/trunk/sys.conf index e57aa4909d..e2f74ee22d 100644 --- a/kernel/trunk/sys.conf +++ b/kernel/trunk/sys.conf @@ -2,13 +2,17 @@ /rd/1=%sys% %sys%/dll=%sys%/lib +[net] +active=1 +addr=192.168.1.2 +mask=255.255.255.0 +gate=192.168.1.1 + [gui] -mouse_speed=2 +mouse_speed=1 mouse_delay=0x00A [dev] sb16=0x220 sound_dma=1 midibase=0x320 - -[end] \ No newline at end of file