From 6d93af5eeaadcb7fd5d3f58444f505d981e68206 Mon Sep 17 00:00:00 2001 From: Tomasz Grysztar Date: Sat, 25 Nov 2017 12:44:44 +0100 Subject: [PATCH] release 1.73.01 --- FASM.TXT | 24 ++++++++- SOURCE/ASSEMBLE.INC | 98 +++++++++++++++++++++++++++++++------ SOURCE/DOS/SYSTEM.INC | 1 - SOURCE/EXPRCALC.INC | 10 ++-- SOURCE/FORMATS.INC | 5 -- SOURCE/LIBC/SYSTEM.INC | 8 ++- SOURCE/LINUX/SYSTEM.INC | 4 +- SOURCE/LINUX/X64/SYSTEM.INC | 4 +- SOURCE/VERSION.INC | 2 +- SOURCE/WIN32/SYSTEM.INC | 4 +- WHATSNEW.TXT | 9 ++++ 11 files changed, 137 insertions(+), 32 deletions(-) diff --git a/FASM.TXT b/FASM.TXT index 69319e1..d238b2d 100644 --- a/FASM.TXT +++ b/FASM.TXT @@ -5,7 +5,7 @@ Û ÜßßßßÛ ßßßßÜ Û Û Û Û ßÜÜÜÜÛÜ ÜÜÜÜÜß Û Û Û - flat assembler 1.72 + flat assembler 1.73 Programmer's Manual @@ -3673,6 +3673,15 @@ For example this code: loads the single byte from offset 10h in file "a.txt" into the "char" constant. + Instead of or in addition to an "at" argument, "virtual" can also be followed +by an "as" keyword and a string defining an extension of additional file where +the initialized content of the block is going to be stored at the end of +a successful assembly. + + virtual at 0 as 'asc' + times 256 db %-1 + end virtual + Any of the "section" directives described in 2.4 also begins a new addressing space. It is possible to declare a special kind of label that marks the current @@ -3699,6 +3708,19 @@ specify addressing space that has not been assembled yet, just as it is not allowed to specify an address in the current addressing space that exceeds the current offset. The addresses in any other addressing space are also limited by the boundaries of the block. + The "virtual" directive can have a previously definen addressing space +label as the only argument. This variant allows to extend a previously defined +and closed block with additional data. Any definition of data within +an extending block is going to have the same effect as if that definition was +present in the original "virtual" block. + + virtual at 0 as 'log' + Log:: + end virtual + + virtual Log + db 'Hello!',13,10 + end virtual 2.2.5 Other directives diff --git a/SOURCE/ASSEMBLE.INC b/SOURCE/ASSEMBLE.INC index 6112808..7ceae1c 100644 --- a/SOURCE/ASSEMBLE.INC +++ b/SOURCE/ASSEMBLE.INC @@ -643,10 +643,6 @@ load_directive: mov ax,[current_pass] mov [ebx+18],ax or byte [ebx+8],8 - cmp [symbols_file],0 - je get_addressing_space - cmp [next_pass_needed],0 - jne get_addressing_space call store_label_reference get_addressing_space: mov ebx,[ebx] @@ -893,6 +889,8 @@ times_directive: virtual_directive: lods byte [esi] + cmp al,'(' + je continue_virtual_area cmp al,80h jne virtual_at_current lods byte [esi] @@ -907,6 +905,7 @@ virtual_directive: jmp set_virtual virtual_at_current: dec esi + virtual_fallback: mov ebp,[addressing_space] mov al,[ds:ebp+9] mov [value_type],al @@ -928,17 +927,7 @@ virtual_directive: shl ecx,16 mov cx,bx push ecx eax - call allocate_structure_data - mov word [ebx],virtual_directive-instruction_handler - mov ecx,[addressing_space] - mov [ebx+12],ecx - mov [ebx+8],edi - mov ecx,[current_line] - mov [ebx+4],ecx - mov ebx,[addressing_space] - mov eax,edi - sub eax,[ebx+18h] - mov [ebx+1Ch],eax + call allocate_virtual_structure_data call init_addressing_space or byte [ebx+0Ah],1 cmp byte [esi],86h @@ -949,6 +938,7 @@ virtual_directive: add esi,3+4 add [ebx+18h],ecx mov [ebx+20h],ecx + push ebx mov ebx,characters get_extension: lods byte [esi] @@ -958,6 +948,7 @@ virtual_directive: jz invalid_argument loop get_extension inc esi + pop ebx addressing_space_extension_ok: pop eax mov cl,[address_sign] @@ -1001,6 +992,82 @@ virtual_directive: no_such_structure: stc ret + allocate_virtual_structure_data: + call allocate_structure_data + mov word [ebx],virtual_directive-instruction_handler + mov ecx,[addressing_space] + mov [ebx+12],ecx + mov [ebx+8],edi + mov ecx,[current_line] + mov [ebx+4],ecx + mov ebx,[addressing_space] + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + ret + continue_virtual_area: + cmp byte [esi],11h + jne invalid_argument + cmp byte [esi+1+4],')' + jne invalid_argument + inc esi + lods dword [esi] + inc esi + cmp eax,0Fh + jbe reserved_word_used_as_symbol + mov edx,undefined_symbol + test byte [eax+8],1 + jz virtual_area_unavailable + mov edx,symbol_out_of_scope + mov cx,[eax+16] + cmp cx,[current_pass] + jne virtual_area_unavailable + mov edx,invalid_use_of_symbol + test byte [eax+9],4 + jz virtual_area_unavailable + mov ebx,eax + mov ax,[current_pass] + mov [ebx+18],ax + or byte [ebx+8],8 + call store_label_reference + mov ebx,[ebx] + test byte [ebx+0Ah],4 + jz virtual_area_unavailable + and byte [ebx+0Ah],not 4 + mov edx,ebx + call allocate_virtual_structure_data + mov [addressing_space],edx + push esi + mov esi,[edx+18h] + mov ecx,[edx+1Ch] + mov eax,[edx+20h] + sub esi,eax + add ecx,eax + lea eax,[edi+ecx] + cmp eax,[tagged_blocks] + jae out_of_memory + mov eax,esi + sub eax,edi + sub [edx+18h],eax + sub [edx],eax + sbb dword [edx+4],0 + sbb byte [edx+8],0 + mov al,cl + shr ecx,2 + rep movs dword [edi],[esi] + mov cl,al + and cl,11b + rep movs byte [edi],[esi] + pop esi + jmp instruction_assembled + virtual_area_unavailable: + cmp [error_line],0 + jne virtual_fallback + push [current_line] + pop [error_line] + mov [error],edx + mov [error_info],eax + jmp virtual_fallback end_virtual: call find_structure_data jc unexpected_instruction @@ -1031,6 +1098,7 @@ virtual_directive: add eax,[ebx+20h] test byte [ebx+0Ah],2 jz addressing_space_closed + or byte [ebx+0Ah],4 push esi edi ecx edx mov ecx,eax mov eax,[tagged_blocks] diff --git a/SOURCE/DOS/SYSTEM.INC b/SOURCE/DOS/SYSTEM.INC index 474f14a..fe616a3 100644 --- a/SOURCE/DOS/SYSTEM.INC +++ b/SOURCE/DOS/SYSTEM.INC @@ -334,7 +334,6 @@ fatal_error: mov al,0FFh jmp exit_program assembler_error: - and [output_file],0 call display_user_messages mov ebx,[current_line] test ebx,ebx diff --git a/SOURCE/EXPRCALC.INC b/SOURCE/EXPRCALC.INC index b5418e8..d22a351 100644 --- a/SOURCE/EXPRCALC.INC +++ b/SOURCE/EXPRCALC.INC @@ -179,12 +179,7 @@ calculate_expression: got_label: test byte [ebx+9],4 jnz invalid_use_of_symbol - cmp [symbols_file],0 - je label_reference_ok - cmp [next_pass_needed],0 - jne label_reference_ok call store_label_reference - label_reference_ok: mov al,[ebx+11] mov [edi-8+12],al mov eax,[ebx+12] @@ -1011,6 +1006,10 @@ calculate_expression: mov [esi+13],bl ret store_label_reference: + cmp [symbols_file],0 + je label_reference_ok + cmp [next_pass_needed],0 + jne label_reference_ok mov eax,[tagged_blocks] mov dword [eax-4],2 mov dword [eax-8],4 @@ -1019,6 +1018,7 @@ calculate_expression: jbe out_of_memory mov [tagged_blocks],eax mov [eax],ebx + label_reference_ok: ret convert_fp: inc esi diff --git a/SOURCE/FORMATS.INC b/SOURCE/FORMATS.INC index 179e7c4..10e658d 100644 --- a/SOURCE/FORMATS.INC +++ b/SOURCE/FORMATS.INC @@ -326,14 +326,9 @@ public_directive: mov dx,[current_pass] mov [eax+18],dx or byte [eax+8],8 - cmp [symbols_file],0 - je public_reference_ok - cmp [next_pass_needed],0 - jne public_reference_ok mov ebx,eax call store_label_reference mov eax,ebx - public_reference_ok: mov ebx,[free_additional_memory] lea edx,[ebx+10h] cmp edx,[structures_buffer] diff --git a/SOURCE/LIBC/SYSTEM.INC b/SOURCE/LIBC/SYSTEM.INC index 4f64666..f16f92a 100644 --- a/SOURCE/LIBC/SYSTEM.INC +++ b/SOURCE/LIBC/SYSTEM.INC @@ -131,9 +131,16 @@ lseek: push ebx movzx eax,al ccall fseek,ebx,edx,eax + test eax,eax + jnz lseek_error mov ebx,[esp] ccall ftell,ebx pop ebx + clc + ret + lseek_error: + pop ebx + stc ret display_string: @@ -220,7 +227,6 @@ fatal_error: jmp exit_program assembler_error: mov [con_handle],2 - and [output_file],0 call display_user_messages mov ebx,[current_line] test ebx,ebx diff --git a/SOURCE/LINUX/SYSTEM.INC b/SOURCE/LINUX/SYSTEM.INC index 53cba01..eec75fd 100644 --- a/SOURCE/LINUX/SYSTEM.INC +++ b/SOURCE/LINUX/SYSTEM.INC @@ -186,6 +186,9 @@ lseek: mov dl,al mov eax,19 int 0x80 + cmp eax,-1 + je file_error + clc ret display_string: @@ -284,7 +287,6 @@ fatal_error: jmp exit_program assembler_error: mov [con_handle],2 - and [output_file],0 call display_user_messages mov ebx,[current_line] test ebx,ebx diff --git a/SOURCE/LINUX/X64/SYSTEM.INC b/SOURCE/LINUX/X64/SYSTEM.INC index 1344afc..fe7b60d 100644 --- a/SOURCE/LINUX/X64/SYSTEM.INC +++ b/SOURCE/LINUX/X64/SYSTEM.INC @@ -220,6 +220,9 @@ lseek: syscall mov esi,r12d mov edi,r13d + cmp eax,-1 + je file_error + clc ret display_string: @@ -318,7 +321,6 @@ fatal_error: jmp exit_program assembler_error: mov [con_handle],2 - and [output_file],0 call display_user_messages mov ebx,[current_line] test ebx,ebx diff --git a/SOURCE/VERSION.INC b/SOURCE/VERSION.INC index fa763f7..dff0843 100644 --- a/SOURCE/VERSION.INC +++ b/SOURCE/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.73.00" +VERSION_STRING equ "1.73.01" VERSION_MAJOR = 1 VERSION_MINOR = 73 diff --git a/SOURCE/WIN32/SYSTEM.INC b/SOURCE/WIN32/SYSTEM.INC index 04849cb..6d519c0 100644 --- a/SOURCE/WIN32/SYSTEM.INC +++ b/SOURCE/WIN32/SYSTEM.INC @@ -187,6 +187,9 @@ lseek: push edx push ebx call [SetFilePointer] + cmp eax,-1 + je file_error + clc ret display_string: @@ -314,7 +317,6 @@ fatal_error: jmp exit_program assembler_error: mov [con_handle],STD_ERROR_HANDLE - and [output_file],0 call display_user_messages mov ebx,[current_line] test ebx,ebx diff --git a/WHATSNEW.TXT b/WHATSNEW.TXT index a91e937..95b5ebc 100644 --- a/WHATSNEW.TXT +++ b/WHATSNEW.TXT @@ -2,6 +2,15 @@ Visit http://flatassembler.net/ for more information. +version 1.73.01 (Nov 25, 2017) + +[+] Added virtual block continuation syntax (backported from flat assembler g). + +[+] Documentation update. + +[-] Fixed a bug in addressing data of the "virtual as" block. + + version 1.73.00 (Nov 24, 2017) [+] Added "virtual as" syntax (backported from flat assembler g).