Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
2288 clevermous 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
;
15
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov nickname  ''AS IS'' AND ANY
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
 
27
; Модуль парсинга - это стандартный компонент, встраиваемый во вторичный загрузчик.
28
; Данный модуль позволяет стандартно произвести разбор ini файла
29
; (и с использованием полученных данных ОС будет загружаться дальше).
30
; В начале найдем открывающий "[" - это будет указывать на начало
31
; секции. Поддерживается 1 секция это [loader], остальные секции могут иметь
32
; любые имена, но они должны быть заключены в в скобки []
33
macro  use_parse
34
{
35
;input cx=size of ini file
36
parse_start:
37
;es:di as 2000:0000 new segment
38
;установим указатель на загруженный блок
39
        enter   256, 0  ;set 16 byte for current task in stack
40
;we are is not use bp because bp is pointer on array 16 byte
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]
44
;обнулим все переменные выделенные из стека
45
;init flag
46
        xor     ax, ax
47
        mov     status_flag, ax
48
;set data size
49
        mov     info_real_mode_size, ini_data_ +0x1000   ;изменим значение занятости памяти
50
 
51
;поиск начала блока.
52
;///////////check [loader]
53
        cld
54
 
55
        mov     ret_on_ch, .start    ;set return
56
        mov     al, byte [es:di]
57
        push    word .first_ret
58
        cmp     al, ' '
59
        jz      .first_sp_1
60
        jmp     get_firs_sym.not_space
61
.first_sp_1:
62
        jmp     get_firs_sym.first_sp
63
 
64
.start:
65
        call    get_firs_sym    ;get first symbol on new line
66
.first_ret:                     ;первый возврат
67
;        jcxz   .end_file       ;.end_loader     ;found or not found parametrs in section  exit in section
68
        test    cx, cx
69
        jz      error.not_loader
70
        cmp     al, '['
71
        jz      .parse_loader
72
        jmp     .start
73
;////// проверка на наличее секции loader
74
use_parse_loader
75
;pause
76
if DEBUG
77
        xor     ax, ax
78
        int     16h
79
end if
80
;////// вывод графического экрана, выбор, секции под дефолту
81
use_any_sec
82
;парсинг выбраной или дефолтной секции т.е. разбор параметров выполнение сценария
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
 
118
}