fasm 1.67.25

git-svn-id: svn://kolibrios.org@692 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
heavyiron 2007-12-30 23:34:37 +00:00
parent b4c6fb8d7b
commit 4dbfb6d6a0
9 changed files with 367 additions and 99 deletions

View File

@ -4,128 +4,168 @@
; All rights reserved.
out_of_memory:
call fatal_error
db 'out of memory',0
push _out_of_memory
jmp fatal_error
stack_overflow:
call fatal_error
db 'out of stack space',0
push _stack_overflow
jmp fatal_error
main_file_not_found:
call fatal_error
db 'source file not found',0
push _main_file_not_found
jmp fatal_error
unexpected_end_of_file:
call fatal_error
db 'unexpected end of file',0
push _unexpected_end_of_file
jmp fatal_error
code_cannot_be_generated:
call fatal_error
db 'code cannot be generated',0
push _code_cannot_be_generated
jmp fatal_error
format_limitations_exceeded:
call fatal_error
db 'format limitations exceeded',0
push _format_limitations_exceeded
jmp fatal_error
invalid_definition:
push _invalid_definition
jmp fatal_error
write_failed:
call fatal_error
db 'write failed',0
push _write_failed
jmp fatal_error
file_not_found:
call assembler_error
db 'file not found',0
push _file_not_found
jmp assembler_error
error_reading_file:
call assembler_error
db 'error reading file',0
push _error_reading_file
jmp assembler_error
invalid_file_format:
call assembler_error
db 'invalid file format',0
push _invalid_file_format
jmp assembler_error
invalid_macro_arguments:
call assembler_error
db 'invalid macro arguments',0
push _invalid_macro_arguments
jmp assembler_error
incomplete_macro:
call assembler_error
db 'incomplete macro',0
push _incomplete_macro
jmp assembler_error
unexpected_characters:
call assembler_error
db 'unexpected characters',0
push _unexpected_characters
jmp assembler_error
invalid_argument:
call assembler_error
db 'invalid argument',0
push _invalid_argument
jmp assembler_error
illegal_instruction:
call assembler_error
db 'illegal instruction',0
push _illegal_instruction
jmp assembler_error
invalid_operand:
call assembler_error
db 'invalid operand',0
push _invalid_operand
jmp assembler_error
invalid_operand_size:
call assembler_error
db 'invalid size of operand',0
push _invalid_operand_size
jmp assembler_error
operand_size_not_specified:
call assembler_error
db 'operand size not specified',0
push _operand_size_not_specified
jmp assembler_error
operand_sizes_do_not_match:
call assembler_error
db 'operand sizes do not match',0
push _operand_sizes_do_not_match
jmp assembler_error
invalid_address_size:
call assembler_error
db 'invalid size of address value',0
push _invalid_address_size
jmp assembler_error
address_sizes_do_not_agree:
call assembler_error
db 'address sizes do not agree',0
push _address_sizes_do_not_agree
jmp assembler_error
prefix_conflict:
call assembler_error
db 'disallowed combination of registers',0
push _prefix_conflict
jmp assembler_error
long_immediate_not_encodable:
call assembler_error
db 'not encodable with long immediate',0
push _long_immediate_not_encodable
jmp assembler_error
relative_jump_out_of_range:
call assembler_error
db 'relative jump out of range',0
push _relative_jump_out_of_range
jmp assembler_error
invalid_expression:
call assembler_error
db 'invalid expression',0
push _invalid_expression
jmp assembler_error
invalid_address:
call assembler_error
db 'invalid address',0
push _invalid_address
jmp assembler_error
invalid_value:
call assembler_error
db 'invalid value',0
push _invalid_value
jmp assembler_error
value_out_of_range:
call assembler_error
db 'value out of range',0
push _value_out_of_range
jmp assembler_error
undefined_symbol:
call assembler_error
db 'undefined symbol',0
mov edi,message
mov esi,_undefined_symbol
call copy_asciiz
push message
cmp [error_info],0
je assembler_error
mov byte [edi-1],20h
call write_quoted_symbol_name
jmp assembler_error
copy_asciiz:
lods byte [esi]
stos byte [edi]
test al,al
jnz copy_asciiz
ret
write_quoted_symbol_name:
mov al,27h
stosb
mov esi,[error_info]
movzx ecx,byte [esi-1]
rep movs byte [edi],[esi]
mov ax,27h
stosw
ret
symbol_out_of_scope:
mov edi,message
mov esi,_symbol_out_of_scope_1
call copy_asciiz
cmp [error_info],0
je finish_symbol_out_of_scope_message
mov byte [edi-1],20h
call write_quoted_symbol_name
finish_symbol_out_of_scope_message:
mov byte [edi-1],20h
mov esi,_symbol_out_of_scope_2
call copy_asciiz
push message
jmp assembler_error
invalid_use_of_symbol:
call assembler_error
db 'invalid use of symbol',0
push _invalid_use_of_symbol
jmp assembler_error
name_too_long:
call assembler_error
db 'name too long',0
push _name_too_long
jmp assembler_error
invalid_name:
call assembler_error
db 'invalid name',0
push _invalid_name
jmp assembler_error
reserved_word_used_as_symbol:
call assembler_error
db 'reserved word used as symbol',0
push _reserved_word_used_as_symbol
jmp assembler_error
symbol_already_defined:
call assembler_error
db 'symbol already defined',0
push _symbol_already_defined
jmp assembler_error
missing_end_quote:
call assembler_error
db 'missing end quote',0
push _missing_end_quote
jmp assembler_error
missing_end_directive:
call assembler_error
db 'missing end directive',0
push _missing_end_directive
jmp assembler_error
unexpected_instruction:
call assembler_error
db 'unexpected instruction',0
push _unexpected_instruction
jmp assembler_error
extra_characters_on_line:
call assembler_error
db 'extra characters on line',0
push _extra_characters_on_line
jmp assembler_error
section_not_aligned_enough:
call assembler_error
db 'section is not aligned enough',0
push _section_not_aligned_enough
jmp assembler_error
setting_already_specified:
call assembler_error
db 'setting already specified',0
push _setting_already_specified
jmp assembler_error
data_already_defined:
call assembler_error
db 'data already defined',0
push _data_already_defined
jmp assembler_error
too_many_repeats:
call assembler_error
db 'too many repeats',0
push _too_many_repeats
jmp assembler_error

