forked from KolibriOS/kolibrios
fasm 1.71.13, proc32.inc and struct.inc from fasm 1.71.13
git-svn-id: svn://kolibrios.org@4039 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
b7c730f2b9
commit
53cca077c5
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
; flat assembler core
|
; flat assembler core
|
||||||
; Copyright (c) 1999-2012, Tomasz Grysztar.
|
; Copyright (c) 1999-2013, Tomasz Grysztar.
|
||||||
; All rights reserved.
|
; All rights reserved.
|
||||||
|
|
||||||
assembler:
|
assembler:
|
||||||
@ -12,7 +12,7 @@ assembler:
|
|||||||
mov [actual_fixups_size],eax
|
mov [actual_fixups_size],eax
|
||||||
assembler_loop:
|
assembler_loop:
|
||||||
mov eax,[labels_list]
|
mov eax,[labels_list]
|
||||||
mov [display_buffer],eax
|
mov [tagged_blocks],eax
|
||||||
mov eax,[additional_memory]
|
mov eax,[additional_memory]
|
||||||
mov [free_additional_memory],eax
|
mov [free_additional_memory],eax
|
||||||
mov eax,[additional_memory_end]
|
mov eax,[additional_memory_end]
|
||||||
@ -22,11 +22,7 @@ assembler:
|
|||||||
xor eax,eax
|
xor eax,eax
|
||||||
mov dword [adjustment],eax
|
mov dword [adjustment],eax
|
||||||
mov dword [adjustment+4],eax
|
mov dword [adjustment+4],eax
|
||||||
mov dword [org_origin],edi
|
mov [addressing_space],eax
|
||||||
mov dword [org_origin+4],eax
|
|
||||||
mov [org_start],edi
|
|
||||||
mov [org_registers],eax
|
|
||||||
mov [org_symbol],eax
|
|
||||||
mov [error_line],eax
|
mov [error_line],eax
|
||||||
mov [counter],eax
|
mov [counter],eax
|
||||||
mov [format_flags],eax
|
mov [format_flags],eax
|
||||||
@ -35,18 +31,16 @@ assembler:
|
|||||||
mov [file_extension],eax
|
mov [file_extension],eax
|
||||||
mov [next_pass_needed],al
|
mov [next_pass_needed],al
|
||||||
mov [output_format],al
|
mov [output_format],al
|
||||||
mov [org_origin_sign],al
|
|
||||||
mov [adjustment_sign],al
|
mov [adjustment_sign],al
|
||||||
mov [labels_type],al
|
|
||||||
mov [virtual_data],al
|
|
||||||
mov [code_type],16
|
mov [code_type],16
|
||||||
|
call init_addressing_space
|
||||||
pass_loop:
|
pass_loop:
|
||||||
call assemble_line
|
call assemble_line
|
||||||
jnc pass_loop
|
jnc pass_loop
|
||||||
mov eax,[additional_memory_end]
|
mov eax,[additional_memory_end]
|
||||||
cmp eax,[structures_buffer]
|
cmp eax,[structures_buffer]
|
||||||
je pass_done
|
je pass_done
|
||||||
sub eax,20h
|
sub eax,18h
|
||||||
mov eax,[eax+4]
|
mov eax,[eax+4]
|
||||||
mov [current_line],eax
|
mov [current_line],eax
|
||||||
jmp missing_end_directive
|
jmp missing_end_directive
|
||||||
@ -141,8 +135,36 @@ assembler:
|
|||||||
assemble_ok:
|
assemble_ok:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
create_addressing_space:
|
||||||
|
mov ebx,[addressing_space]
|
||||||
|
test ebx,ebx
|
||||||
|
jz init_addressing_space
|
||||||
|
test byte [ebx+0Ah],1
|
||||||
|
jnz illegal_instruction
|
||||||
|
mov eax,edi
|
||||||
|
sub eax,[ebx+18h]
|
||||||
|
mov [ebx+1Ch],eax
|
||||||
|
init_addressing_space:
|
||||||
|
mov ebx,[tagged_blocks]
|
||||||
|
mov dword [ebx-4],10h
|
||||||
|
mov dword [ebx-8],20h
|
||||||
|
sub ebx,8+20h
|
||||||
|
cmp ebx,edi
|
||||||
|
jbe out_of_memory
|
||||||
|
mov [tagged_blocks],ebx
|
||||||
|
mov [addressing_space],ebx
|
||||||
|
xor eax,eax
|
||||||
|
mov [ebx],edi
|
||||||
|
mov [ebx+4],eax
|
||||||
|
mov [ebx+8],eax
|
||||||
|
mov [ebx+10h],eax
|
||||||
|
mov [ebx+14h],eax
|
||||||
|
mov [ebx+18h],edi
|
||||||
|
mov [ebx+1Ch],eax
|
||||||
|
ret
|
||||||
|
|
||||||
assemble_line:
|
assemble_line:
|
||||||
mov eax,[display_buffer]
|
mov eax,[tagged_blocks]
|
||||||
sub eax,100h
|
sub eax,100h
|
||||||
cmp edi,eax
|
cmp edi,eax
|
||||||
ja out_of_memory
|
ja out_of_memory
|
||||||
@ -153,6 +175,8 @@ assemble_line:
|
|||||||
cmp al,3
|
cmp al,3
|
||||||
jb define_label
|
jb define_label
|
||||||
je define_constant
|
je define_constant
|
||||||
|
cmp al,4
|
||||||
|
je label_addressing_space
|
||||||
cmp al,0Fh
|
cmp al,0Fh
|
||||||
je new_line
|
je new_line
|
||||||
cmp al,13h
|
cmp al,13h
|
||||||
@ -164,7 +188,7 @@ assemble_line:
|
|||||||
code_type_setting:
|
code_type_setting:
|
||||||
lods byte [esi]
|
lods byte [esi]
|
||||||
mov [code_type],al
|
mov [code_type],al
|
||||||
jmp line_assembled
|
jmp instruction_assembled
|
||||||
new_line:
|
new_line:
|
||||||
lods dword [esi]
|
lods dword [esi]
|
||||||
mov [current_line],eax
|
mov [current_line],eax
|
||||||
@ -173,30 +197,19 @@ assemble_line:
|
|||||||
je continue_line
|
je continue_line
|
||||||
cmp [next_pass_needed],0
|
cmp [next_pass_needed],0
|
||||||
jne continue_line
|
jne continue_line
|
||||||
mov ebx,[display_buffer]
|
mov ebx,[tagged_blocks]
|
||||||
mov dword [ebx-4],1
|
mov dword [ebx-4],1
|
||||||
mov dword [ebx-8],1Ch
|
mov dword [ebx-8],14h
|
||||||
sub ebx,8+1Ch
|
sub ebx,8+14h
|
||||||
cmp ebx,edi
|
cmp ebx,edi
|
||||||
jbe out_of_memory
|
jbe out_of_memory
|
||||||
mov [display_buffer],ebx
|
mov [tagged_blocks],ebx
|
||||||
mov [ebx],eax
|
mov [ebx],eax
|
||||||
mov [ebx+4],edi
|
mov [ebx+4],edi
|
||||||
mov eax,dword [org_origin]
|
mov eax,[addressing_space]
|
||||||
mov edx,dword [org_origin+4]
|
|
||||||
mov ecx,[org_registers]
|
|
||||||
mov [ebx+8],eax
|
mov [ebx+8],eax
|
||||||
mov [ebx+8+4],edx
|
mov al,[code_type]
|
||||||
mov [ebx+10h],ecx
|
mov [ebx+10h],al
|
||||||
mov edx,[org_symbol]
|
|
||||||
; mov al,[virtual_data]
|
|
||||||
; mov ah,[org_origin_sign]
|
|
||||||
; shl eax,16
|
|
||||||
; mov al,[labels_type]
|
|
||||||
; mov ah,[code_type]
|
|
||||||
mov eax,dword [labels_type]
|
|
||||||
mov [ebx+14h],edx
|
|
||||||
mov [ebx+18h],eax
|
|
||||||
continue_line:
|
continue_line:
|
||||||
cmp byte [esi],0Fh
|
cmp byte [esi],0Fh
|
||||||
je line_assembled
|
je line_assembled
|
||||||
@ -215,15 +228,16 @@ assemble_line:
|
|||||||
mov eax,edi
|
mov eax,edi
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
xor cl,cl
|
xor cl,cl
|
||||||
sub eax,dword [org_origin]
|
mov ebp,[addressing_space]
|
||||||
sbb edx,dword [org_origin+4]
|
sub eax,[ds:ebp]
|
||||||
sbb cl,[org_origin_sign]
|
sbb edx,[ds:ebp+4]
|
||||||
|
sbb cl,[ds:ebp+8]
|
||||||
jp label_value_ok
|
jp label_value_ok
|
||||||
call recoverable_overflow
|
call recoverable_overflow
|
||||||
label_value_ok:
|
label_value_ok:
|
||||||
mov [address_sign],cl
|
mov [address_sign],cl
|
||||||
cmp [virtual_data],0
|
test byte [ds:ebp+0Ah],1
|
||||||
jne make_virtual_label
|
jnz make_virtual_label
|
||||||
or byte [ebx+9],1
|
or byte [ebx+9],1
|
||||||
xchg eax,[ebx]
|
xchg eax,[ebx]
|
||||||
xchg edx,[ebx+4]
|
xchg edx,[ebx+4]
|
||||||
@ -251,10 +265,11 @@ assemble_line:
|
|||||||
setne al
|
setne al
|
||||||
or ah,al
|
or ah,al
|
||||||
finish_label:
|
finish_label:
|
||||||
mov ch,[labels_type]
|
mov ebp,[addressing_space]
|
||||||
|
mov ch,[ds:ebp+9]
|
||||||
mov cl,[label_size]
|
mov cl,[label_size]
|
||||||
mov ebp,[org_registers]
|
mov edx,[ds:ebp+14h]
|
||||||
mov edx,[org_symbol]
|
mov ebp,[ds:ebp+10h]
|
||||||
finish_label_symbol:
|
finish_label_symbol:
|
||||||
mov al,[address_sign]
|
mov al,[address_sign]
|
||||||
xor al,[ebx+9]
|
xor al,[ebx+9]
|
||||||
@ -289,6 +304,8 @@ assemble_line:
|
|||||||
jz new_label
|
jz new_label
|
||||||
cmp cx,[ebx+16]
|
cmp cx,[ebx+16]
|
||||||
je symbol_already_defined
|
je symbol_already_defined
|
||||||
|
btr dword [ebx+8],10
|
||||||
|
jc requalified_label
|
||||||
inc cx
|
inc cx
|
||||||
sub cx,[ebx+16]
|
sub cx,[ebx+16]
|
||||||
setnz al
|
setnz al
|
||||||
@ -299,6 +316,7 @@ assemble_line:
|
|||||||
mov cx,[current_pass]
|
mov cx,[current_pass]
|
||||||
cmp cx,[ebx+18]
|
cmp cx,[ebx+18]
|
||||||
jne label_made
|
jne label_made
|
||||||
|
requalified_label:
|
||||||
or [next_pass_needed],-1
|
or [next_pass_needed],-1
|
||||||
label_made:
|
label_made:
|
||||||
ret
|
ret
|
||||||
@ -320,7 +338,7 @@ assemble_line:
|
|||||||
mov cx,[current_pass]
|
mov cx,[current_pass]
|
||||||
cmp cx,[eax+16]
|
cmp cx,[eax+16]
|
||||||
je get_constant_value
|
je get_constant_value
|
||||||
and dl,not 1
|
or dl,4
|
||||||
mov [eax+8],dl
|
mov [eax+8],dl
|
||||||
get_constant_value:
|
get_constant_value:
|
||||||
push eax
|
push eax
|
||||||
@ -331,10 +349,11 @@ assemble_line:
|
|||||||
pop ebx
|
pop ebx
|
||||||
mov ch,bl
|
mov ch,bl
|
||||||
pop ebx
|
pop ebx
|
||||||
pop dword [ebx+8]
|
pop ecx
|
||||||
cmp ebx,0Fh
|
test cl,4
|
||||||
jb invalid_use_of_symbol
|
jnz constant_referencing_mode_ok
|
||||||
je reserved_word_used_as_symbol
|
and byte [ebx+8],not 4
|
||||||
|
constant_referencing_mode_ok:
|
||||||
xor cl,cl
|
xor cl,cl
|
||||||
mov ch,[value_type]
|
mov ch,[value_type]
|
||||||
cmp ch,3
|
cmp ch,3
|
||||||
@ -385,8 +404,11 @@ assemble_line:
|
|||||||
test byte [ebx+8],2
|
test byte [ebx+8],2
|
||||||
jz symbol_already_defined
|
jz symbol_already_defined
|
||||||
or byte [ebx+8],4
|
or byte [ebx+8],4
|
||||||
|
and byte [ebx+9],not 4
|
||||||
jmp instruction_assembled
|
jmp instruction_assembled
|
||||||
redeclare_constant:
|
redeclare_constant:
|
||||||
|
btr dword [ebx+8],10
|
||||||
|
jc requalified_constant
|
||||||
inc cx
|
inc cx
|
||||||
sub cx,[ebx+16]
|
sub cx,[ebx+16]
|
||||||
setnz al
|
setnz al
|
||||||
@ -399,11 +421,37 @@ assemble_line:
|
|||||||
mov cx,[current_pass]
|
mov cx,[current_pass]
|
||||||
cmp cx,[ebx+18]
|
cmp cx,[ebx+18]
|
||||||
jne instruction_assembled
|
jne instruction_assembled
|
||||||
|
requalified_constant:
|
||||||
or [next_pass_needed],-1
|
or [next_pass_needed],-1
|
||||||
jmp instruction_assembled
|
jmp instruction_assembled
|
||||||
new_constant:
|
new_constant:
|
||||||
or byte [ebx+8],1+2
|
or byte [ebx+8],1+2
|
||||||
jmp instruction_assembled
|
jmp instruction_assembled
|
||||||
|
label_addressing_space:
|
||||||
|
lods dword [esi]
|
||||||
|
cmp eax,0Fh
|
||||||
|
jb invalid_use_of_symbol
|
||||||
|
je reserved_word_used_as_symbol
|
||||||
|
mov cx,[current_pass]
|
||||||
|
test byte [eax+8],1
|
||||||
|
jz make_addressing_space_label
|
||||||
|
cmp cx,[eax+16]
|
||||||
|
je symbol_already_defined
|
||||||
|
test byte [eax+9],4
|
||||||
|
jnz make_addressing_space_label
|
||||||
|
or [next_pass_needed],-1
|
||||||
|
make_addressing_space_label:
|
||||||
|
mov dx,[eax+8]
|
||||||
|
and dx,not (2 or 100h)
|
||||||
|
or dx,1 or 4 or 400h
|
||||||
|
mov [eax+8],dx
|
||||||
|
mov [eax+16],cx
|
||||||
|
mov edx,[current_line]
|
||||||
|
mov [eax+28],edx
|
||||||
|
mov ebx,[addressing_space]
|
||||||
|
mov [eax],ebx
|
||||||
|
or byte [ebx+0Ah],2
|
||||||
|
jmp continue_line
|
||||||
assemble_instruction:
|
assemble_instruction:
|
||||||
; mov [operand_size],0
|
; mov [operand_size],0
|
||||||
; mov [size_override],0
|
; mov [size_override],0
|
||||||
@ -446,22 +494,31 @@ org_directive:
|
|||||||
mov cl,[value_type]
|
mov cl,[value_type]
|
||||||
test cl,1
|
test cl,1
|
||||||
jnz invalid_use_of_symbol
|
jnz invalid_use_of_symbol
|
||||||
mov [labels_type],cl
|
push eax
|
||||||
mov dword [org_origin],edi
|
mov ebx,[addressing_space]
|
||||||
xor ecx,ecx
|
mov eax,edi
|
||||||
mov dword [org_origin+4],ecx
|
sub eax,[ebx+18h]
|
||||||
mov [org_origin_sign],cl
|
mov [ebx+1Ch],eax
|
||||||
mov [org_registers],ecx
|
test byte [ebx+0Ah],1
|
||||||
|
jnz in_virtual
|
||||||
|
call init_addressing_space
|
||||||
|
jmp org_space_ok
|
||||||
|
in_virtual:
|
||||||
|
call close_virtual_addressing_space
|
||||||
|
call init_addressing_space
|
||||||
|
or byte [ebx+0Ah],1
|
||||||
|
org_space_ok:
|
||||||
|
pop eax
|
||||||
|
mov [ebx+9],cl
|
||||||
mov cl,[value_sign]
|
mov cl,[value_sign]
|
||||||
sub dword [org_origin],eax
|
sub [ebx],eax
|
||||||
sbb dword [org_origin+4],edx
|
sbb [ebx+4],edx
|
||||||
sbb [org_origin_sign],cl
|
sbb byte [ebx+8],cl
|
||||||
jp org_value_ok
|
jp org_value_ok
|
||||||
call recoverable_overflow
|
call recoverable_overflow
|
||||||
org_value_ok:
|
org_value_ok:
|
||||||
mov [org_start],edi
|
|
||||||
mov edx,[symbol_identifier]
|
mov edx,[symbol_identifier]
|
||||||
mov [org_symbol],edx
|
mov [ebx+14h],edx
|
||||||
cmp [output_format],1
|
cmp [output_format],1
|
||||||
ja instruction_assembled
|
ja instruction_assembled
|
||||||
cmp edi,[code_start]
|
cmp edi,[code_start]
|
||||||
@ -502,9 +559,8 @@ label_directive:
|
|||||||
lods byte [esi]
|
lods byte [esi]
|
||||||
cmp al,'('
|
cmp al,'('
|
||||||
jne invalid_argument
|
jne invalid_argument
|
||||||
push dword [ebx+8]
|
|
||||||
push ebx ecx
|
push ebx ecx
|
||||||
and byte [ebx+8],not 1
|
or byte [ebx+8],4
|
||||||
cmp byte [esi],'.'
|
cmp byte [esi],'.'
|
||||||
je invalid_value
|
je invalid_value
|
||||||
call get_address_value
|
call get_address_value
|
||||||
@ -516,14 +572,10 @@ label_directive:
|
|||||||
xchg bl,bh
|
xchg bl,bh
|
||||||
mov bp,bx
|
mov bp,bx
|
||||||
pop ecx ebx
|
pop ecx ebx
|
||||||
pop dword [ebx+8]
|
and byte [ebx+8],not 4
|
||||||
mov ch,[value_type]
|
mov ch,[value_type]
|
||||||
or ch,ch
|
test ch,1
|
||||||
jz make_free_label
|
jnz invalid_use_of_symbol
|
||||||
cmp ch,4
|
|
||||||
je make_free_label
|
|
||||||
cmp ch,2
|
|
||||||
jne invalid_use_of_symbol
|
|
||||||
make_free_label:
|
make_free_label:
|
||||||
and byte [ebx+9],not 1
|
and byte [ebx+9],not 1
|
||||||
cmp eax,[ebx]
|
cmp eax,[ebx]
|
||||||
@ -558,45 +610,102 @@ load_directive:
|
|||||||
mov [operand_size],al
|
mov [operand_size],al
|
||||||
and dword [value],0
|
and dword [value],0
|
||||||
and dword [value+4],0
|
and dword [value+4],0
|
||||||
lods word [esi]
|
lods byte [esi]
|
||||||
cmp ax,82h+'(' shl 8
|
cmp al,82h
|
||||||
jne invalid_argument
|
jne invalid_argument
|
||||||
load_from_code:
|
call get_data_point
|
||||||
cmp byte [esi],'.'
|
jc value_loaded
|
||||||
je invalid_value
|
|
||||||
or [size_override],-1
|
|
||||||
call get_address_value
|
|
||||||
call calculate_relative_offset
|
|
||||||
push esi edi
|
push esi edi
|
||||||
cmp [next_pass_needed],0
|
mov esi,ebx
|
||||||
jne load_address_type_ok
|
|
||||||
cmp [value_type],0
|
|
||||||
jne invalid_use_of_symbol
|
|
||||||
load_address_type_ok:
|
|
||||||
cmp edx,-1
|
|
||||||
jne bad_load_address
|
|
||||||
neg eax
|
|
||||||
mov esi,edi
|
|
||||||
sub esi,eax
|
|
||||||
jc bad_load_address
|
|
||||||
cmp esi,[org_start]
|
|
||||||
jb bad_load_address
|
|
||||||
mov edi,value
|
mov edi,value
|
||||||
movzx ecx,[operand_size]
|
|
||||||
cmp ecx,eax
|
|
||||||
ja bad_load_address
|
|
||||||
rep movs byte [edi],[esi]
|
rep movs byte [edi],[esi]
|
||||||
jmp value_loaded
|
|
||||||
bad_load_address:
|
|
||||||
call recoverable_overflow
|
|
||||||
value_loaded:
|
|
||||||
pop edi esi
|
pop edi esi
|
||||||
|
value_loaded:
|
||||||
mov [value_sign],0
|
mov [value_sign],0
|
||||||
mov eax,dword [value]
|
mov eax,dword [value]
|
||||||
mov edx,dword [value+4]
|
mov edx,dword [value+4]
|
||||||
pop ebx
|
pop ebx
|
||||||
xor cx,cx
|
xor cx,cx
|
||||||
jmp make_constant
|
jmp make_constant
|
||||||
|
get_data_point:
|
||||||
|
mov ebx,[addressing_space]
|
||||||
|
mov ecx,edi
|
||||||
|
sub ecx,[ebx+18h]
|
||||||
|
mov [ebx+1Ch],ecx
|
||||||
|
lods byte [esi]
|
||||||
|
cmp al,'('
|
||||||
|
jne invalid_argument
|
||||||
|
cmp byte [esi],11h
|
||||||
|
jne get_data_address
|
||||||
|
cmp word [esi+1+4],'):'
|
||||||
|
jne get_data_address
|
||||||
|
inc esi
|
||||||
|
lods dword [esi]
|
||||||
|
add esi,2
|
||||||
|
cmp byte [esi],'('
|
||||||
|
jne invalid_argument
|
||||||
|
inc esi
|
||||||
|
cmp eax,0Fh
|
||||||
|
jbe reserved_word_used_as_symbol
|
||||||
|
mov edx,undefined_symbol
|
||||||
|
test byte [eax+8],1
|
||||||
|
jz addressing_space_unavailable
|
||||||
|
mov edx,symbol_out_of_scope
|
||||||
|
mov cx,[eax+16]
|
||||||
|
cmp cx,[current_pass]
|
||||||
|
jne addressing_space_unavailable
|
||||||
|
test byte [eax+9],4
|
||||||
|
jz invalid_use_of_symbol
|
||||||
|
mov ebx,eax
|
||||||
|
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]
|
||||||
|
get_data_address:
|
||||||
|
push ebx
|
||||||
|
cmp byte [esi],'.'
|
||||||
|
je invalid_value
|
||||||
|
or [size_override],-1
|
||||||
|
call get_address_value
|
||||||
|
pop ebp
|
||||||
|
call calculate_relative_offset
|
||||||
|
cmp [next_pass_needed],0
|
||||||
|
jne data_address_type_ok
|
||||||
|
cmp [value_type],0
|
||||||
|
jne invalid_use_of_symbol
|
||||||
|
data_address_type_ok:
|
||||||
|
mov ebx,edi
|
||||||
|
xor ecx,ecx
|
||||||
|
add ebx,eax
|
||||||
|
adc edx,ecx
|
||||||
|
mov eax,ebx
|
||||||
|
sub eax,[ds:ebp+18h]
|
||||||
|
sbb edx,ecx
|
||||||
|
jnz bad_data_address
|
||||||
|
mov cl,[operand_size]
|
||||||
|
add eax,ecx
|
||||||
|
cmp eax,[ds:ebp+1Ch]
|
||||||
|
ja bad_data_address
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
addressing_space_unavailable:
|
||||||
|
cmp [error_line],0
|
||||||
|
jne get_data_address
|
||||||
|
push [current_line]
|
||||||
|
pop [error_line]
|
||||||
|
mov [error],edx
|
||||||
|
mov [error_info],eax
|
||||||
|
jmp get_data_address
|
||||||
|
bad_data_address:
|
||||||
|
call recoverable_overflow
|
||||||
|
stc
|
||||||
|
ret
|
||||||
store_directive:
|
store_directive:
|
||||||
cmp byte [esi],11h
|
cmp byte [esi],11h
|
||||||
je sized_store
|
je sized_store
|
||||||
@ -616,44 +725,23 @@ store_directive:
|
|||||||
jne invalid_use_of_symbol
|
jne invalid_use_of_symbol
|
||||||
mov dword [value],eax
|
mov dword [value],eax
|
||||||
mov dword [value+4],edx
|
mov dword [value+4],edx
|
||||||
lods word [esi]
|
lods byte [esi]
|
||||||
cmp ax,80h+'(' shl 8
|
cmp al,80h
|
||||||
jne invalid_argument
|
jne invalid_argument
|
||||||
cmp byte [esi],'.'
|
call get_data_point
|
||||||
je invalid_value
|
jc instruction_assembled
|
||||||
or [size_override],-1
|
|
||||||
call get_address_value
|
|
||||||
call calculate_relative_offset
|
|
||||||
push esi edi
|
push esi edi
|
||||||
cmp [next_pass_needed],0
|
|
||||||
jne store_address_type_ok
|
|
||||||
cmp [value_type],0
|
|
||||||
jne invalid_use_of_symbol
|
|
||||||
store_address_type_ok:
|
|
||||||
cmp edx,-1
|
|
||||||
jne bad_store_address
|
|
||||||
neg eax
|
|
||||||
sub edi,eax
|
|
||||||
jc bad_store_address
|
|
||||||
cmp edi,[org_start]
|
|
||||||
jb bad_store_address
|
|
||||||
mov esi,value
|
mov esi,value
|
||||||
movzx ecx,[operand_size]
|
mov edi,ebx
|
||||||
cmp ecx,eax
|
|
||||||
ja bad_store_address
|
|
||||||
rep movs byte [edi],[esi]
|
rep movs byte [edi],[esi]
|
||||||
mov eax,edi
|
mov eax,edi
|
||||||
pop edi esi
|
pop edi esi
|
||||||
cmp edi,[undefined_data_end]
|
cmp ebx,[undefined_data_end]
|
||||||
jne instruction_assembled
|
jae instruction_assembled
|
||||||
cmp eax,[undefined_data_start]
|
cmp eax,[undefined_data_start]
|
||||||
jbe instruction_assembled
|
jbe instruction_assembled
|
||||||
mov [undefined_data_start],eax
|
mov [undefined_data_start],eax
|
||||||
jmp instruction_assembled
|
jmp instruction_assembled
|
||||||
bad_store_address:
|
|
||||||
pop edi esi
|
|
||||||
call recoverable_overflow
|
|
||||||
jmp instruction_assembled
|
|
||||||
|
|
||||||
display_directive:
|
display_directive:
|
||||||
lods byte [esi]
|
lods byte [esi]
|
||||||
@ -665,12 +753,12 @@ display_directive:
|
|||||||
lods dword [esi]
|
lods dword [esi]
|
||||||
mov ecx,eax
|
mov ecx,eax
|
||||||
push edi
|
push edi
|
||||||
mov edi,[display_buffer]
|
mov edi,[tagged_blocks]
|
||||||
sub edi,8
|
sub edi,8
|
||||||
sub edi,eax
|
sub edi,eax
|
||||||
cmp edi,[esp]
|
cmp edi,[esp]
|
||||||
jbe out_of_memory
|
jbe out_of_memory
|
||||||
mov [display_buffer],edi
|
mov [tagged_blocks],edi
|
||||||
rep movs byte [edi],[esi]
|
rep movs byte [edi],[esi]
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
@ -681,9 +769,9 @@ display_directive:
|
|||||||
display_byte:
|
display_byte:
|
||||||
call get_byte_value
|
call get_byte_value
|
||||||
push edi
|
push edi
|
||||||
mov edi,[display_buffer]
|
mov edi,[tagged_blocks]
|
||||||
sub edi,8+1
|
sub edi,8+1
|
||||||
mov [display_buffer],edi
|
mov [tagged_blocks],edi
|
||||||
stos byte [edi]
|
stos byte [edi]
|
||||||
mov eax,1
|
mov eax,1
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
@ -691,7 +779,7 @@ display_directive:
|
|||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
pop edi
|
pop edi
|
||||||
display_next:
|
display_next:
|
||||||
cmp edi,[display_buffer]
|
cmp edi,[tagged_blocks]
|
||||||
ja out_of_memory
|
ja out_of_memory
|
||||||
lods byte [esi]
|
lods byte [esi]
|
||||||
cmp al,','
|
cmp al,','
|
||||||
@ -699,7 +787,7 @@ display_directive:
|
|||||||
dec esi
|
dec esi
|
||||||
jmp instruction_assembled
|
jmp instruction_assembled
|
||||||
show_display_buffer:
|
show_display_buffer:
|
||||||
mov eax,[display_buffer]
|
mov eax,[tagged_blocks]
|
||||||
or eax,eax
|
or eax,eax
|
||||||
jz display_done
|
jz display_done
|
||||||
mov esi,[labels_list]
|
mov esi,[labels_list]
|
||||||
@ -711,12 +799,12 @@ show_display_buffer:
|
|||||||
mov ecx,[esi]
|
mov ecx,[esi]
|
||||||
sub esi,ecx
|
sub esi,ecx
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jnz skip_internal_message
|
jnz skip_block
|
||||||
push esi
|
push esi
|
||||||
call display_block
|
call display_block
|
||||||
pop esi
|
pop esi
|
||||||
skip_internal_message:
|
skip_block:
|
||||||
cmp esi,[display_buffer]
|
cmp esi,[tagged_blocks]
|
||||||
jne display_messages
|
jne display_messages
|
||||||
display_done:
|
display_done:
|
||||||
ret
|
ret
|
||||||
@ -779,28 +867,41 @@ virtual_directive:
|
|||||||
jmp set_virtual
|
jmp set_virtual
|
||||||
virtual_at_current:
|
virtual_at_current:
|
||||||
dec esi
|
dec esi
|
||||||
mov al,[labels_type]
|
mov ebp,[addressing_space]
|
||||||
|
mov al,[ds:ebp+9]
|
||||||
mov [value_type],al
|
mov [value_type],al
|
||||||
mov ebp,[org_symbol]
|
|
||||||
mov eax,edi
|
mov eax,edi
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
xor cl,cl
|
xor cl,cl
|
||||||
sub eax,dword [org_origin]
|
sub eax,[ds:ebp]
|
||||||
sbb edx,dword [org_origin+4]
|
sbb edx,[ds:ebp+4]
|
||||||
sbb cl,[org_origin_sign]
|
sbb cl,[ds:ebp+8]
|
||||||
mov [address_sign],cl
|
mov [address_sign],cl
|
||||||
mov bx,word [org_registers]
|
mov bx,[ds:ebp+10h]
|
||||||
mov cx,word [org_registers+2]
|
mov cx,[ds:ebp+10h+2]
|
||||||
xchg bh,bl
|
xchg bh,bl
|
||||||
xchg ch,cl
|
xchg ch,cl
|
||||||
|
mov ebp,[ds:ebp+14h]
|
||||||
set_virtual:
|
set_virtual:
|
||||||
push [org_registers]
|
xchg bl,bh
|
||||||
mov byte [org_registers],bh
|
xchg cl,ch
|
||||||
mov byte [org_registers+1],bl
|
shl ecx,16
|
||||||
mov byte [org_registers+2],ch
|
mov cx,bx
|
||||||
mov byte [org_registers+3],cl
|
push ecx eax
|
||||||
call allocate_structure_data
|
call allocate_structure_data
|
||||||
mov word [ebx],virtual_directive-instruction_handler
|
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 init_addressing_space
|
||||||
|
or byte [ebx+0Ah],1
|
||||||
|
pop eax
|
||||||
mov cl,[address_sign]
|
mov cl,[address_sign]
|
||||||
not eax
|
not eax
|
||||||
not edx
|
not edx
|
||||||
@ -811,37 +912,19 @@ virtual_directive:
|
|||||||
add eax,edi
|
add eax,edi
|
||||||
adc edx,0
|
adc edx,0
|
||||||
adc cl,0
|
adc cl,0
|
||||||
xchg dword [org_origin],eax
|
mov [ebx],eax
|
||||||
xchg dword [org_origin+4],edx
|
mov [ebx+4],edx
|
||||||
xchg [org_origin_sign],cl
|
mov [ebx+8],cl
|
||||||
mov [ebx+10h],eax
|
pop dword [ebx+10h]
|
||||||
mov [ebx+14h],edx
|
mov [ebx+14h],ebp
|
||||||
pop eax
|
|
||||||
mov [ebx+18h],eax
|
|
||||||
mov al,[virtual_data]
|
|
||||||
and al,0Fh
|
|
||||||
shl cl,4
|
|
||||||
or al,cl
|
|
||||||
mov [ebx+2],al
|
|
||||||
mov al,[labels_type]
|
|
||||||
mov [ebx+3],al
|
|
||||||
mov eax,edi
|
|
||||||
xchg eax,[org_start]
|
|
||||||
mov [ebx+0Ch],eax
|
|
||||||
xchg ebp,[org_symbol]
|
|
||||||
mov [ebx+1Ch],ebp
|
|
||||||
mov [ebx+8],edi
|
|
||||||
mov eax,[current_line]
|
|
||||||
mov [ebx+4],eax
|
|
||||||
or [virtual_data],-1
|
|
||||||
mov al,[value_type]
|
mov al,[value_type]
|
||||||
test al,1
|
test al,1
|
||||||
jnz invalid_use_of_symbol
|
jnz invalid_use_of_symbol
|
||||||
mov [labels_type],al
|
mov [ebx+9],al
|
||||||
jmp instruction_assembled
|
jmp instruction_assembled
|
||||||
allocate_structure_data:
|
allocate_structure_data:
|
||||||
mov ebx,[structures_buffer]
|
mov ebx,[structures_buffer]
|
||||||
sub ebx,20h
|
sub ebx,18h
|
||||||
cmp ebx,[free_additional_memory]
|
cmp ebx,[free_additional_memory]
|
||||||
jb out_of_memory
|
jb out_of_memory
|
||||||
mov [structures_buffer],ebx
|
mov [structures_buffer],ebx
|
||||||
@ -853,7 +936,7 @@ virtual_directive:
|
|||||||
je no_such_structure
|
je no_such_structure
|
||||||
cmp ax,[ebx]
|
cmp ax,[ebx]
|
||||||
je structure_data_found
|
je structure_data_found
|
||||||
add ebx,20h
|
add ebx,18h
|
||||||
jmp scan_structures
|
jmp scan_structures
|
||||||
structure_data_found:
|
structure_data_found:
|
||||||
ret
|
ret
|
||||||
@ -863,27 +946,11 @@ virtual_directive:
|
|||||||
end_virtual:
|
end_virtual:
|
||||||
call find_structure_data
|
call find_structure_data
|
||||||
jc unexpected_instruction
|
jc unexpected_instruction
|
||||||
mov al,[ebx+2]
|
push ebx
|
||||||
mov ah,al
|
call close_virtual_addressing_space
|
||||||
shr ah,4
|
pop ebx
|
||||||
and al,1
|
mov eax,[ebx+12]
|
||||||
neg al
|
mov [addressing_space],eax
|
||||||
and ah,1
|
|
||||||
neg ah
|
|
||||||
mov [virtual_data],al
|
|
||||||
mov [org_origin_sign],ah
|
|
||||||
mov al,[ebx+3]
|
|
||||||
mov [labels_type],al
|
|
||||||
mov eax,[ebx+10h]
|
|
||||||
mov dword [org_origin],eax
|
|
||||||
mov eax,[ebx+14h]
|
|
||||||
mov dword [org_origin+4],eax
|
|
||||||
mov eax,[ebx+18h]
|
|
||||||
mov [org_registers],eax
|
|
||||||
mov eax,[ebx+0Ch]
|
|
||||||
mov [org_start],eax
|
|
||||||
mov eax,[ebx+1Ch]
|
|
||||||
mov [org_symbol],eax
|
|
||||||
mov edi,[ebx+8]
|
mov edi,[ebx+8]
|
||||||
remove_structure_data:
|
remove_structure_data:
|
||||||
push esi edi
|
push esi edi
|
||||||
@ -891,13 +958,55 @@ virtual_directive:
|
|||||||
sub ecx,[structures_buffer]
|
sub ecx,[structures_buffer]
|
||||||
shr ecx,2
|
shr ecx,2
|
||||||
lea esi,[ebx-4]
|
lea esi,[ebx-4]
|
||||||
lea edi,[esi+20h]
|
lea edi,[esi+18h]
|
||||||
std
|
std
|
||||||
rep movs dword [edi],[esi]
|
rep movs dword [edi],[esi]
|
||||||
cld
|
cld
|
||||||
add [structures_buffer],20h
|
add [structures_buffer],18h
|
||||||
pop edi esi
|
pop edi esi
|
||||||
ret
|
ret
|
||||||
|
close_virtual_addressing_space:
|
||||||
|
mov ebx,[addressing_space]
|
||||||
|
mov eax,edi
|
||||||
|
sub eax,[ebx+18h]
|
||||||
|
mov [ebx+1Ch],eax
|
||||||
|
test byte [ebx+0Ah],2
|
||||||
|
jz addressing_space_closed
|
||||||
|
push esi edi ecx edx
|
||||||
|
mov ecx,eax
|
||||||
|
mov eax,[tagged_blocks]
|
||||||
|
mov dword [eax-4],11h
|
||||||
|
mov dword [eax-8],ecx
|
||||||
|
sub eax,8
|
||||||
|
sub eax,ecx
|
||||||
|
mov [tagged_blocks],eax
|
||||||
|
lea edi,[eax+ecx-1]
|
||||||
|
xchg eax,[ebx+18h]
|
||||||
|
lea esi,[eax+ecx-1]
|
||||||
|
mov eax,edi
|
||||||
|
sub eax,esi
|
||||||
|
std
|
||||||
|
shr ecx,1
|
||||||
|
jnc virtual_byte_ok
|
||||||
|
movs byte [edi],[esi]
|
||||||
|
virtual_byte_ok:
|
||||||
|
dec esi
|
||||||
|
dec edi
|
||||||
|
shr ecx,1
|
||||||
|
jnc virtual_word_ok
|
||||||
|
movs word [edi],[esi]
|
||||||
|
virtual_word_ok:
|
||||||
|
sub esi,2
|
||||||
|
sub edi,2
|
||||||
|
rep movs dword [edi],[esi]
|
||||||
|
cld
|
||||||
|
xor edx,edx
|
||||||
|
add [ebx],eax
|
||||||
|
adc dword [ebx+4],edx
|
||||||
|
adc byte [ebx+8],dl
|
||||||
|
pop edx ecx edi esi
|
||||||
|
addressing_space_closed:
|
||||||
|
ret
|
||||||
repeat_directive:
|
repeat_directive:
|
||||||
cmp [prefixed_instruction],0
|
cmp [prefixed_instruction],0
|
||||||
jne unexpected_instruction
|
jne unexpected_instruction
|
||||||
@ -1193,7 +1302,7 @@ break_directive:
|
|||||||
je break_while
|
je break_while
|
||||||
cmp ax,if_directive-instruction_handler
|
cmp ax,if_directive-instruction_handler
|
||||||
je break_if
|
je break_if
|
||||||
add ebx,20h
|
add ebx,18h
|
||||||
jmp find_breakable_structure
|
jmp find_breakable_structure
|
||||||
break_if:
|
break_if:
|
||||||
push [current_line]
|
push [current_line]
|
||||||
@ -1235,14 +1344,15 @@ data_bytes:
|
|||||||
lods dword [esi]
|
lods dword [esi]
|
||||||
mov ecx,eax
|
mov ecx,eax
|
||||||
lea eax,[edi+ecx]
|
lea eax,[edi+ecx]
|
||||||
cmp eax,[display_buffer]
|
cmp eax,[tagged_blocks]
|
||||||
ja out_of_memory
|
ja out_of_memory
|
||||||
rep movs byte [edi],[esi]
|
rep movs byte [edi],[esi]
|
||||||
inc esi
|
inc esi
|
||||||
ret
|
ret
|
||||||
undefined_data:
|
undefined_data:
|
||||||
cmp [virtual_data],0
|
mov ebp,[addressing_space]
|
||||||
je mark_undefined_data
|
test byte [ds:ebp+0Ah],1
|
||||||
|
jz mark_undefined_data
|
||||||
ret
|
ret
|
||||||
mark_undefined_data:
|
mark_undefined_data:
|
||||||
cmp eax,[undefined_data_end]
|
cmp eax,[undefined_data_end]
|
||||||
@ -1252,7 +1362,7 @@ data_bytes:
|
|||||||
mov [undefined_data_end],edi
|
mov [undefined_data_end],edi
|
||||||
ret
|
ret
|
||||||
define_data:
|
define_data:
|
||||||
cmp edi,[display_buffer]
|
cmp edi,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
cmp byte [esi],'('
|
cmp byte [esi],'('
|
||||||
jne simple_data_value
|
jne simple_data_value
|
||||||
@ -1273,7 +1383,7 @@ data_bytes:
|
|||||||
duplicate_data:
|
duplicate_data:
|
||||||
push eax esi
|
push eax esi
|
||||||
duplicated_values:
|
duplicated_values:
|
||||||
cmp edi,[display_buffer]
|
cmp edi,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
call near dword [esp+8]
|
call near dword [esp+8]
|
||||||
lods byte [esi]
|
lods byte [esi]
|
||||||
@ -1287,7 +1397,7 @@ data_bytes:
|
|||||||
mov esi,ebx
|
mov esi,ebx
|
||||||
jmp duplicate_data
|
jmp duplicate_data
|
||||||
duplicate_single_data_value:
|
duplicate_single_data_value:
|
||||||
cmp edi,[display_buffer]
|
cmp edi,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
push eax esi
|
push eax esi
|
||||||
call near dword [esp+8]
|
call near dword [esp+8]
|
||||||
@ -1311,7 +1421,7 @@ data_bytes:
|
|||||||
call skip_symbol
|
call skip_symbol
|
||||||
jmp data_defined
|
jmp data_defined
|
||||||
simple_data_value:
|
simple_data_value:
|
||||||
cmp edi,[display_buffer]
|
cmp edi,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
call near dword [esp]
|
call near dword [esp]
|
||||||
data_defined:
|
data_defined:
|
||||||
@ -1354,7 +1464,7 @@ data_words:
|
|||||||
mov ecx,eax
|
mov ecx,eax
|
||||||
jecxz word_string_ok
|
jecxz word_string_ok
|
||||||
lea eax,[edi+ecx*2]
|
lea eax,[edi+ecx*2]
|
||||||
cmp eax,[display_buffer]
|
cmp eax,[tagged_blocks]
|
||||||
ja out_of_memory
|
ja out_of_memory
|
||||||
xor ah,ah
|
xor ah,ah
|
||||||
copy_word_string:
|
copy_word_string:
|
||||||
@ -1624,7 +1734,7 @@ data_file:
|
|||||||
mov edx,edi
|
mov edx,edi
|
||||||
add edi,ecx
|
add edi,ecx
|
||||||
jc out_of_memory
|
jc out_of_memory
|
||||||
cmp edi,[display_buffer]
|
cmp edi,[tagged_blocks]
|
||||||
ja out_of_memory
|
ja out_of_memory
|
||||||
call read
|
call read
|
||||||
jc error_reading_file
|
jc error_reading_file
|
||||||
@ -1704,7 +1814,7 @@ reserve_bytes:
|
|||||||
mov edx,ecx
|
mov edx,ecx
|
||||||
add edx,edi
|
add edx,edi
|
||||||
jc out_of_memory
|
jc out_of_memory
|
||||||
cmp edx,[display_buffer]
|
cmp edx,[tagged_blocks]
|
||||||
ja out_of_memory
|
ja out_of_memory
|
||||||
push edi
|
push edi
|
||||||
cmp [next_pass_needed],0
|
cmp [next_pass_needed],0
|
||||||
@ -1739,7 +1849,7 @@ reserve_words:
|
|||||||
jc out_of_memory
|
jc out_of_memory
|
||||||
add edx,edi
|
add edx,edi
|
||||||
jc out_of_memory
|
jc out_of_memory
|
||||||
cmp edx,[display_buffer]
|
cmp edx,[tagged_blocks]
|
||||||
ja out_of_memory
|
ja out_of_memory
|
||||||
push edi
|
push edi
|
||||||
cmp [next_pass_needed],0
|
cmp [next_pass_needed],0
|
||||||
@ -1769,7 +1879,7 @@ reserve_dwords:
|
|||||||
jc out_of_memory
|
jc out_of_memory
|
||||||
add edx,edi
|
add edx,edi
|
||||||
jc out_of_memory
|
jc out_of_memory
|
||||||
cmp edx,[display_buffer]
|
cmp edx,[tagged_blocks]
|
||||||
ja out_of_memory
|
ja out_of_memory
|
||||||
push edi
|
push edi
|
||||||
cmp [next_pass_needed],0
|
cmp [next_pass_needed],0
|
||||||
@ -1796,7 +1906,7 @@ reserve_pwords:
|
|||||||
jc out_of_memory
|
jc out_of_memory
|
||||||
add edx,edi
|
add edx,edi
|
||||||
jc out_of_memory
|
jc out_of_memory
|
||||||
cmp edx,[display_buffer]
|
cmp edx,[tagged_blocks]
|
||||||
ja out_of_memory
|
ja out_of_memory
|
||||||
push edi
|
push edi
|
||||||
cmp [next_pass_needed],0
|
cmp [next_pass_needed],0
|
||||||
@ -1820,7 +1930,7 @@ reserve_qwords:
|
|||||||
jc out_of_memory
|
jc out_of_memory
|
||||||
add edx,edi
|
add edx,edi
|
||||||
jc out_of_memory
|
jc out_of_memory
|
||||||
cmp edx,[display_buffer]
|
cmp edx,[tagged_blocks]
|
||||||
ja out_of_memory
|
ja out_of_memory
|
||||||
push edi
|
push edi
|
||||||
cmp [next_pass_needed],0
|
cmp [next_pass_needed],0
|
||||||
@ -1843,7 +1953,7 @@ reserve_twords:
|
|||||||
jc out_of_memory
|
jc out_of_memory
|
||||||
add edx,edi
|
add edx,edi
|
||||||
jc out_of_memory
|
jc out_of_memory
|
||||||
cmp edx,[display_buffer]
|
cmp edx,[tagged_blocks]
|
||||||
ja out_of_memory
|
ja out_of_memory
|
||||||
push edi
|
push edi
|
||||||
cmp [next_pass_needed],0
|
cmp [next_pass_needed],0
|
||||||
@ -1866,14 +1976,15 @@ align_directive:
|
|||||||
cmp eax,1
|
cmp eax,1
|
||||||
je instruction_assembled
|
je instruction_assembled
|
||||||
mov ecx,edi
|
mov ecx,edi
|
||||||
sub ecx,dword [org_origin]
|
mov ebp,[addressing_space]
|
||||||
cmp [org_registers],0
|
sub ecx,[ds:ebp]
|
||||||
|
cmp dword [ds:ebp+10h],0
|
||||||
jne section_not_aligned_enough
|
jne section_not_aligned_enough
|
||||||
cmp [labels_type],0
|
cmp byte [ds:ebp+9],0
|
||||||
je make_alignment
|
je make_alignment
|
||||||
cmp [output_format],3
|
cmp [output_format],3
|
||||||
je pe_alignment
|
je pe_alignment
|
||||||
mov ebx,[org_symbol]
|
mov ebx,[ds:ebp+14h]
|
||||||
cmp byte [ebx],0
|
cmp byte [ebx],0
|
||||||
jne section_not_aligned_enough
|
jne section_not_aligned_enough
|
||||||
cmp eax,[ebx+10h]
|
cmp eax,[ebx+10h]
|
||||||
@ -1892,7 +2003,7 @@ align_directive:
|
|||||||
mov edx,ecx
|
mov edx,ecx
|
||||||
add edx,edi
|
add edx,edi
|
||||||
jc out_of_memory
|
jc out_of_memory
|
||||||
cmp edx,[display_buffer]
|
cmp edx,[tagged_blocks]
|
||||||
ja out_of_memory
|
ja out_of_memory
|
||||||
push edi
|
push edi
|
||||||
cmp [next_pass_needed],0
|
cmp [next_pass_needed],0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
; flat assembler core
|
; flat assembler core
|
||||||
; Copyright (c) 1999-2012, Tomasz Grysztar.
|
; Copyright (c) 1999-2013, Tomasz Grysztar.
|
||||||
; All rights reserved.
|
; All rights reserved.
|
||||||
|
|
||||||
avx_single_source_pd_instruction:
|
avx_single_source_pd_instruction:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
; flat assembler core
|
; flat assembler core
|
||||||
; Copyright (c) 1999-2012, Tomasz Grysztar.
|
; Copyright (c) 1999-2013, Tomasz Grysztar.
|
||||||
; All rights reserved.
|
; All rights reserved.
|
||||||
|
|
||||||
out_of_memory:
|
out_of_memory:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
; flat assembler core
|
; flat assembler core
|
||||||
; Copyright (c) 1999-2012, Tomasz Grysztar.
|
; Copyright (c) 1999-2013, Tomasz Grysztar.
|
||||||
; All rights reserved.
|
; All rights reserved.
|
||||||
|
|
||||||
calculate_expression:
|
calculate_expression:
|
||||||
@ -169,6 +170,8 @@ calculate_expression:
|
|||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
mov [edi-8+13],cl
|
mov [edi-8+13],cl
|
||||||
got_label:
|
got_label:
|
||||||
|
test byte [ebx+9],4
|
||||||
|
jnz invalid_use_of_symbol
|
||||||
cmp [symbols_file],0
|
cmp [symbols_file],0
|
||||||
je label_reference_ok
|
je label_reference_ok
|
||||||
cmp [next_pass_needed],0
|
cmp [next_pass_needed],0
|
||||||
@ -214,25 +217,27 @@ calculate_expression:
|
|||||||
make_current_offset_label:
|
make_current_offset_label:
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
xor ch,ch
|
xor ch,ch
|
||||||
sub eax,dword [org_origin]
|
mov ebp,[addressing_space]
|
||||||
sbb edx,dword [org_origin+4]
|
sub eax,[ds:ebp]
|
||||||
sbb ch,[org_origin_sign]
|
sbb edx,[ds:ebp+4]
|
||||||
|
sbb ch,[ds:ebp+8]
|
||||||
jp current_offset_label_ok
|
jp current_offset_label_ok
|
||||||
call recoverable_overflow
|
call recoverable_overflow
|
||||||
current_offset_label_ok:
|
current_offset_label_ok:
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
mov eax,edx
|
mov eax,edx
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
mov eax,[org_registers]
|
mov eax,[ds:ebp+10h]
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
mov cl,[labels_type]
|
mov cl,[ds:ebp+9]
|
||||||
mov [edi-12+12],cx
|
mov [edi-12+12],cx
|
||||||
mov eax,[org_symbol]
|
mov eax,[ds:ebp+14h]
|
||||||
mov [edi-12+16],eax
|
mov [edi-12+16],eax
|
||||||
add edi,8
|
add edi,8
|
||||||
jmp calculation_loop
|
jmp calculation_loop
|
||||||
org_origin_label:
|
org_origin_label:
|
||||||
mov eax,[org_start]
|
mov eax,[addressing_space]
|
||||||
|
mov eax,[eax+18h]
|
||||||
jmp make_current_offset_label
|
jmp make_current_offset_label
|
||||||
counter_label:
|
counter_label:
|
||||||
mov eax,[counter]
|
mov eax,[counter]
|
||||||
@ -286,17 +291,27 @@ calculate_expression:
|
|||||||
mov [error_info],ebx
|
mov [error_info],ebx
|
||||||
jmp calculation_loop
|
jmp calculation_loop
|
||||||
calculate_add:
|
calculate_add:
|
||||||
mov ecx,[ebx+16]
|
xor ah,ah
|
||||||
cmp byte [edi+12],0
|
mov ah,[ebx+12]
|
||||||
je add_values
|
|
||||||
mov ecx,[edi+16]
|
|
||||||
cmp byte [ebx+12],0
|
|
||||||
je add_values
|
|
||||||
call recoverable_misuse
|
|
||||||
add_values:
|
|
||||||
mov al,[edi+12]
|
mov al,[edi+12]
|
||||||
or [ebx+12],al
|
or al,al
|
||||||
|
jz add_values
|
||||||
|
or ah,ah
|
||||||
|
jz add_relocatable
|
||||||
|
add ah,al
|
||||||
|
jnz invalid_add
|
||||||
|
mov ecx,[edi+16]
|
||||||
|
cmp ecx,[ebx+16]
|
||||||
|
je add_values
|
||||||
|
invalid_add:
|
||||||
|
call recoverable_misuse
|
||||||
|
jmp add_values
|
||||||
|
add_relocatable:
|
||||||
|
mov ah,al
|
||||||
|
mov ecx,[edi+16]
|
||||||
mov [ebx+16],ecx
|
mov [ebx+16],ecx
|
||||||
|
add_values:
|
||||||
|
mov [ebx+12],ah
|
||||||
mov eax,[edi]
|
mov eax,[edi]
|
||||||
add [ebx],eax
|
add [ebx],eax
|
||||||
mov eax,[edi+4]
|
mov eax,[edi+4]
|
||||||
@ -310,31 +325,29 @@ calculate_expression:
|
|||||||
jz calculation_loop
|
jz calculation_loop
|
||||||
push esi
|
push esi
|
||||||
mov esi,ebx
|
mov esi,ebx
|
||||||
lea ebx,[edi+10]
|
mov cl,[edi+10]
|
||||||
mov cl,[edi+8]
|
mov al,[edi+8]
|
||||||
call add_register
|
call add_register
|
||||||
lea ebx,[edi+11]
|
mov cl,[edi+11]
|
||||||
mov cl,[edi+9]
|
mov al,[edi+9]
|
||||||
call add_register
|
call add_register
|
||||||
pop esi
|
pop esi
|
||||||
jmp calculation_loop
|
jmp calculation_loop
|
||||||
add_register:
|
add_register:
|
||||||
or cl,cl
|
or al,al
|
||||||
jz add_register_done
|
jz add_register_done
|
||||||
add_register_start:
|
add_register_start:
|
||||||
cmp [esi+8],cl
|
cmp [esi+8],al
|
||||||
jne add_in_second_slot
|
jne add_in_second_slot
|
||||||
mov al,[ebx]
|
add [esi+10],cl
|
||||||
add [esi+10],al
|
|
||||||
jo value_out_of_range
|
jo value_out_of_range
|
||||||
jnz add_register_done
|
jnz add_register_done
|
||||||
mov byte [esi+8],0
|
mov byte [esi+8],0
|
||||||
ret
|
ret
|
||||||
add_in_second_slot:
|
add_in_second_slot:
|
||||||
cmp [esi+9],cl
|
cmp [esi+9],al
|
||||||
jne create_in_first_slot
|
jne create_in_first_slot
|
||||||
mov al,[ebx]
|
add [esi+11],cl
|
||||||
add [esi+11],al
|
|
||||||
jo value_out_of_range
|
jo value_out_of_range
|
||||||
jnz add_register_done
|
jnz add_register_done
|
||||||
mov byte [esi+9],0
|
mov byte [esi+9],0
|
||||||
@ -342,16 +355,14 @@ calculate_expression:
|
|||||||
create_in_first_slot:
|
create_in_first_slot:
|
||||||
cmp byte [esi+8],0
|
cmp byte [esi+8],0
|
||||||
jne create_in_second_slot
|
jne create_in_second_slot
|
||||||
mov [esi+8],cl
|
mov [esi+8],al
|
||||||
mov al,[ebx]
|
mov [esi+10],cl
|
||||||
mov [esi+10],al
|
|
||||||
ret
|
ret
|
||||||
create_in_second_slot:
|
create_in_second_slot:
|
||||||
cmp byte [esi+9],0
|
cmp byte [esi+9],0
|
||||||
jne invalid_expression
|
jne invalid_expression
|
||||||
mov [esi+9],cl
|
mov [esi+9],al
|
||||||
mov al,[ebx]
|
mov [esi+11],cl
|
||||||
mov [esi+11],al
|
|
||||||
add_register_done:
|
add_register_done:
|
||||||
ret
|
ret
|
||||||
out_of_range:
|
out_of_range:
|
||||||
@ -362,6 +373,8 @@ calculate_expression:
|
|||||||
mov al,[edi+12]
|
mov al,[edi+12]
|
||||||
or al,al
|
or al,al
|
||||||
jz sub_values
|
jz sub_values
|
||||||
|
or ah,ah
|
||||||
|
jz negate_relocatable
|
||||||
cmp al,ah
|
cmp al,ah
|
||||||
jne invalid_sub
|
jne invalid_sub
|
||||||
xor ah,ah
|
xor ah,ah
|
||||||
@ -370,6 +383,12 @@ calculate_expression:
|
|||||||
je sub_values
|
je sub_values
|
||||||
invalid_sub:
|
invalid_sub:
|
||||||
call recoverable_misuse
|
call recoverable_misuse
|
||||||
|
jmp sub_values
|
||||||
|
negate_relocatable:
|
||||||
|
neg al
|
||||||
|
mov ah,al
|
||||||
|
mov ecx,[edi+16]
|
||||||
|
mov [ebx+16],ecx
|
||||||
sub_values:
|
sub_values:
|
||||||
mov [ebx+12],ah
|
mov [ebx+12],ah
|
||||||
mov eax,[edi]
|
mov eax,[edi]
|
||||||
@ -387,18 +406,18 @@ calculate_expression:
|
|||||||
jz calculation_loop
|
jz calculation_loop
|
||||||
push esi
|
push esi
|
||||||
mov esi,ebx
|
mov esi,ebx
|
||||||
lea ebx,[edi+10]
|
mov cl,[edi+10]
|
||||||
mov cl,[edi+8]
|
mov al,[edi+8]
|
||||||
call sub_register
|
call sub_register
|
||||||
lea ebx,[edi+11]
|
mov cl,[edi+11]
|
||||||
mov cl,[edi+9]
|
mov al,[edi+9]
|
||||||
call sub_register
|
call sub_register
|
||||||
pop esi
|
pop esi
|
||||||
jmp calculation_loop
|
jmp calculation_loop
|
||||||
sub_register:
|
sub_register:
|
||||||
or cl,cl
|
or al,al
|
||||||
jz add_register_done
|
jz add_register_done
|
||||||
neg byte [ebx]
|
neg cl
|
||||||
jo value_out_of_range
|
jo value_out_of_range
|
||||||
jmp add_register_start
|
jmp add_register_start
|
||||||
calculate_mul:
|
calculate_mul:
|
||||||
@ -420,6 +439,7 @@ calculate_expression:
|
|||||||
xor bl,bl
|
xor bl,bl
|
||||||
cmp byte [esi+13],0
|
cmp byte [esi+13],0
|
||||||
je mul_first_sign_ok
|
je mul_first_sign_ok
|
||||||
|
xor bl,-1
|
||||||
mov eax,[esi]
|
mov eax,[esi]
|
||||||
mov edx,[esi+4]
|
mov edx,[esi+4]
|
||||||
not eax
|
not eax
|
||||||
@ -430,10 +450,20 @@ calculate_expression:
|
|||||||
mov [esi+4],edx
|
mov [esi+4],edx
|
||||||
or eax,edx
|
or eax,edx
|
||||||
jz mul_overflow
|
jz mul_overflow
|
||||||
xor bl,-1
|
|
||||||
mul_first_sign_ok:
|
mul_first_sign_ok:
|
||||||
cmp byte [edi+13],0
|
cmp byte [edi+13],0
|
||||||
je mul_second_sign_ok
|
je mul_second_sign_ok
|
||||||
|
xor bl,-1
|
||||||
|
cmp byte [esi+8],0
|
||||||
|
je mul_first_register_sign_ok
|
||||||
|
neg byte [esi+10]
|
||||||
|
jo invalid_expression
|
||||||
|
mul_first_register_sign_ok:
|
||||||
|
cmp byte [esi+9],0
|
||||||
|
je mul_second_register_sign_ok
|
||||||
|
neg byte [esi+11]
|
||||||
|
jo invalid_expression
|
||||||
|
mul_second_register_sign_ok:
|
||||||
mov eax,[edi]
|
mov eax,[edi]
|
||||||
mov edx,[edi+4]
|
mov edx,[edi+4]
|
||||||
not eax
|
not eax
|
||||||
@ -444,7 +474,6 @@ calculate_expression:
|
|||||||
mov [edi+4],edx
|
mov [edi+4],edx
|
||||||
or eax,edx
|
or eax,edx
|
||||||
jz mul_overflow
|
jz mul_overflow
|
||||||
xor bl,-1
|
|
||||||
mul_second_sign_ok:
|
mul_second_sign_ok:
|
||||||
cmp dword [esi+4],0
|
cmp dword [esi+4],0
|
||||||
jz mul_numbers
|
jz mul_numbers
|
||||||
@ -875,12 +904,17 @@ calculate_expression:
|
|||||||
not dword [edi]
|
not dword [edi]
|
||||||
jmp finish_not
|
jmp finish_not
|
||||||
calculate_neg:
|
calculate_neg:
|
||||||
cmp word [edi+8],0
|
cmp byte [edi+8],0
|
||||||
jne invalid_expression
|
je neg_first_register_ok
|
||||||
cmp byte [edi+12],0
|
neg byte [edi+10]
|
||||||
je neg_ok
|
jo invalid_expression
|
||||||
call recoverable_misuse
|
neg_first_register_ok:
|
||||||
neg_ok:
|
cmp byte [edi+9],0
|
||||||
|
je neg_second_register_ok
|
||||||
|
neg byte [edi+11]
|
||||||
|
jo invalid_expression
|
||||||
|
neg_second_register_ok:
|
||||||
|
neg byte [edi+12]
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
xor cl,cl
|
xor cl,cl
|
||||||
@ -1105,13 +1139,13 @@ calculate_expression:
|
|||||||
mov [esi+13],bl
|
mov [esi+13],bl
|
||||||
ret
|
ret
|
||||||
store_label_reference:
|
store_label_reference:
|
||||||
mov eax,[display_buffer]
|
mov eax,[tagged_blocks]
|
||||||
mov dword [eax-4],2
|
mov dword [eax-4],2
|
||||||
mov dword [eax-8],4
|
mov dword [eax-8],4
|
||||||
sub eax,8+4
|
sub eax,8+4
|
||||||
cmp eax,edi
|
cmp eax,edi
|
||||||
jbe out_of_memory
|
jbe out_of_memory
|
||||||
mov [display_buffer],eax
|
mov [tagged_blocks],eax
|
||||||
mov [eax],ebx
|
mov [eax],ebx
|
||||||
ret
|
ret
|
||||||
convert_fp:
|
convert_fp:
|
||||||
@ -1520,18 +1554,22 @@ get_value:
|
|||||||
get_address_word_value:
|
get_address_word_value:
|
||||||
mov [address_size],2
|
mov [address_size],2
|
||||||
mov [value_size],2
|
mov [value_size],2
|
||||||
|
mov [free_address_range],0
|
||||||
jmp calculate_address
|
jmp calculate_address
|
||||||
get_address_dword_value:
|
get_address_dword_value:
|
||||||
mov [address_size],4
|
mov [address_size],4
|
||||||
mov [value_size],4
|
mov [value_size],4
|
||||||
|
mov [free_address_range],0
|
||||||
jmp calculate_address
|
jmp calculate_address
|
||||||
get_address_qword_value:
|
get_address_qword_value:
|
||||||
mov [address_size],8
|
mov [address_size],8
|
||||||
mov [value_size],8
|
mov [value_size],8
|
||||||
|
mov [free_address_range],0
|
||||||
jmp calculate_address
|
jmp calculate_address
|
||||||
get_address_value:
|
get_address_value:
|
||||||
mov [address_size],0
|
mov [address_size],0
|
||||||
mov [value_size],8
|
mov [value_size],8
|
||||||
|
or [free_address_range],-1
|
||||||
calculate_address:
|
calculate_address:
|
||||||
cmp byte [esi],'.'
|
cmp byte [esi],'.'
|
||||||
je invalid_address
|
je invalid_address
|
||||||
@ -1542,17 +1580,22 @@ get_address_value:
|
|||||||
mov [address_sign],al
|
mov [address_sign],al
|
||||||
mov al,[edi+12]
|
mov al,[edi+12]
|
||||||
mov [value_type],al
|
mov [value_type],al
|
||||||
|
cmp al,0
|
||||||
|
je address_size_ok
|
||||||
|
jg get_address_symbol_size
|
||||||
|
neg al
|
||||||
|
get_address_symbol_size:
|
||||||
cmp al,6
|
cmp al,6
|
||||||
je special_address_type_32bit
|
je special_address_type_32bit
|
||||||
cmp al,5
|
cmp al,5
|
||||||
je special_address_type_32bit
|
je special_address_type_32bit
|
||||||
ja invalid_use_of_symbol
|
ja invalid_address_type
|
||||||
test al,1
|
test al,1
|
||||||
jnz invalid_use_of_symbol
|
jnz invalid_address_type
|
||||||
or al,al
|
|
||||||
jz address_size_ok
|
|
||||||
shl al,5
|
shl al,5
|
||||||
jmp address_symbol_ok
|
jmp address_symbol_ok
|
||||||
|
invalid_address_type:
|
||||||
|
call recoverable_misuse
|
||||||
special_address_type_32bit:
|
special_address_type_32bit:
|
||||||
mov al,40h
|
mov al,40h
|
||||||
address_symbol_ok:
|
address_symbol_ok:
|
||||||
@ -1621,11 +1664,11 @@ get_address_value:
|
|||||||
je sib_allowed
|
je sib_allowed
|
||||||
cmp al,0Fh
|
cmp al,0Fh
|
||||||
je check_ip_relative_address
|
je check_ip_relative_address
|
||||||
or cl,cl
|
|
||||||
jz check_word_value
|
|
||||||
cmp cl,1
|
cmp cl,1
|
||||||
je check_word_value
|
ja invalid_address
|
||||||
jmp invalid_address
|
cmp [free_address_range],0
|
||||||
|
jne check_qword_value
|
||||||
|
jmp check_word_value
|
||||||
address_sizes_do_not_match:
|
address_sizes_do_not_match:
|
||||||
cmp al,0Fh
|
cmp al,0Fh
|
||||||
jne invalid_address
|
jne invalid_address
|
||||||
@ -1636,10 +1679,14 @@ get_address_value:
|
|||||||
check_ip_relative_address:
|
check_ip_relative_address:
|
||||||
or bl,bl
|
or bl,bl
|
||||||
jnz invalid_address
|
jnz invalid_address
|
||||||
cmp bh,0F4h
|
|
||||||
je check_dword_value
|
|
||||||
cmp bh,0F8h
|
cmp bh,0F8h
|
||||||
|
je check_rip_relative_address
|
||||||
|
cmp bh,0F4h
|
||||||
jne invalid_address
|
jne invalid_address
|
||||||
|
cmp [free_address_range],0
|
||||||
|
jne check_qword_value
|
||||||
|
jmp check_dword_value
|
||||||
|
check_rip_relative_address:
|
||||||
mov eax,[edi]
|
mov eax,[edi]
|
||||||
cdq
|
cdq
|
||||||
cmp edx,[edi+4]
|
cmp edx,[edi+4]
|
||||||
@ -1694,6 +1741,8 @@ get_address_value:
|
|||||||
mov bh,bl
|
mov bh,bl
|
||||||
dec cl
|
dec cl
|
||||||
check_immediate_address:
|
check_immediate_address:
|
||||||
|
cmp [free_address_range],0
|
||||||
|
jne check_qword_value
|
||||||
mov al,[address_size]
|
mov al,[address_size]
|
||||||
and al,0Fh
|
and al,0Fh
|
||||||
cmp al,2
|
cmp al,2
|
||||||
@ -1778,19 +1827,19 @@ calculate_relative_offset:
|
|||||||
jne relative_offset_ok
|
jne relative_offset_ok
|
||||||
test bh,bh
|
test bh,bh
|
||||||
setne ch
|
setne ch
|
||||||
cmp bx,word [org_registers]
|
cmp bx,[ds:ebp+10h]
|
||||||
je origin_registers_ok
|
je origin_registers_ok
|
||||||
xchg bh,bl
|
xchg bh,bl
|
||||||
xchg ch,cl
|
xchg ch,cl
|
||||||
cmp bx,word [org_registers]
|
cmp bx,[ds:ebp+10h]
|
||||||
jne invalid_value
|
jne invalid_value
|
||||||
origin_registers_ok:
|
origin_registers_ok:
|
||||||
cmp cx,word [org_registers+2]
|
cmp cx,[ds:ebp+10h+2]
|
||||||
jne invalid_value
|
jne invalid_value
|
||||||
mov bl,[address_sign]
|
mov bl,[address_sign]
|
||||||
add eax,dword [org_origin]
|
add eax,[ds:ebp]
|
||||||
adc edx,dword [org_origin+4]
|
adc edx,[ds:ebp+4]
|
||||||
adc bl,[org_origin_sign]
|
adc bl,[ds:ebp+8]
|
||||||
sub eax,edi
|
sub eax,edi
|
||||||
sbb edx,0
|
sbb edx,0
|
||||||
sbb bl,0
|
sbb bl,0
|
||||||
@ -1802,7 +1851,7 @@ calculate_relative_offset:
|
|||||||
jnz relative_offset_unallowed
|
jnz relative_offset_unallowed
|
||||||
cmp bl,6
|
cmp bl,6
|
||||||
je plt_relative_offset
|
je plt_relative_offset
|
||||||
mov bh,[labels_type]
|
mov bh,[ds:ebp+9]
|
||||||
cmp bl,bh
|
cmp bl,bh
|
||||||
je set_relative_offset_type
|
je set_relative_offset_type
|
||||||
cmp bx,0402h
|
cmp bx,0402h
|
||||||
@ -1813,16 +1862,16 @@ calculate_relative_offset:
|
|||||||
cmp [value_type],0
|
cmp [value_type],0
|
||||||
je relative_offset_ok
|
je relative_offset_ok
|
||||||
mov [value_type],0
|
mov [value_type],0
|
||||||
cmp ecx,[org_symbol]
|
cmp ecx,[ds:ebp+14h]
|
||||||
je relative_offset_ok
|
je relative_offset_ok
|
||||||
mov [value_type],3
|
mov [value_type],3
|
||||||
relative_offset_ok:
|
relative_offset_ok:
|
||||||
ret
|
ret
|
||||||
plt_relative_offset:
|
plt_relative_offset:
|
||||||
mov [value_type],7
|
mov [value_type],7
|
||||||
cmp [labels_type],2
|
cmp byte [ds:ebp+9],2
|
||||||
je relative_offset_ok
|
je relative_offset_ok
|
||||||
cmp [labels_type],4
|
cmp byte [ds:ebp+9],4
|
||||||
jne recoverable_misuse
|
jne recoverable_misuse
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -1906,6 +1955,8 @@ calculate_logical_expression:
|
|||||||
je given_false
|
je given_false
|
||||||
cmp al,'1'
|
cmp al,'1'
|
||||||
je given_true
|
je given_true
|
||||||
|
cmp al,'('
|
||||||
|
jne invalid_value
|
||||||
call get_value_for_comparison
|
call get_value_for_comparison
|
||||||
mov bh,[value_sign]
|
mov bh,[value_sign]
|
||||||
push eax edx [symbol_identifier] ebx ecx
|
push eax edx [symbol_identifier] ebx ecx
|
||||||
@ -1922,6 +1973,8 @@ calculate_logical_expression:
|
|||||||
je logical_number
|
je logical_number
|
||||||
inc esi
|
inc esi
|
||||||
mov [compare_type],al
|
mov [compare_type],al
|
||||||
|
cmp byte [esi],'('
|
||||||
|
jne invalid_value
|
||||||
call get_value_for_comparison
|
call get_value_for_comparison
|
||||||
cmp bl,[esp+4]
|
cmp bl,[esp+4]
|
||||||
jne values_not_relative
|
jne values_not_relative
|
||||||
@ -2173,6 +2226,8 @@ skip_symbol:
|
|||||||
je skip_label
|
je skip_label
|
||||||
cmp al,3
|
cmp al,3
|
||||||
je skip_label
|
je skip_label
|
||||||
|
cmp al,4
|
||||||
|
je skip_special_label
|
||||||
cmp al,20h
|
cmp al,20h
|
||||||
jb skip_assembler_symbol
|
jb skip_assembler_symbol
|
||||||
cmp al,'('
|
cmp al,'('
|
||||||
@ -2189,6 +2244,9 @@ skip_symbol:
|
|||||||
skip_assembler_symbol:
|
skip_assembler_symbol:
|
||||||
inc esi
|
inc esi
|
||||||
jmp skip_done
|
jmp skip_done
|
||||||
|
skip_special_label:
|
||||||
|
add esi,4
|
||||||
|
jmp skip_done
|
||||||
skip_address:
|
skip_address:
|
||||||
mov al,[esi]
|
mov al,[esi]
|
||||||
and al,11110000b
|
and al,11110000b
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
; flat assembler core
|
; flat assembler core
|
||||||
; Copyright (c) 1999-2012, Tomasz Grysztar.
|
; Copyright (c) 1999-2013, Tomasz Grysztar.
|
||||||
; All rights reserved.
|
; All rights reserved.
|
||||||
|
|
||||||
convert_expression:
|
convert_expression:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
; flat assembler core
|
; flat assembler core
|
||||||
; Copyright (c) 1999-2012, Tomasz Grysztar.
|
; Copyright (c) 1999-2013, Tomasz Grysztar.
|
||||||
; All rights reserved.
|
; All rights reserved.
|
||||||
|
|
||||||
formatter:
|
formatter:
|
||||||
@ -129,14 +129,14 @@ formatter:
|
|||||||
je labels_table_ok
|
je labels_table_ok
|
||||||
mov ecx,[memory_end]
|
mov ecx,[memory_end]
|
||||||
sub ecx,[labels_list]
|
sub ecx,[labels_list]
|
||||||
mov edi,[display_buffer]
|
mov edi,[tagged_blocks]
|
||||||
sub edi,8
|
sub edi,8
|
||||||
mov [edi],ecx
|
mov [edi],ecx
|
||||||
or dword [edi+4],-1
|
or dword [edi+4],-1
|
||||||
sub edi,ecx
|
sub edi,ecx
|
||||||
cmp edi,[current_offset]
|
cmp edi,[current_offset]
|
||||||
jbe out_of_memory
|
jbe out_of_memory
|
||||||
mov [display_buffer],edi
|
mov [tagged_blocks],edi
|
||||||
mov esi,[memory_end]
|
mov esi,[memory_end]
|
||||||
copy_labels:
|
copy_labels:
|
||||||
sub esi,32
|
sub esi,32
|
||||||
@ -200,8 +200,9 @@ formatter:
|
|||||||
format_directive:
|
format_directive:
|
||||||
cmp edi,[code_start]
|
cmp edi,[code_start]
|
||||||
jne unexpected_instruction
|
jne unexpected_instruction
|
||||||
cmp [virtual_data],0
|
mov ebp,[addressing_space]
|
||||||
jne unexpected_instruction
|
test byte [ds:ebp+0Ah],1
|
||||||
|
jnz unexpected_instruction
|
||||||
cmp [output_format],0
|
cmp [output_format],0
|
||||||
jne unexpected_instruction
|
jne unexpected_instruction
|
||||||
lods byte [esi]
|
lods byte [esi]
|
||||||
@ -280,8 +281,6 @@ heap_directive:
|
|||||||
je pe_heap
|
je pe_heap
|
||||||
jmp illegal_instruction
|
jmp illegal_instruction
|
||||||
segment_directive:
|
segment_directive:
|
||||||
cmp [virtual_data],0
|
|
||||||
jne illegal_instruction
|
|
||||||
mov al,[output_format]
|
mov al,[output_format]
|
||||||
cmp al,2
|
cmp al,2
|
||||||
je mz_segment
|
je mz_segment
|
||||||
@ -289,8 +288,6 @@ segment_directive:
|
|||||||
je elf_segment
|
je elf_segment
|
||||||
jmp illegal_instruction
|
jmp illegal_instruction
|
||||||
section_directive:
|
section_directive:
|
||||||
cmp [virtual_data],0
|
|
||||||
jne illegal_instruction
|
|
||||||
mov al,[output_format]
|
mov al,[output_format]
|
||||||
cmp al,3
|
cmp al,3
|
||||||
je pe_section
|
je pe_section
|
||||||
@ -410,6 +407,7 @@ extrn_directive:
|
|||||||
xor eax,eax
|
xor eax,eax
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
xor ebp,ebp
|
xor ebp,ebp
|
||||||
|
mov [address_sign],0
|
||||||
mov ch,2
|
mov ch,2
|
||||||
test [format_flags],8
|
test [format_flags],8
|
||||||
jz make_free_label
|
jz make_free_label
|
||||||
@ -418,8 +416,9 @@ extrn_directive:
|
|||||||
mark_relocation:
|
mark_relocation:
|
||||||
cmp [value_type],0
|
cmp [value_type],0
|
||||||
je relocation_ok
|
je relocation_ok
|
||||||
cmp [virtual_data],0
|
mov ebp,[addressing_space]
|
||||||
jne relocation_ok
|
test byte [ds:ebp+0Ah],1
|
||||||
|
jnz relocation_ok
|
||||||
cmp [output_format],2
|
cmp [output_format],2
|
||||||
je mark_mz_relocation
|
je mark_mz_relocation
|
||||||
cmp [output_format],3
|
cmp [output_format],3
|
||||||
@ -493,13 +492,11 @@ mz_segment:
|
|||||||
mov edx,edi
|
mov edx,edi
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
rep stos byte [edi]
|
rep stos byte [edi]
|
||||||
mov dword [org_origin],edi
|
|
||||||
mov dword [org_origin+4],eax
|
|
||||||
mov [org_origin_sign],al
|
|
||||||
mov [org_registers],eax
|
|
||||||
mov [org_start],edi
|
|
||||||
mov eax,edx
|
mov eax,edx
|
||||||
call undefined_data
|
call undefined_data
|
||||||
|
push ebx
|
||||||
|
call create_addressing_space
|
||||||
|
pop ebx
|
||||||
mov eax,edi
|
mov eax,edi
|
||||||
sub eax,[code_start]
|
sub eax,[code_start]
|
||||||
shr eax,4
|
shr eax,4
|
||||||
@ -515,9 +512,10 @@ mz_segment:
|
|||||||
mov [code_type],al
|
mov [code_type],al
|
||||||
mov eax,edx
|
mov eax,edx
|
||||||
mov ch,1
|
mov ch,1
|
||||||
mov [label_size],0
|
mov [address_sign],0
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
xor ebp,ebp
|
xor ebp,ebp
|
||||||
|
mov [label_size],0
|
||||||
mov [address_symbol],edx
|
mov [address_symbol],edx
|
||||||
jmp make_free_label
|
jmp make_free_label
|
||||||
mz_entry:
|
mz_entry:
|
||||||
@ -724,7 +722,7 @@ make_stub:
|
|||||||
and ecx,not 11b
|
and ecx,not 11b
|
||||||
add ecx,(40h-1Ch) shr 2
|
add ecx,(40h-1Ch) shr 2
|
||||||
lea eax,[edi+ecx*4]
|
lea eax,[edi+ecx*4]
|
||||||
cmp edi,[display_buffer]
|
cmp edi,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
rep stos dword [edi]
|
rep stos dword [edi]
|
||||||
@ -762,7 +760,7 @@ make_stub:
|
|||||||
inc ecx
|
inc ecx
|
||||||
shl ecx,1
|
shl ecx,1
|
||||||
lea eax,[edi+ecx*4]
|
lea eax,[edi+ecx*4]
|
||||||
cmp eax,[display_buffer]
|
cmp eax,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
rep stos dword [edi]
|
rep stos dword [edi]
|
||||||
@ -826,7 +824,7 @@ make_stub:
|
|||||||
mov [esi+16h],ax
|
mov [esi+16h],ax
|
||||||
mov word [esi+14h],100h
|
mov word [esi+14h],100h
|
||||||
mov byte [esi+18h],40h
|
mov byte [esi+18h],40h
|
||||||
mov eax,[display_buffer]
|
mov eax,[tagged_blocks]
|
||||||
sub eax,ecx
|
sub eax,ecx
|
||||||
cmp edi,eax
|
cmp edi,eax
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
@ -1053,7 +1051,7 @@ format_pe:
|
|||||||
shl ebx,cl
|
shl ebx,cl
|
||||||
sub ebx,ebp
|
sub ebx,ebp
|
||||||
mov ecx,ebx
|
mov ecx,ebx
|
||||||
mov eax,[display_buffer]
|
mov eax,[tagged_blocks]
|
||||||
sub eax,ecx
|
sub eax,ecx
|
||||||
cmp edi,eax
|
cmp edi,eax
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
@ -1117,12 +1115,14 @@ format_pe:
|
|||||||
jc pe_labels_type_ok
|
jc pe_labels_type_ok
|
||||||
xor bh,bh
|
xor bh,bh
|
||||||
pe_labels_type_ok:
|
pe_labels_type_ok:
|
||||||
mov [labels_type],bh
|
push eax ebx
|
||||||
mov dword [org_origin],eax
|
call init_addressing_space
|
||||||
mov dword [org_origin+4],ecx
|
mov ebp,ebx
|
||||||
mov [org_origin_sign],bl
|
pop ebx eax
|
||||||
and [org_registers],0
|
mov [ds:ebp],eax
|
||||||
mov [org_start],edi
|
mov [ds:ebp+4],ecx
|
||||||
|
mov [ds:ebp+8],bx
|
||||||
|
mov [ds:ebp+18h],edi
|
||||||
bt [format_flags],8
|
bt [format_flags],8
|
||||||
jnc dll_flag_ok
|
jnc dll_flag_ok
|
||||||
or byte [edx+16h+1],20h
|
or byte [edx+16h+1],20h
|
||||||
@ -1142,6 +1142,10 @@ format_pe:
|
|||||||
jmp format_defined
|
jmp format_defined
|
||||||
pe_section:
|
pe_section:
|
||||||
call close_pe_section
|
call close_pe_section
|
||||||
|
push eax ebx
|
||||||
|
call create_addressing_space
|
||||||
|
mov ebp,ebx
|
||||||
|
pop ebx eax
|
||||||
bts [format_flags],5
|
bts [format_flags],5
|
||||||
lea ecx,[ebx+28h]
|
lea ecx,[ebx+28h]
|
||||||
add edx,[edx+54h]
|
add edx,[edx+54h]
|
||||||
@ -1179,38 +1183,36 @@ pe_section:
|
|||||||
mov edx,[code_start]
|
mov edx,[code_start]
|
||||||
mov eax,edi
|
mov eax,edi
|
||||||
xor ecx,ecx
|
xor ecx,ecx
|
||||||
mov [org_origin_sign],0
|
|
||||||
sub eax,[ebx+0Ch]
|
sub eax,[ebx+0Ch]
|
||||||
sbb ecx,0
|
sbb ecx,0
|
||||||
sbb [org_origin_sign],0
|
sbb byte [ds:ebp+8],0
|
||||||
mov [labels_type],2
|
mov byte [ds:ebp+9],2
|
||||||
mov [code_type],32
|
mov [code_type],32
|
||||||
test [format_flags],8
|
test [format_flags],8
|
||||||
jz pe_section_code_type_ok
|
jz pe_section_code_type_ok
|
||||||
mov [labels_type],4
|
mov byte [ds:ebp+9],4
|
||||||
mov [code_type],64
|
mov [code_type],64
|
||||||
pe_section_code_type_ok:
|
pe_section_code_type_ok:
|
||||||
test [format_flags],4
|
test [format_flags],4
|
||||||
jnz peplus_section_org
|
jnz peplus_section_org
|
||||||
sub eax,[edx+34h]
|
sub eax,[edx+34h]
|
||||||
sbb ecx,0
|
sbb ecx,0
|
||||||
sbb [org_origin_sign],0
|
sbb byte [ds:ebp+8],0
|
||||||
bt [resolver_flags],0
|
bt [resolver_flags],0
|
||||||
jc pe_section_org_ok
|
jc pe_section_org_ok
|
||||||
mov [labels_type],0
|
mov byte [ds:ebp+9],0
|
||||||
jmp pe_section_org_ok
|
jmp pe_section_org_ok
|
||||||
peplus_section_org:
|
peplus_section_org:
|
||||||
sub eax,[edx+30h]
|
sub eax,[edx+30h]
|
||||||
sbb ecx,[edx+34h]
|
sbb ecx,[edx+34h]
|
||||||
sbb [org_origin_sign],0
|
sbb byte [ds:ebp+8],0
|
||||||
bt [resolver_flags],0
|
bt [resolver_flags],0
|
||||||
jc pe_section_org_ok
|
jc pe_section_org_ok
|
||||||
mov [labels_type],0
|
mov byte [ds:ebp+9],0
|
||||||
pe_section_org_ok:
|
pe_section_org_ok:
|
||||||
mov dword [org_origin],eax
|
mov [ds:ebp],eax
|
||||||
mov dword [org_origin+4],ecx
|
mov [ds:ebp+4],ecx
|
||||||
and [org_registers],0
|
mov [ds:ebp+18h],edi
|
||||||
mov [org_start],edi
|
|
||||||
get_section_flags:
|
get_section_flags:
|
||||||
lods byte [esi]
|
lods byte [esi]
|
||||||
cmp al,1Ah
|
cmp al,1Ah
|
||||||
@ -1541,7 +1543,7 @@ pe_heap:
|
|||||||
cmp edx,[ecx+74h]
|
cmp edx,[ecx+74h]
|
||||||
ja value_out_of_range
|
ja value_out_of_range
|
||||||
jb instruction_assembled
|
jb instruction_assembled
|
||||||
cmp eax,[edx+70h]
|
cmp eax,[ecx+70h]
|
||||||
ja value_out_of_range
|
ja value_out_of_range
|
||||||
jmp instruction_assembled
|
jmp instruction_assembled
|
||||||
mark_pe_relocation:
|
mark_pe_relocation:
|
||||||
@ -1664,7 +1666,7 @@ make_pe_resource:
|
|||||||
and [resource_size],0
|
and [resource_size],0
|
||||||
reserve_space_for_resource:
|
reserve_space_for_resource:
|
||||||
add edi,[resource_size]
|
add edi,[resource_size]
|
||||||
cmp edi,[display_buffer]
|
cmp edi,[tagged_blocks]
|
||||||
ja out_of_memory
|
ja out_of_memory
|
||||||
jmp resource_done
|
jmp resource_done
|
||||||
resource_from_file:
|
resource_from_file:
|
||||||
@ -1750,7 +1752,7 @@ make_pe_resource:
|
|||||||
mov [esi],eax
|
mov [esi],eax
|
||||||
mov [resource_data],edi
|
mov [resource_data],edi
|
||||||
lea eax,[edi+16]
|
lea eax,[edi+16]
|
||||||
cmp eax,[display_buffer]
|
cmp eax,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
@ -1812,7 +1814,7 @@ make_pe_resource:
|
|||||||
mov eax,[resource_data]
|
mov eax,[resource_data]
|
||||||
inc word [eax+12]
|
inc word [eax+12]
|
||||||
lea eax,[edi+8]
|
lea eax,[edi+8]
|
||||||
cmp eax,[display_buffer]
|
cmp eax,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
mov eax,ebx
|
mov eax,ebx
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
@ -1849,7 +1851,7 @@ make_pe_resource:
|
|||||||
mov eax,[resource_data]
|
mov eax,[resource_data]
|
||||||
inc word [eax+14]
|
inc word [eax+14]
|
||||||
lea eax,[edi+8]
|
lea eax,[edi+8]
|
||||||
cmp eax,[display_buffer]
|
cmp eax,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
mov eax,ebx
|
mov eax,ebx
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
@ -1870,7 +1872,7 @@ make_pe_resource:
|
|||||||
bts edx,31
|
bts edx,31
|
||||||
mov [esi+4],edx
|
mov [esi+4],edx
|
||||||
lea eax,[edi+16]
|
lea eax,[edi+16]
|
||||||
cmp eax,[display_buffer]
|
cmp eax,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
@ -1949,7 +1951,7 @@ make_pe_resource:
|
|||||||
mov eax,[esp]
|
mov eax,[esp]
|
||||||
inc word [eax+12]
|
inc word [eax+12]
|
||||||
lea eax,[edi+8]
|
lea eax,[edi+8]
|
||||||
cmp eax,[display_buffer]
|
cmp eax,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
mov eax,ebx
|
mov eax,ebx
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
@ -1992,7 +1994,7 @@ make_pe_resource:
|
|||||||
mov eax,[esp]
|
mov eax,[esp]
|
||||||
inc word [eax+14]
|
inc word [eax+14]
|
||||||
lea eax,[edi+8]
|
lea eax,[edi+8]
|
||||||
cmp eax,[display_buffer]
|
cmp eax,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
mov eax,ebx
|
mov eax,ebx
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
@ -2031,7 +2033,7 @@ make_pe_resource:
|
|||||||
bts edx,31
|
bts edx,31
|
||||||
mov [esi+4],edx
|
mov [esi+4],edx
|
||||||
lea eax,[edi+16]
|
lea eax,[edi+16]
|
||||||
cmp eax,[display_buffer]
|
cmp eax,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
@ -2081,7 +2083,7 @@ make_pe_resource:
|
|||||||
mov eax,[esp]
|
mov eax,[esp]
|
||||||
inc word [eax+14]
|
inc word [eax+14]
|
||||||
lea eax,[edi+8]
|
lea eax,[edi+8]
|
||||||
cmp eax,[display_buffer]
|
cmp eax,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
mov eax,ebx
|
mov eax,ebx
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
@ -2122,7 +2124,7 @@ make_pe_resource:
|
|||||||
stos word [edi]
|
stos word [edi]
|
||||||
copy_string_data:
|
copy_string_data:
|
||||||
lea eax,[edi+2]
|
lea eax,[edi+2]
|
||||||
cmp eax,[display_buffer]
|
cmp eax,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
mov ax,[edx]
|
mov ax,[edx]
|
||||||
or ax,ax
|
or ax,ax
|
||||||
@ -2160,7 +2162,7 @@ make_pe_resource:
|
|||||||
sub esi,[resource_data]
|
sub esi,[resource_data]
|
||||||
xchg esi,[ebx+4]
|
xchg esi,[ebx+4]
|
||||||
lea eax,[edi+16]
|
lea eax,[edi+16]
|
||||||
cmp eax,[display_buffer]
|
cmp eax,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
mov eax,esi
|
mov eax,esi
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
@ -2190,7 +2192,7 @@ make_pe_resource:
|
|||||||
mov edx,edi
|
mov edx,edi
|
||||||
mov ecx,[esi+4]
|
mov ecx,[esi+4]
|
||||||
add edi,ecx
|
add edi,ecx
|
||||||
cmp edi,[display_buffer]
|
cmp edi,[tagged_blocks]
|
||||||
ja out_of_memory
|
ja out_of_memory
|
||||||
call read
|
call read
|
||||||
mov eax,edi
|
mov eax,edi
|
||||||
@ -2319,28 +2321,16 @@ format_coff:
|
|||||||
mov [current_section],ebx
|
mov [current_section],ebx
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
mov [number_of_sections],eax
|
mov [number_of_sections],eax
|
||||||
call setup_coff_section_org
|
mov edx,ebx
|
||||||
|
call init_addressing_space
|
||||||
|
mov [ebx+14h],edx
|
||||||
|
mov byte [ebx+9],2
|
||||||
mov [code_type],32
|
mov [code_type],32
|
||||||
test [format_flags],8
|
test [format_flags],8
|
||||||
jz format_defined
|
jz format_defined
|
||||||
|
mov byte [ebx+9],4
|
||||||
mov [code_type],64
|
mov [code_type],64
|
||||||
jmp format_defined
|
jmp format_defined
|
||||||
setup_coff_section_org:
|
|
||||||
xor eax,eax
|
|
||||||
mov dword [org_origin],edi
|
|
||||||
mov dword [org_origin+4],eax
|
|
||||||
mov [org_origin_sign],al
|
|
||||||
mov [org_registers],eax
|
|
||||||
mov [org_start],edi
|
|
||||||
mov [org_symbol],ebx
|
|
||||||
test [format_flags],8
|
|
||||||
jnz coff_64bit_labels
|
|
||||||
mov [labels_type],2
|
|
||||||
ret
|
|
||||||
coff_64bit_labels:
|
|
||||||
mov [labels_type],4
|
|
||||||
ret
|
|
||||||
|
|
||||||
coff_section:
|
coff_section:
|
||||||
call close_coff_section
|
call close_coff_section
|
||||||
mov ebx,[free_additional_memory]
|
mov ebx,[free_additional_memory]
|
||||||
@ -2355,7 +2345,15 @@ coff_section:
|
|||||||
mov [ebx+8],edi
|
mov [ebx+8],edi
|
||||||
mov [ebx+10h],eax
|
mov [ebx+10h],eax
|
||||||
mov [ebx+14h],eax
|
mov [ebx+14h],eax
|
||||||
call setup_coff_section_org
|
mov edx,ebx
|
||||||
|
call create_addressing_space
|
||||||
|
xchg edx,ebx
|
||||||
|
mov [edx+14h],ebx
|
||||||
|
mov byte [edx+9],2
|
||||||
|
test [format_flags],8
|
||||||
|
jz coff_labels_type_ok
|
||||||
|
mov byte [edx+9],4
|
||||||
|
coff_labels_type_ok:
|
||||||
lods word [esi]
|
lods word [esi]
|
||||||
cmp ax,'('
|
cmp ax,'('
|
||||||
jne invalid_argument
|
jne invalid_argument
|
||||||
@ -2442,8 +2440,10 @@ mark_coff_relocation:
|
|||||||
test [format_flags],8
|
test [format_flags],8
|
||||||
jnz coff_64bit_relocation
|
jnz coff_64bit_relocation
|
||||||
mov al,6
|
mov al,6
|
||||||
|
cmp [value_type],2
|
||||||
|
je coff_relocation
|
||||||
cmp [value_type],5
|
cmp [value_type],5
|
||||||
jne coff_relocation
|
jne invalid_use_of_symbol
|
||||||
inc al
|
inc al
|
||||||
jmp coff_relocation
|
jmp coff_relocation
|
||||||
coff_64bit_relocation:
|
coff_64bit_relocation:
|
||||||
@ -2451,8 +2451,10 @@ mark_coff_relocation:
|
|||||||
cmp [value_type],4
|
cmp [value_type],4
|
||||||
je coff_relocation
|
je coff_relocation
|
||||||
mov al,2
|
mov al,2
|
||||||
|
cmp [value_type],2
|
||||||
|
je coff_relocation
|
||||||
cmp [value_type],5
|
cmp [value_type],5
|
||||||
jne coff_relocation
|
jne invalid_use_of_symbol
|
||||||
inc al
|
inc al
|
||||||
jmp coff_relocation
|
jmp coff_relocation
|
||||||
coff_relocation_relative:
|
coff_relocation_relative:
|
||||||
@ -2465,16 +2467,17 @@ mark_coff_relocation:
|
|||||||
sub eax,ebx
|
sub eax,ebx
|
||||||
add eax,4
|
add eax,4
|
||||||
relative_ok:
|
relative_ok:
|
||||||
|
mov ebx,[addressing_space]
|
||||||
push eax
|
push eax
|
||||||
mov al,20
|
mov al,20
|
||||||
test [format_flags],8
|
test [format_flags],8
|
||||||
jnz relative_coff_64bit_relocation
|
jnz relative_coff_64bit_relocation
|
||||||
cmp [labels_type],2
|
cmp byte [ebx+9],2
|
||||||
jne invalid_use_of_symbol
|
jne invalid_use_of_symbol
|
||||||
jmp coff_relocation
|
jmp coff_relocation
|
||||||
relative_coff_64bit_relocation:
|
relative_coff_64bit_relocation:
|
||||||
mov al,4
|
mov al,4
|
||||||
cmp [labels_type],4
|
cmp byte [ebx+9],4
|
||||||
jne invalid_use_of_symbol
|
jne invalid_use_of_symbol
|
||||||
coff_relocation:
|
coff_relocation:
|
||||||
mov ebx,[free_additional_memory]
|
mov ebx,[free_additional_memory]
|
||||||
@ -2686,7 +2689,7 @@ coff_formatter:
|
|||||||
jmp find_relocations
|
jmp find_relocations
|
||||||
add_relocation:
|
add_relocation:
|
||||||
lea eax,[ebx+0Ah]
|
lea eax,[ebx+0Ah]
|
||||||
cmp eax,[display_buffer]
|
cmp eax,[tagged_blocks]
|
||||||
ja out_of_memory
|
ja out_of_memory
|
||||||
mov eax,[esi+4]
|
mov eax,[esi+4]
|
||||||
mov [ebx],eax
|
mov [ebx],eax
|
||||||
@ -2905,7 +2908,7 @@ format_elf:
|
|||||||
mov edx,edi
|
mov edx,edi
|
||||||
mov ecx,34h shr 2
|
mov ecx,34h shr 2
|
||||||
lea eax,[edi+ecx*4]
|
lea eax,[edi+ecx*4]
|
||||||
cmp eax,[display_buffer]
|
cmp eax,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
rep stos dword [edi]
|
rep stos dword [edi]
|
||||||
@ -2940,16 +2943,21 @@ format_elf:
|
|||||||
mov [ebx+14h],eax
|
mov [ebx+14h],eax
|
||||||
mov al,4
|
mov al,4
|
||||||
mov [ebx+10h],eax
|
mov [ebx+10h],eax
|
||||||
call setup_coff_section_org
|
mov edx,ebx
|
||||||
|
call init_addressing_space
|
||||||
|
xchg edx,ebx
|
||||||
|
mov [edx+14h],ebx
|
||||||
|
mov byte [edx+9],2
|
||||||
test [format_flags],8
|
test [format_flags],8
|
||||||
jz format_defined
|
jz format_defined
|
||||||
|
mov byte [edx+9],4
|
||||||
mov byte [ebx+10h],8
|
mov byte [ebx+10h],8
|
||||||
jmp format_defined
|
jmp format_defined
|
||||||
format_elf64:
|
format_elf64:
|
||||||
mov edx,edi
|
mov edx,edi
|
||||||
mov ecx,40h shr 2
|
mov ecx,40h shr 2
|
||||||
lea eax,[edi+ecx*4]
|
lea eax,[edi+ecx*4]
|
||||||
cmp eax,[display_buffer]
|
cmp eax,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
rep stos dword [edi]
|
rep stos dword [edi]
|
||||||
@ -2984,7 +2992,15 @@ elf_section:
|
|||||||
mov [ebx+10h],eax
|
mov [ebx+10h],eax
|
||||||
mov al,10b
|
mov al,10b
|
||||||
mov [ebx+14h],eax
|
mov [ebx+14h],eax
|
||||||
call setup_coff_section_org
|
mov edx,ebx
|
||||||
|
call create_addressing_space
|
||||||
|
xchg edx,ebx
|
||||||
|
mov [edx+14h],ebx
|
||||||
|
mov byte [edx+9],2
|
||||||
|
test [format_flags],8
|
||||||
|
jz elf_labels_type_ok
|
||||||
|
mov byte [edx+9],4
|
||||||
|
elf_labels_type_ok:
|
||||||
lods word [esi]
|
lods word [esi]
|
||||||
cmp ax,'('
|
cmp ax,'('
|
||||||
jne invalid_argument
|
jne invalid_argument
|
||||||
@ -3038,11 +3054,13 @@ elf_section:
|
|||||||
mov byte [ebx+10h],8
|
mov byte [ebx+10h],8
|
||||||
jmp instruction_assembled
|
jmp instruction_assembled
|
||||||
mark_elf_relocation:
|
mark_elf_relocation:
|
||||||
|
push ebx
|
||||||
|
mov ebx,[addressing_space]
|
||||||
cmp [value_type],3
|
cmp [value_type],3
|
||||||
je elf_relocation_relative
|
je elf_relocation_relative
|
||||||
cmp [value_type],7
|
cmp [value_type],7
|
||||||
je elf_relocation_relative
|
je elf_relocation_relative
|
||||||
push ebx eax
|
push eax
|
||||||
cmp [value_type],5
|
cmp [value_type],5
|
||||||
je elf_gotoff_relocation
|
je elf_gotoff_relocation
|
||||||
ja invalid_use_of_symbol
|
ja invalid_use_of_symbol
|
||||||
@ -3059,9 +3077,8 @@ mark_elf_relocation:
|
|||||||
mov al,9 ; R_386_GOTOFF
|
mov al,9 ; R_386_GOTOFF
|
||||||
jmp coff_relocation
|
jmp coff_relocation
|
||||||
elf_relocation_relative:
|
elf_relocation_relative:
|
||||||
cmp [labels_type],0
|
cmp byte [ebx+9],0
|
||||||
je invalid_use_of_symbol
|
je invalid_use_of_symbol
|
||||||
push ebx
|
|
||||||
mov ebx,[current_section]
|
mov ebx,[current_section]
|
||||||
mov ebx,[ebx+8]
|
mov ebx,[ebx+8]
|
||||||
sub ebx,edi
|
sub ebx,edi
|
||||||
@ -3690,11 +3707,13 @@ format_elf_exe:
|
|||||||
add eax,edi
|
add eax,edi
|
||||||
adc ebp,0
|
adc ebp,0
|
||||||
adc cl,0
|
adc cl,0
|
||||||
mov dword [org_origin],eax
|
elf_exe_addressing_setup:
|
||||||
mov dword [org_origin+4],edx
|
push eax
|
||||||
mov [org_origin_sign],cl
|
call init_addressing_space
|
||||||
and [org_registers],0
|
pop eax
|
||||||
mov [org_start],edi
|
mov [ebx],eax
|
||||||
|
mov [ebx+4],edx
|
||||||
|
mov [ebx+8],cl
|
||||||
mov [symbols_stream],edi
|
mov [symbols_stream],edi
|
||||||
jmp format_defined
|
jmp format_defined
|
||||||
format_elf64_exe:
|
format_elf64_exe:
|
||||||
@ -3768,13 +3787,7 @@ format_elf_exe:
|
|||||||
add eax,edi
|
add eax,edi
|
||||||
adc edx,0
|
adc edx,0
|
||||||
adc cl,0
|
adc cl,0
|
||||||
mov dword [org_origin],eax
|
jmp elf_exe_addressing_setup
|
||||||
mov dword [org_origin+4],edx
|
|
||||||
mov [org_origin_sign],cl
|
|
||||||
and [org_registers],0
|
|
||||||
mov [org_start],edi
|
|
||||||
mov [symbols_stream],edi
|
|
||||||
jmp format_defined
|
|
||||||
elf_entry:
|
elf_entry:
|
||||||
lods byte [esi]
|
lods byte [esi]
|
||||||
cmp al,'('
|
cmp al,'('
|
||||||
@ -3804,6 +3817,8 @@ elf_segment:
|
|||||||
jnz elf64_segment
|
jnz elf64_segment
|
||||||
call close_elf_segment
|
call close_elf_segment
|
||||||
push eax
|
push eax
|
||||||
|
call create_addressing_space
|
||||||
|
mov ebp,ebx
|
||||||
mov ebx,[number_of_sections]
|
mov ebx,[number_of_sections]
|
||||||
shl ebx,5
|
shl ebx,5
|
||||||
add ebx,[code_start]
|
add ebx,[code_start]
|
||||||
@ -3883,11 +3898,10 @@ elf_segment:
|
|||||||
add eax,edi
|
add eax,edi
|
||||||
adc edx,0
|
adc edx,0
|
||||||
adc cl,0
|
adc cl,0
|
||||||
mov dword [org_origin],eax
|
elf_segment_addressing_setup:
|
||||||
mov dword [org_origin+4],edx
|
mov [ds:ebp],eax
|
||||||
mov [org_origin_sign],cl
|
mov [ds:ebp+4],edx
|
||||||
and [org_registers],0
|
mov [ds:ebp+8],cl
|
||||||
mov [org_start],edi
|
|
||||||
inc [number_of_sections]
|
inc [number_of_sections]
|
||||||
jmp instruction_assembled
|
jmp instruction_assembled
|
||||||
close_elf_segment:
|
close_elf_segment:
|
||||||
@ -3935,6 +3949,8 @@ elf_segment:
|
|||||||
elf64_segment:
|
elf64_segment:
|
||||||
call close_elf64_segment
|
call close_elf64_segment
|
||||||
push eax edx
|
push eax edx
|
||||||
|
call create_addressing_space
|
||||||
|
mov ebp,ebx
|
||||||
mov ebx,[number_of_sections]
|
mov ebx,[number_of_sections]
|
||||||
imul ebx,38h
|
imul ebx,38h
|
||||||
add ebx,[code_start]
|
add ebx,[code_start]
|
||||||
@ -4015,13 +4031,7 @@ elf_segment:
|
|||||||
add eax,edi
|
add eax,edi
|
||||||
adc edx,0
|
adc edx,0
|
||||||
adc cl,0
|
adc cl,0
|
||||||
mov dword [org_origin],eax
|
jmp elf_segment_addressing_setup
|
||||||
mov dword [org_origin+4],edx
|
|
||||||
mov [org_origin_sign],cl
|
|
||||||
and [org_registers],0
|
|
||||||
mov [org_start],edi
|
|
||||||
inc [number_of_sections]
|
|
||||||
jmp instruction_assembled
|
|
||||||
close_elf64_segment:
|
close_elf64_segment:
|
||||||
cmp [number_of_sections],0
|
cmp [number_of_sections],0
|
||||||
jne finish_elf64_segment
|
jne finish_elf64_segment
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
; flat assembler core
|
; flat assembler core
|
||||||
; Copyright (c) 1999-2012, Tomasz Grysztar.
|
; Copyright (c) 1999-2013, Tomasz Grysztar.
|
||||||
; All rights reserved.
|
; All rights reserved.
|
||||||
|
|
||||||
_out_of_memory db 'out of memory',0
|
_out_of_memory db 'out of memory',0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
; flat assembler core
|
; flat assembler core
|
||||||
; Copyright (c) 1999-2012, Tomasz Grysztar.
|
; Copyright (c) 1999-2013, Tomasz Grysztar.
|
||||||
; All rights reserved.
|
; All rights reserved.
|
||||||
|
|
||||||
parser:
|
parser:
|
||||||
@ -64,6 +64,8 @@ parser:
|
|||||||
simple_label:
|
simple_label:
|
||||||
pop edi
|
pop edi
|
||||||
call identify_label
|
call identify_label
|
||||||
|
cmp byte [esi+1],':'
|
||||||
|
je block_label
|
||||||
mov byte [edi],2
|
mov byte [edi],2
|
||||||
inc edi
|
inc edi
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
@ -71,6 +73,12 @@ parser:
|
|||||||
xor al,al
|
xor al,al
|
||||||
stos byte [edi]
|
stos byte [edi]
|
||||||
jmp parse_line
|
jmp parse_line
|
||||||
|
block_label:
|
||||||
|
mov byte [edi],4
|
||||||
|
inc edi
|
||||||
|
stos dword [edi]
|
||||||
|
add esi,2
|
||||||
|
jmp parse_line
|
||||||
constant_label:
|
constant_label:
|
||||||
pop edi
|
pop edi
|
||||||
call get_label_id
|
call get_label_id
|
||||||
@ -127,8 +135,6 @@ parser:
|
|||||||
cmp al,':'
|
cmp al,':'
|
||||||
je invalid_name
|
je invalid_name
|
||||||
dec esi
|
dec esi
|
||||||
cmp al,3Bh
|
|
||||||
je skip_rest_of_line
|
|
||||||
mov [parenthesis_stack],0
|
mov [parenthesis_stack],0
|
||||||
call parse_argument
|
call parse_argument
|
||||||
jmp parse_next_line
|
jmp parse_next_line
|
||||||
@ -530,6 +536,8 @@ parse_line_contents:
|
|||||||
je unallowed_character
|
je unallowed_character
|
||||||
cmp al,'`'
|
cmp al,'`'
|
||||||
je unallowed_character
|
je unallowed_character
|
||||||
|
cmp al,3Bh
|
||||||
|
je foreign_argument
|
||||||
dec esi
|
dec esi
|
||||||
cmp al,1Ah
|
cmp al,1Ah
|
||||||
jne expression_argument
|
jne expression_argument
|
||||||
@ -550,6 +558,10 @@ parse_line_contents:
|
|||||||
pop edi
|
pop edi
|
||||||
movs byte [edi],[esi]
|
movs byte [edi],[esi]
|
||||||
jmp argument_parsed
|
jmp argument_parsed
|
||||||
|
foreign_argument:
|
||||||
|
dec esi
|
||||||
|
call skip_foreign_line
|
||||||
|
jmp contents_parsed
|
||||||
symbol_argument:
|
symbol_argument:
|
||||||
pop edi
|
pop edi
|
||||||
stos word [edi]
|
stos word [edi]
|
||||||
@ -560,7 +572,7 @@ parse_line_contents:
|
|||||||
je ptr_argument
|
je ptr_argument
|
||||||
stos byte [edi]
|
stos byte [edi]
|
||||||
cmp al,80h
|
cmp al,80h
|
||||||
je forced_expression
|
je forced_multipart_expression
|
||||||
cmp al,8Ch
|
cmp al,8Ch
|
||||||
je forced_expression
|
je forced_expression
|
||||||
cmp al,81h
|
cmp al,81h
|
||||||
@ -725,7 +737,7 @@ parse_line_contents:
|
|||||||
jmp argument_parsed
|
jmp argument_parsed
|
||||||
parse_from_operator:
|
parse_from_operator:
|
||||||
cmp byte [esi],22h
|
cmp byte [esi],22h
|
||||||
jne forced_expression
|
jne forced_multipart_expression
|
||||||
jmp argument_parsed
|
jmp argument_parsed
|
||||||
parse_quoted_extrn:
|
parse_quoted_extrn:
|
||||||
inc esi
|
inc esi
|
||||||
@ -771,14 +783,10 @@ parse_line_contents:
|
|||||||
mov eax,[esi+1]
|
mov eax,[esi+1]
|
||||||
lea ebx,[esi+5+eax]
|
lea ebx,[esi+5+eax]
|
||||||
push ebx ecx esi edi
|
push ebx ecx esi edi
|
||||||
mov al,'('
|
call parse_expression
|
||||||
stos byte [edi]
|
|
||||||
call convert_expression
|
|
||||||
mov al,')'
|
|
||||||
stos byte [edi]
|
|
||||||
pop eax edx ecx ebx
|
pop eax edx ecx ebx
|
||||||
cmp esi,ebx
|
cmp esi,ebx
|
||||||
jne expression_parsed
|
jne expression_argument_parsed
|
||||||
mov edi,eax
|
mov edi,eax
|
||||||
mov esi,edx
|
mov esi,edx
|
||||||
string_argument:
|
string_argument:
|
||||||
@ -799,7 +807,14 @@ parse_line_contents:
|
|||||||
rep movs dword [edi],[esi]
|
rep movs dword [edi],[esi]
|
||||||
xor al,al
|
xor al,al
|
||||||
stos byte [edi]
|
stos byte [edi]
|
||||||
jmp expression_parsed
|
jmp expression_argument_parsed
|
||||||
|
parse_expression:
|
||||||
|
mov al,'('
|
||||||
|
stos byte [edi]
|
||||||
|
call convert_expression
|
||||||
|
mov al,')'
|
||||||
|
stos byte [edi]
|
||||||
|
ret
|
||||||
not_string:
|
not_string:
|
||||||
cmp byte [esi],'('
|
cmp byte [esi],'('
|
||||||
jne expression
|
jne expression
|
||||||
@ -838,24 +853,27 @@ parse_line_contents:
|
|||||||
mov al,0F1h
|
mov al,0F1h
|
||||||
jmp expression_comparator
|
jmp expression_comparator
|
||||||
expression:
|
expression:
|
||||||
mov al,'('
|
call parse_expression
|
||||||
stos byte [edi]
|
jmp expression_argument_parsed
|
||||||
call convert_expression
|
|
||||||
mov al,')'
|
|
||||||
stos byte [edi]
|
|
||||||
jmp expression_parsed
|
|
||||||
forced_expression:
|
forced_expression:
|
||||||
xor al,al
|
xor al,al
|
||||||
xchg al,[formatter_symbols_allowed]
|
xchg al,[formatter_symbols_allowed]
|
||||||
push eax
|
push eax
|
||||||
mov al,'('
|
call parse_expression
|
||||||
stos byte [edi]
|
forced_expression_parsed:
|
||||||
call convert_expression
|
|
||||||
mov al,')'
|
|
||||||
stos byte [edi]
|
|
||||||
pop eax
|
pop eax
|
||||||
mov [formatter_symbols_allowed],al
|
mov [formatter_symbols_allowed],al
|
||||||
jmp argument_parsed
|
jmp argument_parsed
|
||||||
|
forced_multipart_expression:
|
||||||
|
xor al,al
|
||||||
|
xchg al,[formatter_symbols_allowed]
|
||||||
|
push eax
|
||||||
|
call parse_expression
|
||||||
|
cmp byte [esi],':'
|
||||||
|
jne forced_expression_parsed
|
||||||
|
movs byte [edi],[esi]
|
||||||
|
call parse_expression
|
||||||
|
jmp forced_expression_parsed
|
||||||
address_argument:
|
address_argument:
|
||||||
call parse_address
|
call parse_address
|
||||||
lods byte [esi]
|
lods byte [esi]
|
||||||
@ -925,7 +943,7 @@ parse_line_contents:
|
|||||||
dec [parenthesis_stack]
|
dec [parenthesis_stack]
|
||||||
add esp,8
|
add esp,8
|
||||||
jmp argument_parsed
|
jmp argument_parsed
|
||||||
expression_parsed:
|
expression_argument_parsed:
|
||||||
cmp [parenthesis_stack],0
|
cmp [parenthesis_stack],0
|
||||||
je parse_argument
|
je parse_argument
|
||||||
cmp byte [esi],')'
|
cmp byte [esi],')'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
; flat assembler core
|
; flat assembler core
|
||||||
; Copyright (c) 1999-2012, Tomasz Grysztar.
|
; Copyright (c) 1999-2013, Tomasz Grysztar.
|
||||||
; All rights reserved.
|
; All rights reserved.
|
||||||
|
|
||||||
preprocessor:
|
preprocessor:
|
||||||
@ -38,7 +38,7 @@ preprocessor:
|
|||||||
mov [labels_list],eax
|
mov [labels_list],eax
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
mov [source_start],eax
|
mov [source_start],eax
|
||||||
mov [display_buffer],eax
|
mov [tagged_blocks],eax
|
||||||
mov [hash_tree],eax
|
mov [hash_tree],eax
|
||||||
mov [error],eax
|
mov [error],eax
|
||||||
mov [macro_status],al
|
mov [macro_status],al
|
||||||
@ -195,13 +195,13 @@ convert_line:
|
|||||||
lods byte [esi]
|
lods byte [esi]
|
||||||
stos byte [edi]
|
stos byte [edi]
|
||||||
cmp al,0Ah
|
cmp al,0Ah
|
||||||
je missing_end_quote
|
je no_end_quote
|
||||||
cmp al,0Dh
|
cmp al,0Dh
|
||||||
je missing_end_quote
|
je no_end_quote
|
||||||
or al,al
|
or al,al
|
||||||
jz missing_end_quote
|
jz no_end_quote
|
||||||
cmp al,1Ah
|
cmp al,1Ah
|
||||||
je missing_end_quote
|
je no_end_quote
|
||||||
cmp al,ah
|
cmp al,ah
|
||||||
jne copy_string
|
jne copy_string
|
||||||
lods byte [esi]
|
lods byte [esi]
|
||||||
@ -243,6 +243,9 @@ convert_line:
|
|||||||
stos byte [edi]
|
stos byte [edi]
|
||||||
inc byte [ecx]
|
inc byte [ecx]
|
||||||
jmp group_backslashes
|
jmp group_backslashes
|
||||||
|
no_end_quote:
|
||||||
|
mov byte [ebx-5],0
|
||||||
|
jmp missing_end_quote
|
||||||
backslashed_symbol:
|
backslashed_symbol:
|
||||||
cmp al,1Ah
|
cmp al,1Ah
|
||||||
je unexpected_end_of_file
|
je unexpected_end_of_file
|
||||||
@ -554,6 +557,9 @@ preprocess_line:
|
|||||||
call get_preprocessor_symbol
|
call get_preprocessor_symbol
|
||||||
jnc symbolic_constant_in_label
|
jnc symbolic_constant_in_label
|
||||||
lea esi,[esi+ecx+1]
|
lea esi,[esi+ecx+1]
|
||||||
|
cmp byte [esi],':'
|
||||||
|
jne preprocess_instruction
|
||||||
|
inc esi
|
||||||
jmp preprocess_instruction
|
jmp preprocess_instruction
|
||||||
symbolic_constant_in_label:
|
symbolic_constant_in_label:
|
||||||
mov ebx,[edx+8]
|
mov ebx,[edx+8]
|
||||||
@ -571,6 +577,9 @@ preprocess_line:
|
|||||||
cmp byte [ebx],':'
|
cmp byte [ebx],':'
|
||||||
jne label_broken
|
jne label_broken
|
||||||
inc ebx
|
inc ebx
|
||||||
|
cmp byte [ebx],':'
|
||||||
|
jne check_for_broken_label
|
||||||
|
inc ebx
|
||||||
jmp check_for_broken_label
|
jmp check_for_broken_label
|
||||||
label_broken:
|
label_broken:
|
||||||
push line_preprocessed
|
push line_preprocessed
|
||||||
@ -1685,6 +1694,7 @@ do_irp:
|
|||||||
or [default_argument_value],-1
|
or [default_argument_value],-1
|
||||||
call skip_macro_argument_value
|
call skip_macro_argument_value
|
||||||
inc esi
|
inc esi
|
||||||
|
jmp irp_parameters_start
|
||||||
irps_name_ok:
|
irps_name_ok:
|
||||||
cmp al,','
|
cmp al,','
|
||||||
jne invalid_macro_arguments
|
jne invalid_macro_arguments
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
; flat assembler core
|
; flat assembler core
|
||||||
; Copyright (c) 1999-2012, Tomasz Grysztar.
|
; Copyright (c) 1999-2013, Tomasz Grysztar.
|
||||||
; All rights reserved.
|
; All rights reserved.
|
||||||
|
|
||||||
dump_symbols:
|
dump_symbols:
|
||||||
@ -8,14 +8,14 @@ dump_symbols:
|
|||||||
call setup_dump_header
|
call setup_dump_header
|
||||||
mov esi,[input_file]
|
mov esi,[input_file]
|
||||||
call copy_asciiz
|
call copy_asciiz
|
||||||
cmp edi,[display_buffer]
|
cmp edi,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
mov eax,edi
|
mov eax,edi
|
||||||
sub eax,ebx
|
sub eax,ebx
|
||||||
mov [ebx-40h+0Ch],eax
|
mov [ebx-40h+0Ch],eax
|
||||||
mov esi,[output_file]
|
mov esi,[output_file]
|
||||||
call copy_asciiz
|
call copy_asciiz
|
||||||
cmp edi,[display_buffer]
|
cmp edi,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
mov edx,[symbols_stream]
|
mov edx,[symbols_stream]
|
||||||
mov ebp,[free_additional_memory]
|
mov ebp,[free_additional_memory]
|
||||||
@ -53,7 +53,7 @@ dump_symbols:
|
|||||||
rep movs byte [edi],[esi]
|
rep movs byte [edi],[esi]
|
||||||
mov byte [edi],0
|
mov byte [edi],0
|
||||||
inc edi
|
inc edi
|
||||||
cmp edi,[display_buffer]
|
cmp edi,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
jmp prepare_strings_table
|
jmp prepare_strings_table
|
||||||
prepare_section_string:
|
prepare_section_string:
|
||||||
@ -76,7 +76,7 @@ dump_symbols:
|
|||||||
add esi,[resource_data]
|
add esi,[resource_data]
|
||||||
copy_elf_section_name:
|
copy_elf_section_name:
|
||||||
lods byte [esi]
|
lods byte [esi]
|
||||||
cmp edi,[display_buffer]
|
cmp edi,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
stos byte [edi]
|
stos byte [edi]
|
||||||
test al,al
|
test al,al
|
||||||
@ -87,11 +87,11 @@ dump_symbols:
|
|||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
mov ax,'t'
|
mov ax,'t'
|
||||||
stos word [edi]
|
stos word [edi]
|
||||||
cmp edi,[display_buffer]
|
cmp edi,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
jmp prepare_strings_table
|
jmp prepare_strings_table
|
||||||
strings_table_ready:
|
strings_table_ready:
|
||||||
mov edx,[display_buffer]
|
mov edx,[tagged_blocks]
|
||||||
mov ebp,[memory_end]
|
mov ebp,[memory_end]
|
||||||
sub ebp,[labels_list]
|
sub ebp,[labels_list]
|
||||||
add ebp,edx
|
add ebp,edx
|
||||||
@ -117,7 +117,7 @@ dump_symbols:
|
|||||||
mov [edx+24],eax
|
mov [edx+24],eax
|
||||||
movzx ecx,byte [esi-1]
|
movzx ecx,byte [esi-1]
|
||||||
lea eax,[edi+ecx+1]
|
lea eax,[edi+ecx+1]
|
||||||
cmp edi,[display_buffer]
|
cmp edi,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
rep movsb
|
rep movsb
|
||||||
xor al,al
|
xor al,al
|
||||||
@ -129,6 +129,13 @@ dump_symbols:
|
|||||||
sub eax,[memory_start]
|
sub eax,[memory_start]
|
||||||
mov [edx+28],eax
|
mov [edx+28],eax
|
||||||
label_dump_line_ok:
|
label_dump_line_ok:
|
||||||
|
test byte [edx+9],4
|
||||||
|
jz convert_base_symbol_for_label
|
||||||
|
xor eax,eax
|
||||||
|
mov [edx],eax
|
||||||
|
mov [edx+4],eax
|
||||||
|
jmp base_symbol_for_label_ok
|
||||||
|
convert_base_symbol_for_label:
|
||||||
mov eax,[edx+20]
|
mov eax,[edx+20]
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jz base_symbol_for_label_ok
|
jz base_symbol_for_label_ok
|
||||||
@ -172,7 +179,7 @@ dump_symbols:
|
|||||||
mov esi,[labels_list]
|
mov esi,[labels_list]
|
||||||
mov ebp,edi
|
mov ebp,edi
|
||||||
make_lines_dump:
|
make_lines_dump:
|
||||||
cmp esi,[display_buffer]
|
cmp esi,[tagged_blocks]
|
||||||
je lines_dump_ok
|
je lines_dump_ok
|
||||||
mov eax,[esi-4]
|
mov eax,[esi-4]
|
||||||
mov ecx,[esi-8]
|
mov ecx,[esi-8]
|
||||||
@ -185,11 +192,13 @@ dump_symbols:
|
|||||||
add dword [ebx-40h+3Ch],8
|
add dword [ebx-40h+3Ch],8
|
||||||
jmp make_lines_dump
|
jmp make_lines_dump
|
||||||
process_line_dump:
|
process_line_dump:
|
||||||
|
push ebx
|
||||||
|
mov ebx,[esi+8]
|
||||||
mov eax,[esi+4]
|
mov eax,[esi+4]
|
||||||
sub eax,[code_start]
|
sub eax,[code_start]
|
||||||
add eax,[headers_size]
|
add eax,[headers_size]
|
||||||
cmp byte [esi+1Ah],0
|
test byte [ebx+0Ah],1
|
||||||
je store_offset
|
jz store_offset
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
store_offset:
|
store_offset:
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
@ -199,15 +208,15 @@ dump_symbols:
|
|||||||
mov eax,[esi+4]
|
mov eax,[esi+4]
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
xor cl,cl
|
xor cl,cl
|
||||||
sub eax,[esi+8]
|
sub eax,[ebx]
|
||||||
sbb edx,[esi+8+4]
|
sbb edx,[ebx+4]
|
||||||
sbb cl,[esi+1Bh]
|
sbb cl,[ebx+8]
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
mov eax,edx
|
mov eax,edx
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
mov eax,[esi+10h]
|
mov eax,[ebx+10h]
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
mov eax,[esi+14h]
|
mov eax,[ebx+14h]
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jz base_symbol_for_line_ok
|
jz base_symbol_for_line_ok
|
||||||
cmp eax,[symbols_stream]
|
cmp eax,[symbols_stream]
|
||||||
@ -216,11 +225,17 @@ dump_symbols:
|
|||||||
xor eax,eax
|
xor eax,eax
|
||||||
base_symbol_for_line_ok:
|
base_symbol_for_line_ok:
|
||||||
stos dword [edi]
|
stos dword [edi]
|
||||||
mov eax,[esi+18h]
|
mov al,[ebx+9]
|
||||||
and eax,01FFFFh
|
stos byte [edi]
|
||||||
stos dword [edi]
|
mov al,[esi+10h]
|
||||||
mov [edi-1],cl
|
stos byte [edi]
|
||||||
cmp edi,[display_buffer]
|
mov al,[ebx+0Ah]
|
||||||
|
and al,1
|
||||||
|
stos byte [edi]
|
||||||
|
mov al,cl
|
||||||
|
stos byte [edi]
|
||||||
|
pop ebx
|
||||||
|
cmp edi,[tagged_blocks]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
mov eax,edi
|
mov eax,edi
|
||||||
sub eax,1Ch
|
sub eax,1Ch
|
||||||
@ -264,7 +279,7 @@ dump_symbols:
|
|||||||
add ecx,40h
|
add ecx,40h
|
||||||
call write
|
call write
|
||||||
jc write_failed
|
jc write_failed
|
||||||
mov edx,[display_buffer]
|
mov edx,[tagged_blocks]
|
||||||
mov ecx,[memory_end]
|
mov ecx,[memory_end]
|
||||||
sub ecx,[labels_list]
|
sub ecx,[labels_list]
|
||||||
call write
|
call write
|
||||||
@ -287,7 +302,7 @@ dump_symbols:
|
|||||||
mov esi,[labels_list]
|
mov esi,[labels_list]
|
||||||
mov edi,[memory_start]
|
mov edi,[memory_start]
|
||||||
make_references_dump:
|
make_references_dump:
|
||||||
cmp esi,[display_buffer]
|
cmp esi,[tagged_blocks]
|
||||||
je references_dump_ok
|
je references_dump_ok
|
||||||
mov eax,[esi-4]
|
mov eax,[esi-4]
|
||||||
mov ecx,[esi-8]
|
mov ecx,[esi-8]
|
||||||
@ -306,7 +321,7 @@ dump_symbols:
|
|||||||
stosd
|
stosd
|
||||||
mov eax,edx
|
mov eax,edx
|
||||||
stosd
|
stosd
|
||||||
cmp edi,[display_buffer]
|
cmp edi,[tagged_blocks]
|
||||||
jb make_references_dump
|
jb make_references_dump
|
||||||
jmp out_of_memory
|
jmp out_of_memory
|
||||||
references_dump_ok:
|
references_dump_ok:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
; flat assembler core
|
; flat assembler core
|
||||||
; Copyright (c) 1999-2012, Tomasz Grysztar.
|
; Copyright (c) 1999-2013, Tomasz Grysztar.
|
||||||
; All rights reserved.
|
; All rights reserved.
|
||||||
|
|
||||||
include_variable db 'INCLUDE',0
|
include_variable db 'INCLUDE',0
|
||||||
@ -563,6 +563,10 @@ instructions_3:
|
|||||||
db 'xor',30h
|
db 'xor',30h
|
||||||
dw basic_instruction-instruction_handler
|
dw basic_instruction-instruction_handler
|
||||||
instructions_4:
|
instructions_4:
|
||||||
|
db 'adcx',66h
|
||||||
|
dw adx_instruction-instruction_handler
|
||||||
|
db 'adox',0F3h
|
||||||
|
dw adx_instruction-instruction_handler
|
||||||
db 'andn',0F2h
|
db 'andn',0F2h
|
||||||
dw andn_instruction-instruction_handler
|
dw andn_instruction-instruction_handler
|
||||||
db 'arpl',0
|
db 'arpl',0
|
||||||
@ -581,6 +585,8 @@ instructions_4:
|
|||||||
dw call_instruction-instruction_handler
|
dw call_instruction-instruction_handler
|
||||||
db 'cdqe',98h
|
db 'cdqe',98h
|
||||||
dw simple_instruction_64bit-instruction_handler
|
dw simple_instruction_64bit-instruction_handler
|
||||||
|
db 'clac',0CAh
|
||||||
|
dw simple_vmx_instruction-instruction_handler
|
||||||
db 'clgi',0DDh
|
db 'clgi',0DDh
|
||||||
dw simple_vmx_instruction-instruction_handler
|
dw simple_vmx_instruction-instruction_handler
|
||||||
db 'clts',6
|
db 'clts',6
|
||||||
@ -783,6 +789,8 @@ instructions_4:
|
|||||||
dw pm_store_word_instruction-instruction_handler
|
dw pm_store_word_instruction-instruction_handler
|
||||||
db 'smsw',14h
|
db 'smsw',14h
|
||||||
dw pm_store_word_instruction-instruction_handler
|
dw pm_store_word_instruction-instruction_handler
|
||||||
|
db 'stac',0CBh
|
||||||
|
dw simple_vmx_instruction-instruction_handler
|
||||||
db 'stgi',0DCh
|
db 'stgi',0DCh
|
||||||
dw simple_vmx_instruction-instruction_handler
|
dw simple_vmx_instruction-instruction_handler
|
||||||
db 'stos',0AAh
|
db 'stos',0AAh
|
||||||
@ -1551,6 +1559,8 @@ instructions_6:
|
|||||||
dw simple_extended_instruction_64bit-instruction_handler
|
dw simple_extended_instruction_64bit-instruction_handler
|
||||||
db 'rdrand',110b
|
db 'rdrand',110b
|
||||||
dw rdrand_instruction-instruction_handler
|
dw rdrand_instruction-instruction_handler
|
||||||
|
db 'rdseed',111b
|
||||||
|
dw rdrand_instruction-instruction_handler
|
||||||
db 'rdtscp',1
|
db 'rdtscp',1
|
||||||
dw rdtscp_instruction-instruction_handler
|
dw rdtscp_instruction-instruction_handler
|
||||||
db 'repeat',0
|
db 'repeat',0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
; flat assembler core variables
|
; flat assembler core variables
|
||||||
; Copyright (c) 1999-2012, Tomasz Grysztar.
|
; Copyright (c) 1999-2013, 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:
|
||||||
@ -50,10 +50,7 @@ labels_list dd ?
|
|||||||
label_hash dd ?
|
label_hash dd ?
|
||||||
label_leaf dd ?
|
label_leaf dd ?
|
||||||
hash_tree dd ?
|
hash_tree dd ?
|
||||||
org_origin dq ?
|
addressing_space dd ?
|
||||||
org_registers dd ?
|
|
||||||
org_symbol dd ?
|
|
||||||
org_start dd ?
|
|
||||||
undefined_data_start dd ?
|
undefined_data_start dd ?
|
||||||
undefined_data_end dd ?
|
undefined_data_end dd ?
|
||||||
counter dd ?
|
counter dd ?
|
||||||
@ -61,7 +58,7 @@ counter_limit dd ?
|
|||||||
error_info dd ?
|
error_info dd ?
|
||||||
error_line dd ?
|
error_line dd ?
|
||||||
error dd ?
|
error dd ?
|
||||||
display_buffer dd ?
|
tagged_blocks dd ?
|
||||||
structures_buffer dd ?
|
structures_buffer dd ?
|
||||||
number_start dd ?
|
number_start dd ?
|
||||||
current_offset dd ?
|
current_offset dd ?
|
||||||
@ -131,16 +128,15 @@ compare_type db ?
|
|||||||
logical_value_wrapping db ?
|
logical_value_wrapping db ?
|
||||||
next_pass_needed db ?
|
next_pass_needed db ?
|
||||||
output_format db ?
|
output_format db ?
|
||||||
labels_type db ?
|
|
||||||
code_type db ?
|
code_type db ?
|
||||||
virtual_data db ?
|
|
||||||
org_origin_sign db ?
|
|
||||||
adjustment_sign db ?
|
adjustment_sign db ?
|
||||||
|
|
||||||
macro_status db ?
|
macro_status db ?
|
||||||
default_argument_value db ?
|
default_argument_value db ?
|
||||||
prefixed_instruction db ?
|
prefixed_instruction db ?
|
||||||
formatter_symbols_allowed db ?
|
formatter_symbols_allowed db ?
|
||||||
|
free_address_range db ?
|
||||||
|
|
||||||
|
|
||||||
characters rb 100h
|
characters rb 100h
|
||||||
converted rb 100h
|
converted rb 100h
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
; flat assembler version 1.70
|
; flat assembler version 1.71
|
||||||
; Copyright (c) 1999-2012, Tomasz Grysztar.
|
; Copyright (c) 1999-2013, 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.70.03"
|
VERSION_STRING equ "1.71.13"
|
||||||
|
|
||||||
VERSION_MAJOR = 1
|
VERSION_MAJOR = 1
|
||||||
VERSION_MINOR = 70
|
VERSION_MINOR = 71
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
; flat assembler core
|
; flat assembler core
|
||||||
; Copyright (c) 1999-2012, Tomasz Grysztar.
|
; Copyright (c) 1999-2013, Tomasz Grysztar.
|
||||||
; All rights reserved.
|
; All rights reserved.
|
||||||
|
|
||||||
simple_instruction_except64:
|
simple_instruction_except64:
|
||||||
@ -2989,6 +2989,7 @@ jmp_instruction:
|
|||||||
jmp instruction_assembled
|
jmp instruction_assembled
|
||||||
calculate_jump_offset:
|
calculate_jump_offset:
|
||||||
add edi,2
|
add edi,2
|
||||||
|
mov ebp,[addressing_space]
|
||||||
call calculate_relative_offset
|
call calculate_relative_offset
|
||||||
sub edi,2
|
sub edi,2
|
||||||
ret
|
ret
|
||||||
@ -5982,6 +5983,27 @@ movbe_instruction:
|
|||||||
mov al,[operand_size]
|
mov al,[operand_size]
|
||||||
call operand_autodetect
|
call operand_autodetect
|
||||||
jmp instruction_ready
|
jmp instruction_ready
|
||||||
|
adx_instruction:
|
||||||
|
mov [base_code],0Fh
|
||||||
|
mov [extended_code],38h
|
||||||
|
mov [supplemental_code],0F6h
|
||||||
|
mov [operand_prefix],al
|
||||||
|
call get_reg_mem
|
||||||
|
jc adx_reg_reg
|
||||||
|
mov al,[operand_size]
|
||||||
|
cmp al,4
|
||||||
|
je instruction_ready
|
||||||
|
cmp al,8
|
||||||
|
jne invalid_operand_size
|
||||||
|
call operand_64bit
|
||||||
|
jmp instruction_ready
|
||||||
|
adx_reg_reg:
|
||||||
|
cmp ah,4
|
||||||
|
je nomem_instruction_ready
|
||||||
|
cmp ah,8
|
||||||
|
jne invalid_operand_size
|
||||||
|
call operand_64bit
|
||||||
|
jmp nomem_instruction_ready
|
||||||
|
|
||||||
simple_vmx_instruction:
|
simple_vmx_instruction:
|
||||||
mov ah,al
|
mov ah,al
|
||||||
@ -6251,6 +6273,7 @@ xbegin_instruction:
|
|||||||
xbegin_16bit:
|
xbegin_16bit:
|
||||||
call get_address_word_value
|
call get_address_word_value
|
||||||
add edi,4
|
add edi,4
|
||||||
|
mov ebp,[addressing_space]
|
||||||
call calculate_relative_offset
|
call calculate_relative_offset
|
||||||
sub edi,4
|
sub edi,4
|
||||||
shl eax,16
|
shl eax,16
|
||||||
@ -6264,6 +6287,7 @@ xbegin_instruction:
|
|||||||
call get_address_qword_value
|
call get_address_qword_value
|
||||||
xbegin_address_ok:
|
xbegin_address_ok:
|
||||||
add edi,5
|
add edi,5
|
||||||
|
mov ebp,[addressing_space]
|
||||||
call calculate_relative_offset
|
call calculate_relative_offset
|
||||||
sub edi,5
|
sub edi,5
|
||||||
mov edx,eax
|
mov edx,eax
|
||||||
@ -6383,6 +6407,7 @@ get_jump_operator:
|
|||||||
get_address:
|
get_address:
|
||||||
mov [segment_register],0
|
mov [segment_register],0
|
||||||
mov [address_size],0
|
mov [address_size],0
|
||||||
|
mov [free_address_range],0
|
||||||
mov al,[code_type]
|
mov al,[code_type]
|
||||||
shr al,3
|
shr al,3
|
||||||
mov [value_size],al
|
mov [value_size],al
|
||||||
@ -6422,6 +6447,7 @@ get_address:
|
|||||||
mov edx,[address_symbol]
|
mov edx,[address_symbol]
|
||||||
mov [symbol_identifier],edx
|
mov [symbol_identifier],edx
|
||||||
mov edx,[address_high]
|
mov edx,[address_high]
|
||||||
|
mov ebp,[addressing_space]
|
||||||
call calculate_relative_offset
|
call calculate_relative_offset
|
||||||
mov [address_high],edx
|
mov [address_high],edx
|
||||||
cdq
|
cdq
|
||||||
|
@ -55,11 +55,15 @@ macro proc [args] ; define procedure
|
|||||||
prologue@proc equ prologuedef
|
prologue@proc equ prologuedef
|
||||||
|
|
||||||
macro prologuedef procname,flag,parmbytes,localbytes,reglist
|
macro prologuedef procname,flag,parmbytes,localbytes,reglist
|
||||||
{ if parmbytes | localbytes
|
{ local loc
|
||||||
|
loc = (localbytes+3) and (not 3)
|
||||||
|
parmbase@proc equ ebp+8
|
||||||
|
localbase@proc equ ebp-loc
|
||||||
|
if parmbytes | localbytes
|
||||||
push ebp
|
push ebp
|
||||||
mov ebp,esp
|
mov ebp,esp
|
||||||
if localbytes
|
if localbytes
|
||||||
sub esp,localbytes
|
sub esp,loc
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
irps reg, reglist \{ push reg \} }
|
irps reg, reglist \{ push reg \} }
|
||||||
@ -77,6 +81,8 @@ macro epiloguedef procname,flag,parmbytes,localbytes,reglist
|
|||||||
retn parmbytes
|
retn parmbytes
|
||||||
end if }
|
end if }
|
||||||
|
|
||||||
|
close@proc equ
|
||||||
|
|
||||||
macro define@proc name,statement
|
macro define@proc name,statement
|
||||||
{ local params,flag,regs,parmbytes,localbytes,current
|
{ local params,flag,regs,parmbytes,localbytes,current
|
||||||
if used name
|
if used name
|
||||||
@ -91,22 +97,22 @@ macro define@proc name,statement
|
|||||||
flag = 10001b \}
|
flag = 10001b \}
|
||||||
match =params, params \{ params equ statement
|
match =params, params \{ params equ statement
|
||||||
flag = 0 \}
|
flag = 0 \}
|
||||||
virtual at ebp+8
|
|
||||||
match =uses reglist=,args, params \{ regs equ reglist
|
match =uses reglist=,args, params \{ regs equ reglist
|
||||||
params equ args \}
|
params equ args \}
|
||||||
match =regs =uses reglist, regs params \{ regs equ reglist
|
match =regs =uses reglist, regs params \{ regs equ reglist
|
||||||
params equ \}
|
params equ \}
|
||||||
match =regs, regs \{ regs equ \}
|
match =regs, regs \{ regs equ \}
|
||||||
|
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
|
||||||
|
virtual at parmbase@proc
|
||||||
match =,args, params \{ defargs@proc args \}
|
match =,args, params \{ defargs@proc args \}
|
||||||
match =args@proc args, args@proc params \{ defargs@proc args \}
|
match =args@proc args, args@proc params \{ defargs@proc args \}
|
||||||
parmbytes = $ - (ebp+8)
|
parmbytes = $-(parmbase@proc)
|
||||||
end virtual
|
end virtual
|
||||||
name # % = parmbytes/4
|
name # % = parmbytes/4
|
||||||
all@vars equ
|
all@vars equ
|
||||||
current = 0
|
current = 0
|
||||||
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
|
|
||||||
macro locals
|
macro locals
|
||||||
\{ virtual at ebp-localbytes+current
|
\{ virtual at localbase@proc+current
|
||||||
macro label def \\{ match . type,def> \\\{ deflocal@proc .,label,<type \\\} \\}
|
macro label def \\{ match . type,def> \\\{ deflocal@proc .,label,<type \\\} \\}
|
||||||
struc db [val] \\{ \common deflocal@proc .,db,val \\}
|
struc db [val] \\{ \common deflocal@proc .,db,val \\}
|
||||||
struc du [val] \\{ \common deflocal@proc .,du,val \\}
|
struc du [val] \\{ \common deflocal@proc .,du,val \\}
|
||||||
@ -125,13 +131,14 @@ macro define@proc name,statement
|
|||||||
\{ purge label
|
\{ purge label
|
||||||
restruc db,du,dw,dp,dd,dt,dq
|
restruc db,du,dw,dp,dd,dt,dq
|
||||||
restruc rb,rw,rp,rd,rt,rq
|
restruc rb,rw,rp,rd,rt,rq
|
||||||
current = $-(ebp-localbytes)
|
current = $-(localbase@proc)
|
||||||
end virtual \}
|
end virtual \}
|
||||||
macro ret operand
|
macro ret operand
|
||||||
\{ match any, operand \\{ retn operand \\}
|
\{ match any, operand \\{ retn operand \\}
|
||||||
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs>
|
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs> \\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
|
||||||
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
|
macro finish@proc
|
||||||
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2
|
\{ localbytes = current
|
||||||
|
match close:reglist, close@proc:<regs> \\{ close name,flag,parmbytes,localbytes,reglist \\}
|
||||||
end if \} }
|
end if \} }
|
||||||
|
|
||||||
macro defargs@proc [arg]
|
macro defargs@proc [arg]
|
||||||
@ -143,7 +150,9 @@ macro defargs@proc [arg]
|
|||||||
\{ current@arg equ argname
|
\{ current@arg equ argname
|
||||||
label ..arg type
|
label ..arg type
|
||||||
argname equ ..arg
|
argname equ ..arg
|
||||||
if dqword eq type
|
if qqword eq type
|
||||||
|
dd ?,?,?,?,?,?,?,?
|
||||||
|
else if dqword eq type
|
||||||
dd ?,?,?,?
|
dd ?,?,?,?
|
||||||
else if tbyte eq type
|
else if tbyte eq type
|
||||||
dd ?,?,?
|
dd ?,?,?
|
||||||
@ -163,17 +172,19 @@ macro defargs@proc [arg]
|
|||||||
common
|
common
|
||||||
end if }
|
end if }
|
||||||
|
|
||||||
|
macro deflocal@proc name,def,[val] { name def val }
|
||||||
|
|
||||||
macro deflocal@proc name,def,[val]
|
macro deflocal@proc name,def,[val]
|
||||||
{ common
|
{ common
|
||||||
match vars, all@vars \{ all@vars equ all@vars, \}
|
match vars, all@vars \{ all@vars equ all@vars, \}
|
||||||
all@vars equ all@vars name
|
all@vars equ all@vars name
|
||||||
forward
|
forward
|
||||||
local ..var,..tmp
|
local ..var,..tmp
|
||||||
match =label,def \{ ..tmp equ \}
|
..var def val
|
||||||
match tmp,..tmp \{ ..var def val \}
|
|
||||||
match ,..tmp \{ label ..var val \}
|
|
||||||
match =?, val \{ ..tmp equ \}
|
match =?, val \{ ..tmp equ \}
|
||||||
match any =dup (=?), val \{ ..tmp equ \}
|
match any =?, val \{ ..tmp equ \}
|
||||||
|
match any (=?), val \{ ..tmp equ \}
|
||||||
|
match =label, def \{ ..tmp equ \}
|
||||||
match tmp : value, ..tmp : val
|
match tmp : value, ..tmp : val
|
||||||
\{ tmp: end virtual
|
\{ tmp: end virtual
|
||||||
initlocal@proc ..var,def value
|
initlocal@proc ..var,def value
|
||||||
@ -181,6 +192,8 @@ macro deflocal@proc name,def,[val]
|
|||||||
common
|
common
|
||||||
match first rest, ..var, \{ name equ first \} }
|
match first rest, ..var, \{ name equ first \} }
|
||||||
|
|
||||||
|
struc label type { label . type }
|
||||||
|
|
||||||
macro initlocal@proc name,def
|
macro initlocal@proc name,def
|
||||||
{ virtual at name
|
{ virtual at name
|
||||||
def
|
def
|
||||||
@ -238,7 +251,16 @@ macro local [var]
|
|||||||
match =TBYTE, vartype \\{ varname rt count
|
match =TBYTE, vartype \\{ varname rt count
|
||||||
restore done@local \\}
|
restore done@local \\}
|
||||||
match =DQWORD, vartype \\{ label varname dqword
|
match =DQWORD, vartype \\{ label varname dqword
|
||||||
rq count+count
|
rq count*2
|
||||||
|
restore done@local \\}
|
||||||
|
match =QQWORD, vartype \\{ label varname qqword
|
||||||
|
rq count*4
|
||||||
|
restore done@local \\}
|
||||||
|
match =XWORD, vartype \\{ label varname xword
|
||||||
|
rq count*2
|
||||||
|
restore done@local \\}
|
||||||
|
match =YWORD, vartype \\{ label varname yword
|
||||||
|
rq count*4
|
||||||
restore done@local \\}
|
restore done@local \\}
|
||||||
match , done@local \\{ virtual
|
match , done@local \\{ virtual
|
||||||
varname vartype
|
varname vartype
|
||||||
@ -261,6 +283,15 @@ macro local [var]
|
|||||||
match =DQWORD, vartype \\{ label varname dqword
|
match =DQWORD, vartype \\{ label varname dqword
|
||||||
dq ?,?
|
dq ?,?
|
||||||
restore done@local \\}
|
restore done@local \\}
|
||||||
|
match =QQWORD, vartype \\{ label varname qqword
|
||||||
|
dq ?,?,?,?
|
||||||
|
restore done@local \\}
|
||||||
|
match =XWORD, vartype \\{ label varname xword
|
||||||
|
dq ?,?
|
||||||
|
restore done@local \\}
|
||||||
|
match =YWORD, vartype \\{ label varname yword
|
||||||
|
dq ?,?,?,?
|
||||||
|
restore done@local \\}
|
||||||
match , done@local \\{ varname vartype
|
match , done@local \\{ varname vartype
|
||||||
restore done@local \\} \}
|
restore done@local \\} \}
|
||||||
match ,done@local
|
match ,done@local
|
||||||
|
@ -2,53 +2,79 @@
|
|||||||
; Macroinstructions for defining data structures
|
; Macroinstructions for defining data structures
|
||||||
|
|
||||||
macro struct name
|
macro struct name
|
||||||
{ fields@struct equ name
|
{ virtual at 0
|
||||||
|
fields@struct equ name
|
||||||
match child parent, name \{ fields@struct equ child,fields@\#parent \}
|
match child parent, name \{ fields@struct equ child,fields@\#parent \}
|
||||||
sub@struct equ
|
sub@struct equ
|
||||||
struc db [val] \{ \common fields@struct equ fields@struct,.,db,<val> \}
|
struc db [val] \{ \common define field@struct .,db,<val>
|
||||||
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \}
|
fields@struct equ fields@struct,field@struct \}
|
||||||
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \}
|
struc dw [val] \{ \common define field@struct .,dw,<val>
|
||||||
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \}
|
fields@struct equ fields@struct,field@struct \}
|
||||||
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \}
|
struc du [val] \{ \common define field@struct .,du,<val>
|
||||||
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \}
|
fields@struct equ fields@struct,field@struct \}
|
||||||
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \}
|
struc dd [val] \{ \common define field@struct .,dd,<val>
|
||||||
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \}
|
fields@struct equ fields@struct,field@struct \}
|
||||||
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \}
|
struc dp [val] \{ \common define field@struct .,dp,<val>
|
||||||
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \}
|
fields@struct equ fields@struct,field@struct \}
|
||||||
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \}
|
struc dq [val] \{ \common define field@struct .,dq,<val>
|
||||||
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \}
|
fields@struct equ fields@struct,field@struct \}
|
||||||
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \}
|
struc dt [val] \{ \common define field@struct .,dt,<val>
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
|
struc rb count \{ define field@struct .,db,count dup (?)
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
|
struc rw count \{ define field@struct .,dw,count dup (?)
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
|
struc rd count \{ define field@struct .,dd,count dup (?)
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
|
struc rp count \{ define field@struct .,dp,count dup (?)
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
|
struc rq count \{ define field@struct .,dq,count dup (?)
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
|
struc rt count \{ define field@struct .,dt,count dup (?)
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
macro db [val] \{ \common \local anonymous
|
macro db [val] \{ \common \local anonymous
|
||||||
fields@struct equ fields@struct,anonymous,db,<val> \}
|
define field@struct anonymous,db,<val>
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
macro dw [val] \{ \common \local anonymous
|
macro dw [val] \{ \common \local anonymous
|
||||||
fields@struct equ fields@struct,anonymous,dw,<val> \}
|
define field@struct anonymous,dw,<val>
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
macro du [val] \{ \common \local anonymous
|
macro du [val] \{ \common \local anonymous
|
||||||
fields@struct equ fields@struct,anonymous,du,<val> \}
|
define field@struct anonymous,du,<val>
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
macro dd [val] \{ \common \local anonymous
|
macro dd [val] \{ \common \local anonymous
|
||||||
fields@struct equ fields@struct,anonymous,dd,<val> \}
|
define field@struct anonymous,dd,<val>
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
macro dp [val] \{ \common \local anonymous
|
macro dp [val] \{ \common \local anonymous
|
||||||
fields@struct equ fields@struct,anonymous,dp,<val> \}
|
define field@struct anonymous,dp,<val>
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
macro dq [val] \{ \common \local anonymous
|
macro dq [val] \{ \common \local anonymous
|
||||||
fields@struct equ fields@struct,anonymous,dq,<val> \}
|
define field@struct anonymous,dq,<val>
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
macro dt [val] \{ \common \local anonymous
|
macro dt [val] \{ \common \local anonymous
|
||||||
fields@struct equ fields@struct,anonymous,dt,<val> \}
|
define field@struct anonymous,dt,<val>
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
macro rb count \{ \local anonymous
|
macro rb count \{ \local anonymous
|
||||||
fields@struct equ fields@struct,anonymous,db,count dup (?) \}
|
define field@struct anonymous,db,count dup (?)
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
macro rw count \{ \local anonymous
|
macro rw count \{ \local anonymous
|
||||||
fields@struct equ fields@struct,anonymous,dw,count dup (?) \}
|
define field@struct anonymous,dw,count dup (?)
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
macro rd count \{ \local anonymous
|
macro rd count \{ \local anonymous
|
||||||
fields@struct equ fields@struct,anonymous,dd,count dup (?) \}
|
define field@struct anonymous,dd,count dup (?)
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
macro rp count \{ \local anonymous
|
macro rp count \{ \local anonymous
|
||||||
fields@struct equ fields@struct,anonymous,dp,count dup (?) \}
|
define field@struct anonymous,dp,count dup (?)
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
macro rq count \{ \local anonymous
|
macro rq count \{ \local anonymous
|
||||||
fields@struct equ fields@struct,anonymous,dq,count dup (?) \}
|
define field@struct anonymous,dq,count dup (?)
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
macro rt count \{ \local anonymous
|
macro rt count \{ \local anonymous
|
||||||
fields@struct equ fields@struct,anonymous,dt,count dup (?) \}
|
define field@struct anonymous,dt,count dup (?)
|
||||||
|
fields@struct equ fields@struct,field@struct \}
|
||||||
macro union \{ fields@struct equ fields@struct,,union,<
|
macro union \{ fields@struct equ fields@struct,,union,<
|
||||||
sub@struct equ union \}
|
sub@struct equ union \}
|
||||||
macro struct \{ fields@struct equ fields@struct,,substruct,<
|
macro struct \{ fields@struct equ fields@struct,,substruct,<
|
||||||
sub@struct equ substruct \}
|
sub@struct equ substruct \} }
|
||||||
virtual at 0 }
|
|
||||||
|
|
||||||
macro ends
|
macro ends
|
||||||
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
|
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
|
||||||
@ -56,19 +82,19 @@ macro ends
|
|||||||
purge db,dw,du,dd,dp,dq,dt
|
purge db,dw,du,dd,dp,dq,dt
|
||||||
purge rb,rw,rd,rp,rq,rt
|
purge rb,rw,rd,rp,rq,rt
|
||||||
purge union,struct
|
purge union,struct
|
||||||
|
match name tail,fields@struct, \\{ if $
|
||||||
|
display 'Error: definition of ',\\`name,' contains illegal instructions.',0Dh,0Ah
|
||||||
|
err
|
||||||
|
end if \\}
|
||||||
match name=,fields,fields@struct \\{ fields@struct equ
|
match name=,fields,fields@struct \\{ fields@struct equ
|
||||||
make@struct name,fields
|
make@struct name,fields
|
||||||
fields@\\#name equ fields \\}
|
define fields@\\#name fields \\}
|
||||||
end virtual \}
|
end virtual \}
|
||||||
match any, sub@struct \{ fields@struct equ fields@struct> \}
|
match any, sub@struct \{ fields@struct equ fields@struct> \}
|
||||||
restore sub@struct }
|
restore sub@struct }
|
||||||
|
|
||||||
macro make@struct name,[field,type,def]
|
macro make@struct name,[field,type,def]
|
||||||
{ common
|
{ common
|
||||||
if $
|
|
||||||
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah
|
|
||||||
err
|
|
||||||
end if
|
|
||||||
local define
|
local define
|
||||||
define equ name
|
define equ name
|
||||||
forward
|
forward
|
||||||
@ -81,6 +107,14 @@ macro make@struct name,[field,type,def]
|
|||||||
|
|
||||||
macro define@struct name,[field,type,def]
|
macro define@struct name,[field,type,def]
|
||||||
{ common
|
{ common
|
||||||
|
virtual
|
||||||
|
db `name
|
||||||
|
load initial@struct byte from 0
|
||||||
|
if initial@struct = '.'
|
||||||
|
display 'Error: name of structure should not begin with a dot.',0Dh,0Ah
|
||||||
|
err
|
||||||
|
end if
|
||||||
|
end virtual
|
||||||
local list
|
local list
|
||||||
list equ
|
list equ
|
||||||
forward
|
forward
|
||||||
@ -88,6 +122,7 @@ macro define@struct name,[field,type,def]
|
|||||||
name#field type def
|
name#field type def
|
||||||
sizeof.#name#field = $ - name#field
|
sizeof.#name#field = $ - name#field
|
||||||
else
|
else
|
||||||
|
label name#.#type
|
||||||
rb sizeof.#type
|
rb sizeof.#type
|
||||||
end if
|
end if
|
||||||
local value
|
local value
|
||||||
@ -97,15 +132,29 @@ macro define@struct name,[field,type,def]
|
|||||||
sizeof.#name = $
|
sizeof.#name = $
|
||||||
restruc name
|
restruc name
|
||||||
match values, list \{
|
match values, list \{
|
||||||
struc name value \\{
|
struc name value \\{ \\local \\..base
|
||||||
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\}
|
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\}
|
||||||
match , fields@struct \\\{ label .
|
match , fields@struct \\\{ label \\..base
|
||||||
forward
|
forward
|
||||||
match , value \\\\{ field type def \\\\}
|
match , value \\\\{ field type def \\\\}
|
||||||
match any, value \\\\{ field type value
|
match any, value \\\\{ field type value
|
||||||
if ~ field eq .
|
if ~ field eq .
|
||||||
rb sizeof.#name#field - ($-field)
|
rb sizeof.#name#field - ($-field)
|
||||||
end if \\\\}
|
end if \\\\}
|
||||||
|
common label . at \\..base \\\}
|
||||||
|
\\}
|
||||||
|
macro name value \\{
|
||||||
|
match any, fields@struct \\\{ \\\local anonymous
|
||||||
|
fields@struct equ fields@struct,anonymous,name,<values> \\\}
|
||||||
|
match , fields@struct \\\{
|
||||||
|
forward
|
||||||
|
match , value \\\\{ type def \\\\}
|
||||||
|
match any, value \\\\{ \\\\local ..field
|
||||||
|
..field = $
|
||||||
|
type value
|
||||||
|
if ~ field eq .
|
||||||
|
rb sizeof.#name#field - ($-..field)
|
||||||
|
end if \\\\}
|
||||||
common \\\} \\} \} }
|
common \\\} \\} \} }
|
||||||
|
|
||||||
macro enable@substruct
|
macro enable@substruct
|
||||||
@ -116,7 +165,7 @@ macro enable@substruct
|
|||||||
\forward
|
\forward
|
||||||
\local sub
|
\local sub
|
||||||
match , field \\{ match any, type \\\{ enable@substruct
|
match , field \\{ match any, type \\\{ enable@substruct
|
||||||
make@substruct type,name,sub def
|
make@substruct type,parent,sub def
|
||||||
purge make@substruct
|
purge make@substruct
|
||||||
define equ define,.,sub, \\\} \\}
|
define equ define,.,sub, \\\} \\}
|
||||||
match any, field \\{ define equ define,.\#field,type,<def> \\}
|
match any, field \\{ define equ define,.\#field,type,<def> \\}
|
||||||
@ -127,21 +176,28 @@ enable@substruct
|
|||||||
|
|
||||||
macro define@union parent,name,[field,type,def]
|
macro define@union parent,name,[field,type,def]
|
||||||
{ common
|
{ common
|
||||||
virtual at 0
|
virtual at parent#.#name
|
||||||
forward
|
forward
|
||||||
if ~ field eq .
|
if ~ field eq .
|
||||||
virtual at 0
|
virtual at parent#.#name
|
||||||
parent#field type def
|
parent#field type def
|
||||||
sizeof.#parent#field = $ - parent#field
|
sizeof.#parent#field = $ - parent#field
|
||||||
end virtual
|
end virtual
|
||||||
if sizeof.#parent#field > $
|
if sizeof.#parent#field > $ - parent#.#name
|
||||||
rb sizeof.#parent#field - $
|
rb sizeof.#parent#field - ($ - parent#.#name)
|
||||||
|
end if
|
||||||
|
else
|
||||||
|
virtual at parent#.#name
|
||||||
|
label parent#.#type
|
||||||
|
type def
|
||||||
|
end virtual
|
||||||
|
label name#.#type at parent#.#name
|
||||||
|
if sizeof.#type > $ - parent#.#name
|
||||||
|
rb sizeof.#type - ($ - parent#.#name)
|
||||||
end if
|
end if
|
||||||
else if sizeof.#type > $
|
|
||||||
rb sizeof.#type - $
|
|
||||||
end if
|
end if
|
||||||
common
|
common
|
||||||
sizeof.#name = $
|
sizeof.#name = $ - parent#.#name
|
||||||
end virtual
|
end virtual
|
||||||
struc name [value] \{ \common
|
struc name [value] \{ \common
|
||||||
label .\#name
|
label .\#name
|
||||||
@ -153,21 +209,23 @@ macro define@union parent,name,[field,type,def]
|
|||||||
match , last@union \\{ match , value \\\{ field type def \\\}
|
match , last@union \\{ match , value \\\{ field type def \\\}
|
||||||
match any, value \\\{ field type value \\\} \\}
|
match any, value \\\{ field type value \\\} \\}
|
||||||
last@union equ field
|
last@union equ field
|
||||||
common rb sizeof.#name - ($ - .\#name) \} }
|
common rb sizeof.#name - ($ - .\#name) \}
|
||||||
|
macro name [value] \{ \common \local ..anonymous
|
||||||
|
..anonymous name value \} }
|
||||||
|
|
||||||
macro define@substruct parent,name,[field,type,def]
|
macro define@substruct parent,name,[field,type,def]
|
||||||
{ common
|
{ common
|
||||||
virtual at 0
|
virtual at parent#.#name
|
||||||
forward
|
forward
|
||||||
if ~ field eq .
|
if ~ field eq .
|
||||||
parent#field type def
|
parent#field type def
|
||||||
sizeof.#parent#field = $ - parent#field
|
sizeof.#parent#field = $ - parent#field
|
||||||
else
|
else
|
||||||
|
label parent#.#type
|
||||||
rb sizeof.#type
|
rb sizeof.#type
|
||||||
end if
|
end if
|
||||||
local value
|
|
||||||
common
|
common
|
||||||
sizeof.#name = $
|
sizeof.#name = $ - parent#.#name
|
||||||
end virtual
|
end virtual
|
||||||
struc name value \{
|
struc name value \{
|
||||||
label .\#name
|
label .\#name
|
||||||
@ -177,4 +235,6 @@ macro define@substruct parent,name,[field,type,def]
|
|||||||
if ~ field eq .
|
if ~ field eq .
|
||||||
rb sizeof.#parent#field - ($-field)
|
rb sizeof.#parent#field - ($-field)
|
||||||
end if \\}
|
end if \\}
|
||||||
common \} }
|
common \}
|
||||||
|
macro name value \{ \local ..anonymous
|
||||||
|
..anonymous name \} }
|
||||||
|
Loading…
Reference in New Issue
Block a user