fasm 1.67.29

git-svn-id: svn://kolibrios.org@992 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
heavyiron 2008-12-30 20:21:32 +00:00
parent 9c944c3c25
commit 1d22b242c8
11 changed files with 478 additions and 112 deletions

View File

@ -153,6 +153,27 @@ assemble_line:
lods dword [esi]
mov [current_line],eax
mov [prefixed_instruction],0
cmp [symbols_file],0
je continue_line
mov ebx,[display_buffer]
mov dword [ebx-4],1
mov dword [ebx-8],1Ch
sub ebx,8+1Ch
cmp ebx,edi
jbe out_of_memory
mov [display_buffer],ebx
mov [ebx],eax
mov [ebx+4],edi
mov eax,dword [org_origin]
mov edx,dword [org_origin+4]
mov ecx,[org_registers]
mov [ebx+8],eax
mov [ebx+8+4],edx
mov [ebx+10h],ecx
mov edx,[org_symbol]
mov eax,dword [labels_type]
mov [ebx+14h],edx
mov [ebx+18h],eax
continue_line:
cmp byte [esi],0Fh
je line_assembled
@ -728,11 +749,15 @@ display_directive:
mov ecx,eax
push edi
mov edi,[display_buffer]
sub edi,4
sub edi,8
sub edi,eax
cmp edi,[esp]
jbe out_of_memory
mov [display_buffer],edi
rep movs byte [edi],[esi]
stos dword [edi]
xor eax,eax
stos dword [edi]
pop edi
inc esi
jmp display_next
@ -740,11 +765,13 @@ display_directive:
call get_byte_value
push edi
mov edi,[display_buffer]
sub edi,4+1
sub edi,8+1
mov [display_buffer],edi
stos byte [edi]
mov eax,1
stos dword [edi]
dec eax
stos dword [edi]
pop edi
display_next:
cmp edi,[display_buffer]
@ -754,7 +781,7 @@ display_directive:
je display_directive
dec esi
jmp instruction_assembled
flush_display_buffer:
show_display_buffer:
mov eax,[display_buffer]
or eax,eax
jz display_done
@ -762,18 +789,21 @@ flush_display_buffer:
cmp esi,eax
je display_done
display_messages:
sub esi,4
sub esi,8
mov eax,[esi+4]
mov ecx,[esi]
sub esi,ecx
test eax,eax
jnz skip_internal_message
push esi
call display_block
pop esi
skip_internal_message:
cmp esi,[display_buffer]
jne display_messages
mov eax,[labels_list]
mov [display_buffer],eax
display_done:
ret
times_directive:
lods byte [esi]
cmp al,'('

View File

