Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 692 → Rev 691

/programs/develop/fasm/trunk/symbdump.inc
File deleted
/programs/develop/fasm/trunk/messages.inc
File deleted
\ No newline at end of file
/programs/develop/fasm/trunk/fasm.asm
544,7 → 544,6
include 'x86_64.inc'
include 'tables.inc'
include 'symbdump.inc'
include 'messages.inc'
 
title db appname,VERSION_STRING,0
 
587,8 → 586,6
memory_setting dd ?
start_time dd ?
 
predefinitions rb 1000h
 
dbgfilename rb MAX_PATH+4
 
sc system_colors
/programs/develop/fasm/trunk/expressi.inc
956,7 → 956,7
cmp ax,[ebx+16]
je label_defined
test byte [ebx+8],4
jnz label_out_of_scope
jnz label_undefined
test byte [ebx+9],1
jz label_defined
mov eax,[ebx]
1053,22 → 1053,7
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:
1084,7 → 1069,7
jne calculation_loop
mov eax,[current_line]
mov [error_line],eax
mov [error],edx
mov [error],undefined_symbol
jmp calculation_loop
calculate_add:
mov ecx,[ebx+16]
/programs/develop/fasm/trunk/formats.inc
2666,10 → 2666,10
mov [current_line],eax
mov eax,[esi+8]
test byte [eax+8],1
jz undefined_coff_public
jz undefined_symbol
mov cx,[current_pass]
cmp cx,[eax+16]
jne undefined_coff_public
jne undefined_symbol
mov cl,[eax+11]
or cl,cl
jz public_constant
2678,10 → 2678,6
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
3096,10 → 3092,10
jne invalid_argument
mov ebx,[esi+8]
test byte [ebx+8],1
jz undefined_public
jz undefined_symbol
mov ax,[current_pass]
cmp ax,[ebx+16]
jne undefined_public
jne undefined_symbol
mov dl,[ebx+11]
or dl,dl
jz public_absolute
3113,10 → 3109,6
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
/programs/develop/fasm/trunk/version.inc
33,7 → 33,7
; cannot simply be copied and put under another distribution licence
; (including the GNU Public Licence).
 
VERSION_STRING equ "1.67.25"
VERSION_STRING equ "1.67.23"
 
VERSION_MAJOR = 1
VERSION_MINOR = 67
/programs/develop/fasm/trunk/variable.inc
57,7 → 57,6
undefined_data_end dd ?
counter dd ?
counter_limit dd ?
error_info dd ?
error_line dd ?
error dd ?
display_buffer dd ?
123,4 → 122,3
 
characters rb 100h
converted rb 100h
message rb 200h
/programs/develop/fasm/trunk/SYMBDUMP.INC
0,0 → 1,110
symbol_dump:
 
push edi
mov edx,[memory_end]
dump_symbols:
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
test byte [edx+8],1
jz dump_symbols ; do not dump symbols that didn't get defined
mov ax,[current_pass]
cmp ax,[edx+16]
jne dump_symbols
test byte [edx+8],4 or 2
jnz dump_symbols ; 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
 
mov al, '0'
stosb
mov al, 'x'
stosb
mov eax, [edx+4]
mov ecx, 8
@@:
rol eax, 4
test al, 0xF
loopz @b
jz .nohigh
inc ecx
@@:
push eax
and al, 0xF
cmp al, 10
sbb al, 69h
das
stosb
pop eax
rol eax, 4
loop @b
mov eax, [edx]
mov ecx, 8
jmp .low
.nohigh:
mov eax, [edx]
mov ecx, 8
@@:
rol eax, 4
test al, 0xF
loopz @b
inc ecx
.low:
push eax
and al, 0xF
cmp al, 10
sbb al, 69h
das
stosb
pop eax
rol eax, 4
loop .low
 
mov al, ' '
stosb
 
mov esi,[edx+24]
movzx ecx,byte [esi-1]
rep movsb
 
mov ax,0A0Dh
stosw
 
jmp dump_symbols
 
symbols_dumped:
mov edx,dbgfilename
push esi edi
mov esi, outfile
mov edi, edx
@@:
lodsb
stosb
test al, al
jnz @b
lea ecx, [edi-1]
@@:
dec edi
cmp edi, edx
jb @f
cmp byte [edi], '/'
jz @f
cmp byte [edi], '.'
jnz @b
mov ecx, edi
@@:
mov dword [ecx], '.dbg'
mov byte [ecx+4], 0
pop edi esi
call create
mov edx,[esp]
mov ecx,edi
sub ecx,edx
call write
call close
pop edi
 
ret
/programs/develop/fasm/trunk/errors.inc
4,168 → 4,128
; All rights reserved.
 
out_of_memory:
push _out_of_memory
jmp fatal_error
call fatal_error
db 'out of memory',0
stack_overflow:
push _stack_overflow
jmp fatal_error
call fatal_error
db 'out of stack space',0
main_file_not_found:
push _main_file_not_found
jmp fatal_error
call fatal_error
db 'source file not found',0
unexpected_end_of_file:
push _unexpected_end_of_file
jmp fatal_error
call fatal_error
db 'unexpected end of file',0
code_cannot_be_generated:
push _code_cannot_be_generated
jmp fatal_error
call fatal_error
db 'code cannot be generated',0
format_limitations_exceeded:
push _format_limitations_exceeded
jmp fatal_error
invalid_definition:
push _invalid_definition
jmp fatal_error
call fatal_error
db 'format limitations exceeded',0
write_failed:
push _write_failed
jmp fatal_error
 
