change to common line endings (unix) to make and apply patches in more convenient way
add license.txt
remove local copy of struct.inc which wasn't used


git-svn-id: svn://kolibrios.org@3011 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Ivan Baravy 2012-11-09 06:08:39 +00:00
parent 737ea528e8
commit d2833e1b15
9 changed files with 6187 additions and 6330 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
flat assembler version 1.70
Copyright (c) 1999-2012, Tomasz Grysztar.
All rights reserved.
This program is free for commercial and non-commercial use as long as
the following conditions are adhered to.
Copyright remains Tomasz Grysztar, and as such any Copyright notices
in the code are not to be removed.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The licence and distribution terms for any publically available
version or derivative of this code cannot be changed. i.e. this code
cannot simply be copied and put under another distribution licence
(including the GNU Public Licence).

View File

@ -4,24 +4,24 @@
; All rights reserved. ; All rights reserved.
_out_of_memory db 'out of memory',0 _out_of_memory db 'out of memory',0
_stack_overflow db 'out of stack space',0 _stack_overflow db 'out of stack space',0
_main_file_not_found db 'source file not found',0 _main_file_not_found db 'source file not found',0
_unexpected_end_of_file db 'unexpected end of file',0 _unexpected_end_of_file db 'unexpected end of file',0
_code_cannot_be_generated db 'code cannot be generated',0 _code_cannot_be_generated db 'code cannot be generated',0
_format_limitations_exceeded db 'format limitations exceeded',0 _format_limitations_exceeded db 'format limitations exceeded',0
_invalid_definition db 'invalid definition provided',0 _invalid_definition db 'invalid definition provided',0
_write_failed db 'write failed',0 _write_failed db 'write failed',0
_file_not_found db 'file not found',0 _file_not_found db 'file not found',0
_error_reading_file db 'error reading file',0 _error_reading_file db 'error reading file',0
_invalid_file_format db 'invalid file format',0 _invalid_file_format db 'invalid file format',0
_invalid_macro_arguments db 'invalid macro arguments',0 _invalid_macro_arguments db 'invalid macro arguments',0
_incomplete_macro db 'incomplete macro',0 _incomplete_macro db 'incomplete macro',0
_unexpected_characters db 'unexpected characters',0 _unexpected_characters db 'unexpected characters',0
_invalid_argument db 'invalid argument',0 _invalid_argument db 'invalid argument',0
_illegal_instruction db 'illegal instruction',0 _illegal_instruction db 'illegal instruction',0
_invalid_operand db 'invalid operand',0 _invalid_operand db 'invalid operand',0
_invalid_operand_size db 'invalid size of operand',0 _invalid_operand_size db 'invalid size of operand',0
_operand_size_not_specified db 'operand size not specified',0 _operand_size_not_specified db 'operand size not specified',0
_operand_sizes_do_not_match db 'operand sizes do not match',0 _operand_sizes_do_not_match db 'operand sizes do not match',0
_invalid_address_size db 'invalid size of address value',0 _invalid_address_size db 'invalid size of address value',0
_address_sizes_do_not_agree db 'address sizes do not agree',0 _address_sizes_do_not_agree db 'address sizes do not agree',0
@ -29,24 +29,24 @@ _disallowed_combination_of_registers db 'disallowed combination of registers',0
_long_immediate_not_encodable db 'not encodable with long immediate',0 _long_immediate_not_encodable db 'not encodable with long immediate',0
_relative_jump_out_of_range db 'relative jump out of range',0 _relative_jump_out_of_range db 'relative jump out of range',0
_invalid_expression db 'invalid expression',0 _invalid_expression db 'invalid expression',0
_invalid_address db 'invalid address',0 _invalid_address db 'invalid address',0
_invalid_value db 'invalid value',0 _invalid_value db 'invalid value',0
_value_out_of_range db 'value out of range',0 _value_out_of_range db 'value out of range',0
_undefined_symbol db 'undefined symbol',0 _undefined_symbol db 'undefined symbol',0
_symbol_out_of_scope_1 db 'symbol',0 _symbol_out_of_scope_1 db 'symbol',0
_symbol_out_of_scope_2 db 'out of scope',0 _symbol_out_of_scope_2 db 'out of scope',0
_invalid_use_of_symbol db 'invalid use of symbol',0 _invalid_use_of_symbol db 'invalid use of symbol',0
_name_too_long db 'name too long',0 _name_too_long db 'name too long',0
_invalid_name db 'invalid name',0 _invalid_name db 'invalid name',0
_reserved_word_used_as_symbol db 'reserved word used as symbol',0 _reserved_word_used_as_symbol db 'reserved word used as symbol',0
_symbol_already_defined db 'symbol already defined',0 _symbol_already_defined db 'symbol already defined',0
_missing_end_quote db 'missing end quote',0 _missing_end_quote db 'missing end quote',0
_missing_end_directive db 'missing end directive',0 _missing_end_directive db 'missing end directive',0
_unexpected_instruction db 'unexpected instruction',0 _unexpected_instruction db 'unexpected instruction',0
_extra_characters_on_line db 'extra characters on line',0 _extra_characters_on_line db 'extra characters on line',0
_section_not_aligned_enough db 'section is not aligned enough',0 _section_not_aligned_enough db 'section is not aligned enough',0
_setting_already_specified db 'setting already specified',0 _setting_already_specified db 'setting already specified',0
_data_already_defined db 'data already defined',0 _data_already_defined db 'data already defined',0
_too_many_repeats db 'too many repeats',0 _too_many_repeats db 'too many repeats',0
_invoked_error db 'error directive invoked in source file',0 _invoked_error db 'error directive encountered in source file',0
_assertion_failed db 'assertion failed',0 _assertion_failed db 'assertion failed',0