@ -893,40 +893,33 @@ calculate_expression:
expression_value_ok:
ret
get_byte_number:
mov word [edi+8],0
mov byte [edi+12],0
xor eax,eax
lods byte [esi]
stos dword [edi]
xor al,al
stos dword [edi]
got_number:
mov word [edi-8+8],0
mov byte [edi-8+12],0
mov dword [edi-8+16],0
add edi,0Ch
jmp calculation_loop
get_word_number:
mov word [edi+8],0
mov byte [edi+12],0
xor eax,eax
lods word [esi]
stos dword [edi]
xor ax,ax
stos dword [edi]
add edi,0Ch
jmp calculation_loop
jmp got_number
get_dword_number:
mov word [edi+8],0
mov byte [edi+12],0
movs dword [edi],[esi]
xor eax,eax
stos dword [edi]
add edi,0Ch
jmp calculation_loop
jmp got_number
get_qword_number:
mov word [edi+8],0
mov byte [edi+12],0
movs dword [edi],[esi]
movs dword [edi],[esi]
add edi,0Ch
jmp calculation_loop
jmp got_number
get_register:
mov byte [edi+9],0
mov byte [edi+12],0
@ -934,6 +927,7 @@ calculate_expression:
mov [edi+8],al
mov byte [edi+10],1
xor eax,eax
mov [edi+16],eax
stos dword [edi]
stos dword [edi]
add edi,0Ch
@ -1525,6 +1519,8 @@ calculate_expression:
jne invalid_expression
cmp [output_format],5
je calculate_gotoff
cmp [output_format],4
je calculate_coff_rva
cmp [output_format],3
jne invalid_expression
test [format_flags],8
@ -1575,6 +1571,7 @@ calculate_expression:
calculate_gotoff:
test [format_flags],8+1
jnz invalid_expression
calculate_coff_rva:
mov dl,5
cmp byte [edi+12],2
je change_value_type
@ -1607,7 +1604,7 @@ calculate_expression:
cmp byte [edi+12],dh
jne incorrect_change_of_value_type
mov eax,[edi+16]
cmp byte [eax],81h
cmp byte [eax],80h
jne incorrect_change_of_value_type
jmp change_value_type
div_64:
@ -2009,9 +2006,9 @@ get_address_value:
mov al,[edi+12]
mov [value_type],al
cmp al,6
je plt_address
je special_address_type_32bit
cmp al,5
je gotoff_address
je special_address_type_32bit
ja invalid_use_of_symbol
test al,1
jnz invalid_use_of_symbol
@ -2019,8 +2016,7 @@ get_address_value:
jz address_size_ok
shl al,5
jmp address_symbol_ok
gotoff_address:
plt_address:
special_address_type_32bit:
mov al,40h
address_symbol_ok:
mov ah,[address_size]
@ -2032,7 +2028,10 @@ get_address_value:
je address_size_ok
cmp ax,0804h
jne address_sizes_do_not_agree
cmp [value_type],2
ja value_type_correction_ok
mov [value_type],2
value_type_correction_ok:
mov eax,[edi]
cdq
cmp edx,[edi+4]
@ -2180,13 +2179,13 @@ calculate_relative_offset:
je relative_offset_ok
test bl,1
jnz invalid_use_of_symbol
mov ecx,[address_symbol]
mov [symbol_identifier],ecx
cmp bl,6
je plt_relative_offset
cmp bl,[labels_type]
jne invalid_use_of_symbol
mov [value_type],0
mov ecx,[address_symbol]
mov [symbol_identifier],ecx
cmp ecx,[org_symbol]
je relative_offset_ok
mov [value_type],3

View File

