From 3a022d444158114bd89d021dcbc943e5e7b13d91 Mon Sep 17 00:00:00 2001 From: heavyiron Date: Thu, 21 Dec 2006 06:34:09 +0000 Subject: [PATCH] fasm 1.67.17 tinypad - fixed link to fasm (/rd/1/develop/fasm) git-svn-id: svn://kolibrios.org@242 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/fasm/trunk/assemble.inc | 2 + programs/develop/fasm/trunk/expressi.inc | 89 ++++++++++++++++------ programs/develop/fasm/trunk/parser.inc | 11 ++- programs/develop/fasm/trunk/preproce.inc | 27 ++++++- programs/develop/fasm/trunk/variable.inc | 3 + programs/develop/fasm/trunk/version.inc | 2 +- programs/develop/tinypad/trunk/tinypad.asm | 2 +- 7 files changed, 107 insertions(+), 29 deletions(-) diff --git a/programs/develop/fasm/trunk/assemble.inc b/programs/develop/fasm/trunk/assemble.inc index 0c1e36d3c0..60db5bd2a4 100644 --- a/programs/develop/fasm/trunk/assemble.inc +++ b/programs/develop/fasm/trunk/assemble.inc @@ -618,6 +618,7 @@ load_directive: load_from_code: cmp byte [esi],'.' je invalid_value + or [size_override],-1 call get_address_value call calculate_relative_offset push esi edi @@ -676,6 +677,7 @@ store_directive: jne invalid_argument cmp byte [esi],'.' je invalid_value + or [size_override],-1 call get_address_value call calculate_relative_offset push esi edi diff --git a/programs/develop/fasm/trunk/expressi.inc b/programs/develop/fasm/trunk/expressi.inc index 9e0b387acf..5cf3b0d472 100644 --- a/programs/develop/fasm/trunk/expressi.inc +++ b/programs/develop/fasm/trunk/expressi.inc @@ -180,7 +180,7 @@ get_number: cmp byte [ebx],'$' je pascal_hex_number cmp word [ebx],'0x' - je c_hex_number + je get_hex_number mov al,[esi] dec esi cmp al,'h' @@ -279,9 +279,6 @@ get_number: jz get_bin_digit or ebp,-1 jmp get_bin_digit - c_hex_number: - cmp cl,2 - je bad_number pascal_hex_number: cmp cl,1 je bad_number @@ -1270,6 +1267,9 @@ calculate_expression: cmp ah,dl jne value_out_of_range mov [esi+10],al + or al,al + jnz mul_first_register_ok + mov [esi+8],al mul_first_register_ok: cmp byte [esi+9],0 je mul_calculated @@ -1287,6 +1287,9 @@ calculate_expression: cmp ah,dl jne value_out_of_range mov [esi+11],al + or al,al + jnz mul_calculated + mov [esi+9],al mul_calculated: pop esi jmp calculation_loop @@ -2175,6 +2178,9 @@ calculate_relative_offset: ret preevaluate_logical_expression: + xor al,al + preevaluate_embedded_logical_expression: + mov [logical_value_wrapping],al push edi call preevaluate_logical_value preevaluation_loop: @@ -2254,7 +2260,7 @@ preevaluate_logical_expression: mov al,0FFh stos byte [edi] ret -skip_logical_value: + skip_logical_value: cmp byte [esi],'~' jne negation_skipped inc esi @@ -2263,6 +2269,8 @@ skip_logical_value: cmp byte [esi],'{' jne skip_simple_logical_value inc esi + xchg al,[logical_value_wrapping] + push eax skip_logical_expression: call skip_logical_value lods byte [esi] @@ -2275,29 +2283,42 @@ skip_logical_value: cmp al,'&' je skip_logical_expression cmp al,'}' - je logical_value_skipped + jne wrongly_structured_logical_expression + pop eax + mov [logical_value_wrapping],al + logical_value_skipped: + clc + ret wrongly_structured_logical_expression: stc ret skip_simple_logical_value: + mov [logical_value_parentheses],0 + find_simple_logical_value_end: mov al,[esi] or al,al jz logical_value_skipped cmp al,0Fh je logical_value_skipped - cmp al,'}' - je logical_value_skipped cmp al,'|' je logical_value_skipped cmp al,'&' je logical_value_skipped + cmp al,'{' + je skip_logical_value_internal_parenthesis + cmp al,'}' + jne skip_logical_value_symbol + sub [logical_value_parentheses],1 + jnc skip_logical_value_symbol + cmp [logical_value_wrapping],al + jne skip_logical_value_symbol + jmp logical_value_skipped + skip_logical_value_internal_parenthesis: + inc [logical_value_parentheses] + skip_logical_value_symbol: call skip_symbol - jmp skip_simple_logical_value - logical_value_skipped: - clc - ret - -preevaluate_logical_value: + jmp find_simple_logical_value_end + preevaluate_logical_value: mov ebp,edi preevaluate_negation: cmp byte [esi],'~' @@ -2306,12 +2327,16 @@ preevaluate_logical_value: jmp preevaluate_negation preevaluate_negation_ok: mov ebx,esi - xor edx,edx cmp byte [esi],'{' - jne find_logical_value_boundaries - movs byte [edi],[esi] + jne preevaluate_simple_logical_value + lods byte [esi] + stos byte [edi] push ebp - call preevaluate_logical_expression + mov dl,[logical_value_wrapping] + push edx + call preevaluate_embedded_logical_expression + pop edx + mov [logical_value_wrapping],dl pop ebp cmp al,0FFh je invalid_logical_value @@ -2335,12 +2360,17 @@ preevaluate_logical_value: mov edi,ebp mov al,0FFh ret + preevaluate_simple_logical_value: + xor edx,edx + mov [logical_value_parentheses],edx find_logical_value_boundaries: mov al,[esi] or al,al jz logical_value_boundaries_found + cmp al,'{' + je logical_value_internal_parentheses cmp al,'}' - je logical_value_boundaries_found + je logical_value_boundaries_parenthesis_close cmp al,'|' je logical_value_boundaries_found cmp al,'&' @@ -2358,6 +2388,14 @@ preevaluate_logical_value: next_symbol_in_logical_value: call skip_symbol jmp find_logical_value_boundaries + logical_value_internal_parentheses: + inc [logical_value_parentheses] + jmp next_symbol_in_logical_value + logical_value_boundaries_parenthesis_close: + sub [logical_value_parentheses],1 + jnc next_symbol_in_logical_value + cmp [logical_value_wrapping],'{' + jne next_symbol_in_logical_value logical_value_boundaries_found: or edx,edx jz non_preevaluable_logical_value @@ -2506,6 +2544,9 @@ preevaluate_logical_value: jmp invalid_logical_value calculate_logical_expression: + xor al,al + calculate_embedded_logical_expression: + mov [logical_value_wrapping],al call get_logical_value logical_loop: cmp byte [esi],'|' @@ -2537,7 +2578,7 @@ calculate_logical_expression: jc invalid_expression pop eax jmp logical_loop -get_logical_value: + get_logical_value: xor al,al check_for_negation: cmp byte [esi],'~' @@ -2748,8 +2789,12 @@ get_logical_value: or al,-1 jmp logical_value_ok logical_expression: - inc esi - call calculate_logical_expression + lods byte [esi] + mov dl,[logical_value_wrapping] + push edx + call calculate_embedded_logical_expression + pop edx + mov [logical_value_wrapping],dl push eax lods byte [esi] cmp al,'}' diff --git a/programs/develop/fasm/trunk/parser.inc b/programs/develop/fasm/trunk/parser.inc index bfba2427aa..f03130a4eb 100644 --- a/programs/develop/fasm/trunk/parser.inc +++ b/programs/develop/fasm/trunk/parser.inc @@ -14,6 +14,7 @@ parser: mov [anonymous_forward],eax mov [hash_tree],eax mov [blocks_stack],eax + mov [parsed_lines],eax mov esi,[memory_start] mov edi,[source_start] parser_loop: @@ -27,6 +28,7 @@ parser: stos byte [edi] mov eax,esi stos dword [edi] + inc [parsed_lines] add esi,16 parse_line: cmp byte [esi],1Ah @@ -410,6 +412,7 @@ parser: stos byte [edi] mov eax,[current_line] stos dword [edi] + inc [parsed_lines] mov eax,1 + (end_directive-assembler) shl 8 stos dword [edi] mov eax,1 + (if_directive-assembler) shl 8 @@ -446,6 +449,7 @@ parser: stos byte [edi] mov eax,[current_line] stos dword [edi] + inc [parsed_lines] parse_else_if: mov eax,1 + (if_directive-assembler) shl 8 stos dword [edi] @@ -898,7 +902,12 @@ parse_line_contents: jmp expression contents_parsed: cmp [parenthesis_stack],0 - jne invalid_expression +; jne invalid_expression + je contents_ok + dec [parenthesis_stack] + add esp,8 + jmp contents_parsed + contents_ok: ret identify_label: diff --git a/programs/develop/fasm/trunk/preproce.inc b/programs/develop/fasm/trunk/preproce.inc index 7710f0556d..bedbe62492 100644 --- a/programs/develop/fasm/trunk/preproce.inc +++ b/programs/develop/fasm/trunk/preproce.inc @@ -1198,6 +1198,12 @@ process_macro_operators: lods word [esi] movzx ecx,ah lea ebx,[edi+3] + jecxz convert_to_quoted_string + cmp byte [esi],'\' + jne convert_to_quoted_string + inc esi + dec ecx + dec ebx jmp convert_to_quoted_string symbol_character_conversion: cmp al,22h @@ -1260,14 +1266,21 @@ process_macro_operators: movzx ecx,al jecxz do_symbol_concatenation cmp byte [esi],'\' - jne do_symbol_concatenation - sub esi,2 - jmp no_concatenation + je concatenate_escaped_symbol do_symbol_concatenation: - add [ebx],al + add [ebx],cl jc name_too_long rep movs byte [edi],[esi] jmp after_macro_operators + concatenate_escaped_symbol: + inc esi + dec ecx + jz do_symbol_concatenation + movzx eax,byte [esi] + cmp byte [characters+eax],0 + jne do_symbol_concatenation + sub esi,3 + jmp no_concatenation string_concatenation: cmp byte [esi],22h je do_string_concatenation @@ -1285,6 +1298,12 @@ process_macro_operators: inc esi lods byte [esi] movzx ecx,al + jecxz finish_concatenating_converted_symbol + cmp byte [esi],'\' + jne finish_concatenating_converted_symbol + inc esi + dec ecx + finish_concatenating_converted_symbol: add [ebx],ecx rep movs byte [edi],[esi] jmp after_macro_operators diff --git a/programs/develop/fasm/trunk/variable.inc b/programs/develop/fasm/trunk/variable.inc index 5997a413e2..b6194b13b4 100644 --- a/programs/develop/fasm/trunk/variable.inc +++ b/programs/develop/fasm/trunk/variable.inc @@ -86,6 +86,8 @@ resource_data dd ? resource_size dd ? parenthesis_stack dd ? blocks_stack dd ? +parsed_lines dd ? +logical_value_parentheses dd ? next_pass_needed db ? macro_status db ? @@ -115,6 +117,7 @@ push_size db ? operand_prefix db ? rex_prefix db ? immediate_size db ? +logical_value_wrapping db ? characters rb 100h converted rb 100h diff --git a/programs/develop/fasm/trunk/version.inc b/programs/develop/fasm/trunk/version.inc index e249cdcb62..f43d7fc876 100644 --- a/programs/develop/fasm/trunk/version.inc +++ b/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.16" +VERSION_STRING equ "1.67.17" VERSION_MAJOR = 1 VERSION_MINOR = 67 diff --git a/programs/develop/tinypad/trunk/tinypad.asm b/programs/develop/tinypad/trunk/tinypad.asm index 9e8943c465..5a9128567a 100644 --- a/programs/develop/tinypad/trunk/tinypad.asm +++ b/programs/develop/tinypad/trunk/tinypad.asm @@ -646,7 +646,7 @@ fasm_start: dd fasm_parameters dd 0 dd 0 - db '/RD/1/FASM',0 + db '/RD/1/DEVELOP/FASM',0 board_start: dd 7 dd 0