Subversion Repositories Kolibri OS

Rev

Rev 2288 | 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 aka  ''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
 
3539 clevermous 27
; тут описываются процедуры которые используются в secondary loader
2288 clevermous 28
color_sym_black equ     0
29
color_sym_blue  equ     1
30
color_sym_green equ     2
31
color_sym_turquoise equ 3
32
color_sym_red   equ     4
33
 
34
color_sym_lightgray equ 7
35
 
36
color_sym_lightblue equ 9
37
color_sym_lettuce   equ 10
38
color_sym_pink  equ     12
39
color_sym_yellow equ    14
40
color_sym_white equ     15
41
if DEBUG
42
decode:
3539 clevermous 43
;input eax - число, es:di куда писать, cx=10
2288 clevermous 44
        cmp     eax, ecx
45
        jb      @f
46
        xor     edx, edx
47
        div     ecx
48
        push    edx
49
        call    decode
50
        pop     eax
51
    @@:
52
        or      al, 0x30
53
        mov     [ds:di], al
54
        inc     di
55
        ret
56
 
57
end if
58
 
59
 
60
putchar:
61
; in: al=character
62
        mov     ah, 0Eh
63
        mov     bh, 0
64
        int     10h
65
        ret
66
 
67
printplain:
68
; in: si->string
69
        pushad
70
        lodsb
71
@@:
72
        call    putchar
73
        lodsb
74
        test    al, al
75
        jnz     @b
76
        mov     al, 13
77
        call    putchar
78
 
79
        mov     al, 10
80
        call    putchar
81
        popad
82
        ret
83
getkey:
84
; get number in range [bl,bh] (bl,bh in ['0'..'9'])
85
; in: bx=range
86
; out: ax=digit (1..9, 10 for 0)
87
        mov     ah, 0
88
        int     16h
89
        cmp     al, bl
90
        jb      getkey
91
        cmp     al, bh
92
        ja      getkey
93
        push    ax
94
        call    putchar
95
        pop     ax
96
        and     ax, 0Fh
97
        jnz     @f
98
        mov     al, 10
99
@@:
100
        ret
101
 
102
;setcursor:
103
; in: dl=column, dh=row
104
;        mov     ah, 2
105
;        mov     bh, 0
106
;        int     10h
107
;        ret
108
 
109
;macro _setcursor row,column
110
;{
111
;        mov     dx, row*256 + column
112
;        call    setcursor
113
;}
114
 
115
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
116
;
117
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
118
get_firs_sym:
119
.start:
120
        mov     al, byte [es:di]
121
        inc     di
122
        dec     cx
123
        jcxz    .exit
124
 
125
        cmp     al, 0xa         ;cmp al,0xa
126
        jz      ._entry
127
 
128
        cmp     al, ';'
129
        jnz     .start
130
 
131
.first_com:
132
 
133
        mov     al, 0xa
134
        repnz scasb
135
        jcxz    .exit
136
._entry:
137
        mov     al, byte [es:di]
138
.first_sp:
139
        cmp     al, ' '
140
        jnz     .not_space
141
 
142
;       mov     al,' '          ;cut ' '
143
        repe scasb
144
        dec     di
145
        inc     cx
146
        mov     al, byte [es:di]
147
.not_space:
148
        cmp     al, ';'
149
        jz      .first_com
150
.exit:
151
        ret
152
;;;;;;;;;;;;;;;;;;;;;;;;;;;
153
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
154
show_name_section:
155
        push    si
156
        push    ini_data_
157
        pop     es
158
 
159
 
160
        mov     al, ']'
161
        repnz scasb
162
        test    cx, cx
163
        jz      error.incorect_section_def
164
.find_val_name_fb1:
165
        mov     al, 'n'
166
.find_val_name_fb:
167
        repnz scasb
168
        jcxz    .not_name_sec_fb
169
 
170
        mov     si, parse_name
171
 
172
        push    cx
173
        push    di
174
 
175
        mov     cx, parse_name_e -parse_name
176
        repe cmpsb
177
        pop     di
178
        pop     cx
179
        jz      .yaaa_find_value
180
 
181
 
182
        jmp     .find_val_name_fb
183
 
184
.yaaa_find_value:
185
        sub     cx, parse_name_e -parse_name
186
        add     di, parse_name_e -parse_name
187
 
188
        mov     ax, 0x3d20         ; ah='='
189
        repe scasb
190
        test    cx, cx
191
        jz      .not_name_sec_fb
192
 
193
        cmp     ah, byte [es:di-1]   ;find '='
194
        jnz     .find_val_name_fb1
195
 
196
        repe scasb                 ;cut ' '
197
        inc     cx
198
        dec     di
199
 
200
 
3539 clevermous 201
;все вырезали и все готово для вывода имени секции ))
2288 clevermous 202
        push    es
203
        pop     ds
204
 
205
.def_sect_name:
206
        push    0xb800
207
        pop     es
208
;clear array for message
209
        xor     ax, ax
210
if DEBUG
211
        mov     ax, 0x0720
212
end if
213
 
214
        mov     cx, 39
215
        mov     si, di
216
        mov     di, dx
217
        sub     di, 2
218
        rep stosw
219
;//////////////////////
220
 
221
 
222
        mov     di, dx
223
        mov     ah, color_sym_white;color_sym_lightblue
224
        mov     cx, 36
225
        lodsb
226
        sub     di, 2
227
        cmp     al, '"'
228
        jz      @f
229
        cmp     al, "'"
230
        jnz     .end_sh_name_sec
231
@@:
232
        lodsb
233
@@:
234
        stosw
235
        lodsb
236
        cmp     al, '"'
237
        jz      .end_sh_name_sec
238
        cmp     al, "'"
239
        jz      .end_sh_name_sec
240
        loop    @b
241
 
242
        mov     al, '}'
243
        mov     ah, color_sym_yellow
244
        stosw
245
.end_sh_name_sec:
246
        push    cs
247
        pop     ds
248
 
249
        pop     si
250
        ret
251
 
3539 clevermous 252
.not_name_sec_fb:    ;нет имени в названии секции - значит так и скажем об этом
2288 clevermous 253
        push    cs
254
        pop     ds
255
        mov     di, default_section_name
256
        jmp     .def_sect_name
257
 
258
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3539 clevermous 259
;процедура поиска вверх следующей секции
260
;в point_default содержиться указатель на дефаулт секцию, и в пределах врейма мы бегаем по заранее пропарсеными значениям указателей
261
;для того что бы отобразить и пропарсить следующий фрейм, нам нужно получить за пердыдущий или следующий указатель
2288 clevermous 262
find_before_sect:
263
        mov     di, point_default
264
.e:
265
        push    ini_data_