@ -4,9 +4,9 @@
; All rights reserved.
formatter:
mov [current_offset],edi
cmp [output_file],0
jne output_path_ok
push edi
mov esi,[input_file]
mov edi,[free_additional_memory]
copy_output_path:
@ -118,8 +118,30 @@ formatter:
inc edi
mov [structures_buffer],edi
mov [output_file],edi
pop edi
output_path_ok:
cmp [symbols_file],0
je labels_table_ok
mov ecx,[memory_end]
sub ecx,[labels_list]
mov edi,[display_buffer]
sub edi,8
mov [edi],ecx
or dword [edi+4],-1
sub edi,ecx
cmp edi,[esp]
jbe out_of_memory
mov [display_buffer],edi
mov esi,[memory_end]
copy_labels:
sub esi,32
cmp esi,[labels_list]
jb labels_table_ok
mov ecx,32 shr 2
rep movs dword [edi],[esi]
sub esi,32
jmp copy_labels
labels_table_ok:
mov edi,[current_offset]
cmp [output_format],4
je coff_formatter
cmp [output_format],5
@ -134,6 +156,7 @@ formatter:
jne calculate_code_size
mov edi,[undefined_data_start]
calculate_code_size:
mov [current_offset],edi
sub edi,[code_start]
mov [code_size],edi
mov [written_size],0
@ -155,6 +178,8 @@ formatter:
call write_code
output_written:
call close
cmp [symbols_file],0
jne dump_symbols
ret
write_code:
mov eax,[written_size]
@ -162,6 +187,7 @@ formatter:
mov edx,[code_start]
mov ecx,[code_size]
add [written_size],ecx
lea eax,[edx+ecx]
call write
jc write_failed
ret
@ -837,6 +863,10 @@ format_pe:
jc setting_already_specified
and ax,3Fh
mov [subsystem],ax
cmp ax,10
jb subsystem_type_ok
or [format_flags],8
subsystem_type_ok:
cmp byte [esi],'('
jne pe_settings
inc esi
@ -890,11 +920,11 @@ format_pe:
push edx edi
add edi,[stub_size]
test [format_flags],8
jnz get_pe64_base
jnz get_peplus_base
call get_dword_value
mov [image_base],eax
jmp pe_base_ok
get_pe64_base:
get_peplus_base:
call get_qword_value
mov [image_base],eax
mov [image_base_high],edx
@ -957,7 +987,7 @@ format_pe:
pe_alignment_ok:
mov word [edx+1Ah],VERSION_MAJOR + VERSION_MINOR shl 8
test [format_flags],8
jnz init_pe64_specific
jnz init_peplus_specific
mov dword [edx+14h],0E0h ; size of optional header
mov dword [edx+16h],10B010Eh; flags and magic value
mov eax,[image_base]
@ -968,7 +998,7 @@ format_pe:
mov dword [edx+6Ch],0 ; heap commit
mov dword [edx+74h],16 ; number of directories
jmp pe_header_ok
init_pe64_specific:
init_peplus_specific:
mov dword [edx+14h],0F0h ; size of optional header
mov dword [edx+16h],20B002Eh; flags and magic value
mov eax,[image_base]
@ -1031,13 +1061,13 @@ format_pe:
add eax,edi
adc ecx,0
test [format_flags],8
jnz pe64_org
jnz peplus_org
sub eax,[edx+34h]
sbb ecx,0
mov bl,2
mov [code_type],32
jmp pe_org_ok
pe64_org:
peplus_org:
sub eax,[edx+30h]
sbb ecx,[edx+34h]
mov bl,4
@ -1103,7 +1133,7 @@ pe_section:
sub eax,[ebx+0Ch]
sbb ecx,0
test [format_flags],8
jnz pe64_section_org
jnz peplus_section_org
sub eax,[edx+34h]
sbb ecx,0
mov [labels_type],2
@ -1112,7 +1142,7 @@ pe_section:
jc pe_section_org_ok
mov [labels_type],0
jmp pe_section_org_ok
pe64_section_org:
peplus_section_org:
sub eax,[edx+30h]
sbb ecx,[edx+34h]
mov [labels_type],4
@ -1138,11 +1168,11 @@ pe_section:
inc esi
mov ecx,ebx
test [format_flags],8
jnz pe64_directory
jnz peplus_directory
xchg ecx,[edx+78h+eax*8]
mov dword [edx+78h+eax*8+4],-1
jmp pe_directory_set
pe64_directory:
peplus_directory:
xchg ecx,[edx+88h+eax*8]
mov dword [edx+88h+eax*8+4],-1
pe_directory_set:
@ -1199,13 +1229,36 @@ pe_section:
mov eax,[code_start]
sub eax,[stub_size]
sub [ebx+14h],eax
mov ecx,[ebx+10h]
test byte [ebx+24h],20h
jz pe_code_sum_ok
add [edx+1Ch],ecx
cmp dword [edx+2Ch],0
jne pe_code_sum_ok
mov eax,[ebx+0Ch]
mov [edx+2Ch],eax
pe_code_sum_ok:
test byte [ebx+24h],40h
jz pe_data_sum_ok
add [edx+20h],ecx
test [format_flags],8
jnz pe_data_sum_ok
cmp dword [edx+30h],0
jne pe_data_sum_ok
mov eax,[ebx+0Ch]
mov [edx+30h],eax
pe_data_sum_ok:
mov eax,[ebx+8]
or eax,eax
jz udata_ok
cmp dword [ebx+10h],0
jne udata_ok
or byte [ebx+24h],80h
add [edx+24h],ecx
udata_ok:
mov ecx,[edx+38h]
dec ecx
add eax,ecx
@ -1239,10 +1292,10 @@ data_directive:
add ecx,[ebx+0Ch]
mov edx,[code_start]
test [format_flags],8
jnz pe64_data
jnz peplus_data
xchg ecx,[edx+78h+eax*8]
jmp init_pe_data
pe64_data:
peplus_data:
xchg ecx,[edx+88h+eax*8]
init_pe_data:
or ecx,ecx
@ -1266,11 +1319,11 @@ data_directive:
add ecx,[edx+0Ch]
mov edx,[code_start]
test [format_flags],8
jnz end_pe64_data
jnz end_peplus_data
sub ecx,[edx+78h+eax*8]
mov [edx+78h+eax*8+4],ecx
jmp remove_structure_data
end_pe64_data:
end_peplus_data:
sub ecx,[edx+88h+eax*8]
mov [edx+88h+eax*8+4],ecx
jmp remove_structure_data
@ -1281,7 +1334,7 @@ pe_entry:
cmp byte [esi],'.'
je invalid_value
test [format_flags],8
jnz pe64_entry
jnz peplus_entry
call get_dword_value
mov bl,2
bt [resolver_flags],0
@ -1300,29 +1353,29 @@ pe_entry:
sub eax,[edx+34h]
mov [edx+28h],eax
jmp instruction_assembled
pe64_entry:
peplus_entry:
call get_qword_value
mov bl,4
bt [resolver_flags],0
jc check_pe64_entry_label_type
jc check_peplus_entry_label_type
xor bl,bl
check_pe64_entry_label_type:
check_peplus_entry_label_type:
cmp [value_type],bl
je pe64_entry_type_ok
je peplus_entry_type_ok
cmp [error_line],0
jne pe64_entry_type_ok
jne peplus_entry_type_ok
mov edx,[current_line]
mov [error_line],edx
mov [error],invalid_address
pe64_entry_type_ok:
peplus_entry_type_ok:
mov ecx,[code_start]
sub eax,[ecx+30h]
sbb edx,[ecx+34h]
jz pe64_entry_range_ok
jz peplus_entry_range_ok
mov edx,[current_line]
mov [error_line],edx
mov [error],value_out_of_range
pe64_entry_range_ok:
peplus_entry_range_ok:
mov [ecx+28h],eax
jmp instruction_assembled
pe_stack:
@ -1332,7 +1385,7 @@ pe_stack:
cmp byte [esi],'.'
je invalid_value
test [format_flags],8
jnz pe64_stack
jnz peplus_stack
call get_dword_value
cmp [value_type],0
jne invalid_use_of_symbol
@ -1361,7 +1414,7 @@ pe_stack:
ja instruction_assembled
mov dword [edx+64h],eax
jmp instruction_assembled
pe64_stack:
peplus_stack:
call get_qword_value
cmp [value_type],0
jne invalid_use_of_symbol
@ -1369,7 +1422,7 @@ pe_stack:
mov [ecx+60h],eax
mov [ecx+64h],edx
cmp byte [esi],','
jne default_pe64_stack_commit
jne default_peplus_stack_commit
lods byte [esi]
lods byte [esi]
cmp al,'('
@ -1388,7 +1441,7 @@ pe_stack:
cmp eax,[ecx+60h]
ja value_out_of_range
jmp instruction_assembled
default_pe64_stack_commit:
default_peplus_stack_commit:
mov dword [ecx+68h],1000h
cmp dword [ecx+64h],0
jne instruction_assembled
@ -1404,7 +1457,7 @@ pe_heap:
cmp byte [esi],'.'
je invalid_value
test [format_flags],8
jnz pe64_heap
jnz peplus_heap
call get_dword_value
cmp [value_type],0
jne invalid_use_of_symbol
@ -1426,7 +1479,7 @@ pe_heap:
cmp eax,[edx+68h]
ja value_out_of_range
jmp instruction_assembled
pe64_heap:
peplus_heap:
call get_qword_value
cmp [value_type],0
jne invalid_use_of_symbol
@ -1963,7 +2016,7 @@ make_pe_resource:
jge check_next_language_id
mov edx,eax
mov eax,[esp]
mov [current_offset],eax
mov dword [value],eax
check_next_language_id:
pop esi
mov eax,[esi+16]
@ -1981,7 +2034,7 @@ make_pe_resource:
jae out_of_memory
mov eax,ebx
stos dword [edi]
mov eax,[current_offset]
mov eax,dword [value]
stos dword [edi]
jmp make_language_id_directory
language_id_directory_done:
@ -2331,12 +2384,18 @@ mark_coff_relocation:
test [format_flags],8
jnz coff_64bit_relocation
mov al,6
cmp [value_type],5
jne coff_relocation
inc al
jmp coff_relocation
coff_64bit_relocation:
mov al,1
cmp [value_type],4
je coff_relocation
mov al,2
cmp [value_type],5
jne coff_relocation
inc al
jmp coff_relocation
coff_relocation_relative:
push ebx
@ -3514,6 +3573,7 @@ elf_formatter:
mov [edx+1+4],eax
mov dword [edx+1+8],'.str'
mov [edx+1+8+4],eax
mov [resource_data],edx
mov [written_size],0
mov edx,[output_file]
call create
@ -3909,3 +3969,281 @@ close_elf_exe:
or [next_pass_needed],-1
elf64_exe_ok:
ret
dump_symbols:
mov ebx,[code_start]
mov dword [ebx],'fas'+27 shl 24
mov dword [ebx+4],VERSION_MAJOR + VERSION_MINOR shl 8 + 38h shl 16
add ebx,38h
mov edi,ebx
mov dword [ebx-38h+10h],38h
mov dword [ebx-38h+8],0
mov esi,[input_file]
call copy_asciiz
cmp edi,[display_buffer]
jae out_of_memory
mov eax,edi
sub eax,ebx
mov [ebx-38h+0Ch],eax
mov esi,[output_file]
call copy_asciiz
cmp edi,[display_buffer]
jae out_of_memory
mov edx,[symbols_stream]
mov ebp,[free_additional_memory]
mov [number_of_sections],0
cmp [output_format],4
je prepare_strings_table
cmp [output_format],5
jne strings_table_ready
bt [format_flags],0
jc strings_table_ready
prepare_strings_table:
cmp edx,ebp
je strings_table_ready
mov al,[edx]
test al,al
jz prepare_string
cmp al,80h
je prepare_string
add edx,0Ch
cmp al,0C0h
jne prepare_strings_table
add edx,4
jmp prepare_strings_table
prepare_string:
mov esi,edi
sub esi,ebx
xchg esi,[edx+4]
test al,al
jz prepare_section_string
or dword [edx+4],1 shl 31
add edx,0Ch
prepare_external_string:
mov ecx,[esi]
add esi,4
rep movs byte [edi],[esi]
mov byte [edi],0
inc edi
cmp edi,[display_buffer]
jae out_of_memory
jmp prepare_strings_table
prepare_section_string:
mov ecx,[number_of_sections]
mov eax,ecx
inc eax
mov [number_of_sections],eax
xchg eax,[edx+4]
shl ecx,2
add ecx,[free_additional_memory]
mov [ecx],eax
add edx,20h
test esi,esi
jz prepare_default_section_string
cmp [output_format],5
jne prepare_external_string
bt [format_flags],0
jc prepare_external_string
mov esi,[esi]
add esi,[resource_data]
copy_elf_section_name:
lods byte [esi]
cmp edi,[display_buffer]
jae out_of_memory
stos byte [edi]
test al,al
jnz copy_elf_section_name
jmp prepare_strings_table
prepare_default_section_string:
mov eax,'.fla'
stos dword [edi]
mov ax,'t'
stos word [edi]
cmp edi,[display_buffer]
jae out_of_memory
jmp prepare_strings_table
strings_table_ready:
mov edx,[display_buffer]
mov ebp,[memory_end]
sub ebp,[labels_list]
add ebp,edx
prepare_labels_dump:
cmp edx,ebp
je labels_dump_ok
mov eax,[edx+24]
test eax,eax
jz label_dump_name_ok
cmp eax,[memory_start]
jb label_name_outside_source
cmp eax,[source_start]
ja label_name_outside_source
sub eax,[memory_start]
dec eax
mov [edx+24],eax
jmp label_dump_name_ok
label_name_outside_source:
mov esi,eax
mov eax,edi
sub eax,ebx
or eax,1 shl 31
mov [edx+24],eax
movzx ecx,byte [esi-1]
lea eax,[edi+ecx+1]
cmp edi,[display_buffer]
jae out_of_memory
rep movsb
xor al,al
stosb
label_dump_name_ok:
mov eax,[edx+28]
test eax,eax
jz label_dump_line_ok
sub eax,[memory_start]
mov [edx+28],eax
label_dump_line_ok:
mov eax,[edx+20]
test eax,eax
jz base_symbol_for_label_ok
cmp eax,[symbols_stream]
mov eax,[eax+4]
jae base_symbol_for_label_ok
xor eax,eax
base_symbol_for_label_ok:
mov [edx+20],eax
add edx,32
jmp prepare_labels_dump
labels_dump_ok:
mov eax,edi
sub eax,ebx
mov [ebx-38h+14h],eax
add eax,38h
mov [ebx-38h+18h],eax
mov ecx,[memory_end]
sub ecx,[labels_list]
mov [ebx-38h+1Ch],ecx
add eax,ecx
mov [ebx-38h+20h],eax
mov ecx,[source_start]
sub ecx,[memory_start]
mov [ebx-38h+24h],ecx
add eax,ecx
mov [ebx-38h+28h],eax
mov eax,[number_of_sections]
shl eax,3
mov [ebx-38h+34h],eax
mov esi,[memory_start]
prepare_preprocessed_source:
cmp esi,[source_start]
jae preprocessed_source_ok
mov eax,[memory_start]
mov edx,[input_file]
cmp [esi],edx
jne line_not_from_main_input
mov [esi],eax
line_not_from_main_input:
sub [esi],eax
test byte [esi+7],1 shl 7
jz prepare_next_preprocessed_line
sub [esi+8],eax
sub [esi+12],eax
prepare_next_preprocessed_line:
add esi,16
call skip_foreign_line
jmp prepare_preprocessed_source
preprocessed_source_ok:
mov esi,[labels_list]
mov ebp,edi
make_lines_dump:
cmp esi,[display_buffer]
je lines_dump_ok
mov eax,[esi-4]
mov ecx,[esi-8]
sub esi,8
sub esi,ecx
cmp eax,1
jne make_lines_dump
mov eax,[esi+4]
sub eax,[code_start]
add eax,[headers_size]
cmp byte [esi+1Ah],0
je store_offset
xor eax,eax
store_offset:
stos dword [edi]
mov eax,[esi]
sub eax,[memory_start]
stos dword [edi]
mov eax,[esi+4]
xor edx,edx
sub eax,[esi+8]
sbb edx,[esi+8+4]
stos dword [edi]
mov eax,edx
stos dword [edi]
mov eax,[esi+10h]
stos dword [edi]
mov eax,[esi+14h]
test eax,eax
jz base_symbol_for_line_ok
cmp eax,[symbols_stream]
mov eax,[eax+4]
jae base_symbol_for_line_ok
xor eax,eax
base_symbol_for_line_ok:
stos dword [edi]
mov eax,[esi+18h]
and eax,001FFFFh
stos dword [edi]
jmp make_lines_dump
lines_dump_ok:
mov edx,edi
mov eax,[current_offset]
sub eax,[code_start]
add eax,[headers_size]
stos dword [edi]
mov ecx,edi
sub ecx,ebx
sub ecx,[ebx-38h+14h]
mov [ebx-38h+2Ch],ecx
add ecx,[ebx-38h+28h]
mov [ebx-38h+30h],ecx
find_inexisting_offsets:
sub edx,1Ch
cmp edx,ebp
jb write_symbols
test byte [edx+1Ah],1
jnz find_inexisting_offsets
cmp eax,[edx]
jb correct_inexisting_offset
mov eax,[edx]
jmp find_inexisting_offsets
correct_inexisting_offset:
mov dword [edx],0
or byte [edx+1Ah],2
jmp find_inexisting_offsets
write_symbols:
mov edx,[symbols_file]
call create
jc write_failed
mov edx,[code_start]
mov ecx,[edx+14h]
add ecx,38h
call write
mov edx,[display_buffer]
mov ecx,[memory_end]
sub ecx,[labels_list]
call write
mov edx,[memory_start]
mov ecx,[source_start]
sub ecx,edx
call write
mov edx,ebp
mov ecx,edi
sub ecx,edx
call write
mov edx,[free_additional_memory]
mov ecx,[number_of_sections]
shl ecx,2
call write
call close
ret

