Subversion Repositories Kolibri OS

Rev

Rev 2816 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2816 Rev 5062
Line 184... Line 184...
184
        jc      .file_done
184
        jc      .file_done
185
.file_loop:
185
.file_loop:
186
; 8b. Loop over assembled lines in the range.
186
; 8b. Loop over assembled lines in the range.
187
        cmp     esi, [esp]
187
        cmp     esi, [esp]
188
        ja      .file_done
188
        ja      .file_done
189
; 8c. For every assembled line, look at first token;
189
; 8c. For every assembled line, skip "word" and one-byte tokens
-
 
190
; scanning for three predefined word tokens.
-
 
191
; Note that lines like "a:b:c:d file 'something'" are possible and valid.
190
; go to 8d for token 'file',
192
; go to 8d for token 'file',
191
; go to 8e for token 'format',
193
; go to 8e for token 'format',
192
; go to 8f for token 'section',
194
; go to 8f for token 'section',
193
; continue the loop otherwise.
195
; continue the loop otherwise.
194
        mov     eax, [esi+ebx+asm_row.preproc_offs]
196
        mov     eax, [esi+ebx+asm_row.preproc_offs]
195
        add     eax, [ebx+fas_header.preproc_offs]
197
        add     eax, [ebx+fas_header.preproc_offs]
-
 
198
; We save/restore esi since it is used for another thing in the internal loop;
-
 
199
; we push eax, which currently contains ebx-relative pointer to
-
 
200
; preproc_line_header, to be able to access it from resolve_name.
-
 
201
        push    esi eax
-
 
202
.file_tokens_loop:
196
        cmp     byte [eax+ebx+preproc_line_header.contents], 1Ah
203
        mov     cl, byte [eax+ebx+preproc_line_header.contents]
-
 
204
        cmp     cl, 1Ah
197
        jnz     .file_next
205
        jnz     .file_noword_token
198
        movzx   ecx, byte [eax+ebx+preproc_line_header.contents+1]
206
        movzx   ecx, byte [eax+ebx+preproc_line_header.contents+1]
199
        cmp     cl, 4
207
        cmp     cl, 4
200
        jnz     .file_no_file
208
        jnz     .file_no_file
201
        cmp     dword [eax+ebx+preproc_line_header.contents+2], 'file'
209
        cmp     dword [eax+ebx+preproc_line_header.contents+2], 'file'
202
        jnz     .file_no_file4
210
        jnz     .file_no_file4
203
; 8d. For lines starting with 'file' token, loop over tokens and get names.
211
; 8d. For lines starting with 'file' token, loop over tokens and get names.
204
; Note that there can be several names in one line.
212
; Note that there can be several names in one line.
205
; Parsing of tokens is similar to step 5 with the difference that
213
; Parsing of tokens is similar to step 5 with the difference that
206
; preprocessor token stops processing: 'file' directives are processed
214
; preprocessor token stops processing: 'file' directives are processed
207
; in assembler stage.
215
; in assembler stage.
208
; We save/restore esi since it is used for another thing in the internal loop;
-
 
209
; we push eax, which currently contains ebx-relative pointer to
-
 
210
; preproc_line_header, to be able to access it from resolve_name.
-
 
211
        push    esi eax
-
 
212
        lea     esi, [eax+preproc_line_header.contents+6]
216
        lea     esi, [eax+preproc_line_header.contents+6]
213
.file_loop_int:
217
.file_loop_int:
214
        mov     al, [esi+ebx]
218
        mov     al, [esi+ebx]
215
        inc     esi
219
        inc     esi
216
        test    al, al
220
        test    al, al
217
        jz      .file_loop_int_done
221
        jz      .file_next
218
        cmp     al, ';'
222
        cmp     al, ';'
219
        jz      .file_loop_int_done
223
        jz      .file_next
220
        cmp     al, 1Ah
224
        cmp     al, 1Ah
221
        jz      .fileword
225
        jz      .fileword
222
        cmp     al, '"'
226
        cmp     al, '"'
223
        jnz     .file_loop_int
227
        jnz     .file_loop_int
224
        call    resolve_name
228
        call    resolve_name
Line 226... Line 230...
226
        jmp     .file_loop_int
230
        jmp     .file_loop_int
227
.fileword:
231
.fileword:
228
        movzx   eax, byte [esi+ebx]
232
        movzx   eax, byte [esi+ebx]
229
        lea     esi, [esi+eax+1]
233
        lea     esi, [esi+eax+1]
230
        jmp     .file_loop_int
234
        jmp     .file_loop_int
231
.file_loop_int_done:
-
 
232
        pop     eax esi
-
 
233
        jmp     .file_next
-
 
234
.file_no_file4:
235
.file_no_file4:
235
        cmp     dword [eax+ebx+preproc_line_header.contents+2], 'data'
236
        cmp     dword [eax+ebx+preproc_line_header.contents+2], 'data'
236
        jnz     .file_next
237
        jnz     .file_word_token
237
        jmp     .file_scan_from
238
        jmp     .file_scan_from
238
.file_no_file:
239
.file_no_file:
239
        cmp     cl, 6
240
        cmp     cl, 6
240
        jnz     .file_no_format
241
        jnz     .file_no_format
241
        cmp     dword [eax+ebx+preproc_line_header.contents+2], 'form'
242
        cmp     dword [eax+ebx+preproc_line_header.contents+2], 'form'
Line 258... Line 259...
258
        cmp     edx, 'ion'
259
        cmp     edx, 'ion'
259
        jnz     .file_no_section
260
        jnz     .file_no_section
260
.file_scan_from:
261
.file_scan_from:
261
        mov     edx, TokenFrom
262
        mov     edx, TokenFrom
262
        call    scan_after_word
263
        call    scan_after_word
-
 
264
        jmp     .file_next
263
.file_no_section:
265
.file_no_section:
-
 
266
.file_word_token:
-
 
267
        lea     eax, [eax+ecx+2]
-
 
268
        jmp     .file_tokens_loop
-
 
269
.file_noword_token:
-
 
270
        inc     eax
-
 
271
        test    cl, cl
-
 
272
        jz      .file_next
-
 
273
        cmp     cl, 3Bh
-
 
274
        jz      .file_next
-
 
275
        cmp     cl, 22h
-
 
276
        jnz     .file_tokens_loop
264
.file_next:
277
.file_next:
-
 
278
        pop     eax esi
265
        add     esi, asm_row.sizeof
279
        add     esi, asm_row.sizeof
266
        jmp     .file_loop
280
        jmp     .file_loop
267
.file_done:
281
.file_done:
268
        pop     edx
282
        pop     edx
269
; 9. Write result.
283
; 9. Write result.