View File

@ -1,180 +0,0 @@
; Macroinstructions for defining data structures
macro struct name
{ fields@struct equ name
match child parent, name \{ fields@struct equ child,fields@\#parent \}
sub@struct equ
struc db [val] \{ \common fields@struct equ fields@struct,.,db,<val> \}
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \}
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \}
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \}
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \}
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \}
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \}
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \}
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \}
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \}
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \}
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \}
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \}
macro db [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,db,<val> \}
macro dw [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dw,<val> \}
macro du [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,du,<val> \}
macro dd [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dd,<val> \}
macro dp [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dp,<val> \}
macro dq [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dq,<val> \}
macro dt [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dt,<val> \}
macro rb count \{ \local anonymous
fields@struct equ fields@struct,anonymous,db,count dup (?) \}
macro rw count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dw,count dup (?) \}
macro rd count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dd,count dup (?) \}
macro rp count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dp,count dup (?) \}
macro rq count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dq,count dup (?) \}
macro rt count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dt,count dup (?) \}
macro union \{ fields@struct equ fields@struct,,union,<
sub@struct equ union \}
macro struct \{ fields@struct equ fields@struct,,substruct,<
sub@struct equ substruct \}
virtual at 0 }
macro ends
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
restruc rb,rw,rd,rp,rq,rt
purge db,dw,du,dd,dp,dq,dt
purge rb,rw,rd,rp,rq,rt
purge union,struct
match name=,fields,fields@struct \\{ fields@struct equ
make@struct name,fields
fields@\\#name equ fields \\}
end virtual \}
match any, sub@struct \{ fields@struct equ fields@struct> \}
restore sub@struct }
macro make@struct name,[field,type,def]
{ common
if $
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah
err
end if
local define
define equ name
forward
local sub
match , field \{ make@substruct type,name,sub def
define equ define,.,sub, \}
match any, field \{ define equ define,.#field,type,<def> \}
common
match fields, define \{ define@struct fields \} }
macro define@struct name,[field,type,def]
{ common
local list
list equ
forward
if ~ field eq .
name#field type def
sizeof.#name#field = $ - name#field
else
rb sizeof.#type
end if
local value
match any, list \{ list equ list, \}
list equ list <value>
common
sizeof.#name = $
restruc name
match values, list \{
struc name value \\{
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\}
match , fields@struct \\\{ label .
forward
match , value \\\\{ field type def \\\\}
match any, value \\\\{ field type value
if ~ field eq .
rb sizeof.#name#field - ($-field)
end if \\\\}
common \\\} \\} \} }
macro enable@substruct
{ macro make@substruct substruct,parent,name,[field,type,def]
\{ \common
\local define
define equ parent,name
\forward
\local sub
match , field \\{ match any, type \\\{ enable@substruct
make@substruct type,name,sub def
purge make@substruct
define equ define,.,sub, \\\} \\}
match any, field \\{ define equ define,.\#field,type,<def> \\}
\common
match fields, define \\{ define@\#substruct fields \\} \} }
enable@substruct
macro define@union parent,name,[field,type,def]
{ common
virtual at 0
forward
if ~ field eq .
virtual at 0
parent#field type def
sizeof.#parent#field = $ - parent#field
end virtual
if sizeof.#parent#field > $
rb sizeof.#parent#field - $
end if
else if sizeof.#type > $
rb sizeof.#type - $
end if
common
sizeof.#name = $
end virtual
struc name [value] \{ \common
label .\#name
last@union equ
forward
match any, last@union \\{ virtual at .\#name
field type def
end virtual \\}
match , last@union \\{ match , value \\\{ field type def \\\}
match any, value \\\{ field type value \\\} \\}
last@union equ field
common rb sizeof.#name - ($ - .\#name) \} }
macro define@substruct parent,name,[field,type,def]
{ common
virtual at 0
forward
if ~ field eq .
parent#field type def
sizeof.#parent#field = $ - parent#field
else
rb sizeof.#type
end if
local value
common
sizeof.#name = $
end virtual
struc name value \{
label .\#name
forward
match , value \\{ field type def \\}
match any, value \\{ field type value
if ~ field eq .
rb sizeof.#parent#field - ($-field)
end if \\}
common \} }

View File

@ -4,11 +4,11 @@
; All rights reserved. ; All rights reserved.
dump_symbols: dump_symbols:
mov edi,[code_start] mov edi,[code_start]
call setup_dump_header call setup_dump_header
mov esi,[input_file] mov esi,[input_file]
call copy_asciiz call copy_asciiz
cmp edi,[display_buffer] cmp edi,[display_buffer]
jae out_of_memory jae out_of_memory
mov eax,edi mov eax,edi
sub eax,ebx sub eax,ebx
@ -23,132 +23,132 @@ dump_symbols:
cmp [output_format],4 cmp [output_format],4
je prepare_strings_table je prepare_strings_table
cmp [output_format],5 cmp [output_format],5
jne strings_table_ready jne strings_table_ready
bt [format_flags],0 bt [format_flags],0
jc strings_table_ready jc strings_table_ready
prepare_strings_table: prepare_strings_table:
cmp edx,ebp cmp edx,ebp
je strings_table_ready je strings_table_ready
mov al,[edx] mov al,[edx]
test al,al test al,al
jz prepare_string jz prepare_string
cmp al,80h cmp al,80h
je prepare_string je prepare_string
add edx,0Ch add edx,0Ch
cmp al,0C0h cmp al,0C0h
jb prepare_strings_table jb prepare_strings_table
add edx,4 add edx,4
jmp prepare_strings_table jmp prepare_strings_table
prepare_string: prepare_string:
mov esi,edi mov esi,edi
sub esi,ebx sub esi,ebx
xchg esi,[edx+4] xchg esi,[edx+4]
test al,al test al,al
jz prepare_section_string jz prepare_section_string
or dword [edx+4],1 shl 31 or dword [edx+4],1 shl 31
add edx,0Ch add edx,0Ch
prepare_external_string: prepare_external_string:
mov ecx,[esi] mov ecx,[esi]
add esi,4 add esi,4
rep movs byte [edi],[esi] rep movs byte [edi],[esi]
mov byte [edi],0 mov byte [edi],0
inc edi inc edi
cmp edi,[display_buffer] cmp edi,[display_buffer]
jae out_of_memory jae out_of_memory
jmp prepare_strings_table jmp prepare_strings_table
prepare_section_string: prepare_section_string:
mov ecx,[number_of_sections] mov ecx,[number_of_sections]
mov eax,ecx mov eax,ecx
inc eax inc eax
mov [number_of_sections],eax mov [number_of_sections],eax
xchg eax,[edx+4] xchg eax,[edx+4]
shl ecx,2 shl ecx,2
add ecx,[free_additional_memory] add ecx,[free_additional_memory]
mov [ecx],eax mov [ecx],eax
add edx,20h add edx,20h
test esi,esi test esi,esi
jz prepare_default_section_string jz prepare_default_section_string
cmp [output_format],5 cmp [output_format],5
jne prepare_external_string jne prepare_external_string
bt [format_flags],0 bt [format_flags],0
jc prepare_external_string jc prepare_external_string
mov esi,[esi] mov esi,[esi]
add esi,[resource_data] add esi,[resource_data]
copy_elf_section_name: copy_elf_section_name:
lods byte [esi] lods byte [esi]
cmp edi,[display_buffer] cmp edi,[display_buffer]
jae out_of_memory jae out_of_memory
stos byte [edi] stos byte [edi]
test al,al test al,al
jnz copy_elf_section_name jnz copy_elf_section_name
jmp prepare_strings_table jmp prepare_strings_table
prepare_default_section_string: prepare_default_section_string:
mov eax,'.fla' mov eax,'.fla'
stos dword [edi] stos dword [edi]
mov ax,'t' mov ax,'t'
stos word [edi] stos word [edi]
cmp edi,[display_buffer] cmp edi,[display_buffer]
jae out_of_memory jae out_of_memory
jmp prepare_strings_table jmp prepare_strings_table
strings_table_ready: strings_table_ready:
mov edx,[display_buffer] mov edx,[display_buffer]
mov ebp,[memory_end] mov ebp,[memory_end]
sub ebp,[labels_list] sub ebp,[labels_list]
add ebp,edx add ebp,edx
prepare_labels_dump: prepare_labels_dump:
cmp edx,ebp cmp edx,ebp
je labels_dump_ok je labels_dump_ok
mov eax,[edx+24] mov eax,[edx+24]
test eax,eax test eax,eax
jz label_dump_name_ok jz label_dump_name_ok
cmp eax,[memory_start] cmp eax,[memory_start]
jb label_name_outside_source jb label_name_outside_source
cmp eax,[source_start] cmp eax,[source_start]
ja label_name_outside_source ja label_name_outside_source
sub eax,[memory_start] sub eax,[memory_start]
dec eax dec eax
mov [edx+24],eax mov [edx+24],eax
jmp label_dump_name_ok jmp label_dump_name_ok
label_name_outside_source: label_name_outside_source:
mov esi,eax mov esi,eax
mov eax,edi mov eax,edi
sub eax,ebx sub eax,ebx
or eax,1 shl 31 or eax,1 shl 31
mov [edx+24],eax mov [edx+24],eax
movzx ecx,byte [esi-1] movzx ecx,byte [esi-1]
lea eax,[edi+ecx+1] lea eax,[edi+ecx+1]
cmp edi,[display_buffer] cmp edi,[display_buffer]
jae out_of_memory jae out_of_memory
rep movsb rep movsb
xor al,al xor al,al
stosb stosb
label_dump_name_ok: label_dump_name_ok:
mov eax,[edx+28] mov eax,[edx+28]
test eax,eax test eax,eax
jz label_dump_line_ok jz label_dump_line_ok
sub eax,[memory_start] sub eax,[memory_start]
mov [edx+28],eax mov [edx+28],eax
label_dump_line_ok: label_dump_line_ok:
mov eax,[edx+20] mov eax,[edx+20]
test eax,eax test eax,eax
jz base_symbol_for_label_ok jz base_symbol_for_label_ok
cmp eax,[symbols_stream] cmp eax,[symbols_stream]
mov eax,[eax+4] mov eax,[eax+4]
jae base_symbol_for_label_ok jae base_symbol_for_label_ok
xor eax,eax xor eax,eax
base_symbol_for_label_ok: base_symbol_for_label_ok:
mov [edx+20],eax mov [edx+20],eax
mov ax,[current_pass] mov ax,[current_pass]
cmp ax,[edx+16] cmp ax,[edx+16]
je label_defined_flag_ok je label_defined_flag_ok
and byte [edx+8],not 1 and byte [edx+8],not 1
label_defined_flag_ok: label_defined_flag_ok:
cmp ax,[edx+18] cmp ax,[edx+18]
je label_used_flag_ok je label_used_flag_ok
and byte [edx+8],not 8 and byte [edx+8],not 8
label_used_flag_ok: label_used_flag_ok:
add edx,LABEL_STRUCTURE_SIZE add edx,LABEL_STRUCTURE_SIZE
jmp prepare_labels_dump jmp prepare_labels_dump
labels_dump_ok: labels_dump_ok:
mov eax,edi mov eax,edi
sub eax,ebx sub eax,ebx
@ -171,11 +171,11 @@ dump_symbols:
call prepare_preprocessed_source call prepare_preprocessed_source
mov esi,[labels_list] mov esi,[labels_list]
mov ebp,edi mov ebp,edi
make_lines_dump: make_lines_dump:
cmp esi,[display_buffer] cmp esi,[display_buffer]
je lines_dump_ok je lines_dump_ok
mov eax,[esi-4] mov eax,[esi-4]
mov ecx,[esi-8] mov ecx,[esi-8]
sub esi,8 sub esi,8
sub esi,ecx sub esi,ecx
cmp eax,1 cmp eax,1
@ -188,13 +188,13 @@ dump_symbols:
mov eax,[esi+4] mov eax,[esi+4]
sub eax,[code_start] sub eax,[code_start]
add eax,[headers_size] add eax,[headers_size]
cmp byte [esi+1Ah],0 cmp byte [esi+1Ah],0
je store_offset je store_offset
xor eax,eax xor eax,eax
store_offset: store_offset:
stos dword [edi] stos dword [edi]
mov eax,[esi] mov eax,[esi]
sub eax,[memory_start] sub eax,[memory_start]
stos dword [edi] stos dword [edi]
mov eax,[esi+4] mov eax,[esi+4]
xor edx,edx xor edx,edx
@ -205,15 +205,15 @@ dump_symbols:
stos dword [edi] stos dword [edi]
mov eax,edx mov eax,edx
stos dword [edi] stos dword [edi]
mov eax,[esi+10h] mov eax,[esi+10h]
stos dword [edi] stos dword [edi]
mov eax,[esi+14h] mov eax,[esi+14h]
test eax,eax test eax,eax
jz base_symbol_for_line_ok jz base_symbol_for_line_ok
cmp eax,[symbols_stream] cmp eax,[symbols_stream]
mov eax,[eax+4] mov eax,[eax+4]
jae base_symbol_for_line_ok jae base_symbol_for_line_ok
xor eax,eax xor eax,eax
base_symbol_for_line_ok: base_symbol_for_line_ok:
stos dword [edi] stos dword [edi]
mov eax,[esi+18h] mov eax,[esi+18h]
@ -229,9 +229,9 @@ dump_symbols:
jmp make_lines_dump jmp make_lines_dump
lines_dump_ok: lines_dump_ok:
mov edx,edi mov edx,edi
mov eax,[current_offset] mov eax,[current_offset]
sub eax,[code_start] sub eax,[code_start]
add eax,[headers_size] add eax,[headers_size]
stos dword [edi] stos dword [edi]
mov ecx,edi mov ecx,edi
sub ecx,ebx sub ecx,ebx
@ -244,11 +244,11 @@ dump_symbols:
find_inexisting_offsets: find_inexisting_offsets:
sub edx,1Ch sub edx,1Ch
cmp edx,ebp cmp edx,ebp
jb write_symbols jb write_symbols
test byte [edx+1Ah],1 test byte [edx+1Ah],1
jnz find_inexisting_offsets jnz find_inexisting_offsets
cmp eax,[edx] cmp eax,[edx]
jb correct_inexisting_offset jb correct_inexisting_offset
mov eax,[edx] mov eax,[edx]
jmp find_inexisting_offsets jmp find_inexisting_offsets
correct_inexisting_offset: correct_inexisting_offset:
@ -256,8 +256,8 @@ dump_symbols:
or byte [edx+1Ah],2 or byte [edx+1Ah],2
jmp find_inexisting_offsets jmp find_inexisting_offsets
write_symbols: write_symbols:
mov edx,[symbols_file] mov edx,[symbols_file]
call create call create
jc write_failed jc write_failed
mov edx,[code_start] mov edx,[code_start]
mov ecx,[edx+14h] mov ecx,[edx+14h]
@ -265,22 +265,22 @@ dump_symbols:
call write call write
jc write_failed jc write_failed
mov edx,[display_buffer] mov edx,[display_buffer]
mov ecx,[memory_end] mov ecx,[memory_end]
sub ecx,[labels_list] sub ecx,[labels_list]
call write call write
jc write_failed jc write_failed
mov edx,[memory_start] mov edx,[memory_start]
mov ecx,[source_start] mov ecx,[source_start]
sub ecx,edx sub ecx,edx
call write call write
jc write_failed jc write_failed
mov edx,ebp mov edx,ebp
mov ecx,edi mov ecx,edi
sub ecx,edx sub ecx,edx
call write call write
jc write_failed jc write_failed
mov edx,[free_additional_memory] mov edx,[free_additional_memory]
mov ecx,[number_of_sections] mov ecx,[number_of_sections]
shl ecx,2 shl ecx,2
call write call write
jc write_failed jc write_failed
@ -328,85 +328,85 @@ dump_symbols:
ret ret
prepare_preprocessed_source: prepare_preprocessed_source:
mov esi,[memory_start] mov esi,[memory_start]
mov ebp,[source_start] mov ebp,[source_start]
test ebp,ebp test ebp,ebp
jnz prepare_preprocessed_line jnz prepare_preprocessed_line
mov ebp,[current_line] mov ebp,[current_line]
inc ebp inc ebp
prepare_preprocessed_line: prepare_preprocessed_line:
cmp esi,ebp cmp esi,ebp
jae preprocessed_source_ok jae preprocessed_source_ok
mov eax,[memory_start] mov eax,[memory_start]
mov edx,[input_file] mov edx,[input_file]
cmp [esi],edx cmp [esi],edx
jne line_not_from_main_input jne line_not_from_main_input
mov [esi],eax mov [esi],eax
line_not_from_main_input: line_not_from_main_input:
sub [esi],eax sub [esi],eax
test byte [esi+7],1 shl 7 test byte [esi+7],1 shl 7
jz prepare_next_preprocessed_line jz prepare_next_preprocessed_line
sub [esi+8],eax sub [esi+8],eax
sub [esi+12],eax sub [esi+12],eax
prepare_next_preprocessed_line: prepare_next_preprocessed_line:
call skip_preprocessed_line call skip_preprocessed_line
jmp prepare_preprocessed_line jmp prepare_preprocessed_line
preprocessed_source_ok: preprocessed_source_ok:
ret ret
skip_preprocessed_line: skip_preprocessed_line:
add esi,16 add esi,16
skip_preprocessed_line_content: skip_preprocessed_line_content:
lods byte [esi] lods byte [esi]
cmp al,1Ah cmp al,1Ah
je skip_preprocessed_symbol je skip_preprocessed_symbol
cmp al,3Bh cmp al,3Bh
je skip_preprocessed_symbol je skip_preprocessed_symbol
cmp al,22h cmp al,22h
je skip_preprocessed_string je skip_preprocessed_string
or al,al or al,al
jnz skip_preprocessed_line_content jnz skip_preprocessed_line_content
ret ret
skip_preprocessed_string: skip_preprocessed_string:
lods dword [esi] lods dword [esi]
add esi,eax add esi,eax
jmp skip_preprocessed_line_content jmp skip_preprocessed_line_content
skip_preprocessed_symbol: skip_preprocessed_symbol:
lods byte [esi] lods byte [esi]
movzx eax,al movzx eax,al
add esi,eax add esi,eax
jmp skip_preprocessed_line_content jmp skip_preprocessed_line_content
restore_preprocessed_source: restore_preprocessed_source:
mov esi,[memory_start] mov esi,[memory_start]
mov ebp,[source_start] mov ebp,[source_start]
test ebp,ebp test ebp,ebp
jnz restore_preprocessed_line jnz restore_preprocessed_line
mov ebp,[current_line] mov ebp,[current_line]
inc ebp inc ebp
restore_preprocessed_line: restore_preprocessed_line:
cmp esi,ebp cmp esi,ebp
jae preprocessed_source_restored jae preprocessed_source_restored
mov eax,[memory_start] mov eax,[memory_start]
add [esi],eax add [esi],eax
cmp [esi],eax cmp [esi],eax
jne preprocessed_line_source_restored jne preprocessed_line_source_restored
mov edx,[input_file] mov edx,[input_file]
mov [esi],edx mov [esi],edx
preprocessed_line_source_restored: preprocessed_line_source_restored:
test byte [esi+7],1 shl 7 test byte [esi+7],1 shl 7
jz restore_next_preprocessed_line jz restore_next_preprocessed_line
add [esi+8],eax add [esi+8],eax
add [esi+12],eax add [esi+12],eax
restore_next_preprocessed_line: restore_next_preprocessed_line:
call skip_preprocessed_line call skip_preprocessed_line
jmp restore_preprocessed_line jmp restore_preprocessed_line
preprocessed_source_restored: preprocessed_source_restored:
ret ret
dump_preprocessed_source: dump_preprocessed_source:
mov edi,[free_additional_memory] mov edi,[free_additional_memory]
call setup_dump_header call setup_dump_header
mov esi,[input_file] mov esi,[input_file]
call copy_asciiz call copy_asciiz
cmp edi,[additional_memory_end] cmp edi,[additional_memory_end]
jae out_of_memory jae out_of_memory
mov eax,edi mov eax,edi
sub eax,ebx sub eax,ebx
dec eax dec eax
@ -428,8 +428,8 @@ dump_preprocessed_source:
call write call write
jc write_failed jc write_failed
mov edx,[memory_start] mov edx,[memory_start]
mov ecx,esi mov ecx,esi
call write call write
jc write_failed jc write_failed
call close call close
ret ret

File diff suppressed because it is too large Load Diff