call fatal_error
db 'write failed',0
file_not_found:
push _file_not_found
jmp assembler_error
call assembler_error
db 'file not found',0
error_reading_file:
push _error_reading_file
jmp assembler_error
call assembler_error
db 'error reading file',0
invalid_file_format:
push _invalid_file_format
jmp assembler_error
call assembler_error
db 'invalid file format',0
invalid_macro_arguments:
push _invalid_macro_arguments
jmp assembler_error
call assembler_error
db 'invalid macro arguments',0
incomplete_macro:
push _incomplete_macro
jmp assembler_error
call assembler_error
db 'incomplete macro',0
unexpected_characters:
push _unexpected_characters
jmp assembler_error
call assembler_error
db 'unexpected characters',0
invalid_argument:
push _invalid_argument
jmp assembler_error
call assembler_error
db 'invalid argument',0
illegal_instruction:
push _illegal_instruction
jmp assembler_error
call assembler_error
db 'illegal instruction',0
invalid_operand:
push _invalid_operand
jmp assembler_error
call assembler_error
db 'invalid operand',0
invalid_operand_size:
push _invalid_operand_size
jmp assembler_error
call assembler_error
db 'invalid size of operand',0
operand_size_not_specified:
push _operand_size_not_specified
jmp assembler_error
call assembler_error
db 'operand size not specified',0
operand_sizes_do_not_match:
push _operand_sizes_do_not_match
jmp assembler_error
call assembler_error
db 'operand sizes do not match',0
invalid_address_size:
push _invalid_address_size
jmp assembler_error
call assembler_error
db 'invalid size of address value',0
address_sizes_do_not_agree:
push _address_sizes_do_not_agree
jmp assembler_error
call assembler_error
db 'address sizes do not agree',0
prefix_conflict:
push _prefix_conflict
jmp assembler_error
call assembler_error
db 'disallowed combination of registers',0
long_immediate_not_encodable:
push _long_immediate_not_encodable
jmp assembler_error
call assembler_error
db 'not encodable with long immediate',0
relative_jump_out_of_range:
push _relative_jump_out_of_range
jmp assembler_error
call assembler_error
db 'relative jump out of range',0
invalid_expression:
push _invalid_expression
jmp assembler_error
call assembler_error
db 'invalid expression',0
invalid_address:
push _invalid_address
jmp assembler_error
call assembler_error
db 'invalid address',0
invalid_value:
push _invalid_value
jmp assembler_error
call assembler_error
db 'invalid value',0
value_out_of_range:
push _value_out_of_range
jmp assembler_error
call assembler_error
db 'value out of range',0
undefined_symbol:
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
call assembler_error
db 'undefined symbol',0
invalid_use_of_symbol:
push _invalid_use_of_symbol
jmp assembler_error
call assembler_error
db 'invalid use of symbol',0
name_too_long:
push _name_too_long
jmp assembler_error
call assembler_error
db 'name too long',0
invalid_name:
push _invalid_name
jmp assembler_error
call assembler_error
db 'invalid name',0
reserved_word_used_as_symbol:
push _reserved_word_used_as_symbol
jmp assembler_error
call assembler_error
db 'reserved word used as symbol',0
symbol_already_defined:
push _symbol_already_defined
jmp assembler_error
call assembler_error
db 'symbol already defined',0
missing_end_quote:
push _missing_end_quote
jmp assembler_error
call assembler_error
db 'missing end quote',0
missing_end_directive:
push _missing_end_directive
jmp assembler_error
call assembler_error
db 'missing end directive',0
unexpected_instruction:
push _unexpected_instruction
jmp assembler_error
call assembler_error
db 'unexpected instruction',0
extra_characters_on_line:
push _extra_characters_on_line
jmp assembler_error
call assembler_error
db 'extra characters on line',0
section_not_aligned_enough:
push _section_not_aligned_enough
jmp assembler_error
call assembler_error
db 'section is not aligned enough',0
setting_already_specified:
push _setting_already_specified
jmp assembler_error
call assembler_error
db 'setting already specified',0
data_already_defined:
push _data_already_defined
jmp assembler_error
call assembler_error
db 'data already defined',0
too_many_repeats:
push _too_many_repeats
jmp assembler_error
call assembler_error
db 'too many repeats',0
/programs/develop/fasm/trunk/preproce.inc
23,8 → 23,11
mov byte [edi+eax],0
loop mark_symbol_characters
mov edi,locals_counter
mov ax,1 + '0' shl 8
stos word [edi]
mov al,7
stos byte [edi]
movzx ecx,al
mov al,'0'
rep stos byte [edi]
mov edi,[memory_start]
mov [include_paths],edi
mov esi,include_variable
40,149 → 43,6
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
2360,25 → 2220,16
movzx ecx,byte [eax]
counter_loop:
inc byte [eax+ecx]
cmp byte [eax+ecx],'9'+1
cmp byte [eax+ecx],':'
jb counter_ok
jne letter_digit
mov byte [eax+ecx],'A'
jmp counter_ok
letter_digit:
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
cmp byte [eax+ecx],'F'
jbe 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]