kolibrios-gitea/kernel/branches/Kolibri-acpi/sec_loader/trunk/parse.inc
Sergey Semyonov (Serge) 8f992ed021 acpi branch
git-svn-id: svn://kolibrios.org@1635 a494cfbc-eb01-0410-851d-a64ba20cac60
2010-10-01 09:21:55 +00:00

118 lines
4.3 KiB
PHP

; Copyright (c) 2009, <Lrz>
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> nor the
; names of its contributors may be used to endorse or promote products
; derived from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov nickname <Lrz> ''AS IS'' AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
; Ìîäóëü ïàðñèíãà - ýòî ñòàíäàðòíûé êîìïîíåíò, âñòðàèâàåìûé âî âòîðè÷íûé çàãðóç÷èê.
; Äàííûé ìîäóëü ïîçâîëÿåò ñòàíäàðòíî ïðîèçâåñòè ðàçáîð ini ôàéëà
; (è ñ èñïîëüçîâàíèåì ïîëó÷åííûõ äàííûõ ÎÑ áóäåò çàãðóæàòüñÿ äàëüøå).
;  íà÷àëå íàéäåì îòêðûâàþùèé "[" - ýòî áóäåò óêàçûâàòü íà íà÷àëî
; ñåêöèè. Ïîääåðæèâàåòñÿ 1 ñåêöèÿ ýòî [loader], îñòàëüíûå ñåêöèè ìîãóò èìåòü
; ëþáûå èìåíà, íî îíè äîëæíû áûòü çàêëþ÷åíû â â ñêîáêè []
macro use_parse
{
;input cx=size of ini file
parse_start:
;es:di as 2000:0000 new segment
;óñòàíîâèì óêàçàòåëü íà çàãðóæåííûé áëîê
enter 256,0 ;set 16 byte for current task in stack
;we are is not use bp because bp is pointer on array 16 byte
mov word [save_bp_from_timer],bp ;save point to own data array
mov save_cx,cx ;it's placed size of ini file
les di,dword [file_data]
;îáíóëèì âñå ïåðåìåííûå âûäåëåííûå èç ñòåêà
;init flag
xor ax,ax
mov status_flag,ax
;set data size
mov info_real_mode_size,ini_data_ +0x1000 ;èçìåíèì çíà÷åíèå çàíÿòîñòè ïàìÿòè
;ïîèñê íà÷àëà áëîêà.
;///////////check [loader]
cld
mov ret_on_ch,.start ;set return
mov al,byte [es:di]
push word .first_ret
cmp al,' '
jz .first_sp_1
jmp get_firs_sym.not_space
.first_sp_1:
jmp get_firs_sym.first_sp
.start:
call get_firs_sym ;get first symbol on new line
.first_ret: ;ïåðâûé âîçâðàò
; jcxz .end_file ;.end_loader ;found or not found parametrs in section exit in section
test cx,cx
jz error.not_loader
cmp al,'['
jz .parse_loader
jmp .start
;////// ïðîâåðêà íà íàëè÷åå ñåêöèè loader
use_parse_loader
;pause
if DEBUG
xor ax,ax
int 16h
end if
;////// âûâîä ãðàôè÷åñêîãî ýêðàíà, âûáîð, ñåêöèè ïîä äåôîëòó
use_any_sec
;ïàðñèíã âûáðàíîé èëè äåôîëòíîé ñåêöèè ò.å. ðàçáîð ïàðàìåòðîâ âûïîëíåíèå ñöåíàðèÿ
use_parse_def_sect
;//////////////////
;/end parse block
;//////////////////
;.end_bl:
; mov cx,bx
;
; jmp .start
.exit:
; mov si,parse_ini_end
; call printplain
;
;if DEBUG
; pusha
; mov ax,cx
; mov cx,0x0a
; mov di,show_db1_dec
; mov dword[ds:di],' '
; call decode
;Show size
; mov si,show_db1
; call printplain
;
; popa
;end if
jmp $
;///////////////////procedure //////////
;input es:di - is pointer to date
;cx - counter
;return: cx - status if =0 - end of date else es:di point to first symbol on new line
}