git-svn-id: svn://kolibrios.org@2664 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Ivan Baravy 2012-05-20 11:47:06 +00:00
parent 90139378de
commit 96a29bfdda
16 changed files with 2350 additions and 2272 deletions

View File

@ -1,6 +1,6 @@
; flat assembler core
; Copyright (c) 1999-2011, Tomasz Grysztar.
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
assembler:
@ -1914,3 +1914,13 @@ err_directive:
or al,al
jz invoked_error
jmp extra_characters_on_line
assert_directive:
call calculate_logical_expression
or al,al
jnz instruction_assembled
cmp [error_line],0
jne instruction_assembled
mov eax,[current_line]
mov [error_line],eax
mov [error],assertion_failed
jmp instruction_assembled

View File

@ -1,6 +1,6 @@
; flat assembler core
; Copyright (c) 1999-2011, Tomasz Grysztar.
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
avx_single_source_pd_instruction:

View File

@ -1,6 +1,6 @@
; flat assembler core
; Copyright (c) 1999-2011, Tomasz Grysztar.
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
out_of_memory:
@ -178,6 +178,9 @@ data_already_defined:
too_many_repeats:
push _too_many_repeats
jmp error_with_source
assertion_failed:
push _assertion_failed
jmp error_with_source
invoked_error:
push _invoked_error
error_with_source:

View File

@ -1,6 +1,6 @@
; flat assembler core
; Copyright (c) 1999-2011, Tomasz Grysztar.
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
calculate_expression:

View File

@ -1,6 +1,6 @@
; flat assembler core
; Copyright (c) 1999-2011, Tomasz Grysztar.
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
convert_expression:
@ -15,6 +15,8 @@ convert_expression:
pop edi
or al,al
jz expression_element
cmp al,82h
je expression_loop
push eax
jmp expression_loop
expression_element:
@ -391,8 +393,12 @@ get_number:
xor edx,edx
mov cl,bl
dec esi
cmp bl,64
jae oct_out_of_range
cmp bl,63
ja oct_out_of_range
jne oct_range_ok
cmp al,1
ja oct_out_of_range
oct_range_ok:
add bl,3
cmp cl,30
je oct_digit_wrap

View File

@ -1,7 +1,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; flat assembler source ;;
;; Copyright (c) 1999-2006, Tomasz Grysztar ;;
;; Copyright (c) 1999-2012, Tomasz Grysztar ;;
;; All rights reserved. ;;
;; ;;
;; KolibriOS port by KolibriOS Team ;;

View File

@ -1,6 +1,6 @@
; flat assembler core
; Copyright (c) 1999-2011, Tomasz Grysztar.
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
formatter:

View File

@ -1,6 +1,6 @@
; flat assembler core
; Copyright (c) 1999-2011, Tomasz Grysztar.
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
_out_of_memory db 'out of memory',0
@ -49,3 +49,4 @@ _setting_already_specified db 'setting already specified',0
_data_already_defined db 'data already defined',0
_too_many_repeats db 'too many repeats',0
_invoked_error db 'error directive invoked in source file',0
_assertion_failed db 'assertion failed',0

View File

@ -1,6 +1,6 @@
; flat assembler core
; Copyright (c) 1999-2011, Tomasz Grysztar.
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
parser:
@ -115,6 +115,8 @@ parser:
je parse_end_directive
cmp bx,else_directive-instruction_handler
je parse_else
cmp bx,assert_directive-instruction_handler
je parse_assert
common_parse:
call parse_line_contents
jmp parse_next_line
@ -278,6 +280,19 @@ parser:
mov al,dl
stos byte [edi]
jmp parse_if
parse_assert:
push edi
call parse_line_contents
xor al,al
stos byte [edi]
xchg esi,[esp]
mov edi,esi
call preevaluate_logical_expression
pop esi
or al,al
jz parse_next_line
stos byte [edi]
jmp parse_next_line
skip_true_condition_else:
sub edi,4
or byte [esp],1

View File

