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 ; flat assembler core
; Copyright (c) 1999-2011, Tomasz Grysztar. ; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved. ; All rights reserved.
assembler: assembler:
@ -1914,3 +1914,13 @@ err_directive:
or al,al or al,al
jz invoked_error jz invoked_error
jmp extra_characters_on_line 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 ; flat assembler core
; Copyright (c) 1999-2011, Tomasz Grysztar. ; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved. ; All rights reserved.
avx_single_source_pd_instruction: avx_single_source_pd_instruction:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
; flat assembler core ; flat assembler core
; Copyright (c) 1999-2011, Tomasz Grysztar. ; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved. ; All rights reserved.
_out_of_memory db 'out of memory',0 _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 _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 invoked in source file',0
_assertion_failed db 'assertion failed',0

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
; flat assembler version 1.69 ; flat assembler version 1.69
; Copyright (c) 1999-2011, Tomasz Grysztar. ; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved. ; All rights reserved.
; ;
; This programs is free for commercial and non-commercial use as long as ; 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 ; cannot simply be copied and put under another distribution licence
; (including the GNU Public Licence). ; (including the GNU Public Licence).
VERSION_STRING equ "1.69.34" VERSION_STRING equ "1.69.36"
VERSION_MAJOR = 1 VERSION_MAJOR = 1
VERSION_MINOR = 69 VERSION_MINOR = 69

View File

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