View File

@ -24,6 +24,8 @@ parser:
jae out_of_memory
cmp byte [esi+16],0
je empty_line
cmp byte [esi+16],3Bh
je empty_line
mov al,0Fh
stos byte [edi]
mov eax,esi
@ -121,32 +123,15 @@ parser:
jz parse_next_line
cmp al,':'
je invalid_name
cmp al,3Bh
je skip_preprocessed_symbol
dec esi
cmp al,3Bh
je skip_rest_of_line
call parse_argument
jmp parse_next_line
skip_preprocessed_symbol:
lods byte [esi]
movzx eax,al
add esi,eax
skip_next:
lods byte [esi]
or al,al
jz parse_next_line
cmp al,1Ah
je skip_preprocessed_symbol
cmp al,3Bh
je skip_preprocessed_symbol
cmp al,22h
je skip_preprocessed_string
jmp skip_next
skip_preprocessed_string:
lods dword [esi]
add esi,eax
jmp skip_next
empty_line:
add esi,17
add esi,16
skip_rest_of_line:
call skip_foreign_line
parse_next_line:
cmp esi,[source_start]
jb parser_loop
@ -159,10 +144,6 @@ parser:
blocks_stack_ok:
xor al,al
stos byte [edi]
;mov eax,[error_line]
;mov [current_line],eax
;cmp [anonymous_forward],0
;jne invalid_value
add edi,0Fh
and edi,not 0Fh
mov [code_start],edi
@ -914,7 +895,6 @@ parse_line_contents:
jmp expression
contents_parsed:
cmp [parenthesis_stack],0
; jne invalid_expression
je contents_ok
dec [parenthesis_stack]
add esp,8