@ -1,6 +1,6 @@
; flat assembler core
; Copyright (c) 1999-2011, Tomasz Grysztar.
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
preprocessor:
@ -826,7 +826,7 @@ define_macro:
mov [macro_status],al
mov eax,[current_line]
mov [error_line],eax
xor bl,bl
xor ebp,ebp
lods byte [esi]
or al,al
jz line_preprocessed
@ -839,7 +839,7 @@ define_macro:
je skip_macro_argument
cmp al,'['
jne invalid_macro_arguments
xor bl,-1
or ebp,-1
jz invalid_macro_arguments
lods byte [esi]
cmp al,1Ah
@ -849,6 +849,8 @@ define_macro:
inc esi
add esi,eax
lods byte [esi]
cmp al,'='
je macro_argument_with_default_value
cmp al,'*'
jne macro_argument_end
lods byte [esi]
@ -858,15 +860,85 @@ define_macro:
cmp al,']'
jne end_macro_arguments
lods byte [esi]
not bl
not ebp
end_macro_arguments:
or bl,bl
or ebp,ebp
jnz invalid_macro_arguments
or al,al
jz line_preprocessed
cmp al,'{'
je found_macro_block
jmp invalid_macro_arguments
macro_argument_with_default_value:
call skip_macro_argument_value
inc esi
jmp macro_argument_end
skip_macro_argument_value:
cmp byte [esi],'<'
jne simple_argument
mov ecx,1
inc esi
enclosed_argument:
lods byte [esi]
or al,al
jz invalid_macro_arguments
cmp al,1Ah
je enclosed_symbol
cmp al,22h
je enclosed_string
cmp al,'>'
je enclosed_argument_end
cmp al,'<'
jne enclosed_argument
inc ecx
jmp enclosed_argument
enclosed_symbol:
movzx eax,byte [esi]
inc esi
add esi,eax
jmp enclosed_argument
enclosed_string:
lods dword [esi]
add esi,eax
jmp enclosed_argument
enclosed_argument_end:
loop enclosed_argument
lods byte [esi]
or al,al
jz argument_value_end
cmp al,','
je argument_value_end
or ebp,ebp
jz invalid_macro_arguments
cmp al,']'
je argument_value_end
jmp invalid_macro_arguments
simple_argument:
lods byte [esi]
or al,al
jz argument_value_end
cmp al,','
je argument_value_end
cmp al,22h
je argument_string
cmp al,1Ah
je argument_symbol
or ebp,ebp
jz simple_argument
cmp al,']'
je argument_value_end
argument_symbol:
movzx eax,byte [esi]
inc esi
add esi,eax
jmp simple_argument
argument_string:
lods dword [esi]
add esi,eax
jmp simple_argument
argument_value_end:
dec esi
ret
find_macro_block:
add esi,2
lods byte [esi]
@ -1386,6 +1458,7 @@ use_macro:
mov eax,[edx+12]
mov [macro_line],eax
mov [counter_limit],0
xor ebp,ebp
process_macro_arguments:
mov al,[esi]
or al,al
@ -1427,73 +1500,14 @@ use_macro:
add esi,ecx
xchg esi,ebx
mov [edx+12],esi
cmp byte [esi],'<'
jne simple_argument
inc esi
mov [edx+12],esi
mov ecx,1
enclosed_argument:
lods byte [esi]
or al,al
jz invalid_macro_arguments
cmp al,1Ah
je enclosed_symbol
cmp al,22h
je enclosed_string
cmp al,'>'
je enclosed_argument_end
cmp al,'<'
jne enclosed_argument
inc ecx
jmp enclosed_argument
enclosed_symbol:
movzx eax,byte [esi]
inc esi
add esi,eax
jmp enclosed_argument
enclosed_string:
lods dword [esi]
add esi,eax
jmp enclosed_argument
enclosed_argument_end:
loop enclosed_argument
mov al,[esi]
or al,al
jz enclosed_argument_ok
cmp al,','
jne invalid_macro_arguments
enclosed_argument_ok:
mov eax,esi
sub eax,[edx+12]
dec eax
or eax,80000000h
mov [edx+8],eax
jmp argument_value_ok
simple_argument:
lods byte [esi]
or al,al
jz argument_value_end
cmp al,','
je argument_value_end
cmp al,22h
je argument_string
cmp al,1Ah
jne simple_argument
movzx eax,byte [esi]
inc esi
add esi,eax
jmp simple_argument
argument_string:
lods dword [esi]
add esi,eax
jmp simple_argument
argument_value_end:
dec esi
mov eax,esi
sub eax,[edx+12]
mov [edx+8],eax
argument_value_ok:
push ebp
xor ebp,ebp
call skip_macro_argument_value
pop ebp
call finish_macro_argument
xchg esi,ebx
cmp byte [esi],'='
je argument_with_default_value
cmp byte [esi],'*'
jne macro_argument_ok
cmp dword [edx+8],0
@ -1501,6 +1515,27 @@ use_macro:
inc esi
macro_argument_ok:
ret
finish_macro_argument:
mov eax,[edx+12]
mov ecx,esi
sub ecx,eax
cmp byte [eax],'<'
jne argument_value_length_ok
inc dword [edx+12]
sub ecx,2
argument_value_length_ok:
mov [edx+8],ecx
ret
argument_with_default_value:
inc esi
push esi
call skip_macro_argument_value
pop eax
cmp dword [edx+8],0
jne macro_argument_ok
mov [edx+12],eax
call finish_macro_argument
jmp macro_argument_ok
arguments_end:
cmp byte [ebx],0
jne invalid_macro_arguments
@ -1619,6 +1654,8 @@ do_irp:
lods byte [esi]
cmp [base_code],1
ja irps_name_ok
cmp al,'='
je irp_with_default_value
cmp al,'*'
jne irp_name_ok
lods byte [esi]
@ -1626,6 +1663,10 @@ do_irp:
cmp al,','
jne invalid_macro_arguments
jmp irp_parameters_start
irp_with_default_value:
xor ebp,ebp
call skip_macro_argument_value
inc esi
irps_name_ok:
cmp al,','
jne invalid_macro_arguments

