Rev 2288 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2288 | Rev 3539 | ||
---|---|---|---|
1 | ; Copyright (c) 2009, |
1 | ; Copyright (c) 2009, |
2 | ; All rights reserved. |
2 | ; All rights reserved. |
3 | ; |
3 | ; |
4 | ; Redistribution and use in source and binary forms, with or without |
4 | ; Redistribution and use in source and binary forms, with or without |
5 | ; modification, are permitted provided that the following conditions are met: |
5 | ; modification, are permitted provided that the following conditions are met: |
6 | ; * Redistributions of source code must retain the above copyright |
6 | ; * Redistributions of source code must retain the above copyright |
7 | ; notice, this list of conditions and the following disclaimer. |
7 | ; notice, this list of conditions and the following disclaimer. |
8 | ; * Redistributions in binary form must reproduce the above copyright |
8 | ; * Redistributions in binary form must reproduce the above copyright |
9 | ; notice, this list of conditions and the following disclaimer in the |
9 | ; notice, this list of conditions and the following disclaimer in the |
10 | ; documentation and/or other materials provided with the distribution. |
10 | ; documentation and/or other materials provided with the distribution. |
11 | ; * Neither the name of the |
11 | ; * Neither the name of the |
12 | ; names of its contributors may be used to endorse or promote products |
12 | ; names of its contributors may be used to endorse or promote products |
13 | ; derived from this software without specific prior written permission. |
13 | ; derived from this software without specific prior written permission. |
14 | ; |
14 | ; |
15 | ; THIS SOFTWARE IS PROVIDED BY Alexey Teplov nickname |
15 | ; THIS SOFTWARE IS PROVIDED BY Alexey Teplov nickname |
16 | ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
16 | ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
17 | ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
17 | ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
18 | ; DISCLAIMED. IN NO EVENT SHALL |
18 | ; DISCLAIMED. IN NO EVENT SHALL |
19 | ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
19 | ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
20 | ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
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 |
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 |
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 |
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. |
24 | ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | ;***************************************************************************** |
25 | ;***************************************************************************** |
26 | 26 | ||
27 | ; Ìîäóëü ïàðñèíãà - ýòî ñòàíäàðòíûé êîìïîíåíò, âñòðàèâàåìûé âî âòîðè÷íûé çàãðóç÷èê. |
27 | ; Модуль парсинга - это стандартный компонент, встраиваемый во вторичный загрузчик. |
28 | ; Äàííûé ìîäóëü ïîçâîëÿåò ñòàíäàðòíî ïðîèçâåñòè ðàçáîð ini ôàéëà |
28 | ; Данный модуль позволяет стандартно произвести разбор ini файла |
29 | ; (è ñ èñïîëüçîâàíèåì ïîëó÷åííûõ äàííûõ ÎÑ áóäåò çàãðóæàòüñÿ äàëüøå). |
29 | ; (и с использованием полученных данных ОС будет загружаться дальше). |
30 | ;  íà÷àëå íàéäåì îòêðûâàþùèé "[" - ýòî áóäåò óêàçûâàòü íà íà÷àëî |
30 | ; В начале найдем открывающий "[" - это будет указывать на начало |
31 | ; ñåêöèè. Ïîääåðæèâàåòñÿ 1 ñåêöèÿ ýòî [loader], îñòàëüíûå ñåêöèè ìîãóò èìåòü |
31 | ; секции. Поддерживается 1 секция это [loader], остальные секции могут иметь |
32 | ; ëþáûå èìåíà, íî îíè äîëæíû áûòü çàêëþ÷åíû â â ñêîáêè [] |
32 | ; любые имена, но они должны быть заключены в в скобки [] |
33 | macro use_parse |
33 | macro use_parse |
34 | { |
34 | { |
35 | ;input cx=size of ini file |
35 | ;input cx=size of ini file |
36 | parse_start: |
36 | parse_start: |
37 | ;es:di as 2000:0000 new segment |
37 | ;es:di as 2000:0000 new segment |
38 | ;óñòàíîâèì óêàçàòåëü íà çàãðóæåííûé áëîê |
38 | ;установим указатель на загруженный блок |
39 | enter 256, 0 ;set 16 byte for current task in stack |
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 |
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 |
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 |
42 | mov save_cx, cx ;it's placed size of ini file |
43 | les di, dword [file_data] |
43 | les di, dword [file_data] |
44 | ;îáíóëèì âñå ïåðåìåííûå âûäåëåííûå èç ñòåêà |
44 | ;обнулим все переменные выделенные из стека |
45 | ;init flag |
45 | ;init flag |
46 | xor ax, ax |
46 | xor ax, ax |
47 | mov status_flag, ax |
47 | mov status_flag, ax |
48 | ;set data size |
48 | ;set data size |
49 | mov info_real_mode_size, ini_data_ +0x1000 ;èçìåíèì çíà÷åíèå çàíÿòîñòè ïàìÿòè |
49 | mov info_real_mode_size, ini_data_ +0x1000 ;изменим значение занятости памяти |
50 | 50 | ||
51 | ;ïîèñê íà÷àëà áëîêà. |
51 | ;поиск начала блока. |
52 | ;///////////check [loader] |
52 | ;///////////check [loader] |
53 | cld |
53 | cld |
54 | 54 | ||
55 | mov ret_on_ch, .start ;set return |
55 | mov ret_on_ch, .start ;set return |
56 | mov al, byte [es:di] |
56 | mov al, byte [es:di] |
57 | push word .first_ret |
57 | push word .first_ret |
58 | cmp al, ' ' |
58 | cmp al, ' ' |
59 | jz .first_sp_1 |
59 | jz .first_sp_1 |
60 | jmp get_firs_sym.not_space |
60 | jmp get_firs_sym.not_space |
61 | .first_sp_1: |
61 | .first_sp_1: |
62 | jmp get_firs_sym.first_sp |
62 | jmp get_firs_sym.first_sp |
63 | 63 | ||
64 | .start: |
64 | .start: |
65 | call get_firs_sym ;get first symbol on new line |
65 | call get_firs_sym ;get first symbol on new line |
66 | .first_ret: ;ïåðâûé âîçâðàò |
66 | .first_ret: ;первый возврат |
67 | ; jcxz .end_file ;.end_loader ;found or not found parametrs in section exit in section |
67 | ; jcxz .end_file ;.end_loader ;found or not found parametrs in section exit in section |
68 | test cx, cx |
68 | test cx, cx |
69 | jz error.not_loader |
69 | jz error.not_loader |
70 | cmp al, '[' |
70 | cmp al, '[' |
71 | jz .parse_loader |
71 | jz .parse_loader |
72 | jmp .start |
72 | jmp .start |
73 | ;////// ïðîâåðêà íà íàëè÷åå ñåêöèè loader |
73 | ;////// проверка на наличее секции loader |
74 | use_parse_loader |
74 | use_parse_loader |
75 | ;pause |
75 | ;pause |
76 | if DEBUG |
76 | if DEBUG |
77 | xor ax, ax |
77 | xor ax, ax |
78 | int 16h |
78 | int 16h |
79 | end if |
79 | end if |
80 | ;////// âûâîä ãðàôè÷åñêîãî ýêðàíà, âûáîð, ñåêöèè ïîä äåôîëòó |
80 | ;////// вывод графического экрана, выбор, секции под дефолту |
81 | use_any_sec |
81 | use_any_sec |
82 | ;ïàðñèíã âûáðàíîé èëè äåôîëòíîé ñåêöèè ò.å. ðàçáîð ïàðàìåòðîâ âûïîëíåíèå ñöåíàðèÿ |
82 | ;парсинг выбраной или дефолтной секции т.е. разбор параметров выполнение сценария |
83 | use_parse_def_sect |
83 | use_parse_def_sect |
84 | 84 | ||
85 | ;////////////////// |
85 | ;////////////////// |
86 | ;/end parse block |
86 | ;/end parse block |
87 | ;////////////////// |
87 | ;////////////////// |
88 | ;.end_bl: |
88 | ;.end_bl: |
89 | ; mov cx,bx |
89 | ; mov cx,bx |
90 | ; |
90 | ; |
91 | ; jmp .start |
91 | ; jmp .start |
92 | 92 | ||
93 | .exit: |
93 | .exit: |
94 | 94 | ||
95 | ; mov si,parse_ini_end |
95 | ; mov si,parse_ini_end |
96 | ; call printplain |
96 | ; call printplain |
97 | ; |
97 | ; |
98 | ;if DEBUG |
98 | ;if DEBUG |
99 | ; pusha |
99 | ; pusha |
100 | ; mov ax,cx |
100 | ; mov ax,cx |
101 | ; mov cx,0x0a |
101 | ; mov cx,0x0a |
102 | ; mov di,show_db1_dec |
102 | ; mov di,show_db1_dec |
103 | ; mov dword[ds:di],' ' |
103 | ; mov dword[ds:di],' ' |
104 | ; call decode |
104 | ; call decode |
105 | ;Show size |
105 | ;Show size |
106 | ; mov si,show_db1 |
106 | ; mov si,show_db1 |
107 | ; call printplain |
107 | ; call printplain |
108 | ; |
108 | ; |
109 | ; popa |
109 | ; popa |
110 | ;end if |
110 | ;end if |
111 | jmp $ |
111 | jmp $ |
112 | 112 | ||
113 | ;///////////////////procedure ////////// |
113 | ;///////////////////procedure ////////// |
114 | ;input es:di - is pointer to date |
114 | ;input es:di - is pointer to date |
115 | ;cx - counter |
115 | ;cx - counter |
116 | ;return: cx - status if =0 - end of date else es:di point to first symbol on new line |
116 | ;return: cx - status if =0 - end of date else es:di point to first symbol on new line |
117 | 117 | ||
118 | } |
118 | } |