View File

@ -661,13 +661,21 @@ preprocess_line:
mov edx,[struc_name]
movzx eax,byte [edx-1]
add edx,eax
push edi
lea esi,[edi-1]
mov ecx,edi
sub ecx,edx
std
rep movs byte [edi],[esi]
cld
pop edi
inc edi
mov al,3Ah
mov [edx],al
inc al
xchg al,[edx+1]
dec al
mov [edx+2],al
mov [edx+1],al
pop esi edx
inc esi
jmp use_macro
preprocess_label:
dec esi
@ -805,11 +813,15 @@ get_preprocessor_symbol:
ret
add_preprocessor_symbol:
push edi esi
cmp ch,11b
je preprocessor_symbol_name_ok
push ecx
movzx ecx,cl
mov edi,preprocessor_directives
call get_directive
jnc reserved_word_used_as_symbol
pop ecx
preprocessor_symbol_name_ok:
call calculate_hash
mov ebp,eax
and ebp,3FFh
@ -2039,14 +2051,13 @@ process_macro:
stos dword [edi]
jmp macro_line_header_ok
instant_macro_line_header:
mov edx,[macro_line]
mov eax,[edx]
mov eax,[macro_line]
add eax,16+1
stos dword [edi]
mov eax,[edx+4]
mov eax,ecx
stos dword [edi]
mov eax,[edx+8]
mov eax,[macro_line]
stos dword [edi]
mov eax,[edx+12]
stos dword [edi]
macro_line_header_ok:
or [macro_status],20h