View File

@ -1,6 +1,6 @@
; flat assembler core
; Copyright (c) 1999-2011, Tomasz Grysztar.
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
dump_symbols:

View File

@ -1,5 +1,5 @@
; flat assembler
; Copyright (c) 1999-2007, Tomasz Grysztar
; Copyright (c) 1999-2012, Tomasz Grysztar
; All rights reserved.
struc FILEIO

View File

@ -1,6 +1,6 @@
; flat assembler core
; Copyright (c) 1999-2011, Tomasz Grysztar.
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
include_variable db 'INCLUDE',0
@ -58,8 +58,8 @@ operators:
db 0
single_operand_operators:
db 1,'+',0
db 1,'-',083h
db 1,'+',82h
db 1,'-',83h
db 3,'not',0D0h
db 3,'plt',0E1h
db 3,'rva',0E0h
@ -1265,6 +1265,8 @@ instructions_6:
dw sse_pd_instruction-instruction_handler
db 'andnps',55h
dw sse_ps_instruction-instruction_handler
db 'assert',0
dw assert_directive-instruction_handler
db 'cmovae',43h
dw cmov_instruction-instruction_handler
db 'cmovbe',46h

View File

@ -1,6 +1,6 @@
; flat assembler core variables
; Copyright (c) 1999-2011, Tomasz Grysztar.
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
; Variables which have to be set up by interface:

View File

@ -1,6 +1,6 @@
; flat assembler version 1.69
; Copyright (c) 1999-2011, Tomasz Grysztar.
; Copyright (c) 1999-2012, 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.69.34"
VERSION_STRING equ "1.69.36"
VERSION_MAJOR = 1
VERSION_MINOR = 69

View File

@ -1,6 +1,6 @@
; flat assembler core
; Copyright (c) 1999-2011, Tomasz Grysztar.
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
simple_instruction_except64: