2010-10-01 11:21:55 +02:00
|
|
|
|
; 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.
|
|
|
|
|
;*****************************************************************************
|
|
|
|
|
|
2013-05-28 21:09:31 +02:00
|
|
|
|
; Модуль парсинга - это стандартный компонент, встраиваемый во вторичный загрузчик.
|
|
|
|
|
; Данный модуль позволяет стандартно произвести разбор ini файла
|
|
|
|
|
; (и с использованием полученных данных ОС будет загружаться дальше).
|
|
|
|
|
; В начале найдем открывающий "[" - это будет указывать на начало
|
|
|
|
|
; секции. Поддерживается 1 секция это [loader], остальные секции могут иметь
|
|
|
|
|
; любые имена, но они должны быть заключены в в скобки []
|
2010-10-01 11:21:55 +02:00
|
|
|
|
macro use_parse
|
|
|
|
|
{
|
|
|
|
|
;input cx=size of ini file
|
|
|
|
|
parse_start:
|
|
|
|
|
;es:di as 2000:0000 new segment
|
2013-05-28 21:09:31 +02:00
|
|
|
|
;установим указатель на загруженный блок
|
2012-03-08 09:33:38 +01:00
|
|
|
|
enter 256, 0 ;set 16 byte for current task in stack
|
2010-10-01 11:21:55 +02:00
|
|
|
|
;we are is not use bp because bp is pointer on array 16 byte
|
2012-03-08 09:33:38 +01:00
|
|
|
|
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]
|
2013-05-28 21:09:31 +02:00
|
|
|
|
;обнулим все переменные выделенные из стека
|
2010-10-01 11:21:55 +02:00
|
|
|
|
;init flag
|
2012-03-08 09:33:38 +01:00
|
|
|
|
xor ax, ax
|
|
|
|
|
mov status_flag, ax
|
2010-10-01 11:21:55 +02:00
|
|
|
|
;set data size
|
2013-05-28 21:09:31 +02:00
|
|
|
|
mov info_real_mode_size, ini_data_ +0x1000 ;изменим значение занятости памяти
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
2013-05-28 21:09:31 +02:00
|
|
|
|
;поиск начала блока.
|
2010-10-01 11:21:55 +02:00
|
|
|
|
;///////////check [loader]
|
|
|
|
|
cld
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov ret_on_ch, .start ;set return
|
|
|
|
|
mov al, byte [es:di]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
push word .first_ret
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp al, ' '
|
2010-10-01 11:21:55 +02:00
|
|
|
|
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
|
2013-05-28 21:09:31 +02:00
|
|
|
|
.first_ret: ;первый возврат
|
2010-10-01 11:21:55 +02:00
|
|
|
|
; jcxz .end_file ;.end_loader ;found or not found parametrs in section exit in section
|
2012-03-08 09:33:38 +01:00
|
|
|
|
test cx, cx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jz error.not_loader
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp al, '['
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jz .parse_loader
|
|
|
|
|
jmp .start
|
2013-05-28 21:09:31 +02:00
|
|
|
|
;////// проверка на наличее секции loader
|
2010-10-01 11:21:55 +02:00
|
|
|
|
use_parse_loader
|
|
|
|
|
;pause
|
|
|
|
|
if DEBUG
|
2012-03-08 09:33:38 +01:00
|
|
|
|
xor ax, ax
|
2010-10-01 11:21:55 +02:00
|
|
|
|
int 16h
|
|
|
|
|
end if
|
2013-05-28 21:09:31 +02:00
|
|
|
|
;////// вывод графического экрана, выбор, секции под дефолту
|
2010-10-01 11:21:55 +02:00
|
|
|
|
use_any_sec
|
2013-05-28 21:09:31 +02:00
|
|
|
|
;парсинг выбраной или дефолтной секции т.е. разбор параметров выполнение сценария
|
2010-10-01 11:21:55 +02:00
|
|
|
|
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
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
}
|