View File

@ -2,22 +2,22 @@ symbol_dump:
push edi
mov edx,[memory_end]
dump_symbols:
symb_dump:
cmp edx,[labels_list]
jbe symbols_dumped
sub edx,LABEL_STRUCTURE_SIZE
cmp dword [edx+24],0
je dump_symbols ; do not dump anonymous symbols
je symb_dump ; do not dump anonymous symbols
test byte [edx+8],1
jz dump_symbols ; do not dump symbols that didn't get defined
jz symb_dump ; do not dump symbols that didn't get defined
mov ax,[current_pass]
cmp ax,[edx+16]
jne dump_symbols
jne symb_dump
test byte [edx+8],4 or 2
jnz dump_symbols ; do not dump assembly-time variables
jnz symb_dump ; do not dump assembly-time variables
; do not dump variables defined with '='
cmp word [edx+12], 0
jnz dump_symbols ; do not dump register-based variables
jnz symb_dump ; do not dump register-based variables
mov al, '0'
stosb
@ -73,7 +73,7 @@ symbol_dump:
mov ax,0A0Dh
stosw
jmp dump_symbols
jmp symb_dump
symbols_dumped:
mov edx,dbgfilename

View File

@ -418,7 +418,7 @@ display_user_messages:
; pop [textxy]
; add [textxy], 7 shl 16 +53
mov [displayed_count],0
call flush_display_buffer
call show_display_buffer
cmp [displayed_count],1
jb line_break_ok
je make_line_break