View File

@ -956,7 +956,7 @@ calculate_expression:
cmp ax,[ebx+16]
je label_defined
test byte [ebx+8],4
jnz label_undefined
jnz label_out_of_scope
test byte [ebx+9],1
jz label_defined
mov eax,[ebx]
@ -1053,7 +1053,22 @@ calculate_expression:
je timestamp_label
cmp eax,3
je org_origin_label
mov edx,invalid_value
jmp error_undefined
label_out_of_scope:
mov edx,symbol_out_of_scope
mov eax,[ebx+24]
cmp [error_line],0
jne error_undefined
mov [error_info],eax
jmp error_undefined
label_undefined:
mov edx,undefined_symbol
cmp [error_line],0
jne error_undefined
mov eax,[ebx+24]
mov [error_info],eax
error_undefined:
cmp [current_pass],1
ja undefined_value
force_next_pass:
@ -1069,7 +1084,7 @@ calculate_expression:
jne calculation_loop
mov eax,[current_line]
mov [error_line],eax
mov [error],undefined_symbol
mov [error],edx
jmp calculation_loop
calculate_add:
mov ecx,[ebx+16]

View File

@ -544,6 +544,7 @@ include 'formats.inc'
include 'x86_64.inc'
include 'tables.inc'
include 'symbdump.inc'
include 'messages.inc'
title db appname,VERSION_STRING,0
@ -586,6 +587,8 @@ buffer_address dd ?
memory_setting dd ?
start_time dd ?
predefinitions rb 1000h
dbgfilename rb MAX_PATH+4
sc system_colors

View File

@ -2666,10 +2666,10 @@ coff_formatter:
mov [current_line],eax
mov eax,[esi+8]
test byte [eax+8],1
jz undefined_symbol
jz undefined_coff_public
mov cx,[current_pass]
cmp cx,[eax+16]
jne undefined_symbol
jne undefined_coff_public
mov cl,[eax+11]
or cl,cl
jz public_constant
@ -2678,6 +2678,10 @@ coff_formatter:
cmp cl,2
je public_symbol_type_ok
jmp invalid_use_of_symbol
undefined_coff_public:
mov eax,[eax+24]
mov [error_info],eax
jmp undefined_symbol
check_64bit_public_symbol:
cmp cl,4
jne invalid_use_of_symbol
@ -3092,10 +3096,10 @@ elf_formatter:
jne invalid_argument
mov ebx,[esi+8]
test byte [ebx+8],1
jz undefined_symbol
jz undefined_public
mov ax,[current_pass]
cmp ax,[ebx+16]
jne undefined_symbol
jne undefined_public
mov dl,[ebx+11]
or dl,dl
jz public_absolute
@ -3109,6 +3113,10 @@ elf_formatter:
jne invalid_use_of_symbol
mov dx,[eax+0Eh]
jmp section_for_public_ok
undefined_public:
mov eax,[ebx+24]
mov [error_info],eax
jmp undefined_symbol
elf64_public:
cmp dl,4
jne invalid_use_of_symbol

View File

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

View File

