Subversion Repositories Kolibri OS

Rev

Rev 2434 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1065 Lrz 1
; Copyright (c) 2009, 
2
; All rights reserved.
3
;
4
; Redistribution and use in source and binary forms, with or without
5
; modification, are permitted provided that the following conditions are met:
6
;       * Redistributions of source code must retain the above copyright
7
;       notice, this list of conditions and the following disclaimer.
8
;       * Redistributions in binary form must reproduce the above copyright
9
;       notice, this list of conditions and the following disclaimer in the
10
;       documentation and/or other materials provided with the distribution.
11
;       * Neither the name of the  nor the
12
;       names of its contributors may be used to endorse or promote products
13
;       derived from this software without specific prior written permission.
14
;
1151 Lrz 15
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov nickname  ''AS IS'' AND ANY
1065 Lrz 16
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
; DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
19
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
;*****************************************************************************
26
 
3555 Serge 27
; Модуль парсинга - это стандартный компонент, встраиваемый во вторичный загрузчик.
28
; Данный модуль позволяет стандартно произвести разбор ini файла
29
; (и с использованием полученных данных ОС будет загружаться дальше).
30
; В начале найдем открывающий "[" - это будет указывать на начало
31
; секции. Поддерживается 1 секция это [loader], остальные секции могут иметь
32
; любые имена, но они должны быть заключены в в скобки []
1065 Lrz 33
macro  use_parse
34
{
35
;input cx=size of ini file
36
parse_start:
37
;es:di as 2000:0000 new segment
3555 Serge 38
;установим указатель на загруженный блок
2434 Serge 39
        enter   256, 0  ;set 16 byte for current task in stack
1065 Lrz 40
;we are is not use bp because bp is pointer on array 16 byte
2434 Serge 41
        mov     word [save_bp_from_timer], bp   ;save point to own data array
42
        mov     save_cx, cx     ;it's placed size of ini file
43
        les     di, dword [file_data]
3555 Serge 44
;обнулим все переменные выделенные из стека
1065 Lrz 45
;init flag
2434 Serge 46
        xor     ax, ax
47
        mov     status_flag, ax
1065 Lrz 48
;set data size
3555 Serge 49
        mov     info_real_mode_size, ini_data_ +0x1000   ;изменим значение занятости памяти
1065 Lrz 50
 
3555 Serge 51
;поиск начала блока.
1065 Lrz 52
;///////////check [loader]
53
        cld
54
 
2434 Serge 55
        mov     ret_on_ch, .start    ;set return
56
        mov     al, byte [es:di]
1151 Lrz 57
        push    word .first_ret
2434 Serge 58
        cmp     al, ' '
1151 Lrz 59
        jz      .first_sp_1
60
        jmp     get_firs_sym.not_space
1065 Lrz 61
.first_sp_1:
1151 Lrz 62
        jmp     get_firs_sym.first_sp
1065 Lrz 63
 
64
.start:
1151 Lrz 65
        call    get_firs_sym    ;get first symbol on new line
3555 Serge 66
.first_ret:                     ;первый возврат
1151 Lrz 67
;        jcxz   .end_file       ;.end_loader     ;found or not found parametrs in section  exit in section
2434 Serge 68
        test    cx, cx
1151 Lrz 69
        jz      error.not_loader
2434 Serge 70
        cmp     al, '['
1151 Lrz 71
        jz      .parse_loader
72
        jmp     .start
3555 Serge 73
;////// проверка на наличее секции loader
1065 Lrz 74
use_parse_loader
75
;pause
76
if DEBUG
2434 Serge 77
        xor     ax, ax
1065 Lrz 78
        int     16h
1151 Lrz 79
end if
3555 Serge 80
;////// вывод графического экрана, выбор, секции под дефолту
1065 Lrz 81
use_any_sec
3555 Serge 82
;парсинг выбраной или дефолтной секции т.е. разбор параметров выполнение сценария
1065 Lrz 83
use_parse_def_sect
84
 
85
;//////////////////
86
;/end parse block
87
;//////////////////
88
;.end_bl:
89
;        mov     cx,bx
90
;
91
;        jmp     .start
92
 
93
.exit:
94
 
95
;        mov     si,parse_ini_end
96
;        call    printplain
97
;
98
;if DEBUG
99
;        pusha
100
;        mov     ax,cx
101
;        mov     cx,0x0a
102
;        mov     di,show_db1_dec
103
;        mov     dword[ds:di],'    '
104
;        call    decode
105
;Show size
106
;        mov     si,show_db1
107
;        call    printplain
108
;
109
;        popa
110
;end if
111
        jmp     $
112
 
113
;///////////////////procedure //////////
114
;input es:di - is pointer to date
115
;cx - counter
116
;return: cx - status if =0 - end of date else es:di point to first symbol on new line
117
 
2434 Serge 118
}