View File

@ -198,6 +198,8 @@ symbols_3:
db 'ecx',10h,41h
db 'edi',10h,47h
db 'edx',10h,42h
db 'efi',1Bh,10
db 'eip',10h,0F4h
db 'elf',18h,50h
db 'esi',10h,46h
db 'esp',10h,44h
@ -231,6 +233,7 @@ symbols_3:
db 'rcx',10h,81h
db 'rdi',10h,87h
db 'rdx',10h,82h
db 'rip',10h,0F8h
db 'rsi',10h,86h
db 'rsp',10h,84h
db 'sil',10h,16h
@ -336,6 +339,7 @@ symbols_6:
db 'static',1Dh,1
symbols_7:
db 'console',1Bh,3
db 'efiboot',1Bh,11
symbols_8:
db 'linkinfo',19h,9
db 'readable',19h,30
@ -345,6 +349,7 @@ symbols_9:
db 'shareable',19h,28
db 'writeable',19h,31
symbols_10:
db 'efiruntime',1Bh,12
db 'executable',19h,29
db 'linkremove',19h,11
symbols_11:

View File

@ -15,6 +15,7 @@ stack_limit dd ?
input_file dd ?
output_file dd ?
symbols_file dd ?
passes_limit dw ?
@ -51,8 +52,8 @@ label_leaf dd ?
hash_tree dd ?
org_origin dq ?
org_registers dd ?
org_start dd ?
org_symbol dd ?
org_start dd ?
undefined_data_start dd ?
undefined_data_end dd ?
counter dd ?
@ -91,6 +92,10 @@ parsed_lines dd ?
logical_value_parentheses dd ?
file_extension dd ?
labels_type db ?
code_type db ?
virtual_data db ?
operand_size db ?
size_override db ?
operand_prefix db ?
@ -113,14 +118,11 @@ compare_type db ?
logical_value_wrapping db ?
next_pass_needed db ?
macro_status db ?
output_format db ?
code_type db ?
labels_type db ?
segment_register db ?
prefixed_instruction db ?
virtual_data db ?
fp_sign db ?
fp_format db ?
output_format db ?
characters rb 100h
converted rb 100h

View File

@ -1,6 +1,6 @@
; flat assembler version 1.67
; Copyright (c) 1999-2007, Tomasz Grysztar.
; Copyright (c) 1999-2008, Tomasz Grysztar.
; All rights reserved.
;
; This programs is free for commercial and non-commercial use as long as
@ -33,7 +33,7 @@
; cannot simply be copied and put under another distribution licence
; (including the GNU Public Licence).
VERSION_STRING equ "1.67.27"
VERSION_STRING equ "1.67.29"
VERSION_MAJOR = 1
VERSION_MINOR = 67

View File

@ -4845,6 +4845,7 @@ movq_instruction:
call get_size_operator
cmp al,10h
jne invalid_operand
mov [operand_size],0
lods byte [esi]
call convert_mmx_register
mov [postbyte_register],al