@ -23,11 +23,8 @@ preprocessor:
mov byte [edi+eax],0
loop mark_symbol_characters
mov edi,locals_counter
mov al,7
stos byte [edi]
movzx ecx,al
mov al,'0'
rep stos byte [edi]
mov ax,1 + '0' shl 8
stos word [edi]
mov edi,[memory_start]
mov [include_paths],edi
mov esi,include_variable
@ -43,6 +40,149 @@ preprocessor:
mov [display_buffer],eax
mov [hash_tree],eax
mov [macro_status],al
mov esi,predefinitions
process_predefinitions:
movzx ecx,byte [esi]
test ecx,ecx
jz predefinitions_ok
inc esi
lea eax,[esi+ecx]
push eax
mov ch,10b
call add_preprocessor_symbol
pop esi
mov edi,[memory_start]
mov [edx+8],edi
convert_predefinition:
cmp edi,[memory_end]
jae out_of_memory
lods byte [esi]
or al,al
jz predefinition_converted
cmp al,20h
je convert_predefinition
mov ah,al
mov ebx,characters
xlat byte [ebx]
or al,al
jz predefinition_separator
cmp ah,27h
je predefinition_string
cmp ah,22h
je predefinition_string
mov byte [edi],1Ah
scas word [edi]
xchg al,ah
stos byte [edi]
mov ebx,characters
xor ecx,ecx
predefinition_symbol:
lods byte [esi]
stos byte [edi]
xlat byte [ebx]
or al,al
loopnzd predefinition_symbol
neg ecx
cmp ecx,255
ja invalid_definition
mov ebx,edi
sub ebx,ecx
mov byte [ebx-2],cl
found_predefinition_separator:
dec edi
mov ah,[esi-1]
predefinition_separator:
xchg al,ah
or al,al
jz predefinition_converted
cmp al,20h
je convert_line_data
cmp al,3Bh
je invalid_definition
cmp al,5Ch
je predefinition_backslash
stos byte [edi]
jmp convert_predefinition
predefinition_string:
mov al,22h
stos byte [edi]
scas dword [edi]
mov ebx,edi
copy_predefinition_string:
lods byte [esi]
stos byte [edi]
or al,al
jz invalid_definition
cmp al,ah
jne copy_predefinition_string
lods byte [esi]
cmp al,ah
je copy_predefinition_string
dec esi
dec edi
mov eax,edi
sub eax,ebx
mov [ebx-4],eax
jmp convert_predefinition
predefinition_backslash:
mov byte [edi],0
lods byte [esi]
or al,al
jz invalid_definition
cmp al,20h
je invalid_definition
cmp al,3Bh
je invalid_definition
mov al,1Ah
stos byte [edi]
mov ecx,edi
mov ax,5C01h
stos word [edi]
dec esi
group_predefinition_backslashes:
lods byte [esi]
cmp al,5Ch
jne predefinition_backslashed_symbol
stos byte [edi]
inc byte [ecx]
jmp group_predefinition_backslashes
predefinition_backslashed_symbol:
cmp al,20h
je invalid_definition
cmp al,22h
je invalid_definition
cmp al,27h
je invalid_definition
cmp al,3Bh
je invalid_definition
mov ah,al
mov ebx,characters
xlat byte [ebx]
or al,al
jz predefinition_backslashed_symbol_character
mov al,ah
convert_predefinition_backslashed_symbol:
stos byte [edi]
xlat byte [ebx]
or al,al
jz found_predefinition_separator
inc byte [ecx]
jz invalid_definition
lods byte [esi]
jmp convert_predefinition_backslashed_symbol
predefinition_backslashed_symbol_character:
mov al,ah
stos byte [edi]
inc byte [ecx]
jmp convert_predefinition
predefinition_converted:
mov [memory_start],edi
sub edi,[edx+8]
mov [edx+12],edi
jmp process_predefinitions
predefinitions_ok:
mov esi,[input_file]
mov edx,esi
call open
@ -2220,16 +2360,25 @@ local_symbols:
movzx ecx,byte [eax]
counter_loop:
inc byte [eax+ecx]
cmp byte [eax+ecx],':'
cmp byte [eax+ecx],'9'+1
jb counter_ok
jne letter_digit
mov byte [eax+ecx],'A'
jmp counter_ok
letter_digit:
cmp byte [eax+ecx],'F'
jbe counter_ok
cmp byte [eax+ecx],'Z'+1
jb counter_ok
jne small_letter_digit
mov byte [eax+ecx],'a'
jmp counter_ok
small_letter_digit:
cmp byte [eax+ecx],'z'+1
jb counter_ok
mov byte [eax+ecx],'0'
loop counter_loop
inc byte [eax]
movzx ecx,byte [eax]
mov byte [eax+ecx],'0'
counter_ok:
pop ecx
lods byte [esi]

View File

@ -57,6 +57,7 @@ undefined_data_start dd ?
undefined_data_end dd ?
counter dd ?
counter_limit dd ?
error_info dd ?
error_line dd ?
error dd ?
display_buffer dd ?
@ -122,3 +123,4 @@ logical_value_wrapping db ?
characters rb 100h
converted rb 100h
message rb 200h

View File

@ -33,7 +33,7 @@
; cannot simply be copied and put under another distribution licence
; (including the GNU Public Licence).
VERSION_STRING equ "1.67.23"
VERSION_STRING equ "1.67.25"
VERSION_MAJOR = 1
VERSION_MINOR = 67