Subversion Repositories Kolibri OS

Compare Revisions

Ignore whitespace Rev 2664 → Rev 2665

/programs/develop/fasm/trunk/WHATSNEW.TXT
1,281 → 1,265
 
Visit http://flatassembler.net/ for more information.
 
 
version 1.69.11 (Dec 19, 2009)
 
[+] Allowed syntax of "pmovmskb" with 64-bit register destination in long mode.
 
[-] The code generated for "call eax" instruction was missing prefix in 16-bit
mode - fixed.
 
 
version 1.69.10 (Oct 28, 2009)
 
[-] Fixed long mode opcode generator to allow absolute addresses to be
generated with "qword" keyword inside square brackets.
 
 
version 1.69.09 (Oct 20, 2009)
 
[-] Fixed a crash during the symbolic information generation when a "static"
symbol was encountered.
 
 
version 1.69.08 (Oct 04, 2009)
 
[-] Minor bugfixes.
 
 
version 1.69.07 (Oct 03, 2009)
 
[-] Corrected encoding of "extrq" intruction for some cases.
 
 
version 1.69.06 (Sep 29, 2009)
 
[-] The prefix 67h for "jecxz" and "loopd" instructions in 64-bit mode wasn't
correctly generated - fixed.
 
[-] It's no longer possible to define two special segments of the same type
in ELF executables.
 
 
version 1.69.05 (Sep 14, 2009)
 
[+] Allowed to specify branding value (use 3 for Linux) after the
"format ELF executable" setting.
 
[+] Added "intepreter", "dynamic" and "note" keywords for creation of
special segments in ELF executables.
 
 
version 1.69.04 (Sep 7, 2009)
 
[-] Fixed a bug with REX prefix generation with address of type "rX+rsp".
 
 
version 1.69.03 (Aug 03, 2009)
 
[+] Allowed simplified syntax for "monitor", "mwait", "blendvps", "blendvpd" and
"pblendvb" instructions.
 
 
version 1.69.02 (Jul 04, 2009)
 
[-] Minor bugfixes.
 
 
version 1.69.01 (Jul 01, 2009)
 
[+] Added "movbe" instruction.
 
[-] "extractps" no longer generates the double 66h prefix.
 
 
version 1.69.00 (Jun 23, 2009)
 
[+] Extended the syntax of "rept" directive to allow numerical expressions
to be calculated by preprocessor in its arguments.
 
[-] The code of assembler (but not data) has been made position-independent, and
this allowed to use code segmentation in DOS unREAL mode, so the code is
no longer limited to 64 kilobytes.
 
 
version 1.68 (Jun 13, 2009)
 
[+] Added SSSE3 (Supplemental SSE3), SSE4.1, SSE4.2 and SSE4a instructions.
 
[+] Added the AMD SVM and Intel SMX instructions.
 
[+] Added "rdmsrq", "wrmsrq", "sysexitq" and "sysretq" mnemonics for the
64-bit variants of respective instructions.
 
[+] Added "fstenvw", "fstenvd", "fsavew", "fsaved", "frstorw" and "frstord"
mnemonics to allow choosing between 16-bit and 32-bit variants of
structures used by the "fstenv", "fsave" and "frstor" instructions.
 
[+] Added "plt" operator for the ELF output format.
 
[+] Allowed "rva" operator to be used in MS COFF object format, and also
added "static" keyword for the "public" directive.
 
[+] Added Intel-style aliases for the additional long mode 8-bit registers.
 
[-] The PE formatter now automatically detects whether relocatable labels
should be used, depending on whether the fixups directory is placed
somewhere into executable by programer, or not. This makes possible the
more flexible use of the addressing symbols in case of PE executable fixed
at some position.
 
[-] Added support for outputting the 32-bit address relocations in case of
64-bit object formats and PE executable. This makes some specific
instructions compilable, but it also forces linker to put such
generated code into the low 2 gigabytes of addressing space.
 
[+] Added "EFI", "EFIboot" and "EFIruntime" subsystem keywords for PE format.
 
[-] Corrected the precedence of operators of macroinstruction line maker.
The symbol escaping now has always the higher priority than symbol conversion,
and both have higher precedence than concatenation.
 
[+] Allowed to check "@b" and "@f" symbols with "defined" operator.
 
[+] Allowed "as" operator to specify the output file extension when
placed at the end of the "format" directive line.
 
[-] Definition of macro with the same name as one of the preprocessor's directives
is no longer allowed.
 
[+] Allowed single quote character to be put inside the number value,
to help improve long numbers readability.
 
[+] Added optional symbolic information output, and a set of tools that extract
various kinds of information from it.
 
[+] Added "err" directive that allows to signalize error from the source.
 
 
version 1.66 (May 7, 2006)
 
[+] Added "define" directive to preprocessor, which defines symbolic constants,
the same kind as "equ" directive, however there's an important difference
that "define" doesn't process symbolic constants in the value before
assigning it. For example:
 
a equ 1
a equ a+a
 
define b 1
define b b+b
 
defines the "a" constant with value "1+1", but the "b" is defined with
value "b+b". This directive may be useful in some advanced
macroinstructions.
 
[-] Moved part of the conditional expression processing into parser,
for slightly better performance and lesser memory usage by assembler.
The logical values defined with "eq", "eqtype" and "in" operators are now
evaluated by the parser and if they are enough to determine the condition,
the whole block is processed accordingly. Thus this block:
 
if eax eq EAX | 0/0
nop
end if
 
is parsed into just "nop" instruction, since parser is able to determine
that the condition is true, even though one of the logical values makes no
sense - but since this is none of the "eq", "eqtype" and "in" expressions,
the parser doesn't investigate.
 
[-] Also the assembler is now calculating only as many logical values as it
needs to determine the condition. So this block:
 
if defined alpha & alpha
 
end if
 
will not cause error when "alpha" is not defined, as it would with previous
versions. This is because after checking that "defined alpha" is false
condition it doesn't need to know the second logical value to determine the
value of conjunction.
 
[+] Added "short" keyword for specifying jump type, the "jmp byte" form is now
obsolete and no longer correct - use "jmp short" instead.
 
[-] The size operator applied to jump no longer applies to the size of relative
displacement - now it applies to the size of target address.
 
[-] The "ret" instruction with 0 parameter is now assembled into short form,
unless you force using the 16-bit immediate with "word" operator.
 
[+] Added missing extended registers for the 32-bit addressing in long mode.
 
[+] Added "linkremove" and "linkinfo" section flags for MS COFF output.
 
[+] Added support for GOT offsets in ELF object formatter, which can be useful
when making position-independent code for shared libraries. For any label
you can get its offset relative to GOT by preceding it with "rva" operator
(the same keyword as for PE format is used, to avoid adding a new one,
while this one has very similar meaning).
 
[-] Changed ELF executable to use "segment" directive in place of "section",
to make the distinction between the run-time segments and linkable
sections. If you had a "section" directive in your ELF executables and they
no longer assemble, replace it with "segment".
 
[-] The PE formatter now always creates the fixups directory when told to -
even when there are no fixups to be put there (in such case it creates the
directory with one empty block).
 
[-] Some of the internal structures have been extended to provide the
possibility of making extensive symbol dumps.
 
[-] Corrected "fix" directive to keep the value intact before assigning it to the
prioritized constant.
 
[+] The ` operator now works with any kind of symbol; when used with quoted
string it simply does nothing. Thus the sequence of ` operators applied to
one symbol work the same as if there was just one. In similar manner, the
sequence of # operators now works as if it was a single one - using such a
sequence instead of escaping, which was kept for some backward
compatibility, is now deprecated.
 
[-] Corrected order of identifying assembler directives ("if db eq db" was
incorrectly interpreted as data definition).
 
[-] Many other small bugs fixed.
 
 
version 1.64 (Aug 8, 2005)
 
[+] Output of PE executables for Win64 architecture (with "format PE64"
setting).
 
[+] Added "while" and "break" directives.
 
[+] Added "irp" and "irps" directives.
 
[+] The macro arguments can be marked as required with the "*" character.
 
[-] Fixed checking for overflow when multiplying 64-bit values - the result
must always fit in the range of signed 64 integer now.
 
[-] Segment prefixes were generated incorrectly in 16-bit mode when BP was used
as a second addressing register - fixed.
 
[-] The "local" directive was not creating unique labels in some cases - fixed.
 
[-] The "not encodable with long immediate" error in 64-bit mode was sometimes
wrongly signaled - fixed.
 
[-] Other minor fixes and corrections.
 
 
version 1.62 (Jun 14, 2005)
 
[+] Escaping of symbols inside macroinstructions with backslash.
 
[+] Ability of outputting the COFF object files for Win64 architecture
(with "format MS64 COFF" setting).
 
[+] New preprocessor directives: "restruc", "rept" and "match"
 
[+] VMX instructions support (not documented).
 
[+] Extended data directives to allow use of the "dup" operator.
 
[+] Extended "struc" features to allow custom definitions of main structure's
label.
 
[-] When building resources from the the .RES file that contained more
than one resource of the same string name, the separate resource
directories were created with the same names - fixed.
 
[-] Several bugs in the ELF64 object output has been fixed.
 
[-] Corrected behavior of "fix" directive to more straightforward.
 
[-] Fixed bug in "include" directive, which caused files included from within
macros to be processed the wrong way.
 
Visit http://flatassembler.net/ for more information.
 
 
version 1.70.01 (Apr 30, 2012)
 
[-] Corrected a recently introduced bug that caused some incorrect
address expressions to cause an error prematurely during the
parsing stage.
 
 
version 1.70 (Apr 17, 2012)
 
[+] Added support for AVX, AVX2, AES, CLMUL, FMA, RDRAND, FSGSBASE, F16C,
FMA4, XOP, MOVBE, BMI, TBM, INVPCID, HLE and RTM instruction sets.
 
[+] Added half-precision floating point values support.
 
[+] Extended the syntax of "rept" directive to allow numerical expressions
to be calculated by preprocessor in its arguments.
 
[+] Added "large" and "NX" settings from PE format.
 
[+] Allowed PE fixups to be resolved anywhere in the generated executable.
 
[+] Allowed to specify branding value (use 3 for Linux) after the
"format ELF executable" setting.
 
[+] Added "intepreter", "dynamic" and "note" keywords for creation of
special segments in ELF executables.
 
[-] Fixed long mode opcode generator to allow absolute addresses to be
generated with "qword" keyword inside square brackets.
 
[-] Disallowed negative immediates with "int", "enter", "ret" instructions.
 
[+] Allowed symbolic information dump file to be created even in case of error.
In such case it contains only the preprocessed source that can be extracted
with PREPSRC tool. If error occured during preprocessing, only the source up
to the point of error is provided.
 
[+] Added symbol references table to symbolic dump file.
 
[-] Corrected the "defined" and "used" flags in the symbols dump to reflect the
state from the final assembly pass.
 
[+] Added "assert" directive.
 
[-] Formatter symbols like "PE" or "readable" are now recognized only in the
context of formatter directives, and thus are no longer disallowed as
labels.
 
[+] Macroinstruction argument now can have default value, defined with "="
symbol followed by value after the argument name in definition.
 
[+] Added "relativeto" operator, which can be used in logical expressions
to test whether two values differ only by a constant and not relocatable
amount.
 
[-] Revised the expression calculator, it now is able to correctly perform
calculations in signed and unsigned ranges in full 64-bit. This fixes
a number of issues - the overflow will now be correctly detected for
64-bit values in cases, where previous versions could not distinguish
whether it was an overflow or not. The effect of these corrections is
that "dq" directive will now behave consistently with behavior of the
data directives for smaller sizes, and the same applies to all the
places where "qword" size for value is used.
 
 
version 1.68 (Jun 13, 2009)
 
[+] Added SSSE3 (Supplemental SSE3), SSE4.1, SSE4.2 and SSE4a instructions.
 
[+] Added the AMD SVM and Intel SMX instructions.
 
[+] Added "rdmsrq", "wrmsrq", "sysexitq" and "sysretq" mnemonics for the
64-bit variants of respective instructions.
 
[+] Added "fstenvw", "fstenvd", "fsavew", "fsaved", "frstorw" and "frstord"
mnemonics to allow choosing between 16-bit and 32-bit variants of
structures used by the "fstenv", "fsave" and "frstor" instructions.
 
[+] Added "plt" operator for the ELF output format.
 
[+] Allowed "rva" operator to be used in MS COFF object format, and also
added "static" keyword for the "public" directive.
 
[+] Added Intel-style aliases for the additional long mode 8-bit registers.
 
[-] The PE formatter now automatically detects whether relocatable labels
should be used, depending on whether the fixups directory is placed
somewhere into executable by programer, or not. This makes possible the
more flexible use of the addressing symbols in case of PE executable fixed
at some position.
 
[-] Added support for outputting the 32-bit address relocations in case of
64-bit object formats and PE executable. This makes some specific
instructions compilable, but it also forces linker to put such
generated code into the low 2 gigabytes of addressing space.
 
[+] Added "EFI", "EFIboot" and "EFIruntime" subsystem keywords for PE format.
 
[-] Corrected the precedence of operators of macroinstruction line maker.
The symbol escaping now has always the higher priority than symbol conversion,
and both have higher precedence than concatenation.
 
[+] Allowed to check "@b" and "@f" symbols with "defined" operator.
 
[+] Allowed "as" operator to specify the output file extension when
placed at the end of the "format" directive line.
 
[-] Definition of macro with the same name as one of the preprocessor's directives
is no longer allowed.
 
[+] Allowed single quote character to be put inside the number value,
to help improve long numbers readability.
 
[+] Added optional symbolic information output, and a set of tools that extract
various kinds of information from it.
 
[+] Added "err" directive that allows to signalize error from the source.
 
 
version 1.66 (May 7, 2006)
 
[+] Added "define" directive to preprocessor, which defines symbolic constants,
the same kind as "equ" directive, however there's an important difference
that "define" doesn't process symbolic constants in the value before
assigning it. For example:
 
a equ 1
a equ a+a
 
define b 1
define b b+b
 
defines the "a" constant with value "1+1", but the "b" is defined with
value "b+b". This directive may be useful in some advanced
macroinstructions.
 
[-] Moved part of the conditional expression processing into parser,
for slightly better performance and lesser memory usage by assembler.
The logical values defined with "eq", "eqtype" and "in" operators are now
evaluated by the parser and if they are enough to determine the condition,
the whole block is processed accordingly. Thus this block:
 
if eax eq EAX | 0/0
nop
end if
 
is parsed into just "nop" instruction, since parser is able to determine
that the condition is true, even though one of the logical values makes no
sense - but since this is none of the "eq", "eqtype" and "in" expressions,
the parser doesn't investigate.
 
[-] Also the assembler is now calculating only as many logical values as it
needs to determine the condition. So this block:
 
if defined alpha & alpha
 
end if
 
will not cause error when "alpha" is not defined, as it would with previous
versions. This is because after checking that "defined alpha" is false
condition it doesn't need to know the second logical value to determine the
value of conjunction.
 
[+] Added "short" keyword for specifying jump type, the "jmp byte" form is now
obsolete and no longer correct - use "jmp short" instead.
 
[-] The size operator applied to jump no longer applies to the size of relative
displacement - now it applies to the size of target address.
 
[-] The "ret" instruction with 0 parameter is now assembled into short form,
unless you force using the 16-bit immediate with "word" operator.
 
[+] Added missing extended registers for the 32-bit addressing in long mode.
 
[+] Added "linkremove" and "linkinfo" section flags for MS COFF output.
 
[+] Added support for GOT offsets in ELF object formatter, which can be useful
when making position-independent code for shared libraries. For any label
you can get its offset relative to GOT by preceding it with "rva" operator
(the same keyword as for PE format is used, to avoid adding a new one,
while this one has very similar meaning).
 
[-] Changed ELF executable to use "segment" directive in place of "section",
to make the distinction between the run-time segments and linkable
sections. If you had a "section" directive in your ELF executables and they
no longer assemble, replace it with "segment".
 
[-] The PE formatter now always creates the fixups directory when told to -
even when there are no fixups to be put there (in such case it creates the
directory with one empty block).
 
[-] Some of the internal structures have been extended to provide the
possibility of making extensive symbol dumps.
 
[-] Corrected "fix" directive to keep the value intact before assigning it to the
prioritized constant.
 
[+] The ` operator now works with any kind of symbol; when used with quoted
string it simply does nothing. Thus the sequence of ` operators applied to
one symbol work the same as if there was just one. In similar manner, the
sequence of # operators now works as if it was a single one - using such a
sequence instead of escaping, which was kept for some backward
compatibility, is now deprecated.
 
[-] Corrected order of identifying assembler directives ("if db eq db" was
incorrectly interpreted as data definition).
 
[-] Many other small bugs fixed.
 
 
version 1.64 (Aug 8, 2005)
 
[+] Output of PE executables for Win64 architecture (with "format PE64"
setting).
 
[+] Added "while" and "break" directives.
 
[+] Added "irp" and "irps" directives.
 
[+] The macro arguments can be marked as required with the "*" character.
 
[-] Fixed checking for overflow when multiplying 64-bit values - the result
must always fit in the range of signed 64 integer now.
 
[-] Segment prefixes were generated incorrectly in 16-bit mode when BP was used
as a second addressing register - fixed.
 
[-] The "local" directive was not creating unique labels in some cases - fixed.
 
[-] The "not encodable with long immediate" error in 64-bit mode was sometimes
wrongly signaled - fixed.
 
[-] Other minor fixes and corrections.
 
 
version 1.62 (Jun 14, 2005)
 
[+] Escaping of symbols inside macroinstructions with backslash.
 
[+] Ability of outputting the COFF object files for Win64 architecture
(with "format MS64 COFF" setting).
 
[+] New preprocessor directives: "restruc", "rept" and "match"
 
[+] VMX instructions support (not documented).
 
[+] Extended data directives to allow use of the "dup" operator.
 
[+] Extended "struc" features to allow custom definitions of main structure's
label.
 
[-] When building resources from the the .RES file that contained more
than one resource of the same string name, the separate resource
directories were created with the same names - fixed.
 
[-] Several bugs in the ELF64 object output has been fixed.
 
[-] Corrected behavior of "fix" directive to more straightforward.
 
[-] Fixed bug in "include" directive, which caused files included from within
macros to be processed the wrong way.
/programs/develop/fasm/trunk/assemble.inc
35,6 → 35,8
mov [file_extension],eax
mov [next_pass_needed],al
mov [output_format],al
mov [org_origin_sign],al
mov [adjustment_sign],al
mov [labels_type],al
mov [virtual_data],al
mov [code_type],16
169,6 → 171,8
mov [prefixed_instruction],0
cmp [symbols_file],0
je continue_line
cmp [next_pass_needed],0
jne continue_line
mov ebx,[display_buffer]
mov dword [ebx-4],1
mov dword [ebx-8],1Ch
185,6 → 189,11
mov [ebx+8+4],edx
mov [ebx+10h],ecx
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
199,24 → 208,39
je reserved_word_used_as_symbol
mov ebx,eax
lods byte [esi]
mov cl,al
mov [label_size],al
call make_label
jmp continue_line
make_label:
mov eax,edi
xor edx,edx
xor cl,cl
sub eax,dword [org_origin]
sbb edx,dword [org_origin+4]
mov ch,[labels_type]
sbb cl,[org_origin_sign]
jp label_value_ok
call recoverable_overflow
label_value_ok:
mov [address_sign],cl
cmp [virtual_data],0
jne make_virtual_label
or byte [ebx+9],1
xchg eax,[ebx]
xchg edx,[ebx+4]
mov ch,[ebx+9]
shr ch,1
and ch,1
neg ch
sub eax,[ebx]
sbb edx,[ebx+4]
sbb ch,cl
mov dword [adjustment],eax
mov dword [adjustment+4],edx
mov [adjustment_sign],ch
or al,ch
or eax,edx
setnz ah
jmp finish_label_symbol
jmp finish_label
make_virtual_label:
and byte [ebx+9],not 1
cmp eax,[ebx]
226,7 → 250,17
mov [ebx+4],edx
setne al
or ah,al
finish_label:
mov ch,[labels_type]
mov cl,[label_size]
mov ebp,[org_registers]
mov edx,[org_symbol]
finish_label_symbol:
mov al,[address_sign]
xor al,[ebx+9]
and al,10b
or ah,al
xor [ebx+9],al
cmp cl,[ebx+10]
mov [ebx+10],cl
setne al
235,14 → 269,12
mov [ebx+11],ch
setne al
or ah,al
mov edx,[org_registers]
cmp edx,[ebx+12]
mov [ebx+12],edx
cmp ebp,[ebx+12]
mov [ebx+12],ebp
setne al
or ah,al
or ch,ch
jz label_symbol_ok
mov edx,[org_symbol]
cmp edx,[ebx+20]
mov [ebx+20],edx
setne al
261,17 → 293,18
sub cx,[ebx+16]
setnz al
or ah,al
jz continue_line
jz label_made
test byte [ebx+8],8
jz continue_line
jz label_made
mov cx,[current_pass]
cmp cx,[ebx+18]
jne continue_line
jne label_made
or [next_pass_needed],-1
jmp continue_line
label_made:
ret
new_label:
or byte [ebx+8],1
jmp continue_line
ret
define_constant:
lods dword [esi]
inc esi
293,6 → 326,7
push eax
mov al,byte [esi-1]
push eax
or [size_override],-1
call get_value
pop ebx
mov ch,bl
314,6 → 348,11
mov [ebx+4],edx
setne al
or ah,al
mov al,[value_sign]
xor al,[ebx+9]
and al,10b
or ah,al
xor [ebx+9],al
cmp cl,[ebx+10]
mov [ebx+10],cl
setne al
370,12 → 409,12
; mov [size_override],0
; mov [operand_prefix],0
; mov [opcode_prefix],0
mov dword [operand_size],0
and dword [operand_size],0
; mov [rex_prefix],0
; mov [vex_required],0
; mov [vex_register],0
; mov [immediate_size],0
mov dword [rex_prefix],0
and dword [rex_prefix],0
call instruction_handler
instruction_handler:
movzx ebx,word [esi]
408,13 → 447,18
test cl,1
jnz invalid_use_of_symbol
mov [labels_type],cl
mov ecx,edi
sub ecx,eax
adc edx,0
neg edx
mov dword [org_origin],ecx
mov dword [org_origin+4],edx
mov [org_registers],0
mov dword [org_origin],edi
xor ecx,ecx
mov dword [org_origin+4],ecx
mov [org_origin_sign],cl
mov [org_registers],ecx
mov cl,[value_sign]
sub dword [org_origin],eax
sbb dword [org_origin+4],edx
sbb [org_origin_sign],cl
jp org_value_ok
call recoverable_overflow
org_value_ok:
mov [org_start],edi
mov edx,[symbol_identifier]
mov [org_symbol],edx
436,7 → 480,7
je reserved_word_used_as_symbol
inc esi
mov ebx,eax
xor cl,cl
mov [label_size],0
lods byte [esi]
cmp al,':'
je get_label_size
447,30 → 491,12
lods word [esi]
cmp al,11h
jne invalid_argument
mov cl,ah
mov [label_size],ah
label_size_ok:
mov eax,edi
xor edx,edx
sub eax,dword [org_origin]
sbb edx,dword [org_origin+4]
mov ebp,[org_registers]
cmp byte [esi],80h
je get_free_label_value
mov ch,[labels_type]
push [org_symbol]
pop [address_symbol]
cmp [virtual_data],0
jne make_free_label
or byte [ebx+9],1
xchg eax,[ebx]
xchg edx,[ebx+4]
sub eax,[ebx]
sbb edx,[ebx+4]
mov dword [adjustment],eax
mov dword [adjustment+4],edx
or eax,edx
setne ah
jmp finish_label
call make_label
jmp instruction_assembled
get_free_label_value:
inc esi
lods byte [esi]
507,51 → 533,10
mov [ebx+4],edx
setne al
or ah,al
finish_label:
cmp cl,[ebx+10]
mov [ebx+10],cl
setne al
or ah,al
cmp ch,[ebx+11]
mov [ebx+11],ch
setne al
or ah,al
cmp ebp,[ebx+12]
mov [ebx+12],ebp
setne al
or ah,al
or ch,ch
jz free_label_symbol_ok
mov edx,[address_symbol]
cmp edx,[ebx+20]
mov [ebx+20],edx
setne al
or ah,al
free_label_symbol_ok:
mov cx,[current_pass]
xchg [ebx+16],cx
mov edx,[current_line]
mov [ebx+28],edx
and byte [ebx+8],not 2
test byte [ebx+8],1
jz new_free_label
cmp cx,[ebx+16]
je symbol_already_defined
inc cx
sub cx,[ebx+16]
setnz al
or ah,al
jz instruction_assembled
test byte [ebx+8],8
jz instruction_assembled
mov cx,[current_pass]
cmp cx,[ebx+18]
jne instruction_assembled
or [next_pass_needed],-1
mov cl,[label_size]
call finish_label_symbol
jmp instruction_assembled
new_free_label:
or byte [ebx+8],1
jmp instruction_assembled
load_directive:
lods byte [esi]
cmp al,2
571,8 → 556,8
cmp al,8
ja invalid_value
mov [operand_size],al
mov dword [value],0
mov dword [value+4],0
and dword [value],0
and dword [value+4],0
lods word [esi]
cmp ax,82h+'(' shl 8
jne invalid_argument
603,13 → 588,10
rep movs byte [edi],[esi]
jmp value_loaded
bad_load_address:
cmp [error_line],0
jne value_loaded
mov eax,[current_line]
mov [error_line],eax
mov [error],value_out_of_range
call recoverable_overflow
value_loaded:
pop edi esi
mov [value_sign],0
mov eax,dword [value]
mov edx,dword [value+4]
pop ebx
627,6 → 609,7
mov [operand_size],1
jmp store_value_ok
sized_store:
or [size_override],-1
call get_value
store_value_ok:
cmp [value_type],0
669,11 → 652,7
jmp instruction_assembled
bad_store_address:
pop edi esi
cmp [error_line],0
jne instruction_assembled
mov eax,[current_line]
mov [error_line],eax
mov [error],value_out_of_range
call recoverable_overflow
jmp instruction_assembled
 
display_directive:
795,10 → 774,8
je invalid_value
call get_address_value
mov ebp,[address_symbol]
xor ch,ch
or bh,bh
jz set_virtual
mov ch,1
setnz ch
jmp set_virtual
virtual_at_current:
dec esi
807,8 → 784,11
mov ebp,[org_symbol]
mov eax,edi
xor edx,edx
xor cl,cl
sub eax,dword [org_origin]
sbb edx,dword [org_origin+4]
sbb cl,[org_origin_sign]
mov [address_sign],cl
mov bx,word [org_registers]
mov cx,word [org_registers+2]
xchg bh,bl
821,19 → 801,27
mov byte [org_registers+3],cl
call allocate_structure_data
mov word [ebx],virtual_directive-instruction_handler
mov cl,[address_sign]
not eax
not edx
not cl
add eax,1
adc edx,0
adc cl,0
add eax,edi
adc edx,0
adc cl,0
xchg dword [org_origin],eax
xchg dword [org_origin+4],edx
xchg [org_origin_sign],cl
mov [ebx+10h],eax
mov [ebx+14h],edx
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
876,7 → 864,14
call find_structure_data
jc unexpected_instruction
mov al,[ebx+2]
mov ah,al
shr ah,4
and al,1
neg al
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]
1339,7 → 1334,7
cmp al,'?'
jne invalid_argument
mov eax,edi
mov word [edi],0
and word [edi],0
scas word [edi]
jmp undefined_data
ret
1377,7 → 1372,7
cmp al,'?'
jne invalid_argument
mov eax,edi
mov dword [edi],0
and dword [edi],0
scas dword [edi]
jmp undefined_data
get_dword:
1420,9 → 1415,9
cmp al,'?'
jne invalid_argument
mov eax,edi
mov dword [edi],0
and dword [edi],0
scas dword [edi]
mov word [edi],0
and word [edi],0
scas word [edi]
jmp undefined_data
get_pword:
1467,9 → 1462,9
cmp al,'?'
jne invalid_argument
mov eax,edi
mov dword [edi],0
and dword [edi],0
scas dword [edi]
mov dword [edi],0
and dword [edi],0
scas dword [edi]
jmp undefined_data
get_qword:
1487,11 → 1482,11
cmp al,'?'
jne invalid_argument
mov eax,edi
mov dword [edi],0
and dword [edi],0
scas dword [edi]
mov dword [edi],0
and dword [edi],0
scas dword [edi]
mov word [edi],0
and word [edi],0
scas word [edi]
jmp undefined_data
get_tword:
1647,7 → 1642,7
mov esi,[eax]
test byte [eax+7],80h
jz get_current_path
mov eax,[eax+12]
mov eax,[eax+8]
jmp find_current_source_path
get_current_path:
lodsb
1665,15 → 1660,31
jmp cut_current_path
current_path_ok:
mov esi,[esp+4]
call preprocess_path
call expand_path
pop edx
mov esi,edx
call open
jnc file_opened
mov edx,[include_paths]
search_in_include_paths:
push edx esi
mov edi,esi
mov esi,[esp+4]
call get_include_directory
mov [esp+4],esi
mov esi,[esp+8]
call expand_path
pop edx
mov esi,edx
call open
pop edx
jnc file_opened
cmp byte [edx],0
jne search_in_include_paths
mov edi,esi
mov esi,[esp]
push edi
call preprocess_path
call expand_path
pop edx
mov esi,edx
call open
/programs/develop/fasm/trunk/avx.inc
1,9 → 1,9
 
; flat assembler core
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
 
avx_single_source_pd_instruction:
 
; flat assembler core
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
 
avx_single_source_pd_instruction:
or [vex_required],2
jmp avx_pd_instruction
avx_pd_instruction_imm8:
65,12 → 65,16
mov [mmx_size],0
jmp avx_instruction
avx_movshdup_instruction:
or [vex_required],2
mov [opcode_prefix],0F3h
mov [mmx_size],0
avx_instruction:
mov [base_code],0Fh
mov [extended_code],al
or [vex_required],2
mov [opcode_prefix],0F3h
mov [mmx_size],0
jmp avx_instruction
avx_128bit_instruction:
mov [mmx_size],16
mov [opcode_prefix],66h
avx_instruction:
mov [base_code],0Fh
mov [extended_code],al
avx_common:
or [vex_required],1
lods byte [esi]
204,14 → 208,17
jne operand_sizes_do_not_match
avx_mem_ok:
clc
ret
avx_smem:
xchg al,[operand_size]
cmp al,[mmx_size]
jne invalid_operand_size
clc
ret
take_imm4_if_needed:
ret
avx_smem:
xchg al,[operand_size]
or al,al
jz avx_smem_ok
cmp al,[mmx_size]
jne invalid_operand_size
avx_smem_ok:
clc
ret
take_imm4_if_needed:
cmp [immediate_size],-3
jne imm4_ok
push ebx ecx edx
226,29 → 233,30
jnz value_out_of_range
or byte [value],al
pop edx ecx ebx
imm4_ok:
ret
 
avx_128bit_instruction:
mov [mmx_size],16
mov [opcode_prefix],66h
jmp avx_instruction
avx_single_source_128bit_instruction_38:
or [vex_required],2
avx_128bit_instruction_38:
mov [mmx_size],16
avx_instruction_38_setup:
mov [opcode_prefix],66h
mov [supplemental_code],al
mov al,38h
jmp avx_instruction
avx_single_source_instruction_38:
or [vex_required],2
mov [mmx_size],0
jmp avx_instruction_38_setup
avx_ss_instruction_3a_imm8:
mov [mmx_size],4
jmp avx_instruction_3a_imm8_setup
imm4_ok:
ret
 
avx_single_source_128bit_instruction_38:
or [vex_required],2
avx_128bit_instruction_38:
mov [mmx_size],16
jmp avx_instruction_38_setup
avx_single_source_instruction_38:
or [vex_required],2
avx_instruction_38:
mov [mmx_size],0
avx_instruction_38_setup:
mov [opcode_prefix],66h
mov [supplemental_code],al
mov al,38h
jmp avx_instruction
avx_instruction_38_w1:
or [rex_prefix],8
jmp avx_instruction_38
 
avx_ss_instruction_3a_imm8:
mov [mmx_size],4
jmp avx_instruction_3a_imm8_setup
avx_sd_instruction_3a_imm8:
mov [mmx_size],8
jmp avx_instruction_3a_imm8_setup
259,17 → 267,12
jmp avx_instruction_3a_imm8_setup
avx_triple_source_instruction_3a:
mov [mmx_size],0
mov [immediate_size],-1
mov byte [value],0
jmp avx_instruction_3a_setup
avx_triple_source_128bit_instruction_3a:
mov [mmx_size],16
mov [immediate_size],-1
mov byte [value],0
jmp avx_instruction_3a_setup
avx_single_source_instruction_3a_imm8:
or [vex_required],2
avx_instruction_3a_imm8:
mov [immediate_size],-1
mov byte [value],0
jmp avx_instruction_3a_setup
avx_single_source_instruction_3a_imm8:
or [vex_required],2
avx_instruction_3a_imm8:
mov [mmx_size],0
avx_instruction_3a_imm8_setup:
mov [immediate_size],1
280,28 → 283,34
jmp avx_instruction
avx_pclmulqdq_instruction:
mov byte [value],al
mov [mmx_size],16
mov al,44h
jmp avx_instruction_3a_setup
avx_perm2f128_instruction:
call setup_66_0f_3a
mov [immediate_size],1
mov [mmx_size],0
or [vex_required],1
call take_avx_register
mov [mmx_size],16
mov al,44h
jmp avx_instruction_3a_setup
 
avx_permq_instruction:
or [vex_required],2
or [rex_prefix],8
avx_perm2f128_instruction:
mov [immediate_size],1
mov ah,3Ah
jmp avx_perm_instruction
avx_permd_instruction:
mov ah,38h
avx_perm_instruction:
mov [opcode_prefix],66h
mov [base_code],0Fh
mov [extended_code],ah
mov [supplemental_code],al
mov [mmx_size],0
or [vex_required],1
call take_avx_register
cmp ah,32
jne invalid_operand_size
mov [postbyte_register],al
jmp avx_vex_reg
setup_66_0f_3a:
mov [opcode_prefix],66h
mov [base_code],0Fh
mov [extended_code],3Ah
mov [supplemental_code],al
ret
 
avx_movdqu_instruction:
mov [opcode_prefix],0F3h
jne invalid_operand_size
mov [postbyte_register],al
jmp avx_vex_reg
 
avx_movdqu_instruction:
mov [opcode_prefix],0F3h
jmp avx_movps_instruction
avx_movpd_instruction:
mov [opcode_prefix],66h
337,13 → 346,13
lods byte [esi]
call get_size_operator
jmp avx_mem
avx_lddqu_instruction:
mov [opcode_prefix],0F2h
mov [mmx_size],0
xor cl,cl
avx_load_instruction:
mov [base_code],0Fh
mov [extended_code],al
avx_lddqu_instruction:
mov [opcode_prefix],0F2h
mov [mmx_size],0
xor cx,cx
avx_load_instruction:
mov [base_code],0Fh
mov [extended_code],al
or [vex_required],1
call take_avx_register
or cl,cl
359,12 → 368,14
push eax
lods byte [esi]
cmp al,','
jne invalid_operand
lods byte [esi]
call get_size_operator
cmp al,'['
jne invalid_operand
call get_address
jne invalid_operand
lods byte [esi]
call get_size_operator
cmp al,10h
je avx_load_reg_reg
cmp al,'['
jne invalid_operand
call get_address
pop eax
xchg ah,[operand_size]
mov [postbyte_register],al
373,31 → 384,56
jz instruction_ready
or ah,ah
jz instruction_ready
cmp al,ah
jne invalid_operand_size
jmp instruction_ready
avx_movntdqa_instruction:
mov [mmx_size],16
mov al,2Ah
mov cl,16
jmp avx_load_instruction_38
avx_broadcastss_instruction:
mov [mmx_size],4
mov al,18h
xor cl,cl
jmp avx_load_instruction_38
avx_broadcastsd_instruction:
mov [mmx_size],8
mov al,19h
mov cl,32
jmp avx_load_instruction_38
avx_broadcastf128_instruction:
mov [mmx_size],16
mov al,1Ah
mov cl,32
avx_load_instruction_38:
mov [opcode_prefix],66h
mov [supplemental_code],al
cmp al,ah
jne invalid_operand_size
jmp instruction_ready
avx_load_reg_reg:
lods byte [esi]
call convert_avx_register
cmp ch,ah
jne invalid_operand
mov bl,al
pop eax
xchg ah,[operand_size]
mov [postbyte_register],al
jmp nomem_instruction_ready
 
avx_movntdqa_instruction:
mov [mmx_size],0
xor cx,cx
jmp avx_load_instruction_38
avx_broadcastss_instruction:
mov [mmx_size],4
xor cl,cl
mov ch,16
jmp avx_load_instruction_38
avx_broadcastsd_instruction:
mov [mmx_size],8
mov cl,32
mov ch,16
jmp avx_load_instruction_38
avx_pbroadcastb_instruction:
mov [mmx_size],1
jmp avx_pbroadcast_instruction
avx_pbroadcastw_instruction:
mov [mmx_size],2
jmp avx_pbroadcast_instruction
avx_pbroadcastd_instruction:
mov [mmx_size],4
jmp avx_pbroadcast_instruction
avx_pbroadcastq_instruction:
mov [mmx_size],8
avx_pbroadcast_instruction:
xor cl,cl
mov ch,16
jmp avx_load_instruction_38
avx_broadcastf128_instruction:
mov [mmx_size],16
mov cl,32
xor ch,ch
avx_load_instruction_38:
mov [opcode_prefix],66h
mov [supplemental_code],al
mov al,38h
jmp avx_load_instruction
avx_movlpd_instruction:
464,17 → 500,16
lods byte [esi]
cmp al,','
jne invalid_operand
call take_avx_register
mov bl,al
jmp nomem_instruction_ready
avx_maskmov_instruction:
mov [opcode_prefix],66h
mov [base_code],0Fh
mov [extended_code],38h
mov [supplemental_code],al
mov [mmx_size],0
or [vex_required],1
lods byte [esi]
call take_avx_register
mov bl,al
jmp nomem_instruction_ready
avx_maskmov_w1_instruction:
or [rex_prefix],8
avx_maskmov_instruction:
call setup_66_0f_38
mov [mmx_size],0
or [vex_required],1
lods byte [esi]
call get_size_operator
cmp al,10h
jne avx_maskmov_mem
505,12 → 540,18
cmp al,','
jne invalid_operand
call take_avx_register
mov [postbyte_register],al
add [supplemental_code],2
jmp instruction_ready
avx_movd_instruction:
or [vex_required],1
jmp movd_instruction
mov [postbyte_register],al
add [supplemental_code],2
jmp instruction_ready
setup_66_0f_38:
mov [extended_code],38h
mov [supplemental_code],al
mov [base_code],0Fh
mov [opcode_prefix],66h
ret
avx_movd_instruction:
or [vex_required],1
jmp movd_instruction
avx_movq_instruction:
or [vex_required],1
jmp movq_instruction
635,19 → 676,20
jmp nomem_instruction_ready
avx_cvtdq2pd_reg_mem:
cmp al,'['
jne invalid_operand
mov [mmx_size],cl
call get_address
mov al,[operand_size]
or al,al
jz instruction_ready
shl al,1
cmp al,[mmx_size]
jne invalid_operand_size
mov [operand_size],al
jmp instruction_ready
avx_cvtpd2dq_instruction:
mov [opcode_prefix],0F2h
jne invalid_operand
mov [mmx_size],cl
call get_address
mov al,[mmx_size]
mov ah,al
xchg al,[operand_size]
or al,al
jz instruction_ready
shl al,1
cmp al,ah
jne invalid_operand_size
jmp instruction_ready
avx_cvtpd2dq_instruction:
mov [opcode_prefix],0F2h
jmp avx_cvtpd_instruction
avx_cvtpd2ps_instruction:
mov [opcode_prefix],66h
750,12 → 792,18
call take_avx_register
cmp ah,32
jne invalid_operand_size
mov [postbyte_register],al
pop ebx
jmp mmx_nomem_imm8
avx_insertf128_instruction:
or [vex_required],1
call setup_66_0f_3a
mov [postbyte_register],al
pop ebx
jmp mmx_nomem_imm8
setup_66_0f_3a:
mov [extended_code],3Ah
mov [supplemental_code],al
mov [base_code],0Fh
mov [opcode_prefix],66h
ret
avx_insertf128_instruction:
or [vex_required],1
call setup_66_0f_3a
call take_avx_register
cmp ah,32
jne invalid_operand
837,16 → 885,52
jmp pinsr_xmmreg
avx_maskmovdqu_instruction:
or [vex_required],1
jmp maskmovdqu_instruction
avx_pmovmskb_instruction:
or [vex_required],1
jmp pmovmskb_instruction
avx_pshufd_instruction:
or [vex_required],1
jmp pshufd_instruction
avx_pmovsxbw_instruction:
mov [mmx_size],8
jmp avx_pmovsx_instruction
jmp maskmovdqu_instruction
avx_pmovmskb_instruction:
or [vex_required],1
mov [opcode_prefix],66h
mov [base_code],0Fh
mov [extended_code],al
lods byte [esi]
call get_size_operator
cmp al,10h
jne invalid_operand
lods byte [esi]
call convert_register
cmp ah,4
je avx_pmovmskb_reg_size_ok
cmp [code_type],64
jne invalid_operand_size
cmp ah,8
jnz invalid_operand_size
avx_pmovmskb_reg_size_ok:
mov [postbyte_register],al
mov [operand_size],0
lods byte [esi]
cmp al,','
jne invalid_operand
call take_avx_register
mov bl,al
jmp nomem_instruction_ready
avx_pshufd_instruction:
or [vex_required],1
mov [mmx_size],0
mov [opcode_prefix],al
mov [base_code],0Fh
mov [extended_code],70h
call take_avx_register
mov [postbyte_register],al
lods byte [esi]
cmp al,','
jne invalid_operand
call take_avx_rm
jnc mmx_imm8
mov bl,al
jmp mmx_nomem_imm8
 
avx_pmovsxbw_instruction:
mov [mmx_size],8
jmp avx_pmovsx_instruction
avx_pmovsxbd_instruction:
mov [mmx_size],4
jmp avx_pmovsx_instruction
860,13 → 944,46
mov [mmx_size],4
jmp avx_pmovsx_instruction
avx_pmovsxdq_instruction:
mov [mmx_size],8
avx_pmovsx_instruction:
or [vex_required],1
jmp pmovsx_instruction
avx_permil_instruction:
call setup_66_0f_3a
or [vex_required],1
mov [mmx_size],8
avx_pmovsx_instruction:
or [vex_required],1
call setup_66_0f_38
call take_avx_register
mov [postbyte_register],al
lods byte [esi]
cmp al,','
jne invalid_operand
xor al,al
xchg al,[operand_size]
push eax
lods byte [esi]
call get_size_operator
cmp al,10h
je avx_pmovsx_xmmreg_reg
cmp al,'['
jne invalid_operand
call get_address
pop eax
cmp al,32
jb avx_pmovsx_size_check
shl [mmx_size],1
avx_pmovsx_size_check:
xchg al,[operand_size]
test al,al
jz instruction_ready
cmp al,[mmx_size]
jne invalid_operand_size
jmp instruction_ready
avx_pmovsx_xmmreg_reg:
lods byte [esi]
call convert_xmm_register
mov bl,al
pop eax
mov [operand_size],al
jmp nomem_instruction_ready
avx_permil_instruction:
call setup_66_0f_3a
or [vex_required],1
call take_avx_register
mov [postbyte_register],al
lods byte [esi]
912,38 → 1029,20
xor bl,bl
xchg bl,[vex_register]
jmp mmx_nomem_imm8
avx_permil_reg_mem:
call get_address
jmp mmx_imm8
avx_pslldq_instruction:
mov [postbyte_register],al
mov [opcode_prefix],66h
mov [base_code],0Fh
mov [extended_code],73h
or [vex_required],1
call take_avx_register
cmp ah,16
avx_permil_reg_mem:
call get_address
jmp mmx_imm8
avx_bit_shift_instruction:
mov [opcode_prefix],66h
mov [base_code],0Fh
mov [extended_code],al
or [vex_required],1
call take_avx_register
mov [postbyte_register],al
lods byte [esi]
cmp al,','
jne invalid_operand
mov [vex_register],al
lods byte [esi]
cmp al,','
jne invalid_operand
call take_avx_register
mov bl,al
jmp mmx_nomem_imm8
avx_bit_shift_instruction:
mov [opcode_prefix],66h
mov [base_code],0Fh
mov [extended_code],al
or [vex_required],1
call take_avx_register
cmp ah,16
jne invalid_operand
mov [postbyte_register],al
lods byte [esi]
cmp al,','
jne invalid_operand
call take_avx_register
mov [vex_register],al
lods byte [esi]
cmp al,','
950,18 → 1049,18
jne invalid_operand
push esi
xor cl,cl
xchg cl,[operand_size]
lods byte [esi]
call get_size_operator
xchg cl,[operand_size]
pop esi
cmp al,10h
je avx_bit_shift_regs_reg
cmp al,'['
je avx_bit_shift_regs_mem
dec esi
mov bl,[extended_code]
mov al,bl
xchg cl,[operand_size]
lods byte [esi]
call get_size_operator
cmp al,10h
je avx_bit_shift_regs_reg
pop esi
cmp al,'['
je avx_bit_shift_regs_mem
xchg cl,[operand_size]
dec esi
mov bl,[extended_code]
mov al,bl
shr bl,4
and al,1111b
add al,70h
969,20 → 1068,44
sub bl,0Ch
shl bl,1
xchg bl,[postbyte_register]
xchg bl,[vex_register]
jmp mmx_nomem_imm8
avx_bit_shift_regs_reg:
call take_avx_register
mov bl,al
jmp nomem_instruction_ready
avx_bit_shift_regs_mem:
lods byte [esi]
call get_size_operator
call get_address
jmp instruction_ready
 
vzeroall_instruction:
mov [operand_size],32
xchg bl,[vex_register]
jmp mmx_nomem_imm8
avx_bit_shift_regs_reg:
pop eax
lods byte [esi]
call convert_xmm_register
xchg cl,[operand_size]
mov bl,al
jmp nomem_instruction_ready
avx_bit_shift_regs_mem:
push ecx
lods byte [esi]
call get_size_operator
call get_address
pop eax
xchg al,[operand_size]
test al,al
jz instruction_ready
cmp al,16
jne invalid_operand_size
jmp instruction_ready
avx_pslldq_instruction:
mov [postbyte_register],al
mov [opcode_prefix],66h
mov [base_code],0Fh
mov [extended_code],73h
or [vex_required],1
call take_avx_register
mov [vex_register],al
lods byte [esi]
cmp al,','
jne invalid_operand
call take_avx_register
mov bl,al
jmp mmx_nomem_imm8
 
vzeroall_instruction:
mov [operand_size],32
vzeroupper_instruction:
mov [base_code],0Fh
mov [extended_code],al
1023,12 → 1146,172
cmp al,','
jne invalid_operand
call take_avx_register
mov [postbyte_register],al
jmp mmx_nomem_imm8
 
fma_instruction_pd:
or [rex_prefix],8
fma_instruction_ps:
mov [postbyte_register],al
jmp mmx_nomem_imm8
 
bmi_instruction:
mov [base_code],0Fh
mov [extended_code],38h
mov [supplemental_code],0F3h
mov [postbyte_register],al
bmi_reg:
or [vex_required],1
lods byte [esi]
call get_size_operator
cmp al,10h
jne invalid_operand
lods byte [esi]
call convert_register
mov [vex_register],al
lods byte [esi]
cmp al,','
jne invalid_operand
lods byte [esi]
call get_size_operator
cmp al,10h
je bmi_reg_reg
cmp al,'['
jne invalid_argument
call get_address
call operand_32or64
jmp instruction_ready
bmi_reg_reg:
lods byte [esi]
call convert_register
mov bl,al
call operand_32or64
jmp nomem_instruction_ready
operand_32or64:
mov al,[operand_size]
cmp al,4
je operand_32or64_ok
cmp al,8
jne invalid_operand_size
cmp [code_type],64
jne invalid_operand
or [rex_prefix],8
operand_32or64_ok:
ret
pdep_instruction:
mov [opcode_prefix],0F2h
jmp andn_instruction
pext_instruction:
mov [opcode_prefix],0F3h
andn_instruction:
mov [base_code],0Fh
mov [extended_code],38h
mov [supplemental_code],al
or [vex_required],1
lods byte [esi]
call get_size_operator
cmp al,10h
jne invalid_operand
lods byte [esi]
call convert_register
mov [postbyte_register],al
lods byte [esi]
cmp al,','
jne invalid_operand
jmp bmi_reg
sarx_instruction:
mov [opcode_prefix],0F3h
jmp bzhi_instruction
shrx_instruction:
mov [opcode_prefix],0F2h
jmp bzhi_instruction
shlx_instruction:
mov [opcode_prefix],66h
bzhi_instruction:
mov [base_code],0Fh
mov [extended_code],38h
mov [supplemental_code],al
or [vex_required],1
call get_reg_mem
jc bzhi_reg_reg
call get_vex_source_register
jc invalid_operand
call operand_32or64
jmp instruction_ready
bzhi_reg_reg:
call get_vex_source_register
jc invalid_operand
call operand_32or64
jmp nomem_instruction_ready
get_vex_source_register:
lods byte [esi]
cmp al,','
jne invalid_operand
lods byte [esi]
call get_size_operator
cmp al,10h
jne no_vex_source_register
lods byte [esi]
call convert_register
mov [vex_register],al
clc
ret
no_vex_source_register:
stc
ret
bextr_instruction:
mov [base_code],0Fh
mov [extended_code],38h
mov [supplemental_code],al
or [vex_required],1
call get_reg_mem
jc bextr_reg_reg
call get_vex_source_register
jc bextr_reg_mem_imm32
call operand_32or64
jmp instruction_ready
bextr_reg_reg:
call get_vex_source_register
jc bextr_reg_reg_imm32
call operand_32or64
jmp nomem_instruction_ready
setup_bextr_imm_opcode:
mov [xop_opcode_map],0Ah
mov [base_code],10h
call operand_32or64
ret
bextr_reg_mem_imm32:
call get_imm32
call setup_bextr_imm_opcode
jmp store_instruction_with_imm32
bextr_reg_reg_imm32:
call get_imm32
call setup_bextr_imm_opcode
store_nomem_instruction_with_imm32:
call store_nomem_instruction
mov eax,dword [value]
call mark_relocation
stos dword [edi]
jmp instruction_assembled
get_imm32:
cmp al,'('
jne invalid_operand
push edx ebx ecx
call get_dword_value
mov dword [value],eax
pop ecx ebx edx
ret
rorx_instruction:
mov [opcode_prefix],0F2h
mov [base_code],0Fh
mov [extended_code],3Ah
mov [supplemental_code],al
or [vex_required],1
call get_reg_mem
jc rorx_reg_reg
call operand_32or64
jmp mmx_imm8
rorx_reg_reg:
call operand_32or64
jmp mmx_nomem_imm8
 
fma_instruction_pd:
or [rex_prefix],8
fma_instruction_ps:
mov [mmx_size],0
jmp avx_instruction_38_setup
fma_instruction_sd:
1216,12 → 1499,163
mov [base_code],0Fh
mov [supplemental_code],al
mov al,3Ah
mov [mmx_size],0
jmp avx_instruction
 
take_avx_register:
lods byte [esi]
call get_size_operator
mov [mmx_size],0
jmp avx_instruction
 
tbm_instruction:
mov [xop_opcode_map],9
mov ah,al
shr ah,4
and al,111b
mov [base_code],ah
mov [postbyte_register],al
jmp bmi_reg
 
llwpcb_instruction:
or [vex_required],1
mov [xop_opcode_map],9
mov [base_code],12h
mov [postbyte_register],al
lods byte [esi]
call get_size_operator
cmp al,10h
jne invalid_operand
lods byte [esi]
call convert_register
mov bl,al
call operand_32or64
jmp nomem_instruction_ready
lwpins_instruction:
or [vex_required],1
mov [xop_opcode_map],0Ah
mov [base_code],12h
mov [vex_register],al
lods byte [esi]
call get_size_operator
cmp al,10h
jne invalid_operand
lods byte [esi]
call convert_register
mov [postbyte_register],al
lods byte [esi]
cmp al,','
jne invalid_operand
xor cl,cl
xchg cl,[operand_size]
lods byte [esi]
call get_size_operator
cmp al,10h
je lwpins_reg_reg
cmp al,'['
jne invalid_argument
push ecx
call get_address
pop eax
xchg al,[operand_size]
test al,al
jz lwpins_reg_mem_size_ok
cmp al,4
jne invalid_operand_size
lwpins_reg_mem_size_ok:
call prepare_lwpins
jmp store_instruction_with_imm32
lwpins_reg_reg:
lods byte [esi]
call convert_register
cmp ah,4
jne invalid_operand_size
mov [operand_size],cl
mov bl,al
call prepare_lwpins
jmp store_nomem_instruction_with_imm32
prepare_lwpins:
lods byte [esi]
cmp al,','
jne invalid_operand
lods byte [esi]
call get_imm32
call operand_32or64
mov al,[vex_register]
xchg al,[postbyte_register]
mov [vex_register],al
ret
 
gather_instruction_pd:
or [rex_prefix],8
gather_instruction_ps:
call setup_66_0f_38
or [vex_required],4
call take_avx_register
mov [postbyte_register],al
lods byte [esi]
cmp al,','
jne invalid_operand
xor cl,cl
xchg cl,[operand_size]
push ecx
lods byte [esi]
call get_size_operator
cmp al,'['
jne invalid_argument
call get_address
pop eax
xchg al,[operand_size]
test al,al
jz gather_elements_size_ok
test [rex_prefix],8
jnz gather_elements_64bit
cmp al,4
jne invalid_operand_size
jmp gather_elements_size_ok
gather_elements_64bit:
cmp al,8
jne invalid_operand_size
gather_elements_size_ok:
lods byte [esi]
cmp al,','
jne invalid_operand
call take_avx_register
mov [vex_register],al
cmp al,[postbyte_register]
je disallowed_combination_of_registers
mov al,bl
and al,1111b
cmp al,[postbyte_register]
je disallowed_combination_of_registers
cmp al,[vex_register]
je disallowed_combination_of_registers
mov al,bl
shr al,4
cmp al,0Ch
je gather_vr_128bit
mov al,[rex_prefix]
shr al,3
xor al,[supplemental_code]
test al,1
jz gather_256bit
test [supplemental_code],1
jz invalid_operand_size
mov al,32
xchg al,[operand_size]
cmp al,16
jne invalid_operand_size
jmp instruction_ready
gather_256bit:
cmp ah,32
jne invalid_operand_size
jmp instruction_ready
gather_vr_128bit:
cmp ah,16
je instruction_ready
test [supplemental_code],1
jnz invalid_operand_size
test [rex_prefix],8
jz invalid_operand_size
jmp instruction_ready
 
take_avx_register:
lods byte [esi]
call get_size_operator
cmp al,10h
jne invalid_operand
lods byte [esi]
1273,14 → 1707,14
je vex_66
cmp ah,0F3h
je vex_f3
cmp ah,0F2h
je vex_f2
test ah,ah
jnz prefix_conflict
cmp ah,0F2h
je vex_f2
test ah,ah
jnz disallowed_combination_of_registers
ret
vex_f2:
or al,11b
ret
vex_f2:
or al,11b
ret
vex_f3:
or al,10b
ret
/programs/develop/fasm/trunk/errors.inc
72,8 → 72,8
address_sizes_do_not_agree:
push _address_sizes_do_not_agree
jmp error_with_source
prefix_conflict:
push _prefix_conflict
disallowed_combination_of_registers:
push _disallowed_combination_of_registers
jmp error_with_source
long_immediate_not_encodable:
push _long_immediate_not_encodable
/programs/develop/fasm/trunk/exprcalc.inc
1,9 → 1,9
 
; flat assembler core
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
 
calculate_expression:
 
; flat assembler core
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
 
calculate_expression:
mov [current_offset],edi
mov [value_undefined],0
cmp byte [esi],0
49,17 → 49,13
je calculate_add
cmp al,81h
je calculate_sub
mov ah,[ebx+12]
or ah,[edi+12]
jz absolute_values_calculation
cmp [error_line],0
jne absolute_values_calculation
mov eax,[current_line]
mov [error_line],eax
mov [error],invalid_use_of_symbol
absolute_values_calculation:
cmp al,90h
je calculate_mul
mov ah,[ebx+12]
or ah,[edi+12]
jz absolute_values_calculation
call recoverable_misuse
absolute_values_calculation:
cmp al,90h
je calculate_mul
cmp al,91h
je calculate_div
or dx,dx
81,25 → 77,25
sub edi,14h
cmp [value_undefined],0
je expression_value_ok
xor eax,eax
mov [edi],eax
mov [edi+4],eax
mov [edi+12],eax
expression_value_ok:
ret
get_byte_number:
xor eax,eax
mov [edi],eax
mov [edi+4],eax
mov [edi+12],al
expression_value_ok:
ret
get_byte_number:
xor eax,eax
lods byte [esi]
stos dword [edi]
xor al,al
stos dword [edi]
got_number:
mov word [edi-8+8],0
mov byte [edi-8+12],0
mov dword [edi-8+16],0
add edi,0Ch
jmp calculation_loop
get_word_number:
xor al,al
stos dword [edi]
got_number:
and word [edi-8+8],0
and word [edi-8+12],0
and dword [edi-8+16],0
add edi,0Ch
jmp calculation_loop
get_word_number:
xor eax,eax
lods word [esi]
stos dword [edi]
114,13 → 110,13
get_qword_number:
movs dword [edi],[esi]
movs dword [edi],[esi]
jmp got_number
get_register:
mov byte [edi+9],0
mov byte [edi+12],0
lods byte [esi]
mov [edi+8],al
mov byte [edi+10],1
jmp got_number
get_register:
mov byte [edi+9],0
and word [edi+12],0
lods byte [esi]
mov [edi+8],al
mov byte [edi+10],1
xor eax,eax
mov [edi+16],eax
stos dword [edi]
127,51 → 123,74
stos dword [edi]
add edi,0Ch
jmp calculation_loop
get_label:
xor eax,eax
mov [edi+8],eax
mov [edi+12],al
mov [edi+20],eax
lods dword [esi]
cmp eax,0Fh
get_label:
xor eax,eax
mov [edi+8],eax
mov [edi+12],eax
mov [edi+20],eax
lods dword [esi]
cmp eax,0Fh
jb predefined_label
je reserved_word_used_as_symbol
mov ebx,eax
mov ax,[current_pass]
mov [ebx+18],ax
or byte [ebx+8],8
test byte [ebx+8],1
jz label_undefined
cmp ax,[ebx+16]
je label_defined
test byte [ebx+8],4
jnz label_out_of_scope
test byte [ebx+9],1
jz label_defined
mov eax,[ebx]
sub eax,dword [adjustment]
stos dword [edi]
mov eax,[ebx+4]
sbb eax,dword [adjustment+4]
stos dword [edi]
mov eax,dword [adjustment]
or eax,dword [adjustment+4]
jz got_label
or [next_pass_needed],-1
jmp got_label
label_defined:
mov eax,[ebx]
stos dword [edi]
mov eax,[ebx+4]
stos dword [edi]
got_label:
mov al,[ebx+11]
mov [edi-8+12],al
mov eax,[ebx+12]
mov [edi-8+8],eax
mov eax,[ebx+20]
mov [edi-8+16],eax
add edi,0Ch
mov ebx,eax
mov ax,[current_pass]
mov [ebx+18],ax
mov cl,[ebx+9]
shr cl,1
and cl,1
neg cl
or byte [ebx+8],8
test byte [ebx+8],1
jz label_undefined
cmp ax,[ebx+16]
je unadjusted_label
test byte [ebx+8],4
jnz label_out_of_scope
test byte [ebx+9],1
jz unadjusted_label
mov eax,[ebx]
sub eax,dword [adjustment]
stos dword [edi]
mov eax,[ebx+4]
sbb eax,dword [adjustment+4]
stos dword [edi]
sbb cl,[adjustment_sign]
mov [edi-8+13],cl
mov eax,dword [adjustment]
or al,[adjustment_sign]
or eax,dword [adjustment+4]
jz got_label
or [next_pass_needed],-1
jmp got_label
unadjusted_label:
mov eax,[ebx]
stos dword [edi]
mov eax,[ebx+4]
stos dword [edi]
mov [edi-8+13],cl
got_label:
cmp [symbols_file],0
je label_reference_ok
cmp [next_pass_needed],0
jne label_reference_ok
call store_label_reference
label_reference_ok:
mov al,[ebx+11]
mov [edi-8+12],al
mov eax,[ebx+12]
mov [edi-8+8],eax
cmp al,ah
jne labeled_registers_ok
shr eax,16
add al,ah
jo labeled_registers_ok
xor ah,ah
mov [edi-8+10],ax
mov [edi-8+9],ah
labeled_registers_ok:
mov eax,[ebx+20]
mov [edi-8+16],eax
add edi,0Ch
mov al,[ebx+10]
or al,al
jz calculation_loop
191,21 → 210,26
jne operand_sizes_do_not_match
jmp calculation_loop
current_offset_label:
mov eax,[current_offset]
make_current_offset_label:
xor edx,edx
sub eax,dword [org_origin]
sbb edx,dword [org_origin+4]
stos dword [edi]
mov eax,edx
stos dword [edi]
mov eax,[org_registers]
stos dword [edi]
mov al,[labels_type]
mov [edi-12+12],al
mov eax,[org_symbol]
mov [edi-12+16],eax
add edi,8
mov eax,[current_offset]
make_current_offset_label:
xor edx,edx
xor ch,ch
sub eax,dword [org_origin]
sbb edx,dword [org_origin+4]
sbb ch,[org_origin_sign]
jp current_offset_label_ok
call recoverable_overflow
current_offset_label_ok:
stos dword [edi]
mov eax,edx
stos dword [edi]
mov eax,[org_registers]
stos dword [edi]
mov cl,[labels_type]
mov [edi-12+12],cx
mov eax,[org_symbol]
mov [edi-12+16],eax
add edi,8
jmp calculation_loop
org_origin_label:
mov eax,[org_start]
236,59 → 260,55
cmp eax,3
je org_origin_label
mov edx,invalid_value
jmp error_undefined
label_out_of_scope:
mov edx,symbol_out_of_scope
cmp [error_line],0
jne error_undefined
mov [error_info],ebx
jmp error_undefined
label_undefined:
mov edx,undefined_symbol
cmp [error_line],0
jne error_undefined
mov [error_info],ebx
error_undefined:
cmp [current_pass],1
ja undefined_value
force_next_pass:
or [next_pass_needed],-1
undefined_value:
mov byte [edi+12],0
or [value_undefined],-1
xor eax,eax
stos dword [edi]
stos dword [edi]
add edi,0Ch
cmp [error_line],0
jne calculation_loop
mov eax,[current_line]
mov [error_line],eax
mov [error],edx
jmp calculation_loop
calculate_add:
mov ecx,[ebx+16]
jmp error_undefined
label_out_of_scope:
mov edx,symbol_out_of_scope
jmp error_undefined
label_undefined:
mov edx,undefined_symbol
error_undefined:
cmp [current_pass],1
ja undefined_value
force_next_pass:
or [next_pass_needed],-1
undefined_value:
or [value_undefined],-1
and word [edi+12],0
xor eax,eax
stos dword [edi]
stos dword [edi]
add edi,0Ch
cmp [error_line],0
jne calculation_loop
mov eax,[current_line]
mov [error_line],eax
mov [error],edx
mov [error_info],ebx
jmp calculation_loop
calculate_add:
mov ecx,[ebx+16]
cmp byte [edi+12],0
je add_values
mov ecx,[edi+16]
cmp byte [ebx+12],0
je add_values
cmp [error_line],0
jne add_values
mov eax,[current_line]
mov [error_line],eax
mov [error],invalid_use_of_symbol
add_values:
mov al,[edi+12]
or [ebx+12],al
mov ecx,[edi+16]
cmp byte [ebx+12],0
je add_values
call recoverable_misuse
add_values:
mov al,[edi+12]
or [ebx+12],al
mov [ebx+16],ecx
mov eax,[edi]
add [ebx],eax
mov eax,[edi+4]
adc [ebx+4],eax
or dx,dx
jz calculation_loop
push esi
add [ebx],eax
mov eax,[edi+4]
adc [ebx+4],eax
mov al,[edi+13]
adc [ebx+13],al
jp add_sign_ok
call recoverable_overflow
add_sign_ok:
or dx,dx
jz calculation_loop
push esi
mov esi,ebx
lea ebx,[edi+10]
mov cl,[edi+8]
303,20 → 323,22
jz add_register_done
add_register_start:
cmp [esi+8],cl
jne add_in_second_slot
mov al,[ebx]
add [esi+10],al
jnz add_register_done
mov byte [esi+8],0
ret
jne add_in_second_slot
mov al,[ebx]
add [esi+10],al
jo value_out_of_range
jnz add_register_done
mov byte [esi+8],0
ret
add_in_second_slot:
cmp [esi+9],cl
jne create_in_first_slot
mov al,[ebx]
add [esi+11],al
jnz add_register_done
mov byte [esi+9],0
ret
jne create_in_first_slot
mov al,[ebx]
add [esi+11],al
jo value_out_of_range
jnz add_register_done
mov byte [esi+9],0
ret
create_in_first_slot:
cmp byte [esi+8],0
jne create_in_second_slot
329,30 → 351,41
jne invalid_expression
mov [esi+9],cl
mov al,[ebx]
mov [esi+11],al
add_register_done:
ret
calculate_sub:
xor ah,ah
mov ah,[ebx+12]
mov [esi+11],al
add_register_done:
ret
out_of_range:
jmp calculation_loop
calculate_sub:
xor ah,ah
mov ah,[ebx+12]
mov al,[edi+12]
or al,al
jz sub_values
cmp al,ah
jne invalid_sub
xor ah,ah
mov ecx,[edi+16]
cmp ecx,[ebx+16]
jne invalid_sub
sub_values:
mov [ebx+12],ah
mov eax,[edi]
sub [ebx],eax
mov eax,[edi+4]
sbb [ebx+4],eax
or dx,dx
jz calculation_loop
push esi
xor ah,ah
mov ecx,[edi+16]
cmp ecx,[ebx+16]
je sub_values
invalid_sub:
call recoverable_misuse
sub_values:
mov [ebx+12],ah
mov eax,[edi]
sub [ebx],eax
mov eax,[edi+4]
sbb [ebx+4],eax
mov al,[edi+13]
sbb [ebx+13],al
jp sub_sign_ok
cmp [error_line],0
jne sub_sign_ok
call recoverable_overflow
sub_sign_ok:
or dx,dx
jz calculation_loop
push esi
mov esi,ebx
lea ebx,[edi+10]
mov cl,[edi+8]
359,107 → 392,107
call sub_register
lea ebx,[edi+11]
mov cl,[edi+9]
call sub_register
pop esi
jmp calculation_loop
invalid_sub:
cmp [error_line],0
jne sub_values
mov eax,[current_line]
mov [error_line],eax
mov [error],invalid_use_of_symbol
jmp sub_values
sub_register:
or cl,cl
jz add_register_done
neg byte [ebx]
jmp add_register_start
calculate_mul:
or dx,dx
jz mul_start
cmp word [ebx+8],0
jne mul_start
mov eax,[ebx]
xchg eax,[edi]
mov [ebx],eax
mov eax,[ebx+4]
xchg eax,[edi+4]
mov [ebx+4],eax
mov eax,[ebx+8]
xchg eax,[edi+8]
mov [ebx+8],eax
mov eax,[ebx+12]
xchg eax,[edi+12]
mov [ebx+12],eax
mul_start:
push esi edx
mov esi,ebx
xor bl,bl
bt dword [esi+4],31
jnc mul_first_sign_ok
not dword [esi]
not dword [esi+4]
add dword [esi],1
adc dword [esi+4],0
not bl
mul_first_sign_ok:
bt dword [edi+4],31
jnc mul_second_sign_ok
not dword [edi]
not dword [edi+4]
add dword [edi],1
adc dword [edi+4],0
not bl
mul_second_sign_ok:
cmp dword [esi+4],0
jz mul_numbers
cmp dword [edi+4],0
jnz value_out_of_range
mul_numbers:
mov eax,[esi+4]
mul dword [edi]
or edx,edx
jnz value_out_of_range
mov ecx,eax
mov eax,[esi]
mul dword [edi+4]
or edx,edx
jnz value_out_of_range
add ecx,eax
jc value_out_of_range
mov eax,[esi]
mul dword [edi]
add edx,ecx
jc value_out_of_range
test edx,1 shl 31
jnz value_out_of_range
mov [esi],eax
mov [esi+4],edx
or bl,bl
jz mul_ok
not dword [esi]
not dword [esi+4]
add dword [esi],1
adc dword [esi+4],0
mul_ok:
pop edx
or dx,dx
jz mul_calculated
call sub_register
pop esi
jmp calculation_loop
sub_register:
or cl,cl
jz add_register_done
neg byte [ebx]
jo value_out_of_range
jmp add_register_start
calculate_mul:
or dx,dx
jz mul_start
cmp word [ebx+8],0
jne mul_start
xor ecx,ecx
swap_values:
mov eax,[ebx+ecx]
xchg eax,[edi+ecx]
mov [ebx+ecx],eax
add ecx,4
cmp ecx,16
jb swap_values
mul_start:
push esi edx
mov esi,ebx
xor bl,bl
cmp byte [esi+13],0
je mul_first_sign_ok
mov eax,[esi]
mov edx,[esi+4]
not eax
not edx
add eax,1
adc edx,0
mov [esi],eax
mov [esi+4],edx
or eax,edx
jz mul_overflow
xor bl,-1
mul_first_sign_ok:
cmp byte [edi+13],0
je mul_second_sign_ok
mov eax,[edi]
mov edx,[edi+4]
not eax
not edx
add eax,1
adc edx,0
mov [edi],eax
mov [edi+4],edx
or eax,edx
jz mul_overflow
xor bl,-1
mul_second_sign_ok:
cmp dword [esi+4],0
jz mul_numbers
cmp dword [edi+4],0
jz mul_numbers
jnz mul_overflow
mul_numbers:
mov eax,[esi+4]
mul dword [edi]
or edx,edx
jnz mul_overflow
mov ecx,eax
mov eax,[esi]
mul dword [edi+4]
or edx,edx
jnz mul_overflow
add ecx,eax
jc mul_overflow
mov eax,[esi]
mul dword [edi]
add edx,ecx
jc mul_overflow
mov [esi],eax
mov [esi+4],edx
or bl,bl
jz mul_ok
not eax
not edx
add eax,1
adc edx,0
mov [esi],eax
mov [esi+4],edx
or eax,edx
jnz mul_ok
not bl
mul_ok:
mov [esi+13],bl
pop edx
or dx,dx
jz mul_calculated
cmp word [edi+8],0
jne invalid_value
cmp byte [esi+8],0
je mul_first_register_ok
mov al,[edi]
cbw
cwde
cdq
cmp edx,[edi+4]
jne value_out_of_range
cmp eax,[edi]
jne value_out_of_range
imul byte [esi+10]
mov dl,ah
cbw
jne invalid_value
cmp byte [esi+8],0
je mul_first_register_ok
call get_byte_scale
imul byte [esi+10]
mov dl,ah
cbw
cmp ah,dl
jne value_out_of_range
mov [esi+10],al
466,20 → 499,13
or al,al
jnz mul_first_register_ok
mov [esi+8],al
mul_first_register_ok:
cmp byte [esi+9],0
je mul_calculated
mov al,[edi]
cbw
cwde
cdq
cmp edx,[edi+4]
jne value_out_of_range
cmp eax,[edi]
jne value_out_of_range
imul byte [esi+11]
mov dl,ah
cbw
mul_first_register_ok:
cmp byte [esi+9],0
je mul_calculated
call get_byte_scale
imul byte [esi+11]
mov dl,ah
cbw
cmp ah,dl
jne value_out_of_range
mov [esi+11],al
486,49 → 512,49
or al,al
jnz mul_calculated
mov [esi+9],al
mul_calculated:
pop esi
jmp calculation_loop
calculate_div:
push esi edx
mov esi,ebx
mul_calculated:
pop esi
jmp calculation_loop
mul_overflow:
pop edx esi
call recoverable_overflow
jmp calculation_loop
get_byte_scale:
mov al,[edi]
cbw
cwde
cdq
cmp edx,[edi+4]
jne value_out_of_range
cmp eax,[edi]
jne value_out_of_range
ret
calculate_div:
push esi edx
mov esi,ebx
call div_64
pop edx
or dx,dx
jz div_calculated
cmp byte [esi+8],0
je div_first_register_ok
mov al,[edi]
jz div_calculated
cmp byte [esi+8],0
je div_first_register_ok
call get_byte_scale
or al,al
jz value_out_of_range
mov al,[esi+10]
cbw
cwde
cdq
cmp edx,[edi+4]
jne value_out_of_range
cmp eax,[edi]
jne value_out_of_range
or al,al
jz value_out_of_range
mov al,[esi+10]
cbw
idiv byte [edi]
or ah,ah
jnz invalid_use_of_symbol
mov [esi+10],al
div_first_register_ok:
cmp byte [esi+9],0
je div_calculated
mov al,[edi]
div_first_register_ok:
cmp byte [esi+9],0
je div_calculated
call get_byte_scale
or al,al
jz value_out_of_range
mov al,[esi+11]
cbw
cwde
cdq
cmp edx,[edi+4]
jne value_out_of_range
cmp eax,[edi]
jne value_out_of_range
or al,al
jz value_out_of_range
mov al,[esi+11]
cbw
idiv byte [edi]
or ah,ah
jnz invalid_use_of_symbol
539,369 → 565,397
calculate_mod:
push esi
mov esi,ebx
call div_64
mov [esi],eax
mov [esi+4],edx
pop esi
jmp calculation_loop
calculate_and:
mov eax,[edi]
and [ebx],eax
mov eax,[edi+4]
and [ebx+4],eax
jmp calculation_loop
calculate_or:
mov eax,[edi]
or [ebx],eax
mov eax,[edi+4]
or [ebx+4],eax
jmp calculation_loop
calculate_xor:
mov eax,[edi]
xor [ebx],eax
mov edx,[edi+4]
xor [ebx+4],edx
cmp [value_size],1
je xor_byte
cmp [value_size],2
je xor_word
cmp [value_size],4
je xor_dword
cmp [value_size],6
je xor_pword
xor_calculated:
jmp calculation_loop
prepare_xor_check:
cmp edx,-1
je xor_check_ready
xor edx,[ebx+4]
xor eax,[ebx]
cmp edx,-1
xor_check_ready:
ret
xor_byte:
call prepare_xor_check
jne xor_calculated
xor edx,[ebx+4]
jnz xor_calculated
cmp eax,0FFFFFF80h
jb xor_calculated
xor eax,[ebx]
cmp eax,0FFh
ja xor_calculated
mov [ebx+4],edx
and dword [ebx],0FFh
jmp xor_calculated
xor_word:
call prepare_xor_check
jne xor_calculated
xor edx,[ebx+4]
jnz xor_calculated
cmp eax,0FFFF8000h
jb xor_calculated
xor eax,[ebx]
cmp eax,0FFFFh
ja xor_calculated
mov [ebx+4],edx
and dword [ebx],0FFFFh
jmp xor_calculated
xor_dword:
call prepare_xor_check
jne xor_calculated
xor edx,[ebx+4]
jnz xor_calculated
cmp eax,80000000h
jb xor_calculated
mov [ebx+4],edx
jmp xor_calculated
xor_pword:
cmp edx,0FFFF8000h
jae xor_pword_check
xor edx,[ebx+4]
xor eax,[ebx]
cmp edx,0FFFF8000h
jb xor_calculated
xor_pword_check:
xor edx,[ebx+4]
cmp edx,0FFFFh
ja xor_calculated
and dword [ebx+4],0FFFFh
jmp xor_calculated
shr_negative:
not dword [edi]
not dword [edi+4]
add dword [edi],1
adc dword [edi+4],0
calculate_shl:
mov eax,dword [edi+4]
bt eax,31
jc shl_negative
or eax,eax
jnz zero_value
mov ecx,[edi]
cmp ecx,64
jae zero_value
mov edx,[ebx+4]
mov eax,[ebx]
cmp ecx,32
jae shl_high
shld edx,eax,cl
shl eax,cl
mov [ebx],eax
mov [ebx+4],edx
jmp calculation_loop
shl_high:
sub cl,32
shl eax,cl
mov [ebx+4],eax
mov dword [ebx],0
jmp calculation_loop
shl_negative:
not dword [edi]
not dword [edi+4]
add dword [edi],1
adc dword [edi+4],0
calculate_shr:
mov eax,dword [edi+4]
bt eax,31
jc shr_negative
or eax,eax
jnz zero_value
mov ecx,[edi]
cmp ecx,64
jae zero_value
mov edx,[ebx+4]
mov eax,[ebx]
cmp ecx,32
jae shr_high
cmp [value_size],1
je shr_byte
cmp [value_size],2
je shr_word
cmp [value_size],4
je shr_dword
cmp [value_size],6
je shr_pword
shr_regular:
shrd eax,edx,cl
shr edx,cl
mov [ebx],eax
mov [ebx+4],edx
jmp calculation_loop
shr_byte:
cmp edx,-1
jne shr_regular
cmp eax,0FFFFFF80h
jb shr_regular
and eax,0FFh
xor edx,edx
jmp shr_regular
shr_word:
cmp edx,-1
jne shr_regular
cmp eax,0FFFF8000h
jb shr_regular
and eax,0FFFFh
xor edx,edx
jmp shr_regular
shr_dword:
cmp edx,-1
jne shr_regular
cmp eax,80000000h
jb shr_regular
xor edx,edx
jmp shr_regular
shr_pword:
cmp edx,0FFFF8000h
jb shr_regular
and edx,0FFFFh
jmp shr_regular
shr_high:
sub cl,32
cmp [value_size],1
je shr_byte_32plus
cmp [value_size],2
je shr_word_32plus
cmp [value_size],4
je shr_dword_32plus
cmp [value_size],6
je shr_pword_32plus
shr_32plus:
shr edx,cl
mov [ebx],edx
mov dword [ebx+4],0
jmp calculation_loop
shr_byte_32plus:
cmp edx,-1
jne shr_32plus
cmp eax,-80h
jb shr_32plus
jmp zero_value
shr_word_32plus:
cmp edx,-1
jne shr_32plus
cmp eax,-8000h
jb shr_32plus
jmp zero_value
shr_dword_32plus:
cmp edx,-1
jne shr_32plus
cmp eax,-80000000h
jb shr_32plus
jmp zero_value
shr_pword_32plus:
cmp edx,-8000h
jb shr_32plus
and edx,0FFFFh
jmp shr_32plus
zero_value:
mov dword [ebx],0
mov dword [ebx+4],0
jmp calculation_loop
calculate_not:
cmp word [edi+8],0
jne invalid_expression
cmp byte [edi+12],0
je not_ok
cmp [error_line],0
jne not_ok
mov eax,[current_line]
mov [error_line],eax
mov [error],invalid_use_of_symbol
not_ok:
cmp [value_size],1
je not_byte
cmp [value_size],2
je not_word
cmp [value_size],4
je not_dword
cmp [value_size],6
je not_pword
not_qword:
not dword [edi]
not dword [edi+4]
add edi,14h
jmp calculation_loop
not_byte:
call div_64
mov [esi],eax
mov [esi+4],edx
mov [esi+13],bh
pop esi
jmp calculation_loop
calculate_and:
mov eax,[edi]
mov edx,[edi+4]
mov cl,[edi+13]
and [ebx],eax
and [ebx+4],edx
and [ebx+13],cl
jmp calculation_loop
calculate_or:
mov eax,[edi]
mov edx,[edi+4]
mov cl,[edi+13]
or [ebx],eax
or [ebx+4],edx
or [ebx+13],cl
jmp calculation_loop
calculate_xor:
mov eax,[edi]
mov edx,[edi+4]
mov cl,[edi+13]
xor [ebx],eax
xor [ebx+4],edx
xor [ebx+13],cl
jz calculation_loop
or cl,cl
jz xor_size_check
xor eax,[ebx]
xor edx,[ebx+4]
xor_size_check:
mov cl,[value_size]
cmp cl,1
je xor_byte_result
cmp cl,2
je xor_word_result
cmp cl,4
je xor_dword_result
cmp cl,6
je xor_pword_result
cmp cl,8
jne calculation_loop
xor edx,[ebx+4]
js xor_result_truncated
jmp calculation_loop
xor_pword_result:
test edx,0FFFF0000h
jnz calculation_loop
cmp word [ebx+6],-1
jne calculation_loop
xor dx,[ebx+4]
jns calculation_loop
not word [ebx+6]
jmp xor_result_truncated
xor_dword_result:
test edx,edx
jnz calculation_loop
cmp dword [ebx+4],-1
jne calculation_loop
xor eax,[ebx]
jns calculation_loop
not dword [ebx+4]
jmp xor_result_truncated
xor_word_result:
test edx,edx
jnz calculation_loop
test eax,0FFFF0000h
jnz calculation_loop
cmp dword [ebx+4],-1
jne calculation_loop
cmp word [ebx+2],-1
jne calculation_loop
xor ax,[ebx]
jns calculation_loop
not dword [ebx+4]
not word [ebx+2]
jmp xor_result_truncated
xor_byte_result:
test edx,edx
jnz calculation_loop
test eax,0FFFFFF00h
jnz calculation_loop
cmp dword [ebx+4],-1
jne calculation_loop
cmp word [ebx+2],-1
jne calculation_loop
cmp byte [ebx+1],-1
jne calculation_loop
xor al,[ebx]
jns calculation_loop
not dword [ebx+4]
not word [ebx+2]
not byte [ebx+1]
xor_result_truncated:
mov byte [ebx+13],0
jmp calculation_loop
shr_negative:
mov byte [edi+13],0
not dword [edi]
not dword [edi+4]
add dword [edi],1
adc dword [edi+4],0
jc shl_over
calculate_shl:
cmp byte [edi+13],0
jne shl_negative
mov edx,[ebx+4]
mov eax,[ebx]
cmp dword [edi+4],0
jne shl_over
movsx ecx,byte [ebx+13]
xchg ecx,[edi]
cmp ecx,64
je shl_max
ja shl_over
cmp ecx,32
jae shl_high
shld [edi],edx,cl
shld edx,eax,cl
shl eax,cl
mov [ebx],eax
mov [ebx+4],edx
jmp shl_done
shl_over:
cmp byte [ebx+13],0
jne shl_overflow
shl_max:
movsx ecx,byte [ebx+13]
cmp eax,ecx
jne shl_overflow
cmp edx,ecx
jne shl_overflow
xor eax,eax
mov [ebx],eax
mov [ebx+4],eax
jmp calculation_loop
shl_high:
sub cl,32
shld [edi],edx,cl
shld edx,eax,cl
shl eax,cl
mov [ebx+4],eax
and dword [ebx],0
cmp edx,[edi]
jne shl_overflow
shl_done:
movsx eax,byte [ebx+13]
cmp eax,[edi]
je calculation_loop
shl_overflow:
call recoverable_overflow
jmp calculation_loop
shl_negative:
mov byte [edi+13],0
not dword [edi]
not dword [edi+4]
add dword [edi],1
adc dword [edi+4],0
jnc calculate_shr
dec dword [edi+4]
calculate_shr:
cmp byte [edi+13],0
jne shr_negative
cmp byte [ebx+13],0
je do_shr
mov al,[value_size]
cmp al,1
je shr_negative_byte
cmp al,2
je shr_negative_word
cmp al,4
je shr_negative_dword
cmp al,6
je shr_negative_pword
cmp al,8
jne do_shr
shr_negative_qword:
test byte [ebx+7],80h
jz do_shr
shr_truncated:
mov byte [ebx+13],0
do_shr:
mov edx,[ebx+4]
mov eax,[ebx]
cmp dword [edi+4],0
jne shr_over
mov ecx,[edi]
cmp ecx,64
jae shr_over
push esi
movsx esi,byte [ebx+13]
cmp ecx,32
jae shr_high
shrd eax,edx,cl
shrd edx,esi,cl
mov [ebx],eax
mov [ebx+4],edx
pop esi
jmp calculation_loop
shr_high:
sub cl,32
shrd edx,esi,cl
mov [ebx],edx
mov [ebx+4],esi
pop esi
jmp calculation_loop
shr_over:
movsx eax,byte [ebx+13]
mov dword [ebx],eax
mov dword [ebx+4],eax
jmp calculation_loop
shr_negative_byte:
cmp dword [ebx+4],-1
jne do_shr
cmp word [ebx+2],-1
jne do_shr
cmp byte [ebx+1],-1
jne do_shr
test byte [ebx],80h
jz do_shr
not dword [ebx+4]
not word [ebx+2]
not byte [ebx+1]
jmp shr_truncated
shr_negative_word:
cmp dword [ebx+4],-1
jne do_shr
cmp word [ebx+2],-1
jne do_shr
test byte [ebx+1],80h
jz do_shr
not dword [ebx+4]
not word [ebx+2]
jmp shr_truncated
shr_negative_dword:
cmp dword [ebx+4],-1
jne do_shr
test byte [ebx+3],80h
jz do_shr
not dword [ebx+4]
jmp shr_truncated
shr_negative_pword:
cmp word [ebx+6],-1
jne do_shr
test byte [ebx+5],80h
jz do_shr
not word [ebx+6]
jmp shr_truncated
calculate_not:
cmp word [edi+8],0
jne invalid_expression
cmp byte [edi+12],0
je not_ok
call recoverable_misuse
not_ok:
mov al,[value_size]
cmp al,1
je not_byte
cmp al,2
je not_word
cmp al,4
je not_dword
cmp al,6
je not_pword
cmp al,8
je not_qword
not dword [edi]
not dword [edi+4]
not byte [edi+13]
add edi,14h
jmp calculation_loop
not_qword:
not dword [edi]
not dword [edi+4]
finish_not:
mov byte [edi+13],0
add edi,14h
jmp calculation_loop
not_byte:
cmp dword [edi+4],0
jne not_qword
cmp word [edi+2],0
jne not_qword
cmp byte [edi+1],0
jne not_qword
not byte [edi]
add edi,14h
jmp calculation_loop
not_word:
cmp dword [edi+4],0
jne not_qword
cmp word [edi+2],0
jne not_qword
not word [edi]
add edi,14h
jmp calculation_loop
not_dword:
cmp dword [edi+4],0
jne not_qword
not dword [edi]
add edi,14h
jmp calculation_loop
not_pword:
cmp word [edi+6],0
jne not_qword
not dword [edi]
not word [edi+4]
add edi,14h
jmp calculation_loop
calculate_neg:
cmp word [edi+8],0
jne invalid_expression
cmp byte [edi+12],0
je neg_ok
cmp [error_line],0
jne neg_ok
mov eax,[current_line]
mov [error_line],eax
mov [error],invalid_use_of_symbol
neg_ok:
mov eax,[edi]
mov edx,[edi+4]
mov dword [edi],0
mov dword [edi+4],0
sub [edi],eax
sbb [edi+4],edx
add edi,14h
jmp calculation_loop
calculate_rva:
cmp word [edi+8],0
jne invalid_expression
cmp [output_format],5
je calculate_gotoff
cmp [output_format],4
je calculate_coff_rva
cmp [output_format],3
jne invalid_expression
test [format_flags],8
jnz pe64_rva
cmp byte [edi+1],0
jne not_qword
not byte [edi]
jmp finish_not
not_word:
cmp dword [edi+4],0
jne not_qword
cmp word [edi+2],0
jne not_qword
not word [edi]
jmp finish_not
not_dword:
cmp dword [edi+4],0
jne not_qword
not dword [edi]
jmp finish_not
not_pword:
cmp word [edi+6],0
jne not_qword
not word [edi+4]
not dword [edi]
jmp finish_not
calculate_neg:
cmp word [edi+8],0
jne invalid_expression
cmp byte [edi+12],0
je neg_ok
call recoverable_misuse
neg_ok:
xor eax,eax
xor edx,edx
xor cl,cl
xchg eax,[edi]
xchg edx,[edi+4]
xchg cl,[edi+13]
sub [edi],eax
sbb [edi+4],edx
sbb [edi+13],cl
jp neg_sign_ok
call recoverable_overflow
neg_sign_ok:
add edi,14h
jmp calculation_loop
calculate_rva:
cmp word [edi+8],0
jne invalid_expression
mov al,[output_format]
cmp al,5
je calculate_gotoff
cmp al,4
je calculate_coff_rva
cmp al,3
jne invalid_expression
test [format_flags],8
jnz pe64_rva
mov al,2
bt [resolver_flags],0
jc rva_type_ok
xor al,al
rva_type_ok:
cmp byte [edi+12],al
je rva_ok
cmp [error_line],0
jne rva_ok
mov eax,[current_line]
mov [error_line],eax
mov [error],invalid_use_of_symbol
rva_ok:
mov byte [edi+12],0
mov eax,[code_start]
mov eax,[eax+34h]
cdq
sub [edi],eax
sbb [edi+4],edx
add edi,14h
jmp calculation_loop
pe64_rva:
rva_type_ok:
cmp byte [edi+12],al
je rva_ok
call recoverable_misuse
rva_ok:
mov byte [edi+12],0
mov eax,[code_start]
mov eax,[eax+34h]
xor edx,edx
finish_rva:
sub [edi],eax
sbb [edi+4],edx
sbb byte [edi+13],0
jp rva_finished
call recoverable_overflow
rva_finished:
add edi,14h
jmp calculation_loop
pe64_rva:
mov al,4
bt [resolver_flags],0
jc pe64_rva_type_ok
xor al,al
pe64_rva_type_ok:
cmp byte [edi+12],al
je pe64_rva_ok
cmp [error_line],0
jne pe64_rva_ok
mov eax,[current_line]
mov [error_line],eax
mov [error],invalid_use_of_symbol
pe64_rva_ok:
mov byte [edi+12],0
mov eax,[code_start]
mov edx,[eax+34h]
mov eax,[eax+30h]
sub [edi],eax
sbb [edi+4],edx
add edi,14h
jmp calculation_loop
calculate_gotoff:
test [format_flags],8+1
jnz invalid_expression
pe64_rva_type_ok:
cmp byte [edi+12],al
je pe64_rva_ok
call recoverable_misuse
pe64_rva_ok:
mov byte [edi+12],0
mov eax,[code_start]
mov edx,[eax+34h]
mov eax,[eax+30h]
jmp finish_rva
calculate_gotoff:
test [format_flags],8+1
jnz invalid_expression
calculate_coff_rva:
mov dl,5
cmp byte [edi+12],2
je change_value_type
incorrect_change_of_value_type:
cmp [error_line],0
jne change_value_type
mov eax,[current_line]
mov [error_line],eax
mov [error],invalid_use_of_symbol
change_value_type:
mov byte [edi+12],dl
add edi,14h
cmp byte [edi+12],2
je change_value_type
incorrect_change_of_value_type:
call recoverable_misuse
change_value_type:
mov byte [edi+12],dl
add edi,14h
jmp calculation_loop
calculate_plt:
cmp word [edi+8],0
932,27 → 986,39
cmp dword [edi+4],0
jne divider_ok
cmp [next_pass_needed],0
je value_out_of_range
jmp div_done
divider_ok:
bt dword [esi+4],31
jnc div_first_sign_ok
not dword [esi]
not dword [esi+4]
add dword [esi],1
adc dword [esi+4],0
not bx
div_first_sign_ok:
bt dword [edi+4],31
jnc div_second_sign_ok
not dword [edi]
not dword [edi+4]
add dword [edi],1
adc dword [edi+4],0
not bl
div_second_sign_ok:
cmp dword [edi+4],0
jne div_high
je value_out_of_range
jmp div_done
divider_ok:
cmp byte [esi+13],0
je div_first_sign_ok
mov eax,[esi]
mov edx,[esi+4]
not eax
not edx
add eax,1
adc edx,0
mov [esi],eax
mov [esi+4],edx
or eax,edx
jz value_out_of_range
xor bx,-1
div_first_sign_ok:
cmp byte [edi+13],0
je div_second_sign_ok
mov eax,[edi]
mov edx,[edi+4]
not eax
not edx
add eax,1
adc edx,0
mov [edi],eax
mov [edi+4],edx
or eax,edx
jz value_out_of_range
xor bl,-1
div_second_sign_ok:
cmp dword [edi+4],0
jne div_high
mov ecx,[edi]
mov eax,[esi+4]
xor edx,edx
962,18 → 1028,19
div ecx
mov [esi],eax
mov eax,edx
xor edx,edx
jmp div_done
div_high:
mov eax,[esi+4]
xor edx,edx
div dword [edi+4]
mov ebx,[esi]
mov [esi],eax
mov dword [esi+4],0
mov ecx,edx
mul dword [edi]
div_high_loop:
xor edx,edx
jmp div_done
div_high:
push ebx
mov eax,[esi+4]
xor edx,edx
div dword [edi+4]
mov ebx,[esi]
mov [esi],eax
and dword [esi+4],0
mov ecx,edx
mul dword [edi]
div_high_loop:
cmp ecx,edx
ja div_high_done
jb div_high_large_correction
986,13 → 1053,14
jnc div_high_loop
div_high_done:
sub ebx,eax
sbb ecx,edx
mov edx,ecx
mov eax,ebx
ret
div_high_large_correction:
push eax edx
mov eax,edx
sbb ecx,edx
mov edx,ecx
mov eax,ebx
pop ebx
jmp div_done
div_high_large_correction:
push eax edx
mov eax,edx
sub eax,ecx
xor edx,edx
div dword [edi+4]
1015,33 → 1083,116
or bh,bh
jz remainder_ok
not eax
not edx
add eax,1
adc edx,0
remainder_ok:
or bl,bl
jz div_ok
not edx
add eax,1
adc edx,0
mov ecx,eax
or ecx,edx
jnz remainder_ok
not bh
remainder_ok:
or bl,bl
jz div_ok
not dword [esi]
not dword [esi+4]
add dword [esi],1
adc dword [esi+4],0
div_ok:
ret
convert_fp:
inc esi
mov word [edi+8],0
mov byte [edi+12],0
mov al,[value_size]
cmp al,2
je convert_fp_word
cmp al,4
je convert_fp_dword
cmp al,8
je convert_fp_qword
jmp invalid_value
convert_fp_word:
xor eax,eax
cmp word [esi+8],8000h
not dword [esi+4]
add dword [esi],1
adc dword [esi+4],0
mov ecx,[esi]
or ecx,[esi+4]
jnz div_ok
not bl
div_ok:
mov [esi+13],bl
ret
store_label_reference:
mov eax,[display_buffer]
mov dword [eax-4],2
mov dword [eax-8],4
sub eax,8+4
cmp eax,edi
jbe out_of_memory
mov [display_buffer],eax
mov [eax],ebx
ret
convert_fp:
inc esi
and word [edi+8],0
and word [edi+12],0
mov al,[value_size]
cmp al,2
je convert_fp_word
cmp al,4
je convert_fp_dword
test al,not 8
jnz invalid_value
convert_fp_qword:
xor eax,eax
xor edx,edx
cmp word [esi+8],8000h
je fp_qword_store
mov bx,[esi+8]
mov eax,[esi]
mov edx,[esi+4]
add eax,eax
adc edx,edx
mov ecx,edx
shr edx,12
shrd eax,ecx,12
jnc fp_qword_ok
add eax,1
adc edx,0
bt edx,20
jnc fp_qword_ok
and edx,1 shl 20 - 1
inc bx
shr edx,1
rcr eax,1
fp_qword_ok:
add bx,3FFh
cmp bx,7FFh
jge value_out_of_range
cmp bx,0
jg fp_qword_exp_ok
or edx,1 shl 20
mov cx,bx
neg cx
inc cx
cmp cx,52
ja value_out_of_range
cmp cx,32
jbe fp_qword_small_shift
sub cx,32
mov eax,edx
xor edx,edx
shr eax,cl
jmp fp_qword_shift_done
fp_qword_small_shift:
mov ebx,edx
shr edx,cl
shrd eax,ebx,cl
fp_qword_shift_done:
mov bx,0
jnc fp_qword_exp_ok
add eax,1
adc edx,0
test edx,1 shl 20
jz fp_qword_exp_ok
and edx,1 shl 20 - 1
inc bx
fp_qword_exp_ok:
shl ebx,20
or edx,ebx
fp_qword_store:
mov bl,[esi+11]
shl ebx,31
or edx,ebx
mov [edi],eax
mov [edi+4],edx
add esi,13
ret
convert_fp_word:
xor eax,eax
cmp word [esi+8],8000h
je fp_word_store
mov bx,[esi+8]
mov ax,[esi+6]
1130,77 → 1281,12
or eax,ebx
mov [edi],eax
xor eax,eax
mov [edi+4],eax
add esi,13
ret
convert_fp_qword:
xor eax,eax
xor edx,edx
cmp word [esi+8],8000h
je fp_qword_store
mov bx,[esi+8]
mov eax,[esi]
mov edx,[esi+4]
add eax,eax
adc edx,edx
mov ecx,edx
shr edx,12
shrd eax,ecx,12
jnc fp_qword_ok
add eax,1
adc edx,0
bt edx,20
jnc fp_qword_ok
and edx,1 shl 20 - 1
inc bx
shr edx,1
rcr eax,1
fp_qword_ok:
add bx,3FFh
cmp bx,7FFh
jge value_out_of_range
cmp bx,0
jg fp_qword_exp_ok
or edx,1 shl 20
mov cx,bx
neg cx
inc cx
cmp cx,52
ja value_out_of_range
cmp cx,32
jbe fp_qword_small_shift
sub cx,32
mov eax,edx
xor edx,edx
shr eax,cl
jmp fp_qword_shift_done
fp_qword_small_shift:
mov ebx,edx
shr edx,cl
shrd eax,ebx,cl
fp_qword_shift_done:
mov bx,0
jnc fp_qword_exp_ok
add eax,1
adc edx,0
test edx,1 shl 20
jz fp_qword_exp_ok
and edx,1 shl 20 - 1
inc bx
fp_qword_exp_ok:
shl ebx,20
or edx,ebx
fp_qword_store:
mov bl,[esi+11]
shl ebx,31
or edx,ebx
mov [edi],eax
mov [edi+4],edx
add esi,13
ret
get_string_value:
inc esi
lods dword [esi]
mov [edi+4],eax
add esi,13
ret
get_string_value:
inc esi
lods dword [esi]
mov ecx,eax
cmp ecx,8
ja value_out_of_range
1209,170 → 1295,159
stos dword [edi]
stos dword [edi]
mov edi,edx
rep movs byte [edi],[esi]
mov edi,edx
inc esi
mov word [edi+8],0
mov byte [edi+12],0
rep movs byte [edi],[esi]
mov edi,edx
inc esi
and word [edi+8],0
and word [edi+12],0
ret
 
get_byte_value:
mov [value_size],1
mov [size_override],-1
call calculate_value
or al,al
jz check_byte_value
call recoverable_misuse
check_byte_value:
mov eax,[edi]
mov edx,[edi+4]
cmp byte [edi+13],0
je byte_positive
cmp edx,-1
jne range_exceeded
cmp eax,-80h
jb range_exceeded
ret
byte_positive:
test edx,edx
jnz range_exceeded
cmp eax,100h
jae range_exceeded
return_byte_value:
ret
 
get_byte_value:
mov [value_size],1
mov [size_override],-1
call calculate_expression
mov eax,[edi+16]
mov [symbol_identifier],eax
mov [value_type],0
cmp word [edi+8],0
jne invalid_value
cmp byte [edi+12],0
je check_byte_value
cmp [error_line],0
jne check_byte_value
mov eax,[current_line]
mov [error_line],eax
mov [error],invalid_use_of_symbol
check_byte_value:
range_exceeded:
xor eax,eax
xor edx,edx
recoverable_overflow:
cmp [error_line],0
jne ignore_overflow
push [current_line]
pop [error_line]
mov [error],value_out_of_range
or [value_undefined],-1
ignore_overflow:
ret
recoverable_misuse:
cmp [error_line],0
jne ignore_misuse
push [current_line]
pop [error_line]
mov [error],invalid_use_of_symbol
ignore_misuse:
ret
get_word_value:
mov [value_size],2
mov [size_override],-1
call calculate_value
cmp al,2
jb check_word_value
call recoverable_misuse
check_word_value:
mov eax,[edi]
mov edx,[edi+4]
cmp byte [edi+13],0
je word_positive
cmp edx,-1
jne range_exceeded
cmp eax,-8000h
jb range_exceeded
ret
word_positive:
test edx,edx
jnz range_exceeded
cmp eax,10000h
jae range_exceeded
ret
get_dword_value:
mov [value_size],4
mov [size_override],-1
call calculate_value
cmp al,4
jne check_dword_value
mov [value_type],2
mov eax,[edi]
mov edx,[edi+4]
or edx,edx
jz byte_positive
cmp edx,-1
jne range_exceeded
cmp eax,-80h
jb range_exceeded
ret
byte_positive:
cmp eax,100h
jae range_exceeded
return_byte_value:
ret
range_exceeded:
xor eax,eax
xor edx,edx
cmp [error_line],0
jne return_byte_value
mov ecx,[current_line]
mov [error_line],ecx
mov [error],value_out_of_range
ret
get_word_value:
mov [value_size],2
mov [size_override],-1
call calculate_expression
cmp word [edi+8],0
jne invalid_value
mov eax,[edi+16]
mov [symbol_identifier],eax
mov al,[edi+12]
mov [value_type],al
cmp al,2
jb check_word_value
cmp [error_line],0
jne check_word_value
mov eax,[current_line]
mov [error_line],eax
mov [error],invalid_use_of_symbol
check_word_value:
mov eax,[edi]
mov edx,[edi+4]
or edx,edx
jz word_positive
cmp edx,-1
jne range_exceeded
cmp eax,-8000h
jb range_exceeded
ret
word_positive:
cmp eax,10000h
jae range_exceeded
ret
get_dword_value:
mov [value_size],4
mov [size_override],-1
call calculate_expression
cmp word [edi+8],0
jne invalid_value
mov eax,[edi+16]
mov [symbol_identifier],eax
mov al,[edi+12]
mov [value_type],al
cmp al,4
jne check_dword_value
mov [value_type],2
mov eax,[edi]
cdq
cmp edx,[edi+4]
jne range_exceeded
ret
check_dword_value:
mov eax,[edi]
mov edx,[edi+4]
or edx,edx
jz dword_positive
cmp edx,-1
jne range_exceeded
bt eax,31
jnc range_exceeded
dword_positive:
ret
get_pword_value:
mov [value_size],6
mov [size_override],-1
call calculate_expression
mov eax,[edi+16]
mov [symbol_identifier],eax
cmp word [edi+8],0
jne invalid_value
mov al,[edi+12]
mov [value_type],al
cmp al,4
jne check_pword_value
cmp [error_line],0
jne check_pword_value
mov eax,[current_line]
mov [error_line],eax
mov [error],invalid_use_of_symbol
check_pword_value:
mov eax,[edi]
mov edx,[edi+4]
cmp edx,10000h
jge range_exceeded
cmp edx,-8000h
jl range_exceeded
ret
get_qword_value:
mov [value_size],8
mov [size_override],-1
call calculate_expression
cmp word [edi+8],0
jne invalid_value
mov eax,[edi+16]
mov [symbol_identifier],eax
mov al,[edi+12]
mov [value_type],al
check_qword_value:
mov eax,[edi]
mov edx,[edi+4]
ret
get_count_value:
mov [value_size],8
mov [size_override],-1
call calculate_expression
cmp word [edi+8],0
jne invalid_value
mov al,[edi+12]
or al,al
jz check_count_value
cmp [error_line],0
jne check_count_value
mov eax,[current_line]
mov [error_line],eax
mov [error],invalid_use_of_symbol
check_count_value:
mov eax,[edi]
mov edx,[edi+4]
or edx,edx
cdq
cmp edx,[edi+4]
jne range_exceeded
mov ecx,edx
shr ecx,31
cmp cl,[value_sign]
jne range_exceeded
ret
check_dword_value:
mov eax,[edi]
mov edx,[edi+4]
cmp byte [edi+13],0
je dword_positive
cmp edx,-1
jne range_exceeded
bt eax,31
jnc range_exceeded
ret
dword_positive:
test edx,edx
jne range_exceeded
ret
get_pword_value:
mov [value_size],6
mov [size_override],-1
call calculate_value
cmp al,4
jne check_pword_value
call recoverable_misuse
check_pword_value:
mov eax,[edi]
mov edx,[edi+4]
cmp byte [edi+13],0
je pword_positive
cmp edx,-8000h
jb range_exceeded
ret
pword_positive:
cmp edx,10000h
jae range_exceeded
ret
get_qword_value:
mov [value_size],8
mov [size_override],-1
call calculate_value
check_qword_value:
mov eax,[edi]
mov edx,[edi+4]
cmp byte [edi+13],0
je qword_positive
cmp edx,-80000000h
jb range_exceeded
qword_positive:
ret
get_count_value:
mov [value_size],8
mov [size_override],-1
call calculate_expression
cmp word [edi+8],0
jne invalid_value
mov [value_sign],0
mov al,[edi+12]
or al,al
jz check_count_value
call recoverable_misuse
check_count_value:
cmp byte [edi+13],0
jne invalid_count_value
mov eax,[edi]
mov edx,[edi+4]
or edx,edx
jnz invalid_count_value
ret
invalid_count_value:
1400,33 → 1475,51
cmp al,6
je value_pword
cmp al,8
je value_qword
or al,al
jnz invalid_value
value_qword:
call get_qword_value
ret
value_pword:
call get_pword_value
movzx edx,dx
ret
value_dword:
call get_dword_value
xor edx,edx
ret
value_word:
call get_word_value
xor edx,edx
movzx eax,ax
ret
value_byte:
call get_byte_value
xor edx,edx
movzx eax,al
ret
get_address_word_value:
mov [address_size],2
mov [value_size],2
je value_qword
or al,al
jnz invalid_value
mov [value_size],al
call calculate_value
mov eax,[edi]
mov edx,[edi+4]
ret
calculate_value:
call calculate_expression
cmp word [edi+8],0
jne invalid_value
mov eax,[edi+16]
mov [symbol_identifier],eax
mov al,[edi+13]
mov [value_sign],al
mov al,[edi+12]
mov [value_type],al
ret
value_qword:
call get_qword_value
truncated_value:
mov [value_sign],0
ret
value_pword:
call get_pword_value
movzx edx,dx
jmp truncated_value
value_dword:
call get_dword_value
xor edx,edx
jmp truncated_value
value_word:
call get_word_value
xor edx,edx
movzx eax,ax
jmp truncated_value
value_byte:
call get_byte_value
xor edx,edx
movzx eax,al
jmp truncated_value
get_address_word_value:
mov [address_size],2
mov [value_size],2
jmp calculate_address
get_address_dword_value:
mov [address_size],4
1442,12 → 1535,14
calculate_address:
cmp byte [esi],'.'
je invalid_address
call calculate_expression
mov eax,[edi+16]
mov [address_symbol],eax
mov al,[edi+12]
mov [value_type],al
cmp al,6
call calculate_expression
mov eax,[edi+16]
mov [address_symbol],eax
mov al,[edi+13]
mov [address_sign],al
mov al,[edi+12]
mov [value_type],al
cmp al,6
je special_address_type_32bit
cmp al,5
je special_address_type_32bit
1477,15 → 1572,13
mov eax,[edi]
cdq
cmp edx,[edi+4]
je address_size_ok
cmp [error_line],0
jne address_size_ok
mov ecx,[current_line]
mov [error_line],ecx
mov [error],value_out_of_range
address_size_ok:
xor ebx,ebx
xor ecx,ecx
je address_size_ok
cmp [error_line],0
jne address_size_ok
call recoverable_overflow
address_size_ok:
xor ebx,ebx
xor ecx,ecx
mov cl,[value_type]
shl ecx,16
mov ch,[address_size]
1494,16 → 1587,24
mov al,[edi+8]
mov dl,[edi+10]
call get_address_register
mov al,[edi+9]
mov dl,[edi+11]
call get_address_register
mov ax,bx
shr ah,4
shr al,4
or bh,bh
mov al,[edi+9]
mov dl,[edi+11]
call get_address_register
mov ax,bx
shr ah,4
shr al,4
cmp ah,0Ch
je check_vsib_address
cmp ah,0Dh
je check_vsib_address
cmp al,0Ch
je check_vsib_address
cmp al,0Dh
je check_vsib_address
or bh,bh
jz check_address_registers
or bl,bl
jz check_address_registers
or bl,bl
jz check_address_registers
cmp al,ah
jne invalid_address
check_address_registers:
1530,20 → 1631,24
jne invalid_address
mov al,bh
and al,0Fh
cmp al,ah
cmp al,ah
jne invalid_address
check_ip_relative_address:
or bl,bl
jnz invalid_address
cmp bh,0F4h
je check_dword_value
cmp bh,0F8h
jne invalid_address
check_ip_relative_address:
cmp bh,0F4h
je check_dword_value
cmp bh,0F8h
jne invalid_address
mov eax,[edi]
cdq
cmp edx,[edi+4]
jne range_exceeded
ret
get_address_register:
or al,al
cdq
cmp edx,[edi+4]
jne range_exceeded
cmp dl,[edi+13]
jne range_exceeded
ret
get_address_register:
or al,al
jz address_register_ok
cmp dl,1
jne scaled_register
1635,12 → 1740,42
jnz invalid_address
mov al,cl
dec al
and al,cl
jz check_immediate_address
jmp invalid_address
calculate_relative_offset:
cmp [value_undefined],0
jne relative_offset_ok
and al,cl
jz check_immediate_address
jmp invalid_address
check_vsib_address:
cmp ah,0Ch
je swap_vsib_registers
cmp ah,0Dh
jne check_vsib_base
swap_vsib_registers:
cmp cl,1
ja invalid_address
xchg bl,bh
mov cl,1
check_vsib_base:
test bh,bh
jz vsib_base_ok
mov al,bh
shr al,4
cmp al,4
je vsib_base_ok
cmp [code_type],64
jne invalid_address
cmp al,8
jne invalid_address
vsib_base_ok:
mov al,bl
shr al,4
cmp al,0Ch
je check_index_scale
cmp al,0Dh
je check_index_scale
jmp invalid_address
 
calculate_relative_offset:
cmp [value_undefined],0
jne relative_offset_ok
test bh,bh
setne ch
cmp bx,word [org_registers]
1649,35 → 1784,46
xchg ch,cl
cmp bx,word [org_registers]
jne invalid_value
origin_registers_ok:
cmp cx,word [org_registers+2]
jne invalid_value
add eax,dword [org_origin]
adc edx,dword [org_origin+4]
sub eax,edi
sbb edx,0
mov bl,[value_type]
or bl,bl
je relative_offset_ok
test bl,1
jnz invalid_use_of_symbol
mov ecx,[address_symbol]
mov [symbol_identifier],ecx
cmp bl,6
je plt_relative_offset
cmp bl,[labels_type]
jne invalid_use_of_symbol
mov [value_type],0
cmp ecx,[org_symbol]
je relative_offset_ok
origin_registers_ok:
cmp cx,word [org_registers+2]
jne invalid_value
mov bl,[address_sign]
add eax,dword [org_origin]
adc edx,dword [org_origin+4]
adc bl,[org_origin_sign]
sub eax,edi
sbb edx,0
sbb bl,0
mov [value_sign],bl
mov bl,[value_type]
mov ecx,[address_symbol]
mov [symbol_identifier],ecx
test bl,1
jnz relative_offset_unallowed
cmp bl,6
je plt_relative_offset
cmp bl,[labels_type]
je set_relative_offset_type
relative_offset_unallowed:
call recoverable_misuse
set_relative_offset_type:
cmp [value_type],0
je relative_offset_ok
mov [value_type],0
cmp ecx,[org_symbol]
je relative_offset_ok
mov [value_type],3
relative_offset_ok:
ret
plt_relative_offset:
mov [value_type],7
ret
 
calculate_logical_expression:
ret
plt_relative_offset:
mov [value_type],7
cmp [labels_type],2
je relative_offset_ok
cmp [labels_type],4
jne recoverable_misuse
ret
 
calculate_logical_expression:
xor al,al
calculate_embedded_logical_expression:
mov [logical_value_wrapping],al
1709,12 → 1855,34
logical_value_already_determined:
push eax
call skip_logical_value
jc invalid_expression
pop eax
jmp logical_loop
get_logical_value:
xor al,al
check_for_negation:
jc invalid_expression
pop eax
jmp logical_loop
get_value_for_comparison:
mov [value_size],8
mov [size_override],-1
lods byte [esi]
call calculate_expression
cmp byte [edi+8],0
jne first_register_size_ok
mov byte [edi+10],0
first_register_size_ok:
cmp byte [edi+9],0
jne second_register_size_ok
mov byte [edi+11],0
second_register_size_ok:
mov eax,[edi+16]
mov [symbol_identifier],eax
mov al,[edi+13]
mov [value_sign],al
mov bl,[edi+12]
mov eax,[edi]
mov edx,[edi+4]
mov ecx,[edi+8]
ret
get_logical_value:
xor al,al
check_for_negation:
cmp byte [esi],'~'
jne negation_ok
inc esi
1732,15 → 1900,15
cmp al,89h
je check_for_used
cmp al,'0'
je given_false
cmp al,'1'
je given_true
call get_value
mov bl,[value_type]
push eax edx ebx
mov al,[esi]
or al,al
jz logical_number
je given_false
cmp al,'1'
je given_true
call get_value_for_comparison
mov bh,[value_sign]
push eax edx [symbol_identifier] ebx ecx
mov al,[esi]
or al,al
jz logical_number
cmp al,0Fh
je logical_number
cmp al,'}'
1748,77 → 1916,128
cmp al,'&'
je logical_number
cmp al,'|'
je logical_number
inc esi
mov [compare_type],al
call get_value
pop ebx
cmp [next_pass_needed],0
jne values_ok
cmp bl,[value_type]
jne invalid_use_of_symbol
values_ok:
pop ecx ebx
cmp [compare_type],'='
je check_equal
cmp [compare_type],'>'
je check_greater
cmp [compare_type],'<'
je check_less
cmp [compare_type],0F1h
je check_not_equal
cmp [compare_type],0F2h
je check_not_less
cmp [compare_type],0F3h
je check_not_greater
jmp invalid_expression
check_equal:
cmp eax,ebx
jne return_false
cmp edx,ecx
jne return_false
jmp return_true
check_greater:
cmp edx,ecx
jl return_true
jg return_false
cmp eax,ebx
jb return_true
jae return_false
check_less:
cmp edx,ecx
jl return_false
jg return_true
cmp eax,ebx
jbe return_false
ja return_true
check_not_less:
cmp edx,ecx
jl return_true
jg return_false
cmp eax,ebx
jbe return_true
ja return_false
check_not_greater:
cmp edx,ecx
jl return_false
jg return_true
cmp eax,ebx
jb return_false
jae return_true
check_not_equal:
cmp eax,ebx
jne return_true
cmp edx,ecx
jne return_true
jmp return_false
logical_number:
pop ebx edx eax
or bl,bl
jnz invalid_expression
or eax,edx
jnz return_true
jmp return_false
je logical_number
inc esi
mov [compare_type],al
call get_value_for_comparison
cmp bl,[esp+4]
jne values_not_relative
or bl,bl
jz check_values_registers
mov ebx,[symbol_identifier]
cmp ebx,[esp+8]
jne values_not_relative
check_values_registers:
cmp ecx,[esp]
je values_relative
ror ecx,16
xchg ch,cl
ror ecx,16
xchg ch,cl
cmp ecx,[esp]
je values_relative
values_not_relative:
cmp [compare_type],0F8h
jne invalid_comparison
add esp,12+8
jmp return_false
invalid_comparison:
call recoverable_misuse
values_relative:
pop ebx
shl ebx,16
mov bx,[esp]
add esp,8
pop ecx ebp
cmp [compare_type],'='
je check_equal
cmp [compare_type],0F1h
je check_not_equal
cmp [compare_type],0F8h
je return_true
test ebx,0FFFF0000h
jz check_less_or_greater
call recoverable_misuse
check_less_or_greater:
cmp [compare_type],'>'
je check_greater
cmp [compare_type],'<'
je check_less
cmp [compare_type],0F2h
je check_not_less
cmp [compare_type],0F3h
je check_not_greater
jmp invalid_expression
check_equal:
cmp bh,[value_sign]
jne return_false
cmp eax,ebp
jne return_false
cmp edx,ecx
jne return_false
jmp return_true
check_greater:
cmp bh,[value_sign]
jg return_true
jl return_false
cmp edx,ecx
jb return_true
ja return_false
cmp eax,ebp
jb return_true
jae return_false
check_less:
cmp bh,[value_sign]
jg return_false
jl return_true
cmp edx,ecx
jb return_false
ja return_true
cmp eax,ebp
jbe return_false
ja return_true
check_not_less:
cmp bh,[value_sign]
jg return_true
jl return_false
cmp edx,ecx
jb return_true
ja return_false
cmp eax,ebp
jbe return_true
ja return_false
check_not_greater:
cmp bh,[value_sign]
jg return_false
jl return_true
cmp edx,ecx
jb return_false
ja return_true
cmp eax,ebp
jb return_false
jae return_true
check_not_equal:
cmp bh,[value_sign]
jne return_true
cmp eax,ebp
jne return_true
cmp edx,ecx
jne return_true
jmp return_false
logical_number:
pop ecx ebx eax edx eax
or bl,bl
jnz invalid_logical_number
or cx,cx
jz logical_number_ok
invalid_logical_number:
call recoverable_misuse
logical_number_ok:
test bh,bh
jnz return_true
or eax,edx
jnz return_true
jmp return_false
check_for_defined:
or bl,-1
lods word [esi]
2013,6 → 2232,55
inc esi
jmp skip_done
nothing_to_skip:
dec esi
stc
ret
dec esi
stc
ret
 
expand_path:
lods byte [esi]
cmp al,'%'
je environment_variable
stos byte [edi]
or al,al
jnz expand_path
cmp edi,[memory_end]
ja out_of_memory
ret
environment_variable:
mov ebx,esi
find_variable_end:
lods byte [esi]
or al,al
jz not_environment_variable
cmp al,'%'
jne find_variable_end
mov byte [esi-1],0
push esi
mov esi,ebx
call get_environment_variable
pop esi
mov byte [esi-1],'%'
jmp expand_path
not_environment_variable:
mov al,'%'
stos byte [edi]
mov esi,ebx
jmp expand_path
get_include_directory:
lods byte [esi]
cmp al,';'
je include_directory_ok
stos byte [edi]
or al,al
jnz get_include_directory
dec esi
dec edi
include_directory_ok:
cmp byte [edi-1],'/'
je path_separator_ok
cmp byte [edi-1],'\'
je path_separator_ok
mov al,'/'
stos byte [edi]
path_separator_ok:
ret
/programs/develop/fasm/trunk/exprpars.inc
1,9 → 1,9
 
; flat assembler core
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
 
convert_expression:
 
; flat assembler core
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
 
convert_expression:
push ebp
call get_fp_value
jnc fp_expression
12,14 → 12,14
push edi
mov edi,single_operand_operators
call get_operator
pop edi
or al,al
jz expression_element
cmp al,82h
je expression_loop
push eax
jmp expression_loop
expression_element:
pop edi
or al,al
jz expression_element
cmp al,82h
je expression_loop
push eax
jmp expression_loop
expression_element:
mov al,[esi]
cmp al,1Ah
je expression_number
131,18 → 131,46
cmp al,')'
jne invalid_expression
ret
symbol_value:
cmp [source_start],0
je preprocessor_value
push edi
mov edi,address_registers
call get_operator
symbol_value:
cmp [source_start],0
je preprocessor_value
push edi esi
lods word [esi]
cmp al,1Ah
jne no_address_register
movzx ecx,ah
call get_symbol
jc no_address_register
cmp al,10h
jne no_address_register
mov al,ah
shr ah,4
cmp ah,4
je register_value
cmp ah,8
je register_value
cmp ah,0Ch
je register_value
cmp ah,0Dh
je register_value
cmp ah,0Fh
je register_value
cmp ah,2
jne no_address_register
cmp al,23h
je register_value
cmp al,25h
je register_value
cmp al,26h
je register_value
cmp al,27h
je register_value
no_address_register:
pop esi
mov edi,directive_operators
call get_operator
pop edi
or al,al
jnz register_value
mov edi,directive_operators
call get_operator
pop edi
or al,al
jnz broken_value
lods byte [esi]
cmp al,1Ah
155,13 → 183,13
stos dword [edi]
ret
broken_value:
mov eax,0Fh
jmp store_label_value
register_value:
pop edi
mov byte [edi-1],10h
stos byte [edi]
ret
mov eax,0Fh
jmp store_label_value
register_value:
pop edx edi
mov byte [edi-1],10h
stos byte [edi]
ret
preprocessor_value:
dec edi
cmp [hash_tree],0
390,18 → 418,18
cmp al,7
ja bad_number
oct_digit_ok:
xor edx,edx
mov cl,bl
dec esi
cmp bl,63
ja oct_out_of_range
jne oct_range_ok
cmp al,1
ja oct_out_of_range
oct_range_ok:
add bl,3
cmp cl,30
je oct_digit_wrap
xor edx,edx
mov cl,bl
dec esi
cmp bl,63
ja oct_out_of_range
jne oct_range_ok
cmp al,1
ja oct_out_of_range
oct_range_ok:
add bl,3
cmp cl,30
je oct_digit_wrap
ja oct_digit_high
shl eax,cl
or dword [edi],eax
/programs/develop/fasm/trunk/formats.inc
35,14 → 35,15
jae out_of_memory
cmp [file_extension],0
jne extension_specified
cmp [output_format],2
mov al,[output_format]
cmp al,2
je exe_extension
jb bin_extension
cmp [output_format],4
cmp al,4
je obj_extension
cmp [output_format],5
cmp al,5
je o_extension
cmp [output_format],3
cmp al,3
jne no_extension
cmp [subsystem],1
je sys_extension
164,7 → 165,7
mov [current_offset],edi
sub edi,[code_start]
mov [code_size],edi
mov [written_size],0
and [written_size],0
mov edx,[output_file]
call create
jc write_failed
324,10 → 325,18
cmp eax,0Fh
jb invalid_use_of_symbol
je reserved_word_used_as_symbol
inc esi
mov dx,[current_pass]
mov [eax+18],dx
or byte [eax+8],8
inc esi
cmp [symbols_file],0
je public_reference_ok
cmp [next_pass_needed],0
jne public_reference_ok
mov ebx,eax
call store_label_reference
mov eax,ebx
public_reference_ok:
mov ebx,[free_additional_memory]
lea edx,[ebx+10h]
cmp edx,[structures_buffer]
395,6 → 404,7
jne invalid_argument
extrn_size_ok:
mov [address_symbol],edx
mov [label_size],ah
movzx ecx,ah
mov [edx+8],ecx
xor eax,eax
485,6 → 495,7
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
503,7 → 514,8
segment_type_ok:
mov [code_type],al
mov eax,edx
mov cx,0100h
mov ch,1
mov [label_size],0
xor edx,edx
xor ebp,ebp
mov [address_symbol],edx
515,11 → 527,7
call get_word_value
cmp [value_type],1
je initial_cs_ok
cmp [error_line],0
jne initial_cs_ok
mov eax,[current_line]
mov [error_line],eax
mov [error],invalid_address
call recoverable_invalid_address
initial_cs_ok:
mov edx,[additional_memory]
mov [edx+16h],ax
536,6 → 544,14
mov edx,[additional_memory]
mov [edx+14h],ax
jmp instruction_assembled
recoverable_invalid_address:
cmp [error_line],0
jne ignore_invalid_address
push [current_line]
pop [error_line]
mov [error],invalid_address
ignore_invalid_address:
ret
mz_stack:
lods byte [esi]
cmp al,'('
553,11 → 569,7
stack_pointer:
cmp [value_type],1
je initial_ss_ok
cmp [error_line],0
jne initial_ss_ok
mov eax,[current_line]
mov [error_line],eax
mov [error],invalid_address
call recoverable_invalid_address
initial_ss_ok:
mov edx,[additional_memory]
mov [edx+0Eh],ax
834,7 → 846,7
mov [subsystem],3
mov [subsystem_version],3 + 10 shl 16
mov [image_base],400000h
mov [image_base_high],0
and [image_base_high],0
test [format_flags],8
jz pe_settings
mov [machine],8664h
1061,7 → 1073,7
jc pe_entry_init_ok
mov [edx+28h],eax ; entry point rva
pe_entry_init_ok:
mov [number_of_sections],0
and [number_of_sections],0
movzx ebx,word [edx+14h]
lea ebx,[edx+18h+ebx]
mov [current_section],ebx
1071,38 → 1083,45
mov [ebx+0Ch],eax
mov dword [ebx+24h],0E0000060h
xor ecx,ecx
xor bl,bl
not eax
not ecx
not bl
add eax,1
adc ecx,0
adc bl,0
add eax,edi
adc ecx,0
adc bl,0
test [format_flags],4
jnz peplus_org
sub eax,[edx+34h]
sbb ecx,0
sbb bl,0
jmp pe_org_ok
peplus_org:
sub eax,[edx+30h]
sbb ecx,[edx+34h]
sbb bl,0
pe_org_ok:
test [format_flags],8
jnz pe64_code
mov bl,2
mov bh,2
mov [code_type],32
jmp pe_code_type_ok
pe64_code:
mov bl,4
mov bh,4
mov [code_type],64
pe_code_type_ok:
bt [resolver_flags],0
jc pe_labels_type_ok
xor bl,bl
xor bh,bh
pe_labels_type_ok:
mov [labels_type],bl
mov [labels_type],bh
mov dword [org_origin],eax
mov dword [org_origin+4],ecx
mov [org_registers],0
mov [org_origin_sign],bl
and [org_registers],0
mov [org_start],edi
bt [format_flags],8
jnc dll_flag_ok
1155,13 → 1174,15
mov esi,edx
rep movs byte [edi],[esi]
pop edi esi
mov dword [ebx+24h],0
and dword [ebx+24h],0
mov [ebx+14h],edi
mov edx,[code_start]
mov eax,edi
xor ecx,ecx
mov [org_origin_sign],0
sub eax,[ebx+0Ch]
sbb ecx,0
sbb [org_origin_sign],0
mov [labels_type],2
mov [code_type],32
test [format_flags],8
1173,6 → 1194,7
jnz peplus_section_org
sub eax,[edx+34h]
sbb ecx,0
sbb [org_origin_sign],0
bt [resolver_flags],0
jc pe_section_org_ok
mov [labels_type],0
1180,6 → 1202,7
peplus_section_org:
sub eax,[edx+30h]
sbb ecx,[edx+34h]
sbb [org_origin_sign],0
bt [resolver_flags],0
jc pe_section_org_ok
mov [labels_type],0
1186,7 → 1209,7
pe_section_org_ok:
mov dword [org_origin],eax
mov dword [org_origin+4],ecx
mov [org_registers],0
and [org_registers],0
mov [org_start],edi
get_section_flags:
lods byte [esi]
1246,7 → 1269,7
jb align_section
mov edi,[undefined_data_start]
align_section:
mov [undefined_data_end],0
and [undefined_data_end],0
mov ebp,edi
sub ebp,[ebx+14h]
mov ecx,[edx+3Ch]
1373,11 → 1396,7
check_pe_entry_label_type:
cmp [value_type],bl
je pe_entry_ok
cmp [error_line],0
jne pe_entry_ok
mov edx,[current_line]
mov [error_line],edx
mov [error],invalid_address
call recoverable_invalid_address
pe_entry_ok:
cdq
test [format_flags],4
1395,19 → 1414,13
check_pe64_entry_label_type:
cmp [value_type],bl
je pe64_entry_type_ok
cmp [error_line],0
jne pe64_entry_type_ok
mov edx,[current_line]
mov [error_line],edx
mov [error],invalid_address
call recoverable_invalid_address
pe64_entry_type_ok:
mov ecx,[code_start]
sub eax,[ecx+30h]
sbb edx,[ecx+34h]
jz pe64_entry_range_ok
mov edx,[current_line]
mov [error_line],edx
mov [error],value_out_of_range
call recoverable_overflow
pe64_entry_range_ok:
mov [ecx+28h],eax
jmp instruction_assembled
1540,11 → 1553,7
check_standard_pe_relocation_type:
cmp [value_type],2
je pe_relocation_type_ok
cmp [error_line],0
jne pe_relocation_type_ok
mov eax,[current_line]
mov [error_line],eax
mov [error],invalid_use_of_symbol
call recoverable_misuse
pe_relocation_type_ok:
mov ebx,[current_section]
mov eax,edi
1580,7 → 1589,7
jc fixups_ready
or [next_pass_needed],-1
fixups_ready:
mov [last_fixup_base],0
and [last_fixup_base],0
call make_fixups
xchg eax,[actual_fixups_size]
sub eax,[actual_fixups_size]
1652,7 → 1661,7
je resource_from_file
cmp [current_pass],0
jne reserve_space_for_resource
mov [resource_size],0
and [resource_size],0
reserve_space_for_resource:
add edi,[resource_size]
cmp edi,[display_buffer]
2310,18 → 2319,28
mov [current_section],ebx
xor eax,eax
mov [number_of_sections],eax
call setup_coff_section_org
mov [code_type],32
test [format_flags],8
jz format_defined
mov [code_type],64
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
mov [code_type],32
test [format_flags],8
jz format_defined
ret
coff_64bit_labels:
mov [labels_type],4
mov [code_type],64
jmp format_defined
ret
 
coff_section:
call close_coff_section
mov ebx,[free_additional_memory]
2334,18 → 2353,9
xor eax,eax
mov [ebx],al
mov [ebx+8],edi
mov dword [org_origin],edi
mov dword [org_origin+4],eax
mov [org_registers],eax
mov [org_start],edi
mov [org_symbol],ebx
mov [labels_type],2
test [format_flags],8
jz coff_labels_type_ok
mov [labels_type],4
coff_labels_type_ok:
mov [ebx+10h],eax
mov [ebx+14h],eax
call setup_coff_section_org
lods word [esi]
cmp ax,'('
jne invalid_argument
2552,8 → 2562,8
mov edx,[esi+8]
add esi,10h
inc eax
cmp byte [edx+11],2
jne enumerate_symbols
cmp byte [edx+11],0
je enumerate_symbols
mov edx,[edx+20]
cmp byte [edx],0C0h
jae enumerate_symbols
2803,13 → 2813,14
mov cx,[ecx+1Eh]
mov [ebx+0Ch],cx
public_symbol_section_ok:
cmp dword [eax+4],0
je store_public_symbol
cmp dword [eax+4],-1
movzx ecx,byte [eax+9]
shr cl,1
and cl,1
neg ecx
cmp ecx,[eax+4]
jne value_out_of_range
bt dword [eax],31
jnc value_out_of_range
store_public_symbol:
xor ecx,[eax]
js value_out_of_range
mov eax,[eax]
mov [ebx+8],eax
mov al,2
2850,7 → 2861,7
mov [edx],eax
sub edi,[code_start]
mov [code_size],edi
mov [written_size],0
and [written_size],0
mov edx,[output_file]
call create
jc write_failed
2910,7 → 2921,6
mov [code_type],32
cmp word [esi],1D19h
je format_elf_exe
mov [labels_type],2
elf_header_ok:
mov byte [edx+10h],1
mov eax,[additional_memory]
2923,11 → 2933,6
xor eax,eax
mov [current_section],ebx
mov [number_of_sections],eax
mov dword [org_origin],edi
mov dword [org_origin+4],eax
mov [org_registers],eax
mov [org_start],edi
mov [org_symbol],ebx
mov [ebx],al
mov [ebx+4],eax
mov [ebx+8],edi
2935,6 → 2940,7
mov [ebx+14h],eax
mov al,4
mov [ebx+10h],eax
call setup_coff_section_org
test [format_flags],8
jz format_defined
mov byte [ebx+10h],8
2958,9 → 2964,8
mov byte [edx+3Ah],40h
mov [code_type],64
cmp word [esi],1D19h
je format_elf64_exe
mov [labels_type],4
jmp elf_header_ok
jne elf_header_ok
jmp format_elf64_exe
elf_section:
bt [format_flags],0
jc illegal_instruction
2976,21 → 2981,10
xor eax,eax
mov [ebx],al
mov [ebx+8],edi
mov dword [org_origin],edi
mov dword [org_origin+4],eax
mov [org_registers],eax
mov [org_start],edi
mov [org_symbol],ebx
test [format_flags],8
jnz elf64_labels_type
mov [labels_type],2
jmp elf_labels_type_ok
elf64_labels_type:
mov [labels_type],4
elf_labels_type_ok:
mov [ebx+10h],eax
mov al,10b
mov [ebx+14h],eax
call setup_coff_section_org
lods word [esi]
cmp ax,'('
jne invalid_argument
3218,8 → 3212,7
mov dx,[eax+0Eh]
jmp section_for_public_ok
undefined_public:
mov eax,[ebx+24]
mov [error_info],eax
mov [error_info],ebx
jmp undefined_symbol
elf64_public:
cmp dl,4
3233,7 → 3226,15
stos dword [edi]
test [format_flags],8
jnz elf64_public_symbol
call get_public_value
movzx eax,byte [ebx+9]
shr al,1
and al,1
neg eax
cmp eax,[ebx+4]
jne value_out_of_range
xor eax,[ebx]
js value_out_of_range
mov eax,[ebx]
stos dword [edi]
xor eax,eax
mov al,[ebx+10]
3262,9 → 3263,13
or al,2
store_elf64_public_info:
stos dword [edi]
call get_public_value
mov al,[ebx+9]
shl eax,31-1
xor eax,[ebx+4]
js value_out_of_range
mov eax,[ebx]
stos dword [edi]
xor eax,eax
mov eax,[ebx+4]
stos dword [edi]
mov al,[ebx+10]
stos dword [edi]
3278,16 → 3283,6
mov [esi],eax
add esi,10h
jmp find_other_symbols
get_public_value:
mov eax,[ebx]
cmp dword [ebx+4],0
je public_value_ok
cmp dword [ebx+4],-1
jne value_out_of_range
bt eax,31
jnc value_out_of_range
public_value_ok:
ret
make_extrn_symbol:
mov eax,[esi+4]
stos dword [edi]
3488,7 → 3483,7
stos dword [edi]
test [format_flags],8
jz elf_machine_word_ok
mov dword [edi],0
and dword [edi],0
add edi,4
elf_machine_word_ok:
ret
3669,27 → 3664,36
init_elf_segments:
xor eax,eax
rep stos dword [edi]
mov [number_of_sections],0
and [number_of_sections],0
mov byte [ebx],1
mov word [ebx+1Ch],1000h
mov byte [ebx+18h],111b
mov eax,edi
xor ebp,ebp
xor cl,cl
sub eax,[code_start]
sbb ebp,0
sbb cl,0
mov [ebx+4],eax
add eax,[image_base]
adc ebp,0
adc cl,0
mov [ebx+8],eax
mov [ebx+0Ch],eax
mov [edx+18h],eax
xor edx,edx
not eax
not edx
not ebp
not cl
add eax,1
adc edx,0
adc ebp,0
adc cl,0
add eax,edi
adc edx,0
adc ebp,0
adc cl,0
mov dword [org_origin],eax
mov dword [org_origin+4],edx
mov [org_registers],0
mov [org_origin_sign],cl
and [org_registers],0
mov [org_start],edi
mov [symbols_stream],edi
jmp format_defined
3709,7 → 3713,7
mov [edx+7],al
elf64_exe_brand_ok:
mov [image_base],400000h
mov [image_base_high],0
and [image_base_high],0
cmp byte [esi],80h
jne elf64_exe_base_ok
lods word [esi]
3735,7 → 3739,7
init_elf64_segments:
xor eax,eax
rep stos dword [edi]
mov [number_of_sections],0
and [number_of_sections],0
mov byte [ebx],1
mov word [ebx+30h],1000h
mov byte [ebx+4],111b
3744,8 → 3748,10
sub eax,[code_start]
mov [ebx+8],eax
xor edx,edx
xor cl,cl
add eax,[image_base]
adc edx,[image_base_high]
adc cl,0
mov [ebx+10h],eax
mov [ebx+10h+4],edx
mov [ebx+18h],eax
3755,13 → 3761,17
mov [ebx+18h+4],edx
not eax
not edx
not cl
add eax,1
adc edx,0
adc cl,0
add eax,edi
adc edx,0
adc cl,0
mov dword [org_origin],eax
mov dword [org_origin+4],edx
mov [org_registers],0
mov [org_origin_sign],cl
and [org_registers],0
mov [org_start],edi
mov [symbols_stream],edi
jmp format_defined
3863,15 → 3873,20
mov [ebx+0Ch],edx
mov eax,edx
xor edx,edx
xor cl,cl
not eax
not edx
not cl
add eax,1
adc edx,0
adc cl,0
add eax,edi
adc edx,0
adc cl,0
mov dword [org_origin],eax
mov dword [org_origin+4],edx
mov [org_registers],0
mov [org_origin_sign],cl
and [org_registers],0
mov [org_start],edi
inc [number_of_sections]
jmp instruction_assembled
3990,15 → 4005,20
mov [ebx+10h+4],edx
mov [ebx+18h],eax
mov [ebx+18h+4],edx
xor cl,cl
not eax
not edx
not cl
add eax,1
adc edx,0
adc cl,0
add eax,edi
adc edx,0
adc cl,0
mov dword [org_origin],eax
mov dword [org_origin+4],edx
mov [org_registers],0
mov [org_origin_sign],cl
and [org_registers],0
mov [org_start],edi
inc [number_of_sections]
jmp instruction_assembled
/programs/develop/fasm/trunk/messages.inc
1,9 → 1,9
 
; flat assembler core
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
 
_out_of_memory db 'out of memory',0
 
; flat assembler core
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
 
_out_of_memory db 'out of memory',0
_stack_overflow db 'out of stack space',0
_main_file_not_found db 'source file not found',0
_unexpected_end_of_file db 'unexpected end of file',0
22,13 → 22,13
_invalid_operand db 'invalid operand',0
_invalid_operand_size db 'invalid size of operand',0
_operand_size_not_specified db 'operand size not specified',0
_operand_sizes_do_not_match db 'operand sizes do not match',0
_invalid_address_size db 'invalid size of address value',0
_address_sizes_do_not_agree db 'address sizes do not agree',0
_prefix_conflict db 'disallowed combination of registers',0
_long_immediate_not_encodable db 'not encodable with long immediate',0
_relative_jump_out_of_range db 'relative jump out of range',0
_invalid_expression db 'invalid expression',0
_operand_sizes_do_not_match db 'operand sizes do not match',0
_invalid_address_size db 'invalid size of address value',0
_address_sizes_do_not_agree db 'address sizes do not agree',0
_disallowed_combination_of_registers db 'disallowed combination of registers',0
_long_immediate_not_encodable db 'not encodable with long immediate',0
_relative_jump_out_of_range db 'relative jump out of range',0
_invalid_expression db 'invalid expression',0
_invalid_address db 'invalid address',0
_invalid_value db 'invalid value',0
_value_out_of_range db 'value out of range',0
45,8 → 45,8
_unexpected_instruction db 'unexpected instruction',0
_extra_characters_on_line db 'extra characters on line',0
_section_not_aligned_enough db 'section is not aligned enough',0
_setting_already_specified db 'setting already specified',0
_data_already_defined db 'data already defined',0
_too_many_repeats db 'too many repeats',0
_invoked_error db 'error directive invoked in source file',0
_assertion_failed db 'assertion failed',0
_setting_already_specified db 'setting already specified',0
_data_already_defined db 'data already defined',0
_too_many_repeats db 'too many repeats',0
_invoked_error db 'error directive invoked in source file',0
_assertion_failed db 'assertion failed',0
/programs/develop/fasm/trunk/parser.inc
503,7 → 503,7
cmp al,','
je separator
cmp al,'='
je separator
je expression_comparator
cmp al,'|'
je separator
cmp al,'&'
569,7 → 569,11
je parse_from_operator
cmp al,89h
je parse_label_operator
cmp al,0F8h
je forced_expression
jmp argument_parsed
instruction_separator:
stos byte [edi]
allow_embedded_instruction:
cmp byte [esi],1Ah
jne parse_argument
810,6 → 814,29
stos byte [edi]
inc [parenthesis_stack]
jmp parse_argument
expression_comparator:
stos byte [edi]
jmp forced_expression
greater:
cmp byte [esi],'='
jne separator
inc esi
mov al,0F2h
jmp separator
less:
cmp byte [edi-1],0F6h
je separator
cmp byte [esi],'>'
je not_equal
cmp byte [esi],'='
jne separator
inc esi
mov al,0F3h
jmp separator
not_equal:
inc esi
mov al,0F1h
jmp expression_comparator
expression:
mov al,'('
stos byte [edi]
892,30 → 919,6
mov al,'}'
separator:
stos byte [edi]
jmp argument_parsed
instruction_separator:
stos byte [edi]
jmp allow_embedded_instruction
greater:
cmp byte [esi],'='
jne separator
inc esi
mov al,0F2h
jmp separator
less:
cmp byte [edi-1],0F6h
je separator
cmp byte [esi],'>'
je not_equal
cmp byte [esi],'='
jne separator
inc esi
mov al,0F3h
jmp separator
not_equal:
inc esi
mov al,0F1h
jmp separator
argument_parsed:
cmp [parenthesis_stack],0
je parse_argument
984,6 → 987,7
jne next_operator
repe cmps byte [esi],[edi]
je operator_found
jb no_operator
next_operator:
mov edi,ebx
inc edi
1046,12 → 1050,10
ja symbols_up
jb symbols_down
mov ax,[edi]
 
cmp al,18h
jb symbol_ok
cmp [formatter_symbols_allowed],0
je no_symbol
 
symbol_ok:
pop esi
add esi,ebp
/programs/develop/fasm/trunk/preproce.inc
4,2584 → 4,2558
; All rights reserved.
 
preprocessor:
mov edi,characters
xor al,al
mov edi,characters
xor al,al
make_characters_table:
stosb
inc al
jnz make_characters_table
mov esi,characters+'a'
mov edi,characters+'A'
mov ecx,26
rep movsb
mov edi,characters
mov esi,symbol_characters+1
movzx ecx,byte [esi-1]
xor eax,eax
stosb
inc al
jnz make_characters_table
mov esi,characters+'a'
mov edi,characters+'A'
mov ecx,26
rep movsb
mov edi,characters
mov esi,symbol_characters+1
movzx ecx,byte [esi-1]
xor eax,eax
mark_symbol_characters:
lodsb
mov byte [edi+eax],0
loop mark_symbol_characters
mov edi,locals_counter
mov ax,1 + '0' shl 8
stos word [edi]
mov edi,[memory_start]
mov [include_paths],edi
mov esi,include_variable
call get_environment_variable
xor al,al
stos byte [edi]
mov [memory_start],edi
mov eax,[additional_memory]
mov [free_additional_memory],eax
mov eax,[additional_memory_end]
mov [labels_list],eax
xor eax,eax
mov [source_start],eax
mov [display_buffer],eax
mov [hash_tree],eax
mov [macro_status],al
mov esi,[input_file]
mov edx,esi
call open
jc main_file_not_found
mov edi,[memory_start]
call preprocess_file
mov eax,[error_line]
mov [current_line],eax
cmp [macro_status],0
jne incomplete_macro
mov [source_start],edi
ret
lodsb
mov byte [edi+eax],0
loop mark_symbol_characters
mov edi,locals_counter
mov ax,1 + '0' shl 8
stos word [edi]
mov edi,[memory_start]
mov [include_paths],edi
mov esi,include_variable
call get_environment_variable
xor al,al
stos byte [edi]
mov [memory_start],edi
mov eax,[additional_memory]
mov [free_additional_memory],eax
mov eax,[additional_memory_end]
mov [labels_list],eax
xor eax,eax
mov [source_start],eax
mov [display_buffer],eax
mov [hash_tree],eax
mov [error],eax
mov [macro_status],al
mov esi,[input_file]
mov edx,esi
call open
jc main_file_not_found
mov edi,[memory_start]
call preprocess_file
mov eax,[error_line]
mov [current_line],eax
cmp [macro_status],0
jne incomplete_macro
mov [source_start],edi
ret
 
preprocess_file:
push [memory_end]
push esi
mov al,2
xor edx,edx
call lseek
push eax
xor al,al
xor edx,edx
call lseek
pop ecx
mov edx,[memory_end]
dec edx
mov byte [edx],1Ah
sub edx,ecx
jc out_of_memory
mov esi,edx
cmp edx,edi
jbe out_of_memory
mov [memory_end],edx
call read
call close
pop edx
xor ecx,ecx
mov ebx,esi
push [memory_end]
push esi
mov al,2
xor edx,edx
call lseek
push eax
xor al,al
xor edx,edx
call lseek
pop ecx
mov edx,[memory_end]
dec edx
mov byte [edx],1Ah
sub edx,ecx
jc out_of_memory
mov esi,edx
cmp edx,edi
jbe out_of_memory
mov [memory_end],edx
call read
call close
pop edx
xor ecx,ecx
mov ebx,esi
preprocess_source:
inc ecx
mov [current_line],edi
mov eax,edx
stos dword [edi]
mov eax,ecx
stos dword [edi]
mov eax,esi
sub eax,ebx
stos dword [edi]
xor eax,eax
stos dword [edi]
push ebx edx
call convert_line
call preprocess_line
pop edx ebx
inc ecx
mov [current_line],edi
mov eax,edx
stos dword [edi]
mov eax,ecx
stos dword [edi]
mov eax,esi
sub eax,ebx
stos dword [edi]
xor eax,eax
stos dword [edi]
push ebx edx
call convert_line
call preprocess_line
pop edx ebx
next_line:
cmp byte [esi-1],0
je file_end
cmp byte [esi-1],1Ah
jne preprocess_source
cmp byte [esi-1],0
je file_end
cmp byte [esi-1],1Ah
jne preprocess_source
file_end:
pop [memory_end]
clc
ret
pop [memory_end]
clc
ret
 
convert_line:
push ecx
test [macro_status],0Fh
jz convert_line_data
mov ax,3Bh
stos word [edi]
push ecx
test [macro_status],0Fh
jz convert_line_data
mov ax,3Bh
stos word [edi]
convert_line_data:
cmp edi,[memory_end]
jae out_of_memory
lods byte [esi]
cmp al,20h
je convert_line_data
cmp al,9
je convert_line_data
mov ah,al
mov ebx,characters
xlat byte [ebx]
or al,al
jz convert_separator
cmp ah,27h
je convert_string
cmp ah,22h
je convert_string
mov byte [edi],1Ah
scas word [edi]
xchg al,ah
stos byte [edi]
mov ebx,characters
xor ecx,ecx
cmp edi,[memory_end]
jae out_of_memory
lods byte [esi]
cmp al,20h
je convert_line_data
cmp al,9
je convert_line_data
mov ah,al
mov ebx,characters
xlat byte [ebx]
or al,al
jz convert_separator
cmp ah,27h
je convert_string
cmp ah,22h
je convert_string
mov byte [edi],1Ah
scas word [edi]
xchg al,ah
stos byte [edi]
mov ebx,characters
xor ecx,ecx
convert_symbol:
lods byte [esi]
stos byte [edi]
xlat byte [ebx]
or al,al
loopnzd convert_symbol
neg ecx
cmp ecx,255
ja name_too_long
mov ebx,edi
sub ebx,ecx
mov byte [ebx-2],cl
lods byte [esi]
stos byte [edi]
xlat byte [ebx]
or al,al
loopnzd convert_symbol
neg ecx
cmp ecx,255
ja name_too_long
mov ebx,edi
sub ebx,ecx
mov byte [ebx-2],cl
found_separator:
dec edi
mov ah,[esi-1]
dec edi
mov ah,[esi-1]
convert_separator:
xchg al,ah
cmp al,20h
jb control_character
je convert_line_data
xchg al,ah
cmp al,20h
jb control_character
je convert_line_data
symbol_character:
cmp al,3Bh
je ignore_comment
cmp al,5Ch
je backslash_character
stos byte [edi]
jmp convert_line_data
cmp al,3Bh
je ignore_comment
cmp al,5Ch
je backslash_character
stos byte [edi]
jmp convert_line_data
control_character:
cmp al,1Ah
je line_end
cmp al,0Dh
je cr_character
cmp al,0Ah
je lf_character
cmp al,9
je convert_line_data
or al,al
jnz symbol_character
jmp line_end
cmp al,1Ah
je line_end
cmp al,0Dh
je cr_character
cmp al,0Ah
je lf_character
cmp al,9
je convert_line_data
or al,al
jnz symbol_character
jmp line_end
lf_character:
lods byte [esi]
cmp al,0Dh
je line_end
dec esi
jmp line_end
lods byte [esi]
cmp al,0Dh
je line_end
dec esi
jmp line_end
cr_character:
lods byte [esi]
cmp al,0Ah
je line_end
dec esi
jmp line_end
lods byte [esi]
cmp al,0Ah
je line_end
dec esi
jmp line_end
convert_string:
mov al,22h
stos byte [edi]
scas dword [edi]
mov ebx,edi
mov al,22h
stos byte [edi]
scas dword [edi]
mov ebx,edi
copy_string:
lods byte [esi]
stos byte [edi]
cmp al,0Ah
je missing_end_quote
cmp al,0Dh
je missing_end_quote
or al,al
jz missing_end_quote
cmp al,1Ah
je missing_end_quote
cmp al,ah
jne copy_string
lods byte [esi]
cmp al,ah
je copy_string
dec esi
dec edi
mov eax,edi
sub eax,ebx
mov [ebx-4],eax
jmp convert_line_data
lods byte [esi]
stos byte [edi]
cmp al,0Ah
je missing_end_quote
cmp al,0Dh
je missing_end_quote
or al,al
jz missing_end_quote
cmp al,1Ah
je missing_end_quote
cmp al,ah
jne copy_string
lods byte [esi]
cmp al,ah
je copy_string
dec esi
dec edi
mov eax,edi
sub eax,ebx
mov [ebx-4],eax
jmp convert_line_data
backslash_character:
mov byte [edi],0
lods byte [esi]
cmp al,20h
je concatenate_lines
cmp al,9
je concatenate_lines
cmp al,1Ah
je unexpected_end_of_file
or al,al
jz unexpected_end_of_file
cmp al,0Ah
je concatenate_lf
cmp al,0Dh
je concatenate_cr
cmp al,3Bh
je find_concatenated_line
mov al,1Ah
stos byte [edi]
mov ecx,edi
mov ax,5C01h
stos word [edi]
dec esi
mov byte [edi],0
lods byte [esi]
cmp al,20h
je concatenate_lines
cmp al,9
je concatenate_lines
cmp al,1Ah
je unexpected_end_of_file
or al,al
jz unexpected_end_of_file
cmp al,0Ah
je concatenate_lf
cmp al,0Dh
je concatenate_cr
cmp al,3Bh
je find_concatenated_line
mov al,1Ah
stos byte [edi]
mov ecx,edi
mov ax,5C01h
stos word [edi]
dec esi
group_backslashes:
lods byte [esi]
cmp al,5Ch
jne backslashed_symbol
stos byte [edi]
inc byte [ecx]
jmp group_backslashes
lods byte [esi]
cmp al,5Ch
jne backslashed_symbol
stos byte [edi]
inc byte [ecx]
jmp group_backslashes
backslashed_symbol:
cmp al,1Ah
je unexpected_end_of_file
or al,al
jz unexpected_end_of_file
cmp al,0Ah
je extra_characters_on_line
cmp al,0Dh
je extra_characters_on_line
cmp al,20h
je extra_characters_on_line
cmp al,9
je extra_characters_on_line
cmp al,22h
je extra_characters_on_line
cmp al,27h
je extra_characters_on_line
cmp al,3Bh
je extra_characters_on_line
mov ah,al
mov ebx,characters
xlat byte [ebx]
or al,al
jz backslashed_symbol_character
mov al,ah
cmp al,1Ah
je unexpected_end_of_file
or al,al
jz unexpected_end_of_file
cmp al,0Ah
je extra_characters_on_line
cmp al,0Dh
je extra_characters_on_line
cmp al,20h
je extra_characters_on_line
cmp al,9
je extra_characters_on_line
cmp al,22h
je extra_characters_on_line
cmp al,27h
je extra_characters_on_line
cmp al,3Bh
je extra_characters_on_line
mov ah,al
mov ebx,characters
xlat byte [ebx]
or al,al
jz backslashed_symbol_character
mov al,ah
convert_backslashed_symbol:
stos byte [edi]
xlat byte [ebx]
or al,al
jz found_separator
inc byte [ecx]
jz name_too_long
lods byte [esi]
jmp convert_backslashed_symbol
stos byte [edi]
xlat byte [ebx]
or al,al
jz found_separator
inc byte [ecx]
jz name_too_long
lods byte [esi]
jmp convert_backslashed_symbol
backslashed_symbol_character:
mov al,ah
stos byte [edi]
inc byte [ecx]
jmp convert_line_data
mov al,ah
stos byte [edi]
inc byte [ecx]
jmp convert_line_data
concatenate_lines:
lods byte [esi]
cmp al,20h
je concatenate_lines
cmp al,9
je concatenate_lines
cmp al,1Ah
je unexpected_end_of_file
or al,al
jz unexpected_end_of_file
cmp al,0Ah
je concatenate_lf
cmp al,0Dh
je concatenate_cr
cmp al,3Bh
jne extra_characters_on_line
lods byte [esi]
cmp al,20h
je concatenate_lines
cmp al,9
je concatenate_lines
cmp al,1Ah
je unexpected_end_of_file
or al,al
jz unexpected_end_of_file
cmp al,0Ah
je concatenate_lf
cmp al,0Dh
je concatenate_cr
cmp al,3Bh
jne extra_characters_on_line
find_concatenated_line:
lods byte [esi]
cmp al,0Ah
je concatenate_lf
cmp al,0Dh
je concatenate_cr
or al,al
jz concatenate_ok
cmp al,1Ah
jne find_concatenated_line
jmp unexpected_end_of_file
lods byte [esi]
cmp al,0Ah
je concatenate_lf
cmp al,0Dh
je concatenate_cr
or al,al
jz concatenate_ok
cmp al,1Ah
jne find_concatenated_line
jmp unexpected_end_of_file
concatenate_lf:
lods byte [esi]
cmp al,0Dh
je concatenate_ok
dec esi
jmp concatenate_ok
lods byte [esi]
cmp al,0Dh
je concatenate_ok
dec esi
jmp concatenate_ok
concatenate_cr:
lods byte [esi]
cmp al,0Ah
je concatenate_ok
dec esi
lods byte [esi]
cmp al,0Ah
je concatenate_ok
dec esi
concatenate_ok:
inc dword [esp]
jmp convert_line_data
inc dword [esp]
jmp convert_line_data
ignore_comment:
lods byte [esi]
cmp al,0Ah
je lf_character
cmp al,0Dh
je cr_character
or al,al
jz line_end
cmp al,1Ah
jne ignore_comment
lods byte [esi]
cmp al,0Ah
je lf_character
cmp al,0Dh
je cr_character
or al,al
jz line_end
cmp al,1Ah
jne ignore_comment
line_end:
xor al,al
stos byte [edi]
pop ecx
ret
xor al,al
stos byte [edi]
pop ecx
ret
 
lower_case:
mov edi,converted
mov ebx,characters
mov edi,converted
mov ebx,characters
convert_case:
lods byte [esi]
xlat byte [ebx]
stos byte [edi]
loop convert_case
lods byte [esi]
xlat byte [ebx]
stos byte [edi]
loop convert_case
case_ok:
ret
ret
 
get_directive:
push edi
mov edx,esi
mov ebp,ecx
call lower_case
pop edi
push edi
mov edx,esi
mov ebp,ecx
call lower_case
pop edi
scan_directives:
mov esi,converted
movzx eax,byte [edi]
or al,al
jz no_directive
mov ecx,ebp
inc edi
mov ebx,edi
add ebx,eax
mov ah,[esi]
cmp ah,[edi]
jb no_directive
ja next_directive
cmp cl,al
jne next_directive
repe cmps byte [esi],[edi]
jb no_directive
je directive_ok
mov esi,converted
movzx eax,byte [edi]
or al,al
jz no_directive
mov ecx,ebp
inc edi
mov ebx,edi
add ebx,eax
mov ah,[esi]
cmp ah,[edi]
jb no_directive
ja next_directive
cmp cl,al
jne next_directive
repe cmps byte [esi],[edi]
jb no_directive
je directive_ok
next_directive:
mov edi,ebx
add edi,2
jmp scan_directives
mov edi,ebx
add edi,2
jmp scan_directives
no_directive:
mov esi,edx
mov ecx,ebp
stc
ret
mov esi,edx
mov ecx,ebp
stc
ret
directive_ok:
lea esi,[edx+ebp]
call directive_handler
lea esi,[edx+ebp]
call directive_handler
directive_handler:
pop ecx
movzx eax,word [ebx]
add eax,ecx
clc
ret
pop ecx
movzx eax,word [ebx]
add eax,ecx
clc
ret
 
preprocess_line:
mov eax,esp
sub eax,100h
jc stack_overflow
cmp eax,[stack_limit]
jb stack_overflow
push ecx esi
mov eax,esp
sub eax,100h
jc stack_overflow
cmp eax,[stack_limit]
jb stack_overflow
push ecx esi
preprocess_current_line:
mov esi,[current_line]
add esi,16
cmp word [esi],3Bh
jne line_start_ok
add esi,2
mov esi,[current_line]
add esi,16
cmp word [esi],3Bh
jne line_start_ok
add esi,2
line_start_ok:
test [macro_status],0F0h
jnz macro_preprocessing
cmp byte [esi],1Ah
jne not_fix_constant
movzx edx,byte [esi+1]
lea edx,[esi+2+edx]
cmp word [edx],031Ah
jne not_fix_constant
mov ebx,characters
movzx eax,byte [edx+2]
xlat byte [ebx]
ror eax,8
mov al,[edx+3]
xlat byte [ebx]
ror eax,8
mov al,[edx+4]
xlat byte [ebx]
ror eax,16
cmp eax,'fix'
je define_fix_constant
test [macro_status],0F0h
jnz macro_preprocessing
cmp byte [esi],1Ah
jne not_fix_constant
movzx edx,byte [esi+1]
lea edx,[esi+2+edx]
cmp word [edx],031Ah
jne not_fix_constant
mov ebx,characters
movzx eax,byte [edx+2]
xlat byte [ebx]
ror eax,8
mov al,[edx+3]
xlat byte [ebx]
ror eax,8
mov al,[edx+4]
xlat byte [ebx]
ror eax,16
cmp eax,'fix'
je define_fix_constant
not_fix_constant:
call process_fix_constants
jmp initial_preprocessing_ok
call process_fix_constants
jmp initial_preprocessing_ok
macro_preprocessing:
call process_macro_operators
call process_macro_operators
initial_preprocessing_ok:
mov esi,[current_line]
add esi,16
mov al,[macro_status]
test al,2
jnz skip_macro_block
test al,1
jnz find_macro_block
mov esi,[current_line]
add esi,16
mov al,[macro_status]
test al,2
jnz skip_macro_block
test al,1
jnz find_macro_block
preprocess_instruction:
mov [current_offset],esi
lods byte [esi]
movzx ecx,byte [esi]
inc esi
cmp al,1Ah
jne not_preprocessor_symbol
cmp cl,3
jb not_preprocessor_directive
push edi
mov edi,preprocessor_directives
call get_directive
pop edi
jc not_preprocessor_directive
mov byte [edx-2],3Bh
jmp near eax
mov [current_offset],esi
lods byte [esi]
movzx ecx,byte [esi]
inc esi
cmp al,1Ah
jne not_preprocessor_symbol
cmp cl,3
jb not_preprocessor_directive
push edi
mov edi,preprocessor_directives
call get_directive
pop edi
jc not_preprocessor_directive
mov byte [edx-2],3Bh
jmp near eax
not_preprocessor_directive:
xor ch,ch
call get_preprocessor_symbol
jc not_macro
mov byte [ebx-2],3Bh
mov [struc_name],0
jmp use_macro
xor ch,ch
call get_preprocessor_symbol
jc not_macro
mov byte [ebx-2],3Bh
mov [struc_name],0
jmp use_macro
not_macro:
mov [struc_name],esi
add esi,ecx
lods byte [esi]
cmp al,':'
je preprocess_label
cmp al,1Ah
jne not_preprocessor_symbol
lods byte [esi]
cmp al,3
jne not_symbolic_constant
mov ebx,characters
movzx eax,byte [esi]
xlat byte [ebx]
ror eax,8
mov al,[esi+1]
xlat byte [ebx]
ror eax,8
mov al,[esi+2]
xlat byte [ebx]
ror eax,16
cmp eax,'equ'
je define_equ_constant
mov al,3
mov [struc_name],esi
add esi,ecx
lods byte [esi]
cmp al,':'
je preprocess_label
cmp al,1Ah
jne not_preprocessor_symbol
lods byte [esi]
cmp al,3
jne not_symbolic_constant
mov ebx,characters
movzx eax,byte [esi]
xlat byte [ebx]
ror eax,8
mov al,[esi+1]
xlat byte [ebx]
ror eax,8
mov al,[esi+2]
xlat byte [ebx]
ror eax,16
cmp eax,'equ'
je define_equ_constant
mov al,3
not_symbolic_constant:
mov ch,1
mov cl,al
call get_preprocessor_symbol
jc not_preprocessor_symbol
push edx esi
mov esi,[struc_name]
mov [struc_label],esi
sub [struc_label],2
mov cl,[esi-1]
mov ch,10b
call get_preprocessor_symbol
jc struc_name_ok
mov ecx,[edx+12]
add ecx,3
lea ebx,[edi+ecx]
mov ecx,edi
sub ecx,[struc_label]
lea esi,[edi-1]
lea edi,[ebx-1]
std
rep movs byte [edi],[esi]
cld
mov edi,[struc_label]
mov esi,[edx+8]
mov ecx,[edx+12]
add [struc_name],ecx
add [struc_name],3
call move_data
mov al,3Ah
stos byte [edi]
mov ax,3Bh
stos word [edi]
mov edi,ebx
pop esi
add esi,[edx+12]
add esi,3
pop edx
jmp use_macro
mov ch,1
mov cl,al
call get_preprocessor_symbol
jc not_preprocessor_symbol
push edx esi
mov esi,[struc_name]
mov [struc_label],esi
sub [struc_label],2
mov cl,[esi-1]
mov ch,10b
call get_preprocessor_symbol
jc struc_name_ok
mov ecx,[edx+12]
add ecx,3
lea ebx,[edi+ecx]
mov ecx,edi
sub ecx,[struc_label]
lea esi,[edi-1]
lea edi,[ebx-1]
std
rep movs byte [edi],[esi]
cld
mov edi,[struc_label]
mov esi,[edx+8]
mov ecx,[edx+12]
add [struc_name],ecx
add [struc_name],3
call move_data
mov al,3Ah
stos byte [edi]
mov ax,3Bh
stos word [edi]
mov edi,ebx
pop esi
add esi,[edx+12]
add esi,3
pop edx
jmp use_macro
struc_name_ok:
mov edx,[struc_name]
movzx eax,byte [edx-1]
add edx,eax
push edi
lea esi,[edi-1]
mov ecx,edi
sub ecx,edx
std
rep movs byte [edi],[esi]
cld
pop edi
inc edi
mov al,3Ah
mov [edx],al
inc al
mov [edx+1],al
pop esi edx
inc esi
jmp use_macro
mov edx,[struc_name]
movzx eax,byte [edx-1]
add edx,eax
push edi
lea esi,[edi-1]
mov ecx,edi
sub ecx,edx
std
rep movs byte [edi],[esi]
cld
pop edi
inc edi
mov al,3Ah
mov [edx],al
inc al
mov [edx+1],al
pop esi edx
inc esi
jmp use_macro
preprocess_label:
dec esi
sub esi,ecx
lea ebp,[esi-2]
mov ch,10b
call get_preprocessor_symbol
jnc symbolic_constant_in_label
lea esi,[esi+ecx+1]
jmp preprocess_instruction
dec esi
sub esi,ecx
lea ebp,[esi-2]
mov ch,10b
call get_preprocessor_symbol
jnc symbolic_constant_in_label
lea esi,[esi+ecx+1]
jmp preprocess_instruction
symbolic_constant_in_label:
mov ebx,[edx+8]
mov ecx,[edx+12]
add ecx,ebx
mov ebx,[edx+8]
mov ecx,[edx+12]
add ecx,ebx
check_for_broken_label:
cmp ebx,ecx
je label_broken
cmp byte [ebx],1Ah
jne label_broken
movzx eax,byte [ebx+1]
lea ebx,[ebx+2+eax]
cmp ebx,ecx
je label_constant_ok
cmp byte [ebx],':'
jne label_broken
inc ebx
jmp check_for_broken_label
cmp ebx,ecx
je label_broken
cmp byte [ebx],1Ah
jne label_broken
movzx eax,byte [ebx+1]
lea ebx,[ebx+2+eax]
cmp ebx,ecx
je label_constant_ok
cmp byte [ebx],':'
jne label_broken
inc ebx
jmp check_for_broken_label
label_broken:
push line_preprocessed
jmp replace_symbolic_constant
push line_preprocessed
jmp replace_symbolic_constant
label_constant_ok:
mov ecx,edi
sub ecx,esi
mov edi,[edx+12]
add edi,ebp
push edi
lea eax,[edi+ecx]
push eax
cmp esi,edi
je replace_label
jb move_rest_of_line_up
rep movs byte [edi],[esi]
jmp replace_label
mov ecx,edi
sub ecx,esi
mov edi,[edx+12]
add edi,ebp
push edi
lea eax,[edi+ecx]
push eax
cmp esi,edi
je replace_label
jb move_rest_of_line_up
rep movs byte [edi],[esi]
jmp replace_label
move_rest_of_line_up:
lea esi,[esi+ecx-1]
lea edi,[edi+ecx-1]
std
rep movs byte [edi],[esi]
cld
lea esi,[esi+ecx-1]
lea edi,[edi+ecx-1]
std
rep movs byte [edi],[esi]
cld
replace_label:
mov ecx,[edx+12]
mov edi,[esp+4]
sub edi,ecx
mov esi,[edx+8]
rep movs byte [edi],[esi]
pop edi esi
inc esi
jmp preprocess_instruction
mov ecx,[edx+12]
mov edi,[esp+4]
sub edi,ecx
mov esi,[edx+8]
rep movs byte [edi],[esi]
pop edi esi
inc esi
jmp preprocess_instruction
not_preprocessor_symbol:
mov esi,[current_offset]
call process_equ_constants
mov esi,[current_offset]
call process_equ_constants
line_preprocessed:
pop esi ecx
ret
pop esi ecx
ret
 
get_preprocessor_symbol:
push ebp edi esi
mov ebp,ecx
shl ebp,22
movzx ecx,cl
mov ebx,hash_tree
mov edi,10
push ebp edi esi
mov ebp,ecx
shl ebp,22
movzx ecx,cl
mov ebx,hash_tree
mov edi,10
follow_hashes_roots:
mov edx,[ebx]
or edx,edx
jz preprocessor_symbol_not_found
xor eax,eax
shl ebp,1
adc eax,0
lea ebx,[edx+eax*4]
dec edi
jnz follow_hashes_roots
mov edi,ebx
call calculate_hash
mov ebp,eax
and ebp,3FFh
shl ebp,10
xor ebp,eax
mov ebx,edi
mov edi,22
mov edx,[ebx]
or edx,edx
jz preprocessor_symbol_not_found
xor eax,eax
shl ebp,1
adc eax,0
lea ebx,[edx+eax*4]
dec edi
jnz follow_hashes_roots
mov edi,ebx
call calculate_hash
mov ebp,eax
and ebp,3FFh
shl ebp,10
xor ebp,eax
mov ebx,edi
mov edi,22
follow_hashes_tree:
mov edx,[ebx]
or edx,edx
jz preprocessor_symbol_not_found
xor eax,eax
shl ebp,1
adc eax,0
lea ebx,[edx+eax*4]
dec edi
jnz follow_hashes_tree
mov al,cl
mov edx,[ebx]
or edx,edx
jz preprocessor_symbol_not_found
mov edx,[ebx]
or edx,edx
jz preprocessor_symbol_not_found
xor eax,eax
shl ebp,1
adc eax,0
lea ebx,[edx+eax*4]
dec edi
jnz follow_hashes_tree
mov al,cl
mov edx,[ebx]
or edx,edx
jz preprocessor_symbol_not_found
compare_with_preprocessor_symbol:
mov edi,[edx+4]
cmp edi,1
jbe next_equal_hash
repe cmps byte [esi],[edi]
je preprocessor_symbol_found
mov cl,al
mov esi,[esp]
mov edi,[edx+4]
cmp edi,1
jbe next_equal_hash
repe cmps byte [esi],[edi]
je preprocessor_symbol_found
mov cl,al
mov esi,[esp]
next_equal_hash:
mov edx,[edx]
or edx,edx
jnz compare_with_preprocessor_symbol
mov edx,[edx]
or edx,edx
jnz compare_with_preprocessor_symbol
preprocessor_symbol_not_found:
pop esi edi ebp
stc
ret
pop esi edi ebp
stc
ret
preprocessor_symbol_found:
pop ebx edi ebp
clc
ret
pop ebx edi ebp
clc
ret
calculate_hash:
xor ebx,ebx
mov eax,2166136261
mov ebp,16777619
xor ebx,ebx
mov eax,2166136261
mov ebp,16777619
fnv1a_hash:
xor al,[esi+ebx]
mul ebp
inc bl
cmp bl,cl
jb fnv1a_hash
ret
xor al,[esi+ebx]
mul ebp
inc bl
cmp bl,cl
jb fnv1a_hash
ret
add_preprocessor_symbol:
push edi esi
cmp ch,11b
je preprocessor_symbol_name_ok
push ecx
movzx ecx,cl
mov edi,preprocessor_directives
call get_directive
jnc reserved_word_used_as_symbol
pop ecx
push edi esi
cmp ch,11b
je preprocessor_symbol_name_ok
push ecx
movzx ecx,cl
mov edi,preprocessor_directives
call get_directive
jnc reserved_word_used_as_symbol
pop ecx
preprocessor_symbol_name_ok:
call calculate_hash
mov ebp,eax
and ebp,3FFh
shr eax,10
xor ebp,eax
shl ecx,22
or ebp,ecx
mov ebx,hash_tree
mov ecx,32
call calculate_hash
mov ebp,eax
and ebp,3FFh
shr eax,10
xor ebp,eax
shl ecx,22
or ebp,ecx
mov ebx,hash_tree
mov ecx,32
find_leave_for_symbol:
mov edx,[ebx]
or edx,edx
jz extend_hashes_tree
xor eax,eax
rol ebp,1
adc eax,0
lea ebx,[edx+eax*4]
dec ecx
jnz find_leave_for_symbol
mov edx,[ebx]
or edx,edx
jz add_symbol_entry
shr ebp,30
cmp ebp,11b
je reuse_symbol_entry
cmp dword [edx+4],0
jne add_symbol_entry
mov edx,[ebx]
or edx,edx
jz extend_hashes_tree
xor eax,eax
rol ebp,1
adc eax,0
lea ebx,[edx+eax*4]
dec ecx
jnz find_leave_for_symbol
mov edx,[ebx]
or edx,edx
jz add_symbol_entry
shr ebp,30
cmp ebp,11b
je reuse_symbol_entry
cmp dword [edx+4],0
jne add_symbol_entry
find_entry_to_reuse:
mov edi,[edx]
or edi,edi
jz reuse_symbol_entry
cmp dword [edi+4],0
jne reuse_symbol_entry
mov edx,edi
jmp find_entry_to_reuse
mov edi,[edx]
or edi,edi
jz reuse_symbol_entry
cmp dword [edi+4],0
jne reuse_symbol_entry
mov edx,edi
jmp find_entry_to_reuse
add_symbol_entry:
mov eax,edx
mov edx,[labels_list]
sub edx,16
cmp edx,[free_additional_memory]
jb out_of_memory
mov [labels_list],edx
mov [edx],eax
mov [ebx],edx
mov eax,edx
mov edx,[labels_list]
sub edx,16
cmp edx,[free_additional_memory]
jb out_of_memory
mov [labels_list],edx
mov [edx],eax
mov [ebx],edx
reuse_symbol_entry:
pop esi edi
mov [edx+4],esi
ret
pop esi edi
mov [edx+4],esi
ret
extend_hashes_tree:
mov edx,[labels_list]
sub edx,8
cmp edx,[free_additional_memory]
jb out_of_memory
mov [labels_list],edx
xor eax,eax
mov [edx],eax
mov [edx+4],eax
shl ebp,1
adc eax,0
mov [ebx],edx
lea ebx,[edx+eax*4]
dec ecx
jnz extend_hashes_tree
mov edx,[labels_list]
sub edx,16
cmp edx,[free_additional_memory]
jb out_of_memory
mov [labels_list],edx
mov dword [edx],0
mov [ebx],edx
pop esi edi
mov [edx+4],esi
ret
mov edx,[labels_list]
sub edx,8
cmp edx,[free_additional_memory]
jb out_of_memory
mov [labels_list],edx
xor eax,eax
mov [edx],eax
mov [edx+4],eax
shl ebp,1
adc eax,0
mov [ebx],edx
lea ebx,[edx+eax*4]
dec ecx
jnz extend_hashes_tree
mov edx,[labels_list]
sub edx,16
cmp edx,[free_additional_memory]
jb out_of_memory
mov [labels_list],edx
mov dword [edx],0
mov [ebx],edx
pop esi edi
mov [edx+4],esi
ret
 
define_fix_constant:
add edx,5
add esi,2
push edx
mov ch,11b
jmp define_preprocessor_constant
add edx,5
add esi,2
push edx
mov ch,11b
jmp define_preprocessor_constant
define_equ_constant:
add esi,3
push esi
call process_equ_constants
mov esi,[struc_name]
mov ch,10b
add esi,3
push esi
call process_equ_constants
mov esi,[struc_name]
mov ch,10b
define_preprocessor_constant:
mov byte [esi-2],3Bh
mov cl,[esi-1]
call add_preprocessor_symbol
pop ebx
mov ecx,edi
dec ecx
sub ecx,ebx
mov [edx+8],ebx
mov [edx+12],ecx
jmp line_preprocessed
mov byte [esi-2],3Bh
mov cl,[esi-1]
call add_preprocessor_symbol
pop ebx
mov ecx,edi
dec ecx
sub ecx,ebx
mov [edx+8],ebx
mov [edx+12],ecx
jmp line_preprocessed
define_symbolic_constant:
lods byte [esi]
cmp al,1Ah
jne invalid_name
lods byte [esi]
mov cl,al
mov ch,10b
call add_preprocessor_symbol
movzx eax,byte [esi-1]
add esi,eax
lea ecx,[edi-1]
sub ecx,esi
mov [edx+8],esi
mov [edx+12],ecx
jmp line_preprocessed
lods byte [esi]
cmp al,1Ah
jne invalid_name
lods byte [esi]
mov cl,al
mov ch,10b
call add_preprocessor_symbol
movzx eax,byte [esi-1]
add esi,eax
lea ecx,[edi-1]
sub ecx,esi
mov [edx+8],esi
mov [edx+12],ecx
jmp line_preprocessed
 
define_struc:
mov ch,1
jmp make_macro
mov ch,1
jmp make_macro
define_macro:
xor ch,ch
xor ch,ch
make_macro:
lods byte [esi]
cmp al,1Ah
jne invalid_name
lods byte [esi]
mov cl,al
call add_preprocessor_symbol
mov eax,[current_line]
mov [edx+12],eax
movzx eax,byte [esi-1]
add esi,eax
mov [edx+8],esi
mov al,[macro_status]
and al,0F0h
or al,1
mov [macro_status],al
mov eax,[current_line]
mov [error_line],eax
xor ebp,ebp
lods byte [esi]
or al,al
jz line_preprocessed
cmp al,'{'
je found_macro_block
dec esi
lods byte [esi]
cmp al,1Ah
jne invalid_name
lods byte [esi]
mov cl,al
call add_preprocessor_symbol
mov eax,[current_line]
mov [edx+12],eax
movzx eax,byte [esi-1]
add esi,eax
mov [edx+8],esi
mov al,[macro_status]
and al,0F0h
or al,1
mov [macro_status],al
mov eax,[current_line]
mov [error_line],eax
xor ebp,ebp
lods byte [esi]
or al,al
jz line_preprocessed
cmp al,'{'
je found_macro_block
dec esi
skip_macro_arguments:
lods byte [esi]
cmp al,1Ah
je skip_macro_argument
cmp al,'['
jne invalid_macro_arguments
or ebp,-1
jz invalid_macro_arguments
lods byte [esi]
cmp al,1Ah
jne invalid_macro_arguments
lods byte [esi]
cmp al,1Ah
je skip_macro_argument
cmp al,'['
jne invalid_macro_arguments
or ebp,-1
jz invalid_macro_arguments
lods byte [esi]
cmp al,1Ah
jne invalid_macro_arguments
skip_macro_argument:
movzx eax,byte [esi]
inc esi
add esi,eax
lods byte [esi]
cmp al,'='
je macro_argument_with_default_value
cmp al,'*'
jne macro_argument_end
lods byte [esi]
movzx eax,byte [esi]
inc esi
add esi,eax
lods byte [esi]
cmp al,'='
je macro_argument_with_default_value
cmp al,'*'
jne macro_argument_end
lods byte [esi]
macro_argument_end:
cmp al,','
je skip_macro_arguments
cmp al,']'
jne end_macro_arguments
lods byte [esi]
not ebp
cmp al,','
je skip_macro_arguments
cmp al,']'
jne end_macro_arguments
lods byte [esi]
not ebp
end_macro_arguments:
or ebp,ebp
jnz invalid_macro_arguments
or al,al
jz line_preprocessed
cmp al,'{'
je found_macro_block
jmp invalid_macro_arguments
or ebp,ebp
jnz invalid_macro_arguments
or al,al
jz line_preprocessed
cmp al,'{'
je found_macro_block
jmp invalid_macro_arguments
macro_argument_with_default_value:
call skip_macro_argument_value
inc esi
jmp macro_argument_end
or [default_argument_value],-1
call skip_macro_argument_value
inc esi
jmp macro_argument_end
skip_macro_argument_value:
cmp byte [esi],'<'
jne simple_argument
mov ecx,1
inc esi
cmp byte [esi],'<'
jne simple_argument
mov ecx,1
inc esi
enclosed_argument:
lods byte [esi]
or al,al
jz invalid_macro_arguments
cmp al,1Ah
je enclosed_symbol
cmp al,22h
je enclosed_string
cmp al,'>'
je enclosed_argument_end
cmp al,'<'
jne enclosed_argument
inc ecx
jmp enclosed_argument
lods byte [esi]
or al,al
jz invalid_macro_arguments
cmp al,1Ah
je enclosed_symbol
cmp al,22h
je enclosed_string
cmp al,'>'
je enclosed_argument_end
cmp al,'<'
jne enclosed_argument
inc ecx
jmp enclosed_argument
enclosed_symbol:
movzx eax,byte [esi]
inc esi
add esi,eax
jmp enclosed_argument
movzx eax,byte [esi]
inc esi
add esi,eax
jmp enclosed_argument
enclosed_string:
lods dword [esi]
add esi,eax
jmp enclosed_argument
lods dword [esi]
add esi,eax
jmp enclosed_argument
enclosed_argument_end:
loop enclosed_argument
lods byte [esi]
or al,al
jz argument_value_end
cmp al,','
je argument_value_end
or ebp,ebp
jz invalid_macro_arguments
cmp al,']'
je argument_value_end
jmp invalid_macro_arguments
loop enclosed_argument
lods byte [esi]
or al,al
jz argument_value_end
cmp al,','
je argument_value_end
cmp [default_argument_value],0
je invalid_macro_arguments
cmp al,'{'
je argument_value_end
or ebp,ebp
jz invalid_macro_arguments
cmp al,']'
je argument_value_end
jmp invalid_macro_arguments
simple_argument:
lods byte [esi]
or al,al
jz argument_value_end
cmp al,','
je argument_value_end
cmp al,22h
je argument_string
cmp al,1Ah
je argument_symbol
or ebp,ebp
jz simple_argument
cmp al,']'
je argument_value_end
lods byte [esi]
or al,al
jz argument_value_end
cmp al,','
je argument_value_end
cmp al,22h
je argument_string
cmp al,1Ah
je argument_symbol
cmp [default_argument_value],0
je simple_argument
cmp al,'{'
je argument_value_end
or ebp,ebp
jz simple_argument
cmp al,']'
je argument_value_end
argument_symbol:
movzx eax,byte [esi]
inc esi
add esi,eax
jmp simple_argument
movzx eax,byte [esi]
inc esi
add esi,eax
jmp simple_argument
argument_string:
lods dword [esi]
add esi,eax
jmp simple_argument
lods dword [esi]
add esi,eax
jmp simple_argument
argument_value_end:
dec esi
ret
dec esi
ret
find_macro_block:
add esi,2
lods byte [esi]
or al,al
jz line_preprocessed
cmp al,'{'
jne unexpected_characters
add esi,2
lods byte [esi]
or al,al
jz line_preprocessed
cmp al,'{'
jne unexpected_characters
found_macro_block:
or [macro_status],2
or [macro_status],2
skip_macro_block:
lods byte [esi]
cmp al,1Ah
je skip_macro_symbol
cmp al,3Bh
je skip_macro_symbol
cmp al,22h
je skip_macro_string
or al,al
jz line_preprocessed
cmp al,'}'
jne skip_macro_block
mov al,[macro_status]
and [macro_status],0F0h
test al,8
jnz use_instant_macro
cmp byte [esi],0
je line_preprocessed
mov ecx,edi
sub ecx,esi
mov edx,esi
lea esi,[esi+ecx-1]
lea edi,[edi+1+16]
mov ebx,edi
dec edi
std
rep movs byte [edi],[esi]
cld
mov edi,edx
xor al,al
stos byte [edi]
mov esi,[current_line]
mov [current_line],edi
mov ecx,4
rep movs dword [edi],[esi]
mov edi,ebx
jmp initial_preprocessing_ok
lods byte [esi]
cmp al,1Ah
je skip_macro_symbol
cmp al,3Bh
je skip_macro_symbol
cmp al,22h
je skip_macro_string
or al,al
jz line_preprocessed
cmp al,'}'
jne skip_macro_block
mov al,[macro_status]
and [macro_status],0F0h
test al,8
jnz use_instant_macro
cmp byte [esi],0
je line_preprocessed
mov ecx,edi
sub ecx,esi
mov edx,esi
lea esi,[esi+ecx-1]
lea edi,[edi+1+16]
mov ebx,edi
dec edi
std
rep movs byte [edi],[esi]
cld
mov edi,edx
xor al,al
stos byte [edi]
mov esi,[current_line]
mov [current_line],edi
mov ecx,4
rep movs dword [edi],[esi]
mov edi,ebx
jmp initial_preprocessing_ok
skip_macro_symbol:
movzx eax,byte [esi]
inc esi
add esi,eax
jmp skip_macro_block
movzx eax,byte [esi]
inc esi
add esi,eax
jmp skip_macro_block
skip_macro_string:
lods dword [esi]
add esi,eax
jmp skip_macro_block
lods dword [esi]
add esi,eax
jmp skip_macro_block
rept_directive:
mov [base_code],0
jmp define_instant_macro
mov [base_code],0
jmp define_instant_macro
irp_directive:
mov [base_code],1
jmp define_instant_macro
mov [base_code],1
jmp define_instant_macro
irps_directive:
mov [base_code],2
jmp define_instant_macro
mov [base_code],2
jmp define_instant_macro
match_directive:
mov [base_code],10h
mov [base_code],10h
define_instant_macro:
mov al,[macro_status]
and al,0F0h
or al,8+1
mov [macro_status],al
mov eax,[current_line]
mov [error_line],eax
mov [instant_macro_start],esi
cmp [base_code],10h
je prepare_match
mov al,[macro_status]
and al,0F0h
or al,8+1
mov [macro_status],al
mov eax,[current_line]
mov [error_line],eax
mov [instant_macro_start],esi
cmp [base_code],10h
je prepare_match
skip_parameters:
lods byte [esi]
or al,al
jz parameters_skipped
cmp al,'{'
je parameters_skipped
cmp al,22h
je skip_quoted_parameter
cmp al,1Ah
jne skip_parameters
lods byte [esi]
movzx eax,al
add esi,eax
jmp skip_parameters
lods byte [esi]
or al,al
jz parameters_skipped
cmp al,'{'
je parameters_skipped
cmp al,22h
je skip_quoted_parameter
cmp al,1Ah
jne skip_parameters
lods byte [esi]
movzx eax,al
add esi,eax
jmp skip_parameters
skip_quoted_parameter:
lods dword [esi]
add esi,eax
jmp skip_parameters
lods dword [esi]
add esi,eax
jmp skip_parameters
parameters_skipped:
dec esi
mov [parameters_end],esi
lods byte [esi]
cmp al,'{'
je found_macro_block
or al,al
jnz invalid_macro_arguments
jmp line_preprocessed
dec esi
mov [parameters_end],esi
lods byte [esi]
cmp al,'{'
je found_macro_block
or al,al
jnz invalid_macro_arguments
jmp line_preprocessed
prepare_match:
call skip_pattern
mov [value_type],80h+10b
call process_symbolic_constants
jmp parameters_skipped
call skip_pattern
mov [value_type],80h+10b
call process_symbolic_constants
jmp parameters_skipped
skip_pattern:
lods byte [esi]
or al,al
jz invalid_macro_arguments
cmp al,','
je pattern_skipped
cmp al,22h
je skip_quoted_string_in_pattern
cmp al,1Ah
je skip_symbol_in_pattern
cmp al,'='
jne skip_pattern
mov al,[esi]
cmp al,1Ah
je skip_pattern
cmp al,22h
je skip_pattern
inc esi
jmp skip_pattern
lods byte [esi]
or al,al
jz invalid_macro_arguments
cmp al,','
je pattern_skipped
cmp al,22h
je skip_quoted_string_in_pattern
cmp al,1Ah
je skip_symbol_in_pattern
cmp al,'='
jne skip_pattern
mov al,[esi]
cmp al,1Ah
je skip_pattern
cmp al,22h
je skip_pattern
inc esi
jmp skip_pattern
skip_symbol_in_pattern:
lods byte [esi]
movzx eax,al
add esi,eax
jmp skip_pattern
lods byte [esi]
movzx eax,al
add esi,eax
jmp skip_pattern
skip_quoted_string_in_pattern:
lods dword [esi]
add esi,eax
jmp skip_pattern
lods dword [esi]
add esi,eax
jmp skip_pattern
pattern_skipped:
ret
ret
 
purge_macro:
xor ch,ch
jmp restore_preprocessor_symbol
xor ch,ch
jmp restore_preprocessor_symbol
purge_struc:
mov ch,1
jmp restore_preprocessor_symbol
mov ch,1
jmp restore_preprocessor_symbol
restore_equ_constant:
mov ch,10b
mov ch,10b
restore_preprocessor_symbol:
push ecx
lods byte [esi]
cmp al,1Ah
jne invalid_name
lods byte [esi]
mov cl,al
call get_preprocessor_symbol
jc no_symbol_to_restore
mov dword [edx+4],0
jmp symbol_restored
push ecx
lods byte [esi]
cmp al,1Ah
jne invalid_name
lods byte [esi]
mov cl,al
call get_preprocessor_symbol
jc no_symbol_to_restore
mov dword [edx+4],0
jmp symbol_restored
no_symbol_to_restore:
add esi,ecx
add esi,ecx
symbol_restored:
pop ecx
lods byte [esi]
cmp al,','
je restore_preprocessor_symbol
or al,al
jnz extra_characters_on_line
jmp line_preprocessed
pop ecx
lods byte [esi]
cmp al,','
je restore_preprocessor_symbol
or al,al
jnz extra_characters_on_line
jmp line_preprocessed
 
process_fix_constants:
mov [value_type],11b
jmp process_symbolic_constants
mov [value_type],11b
jmp process_symbolic_constants
process_equ_constants:
mov [value_type],10b
mov [value_type],10b
process_symbolic_constants:
mov ebp,esi
lods byte [esi]
cmp al,1Ah
je check_symbol
cmp al,22h
je ignore_string
cmp al,'{'
je check_brace
or al,al
jnz process_symbolic_constants
ret
mov ebp,esi
lods byte [esi]
cmp al,1Ah
je check_symbol
cmp al,22h
je ignore_string
cmp al,'{'
je check_brace
or al,al
jnz process_symbolic_constants
ret
ignore_string:
lods dword [esi]
add esi,eax
jmp process_symbolic_constants
lods dword [esi]
add esi,eax
jmp process_symbolic_constants
check_brace:
test [value_type],80h
jz process_symbolic_constants
ret
test [value_type],80h
jz process_symbolic_constants
ret
no_replacing:
movzx ecx,byte [esi-1]
add esi,ecx
jmp process_symbolic_constants
movzx ecx,byte [esi-1]
add esi,ecx
jmp process_symbolic_constants
check_symbol:
mov cl,[esi]
inc esi
mov ch,[value_type]
call get_preprocessor_symbol
jc no_replacing
mov [current_section],edi
mov cl,[esi]
inc esi
mov ch,[value_type]
call get_preprocessor_symbol
jc no_replacing
mov [current_section],edi
replace_symbolic_constant:
mov ecx,[edx+12]
mov edx,[edx+8]
xchg esi,edx
call move_data
mov esi,edx
mov ecx,[edx+12]
mov edx,[edx+8]
xchg esi,edx
call move_data
mov esi,edx
process_after_replaced:
lods byte [esi]
cmp al,1Ah
je symbol_after_replaced
stos byte [edi]
cmp al,22h
je string_after_replaced
cmp al,'{'
je brace_after_replaced
or al,al
jnz process_after_replaced
mov ecx,edi
sub ecx,esi
mov edi,ebp
call move_data
mov esi,edi
ret
lods byte [esi]
cmp al,1Ah
je symbol_after_replaced
stos byte [edi]
cmp al,22h
je string_after_replaced
cmp al,'{'
je brace_after_replaced
or al,al
jnz process_after_replaced
mov ecx,edi
sub ecx,esi
mov edi,ebp
call move_data
mov esi,edi
ret
move_data:
lea eax,[edi+ecx]
cmp eax,[memory_end]
jae out_of_memory
shr ecx,1
jnc movsb_ok
movs byte [edi],[esi]
lea eax,[edi+ecx]
cmp eax,[memory_end]
jae out_of_memory
shr ecx,1
jnc movsb_ok
movs byte [edi],[esi]
movsb_ok:
shr ecx,1
jnc movsw_ok
movs word [edi],[esi]
shr ecx,1
jnc movsw_ok
movs word [edi],[esi]
movsw_ok:
rep movs dword [edi],[esi]
ret
rep movs dword [edi],[esi]
ret
string_after_replaced:
lods dword [esi]
stos dword [edi]
mov ecx,eax
call move_data
jmp process_after_replaced
lods dword [esi]
stos dword [edi]
mov ecx,eax
call move_data
jmp process_after_replaced
brace_after_replaced:
test [value_type],80h
jz process_after_replaced
mov edx,edi
mov ecx,[current_section]
sub edx,ecx
sub ecx,esi
rep movs byte [edi],[esi]
mov ecx,edi
sub ecx,esi
mov edi,ebp
call move_data
lea esi,[ebp+edx]
ret
test [value_type],80h
jz process_after_replaced
mov edx,edi
mov ecx,[current_section]
sub edx,ecx
sub ecx,esi
rep movs byte [edi],[esi]
mov ecx,edi
sub ecx,esi
mov edi,ebp
call move_data
lea esi,[ebp+edx]
ret
symbol_after_replaced:
mov cl,[esi]
inc esi
mov ch,[value_type]
call get_preprocessor_symbol
jnc replace_symbolic_constant
movzx ecx,byte [esi-1]
mov al,1Ah
mov ah,cl
stos word [edi]
call move_data
jmp process_after_replaced
mov cl,[esi]
inc esi
mov ch,[value_type]
call get_preprocessor_symbol
jnc replace_symbolic_constant
movzx ecx,byte [esi-1]
mov al,1Ah
mov ah,cl
stos word [edi]
call move_data
jmp process_after_replaced
process_macro_operators:
xor dl,dl
mov ebp,edi
xor dl,dl
mov ebp,edi
before_macro_operators:
mov edi,esi
lods byte [esi]
cmp al,'`'
je symbol_conversion
cmp al,'#'
je concatenation
cmp al,1Ah
je symbol_before_macro_operators
cmp al,3Bh
je no_more_macro_operators
cmp al,22h
je string_before_macro_operators
xor dl,dl
or al,al
jnz before_macro_operators
mov edi,esi
ret
mov edi,esi
lods byte [esi]
cmp al,'`'
je symbol_conversion
cmp al,'#'
je concatenation
cmp al,1Ah
je symbol_before_macro_operators
cmp al,3Bh
je no_more_macro_operators
cmp al,22h
je string_before_macro_operators
xor dl,dl
or al,al
jnz before_macro_operators
mov edi,esi
ret
no_more_macro_operators:
mov edi,ebp
ret
mov edi,ebp
ret
symbol_before_macro_operators:
mov dl,1Ah
mov ebx,esi
lods byte [esi]
movzx ecx,al
jecxz symbol_before_macro_operators_ok
mov edi,esi
cmp byte [esi],'\'
je escaped_symbol
mov dl,1Ah
mov ebx,esi
lods byte [esi]
movzx ecx,al
jecxz symbol_before_macro_operators_ok
mov edi,esi
cmp byte [esi],'\'
je escaped_symbol
symbol_before_macro_operators_ok:
add esi,ecx
jmp before_macro_operators
add esi,ecx
jmp before_macro_operators
string_before_macro_operators:
mov dl,22h
mov ebx,esi
lods dword [esi]
add esi,eax
jmp before_macro_operators
mov dl,22h
mov ebx,esi
lods dword [esi]
add esi,eax
jmp before_macro_operators
escaped_symbol:
dec byte [edi-1]
dec ecx
inc esi
cmp ecx,1
rep movs byte [edi],[esi]
jne after_macro_operators
mov al,[esi-1]
mov ecx,ebx
mov ebx,characters
xlat byte [ebx]
mov ebx,ecx
or al,al
jnz after_macro_operators
sub edi,3
mov al,[esi-1]
stos byte [edi]
xor dl,dl
jmp after_macro_operators
dec byte [edi-1]
dec ecx
inc esi
cmp ecx,1
rep movs byte [edi],[esi]
jne after_macro_operators
mov al,[esi-1]
mov ecx,ebx
mov ebx,characters
xlat byte [ebx]
mov ebx,ecx
or al,al
jnz after_macro_operators
sub edi,3
mov al,[esi-1]
stos byte [edi]
xor dl,dl
jmp after_macro_operators
reduce_symbol_conversion:
inc esi
inc esi
symbol_conversion:
mov edx,esi
mov al,[esi]
cmp al,1Ah
jne symbol_character_conversion
lods word [esi]
movzx ecx,ah
lea ebx,[edi+3]
jecxz convert_to_quoted_string
cmp byte [esi],'\'
jne convert_to_quoted_string
inc esi
dec ecx
dec ebx
jmp convert_to_quoted_string
mov edx,esi
mov al,[esi]
cmp al,1Ah
jne symbol_character_conversion
lods word [esi]
movzx ecx,ah
lea ebx,[edi+3]
jecxz convert_to_quoted_string
cmp byte [esi],'\'
jne convert_to_quoted_string
inc esi
dec ecx
dec ebx
jmp convert_to_quoted_string
symbol_character_conversion:
cmp al,22h
je after_macro_operators
cmp al,'`'
je reduce_symbol_conversion
lea ebx,[edi+5]
xor ecx,ecx
or al,al
jz convert_to_quoted_string
cmp al,'#'
je convert_to_quoted_string
inc ecx
cmp al,22h
je after_macro_operators
cmp al,'`'
je reduce_symbol_conversion
lea ebx,[edi+5]
xor ecx,ecx
or al,al
jz convert_to_quoted_string
cmp al,'#'
je convert_to_quoted_string
inc ecx
convert_to_quoted_string:
sub ebx,edx
ja shift_line_data
mov al,22h
mov dl,al
stos byte [edi]
mov ebx,edi
mov eax,ecx
stos dword [edi]
rep movs byte [edi],[esi]
cmp edi,esi
je before_macro_operators
jmp after_macro_operators
sub ebx,edx
ja shift_line_data
mov al,22h
mov dl,al
stos byte [edi]
mov ebx,edi
mov eax,ecx
stos dword [edi]
rep movs byte [edi],[esi]
cmp edi,esi
je before_macro_operators
jmp after_macro_operators
shift_line_data:
push ecx
mov edx,esi
lea esi,[ebp-1]
add ebp,ebx
lea edi,[ebp-1]
lea ecx,[esi+1]
sub ecx,edx
std
rep movs byte [edi],[esi]
cld
pop eax
sub edi,3
mov dl,22h
mov [edi-1],dl
mov ebx,edi
mov [edi],eax
lea esi,[edi+4+eax]
jmp before_macro_operators
push ecx
mov edx,esi
lea esi,[ebp-1]
add ebp,ebx
lea edi,[ebp-1]
lea ecx,[esi+1]
sub ecx,edx
std
rep movs byte [edi],[esi]
cld
pop eax
sub edi,3
mov dl,22h
mov [edi-1],dl
mov ebx,edi
mov [edi],eax
lea esi,[edi+4+eax]
jmp before_macro_operators
concatenation:
cmp dl,1Ah
je symbol_concatenation
cmp dl,22h
je string_concatenation
cmp dl,1Ah
je symbol_concatenation
cmp dl,22h
je string_concatenation
no_concatenation:
cmp esi,edi
je before_macro_operators
jmp after_macro_operators
cmp esi,edi
je before_macro_operators
jmp after_macro_operators
symbol_concatenation:
cmp byte [esi],1Ah
jne no_concatenation
inc esi
lods byte [esi]
movzx ecx,al
jecxz do_symbol_concatenation
cmp byte [esi],'\'
je concatenate_escaped_symbol
cmp byte [esi],1Ah
jne no_concatenation
inc esi
lods byte [esi]
movzx ecx,al
jecxz do_symbol_concatenation
cmp byte [esi],'\'
je concatenate_escaped_symbol
do_symbol_concatenation:
add [ebx],cl
jc name_too_long
rep movs byte [edi],[esi]
jmp after_macro_operators
add [ebx],cl
jc name_too_long
rep movs byte [edi],[esi]
jmp after_macro_operators
concatenate_escaped_symbol:
inc esi
dec ecx
jz do_symbol_concatenation
movzx eax,byte [esi]
cmp byte [characters+eax],0
jne do_symbol_concatenation
sub esi,3
jmp no_concatenation
inc esi
dec ecx
jz do_symbol_concatenation
movzx eax,byte [esi]
cmp byte [characters+eax],0
jne do_symbol_concatenation
sub esi,3
jmp no_concatenation
string_concatenation:
cmp byte [esi],22h
je do_string_concatenation
cmp byte [esi],'`'
jne no_concatenation
cmp byte [esi],22h
je do_string_concatenation
cmp byte [esi],'`'
jne no_concatenation
concatenate_converted_symbol:
inc esi
mov al,[esi]
cmp al,'`'
je concatenate_converted_symbol
cmp al,22h
je do_string_concatenation
cmp al,1Ah
jne concatenate_converted_symbol_character
inc esi
lods byte [esi]
movzx ecx,al
jecxz finish_concatenating_converted_symbol
cmp byte [esi],'\'
jne finish_concatenating_converted_symbol
inc esi
dec ecx
inc esi
mov al,[esi]
cmp al,'`'
je concatenate_converted_symbol
cmp al,22h
je do_string_concatenation
cmp al,1Ah
jne concatenate_converted_symbol_character
inc esi
lods byte [esi]
movzx ecx,al
jecxz finish_concatenating_converted_symbol
cmp byte [esi],'\'
jne finish_concatenating_converted_symbol
inc esi
dec ecx
finish_concatenating_converted_symbol:
add [ebx],ecx
rep movs byte [edi],[esi]
jmp after_macro_operators
add [ebx],ecx
rep movs byte [edi],[esi]
jmp after_macro_operators
concatenate_converted_symbol_character:
or al,al
jz after_macro_operators
cmp al,'#'
je after_macro_operators
inc dword [ebx]
movs byte [edi],[esi]
jmp after_macro_operators
or al,al
jz after_macro_operators
cmp al,'#'
je after_macro_operators
inc dword [ebx]
movs byte [edi],[esi]
jmp after_macro_operators
do_string_concatenation:
inc esi
lods dword [esi]
mov ecx,eax
add [ebx],eax
rep movs byte [edi],[esi]
inc esi
lods dword [esi]
mov ecx,eax
add [ebx],eax
rep movs byte [edi],[esi]
after_macro_operators:
lods byte [esi]
cmp al,'`'
je symbol_conversion
cmp al,'#'
je concatenation
stos byte [edi]
cmp al,1Ah
je symbol_after_macro_operators
cmp al,3Bh
je no_more_macro_operators
cmp al,22h
je string_after_macro_operators
xor dl,dl
or al,al
jnz after_macro_operators
ret
lods byte [esi]
cmp al,'`'
je symbol_conversion
cmp al,'#'
je concatenation
stos byte [edi]
cmp al,1Ah
je symbol_after_macro_operators
cmp al,3Bh
je no_more_macro_operators
cmp al,22h
je string_after_macro_operators
xor dl,dl
or al,al
jnz after_macro_operators
ret
symbol_after_macro_operators:
mov dl,1Ah
mov ebx,edi
lods byte [esi]
stos byte [edi]
movzx ecx,al
jecxz symbol_after_macro_operatorss_ok
cmp byte [esi],'\'
je escaped_symbol
mov dl,1Ah
mov ebx,edi
lods byte [esi]
stos byte [edi]
movzx ecx,al
jecxz symbol_after_macro_operatorss_ok
cmp byte [esi],'\'
je escaped_symbol
symbol_after_macro_operatorss_ok:
rep movs byte [edi],[esi]
jmp after_macro_operators
rep movs byte [edi],[esi]
jmp after_macro_operators
string_after_macro_operators:
mov dl,22h
mov ebx,edi
lods dword [esi]
stos dword [edi]
mov ecx,eax
rep movs byte [edi],[esi]
jmp after_macro_operators
mov dl,22h
mov ebx,edi
lods dword [esi]
stos dword [edi]
mov ecx,eax
rep movs byte [edi],[esi]
jmp after_macro_operators
 
use_macro:
push [free_additional_memory]
push [macro_symbols]
mov [macro_symbols],0
push [counter_limit]
push dword [edx+4]
mov dword [edx+4],1
push edx
mov ebx,esi
mov esi,[edx+8]
mov eax,[edx+12]
mov [macro_line],eax
mov [counter_limit],0
xor ebp,ebp
push [free_additional_memory]
push [macro_symbols]
mov [macro_symbols],0
push [counter_limit]
push dword [edx+4]
mov dword [edx+4],1
push edx
mov ebx,esi
mov esi,[edx+8]
mov eax,[edx+12]
mov [macro_line],eax
mov [counter_limit],0
xor ebp,ebp
process_macro_arguments:
mov al,[esi]
or al,al
jz arguments_end
cmp al,'{'
je arguments_end
inc esi
cmp al,'['
jne get_macro_arguments
mov ebp,esi
inc esi
inc [counter_limit]
mov al,[esi]
or al,al
jz arguments_end
cmp al,'{'
je arguments_end
inc esi
cmp al,'['
jne get_macro_arguments
mov ebp,esi
inc esi
inc [counter_limit]
get_macro_arguments:
call get_macro_argument
lods byte [esi]
cmp al,','
je next_argument
cmp al,']'
je next_arguments_group
dec esi
jmp arguments_end
call get_macro_argument
lods byte [esi]
cmp al,','
je next_argument
cmp al,']'
je next_arguments_group
dec esi
jmp arguments_end
next_argument:
cmp byte [ebx],','
jne process_macro_arguments
inc ebx
jmp process_macro_arguments
cmp byte [ebx],','
jne process_macro_arguments
inc ebx
jmp process_macro_arguments
next_arguments_group:
cmp byte [ebx],','
jne arguments_end
inc ebx
inc [counter_limit]
mov esi,ebp
jmp process_macro_arguments
cmp byte [ebx],','
jne arguments_end
inc ebx
inc [counter_limit]
mov esi,ebp
jmp process_macro_arguments
get_macro_argument:
lods byte [esi]
movzx ecx,al
mov eax,[counter_limit]
call add_macro_symbol
add esi,ecx
xchg esi,ebx
mov [edx+12],esi
push ebp
xor ebp,ebp
call skip_macro_argument_value
pop ebp
call finish_macro_argument
xchg esi,ebx
cmp byte [esi],'='
je argument_with_default_value
cmp byte [esi],'*'
jne macro_argument_ok
cmp dword [edx+8],0
je invalid_macro_arguments
inc esi
lods byte [esi]
movzx ecx,al
mov eax,[counter_limit]
call add_macro_symbol
add esi,ecx
xchg esi,ebx
mov [edx+12],esi
mov [default_argument_value],0
call skip_macro_argument_value
call finish_macro_argument
xchg esi,ebx
cmp byte [esi],'='
je argument_with_default_value
cmp byte [esi],'*'
jne macro_argument_ok
cmp dword [edx+8],0
je invalid_macro_arguments
inc esi
macro_argument_ok:
ret
ret
finish_macro_argument:
mov eax,[edx+12]
mov ecx,esi
sub ecx,eax
cmp byte [eax],'<'
jne argument_value_length_ok
inc dword [edx+12]
sub ecx,2
mov eax,[edx+12]
mov ecx,esi
sub ecx,eax
cmp byte [eax],'<'
jne argument_value_length_ok
inc dword [edx+12]
sub ecx,2
or ecx,80000000h
argument_value_length_ok:
mov [edx+8],ecx
ret
mov [edx+8],ecx
ret
argument_with_default_value:
inc esi
push esi
call skip_macro_argument_value
pop eax
cmp dword [edx+8],0
jne macro_argument_ok
mov [edx+12],eax
call finish_macro_argument
jmp macro_argument_ok
inc esi
push esi
or [default_argument_value],-1
call skip_macro_argument_value
pop eax
cmp dword [edx+8],0
jne macro_argument_ok
mov [edx+12],eax
call finish_macro_argument
jmp macro_argument_ok
arguments_end:
cmp byte [ebx],0
jne invalid_macro_arguments
mov eax,[esp+4]
dec eax
call process_macro
pop edx
pop dword [edx+4]
pop [counter_limit]
pop [macro_symbols]
pop [free_additional_memory]
jmp line_preprocessed
cmp byte [ebx],0
jne invalid_macro_arguments
mov eax,[esp+4]
dec eax
call process_macro
pop edx
pop dword [edx+4]
pop [counter_limit]
pop [macro_symbols]
pop [free_additional_memory]
jmp line_preprocessed
use_instant_macro:
push edi [current_line] esi
mov eax,[error_line]
mov [current_line],eax
mov [macro_line],eax
mov esi,[instant_macro_start]
cmp [base_code],10h
jae do_match
cmp [base_code],0
jne do_irp
call precalculate_value
cmp eax,0
jl value_out_of_range
push [free_additional_memory]
push [macro_symbols]
mov [macro_symbols],0
push [counter_limit]
mov [struc_name],0
mov [counter_limit],eax
lods byte [esi]
or al,al
jz rept_counters_ok
cmp al,'{'
je rept_counters_ok
cmp al,1Ah
jne invalid_macro_arguments
push edi [current_line] esi
mov eax,[error_line]
mov [current_line],eax
mov [macro_line],eax
mov esi,[instant_macro_start]
cmp [base_code],10h
jae do_match
cmp [base_code],0
jne do_irp
call precalculate_value
cmp eax,0
jl value_out_of_range
push [free_additional_memory]
push [macro_symbols]
mov [macro_symbols],0
push [counter_limit]
mov [struc_name],0
mov [counter_limit],eax
lods byte [esi]
or al,al
jz rept_counters_ok
cmp al,'{'
je rept_counters_ok
cmp al,1Ah
jne invalid_macro_arguments
add_rept_counter:
lods byte [esi]
movzx ecx,al
xor eax,eax
call add_macro_symbol
add esi,ecx
xor eax,eax
mov dword [edx+12],eax
inc eax
mov dword [edx+8],eax
lods byte [esi]
cmp al,':'
jne rept_counter_added
push edx
call precalculate_value
mov edx,eax
add edx,[counter_limit]
jo value_out_of_range
pop edx
mov dword [edx+8],eax
lods byte [esi]
lods byte [esi]
movzx ecx,al
xor eax,eax
call add_macro_symbol
add esi,ecx
xor eax,eax
mov dword [edx+12],eax
inc eax
mov dword [edx+8],eax
lods byte [esi]
cmp al,':'
jne rept_counter_added
push edx
call precalculate_value
mov edx,eax
add edx,[counter_limit]
jo value_out_of_range
pop edx
mov dword [edx+8],eax
lods byte [esi]
rept_counter_added:
cmp al,','
jne rept_counters_ok
lods byte [esi]
cmp al,1Ah
jne invalid_macro_arguments
jmp add_rept_counter
cmp al,','
jne rept_counters_ok
lods byte [esi]
cmp al,1Ah
jne invalid_macro_arguments
jmp add_rept_counter
rept_counters_ok:
dec esi
cmp [counter_limit],0
je instant_macro_finish
dec esi
cmp [counter_limit],0
je instant_macro_finish
instant_macro_parameters_ok:
xor eax,eax
call process_macro
xor eax,eax
call process_macro
instant_macro_finish:
pop [counter_limit]
pop [macro_symbols]
pop [free_additional_memory]
pop [counter_limit]
pop [macro_symbols]
pop [free_additional_memory]
instant_macro_done:
pop ebx esi edx
cmp byte [ebx],0
je line_preprocessed
mov [current_line],edi
mov ecx,4
rep movs dword [edi],[esi]
test [macro_status],0Fh
jz instant_macro_attached_line
mov ax,3Bh
stos word [edi]
pop ebx esi edx
cmp byte [ebx],0
je line_preprocessed
mov [current_line],edi
mov ecx,4
rep movs dword [edi],[esi]
test [macro_status],0Fh
jz instant_macro_attached_line
mov ax,3Bh
stos word [edi]
instant_macro_attached_line:
mov esi,ebx
sub edx,ebx
mov ecx,edx
call move_data
jmp initial_preprocessing_ok
mov esi,ebx
sub edx,ebx
mov ecx,edx
call move_data
jmp initial_preprocessing_ok
precalculate_value:
push edi
call convert_expression
mov al,')'
stosb
push esi
mov esi,[esp+4]
mov [value_size],8
call calculate_expression
mov eax,[edi]
mov ecx,[edi+4]
pop esi edi
cdq
cmp edx,ecx
jne value_out_of_range
ret
push edi
call convert_expression
mov al,')'
stosb
push esi
mov esi,[esp+4]
mov [error_line],0
mov [value_size],0
call calculate_expression
cmp [error_line],0
je value_precalculated
jmp [error]
value_precalculated:
mov eax,[edi]
mov ecx,[edi+4]
cdq
cmp edx,ecx
jne value_out_of_range
cmp dl,[edi+13]
jne value_out_of_range
pop esi edi
ret
do_irp:
cmp byte [esi],1Ah
jne invalid_macro_arguments
movzx eax,byte [esi+1]
lea esi,[esi+2+eax]
lods byte [esi]
cmp [base_code],1
ja irps_name_ok
cmp al,'='
je irp_with_default_value
cmp al,'*'
jne irp_name_ok
lods byte [esi]
cmp byte [esi],1Ah
jne invalid_macro_arguments
movzx eax,byte [esi+1]
lea esi,[esi+2+eax]
lods byte [esi]
cmp [base_code],1
ja irps_name_ok
cmp al,'='
je irp_with_default_value
cmp al,'*'
jne irp_name_ok
lods byte [esi]
irp_name_ok:
cmp al,','
jne invalid_macro_arguments
jmp irp_parameters_start
cmp al,','
jne invalid_macro_arguments
jmp irp_parameters_start
irp_with_default_value:
xor ebp,ebp
call skip_macro_argument_value
inc esi
xor ebp,ebp
or [default_argument_value],-1
call skip_macro_argument_value
inc esi
irps_name_ok:
cmp al,','
jne invalid_macro_arguments
mov al,[esi]
or al,al
jz instant_macro_done
cmp al,'{'
je instant_macro_done
cmp al,','
jne invalid_macro_arguments
mov al,[esi]
or al,al
jz instant_macro_done
cmp al,'{'
je instant_macro_done
irp_parameters_start:
xor eax,eax
push [free_additional_memory]
push [macro_symbols]
mov [macro_symbols],eax
push [counter_limit]
mov [counter_limit],eax
mov [struc_name],eax
mov ebx,esi
cmp [base_code],1
ja get_irps_parameter
mov edx,[parameters_end]
mov al,[edx]
push eax
mov byte [edx],0
xor eax,eax
push [free_additional_memory]
push [macro_symbols]
mov [macro_symbols],eax
push [counter_limit]
mov [counter_limit],eax
mov [struc_name],eax
mov ebx,esi
cmp [base_code],1
ja get_irps_parameter
mov edx,[parameters_end]
mov al,[edx]
push eax
mov byte [edx],0
get_irp_parameter:
inc [counter_limit]
mov esi,[instant_macro_start]
inc esi
call get_macro_argument
cmp byte [ebx],','
jne irp_parameters_end
inc ebx
jmp get_irp_parameter
inc [counter_limit]
mov esi,[instant_macro_start]
inc esi
call get_macro_argument
cmp byte [ebx],','
jne irp_parameters_end
inc ebx
jmp get_irp_parameter
irp_parameters_end:
mov esi,ebx
pop eax
mov [esi],al
jmp instant_macro_parameters_ok
mov esi,ebx
pop eax
mov [esi],al
jmp instant_macro_parameters_ok
get_irps_parameter:
mov esi,[instant_macro_start]
inc esi
lods byte [esi]
movzx ecx,al
inc [counter_limit]
mov eax,[counter_limit]
call add_macro_symbol
mov [edx+12],ebx
cmp byte [ebx],1Ah
je irps_symbol
cmp byte [ebx],22h
je irps_quoted_string
mov eax,1
jmp irps_parameter_ok
mov esi,[instant_macro_start]
inc esi
lods byte [esi]
movzx ecx,al
inc [counter_limit]
mov eax,[counter_limit]
call add_macro_symbol
mov [edx+12],ebx
cmp byte [ebx],1Ah
je irps_symbol
cmp byte [ebx],22h
je irps_quoted_string
mov eax,1
jmp irps_parameter_ok
irps_quoted_string:
mov eax,[ebx+1]
add eax,1+4
jmp irps_parameter_ok
mov eax,[ebx+1]
add eax,1+4
jmp irps_parameter_ok
irps_symbol:
movzx eax,byte [ebx+1]
add eax,1+1
movzx eax,byte [ebx+1]
add eax,1+1
irps_parameter_ok:
mov [edx+8],eax
add ebx,eax
cmp byte [ebx],0
je irps_parameters_end
cmp byte [ebx],'{'
jne get_irps_parameter
mov [edx+8],eax
add ebx,eax
cmp byte [ebx],0
je irps_parameters_end
cmp byte [ebx],'{'
jne get_irps_parameter
irps_parameters_end:
mov esi,ebx
jmp instant_macro_parameters_ok
mov esi,ebx
jmp instant_macro_parameters_ok
do_match:
mov ebx,esi
call skip_pattern
call exact_match
mov edx,edi
mov al,[ebx]
cmp al,1Ah
je free_match
cmp al,','
jne instant_macro_done
cmp esi,[parameters_end]
je matched_pattern
jmp instant_macro_done
mov ebx,esi
call skip_pattern
call exact_match
mov edx,edi
mov al,[ebx]
cmp al,1Ah
je free_match
cmp al,','
jne instant_macro_done
cmp esi,[parameters_end]
je matched_pattern
jmp instant_macro_done
free_match:
add edx,12
cmp edx,[memory_end]
ja out_of_memory
mov [edx-12],ebx
mov [edx-8],esi
call skip_match_element
jc try_different_matching
mov [edx-4],esi
movzx eax,byte [ebx+1]
lea ebx,[ebx+2+eax]
cmp byte [ebx],1Ah
je free_match
add edx,12
cmp edx,[memory_end]
ja out_of_memory
mov [edx-12],ebx
mov [edx-8],esi
call skip_match_element
jc try_different_matching
mov [edx-4],esi
movzx eax,byte [ebx+1]
lea ebx,[ebx+2+eax]
cmp byte [ebx],1Ah
je free_match
find_exact_match:
call exact_match
cmp esi,[parameters_end]
je end_matching
cmp byte [ebx],1Ah
je free_match
mov ebx,[edx-12]
movzx eax,byte [ebx+1]
lea ebx,[ebx+2+eax]
mov esi,[edx-4]
jmp match_more_elements
call exact_match
cmp esi,[parameters_end]
je end_matching
cmp byte [ebx],1Ah
je free_match
mov ebx,[edx-12]
movzx eax,byte [ebx+1]
lea ebx,[ebx+2+eax]
mov esi,[edx-4]
jmp match_more_elements
try_different_matching:
sub edx,12
cmp edx,edi
je instant_macro_done
mov ebx,[edx-12]
movzx eax,byte [ebx+1]
lea ebx,[ebx+2+eax]
cmp byte [ebx],1Ah
je try_different_matching
mov esi,[edx-4]
sub edx,12
cmp edx,edi
je instant_macro_done
mov ebx,[edx-12]
movzx eax,byte [ebx+1]
lea ebx,[ebx+2+eax]
cmp byte [ebx],1Ah
je try_different_matching
mov esi,[edx-4]
match_more_elements:
call skip_match_element
jc try_different_matching
mov [edx-4],esi
jmp find_exact_match
call skip_match_element
jc try_different_matching
mov [edx-4],esi
jmp find_exact_match
skip_match_element:
cmp esi,[parameters_end]
je cannot_match
mov al,[esi]
cmp al,1Ah
je skip_match_symbol
cmp al,22h
je skip_match_quoted_string
add esi,1
ret
cmp esi,[parameters_end]
je cannot_match
mov al,[esi]
cmp al,1Ah
je skip_match_symbol
cmp al,22h
je skip_match_quoted_string
add esi,1
ret
skip_match_quoted_string:
mov eax,[esi+1]
add esi,5
jmp skip_match_ok
mov eax,[esi+1]
add esi,5
jmp skip_match_ok
skip_match_symbol:
movzx eax,byte [esi+1]
add esi,2
movzx eax,byte [esi+1]
add esi,2
skip_match_ok:
add esi,eax
ret
add esi,eax
ret
cannot_match:
stc
ret
stc
ret
exact_match:
cmp esi,[parameters_end]
je exact_match_complete
mov ah,[esi]
mov al,[ebx]
cmp al,','
je exact_match_complete
cmp al,1Ah
je exact_match_complete
cmp al,'='
je match_verbatim
call match_elements
je exact_match
cmp esi,[parameters_end]
je exact_match_complete
mov ah,[esi]
mov al,[ebx]
cmp al,','
je exact_match_complete
cmp al,1Ah
je exact_match_complete
cmp al,'='
je match_verbatim
call match_elements
je exact_match
exact_match_complete:
ret
ret
match_verbatim:
inc ebx
call match_elements
je exact_match
dec ebx
ret
inc ebx
call match_elements
je exact_match
dec ebx
ret
match_elements:
mov al,[ebx]
cmp al,1Ah
je match_symbols
cmp al,22h
je match_quoted_strings
cmp al,ah
je symbol_characters_matched
ret
mov al,[ebx]
cmp al,1Ah
je match_symbols
cmp al,22h
je match_quoted_strings
cmp al,ah
je symbol_characters_matched
ret
symbol_characters_matched:
lea ebx,[ebx+1]
lea esi,[esi+1]
ret
lea ebx,[ebx+1]
lea esi,[esi+1]
ret
match_quoted_strings:
mov ecx,[ebx+1]
add ecx,5
jmp compare_elements
mov ecx,[ebx+1]
add ecx,5
jmp compare_elements
match_symbols:
movzx ecx,byte [ebx+1]
add ecx,2
movzx ecx,byte [ebx+1]
add ecx,2
compare_elements:
mov eax,esi
mov ebp,edi
mov edi,ebx
repe cmps byte [esi],[edi]
jne elements_mismatch
mov ebx,edi
mov edi,ebp
ret
mov eax,esi
mov ebp,edi
mov edi,ebx
repe cmps byte [esi],[edi]
jne elements_mismatch
mov ebx,edi
mov edi,ebp
ret
elements_mismatch:
mov esi,eax
mov edi,ebp
ret
mov esi,eax
mov edi,ebp
ret
end_matching:
cmp byte [ebx],','
jne instant_macro_done
cmp byte [ebx],','
jne instant_macro_done
matched_pattern:
xor eax,eax
push [free_additional_memory]
push [macro_symbols]
mov [macro_symbols],eax
push [counter_limit]
mov [counter_limit],eax
mov [struc_name],eax
push esi edi edx
xor eax,eax
push [free_additional_memory]
push [macro_symbols]
mov [macro_symbols],eax
push [counter_limit]
mov [counter_limit],eax
mov [struc_name],eax
push esi edi edx
add_matched_symbol:
cmp edi,[esp]
je matched_symbols_ok
mov esi,[edi]
inc esi
lods byte [esi]
movzx ecx,al
xor eax,eax
call add_macro_symbol
mov eax,[edi+4]
mov dword [edx+12],eax
mov ecx,[edi+8]
sub ecx,eax
mov dword [edx+8],ecx
add edi,12
jmp add_matched_symbol
cmp edi,[esp]
je matched_symbols_ok
mov esi,[edi]
inc esi
lods byte [esi]
movzx ecx,al
xor eax,eax
call add_macro_symbol
mov eax,[edi+4]
mov dword [edx+12],eax
mov ecx,[edi+8]
sub ecx,eax
mov dword [edx+8],ecx
add edi,12
jmp add_matched_symbol
matched_symbols_ok:
pop edx edi esi
jmp instant_macro_parameters_ok
pop edx edi esi
jmp instant_macro_parameters_ok
 
process_macro:
push dword [macro_status]
or [macro_status],10h
push [counter]
push [macro_block]
push [macro_block_line]
push [macro_block_line_number]
push [struc_label]
push [struc_name]
push eax
push [current_line]
lods byte [esi]
cmp al,'{'
je macro_instructions_start
or al,al
jnz unexpected_characters
push dword [macro_status]
or [macro_status],10h
push [counter]
push [macro_block]
push [macro_block_line]
push [macro_block_line_number]
push [struc_label]
push [struc_name]
push eax
push [current_line]
lods byte [esi]
cmp al,'{'
je macro_instructions_start
or al,al
jnz unexpected_characters
find_macro_instructions:
mov [macro_line],esi
add esi,16+2
lods byte [esi]
or al,al
jz find_macro_instructions
cmp al,'{'
je macro_instructions_start
cmp al,3Bh
jne unexpected_characters
call skip_foreign_symbol
jmp find_macro_instructions
mov [macro_line],esi
add esi,16+2
lods byte [esi]
or al,al
jz find_macro_instructions
cmp al,'{'
je macro_instructions_start
cmp al,3Bh
jne unexpected_characters
call skip_foreign_symbol
jmp find_macro_instructions
macro_instructions_start:
mov ecx,80000000h
mov [macro_block],esi
mov eax,[macro_line]
mov [macro_block_line],eax
mov [macro_block_line_number],ecx
xor eax,eax
mov [counter],eax
cmp [counter_limit],eax
je process_macro_line
inc [counter]
mov ecx,80000000h
mov [macro_block],esi
mov eax,[macro_line]
mov [macro_block_line],eax
mov [macro_block_line_number],ecx
xor eax,eax
mov [counter],eax
cmp [counter_limit],eax
je process_macro_line
inc [counter]
process_macro_line:
lods byte [esi]
or al,al
jz process_next_line
cmp al,'}'
je macro_block_processed
dec esi
mov [current_line],edi
lea eax,[edi+10h]
cmp eax,[memory_end]
jae out_of_memory
mov eax,[esp+4]
or eax,eax
jz instant_macro_line_header
stos dword [edi]
mov eax,ecx
stos dword [edi]
mov eax,[esp]
stos dword [edi]
mov eax,[macro_line]
stos dword [edi]
jmp macro_line_header_ok
lods byte [esi]
or al,al
jz process_next_line
cmp al,'}'
je macro_block_processed
dec esi
mov [current_line],edi
lea eax,[edi+10h]
cmp eax,[memory_end]
jae out_of_memory
mov eax,[esp+4]
or eax,eax
jz instant_macro_line_header
stos dword [edi]
mov eax,ecx
stos dword [edi]
mov eax,[esp]
stos dword [edi]
mov eax,[macro_line]
stos dword [edi]
jmp macro_line_header_ok
instant_macro_line_header:
mov eax,[macro_line]
add eax,16+1
stos dword [edi]
mov eax,ecx
stos dword [edi]
mov eax,[macro_line]
stos dword [edi]
stos dword [edi]
mov eax,[macro_line]
add eax,16+1
stos dword [edi]
mov eax,ecx
stos dword [edi]
mov eax,[macro_line]
stos dword [edi]
stos dword [edi]
macro_line_header_ok:
or [macro_status],20h
push ebx ecx
test [macro_status],0Fh
jz process_macro_line_element
mov ax,3Bh
stos word [edi]
or [macro_status],20h
push ebx ecx
test [macro_status],0Fh
jz process_macro_line_element
mov ax,3Bh
stos word [edi]
process_macro_line_element:
lea eax,[edi+100h]
cmp eax,[memory_end]
jae out_of_memory
lods byte [esi]
cmp al,'}'
je macro_line_processed
or al,al
jz macro_line_processed
cmp al,1Ah
je process_macro_symbol
cmp al,3Bh
je macro_foreign_line
and [macro_status],not 20h
stos byte [edi]
cmp al,22h
jne process_macro_line_element
lea eax,[edi+100h]
cmp eax,[memory_end]
jae out_of_memory
lods byte [esi]
cmp al,'}'
je macro_line_processed
or al,al
jz macro_line_processed
cmp al,1Ah
je process_macro_symbol
cmp al,3Bh
je macro_foreign_line
and [macro_status],not 20h
stos byte [edi]
cmp al,22h
jne process_macro_line_element
copy_macro_string:
mov ecx,[esi]
add ecx,4
call move_data
jmp process_macro_line_element
mov ecx,[esi]
add ecx,4
call move_data
jmp process_macro_line_element
process_macro_symbol:
push esi edi
test [macro_status],20h
jz not_macro_directive
movzx ecx,byte [esi]
inc esi
mov edi,macro_directives
call get_directive
jnc process_macro_directive
dec esi
jmp not_macro_directive
push esi edi
test [macro_status],20h
jz not_macro_directive
movzx ecx,byte [esi]
inc esi
mov edi,macro_directives
call get_directive
jnc process_macro_directive
dec esi
jmp not_macro_directive
process_macro_directive:
mov edx,eax
pop edi eax
mov byte [edi],0
inc edi
pop ecx ebx
jmp near edx
mov edx,eax
pop edi eax
mov byte [edi],0
inc edi
pop ecx ebx
jmp near edx
not_macro_directive:
and [macro_status],not 20h
movzx ecx,byte [esi]
inc esi
mov eax,[counter]
call get_macro_symbol
jnc group_macro_symbol
xor eax,eax
cmp [counter],eax
je multiple_macro_symbol_values
call get_macro_symbol
jc not_macro_symbol
and [macro_status],not 20h
movzx ecx,byte [esi]
inc esi
mov eax,[counter]
call get_macro_symbol
jnc group_macro_symbol
xor eax,eax
cmp [counter],eax
je multiple_macro_symbol_values
call get_macro_symbol
jc not_macro_symbol
replace_macro_symbol:
pop edi eax
mov ecx,[edx+8]
mov edx,[edx+12]
or edx,edx
jz replace_macro_counter
and ecx,not 80000000h
xchg esi,edx
call move_data
mov esi,edx
jmp process_macro_line_element
pop edi eax
mov ecx,[edx+8]
mov edx,[edx+12]
or edx,edx
jz replace_macro_counter
and ecx,not 80000000h
xchg esi,edx
call move_data
mov esi,edx
jmp process_macro_line_element
group_macro_symbol:
xor eax,eax
cmp [counter],eax
je replace_macro_symbol
push esi edx
sub esi,ecx
call get_macro_symbol
mov ebx,edx
pop edx esi
jc replace_macro_symbol
cmp edx,ebx
ja replace_macro_symbol
mov edx,ebx
jmp replace_macro_symbol
xor eax,eax
cmp [counter],eax
je replace_macro_symbol
push esi edx
sub esi,ecx
call get_macro_symbol
mov ebx,edx
pop edx esi
jc replace_macro_symbol
cmp edx,ebx
ja replace_macro_symbol
mov edx,ebx
jmp replace_macro_symbol
multiple_macro_symbol_values:
inc eax
push eax
call get_macro_symbol
pop eax
jc not_macro_symbol
pop edi
push ecx
mov ecx,[edx+8]
mov edx,[edx+12]
xchg esi,edx
btr ecx,31
jc enclose_macro_symbol_value
rep movs byte [edi],[esi]
jmp macro_symbol_value_ok
inc eax
push eax
call get_macro_symbol
pop eax
jc not_macro_symbol
pop edi
push ecx
mov ecx,[edx+8]
mov edx,[edx+12]
xchg esi,edx
btr ecx,31
jc enclose_macro_symbol_value
rep movs byte [edi],[esi]
jmp macro_symbol_value_ok
enclose_macro_symbol_value:
mov byte [edi],'<'
inc edi
rep movs byte [edi],[esi]
mov byte [edi],'>'
inc edi
mov byte [edi],'<'
inc edi
rep movs byte [edi],[esi]
mov byte [edi],'>'
inc edi
macro_symbol_value_ok:
cmp eax,[counter_limit]
je multiple_macro_symbol_values_ok
mov byte [edi],','
inc edi
mov esi,edx
pop ecx
push edi
sub esi,ecx
jmp multiple_macro_symbol_values
cmp eax,[counter_limit]
je multiple_macro_symbol_values_ok
mov byte [edi],','
inc edi
mov esi,edx
pop ecx
push edi
sub esi,ecx
jmp multiple_macro_symbol_values
multiple_macro_symbol_values_ok:
pop ecx eax
mov esi,edx
jmp process_macro_line_element
pop ecx eax
mov esi,edx
jmp process_macro_line_element
replace_macro_counter:
mov eax,[counter]
and eax,not 80000000h
jz group_macro_counter
add ecx,eax
dec ecx
call store_number_symbol
jmp process_macro_line_element
mov eax,[counter]
and eax,not 80000000h
jz group_macro_counter
add ecx,eax
dec ecx
call store_number_symbol
jmp process_macro_line_element
group_macro_counter:
mov edx,ecx
xor ecx,ecx
mov edx,ecx
xor ecx,ecx
multiple_macro_counter_values:
push ecx edx
add ecx,edx
call store_number_symbol
pop edx ecx
inc ecx
cmp ecx,[counter_limit]
je process_macro_line_element
mov byte [edi],','
inc edi
jmp multiple_macro_counter_values
push ecx edx
add ecx,edx
call store_number_symbol
pop edx ecx
inc ecx
cmp ecx,[counter_limit]
je process_macro_line_element
mov byte [edi],','
inc edi
jmp multiple_macro_counter_values
store_number_symbol:
cmp ecx,0
jge numer_symbol_sign_ok
neg ecx
mov al,'-'
stos byte [edi]
cmp ecx,0
jge numer_symbol_sign_ok
neg ecx
mov al,'-'
stos byte [edi]
numer_symbol_sign_ok:
mov ax,1Ah
stos word [edi]
push edi
mov eax,ecx
mov ecx,1000000000
xor edx,edx
xor bl,bl
mov ax,1Ah
stos word [edi]
push edi
mov eax,ecx
mov ecx,1000000000
xor edx,edx
xor bl,bl
store_number_digits:
div ecx
push edx
or bl,bl
jnz store_number_digit
cmp ecx,1
je store_number_digit
or al,al
jz number_digit_ok
not bl
div ecx
push edx
or bl,bl
jnz store_number_digit
cmp ecx,1
je store_number_digit
or al,al
jz number_digit_ok
not bl
store_number_digit:
add al,30h
stos byte [edi]
add al,30h
stos byte [edi]
number_digit_ok:
mov eax,ecx
xor edx,edx
mov ecx,10
div ecx
mov ecx,eax
pop eax
or ecx,ecx
jnz store_number_digits
pop ebx
mov eax,edi
sub eax,ebx
mov [ebx-1],al
ret
mov eax,ecx
xor edx,edx
mov ecx,10
div ecx
mov ecx,eax
pop eax
or ecx,ecx
jnz store_number_digits
pop ebx
mov eax,edi
sub eax,ebx
mov [ebx-1],al
ret
not_macro_symbol:
pop edi esi
mov al,1Ah
stos byte [edi]
mov al,[esi]
inc esi
stos byte [edi]
cmp byte [esi],'.'
jne copy_raw_symbol
mov ebx,[esp+8+8]
or ebx,ebx
jz copy_raw_symbol
cmp al,1
je copy_struc_name
xchg esi,ebx
movzx ecx,byte [esi-1]
add [edi-1],cl
jc name_too_long
rep movs byte [edi],[esi]
xchg esi,ebx
pop edi esi
mov al,1Ah
stos byte [edi]
mov al,[esi]
inc esi
stos byte [edi]
cmp byte [esi],'.'
jne copy_raw_symbol
mov ebx,[esp+8+8]
or ebx,ebx
jz copy_raw_symbol
cmp al,1
je copy_struc_name
xchg esi,ebx
movzx ecx,byte [esi-1]
add [edi-1],cl
jc name_too_long
rep movs byte [edi],[esi]
xchg esi,ebx
copy_raw_symbol:
movzx ecx,al
rep movs byte [edi],[esi]
jmp process_macro_line_element
movzx ecx,al
rep movs byte [edi],[esi]
jmp process_macro_line_element
copy_struc_name:
inc esi
xchg esi,ebx
movzx ecx,byte [esi-1]
mov [edi-1],cl
rep movs byte [edi],[esi]
xchg esi,ebx
mov eax,[esp+8+12]
cmp byte [eax],3Bh
je process_macro_line_element
cmp byte [eax],1Ah
jne disable_replaced_struc_name
mov byte [eax],3Bh
jmp process_macro_line_element
inc esi
xchg esi,ebx
movzx ecx,byte [esi-1]
mov [edi-1],cl
rep movs byte [edi],[esi]
xchg esi,ebx
mov eax,[esp+8+12]
cmp byte [eax],3Bh
je process_macro_line_element
cmp byte [eax],1Ah
jne disable_replaced_struc_name
mov byte [eax],3Bh
jmp process_macro_line_element
disable_replaced_struc_name:
mov ebx,[esp+8+8]
push esi edi
lea edi,[ebx-3]
lea esi,[edi-2]
lea ecx,[esi+1]
sub ecx,eax
std
rep movs byte [edi],[esi]
cld
mov word [eax],3Bh
pop edi esi
jmp process_macro_line_element
mov ebx,[esp+8+8]
push esi edi
lea edi,[ebx-3]
lea esi,[edi-2]
lea ecx,[esi+1]
sub ecx,eax
std
rep movs byte [edi],[esi]
cld
mov word [eax],3Bh
pop edi esi
jmp process_macro_line_element
skip_foreign_symbol:
lods byte [esi]
movzx eax,al
add esi,eax
lods byte [esi]
movzx eax,al
add esi,eax
skip_foreign_line:
lods byte [esi]
cmp al,1Ah
je skip_foreign_symbol
cmp al,3Bh
je skip_foreign_symbol
cmp al,22h
je skip_foreign_string
or al,al
jnz skip_foreign_line
ret
lods byte [esi]
cmp al,1Ah
je skip_foreign_symbol
cmp al,3Bh
je skip_foreign_symbol
cmp al,22h
je skip_foreign_string
or al,al
jnz skip_foreign_line
ret
skip_foreign_string:
lods dword [esi]
add esi,eax
jmp skip_foreign_line
lods dword [esi]
add esi,eax
jmp skip_foreign_line
macro_foreign_line:
call skip_foreign_symbol
call skip_foreign_symbol
macro_line_processed:
mov byte [edi],0
inc edi
push eax
call preprocess_line
pop eax
pop ecx ebx
cmp al,'}'
je macro_block_processed
mov byte [edi],0
inc edi
push eax
call preprocess_line
pop eax
pop ecx ebx
cmp al,'}'
je macro_block_processed
process_next_line:
inc ecx
mov [macro_line],esi
add esi,16+2
jmp process_macro_line
inc ecx
mov [macro_line],esi
add esi,16+2
jmp process_macro_line
macro_block_processed:
call close_macro_block
jc process_macro_line
pop [current_line]
add esp,12
pop [macro_block_line_number]
pop [macro_block_line]
pop [macro_block]
pop [counter]
pop eax
and al,0F0h
and [macro_status],0Fh
or [macro_status],al
ret
call close_macro_block
jc process_macro_line
pop [current_line]
add esp,12
pop [macro_block_line_number]
pop [macro_block_line]
pop [macro_block]
pop [counter]
pop eax
and al,0F0h
and [macro_status],0Fh
or [macro_status],al
ret
 
local_symbols:
lods byte [esi]
cmp al,1Ah
jne invalid_argument
mov byte [edi-1],3Bh
xor al,al
stos byte [edi]
lods byte [esi]
cmp al,1Ah
jne invalid_argument
mov byte [edi-1],3Bh
xor al,al
stos byte [edi]
make_local_symbol:
push ecx
lods byte [esi]
movzx ecx,al
mov eax,[counter]
call add_macro_symbol
mov [edx+12],edi
movzx eax,[locals_counter]
add eax,ecx
inc eax
cmp eax,100h
jae name_too_long
lea ebp,[edi+2+eax]
cmp ebp,[memory_end]
jae out_of_memory
mov ah,al
mov al,1Ah
stos word [edi]
rep movs byte [edi],[esi]
mov al,'?'
stos byte [edi]
push esi
mov esi,locals_counter+1
movzx ecx,[locals_counter]
rep movs byte [edi],[esi]
pop esi
mov eax,edi
sub eax,[edx+12]
mov [edx+8],eax
xor al,al
stos byte [edi]
mov eax,locals_counter
movzx ecx,byte [eax]
push ecx
lods byte [esi]
movzx ecx,al
mov eax,[counter]
call add_macro_symbol
mov [edx+12],edi
movzx eax,[locals_counter]
add eax,ecx
inc eax
cmp eax,100h
jae name_too_long
lea ebp,[edi+2+eax]
cmp ebp,[memory_end]
jae out_of_memory
mov ah,al
mov al,1Ah
stos word [edi]
rep movs byte [edi],[esi]
mov al,'?'
stos byte [edi]
push esi
mov esi,locals_counter+1
movzx ecx,[locals_counter]
rep movs byte [edi],[esi]
pop esi
mov eax,edi
sub eax,[edx+12]
mov [edx+8],eax
xor al,al
stos byte [edi]
mov eax,locals_counter
movzx ecx,byte [eax]
counter_loop:
inc byte [eax+ecx]
cmp byte [eax+ecx],'9'+1
jb counter_ok
jne letter_digit
mov byte [eax+ecx],'A'
jmp counter_ok
inc byte [eax+ecx]
cmp byte [eax+ecx],'9'+1
jb counter_ok
jne letter_digit
mov byte [eax+ecx],'A'
jmp counter_ok
letter_digit:
cmp byte [eax+ecx],'Z'+1
jb counter_ok
jne small_letter_digit
mov byte [eax+ecx],'a'
jmp counter_ok
cmp byte [eax+ecx],'Z'+1
jb counter_ok
jne small_letter_digit
mov byte [eax+ecx],'a'
jmp counter_ok
small_letter_digit:
cmp byte [eax+ecx],'z'+1
jb counter_ok
mov byte [eax+ecx],'0'
loop counter_loop
inc byte [eax]
movzx ecx,byte [eax]
mov byte [eax+ecx],'0'
cmp byte [eax+ecx],'z'+1
jb counter_ok
mov byte [eax+ecx],'0'
loop counter_loop
inc byte [eax]
movzx ecx,byte [eax]
mov byte [eax+ecx],'0'
counter_ok:
pop ecx
lods byte [esi]
cmp al,'}'
je macro_block_processed
or al,al
jz process_next_line
cmp al,','
jne extra_characters_on_line
dec edi
lods byte [esi]
cmp al,1Ah
je make_local_symbol
jmp invalid_argument
pop ecx
lods byte [esi]
cmp al,'}'
je macro_block_processed
or al,al
jz process_next_line
cmp al,','
jne extra_characters_on_line
dec edi
lods byte [esi]
cmp al,1Ah
je make_local_symbol
jmp invalid_argument
common_block:
call close_macro_block
jc process_macro_line
mov [counter],0
jmp new_macro_block
call close_macro_block
jc process_macro_line
mov [counter],0
jmp new_macro_block
forward_block:
cmp [counter_limit],0
je common_block
call close_macro_block
jc process_macro_line
mov [counter],1
jmp new_macro_block
cmp [counter_limit],0
je common_block
call close_macro_block
jc process_macro_line
mov [counter],1
jmp new_macro_block
reverse_block:
cmp [counter_limit],0
je common_block
call close_macro_block
jc process_macro_line
mov eax,[counter_limit]
or eax,80000000h
mov [counter],eax
cmp [counter_limit],0
je common_block
call close_macro_block
jc process_macro_line
mov eax,[counter_limit]
or eax,80000000h
mov [counter],eax
new_macro_block:
mov [macro_block],esi
mov eax,[macro_line]
mov [macro_block_line],eax
mov [macro_block_line_number],ecx
jmp process_macro_line
mov [macro_block],esi
mov eax,[macro_line]
mov [macro_block_line],eax
mov [macro_block_line_number],ecx
jmp process_macro_line
close_macro_block:
cmp [counter],0
je block_closed
jl reverse_counter
mov eax,[counter]
cmp eax,[counter_limit]
je block_closed
inc [counter]
jmp continue_block
cmp [counter],0
je block_closed
jl reverse_counter
mov eax,[counter]
cmp eax,[counter_limit]
je block_closed
inc [counter]
jmp continue_block
reverse_counter:
mov eax,[counter]
dec eax
cmp eax,80000000h
je block_closed
mov [counter],eax
mov eax,[counter]
dec eax
cmp eax,80000000h
je block_closed
mov [counter],eax
continue_block:
mov esi,[macro_block]
mov eax,[macro_block_line]
mov [macro_line],eax
mov ecx,[macro_block_line_number]
stc
ret
mov esi,[macro_block]
mov eax,[macro_block_line]
mov [macro_line],eax
mov ecx,[macro_block_line_number]
stc
ret
block_closed:
clc
ret
clc
ret
get_macro_symbol:
push ecx
call find_macro_symbol_leaf
jc macro_symbol_not_found
mov edx,[ebx]
mov ebx,esi
push ecx
call find_macro_symbol_leaf
jc macro_symbol_not_found
mov edx,[ebx]
mov ebx,esi
try_macro_symbol:
or edx,edx
jz macro_symbol_not_found
mov ecx,[esp]
mov edi,[edx+4]
repe cmps byte [esi],[edi]
je macro_symbol_found
mov esi,ebx
mov edx,[edx]
jmp try_macro_symbol
or edx,edx
jz macro_symbol_not_found
mov ecx,[esp]
mov edi,[edx+4]
repe cmps byte [esi],[edi]
je macro_symbol_found
mov esi,ebx
mov edx,[edx]
jmp try_macro_symbol
macro_symbol_found:
pop ecx
clc
ret
pop ecx
clc
ret
macro_symbol_not_found:
pop ecx
stc
ret
pop ecx
stc
ret
find_macro_symbol_leaf:
shl eax,8
mov al,cl
mov ebp,eax
mov ebx,macro_symbols
shl eax,8
mov al,cl
mov ebp,eax
mov ebx,macro_symbols
follow_macro_symbols_tree:
mov edx,[ebx]
or edx,edx
jz no_such_macro_symbol
xor eax,eax
shr ebp,1
adc eax,0
lea ebx,[edx+eax*4]
or ebp,ebp
jnz follow_macro_symbols_tree
add ebx,8
clc
ret
mov edx,[ebx]
or edx,edx
jz no_such_macro_symbol
xor eax,eax
shr ebp,1
adc eax,0
lea ebx,[edx+eax*4]
or ebp,ebp
jnz follow_macro_symbols_tree
add ebx,8
clc
ret
no_such_macro_symbol:
stc
ret
stc
ret
add_macro_symbol:
push ebx ebp
call find_macro_symbol_leaf
jc extend_macro_symbol_tree
mov eax,[ebx]
push ebx ebp
call find_macro_symbol_leaf
jc extend_macro_symbol_tree
mov eax,[ebx]
make_macro_symbol:
mov edx,[free_additional_memory]
add edx,16
cmp edx,[labels_list]
ja out_of_memory
xchg edx,[free_additional_memory]
mov [ebx],edx
mov [edx],eax
mov [edx+4],esi
pop ebp ebx
ret
mov edx,[free_additional_memory]
add edx,16
cmp edx,[labels_list]
ja out_of_memory
xchg edx,[free_additional_memory]
mov [ebx],edx
mov [edx],eax
mov [edx+4],esi
pop ebp ebx
ret
extend_macro_symbol_tree:
mov edx,[free_additional_memory]
add edx,16
cmp edx,[labels_list]
ja out_of_memory
xchg edx,[free_additional_memory]
xor eax,eax
mov [edx],eax
mov [edx+4],eax
mov [edx+8],eax
mov [edx+12],eax
shr ebp,1
adc eax,0
mov [ebx],edx
lea ebx,[edx+eax*4]
or ebp,ebp
jnz extend_macro_symbol_tree
add ebx,8
xor eax,eax
jmp make_macro_symbol
mov edx,[free_additional_memory]
add edx,16
cmp edx,[labels_list]
ja out_of_memory
xchg edx,[free_additional_memory]
xor eax,eax
mov [edx],eax
mov [edx+4],eax
mov [edx+8],eax
mov [edx+12],eax
shr ebp,1
adc eax,0
mov [ebx],edx
lea ebx,[edx+eax*4]
or ebp,ebp
jnz extend_macro_symbol_tree
add ebx,8
xor eax,eax
jmp make_macro_symbol
 
include_file:
lods byte [esi]
cmp al,22h
jne invalid_argument
lods dword [esi]
cmp byte [esi+eax],0
jne extra_characters_on_line
push esi
push edi
mov ebx,[current_line]
lods byte [esi]
cmp al,22h
jne invalid_argument
lods dword [esi]
cmp byte [esi+eax],0
jne extra_characters_on_line
push esi
push edi
mov ebx,[current_line]
find_current_file_path:
mov esi,[ebx]
test byte [ebx+7],80h
jz copy_current_file_path
mov ebx,[ebx+8]
jmp find_current_file_path
mov esi,[ebx]
test byte [ebx+7],80h
jz copy_current_file_path
mov ebx,[ebx+8]
jmp find_current_file_path
copy_current_file_path:
lods byte [esi]
stos byte [edi]
or al,al
jnz copy_current_file_path
lods byte [esi]
stos byte [edi]
or al,al
jnz copy_current_file_path
cut_current_file_name:
cmp edi,[esp]
je current_file_path_ok
cmp byte [edi-1],'\'
je current_file_path_ok
cmp byte [edi-1],'/'
je current_file_path_ok
dec edi
jmp cut_current_file_name
cmp edi,[esp]
je current_file_path_ok
cmp byte [edi-1],'\'
je current_file_path_ok
cmp byte [edi-1],'/'
je current_file_path_ok
dec edi
jmp cut_current_file_name
current_file_path_ok:
mov esi,[esp+4]
call preprocess_path
pop edx
mov esi,edx
call open
jnc include_path_ok
mov ebp,[include_paths]
mov esi,[esp+4]
call expand_path
pop edx
mov esi,edx
call open
jnc include_path_ok
mov ebp,[include_paths]
try_include_directories:
mov edi,esi
mov esi,ebp
cmp byte [esi],0
je try_in_current_directory
push ebp
push edi
copy_include_directory:
lods byte [esi]
cmp al,';'
je include_directory_ok
stos byte [edi]
or al,al
jnz copy_include_directory
dec esi
dec edi
include_directory_ok:
cmp byte [edi-1],'/'
je path_separator_ok
cmp byte [edi-1],'\'
je path_separator_ok
mov al,'/'
stos byte [edi]
path_separator_ok:
mov [esp+4],esi
mov esi,[esp+8]
call preprocess_path
pop edx
mov esi,edx
call open
pop ebp
jnc include_path_ok
jmp try_include_directories
mov edi,esi
mov edi,esi
mov esi,ebp
cmp byte [esi],0
je try_in_current_directory
push ebp
push edi
call get_include_directory
mov [esp+4],esi
mov esi,[esp+8]
call expand_path
pop edx
mov esi,edx
call open
pop ebp
jnc include_path_ok
jmp try_include_directories
mov edi,esi
try_in_current_directory:
mov esi,[esp]
push edi
call preprocess_path
pop edx
mov esi,edx
call open
jc file_not_found
mov esi,[esp]
push edi
call expand_path
pop edx
mov esi,edx
call open
jc file_not_found
include_path_ok:
mov edi,[esp]
mov edi,[esp]
copy_preprocessed_path:
lods byte [esi]
stos byte [edi]
or al,al
jnz copy_preprocessed_path
pop esi
lea ecx,[edi-1]
sub ecx,esi
mov [esi-4],ecx
push dword [macro_status]
and [macro_status],0Fh
call preprocess_file
pop eax
mov [macro_status],al
jmp line_preprocessed
preprocess_path:
lods byte [esi]
cmp al,'%'
je environment_variable
stos byte [edi]
or al,al
jnz preprocess_path
cmp edi,[memory_end]
ja out_of_memory
ret
environment_variable:
mov ebx,esi
find_variable_end:
lods byte [esi]
or al,al
jz not_environment_variable
cmp al,'%'
jne find_variable_end
mov byte [esi-1],0
push esi
mov esi,ebx
call get_environment_variable
pop esi
mov byte [esi-1],'%'
jmp preprocess_path
not_environment_variable:
mov al,'%'
stos byte [edi]
mov esi,ebx
jmp preprocess_path
lods byte [esi]
stos byte [edi]
or al,al
jnz copy_preprocessed_path
pop esi
lea ecx,[edi-1]
sub ecx,esi
mov [esi-4],ecx
push dword [macro_status]
and [macro_status],0Fh
call preprocess_file
pop eax
and al,0F0h
and [macro_status],0Fh
or [macro_status],al
jmp line_preprocessed
/programs/develop/fasm/trunk/symbdump.inc
1,28 → 1,28
 
; flat assembler core
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
 
dump_symbols:
 
; flat assembler core
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
 
dump_symbols:
mov edi,[code_start]
call setup_dump_header
mov esi,[input_file]
call copy_asciiz
cmp edi,[display_buffer]
jae out_of_memory
mov eax,edi
sub eax,ebx
mov [ebx-38h+0Ch],eax
mov esi,[output_file]
call copy_asciiz
cmp edi,[display_buffer]
jae out_of_memory
mov edx,[symbols_stream]
mov ebp,[free_additional_memory]
mov [number_of_sections],0
cmp [output_format],4
je prepare_strings_table
cmp [output_format],5
jae out_of_memory
mov eax,edi
sub eax,ebx
mov [ebx-40h+0Ch],eax
mov esi,[output_file]
call copy_asciiz
cmp edi,[display_buffer]
jae out_of_memory
mov edx,[symbols_stream]
mov ebp,[free_additional_memory]
and [number_of_sections],0
cmp [output_format],4
je prepare_strings_table
cmp [output_format],5
jne strings_table_ready
bt [format_flags],0
jc strings_table_ready
149,40 → 149,45
label_used_flag_ok:
add edx,LABEL_STRUCTURE_SIZE
jmp prepare_labels_dump
labels_dump_ok:
mov eax,edi
sub eax,ebx
mov [ebx-38h+14h],eax
add eax,38h
mov [ebx-38h+18h],eax
mov ecx,[memory_end]
sub ecx,[labels_list]
mov [ebx-38h+1Ch],ecx
add eax,ecx
mov [ebx-38h+20h],eax
mov ecx,[source_start]
sub ecx,[memory_start]
mov [ebx-38h+24h],ecx
add eax,ecx
mov [ebx-38h+28h],eax
mov eax,[number_of_sections]
shl eax,2
mov [ebx-38h+34h],eax
call prepare_preprocessed_source
mov esi,[labels_list]
mov ebp,edi
labels_dump_ok:
mov eax,edi
sub eax,ebx
mov [ebx-40h+14h],eax
add eax,40h
mov [ebx-40h+18h],eax
mov ecx,[memory_end]
sub ecx,[labels_list]
mov [ebx-40h+1Ch],ecx
add eax,ecx
mov [ebx-40h+20h],eax
mov ecx,[source_start]
sub ecx,[memory_start]
mov [ebx-40h+24h],ecx
add eax,ecx
mov [ebx-40h+28h],eax
mov eax,[number_of_sections]
shl eax,2
mov [ebx-40h+34h],eax
call prepare_preprocessed_source
mov esi,[labels_list]
mov ebp,edi
make_lines_dump:
cmp esi,[display_buffer]
je lines_dump_ok
mov eax,[esi-4]
mov ecx,[esi-8]
sub esi,8
sub esi,ecx
cmp eax,1
jne make_lines_dump
mov eax,[esi+4]
sub eax,[code_start]
add eax,[headers_size]
sub esi,8
sub esi,ecx
cmp eax,1
je process_line_dump
cmp eax,2
jne make_lines_dump
add dword [ebx-40h+3Ch],8
jmp make_lines_dump
process_line_dump:
mov eax,[esi+4]
sub eax,[code_start]
add eax,[headers_size]
cmp byte [esi+1Ah],0
je store_offset
xor eax,eax
190,14 → 195,16
stos dword [edi]
mov eax,[esi]
sub eax,[memory_start]
stos dword [edi]
mov eax,[esi+4]
xor edx,edx
sub eax,[esi+8]
sbb edx,[esi+8+4]
stos dword [edi]
mov eax,edx
stos dword [edi]
stos dword [edi]
mov eax,[esi+4]
xor edx,edx
xor cl,cl
sub eax,[esi+8]
sbb edx,[esi+8+4]
sbb cl,[esi+1Bh]
stos dword [edi]
mov eax,edx
stos dword [edi]
mov eax,[esi+10h]
stos dword [edi]
mov eax,[esi+14h]
207,50 → 214,57
mov eax,[eax+4]
jae base_symbol_for_line_ok
xor eax,eax
base_symbol_for_line_ok:
stos dword [edi]
mov eax,[esi+18h]
and eax,001FFFFh
stos dword [edi]
cmp edi,[display_buffer]
jae out_of_memory
jmp make_lines_dump
lines_dump_ok:
mov edx,edi
base_symbol_for_line_ok:
stos dword [edi]
mov eax,[esi+18h]
and eax,01FFFFh
stos dword [edi]
mov [edi-1],cl
cmp edi,[display_buffer]
jae out_of_memory
mov eax,edi
sub eax,1Ch
sub eax,ebp
mov [esi],eax
jmp make_lines_dump
lines_dump_ok:
mov edx,edi
mov eax,[current_offset]
sub eax,[code_start]
add eax,[headers_size]
stos dword [edi]
mov ecx,edi
sub ecx,ebx
sub ecx,[ebx-38h+14h]
mov [ebx-38h+2Ch],ecx
add ecx,[ebx-38h+28h]
mov [ebx-38h+30h],ecx
find_inexisting_offsets:
sub edx,1Ch
cmp edx,ebp
stos dword [edi]
mov ecx,edi
sub ecx,ebx
sub ecx,[ebx-40h+14h]
mov [ebx-40h+2Ch],ecx
add ecx,[ebx-40h+28h]
mov [ebx-40h+30h],ecx
add ecx,[ebx-40h+34h]
mov [ebx-40h+38h],ecx
find_inexisting_offsets:
sub edx,1Ch
cmp edx,ebp
jb write_symbols
test byte [edx+1Ah],1
jnz find_inexisting_offsets
cmp eax,[edx]
jb correct_inexisting_offset
mov eax,[edx]
jmp find_inexisting_offsets
correct_inexisting_offset:
mov dword [edx],0
or byte [edx+1Ah],2
jmp find_inexisting_offsets
write_symbols:
mov eax,[edx]
jmp find_inexisting_offsets
correct_inexisting_offset:
and dword [edx],0
or byte [edx+1Ah],2
jmp find_inexisting_offsets
write_symbols:
mov edx,[symbols_file]
call create
jc write_failed
mov edx,[code_start]
mov ecx,[edx+14h]
add ecx,38h
call write
jc write_failed
mov edx,[display_buffer]
jc write_failed
mov edx,[code_start]
mov ecx,[edx+14h]
add ecx,40h
call write
jc write_failed
mov edx,[display_buffer]
mov ecx,[memory_end]
sub ecx,[labels_list]
call write
267,22 → 281,53
jc write_failed
mov edx,[free_additional_memory]
mov ecx,[number_of_sections]
shl ecx,2
call write
jc write_failed
call close
ret
setup_dump_header:
xor eax,eax
mov ecx,38h shr 2
rep stos dword [edi]
mov ebx,edi
mov dword [ebx-38h],'fas'+1Ah shl 24
mov dword [ebx-38h+4],VERSION_MAJOR + VERSION_MINOR shl 8 + 38h shl 16
mov dword [ebx-38h+10h],38h
ret
prepare_preprocessed_source:
mov esi,[memory_start]
shl ecx,2
call write
jc write_failed
mov esi,[labels_list]
mov edi,[memory_start]
make_references_dump:
cmp esi,[display_buffer]
je references_dump_ok
mov eax,[esi-4]
mov ecx,[esi-8]
sub esi,8
sub esi,ecx
cmp eax,2
je dump_reference
cmp eax,1
jne make_references_dump
mov edx,[esi]
jmp make_references_dump
dump_reference:
mov eax,[memory_end]
sub eax,[esi]
sub eax,LABEL_STRUCTURE_SIZE
stosd
mov eax,edx
stosd
cmp edi,[display_buffer]
jb make_references_dump
jmp out_of_memory
references_dump_ok:
mov edx,[memory_start]
mov ecx,edi
sub ecx,edx
call write
jc write_failed
call close
ret
setup_dump_header:
xor eax,eax
mov ecx,40h shr 2
rep stos dword [edi]
mov ebx,edi
mov dword [ebx-40h],'fas'+1Ah shl 24
mov dword [ebx-40h+4],VERSION_MAJOR + VERSION_MINOR shl 8 + 40h shl 16
mov dword [ebx-40h+10h],40h
ret
prepare_preprocessed_source:
mov esi,[memory_start]
mov ebp,[source_start]
test ebp,ebp
jnz prepare_preprocessed_line
362,29 → 407,29
call copy_asciiz
cmp edi,[additional_memory_end]
jae out_of_memory
mov eax,edi
sub eax,ebx
dec eax
mov [ebx-38h+0Ch],eax
mov eax,edi
sub eax,ebx
mov [ebx-38h+14h],eax
add eax,38h
mov [ebx-38h+20h],eax
call prepare_preprocessed_source
sub esi,[memory_start]
mov [ebx-38h+24h],esi
mov edx,[symbols_file]
call create
jc write_failed
mov edx,[free_additional_memory]
mov ecx,[edx+14h]
add ecx,38h
call write
jc write_failed
mov edx,[memory_start]
mov eax,edi
sub eax,ebx
dec eax
mov [ebx-40h+0Ch],eax
mov eax,edi
sub eax,ebx
mov [ebx-40h+14h],eax
add eax,40h
mov [ebx-40h+20h],eax
call prepare_preprocessed_source
sub esi,[memory_start]
mov [ebx-40h+24h],esi
mov edx,[symbols_file]
call create
jc write_failed
mov edx,[free_additional_memory]
mov ecx,[edx+14h]
add ecx,40h
call write
jc write_failed
mov edx,[memory_start]
mov ecx,esi
call write
jc write_failed
call close
ret
ret
/programs/develop/fasm/trunk/tables.inc
1,10 → 1,10
 
; flat assembler core
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
 
include_variable db 'INCLUDE',0
 
; flat assembler core
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
 
include_variable db 'INCLUDE',0
 
symbol_characters db 27
db 9,0Ah,0Dh,1Ah,20h,'+-/*=<>()[]{}:,|&~#`;\'
 
46,25 → 46,25
 
operators:
db 1,'+',80h
db 1,'-',81h
db 1,'*',90h
db 1,'/',91h
db 3,'mod',0A0h
db 3,'and',0B0h
db 2,'or',0B1h
db 3,'xor',0B2h
db 3,'shl',0C0h
db 3,'shr',0C1h
db 1,'-',81h
db 1,'*',90h
db 1,'/',91h
db 3,'and',0B0h
db 3,'mod',0A0h
db 2,'or',0B1h
db 3,'shl',0C0h
db 3,'shr',0C1h
db 3,'xor',0B2h
db 0
 
single_operand_operators:
db 1,'+',82h
db 1,'-',83h
db 3,'not',0D0h
db 3,'plt',0E1h
db 3,'rva',0E0h
db 0
 
single_operand_operators:
db 1,'+',82h
db 1,'-',83h
db 3,'not',0D0h
db 3,'plt',0E1h
db 3,'rva',0E0h
db 0
 
directive_operators:
db 5,'align',8Ch
db 2,'as',86h
74,56 → 74,16
db 2,'eq',0F0h
db 6,'eqtype',0F7h
db 4,'from',82h
db 2,'in',0F6h
db 2,'on',84h
db 3,'ptr',85h
db 4,'used',89h
db 0
 
address_registers:
db 2,'bp',25h
db 2,'bx',23h
db 2,'di',27h
db 3,'eax',40h
db 3,'ebp',45h
db 3,'ebx',43h
db 3,'ecx',41h
db 3,'edi',47h
db 3,'edx',42h
db 3,'eip',0F4h
db 3,'esi',46h
db 3,'esp',44h
db 3,'r10',8Ah
db 4,'r10d',4Ah
db 3,'r11',8Bh
db 4,'r11d',4Bh
db 3,'r12',8Ch
db 4,'r12d',4Ch
db 3,'r13',8Dh
db 4,'r13d',4Dh
db 3,'r14',8Eh
db 4,'r14d',4Eh
db 3,'r15',8Fh
db 4,'r15d',4Fh
db 2,'r8',88h
db 3,'r8d',48h
db 2,'r9',89h
db 3,'r9d',49h
db 3,'rax',80h
db 3,'rbp',85h
db 3,'rbx',83h
db 3,'rcx',81h
db 3,'rdi',87h
db 3,'rdx',82h
db 3,'rip',0F8h
db 3,'rsi',86h
db 3,'rsp',84h
db 2,'si',26h
db 0
 
address_sizes:
db 4,'byte',1
db 5,'dword',4
db 2,'in',0F6h
db 2,'on',84h
db 3,'ptr',85h
db 10,'relativeto',0F8h
db 4,'used',89h
db 0
 
address_sizes:
db 4,'byte',1
db 5,'dword',4
db 5,'qword',8
db 4,'word',2
db 0
600,14 → 560,26
dw basic_instruction-instruction_handler
db 'ud2',0Bh
dw simple_extended_instruction-instruction_handler
db 'xor',30h
dw basic_instruction-instruction_handler
instructions_4:
db 'arpl',0
dw arpl_instruction-instruction_handler
db 'call',0
dw call_instruction-instruction_handler
db 'cdqe',98h
db 'xor',30h
dw basic_instruction-instruction_handler
instructions_4:
db 'andn',0F2h
dw andn_instruction-instruction_handler
db 'arpl',0
dw arpl_instruction-instruction_handler
db 'blci',26h
dw tbm_instruction-instruction_handler
db 'blcs',13h
dw tbm_instruction-instruction_handler
db 'blsi',3
dw bmi_instruction-instruction_handler
db 'blsr',1
dw bmi_instruction-instruction_handler
db 'bzhi',0F5h
dw bzhi_instruction-instruction_handler
db 'call',0
dw call_instruction-instruction_handler
db 'cdqe',98h
dw simple_instruction_64bit-instruction_handler
db 'clgi',0DDh
dw simple_vmx_instruction-instruction_handler
720,20 → 692,26
db 'movd',0
dw movd_instruction-instruction_handler
db 'movq',0
dw movq_instruction-instruction_handler
db 'movs',0A4h
dw movs_instruction-instruction_handler
db 'orpd',56h
dw sse_pd_instruction-instruction_handler
db 'orps',56h
dw movq_instruction-instruction_handler
db 'movs',0A4h
dw movs_instruction-instruction_handler
db 'mulx',0F6h
dw pdep_instruction-instruction_handler
db 'orpd',56h
dw sse_pd_instruction-instruction_handler
db 'orps',56h
dw sse_ps_instruction-instruction_handler
db 'outs',6Eh
dw outs_instruction-instruction_handler
db 'pand',0DBh
dw basic_mmx_instruction-instruction_handler
db 'popa',61h
dw simple_instruction_except64-instruction_handler
db 'popd',4
dw outs_instruction-instruction_handler
db 'pand',0DBh
dw basic_mmx_instruction-instruction_handler
db 'pdep',0F5h
dw pdep_instruction-instruction_handler
db 'pext',0F5h
dw pext_instruction-instruction_handler
db 'popa',61h
dw simple_instruction_except64-instruction_handler
db 'popd',4
dw pop_instruction-instruction_handler
db 'popf',9Dh
dw simple_instruction-instruction_handler
756,16 → 734,20
db 'retn',0C2h
dw ret_instruction-instruction_handler
db 'retq',0C2h
dw ret_instruction_only64-instruction_handler
db 'retw',0C2h
dw ret_instruction_16bit-instruction_handler
db 'sahf',9Eh
dw simple_instruction-instruction_handler
db 'salc',0D6h
dw simple_instruction_except64-instruction_handler
db 'scas',0AEh
dw stos_instruction-instruction_handler
db 'seta',97h
dw ret_instruction_only64-instruction_handler
db 'retw',0C2h
dw ret_instruction_16bit-instruction_handler
db 'rorx',0F0h
dw rorx_instruction-instruction_handler
db 'sahf',9Eh
dw simple_instruction-instruction_handler
db 'salc',0D6h
dw simple_instruction_except64-instruction_handler
db 'sarx',0F7h
dw sarx_instruction-instruction_handler
db 'scas',0AEh
dw stos_instruction-instruction_handler
db 'seta',97h
dw set_instruction-instruction_handler
db 'setb',92h
dw set_instruction-instruction_handler
786,14 → 768,18
db 'setz',94h
dw set_instruction-instruction_handler
db 'sgdt',0
dw lgdt_instruction-instruction_handler
db 'shld',0A4h
dw shd_instruction-instruction_handler
db 'shrd',0ACh
dw shd_instruction-instruction_handler
db 'sidt',1
dw lgdt_instruction-instruction_handler
db 'sldt',0
dw lgdt_instruction-instruction_handler
db 'shld',0A4h
dw shd_instruction-instruction_handler
db 'shlx',0F7h
dw shlx_instruction-instruction_handler
db 'shrd',0ACh
dw shd_instruction-instruction_handler
db 'shrx',0F7h
dw shrx_instruction-instruction_handler
db 'sidt',1
dw lgdt_instruction-instruction_handler
db 'sldt',0
dw pm_store_word_instruction-instruction_handler
db 'smsw',14h
dw pm_store_word_instruction-instruction_handler
805,19 → 791,21
dw test_instruction-instruction_handler
db 'verr',4
dw pm_word_instruction-instruction_handler
db 'verw',5
dw pm_word_instruction-instruction_handler
db 'vpor',0EBh
dw avx_128bit_instruction-instruction_handler
db 'wait',9Bh
dw simple_instruction-instruction_handler
db 'xadd',0C0h
dw basic_486_instruction-instruction_handler
db 'xchg',0
dw xchg_instruction-instruction_handler
db 'xlat',0D7h
dw xlat_instruction-instruction_handler
instructions_5:
db 'verw',5
dw pm_word_instruction-instruction_handler
db 'vpor',0EBh
dw avx_pd_instruction-instruction_handler
db 'wait',9Bh
dw simple_instruction-instruction_handler
db 'xadd',0C0h
dw basic_486_instruction-instruction_handler
db 'xchg',0
dw xchg_instruction-instruction_handler
db 'xend',0D5h
dw simple_vmx_instruction-instruction_handler
db 'xlat',0D7h
dw xlat_instruction-instruction_handler
instructions_5:
db 'addpd',58h
dw sse_pd_instruction-instruction_handler
db 'addps',58h
829,38 → 817,44
db 'align',0
dw align_directive-instruction_handler
db 'andpd',54h
dw sse_pd_instruction-instruction_handler
db 'andps',54h
dw sse_ps_instruction-instruction_handler
db 'bound',0
dw bound_instruction-instruction_handler
db 'break',0
dw sse_pd_instruction-instruction_handler
db 'andps',54h
dw sse_ps_instruction-instruction_handler
db 'bextr',0F7h
dw bextr_instruction-instruction_handler
db 'blcic',15h
dw tbm_instruction-instruction_handler
db 'blsic',16h
dw tbm_instruction-instruction_handler
db 'bound',0
dw bound_instruction-instruction_handler
db 'break',0
dw break_directive-instruction_handler
db 'bswap',0
dw bswap_instruction-instruction_handler
db 'cmova',47h
dw cmov_instruction-instruction_handler
db 'cmovb',42h
dw cmov_instruction-instruction_handler
db 'cmovc',42h
dw cmov_instruction-instruction_handler
db 'cmove',44h
dw cmov_instruction-instruction_handler
db 'cmovg',4Fh
dw cmov_instruction-instruction_handler
db 'cmovl',4Ch
dw cmov_instruction-instruction_handler
db 'cmovo',40h
dw cmov_instruction-instruction_handler
db 'cmovp',4Ah
dw cmov_instruction-instruction_handler
db 'cmovs',48h
dw cmov_instruction-instruction_handler
db 'cmovz',44h
dw cmov_instruction-instruction_handler
db 'cmppd',-1
dw cmp_pd_instruction-instruction_handler
db 'cmpps',-1
db 'bswap',0
dw bswap_instruction-instruction_handler
db 'cmova',47h
dw bs_instruction-instruction_handler
db 'cmovb',42h
dw bs_instruction-instruction_handler
db 'cmovc',42h
dw bs_instruction-instruction_handler
db 'cmove',44h
dw bs_instruction-instruction_handler
db 'cmovg',4Fh
dw bs_instruction-instruction_handler
db 'cmovl',4Ch
dw bs_instruction-instruction_handler
db 'cmovo',40h
dw bs_instruction-instruction_handler
db 'cmovp',4Ah
dw bs_instruction-instruction_handler
db 'cmovs',48h
dw bs_instruction-instruction_handler
db 'cmovz',44h
dw bs_instruction-instruction_handler
db 'cmppd',-1
dw cmp_pd_instruction-instruction_handler
db 'cmpps',-1
dw cmp_ps_instruction-instruction_handler
db 'cmpsb',0A6h
dw simple_instruction-instruction_handler
1219,12 → 1213,16
db 'subsd',5Ch
dw sse_sd_instruction-instruction_handler
db 'subss',5Ch
dw sse_ss_instruction-instruction_handler
db 'times',0
dw times_directive-instruction_handler
db 'vdppd',41h
dw avx_128bit_instruction_3a_imm8-instruction_handler
db 'vdpps',40h
dw sse_ss_instruction-instruction_handler
db 'times',0
dw times_directive-instruction_handler
db 'tzcnt',0BCh
dw popcnt_instruction-instruction_handler
db 'tzmsk',14h
dw tbm_instruction-instruction_handler
db 'vdppd',41h
dw avx_128bit_instruction_3a_imm8-instruction_handler
db 'vdpps',40h
dw avx_instruction_3a_imm8-instruction_handler
db 'vmovd',0
dw avx_movd_instruction-instruction_handler
1236,15 → 1234,15
dw vmxon_instruction-instruction_handler
db 'vorpd',56h
dw avx_pd_instruction-instruction_handler
db 'vorps',56h
dw avx_ps_instruction-instruction_handler
db 'vpand',0DBh
dw avx_128bit_instruction-instruction_handler
db 'vpxor',0EFh
dw avx_128bit_instruction-instruction_handler
db 'while',0
dw while_directive-instruction_handler
db 'wrmsr',30h
db 'vorps',56h
dw avx_ps_instruction-instruction_handler
db 'vpand',0DBh
dw avx_pd_instruction-instruction_handler
db 'vpxor',0EFh
dw avx_pd_instruction-instruction_handler
db 'while',0
dw while_directive-instruction_handler
db 'wrmsr',30h
dw simple_extended_instruction-instruction_handler
db 'xlatb',0D7h
dw simple_instruction-instruction_handler
1251,57 → 1249,63
db 'xorpd',57h
dw sse_pd_instruction-instruction_handler
db 'xorps',57h
dw sse_ps_instruction-instruction_handler
db 'xsave',100b
dw fxsave_instruction-instruction_handler
instructions_6:
db 'aesdec',0DEh
dw sse4_instruction_38-instruction_handler
dw sse_ps_instruction-instruction_handler
db 'xsave',100b
dw fxsave_instruction-instruction_handler
db 'xtest',0D6h
dw simple_vmx_instruction-instruction_handler
instructions_6:
db 'aesdec',0DEh
dw sse4_instruction_38-instruction_handler
db 'aesenc',0DCh
dw sse4_instruction_38-instruction_handler
db 'aesimc',0DBh
dw sse4_instruction_38-instruction_handler
db 'andnpd',55h
dw sse_pd_instruction-instruction_handler
db 'andnps',55h
dw sse_ps_instruction-instruction_handler
db 'assert',0
dw assert_directive-instruction_handler
db 'cmovae',43h
dw cmov_instruction-instruction_handler
db 'cmovbe',46h
dw cmov_instruction-instruction_handler
db 'cmovge',4Dh
dw cmov_instruction-instruction_handler
db 'cmovle',4Eh
dw cmov_instruction-instruction_handler
db 'cmovna',46h
dw cmov_instruction-instruction_handler
db 'cmovnb',43h
dw cmov_instruction-instruction_handler
db 'cmovnc',43h
dw cmov_instruction-instruction_handler
db 'cmovne',45h
dw cmov_instruction-instruction_handler
db 'cmovng',4Eh
dw cmov_instruction-instruction_handler
db 'cmovnl',4Dh
dw cmov_instruction-instruction_handler
db 'cmovno',41h
dw cmov_instruction-instruction_handler
db 'cmovnp',4Bh
dw cmov_instruction-instruction_handler
db 'cmovns',49h
dw cmov_instruction-instruction_handler
db 'cmovnz',45h
dw cmov_instruction-instruction_handler
db 'cmovpe',4Ah
dw cmov_instruction-instruction_handler
db 'cmovpo',4Bh
dw cmov_instruction-instruction_handler
db 'comisd',2Fh
dw comisd_instruction-instruction_handler
db 'comiss',2Fh
dw sse_pd_instruction-instruction_handler
db 'andnps',55h
dw sse_ps_instruction-instruction_handler
db 'assert',0
dw assert_directive-instruction_handler
db 'blcmsk',21h
dw tbm_instruction-instruction_handler
db 'blsmsk',2
dw bmi_instruction-instruction_handler
db 'cmovae',43h
dw bs_instruction-instruction_handler
db 'cmovbe',46h
dw bs_instruction-instruction_handler
db 'cmovge',4Dh
dw bs_instruction-instruction_handler
db 'cmovle',4Eh
dw bs_instruction-instruction_handler
db 'cmovna',46h
dw bs_instruction-instruction_handler
db 'cmovnb',43h
dw bs_instruction-instruction_handler
db 'cmovnc',43h
dw bs_instruction-instruction_handler
db 'cmovne',45h
dw bs_instruction-instruction_handler
db 'cmovng',4Eh
dw bs_instruction-instruction_handler
db 'cmovnl',4Dh
dw bs_instruction-instruction_handler
db 'cmovno',41h
dw bs_instruction-instruction_handler
db 'cmovnp',4Bh
dw bs_instruction-instruction_handler
db 'cmovns',49h
dw bs_instruction-instruction_handler
db 'cmovnz',45h
dw bs_instruction-instruction_handler
db 'cmovpe',4Ah
dw bs_instruction-instruction_handler
db 'cmovpo',4Bh
dw bs_instruction-instruction_handler
db 'comisd',2Fh
dw comisd_instruction-instruction_handler
db 'comiss',2Fh
dw comiss_instruction-instruction_handler
db 'fcmovb',0C0h
dw fcmov_instruction-instruction_handler
1388,12 → 1392,14
db 'invept',80h
dw vmx_inv_instruction-instruction_handler
db 'invlpg',0
dw invlpg_instruction-instruction_handler
db 'lfence',0E8h
dw fence_instruction-instruction_handler
db 'looped',0E1h
dw loop_instruction_32bit-instruction_handler
db 'loopeq',0E1h
dw invlpg_instruction-instruction_handler
db 'lfence',0E8h
dw fence_instruction-instruction_handler
db 'llwpcb',0
dw llwpcb_instruction-instruction_handler
db 'looped',0E1h
dw loop_instruction_32bit-instruction_handler
db 'loopeq',0E1h
dw loop_instruction_64bit-instruction_handler
db 'loopew',0E1h
dw loop_instruction_16bit-instruction_handler
1404,12 → 1410,16
db 'loopzd',0E1h
dw loop_instruction_32bit-instruction_handler
db 'loopzq',0E1h
dw loop_instruction_64bit-instruction_handler
db 'loopzw',0E1h
dw loop_instruction_16bit-instruction_handler
db 'mfence',0F0h
dw fence_instruction-instruction_handler
db 'movapd',28h
dw loop_instruction_64bit-instruction_handler
db 'loopzw',0E1h
dw loop_instruction_16bit-instruction_handler
db 'lwpins',0
dw lwpins_instruction-instruction_handler
db 'lwpval',1
dw lwpins_instruction-instruction_handler
db 'mfence',0F0h
dw fence_instruction-instruction_handler
db 'movapd',28h
dw movpd_instruction-instruction_handler
db 'movaps',28h
dw movps_instruction-instruction_handler
1560,12 → 1570,14
db 'shufpd',0C6h
dw sse_pd_instruction_imm8-instruction_handler
db 'shufps',0C6h
dw sse_ps_instruction_imm8-instruction_handler
db 'skinit',0
dw skinit_instruction-instruction_handler
db 'sqrtpd',51h
dw sse_pd_instruction-instruction_handler
db 'sqrtps',51h
dw sse_ps_instruction_imm8-instruction_handler
db 'skinit',0
dw skinit_instruction-instruction_handler
db 'slwpcb',1
dw llwpcb_instruction-instruction_handler
db 'sqrtpd',51h
dw sse_pd_instruction-instruction_handler
db 'sqrtps',51h
dw sse_ps_instruction-instruction_handler
db 'sqrtsd',51h
dw sse_sd_instruction-instruction_handler
1572,12 → 1584,14
db 'sqrtss',51h
dw sse_ss_instruction-instruction_handler
db 'swapgs',0
dw swapgs_instruction-instruction_handler
db 'sysret',07h
dw simple_extended_instruction-instruction_handler
db 'vaddpd',58h
dw avx_pd_instruction-instruction_handler
db 'vaddps',58h
dw swapgs_instruction-instruction_handler
db 'sysret',07h
dw simple_extended_instruction-instruction_handler
db 't1mskc',17h
dw tbm_instruction-instruction_handler
db 'vaddpd',58h
dw avx_pd_instruction-instruction_handler
db 'vaddps',58h
dw avx_ps_instruction-instruction_handler
db 'vaddsd',58h
dw avx_sd_instruction-instruction_handler
1641,41 → 1655,45
dw avx_sd_instruction-instruction_handler
db 'vmulss',59h
dw avx_ss_instruction-instruction_handler
db 'vmxoff',0C4h
dw simple_vmx_instruction-instruction_handler
db 'vpabsb',1Ch
dw avx_single_source_128bit_instruction_38-instruction_handler
db 'vpabsd',1Eh
dw avx_single_source_128bit_instruction_38-instruction_handler
db 'vpabsw',1Dh
dw avx_single_source_128bit_instruction_38-instruction_handler
db 'vpaddb',0FCh
dw avx_128bit_instruction-instruction_handler
db 'vpaddd',0FEh
dw avx_128bit_instruction-instruction_handler
db 'vpaddq',0D4h
dw avx_128bit_instruction-instruction_handler
db 'vpaddw',0FDh
dw avx_128bit_instruction-instruction_handler
db 'vpandn',0DFh
dw avx_128bit_instruction-instruction_handler
db 'vpavgb',0E0h
dw avx_128bit_instruction-instruction_handler
db 'vpavgw',0E3h
dw avx_128bit_instruction-instruction_handler
db 'vpcmov',0A2h
dw vpcmov_instruction-instruction_handler
db 'vpcomb',-1
db 'vmxoff',0C4h
dw simple_vmx_instruction-instruction_handler
db 'vpabsb',1Ch
dw avx_single_source_instruction_38-instruction_handler
db 'vpabsd',1Eh
dw avx_single_source_instruction_38-instruction_handler
db 'vpabsw',1Dh
dw avx_single_source_instruction_38-instruction_handler
db 'vpaddb',0FCh
dw avx_pd_instruction-instruction_handler
db 'vpaddd',0FEh
dw avx_pd_instruction-instruction_handler
db 'vpaddq',0D4h
dw avx_pd_instruction-instruction_handler
db 'vpaddw',0FDh
dw avx_pd_instruction-instruction_handler
db 'vpandn',0DFh
dw avx_pd_instruction-instruction_handler
db 'vpavgb',0E0h
dw avx_pd_instruction-instruction_handler
db 'vpavgw',0E3h
dw avx_pd_instruction-instruction_handler
db 'vpcmov',0A2h
dw vpcmov_instruction-instruction_handler
db 'vpcomb',-1
dw xop_pcom_b_instruction-instruction_handler
db 'vpcomd',-1
dw xop_pcom_d_instruction-instruction_handler
db 'vpcomq',-1
dw xop_pcom_q_instruction-instruction_handler
db 'vpcomw',-1
dw xop_pcom_w_instruction-instruction_handler
db 'vpperm',0A3h
dw xop_128bit_instruction-instruction_handler
db 'vprotb',90h
dw xop_pcom_q_instruction-instruction_handler
db 'vpcomw',-1
dw xop_pcom_w_instruction-instruction_handler
db 'vpermd',36h
dw avx_permd_instruction-instruction_handler
db 'vpermq',0
dw avx_permq_instruction-instruction_handler
db 'vpperm',0A3h
dw xop_128bit_instruction-instruction_handler
db 'vprotb',90h
dw xop_shift_instruction-instruction_handler
db 'vprotd',92h
dw xop_shift_instruction-instruction_handler
1713,19 → 1731,19
dw avx_bit_shift_instruction-instruction_handler
db 'vpsrlq',0D3h
dw avx_bit_shift_instruction-instruction_handler
db 'vpsrlw',0D1h
dw avx_bit_shift_instruction-instruction_handler
db 'vpsubb',0F8h
dw avx_128bit_instruction-instruction_handler
db 'vpsubd',0FAh
dw avx_128bit_instruction-instruction_handler
db 'vpsubq',0FBh
dw avx_128bit_instruction-instruction_handler
db 'vpsubw',0F9h
dw avx_128bit_instruction-instruction_handler
db 'vptest',17h
dw avx_single_source_instruction_38-instruction_handler
db 'vrcpps',53h
db 'vpsrlw',0D1h
dw avx_bit_shift_instruction-instruction_handler
db 'vpsubb',0F8h
dw avx_pd_instruction-instruction_handler
db 'vpsubd',0FAh
dw avx_pd_instruction-instruction_handler
db 'vpsubq',0FBh
dw avx_pd_instruction-instruction_handler
db 'vpsubw',0F9h
dw avx_pd_instruction-instruction_handler
db 'vptest',17h
dw avx_single_source_instruction_38-instruction_handler
db 'vrcpps',53h
dw avx_single_source_ps_instruction-instruction_handler
db 'vrcpss',53h
dw avx_ss_instruction-instruction_handler
1742,33 → 1760,41
db 'vxorps',57h
dw avx_ps_instruction-instruction_handler
db 'wbinvd',9
dw simple_extended_instruction-instruction_handler
db 'wrmsrq',30h
dw simple_extended_instruction_64bit-instruction_handler
db 'xgetbv',0D0h
dw simple_vmx_instruction-instruction_handler
db 'xrstor',101b
dw simple_extended_instruction-instruction_handler
db 'wrmsrq',30h
dw simple_extended_instruction_64bit-instruction_handler
db 'xabort',0
dw xabort_instruction-instruction_handler
db 'xbegin',0
dw xbegin_instruction-instruction_handler
db 'xgetbv',0D0h
dw simple_vmx_instruction-instruction_handler
db 'xrstor',101b
dw fxsave_instruction-instruction_handler
db 'xsetbv',0D1h
dw simple_vmx_instruction-instruction_handler
instructions_7:
db 'blendpd',0Dh
dw sse4_instruction_3a_imm8-instruction_handler
db 'blendps',0Ch
dw sse4_instruction_3a_imm8-instruction_handler
db 'clflush',111b
dw fxsave_instruction-instruction_handler
db 'cmovnae',42h
dw cmov_instruction-instruction_handler
db 'cmovnbe',47h
dw cmov_instruction-instruction_handler
db 'cmovnge',4Ch
dw cmov_instruction-instruction_handler
db 'cmovnle',4Fh
dw cmov_instruction-instruction_handler
db 'cmpeqpd',0
dw cmp_pd_instruction-instruction_handler
db 'cmpeqps',0
db 'xsetbv',0D1h
dw simple_vmx_instruction-instruction_handler
instructions_7:
db 'blcfill',11h
dw tbm_instruction-instruction_handler
db 'blendpd',0Dh
dw sse4_instruction_3a_imm8-instruction_handler
db 'blendps',0Ch
dw sse4_instruction_3a_imm8-instruction_handler
db 'blsfill',12h
dw tbm_instruction-instruction_handler
db 'clflush',111b
dw fxsave_instruction-instruction_handler
db 'cmovnae',42h
dw bs_instruction-instruction_handler
db 'cmovnbe',47h
dw bs_instruction-instruction_handler
db 'cmovnge',4Ch
dw bs_instruction-instruction_handler
db 'cmovnle',4Fh
dw bs_instruction-instruction_handler
db 'cmpeqpd',0
dw cmp_pd_instruction-instruction_handler
db 'cmpeqps',0
dw cmp_ps_instruction-instruction_handler
db 'cmpeqsd',0
dw cmp_sd_instruction-instruction_handler
1839,12 → 1865,14
db 'fyl2xp1',111001b
dw simple_fpu_instruction-instruction_handler
db 'insertq',0
dw insertq_instruction-instruction_handler
db 'invlpga',0DFh
dw invlpga_instruction-instruction_handler
db 'invvpid',81h
dw vmx_inv_instruction-instruction_handler
db 'ldmxcsr',10b
dw insertq_instruction-instruction_handler
db 'invlpga',0DFh
dw invlpga_instruction-instruction_handler
db 'invpcid',82h
dw vmx_inv_instruction-instruction_handler
db 'invvpid',81h
dw vmx_inv_instruction-instruction_handler
db 'ldmxcsr',10b
dw fxsave_instruction-instruction_handler
db 'loopned',0E0h
dw loop_instruction_32bit-instruction_handler
2026,99 → 2054,113
dw vmx_instruction-instruction_handler
db 'vmptrst',7
dw vmx_instruction-instruction_handler
db 'vmwrite',0
dw vmwrite_instruction-instruction_handler
db 'vpaddsb',0ECh
dw avx_128bit_instruction-instruction_handler
db 'vpaddsw',0EDh
dw avx_128bit_instruction-instruction_handler
db 'vpcomub',-1
dw xop_pcom_ub_instruction-instruction_handler
db 'vpcomud',-1
db 'vmwrite',0
dw vmwrite_instruction-instruction_handler
db 'vpaddsb',0ECh
dw avx_pd_instruction-instruction_handler
db 'vpaddsw',0EDh
dw avx_pd_instruction-instruction_handler
db 'vpcomub',-1
dw xop_pcom_ub_instruction-instruction_handler
db 'vpcomud',-1
dw xop_pcom_ud_instruction-instruction_handler
db 'vpcomuq',-1
dw xop_pcom_uq_instruction-instruction_handler
db 'vpcomuw',-1
dw xop_pcom_uw_instruction-instruction_handler
db 'vpextrb',14h
dw avx_pextrb_instruction-instruction_handler
db 'vpextrd',16h
dw xop_pcom_uq_instruction-instruction_handler
db 'vpcomuw',-1
dw xop_pcom_uw_instruction-instruction_handler
db 'vpermpd',1
dw avx_permq_instruction-instruction_handler
db 'vpermps',16h
dw avx_permd_instruction-instruction_handler
db 'vpextrb',14h
dw avx_pextrb_instruction-instruction_handler
db 'vpextrd',16h
dw avx_pextrd_instruction-instruction_handler
db 'vpextrq',16h
dw avx_pextrq_instruction-instruction_handler
db 'vpextrw',15h
dw avx_pextrw_instruction-instruction_handler
db 'vphaddd',2
dw avx_128bit_instruction_38-instruction_handler
db 'vphaddw',1
dw avx_128bit_instruction_38-instruction_handler
db 'vphsubd',6
dw avx_128bit_instruction_38-instruction_handler
db 'vphsubw',5
dw avx_128bit_instruction_38-instruction_handler
db 'vpinsrb',20h
dw avx_pinsrb_instruction-instruction_handler
db 'vpinsrd',22h
db 'vpextrw',15h
dw avx_pextrw_instruction-instruction_handler
db 'vphaddd',2
dw avx_instruction_38-instruction_handler
db 'vphaddw',1
dw avx_instruction_38-instruction_handler
db 'vphsubd',6
dw avx_instruction_38-instruction_handler
db 'vphsubw',5
dw avx_instruction_38-instruction_handler
db 'vpinsrb',20h
dw avx_pinsrb_instruction-instruction_handler
db 'vpinsrd',22h
dw avx_pinsrd_instruction-instruction_handler
db 'vpinsrq',22h
dw avx_pinsrq_instruction-instruction_handler
db 'vpinsrw',0C4h
dw avx_pinsrw_instruction-instruction_handler
db 'vpmaxsb',3Ch
dw avx_128bit_instruction_38-instruction_handler
db 'vpmaxsd',3Dh
dw avx_128bit_instruction_38-instruction_handler
db 'vpmaxsw',0EEh
dw avx_128bit_instruction-instruction_handler
db 'vpmaxub',0DEh
dw avx_128bit_instruction-instruction_handler
db 'vpmaxud',3Fh
dw avx_128bit_instruction_38-instruction_handler
db 'vpmaxuw',3Eh
dw avx_128bit_instruction_38-instruction_handler
db 'vpminsb',38h
dw avx_128bit_instruction_38-instruction_handler
db 'vpminsd',39h
dw avx_128bit_instruction_38-instruction_handler
db 'vpminsw',0EAh
dw avx_128bit_instruction-instruction_handler
db 'vpminub',0DAh
dw avx_128bit_instruction-instruction_handler
db 'vpminud',3Bh
dw avx_128bit_instruction_38-instruction_handler
db 'vpminuw',3Ah
dw avx_128bit_instruction_38-instruction_handler
db 'vpmuldq',28h
dw avx_128bit_instruction_38-instruction_handler
db 'vpmulhw',0E5h
dw avx_128bit_instruction-instruction_handler
db 'vpmulld',40h
dw avx_128bit_instruction_38-instruction_handler
db 'vpmullw',0D5h
dw avx_128bit_instruction-instruction_handler
db 'vpsadbw',0F6h
dw avx_128bit_instruction-instruction_handler
db 'vpshufb',0
dw avx_128bit_instruction_38-instruction_handler
db 'vpshufd',66h
dw avx_pshufd_instruction-instruction_handler
db 'vpsignb',8
dw avx_128bit_instruction_38-instruction_handler
db 'vpsignd',0Ah
dw avx_128bit_instruction_38-instruction_handler
db 'vpsignw',9
dw avx_128bit_instruction_38-instruction_handler
db 'vpslldq',111b
dw avx_pslldq_instruction-instruction_handler
db 'vpsrldq',011b
dw avx_pslldq_instruction-instruction_handler
db 'vpsubsb',0E8h
dw avx_128bit_instruction-instruction_handler
db 'vpsubsw',0E9h
dw avx_128bit_instruction-instruction_handler
db 'vshufpd',0C6h
dw avx_pd_instruction_imm8-instruction_handler
db 'vshufps',0C6h
db 'vpinsrw',0C4h
dw avx_pinsrw_instruction-instruction_handler
db 'vpmaxsb',3Ch
dw avx_instruction_38-instruction_handler
db 'vpmaxsd',3Dh
dw avx_instruction_38-instruction_handler
db 'vpmaxsw',0EEh
dw avx_pd_instruction-instruction_handler
db 'vpmaxub',0DEh
dw avx_pd_instruction-instruction_handler
db 'vpmaxud',3Fh
dw avx_instruction_38-instruction_handler
db 'vpmaxuw',3Eh
dw avx_instruction_38-instruction_handler
db 'vpminsb',38h
dw avx_instruction_38-instruction_handler
db 'vpminsd',39h
dw avx_instruction_38-instruction_handler
db 'vpminsw',0EAh
dw avx_pd_instruction-instruction_handler
db 'vpminub',0DAh
dw avx_pd_instruction-instruction_handler
db 'vpminud',3Bh
dw avx_instruction_38-instruction_handler
db 'vpminuw',3Ah
dw avx_instruction_38-instruction_handler
db 'vpmuldq',28h
dw avx_instruction_38-instruction_handler
db 'vpmulhw',0E5h
dw avx_pd_instruction-instruction_handler
db 'vpmulld',40h
dw avx_instruction_38-instruction_handler
db 'vpmullw',0D5h
dw avx_pd_instruction-instruction_handler
db 'vpsadbw',0F6h
dw avx_pd_instruction-instruction_handler
db 'vpshufb',0
dw avx_instruction_38-instruction_handler
db 'vpshufd',66h
dw avx_pshufd_instruction-instruction_handler
db 'vpsignb',8
dw avx_instruction_38-instruction_handler
db 'vpsignd',0Ah
dw avx_instruction_38-instruction_handler
db 'vpsignw',9
dw avx_instruction_38-instruction_handler
db 'vpslldq',111b
dw avx_pslldq_instruction-instruction_handler
db 'vpsllvd',47h
dw avx_instruction_38-instruction_handler
db 'vpsllvq',47h
dw avx_instruction_38_w1-instruction_handler
db 'vpsravd',46h
dw avx_instruction_38-instruction_handler
db 'vpsrldq',011b
dw avx_pslldq_instruction-instruction_handler
db 'vpsrlvd',45h
dw avx_instruction_38-instruction_handler
db 'vpsrlvq',45h
dw avx_instruction_38_w1-instruction_handler
db 'vpsubsb',0E8h
dw avx_pd_instruction-instruction_handler
db 'vpsubsw',0E9h
dw avx_pd_instruction-instruction_handler
db 'vshufpd',0C6h
dw avx_pd_instruction_imm8-instruction_handler
db 'vshufps',0C6h
dw avx_ps_instruction_imm8-instruction_handler
db 'vsqrtpd',51h
dw avx_single_source_pd_instruction-instruction_handler
2210,21 → 2252,23
db 'fcmovnbe',0D0h
dw fcomi_instruction-instruction_handler
db 'fnstenvd',6
dw fldenv_instruction_32bit-instruction_handler
db 'fnstenvw',6
dw fldenv_instruction_16bit-instruction_handler
db 'insertps',0
dw insertps_instruction-instruction_handler
db 'maskmovq',0
dw fldenv_instruction_32bit-instruction_handler
db 'fnstenvw',6
dw fldenv_instruction_16bit-instruction_handler
db 'fxsave64',0
dw fxsave_instruction_64bit-instruction_handler
db 'insertps',0
dw insertps_instruction-instruction_handler
db 'maskmovq',0
dw maskmovq_instruction-instruction_handler
db 'movmskpd',0
dw movmskpd_instruction-instruction_handler
db 'movmskps',0
dw movmskps_instruction-instruction_handler
db 'movntdqa',0
dw movntdqa_instruction-instruction_handler
db 'movshdup',16h
dw movshdup_instruction-instruction_handler
dw movmskpd_instruction-instruction_handler
db 'movmskps',0
dw movmskps_instruction-instruction_handler
db 'movntdqa',2Ah
dw movntdqa_instruction-instruction_handler
db 'movshdup',16h
dw movshdup_instruction-instruction_handler
db 'movsldup',12h
dw movshdup_instruction-instruction_handler
db 'packssdw',6Bh
2363,39 → 2407,41
dw avx_movntpd_instruction-instruction_handler
db 'vmovntpd',2Bh
dw avx_movntpd_instruction-instruction_handler
db 'vmovntps',2Bh
dw avx_movntps_instruction-instruction_handler
db 'vmpsadbw',42h
dw avx_128bit_instruction_3a_imm8-instruction_handler
db 'vmresume',0C3h
dw simple_vmx_instruction-instruction_handler
db 'vpaddusb',0DCh
dw avx_128bit_instruction-instruction_handler
db 'vpaddusw',0DDh
dw avx_128bit_instruction-instruction_handler
db 'vpalignr',0Fh
dw avx_128bit_instruction_3a_imm8-instruction_handler
db 'vpblendw',0Eh
dw avx_128bit_instruction_3a_imm8-instruction_handler
db 'vpcmpeqb',74h
dw avx_128bit_instruction-instruction_handler
db 'vpcmpeqd',76h
dw avx_128bit_instruction-instruction_handler
db 'vpcmpeqq',29h
dw avx_128bit_instruction_38-instruction_handler
db 'vpcmpeqw',75h
dw avx_128bit_instruction-instruction_handler
db 'vpcmpgtb',64h
dw avx_128bit_instruction-instruction_handler
db 'vpcmpgtd',66h
dw avx_128bit_instruction-instruction_handler
db 'vpcmpgtq',37h
dw avx_128bit_instruction_38-instruction_handler
db 'vpcmpgtw',65h
dw avx_128bit_instruction-instruction_handler
db 'vpcomeqb',4
dw xop_pcom_b_instruction-instruction_handler
db 'vpcomeqd',4
db 'vmovntps',2Bh
dw avx_movntps_instruction-instruction_handler
db 'vmpsadbw',42h
dw avx_instruction_3a_imm8-instruction_handler
db 'vmresume',0C3h
dw simple_vmx_instruction-instruction_handler
db 'vpaddusb',0DCh
dw avx_pd_instruction-instruction_handler
db 'vpaddusw',0DDh
dw avx_pd_instruction-instruction_handler
db 'vpalignr',0Fh
dw avx_instruction_3a_imm8-instruction_handler
db 'vpblendd',2
dw avx_instruction_3a_imm8-instruction_handler
db 'vpblendw',0Eh
dw avx_instruction_3a_imm8-instruction_handler
db 'vpcmpeqb',74h
dw avx_pd_instruction-instruction_handler
db 'vpcmpeqd',76h
dw avx_pd_instruction-instruction_handler
db 'vpcmpeqq',29h
dw avx_instruction_38-instruction_handler
db 'vpcmpeqw',75h
dw avx_pd_instruction-instruction_handler
db 'vpcmpgtb',64h
dw avx_pd_instruction-instruction_handler
db 'vpcmpgtd',66h
dw avx_pd_instruction-instruction_handler
db 'vpcmpgtq',37h
dw avx_instruction_38-instruction_handler
db 'vpcmpgtw',65h
dw avx_pd_instruction-instruction_handler
db 'vpcomeqb',4
dw xop_pcom_b_instruction-instruction_handler
db 'vpcomeqd',4
dw xop_pcom_d_instruction-instruction_handler
db 'vpcomeqq',4
dw xop_pcom_q_instruction-instruction_handler
2439,46 → 2485,46
dw xop_single_source_128bit_instruction-instruction_handler
db 'vphaddbw',0C1h
dw xop_single_source_128bit_instruction-instruction_handler
db 'vphadddq',0CBh
db 'vphadddq',0CBh
dw xop_single_source_128bit_instruction-instruction_handler
db 'vphaddsw',3
dw avx_instruction_38-instruction_handler
db 'vphaddwd',0C6h
dw xop_single_source_128bit_instruction-instruction_handler
db 'vphaddwq',0C7h
dw xop_single_source_128bit_instruction-instruction_handler
db 'vphaddsw',3
dw avx_128bit_instruction_38-instruction_handler
db 'vphaddwd',0C6h
dw xop_single_source_128bit_instruction-instruction_handler
db 'vphaddwq',0C7h
dw xop_single_source_128bit_instruction-instruction_handler
db 'vphsubbw',0E1h
dw xop_single_source_128bit_instruction-instruction_handler
db 'vphsubdq',0E3h
dw xop_single_source_128bit_instruction-instruction_handler
db 'vphsubsw',7
dw avx_128bit_instruction_38-instruction_handler
db 'vphsubwd',0E2h
dw xop_single_source_128bit_instruction-instruction_handler
db 'vpmacsdd',9Eh
db 'vphsubdq',0E3h
dw xop_single_source_128bit_instruction-instruction_handler
db 'vphsubsw',7
dw avx_instruction_38-instruction_handler
db 'vphsubwd',0E2h
dw xop_single_source_128bit_instruction-instruction_handler
db 'vpmacsdd',9Eh
dw xop_triple_source_128bit_instruction-instruction_handler
db 'vpmacswd',96h
dw xop_triple_source_128bit_instruction-instruction_handler
db 'vpmacsww',95h
dw xop_triple_source_128bit_instruction-instruction_handler
db 'vpmaddwd',0F5h
dw avx_128bit_instruction-instruction_handler
db 'vpmulhuw',0E4h
dw avx_128bit_instruction-instruction_handler
db 'vpmuludq',0F4h
dw avx_128bit_instruction-instruction_handler
db 'vpshufhw',0F3h
dw avx_pshufd_instruction-instruction_handler
db 'vpshuflw',0F2h
dw avx_pshufd_instruction-instruction_handler
db 'vpsubusb',0D8h
dw avx_128bit_instruction-instruction_handler
db 'vpsubusw',0D9h
dw avx_128bit_instruction-instruction_handler
db 'vroundpd',9
db 'vpmacsww',95h
dw xop_triple_source_128bit_instruction-instruction_handler
db 'vpmaddwd',0F5h
dw avx_pd_instruction-instruction_handler
db 'vpmulhuw',0E4h
dw avx_pd_instruction-instruction_handler
db 'vpmuludq',0F4h
dw avx_pd_instruction-instruction_handler
db 'vpshufhw',0F3h
dw avx_pshufd_instruction-instruction_handler
db 'vpshuflw',0F2h
dw avx_pshufd_instruction-instruction_handler
db 'vpsubusb',0D8h
dw avx_pd_instruction-instruction_handler
db 'vpsubusw',0D9h
dw avx_pd_instruction-instruction_handler
db 'vroundpd',9
dw avx_single_source_instruction_3a_imm8-instruction_handler
db 'vroundps',8
dw avx_single_source_instruction_3a_imm8-instruction_handler
db 'vroundps',8
dw avx_single_source_instruction_3a_imm8-instruction_handler
db 'vroundsd',0Bh
dw avx_sd_instruction_3a_imm8-instruction_handler
db 'vroundss',0Ah
2496,12 → 2542,16
db 'vzeroall',77h
dw vzeroall_instruction-instruction_handler
db 'wrfsbase',2
dw rdfsbase_instruction-instruction_handler
db 'wrgsbase',3
dw rdfsbase_instruction-instruction_handler
db 'xrstor64',101b
dw fxsave_instruction_64bit-instruction_handler
db 'xsaveopt',110b
dw rdfsbase_instruction-instruction_handler
db 'wrgsbase',3
dw rdfsbase_instruction-instruction_handler
db 'xacquire',0F2h
dw prefix_instruction-instruction_handler
db 'xrelease',0F3h
dw prefix_instruction-instruction_handler
db 'xrstor64',101b
dw fxsave_instruction_64bit-instruction_handler
db 'xsaveopt',110b
dw fxsave_instruction-instruction_handler
instructions_9:
db 'cmpxchg8b',8
2517,12 → 2567,14
db 'cvttsd2si',2Ch
dw cvtsd2si_instruction-instruction_handler
db 'cvttss2si',2Ch
dw cvtss2si_instruction-instruction_handler
db 'extractps',0
dw extractps_instruction-instruction_handler
db 'pclmulqdq',-1
dw pclmulqdq_instruction-instruction_handler
db 'pcmpestri',61h
dw cvtss2si_instruction-instruction_handler
db 'extractps',0
dw extractps_instruction-instruction_handler
db 'fxrstor64',1
dw fxsave_instruction_64bit-instruction_handler
db 'pclmulqdq',-1
dw pclmulqdq_instruction-instruction_handler
db 'pcmpestri',61h
dw sse4_instruction_3a_imm8-instruction_handler
db 'pcmpestrm',60h
dw sse4_instruction_3a_imm8-instruction_handler
2649,28 → 2701,28
db 'vinsertps',0
dw avx_insertps_instruction-instruction_handler
db 'vmovmskpd',0
dw avx_movmskpd_instruction-instruction_handler
db 'vmovmskps',0
dw avx_movmskps_instruction-instruction_handler
db 'vmovntdqa',0
dw avx_movntdqa_instruction-instruction_handler
db 'vmovshdup',16h
dw avx_movshdup_instruction-instruction_handler
db 'vmovsldup',12h
dw avx_movshdup_instruction-instruction_handler
db 'vpackssdw',6Bh
dw avx_128bit_instruction-instruction_handler
db 'vpacksswb',63h
dw avx_128bit_instruction-instruction_handler
db 'vpackusdw',2Bh
dw avx_128bit_instruction_38-instruction_handler
db 'vpackuswb',67h
dw avx_128bit_instruction-instruction_handler
db 'vpblendvb',4Ch
dw avx_triple_source_128bit_instruction_3a-instruction_handler
db 'vpcomequb',4
dw xop_pcom_ub_instruction-instruction_handler
db 'vpcomequd',4
dw avx_movmskpd_instruction-instruction_handler
db 'vmovmskps',0
dw avx_movmskps_instruction-instruction_handler
db 'vmovntdqa',2Ah
dw avx_movntdqa_instruction-instruction_handler
db 'vmovshdup',16h
dw avx_movshdup_instruction-instruction_handler
db 'vmovsldup',12h
dw avx_movshdup_instruction-instruction_handler
db 'vpackssdw',6Bh
dw avx_pd_instruction-instruction_handler
db 'vpacksswb',63h
dw avx_pd_instruction-instruction_handler
db 'vpackusdw',2Bh
dw avx_instruction_38-instruction_handler
db 'vpackuswb',67h
dw avx_pd_instruction-instruction_handler
db 'vpblendvb',4Ch
dw avx_triple_source_instruction_3a-instruction_handler
db 'vpcomequb',4
dw xop_pcom_ub_instruction-instruction_handler
db 'vpcomequd',4
dw xop_pcom_ud_instruction-instruction_handler
db 'vpcomequq',4
dw xop_pcom_uq_instruction-instruction_handler
2768,21 → 2820,21
dw avx_pmovsxdq_instruction-instruction_handler
db 'vpmovzxwd',33h
dw avx_pmovsxwd_instruction-instruction_handler
db 'vpmovzxwq',34h
dw avx_pmovsxwq_instruction-instruction_handler
db 'vpmulhrsw',0Bh
dw avx_128bit_instruction_38-instruction_handler
db 'vunpckhpd',15h
dw avx_pd_instruction-instruction_handler
db 'vunpckhps',15h
dw avx_instruction-instruction_handler
db 'vunpcklpd',14h
dw avx_pd_instruction-instruction_handler
db 'vunpcklps',14h
dw avx_instruction-instruction_handler
instructions_10:
db 'aesdeclast',0DFh
dw sse4_instruction_38-instruction_handler
db 'vpmovzxwq',34h
dw avx_pmovsxwq_instruction-instruction_handler
db 'vpmulhrsw',0Bh
dw avx_instruction_38-instruction_handler
db 'vunpckhpd',15h
dw avx_pd_instruction-instruction_handler
db 'vunpckhps',15h
dw avx_ps_instruction-instruction_handler
db 'vunpcklpd',14h
dw avx_pd_instruction-instruction_handler
db 'vunpcklps',14h
dw avx_ps_instruction-instruction_handler
instructions_10:
db 'aesdeclast',0DFh
dw sse4_instruction_38-instruction_handler
db 'aesenclast',0DDh
dw sse4_instruction_38-instruction_handler
db 'cmpunordpd',3
2828,13 → 2880,21
db 'vcvttsd2si',2Ch
dw avx_cvtsd2si_instruction-instruction_handler
db 'vcvttss2si',2Ch
dw avx_cvtss2si_instruction-instruction_handler
db 'vextractps',0
dw avx_extractps_instruction-instruction_handler
db 'vmaskmovpd',2Dh
dw avx_cvtss2si_instruction-instruction_handler
db 'vextractps',0
dw avx_extractps_instruction-instruction_handler
db 'vgatherdpd',92h
dw gather_instruction_pd-instruction_handler
db 'vgatherdps',92h
dw gather_instruction_ps-instruction_handler
db 'vgatherqpd',93h
dw gather_instruction_pd-instruction_handler
db 'vgatherqps',93h
dw gather_instruction_ps-instruction_handler
db 'vmaskmovpd',2Dh
dw avx_maskmov_instruction-instruction_handler
db 'vmaskmovps',2Ch
dw avx_maskmov_instruction-instruction_handler
db 'vmaskmovps',2Ch
dw avx_maskmov_instruction-instruction_handler
db 'vpclmulqdq',-1
dw avx_pclmulqdq_instruction-instruction_handler
db 'vpcmpestri',61h
2860,36 → 2920,50
db 'vpcomtrueq',7
dw xop_pcom_q_instruction-instruction_handler
db 'vpcomtruew',7
dw xop_pcom_w_instruction-instruction_handler
db 'vperm2f128',6
dw avx_perm2f128_instruction-instruction_handler
db 'vpermil2pd',49h
dw vpermil2_instruction-instruction_handler
db 'vpermil2ps',48h
dw vpermil2_instruction-instruction_handler
db 'vpmacssdqh',8Fh
dw xop_pcom_w_instruction-instruction_handler
db 'vperm2f128',6
dw avx_perm2f128_instruction-instruction_handler
db 'vperm2i128',46h
dw avx_perm2f128_instruction-instruction_handler
db 'vpermil2pd',49h
dw vpermil2_instruction-instruction_handler
db 'vpermil2ps',48h
dw vpermil2_instruction-instruction_handler
db 'vpgatherdd',90h
dw gather_instruction_ps-instruction_handler
db 'vpgatherdq',90h
dw gather_instruction_pd-instruction_handler
db 'vpgatherqd',91h
dw gather_instruction_ps-instruction_handler
db 'vpgatherqq',91h
dw gather_instruction_pd-instruction_handler
db 'vpmacssdqh',8Fh
dw xop_triple_source_128bit_instruction-instruction_handler
db 'vpmacssdql',87h
dw xop_triple_source_128bit_instruction-instruction_handler
db 'vpmacssdql',87h
dw xop_triple_source_128bit_instruction-instruction_handler
db 'vpmadcsswd',0A6h
dw xop_triple_source_128bit_instruction-instruction_handler
db 'vpmaddubsw',4
dw avx_128bit_instruction_38-instruction_handler
db 'vpunpckhbw',68h
dw avx_128bit_instruction-instruction_handler
db 'vpunpckhdq',6Ah
dw avx_128bit_instruction-instruction_handler
db 'vpunpckhwd',69h
dw avx_128bit_instruction-instruction_handler
db 'vpunpcklbw',60h
dw avx_128bit_instruction-instruction_handler
db 'vpunpckldq',62h
dw avx_128bit_instruction-instruction_handler
db 'vpunpcklwd',61h
dw avx_128bit_instruction-instruction_handler
db 'vzeroupper',77h
dw vzeroupper_instruction-instruction_handler
db 'xsaveopt64',110b
db 'vpmadcsswd',0A6h
dw xop_triple_source_128bit_instruction-instruction_handler
db 'vpmaddubsw',4
dw avx_instruction_38-instruction_handler
db 'vpmaskmovd',8Ch
dw avx_maskmov_instruction-instruction_handler
db 'vpmaskmovq',8Ch
dw avx_maskmov_w1_instruction-instruction_handler
db 'vpunpckhbw',68h
dw avx_pd_instruction-instruction_handler
db 'vpunpckhdq',6Ah
dw avx_pd_instruction-instruction_handler
db 'vpunpckhwd',69h
dw avx_pd_instruction-instruction_handler
db 'vpunpcklbw',60h
dw avx_pd_instruction-instruction_handler
db 'vpunpckldq',62h
dw avx_pd_instruction-instruction_handler
db 'vpunpcklwd',61h
dw avx_pd_instruction-instruction_handler
db 'vzeroupper',77h
dw vzeroupper_instruction-instruction_handler
db 'xsaveopt64',110b
dw fxsave_instruction_64bit-instruction_handler
instructions_11:
db 'pclmulhqhdq',10001b
3037,12 → 3111,14
db 'vfmsubaddpd',5Fh
dw fma4_instruction_p-instruction_handler
db 'vfmsubaddps',5Eh
dw fma4_instruction_p-instruction_handler
db 'vinsertf128',18h
dw avx_insertf128_instruction-instruction_handler
db 'vmaskmovdqu',0
dw avx_maskmovdqu_instruction-instruction_handler
db 'vpcomfalseb',6
dw fma4_instruction_p-instruction_handler
db 'vinsertf128',18h
dw avx_insertf128_instruction-instruction_handler
db 'vinserti128',38h
dw avx_insertf128_instruction-instruction_handler
db 'vmaskmovdqu',0
dw avx_maskmovdqu_instruction-instruction_handler
db 'vpcomfalseb',6
dw xop_pcom_b_instruction-instruction_handler
db 'vpcomfalsed',6
dw xop_pcom_d_instruction-instruction_handler
3056,25 → 3132,29
dw xop_pcom_ud_instruction-instruction_handler
db 'vpcomtrueuq',7
dw xop_pcom_uq_instruction-instruction_handler
db 'vpcomtrueuw',7
dw xop_pcom_uw_instruction-instruction_handler
db 'vphminposuw',41h
dw avx_single_source_128bit_instruction_38-instruction_handler
db 'vpunpckhqdq',6Dh
dw avx_128bit_instruction-instruction_handler
db 'vpunpcklqdq',6Ch
dw avx_128bit_instruction-instruction_handler
instructions_12:
db 'pclmulhqlqdq',1
dw pclmulqdq_instruction-instruction_handler
db 'pclmullqlqdq',0
dw pclmulqdq_instruction-instruction_handler
db 'vbroadcastsd',0
dw avx_broadcastsd_instruction-instruction_handler
db 'vbroadcastss',0
dw avx_broadcastss_instruction-instruction_handler
db 'vcmpneq_oqpd',0Ch
dw avx_cmp_pd_instruction-instruction_handler
db 'vpcomtrueuw',7
dw xop_pcom_uw_instruction-instruction_handler
db 'vphminposuw',41h
dw avx_single_source_instruction_38-instruction_handler
db 'vpunpckhqdq',6Dh
dw avx_pd_instruction-instruction_handler
db 'vpunpcklqdq',6Ch
dw avx_pd_instruction-instruction_handler
instructions_12:
db 'pclmulhqhqdq',10001b
dw pclmulqdq_instruction-instruction_handler
db 'pclmulhqlqdq',1
dw pclmulqdq_instruction-instruction_handler
db 'pclmullqhqdq',10000b
dw pclmulqdq_instruction-instruction_handler
db 'pclmullqlqdq',0
dw pclmulqdq_instruction-instruction_handler
db 'vbroadcastsd',19h
dw avx_broadcastsd_instruction-instruction_handler
db 'vbroadcastss',18h
dw avx_broadcastss_instruction-instruction_handler
db 'vcmpneq_oqpd',0Ch
dw avx_cmp_pd_instruction-instruction_handler
db 'vcmpneq_oqps',0Ch
dw avx_cmp_ps_instruction-instruction_handler
db 'vcmpneq_oqsd',0Ch
3128,12 → 3208,14
db 'vcmpnlt_uqsd',15h
dw avx_cmp_sd_instruction-instruction_handler
db 'vcmpnlt_uqss',15h
dw avx_cmp_ss_instruction-instruction_handler
db 'vextractf128',19h
dw avx_extractf128_instruction-instruction_handler
db 'vfnmadd132pd',9Ch
dw fma_instruction_pd-instruction_handler
db 'vfnmadd132ps',9Ch
dw avx_cmp_ss_instruction-instruction_handler
db 'vextractf128',19h
dw avx_extractf128_instruction-instruction_handler
db 'vextracti128',39h
dw avx_extractf128_instruction-instruction_handler
db 'vfnmadd132pd',9Ch
dw fma_instruction_pd-instruction_handler
db 'vfnmadd132ps',9Ch
dw fma_instruction_ps-instruction_handler
db 'vfnmadd132sd',9Dh
dw fma_instruction_sd-instruction_handler
3176,13 → 3258,21
db 'vfnmsub231ps',0BEh
dw fma_instruction_ps-instruction_handler
db 'vfnmsub231sd',0BFh
dw fma_instruction_sd-instruction_handler
db 'vfnmsub231ss',0BFh
dw fma_instruction_ss-instruction_handler
db 'vpclmulhqhdq',10001b
dw fma_instruction_sd-instruction_handler
db 'vfnmsub231ss',0BFh
dw fma_instruction_ss-instruction_handler
db 'vpbroadcastb',78h
dw avx_pbroadcastb_instruction-instruction_handler
db 'vpbroadcastd',58h
dw avx_pbroadcastd_instruction-instruction_handler
db 'vpbroadcastq',59h
dw avx_pbroadcastq_instruction-instruction_handler
db 'vpbroadcastw',79h
dw avx_pbroadcastw_instruction-instruction_handler
db 'vpclmulhqhdq',10001b
dw avx_pclmulqdq_instruction-instruction_handler
db 'vpclmullqhdq',10000b
dw avx_pclmulqdq_instruction-instruction_handler
db 'vpclmullqhdq',10000b
dw avx_pclmulqdq_instruction-instruction_handler
db 'vpcomfalseub',6
dw xop_pcom_ub_instruction-instruction_handler
db 'vpcomfalseud',6
3222,14 → 3312,16
dw avx_cmp_ss_instruction-instruction_handler
db 'vpclmulhqlqdq',1
dw avx_pclmulqdq_instruction-instruction_handler
db 'vpclmullqlqdq',0
dw avx_pclmulqdq_instruction-instruction_handler
instructions_14:
db 'vbroadcastf128',0
dw avx_broadcastf128_instruction-instruction_handler
db 'vcmpfalse_ospd',1Bh
dw avx_cmp_pd_instruction-instruction_handler
db 'vcmpfalse_osps',1Bh
db 'vpclmullqlqdq',0
dw avx_pclmulqdq_instruction-instruction_handler
instructions_14:
db 'vbroadcastf128',1Ah
dw avx_broadcastf128_instruction-instruction_handler
db 'vbroadcasti128',5Ah
dw avx_broadcastf128_instruction-instruction_handler
db 'vcmpfalse_ospd',1Bh
dw avx_cmp_pd_instruction-instruction_handler
db 'vcmpfalse_osps',1Bh
dw avx_cmp_ps_instruction-instruction_handler
db 'vcmpfalse_ossd',1Bh
dw avx_cmp_sd_instruction-instruction_handler
/programs/develop/fasm/trunk/variable.inc
117,12 → 117,16
push_size db ?
value_size db ?
address_size db ?
label_size db ?
size_declared db ?
 
value_undefined db ?
value_constant db ?
value_type db ?
value_sign db ?
fp_sign db ?
fp_format db ?
address_sign db ?
compare_type db ?
logical_value_wrapping db ?
next_pass_needed db ?
130,8 → 134,11
labels_type db ?
code_type db ?
virtual_data db ?
org_origin_sign db ?
adjustment_sign db ?
 
macro_status db ?
default_argument_value db ?
prefixed_instruction db ?
formatter_symbols_allowed db ?
 
/programs/develop/fasm/trunk/version.inc
1,5 → 1,5
 
; flat assembler version 1.69
; flat assembler version 1.70
; Copyright (c) 1999-2012, Tomasz Grysztar.
; All rights reserved.
;
33,7 → 33,7
; cannot simply be copied and put under another distribution licence
; (including the GNU Public Licence).
 
VERSION_STRING equ "1.69.36"
VERSION_STRING equ "1.70.01"
 
VERSION_MAJOR = 1
VERSION_MINOR = 69
VERSION_MINOR = 70
/programs/develop/fasm/trunk/x86_64.inc
76,10 → 76,9
cmp al,'('
jne invalid_operand
call get_byte_value
cmp [next_pass_needed],0
jne int_imm_ok
test eax,eax
js value_out_of_range
jns int_imm_ok
call recoverable_overflow
int_imm_ok:
mov ah,al
mov al,0CDh
160,11 → 159,7
jae long_immediate_not_encodable
jmp basic_mem_imm_32bit_ok
basic_mem_imm_nosize:
cmp [error_line],0
jne basic_mem_imm_8bit
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
basic_mem_imm_8bit:
call get_byte_value
mov byte [value],al
373,6 → 368,14
add [base_code],5
call store_instruction_code
jmp basic_store_imm_32bit
recoverable_unknown_size:
cmp [error_line],0
jne ignore_unknown_size
push [current_line]
pop [error_line]
mov [error],operand_size_not_specified
ignore_unknown_size:
ret
single_operand_instruction:
mov [base_code],0F6h
mov [postbyte_register],al
392,11 → 395,7
inc [base_code]
jmp instruction_ready
single_mem_nosize:
cmp [error_line],0
jne single_mem_8bit
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
single_mem_8bit:
jmp instruction_ready
single_reg:
575,11 → 574,7
call store_instruction_with_imm16
jmp instruction_assembled
mov_mem_imm_nosize:
cmp [error_line],0
jne mov_mem_imm_32bit
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
mov_mem_imm_32bit:
call operand_32bit
call get_dword_value
920,37 → 915,6
cmp ah,8
je mov_xrx_store
jmp invalid_operand_size
cmov_instruction:
mov [base_code],0Fh
mov [extended_code],al
lods byte [esi]
call get_size_operator
cmp al,10h
jne invalid_operand
lods byte [esi]
call convert_register
mov [postbyte_register],al
lods byte [esi]
cmp al,','
jne invalid_operand
lods byte [esi]
call get_size_operator
cmp al,'['
je cmov_reg_mem
cmp al,10h
jne invalid_operand
cmov_reg_reg:
lods byte [esi]
call convert_register
mov bl,al
mov al,ah
call operand_autodetect
jmp nomem_instruction_ready
cmov_reg_mem:
call get_address
mov al,[operand_size]
call operand_autodetect
jmp instruction_ready
test_instruction:
mov [base_code],84h
lods byte [esi]
1020,11 → 984,7
call store_instruction_with_imm16
jmp instruction_assembled
test_mem_imm_nosize:
cmp [error_line],0
jne test_mem_imm_32bit
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
test_mem_imm_32bit:
call operand_32bit
call get_dword_value
1243,11 → 1203,7
je push_mem_32bit
cmp ah,8
je push_mem_64bit
cmp [error_line],0
jne push_mem_store
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
jmp push_mem_store
push_mem_16bit:
test ah,not 2
1509,11 → 1465,7
je pop_mem_32bit
cmp ah,8
je pop_mem_64bit
cmp [error_line],0
jne pop_mem_store
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
jmp pop_mem_store
pop_mem_16bit:
test ah,not 2
1689,11 → 1641,7
mov [postbyte_register],al
jmp instruction_ready
inc_mem_nosize:
cmp [error_line],0
jne inc_mem_8bit
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
inc_mem_8bit:
mov al,0FEh
xchg al,[base_code]
2028,11 → 1976,7
mov [base_code],0D3h
jmp instruction_ready
sh_mem_cl_nosize:
cmp [error_line],0
jne sh_mem_cl_8bit
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
sh_mem_cl_8bit:
mov [base_code],0D2h
jmp instruction_ready
2059,11 → 2003,7
mov [base_code],0D1h
jmp instruction_ready
sh_mem_imm_nosize:
cmp [error_line],0
jne sh_mem_imm_8bit
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
sh_mem_imm_8bit:
cmp byte [value],1
je sh_mem_1_8bit
2277,11 → 2217,7
call operand_autodetect
jmp instruction_ready
movx_unknown_size:
cmp [error_line],0
jne movx_mem_store
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
jmp movx_mem_store
movx_reg:
lods byte [esi]
2400,11 → 2336,7
call store_instruction_with_imm8
jmp instruction_assembled
bt_mem_imm_nosize:
cmp [error_line],0
jne bt_mem_imm_store
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
jmp bt_mem_imm_store
bt_reg:
lods byte [esi]
2457,6 → 2389,16
bs_instruction:
mov [extended_code],al
mov [base_code],0Fh
call get_reg_mem
jc bs_reg_reg
mov al,[operand_size]
call operand_autodetect
jmp instruction_ready
bs_reg_reg:
mov al,ah
call operand_autodetect
jmp nomem_instruction_ready
get_reg_mem:
lods byte [esi]
call get_size_operator
cmp al,10h
2470,20 → 2412,19
lods byte [esi]
call get_size_operator
cmp al,10h
je bs_reg_reg
je get_reg_reg
cmp al,'['
jne invalid_argument
call get_address
mov al,[operand_size]
call operand_autodetect
jmp instruction_ready
bs_reg_reg:
clc
ret
get_reg_reg:
lods byte [esi]
call convert_register
mov bl,al
mov al,ah
call operand_autodetect
jmp nomem_instruction_ready
stc
ret
 
imul_instruction:
mov [base_code],0F6h
mov [postbyte_register],5
2503,11 → 2444,7
inc [base_code]
jmp instruction_ready
imul_mem_nosize:
cmp [error_line],0
jne imul_mem_8bit
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
imul_mem_8bit:
jmp instruction_ready
imul_reg:
2892,11 → 2829,7
je jmp_mem_far
cmp [jump_type],2
je jmp_mem_near
cmp [error_line],0
jne jmp_mem_near
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
jmp_mem_near:
cmp [code_type],16
je jmp_mem_16bit
3007,6 → 2940,10
jmp_imm_32bit_store:
mov edx,eax
sub edx,3
jno jmp_imm_32bit_ok
cmp [code_type],64
je relative_jump_out_of_range
jmp_imm_32bit_ok:
mov al,[base_code]
stos byte [edi]
mov eax,edx
3021,7 → 2958,7
mov ecx,edx
cdq
cmp edx,ecx
jne value_out_of_range
jne relative_jump_out_of_range
call check_for_short_jump
jnc jmp_imm_32bit_store
jmp_short:
3202,7 → 3139,7
mov ecx,edx
cdq
cmp edx,ecx
jne value_out_of_range
jne relative_jump_out_of_range
call check_for_short_jump
jnc conditional_jump_32bit_store
conditional_jump_short:
3307,7 → 3244,7
mov ecx,edx
cdq
cmp edx,ecx
jne value_out_of_range
jne relative_jump_out_of_range
jmp make_loop_jump
loop_jump_16bit:
call get_address_word_value
3393,11 → 3330,7
je simple_instruction_64bit
or bl,bl
jnz invalid_operand_size
cmp [error_line],0
jne simple_instruction
mov ebx,[current_line]
mov [error_line],ebx
mov [error],operand_size_not_specified
call recoverable_unknown_size
jmp simple_instruction
lods_instruction:
lods byte [esi]
3935,11 → 3868,7
je basic_fpu_mem_64bit
or al,al
jnz invalid_operand_size
cmp [error_line],0
jne basic_fpu_mem_32bit
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
basic_fpu_mem_32bit:
jmp instruction_ready
basic_fpu_mem_64bit:
4007,11 → 3936,7
je fi_mem_32bit
or al,al
jnz invalid_operand_size
cmp [error_line],0
jne fi_mem_32bit
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
fi_mem_32bit:
mov [base_code],0DAh
jmp instruction_ready
4036,11 → 3961,7
je fld_mem_80bit
or al,al
jnz invalid_operand_size
cmp [error_line],0
jne fld_mem_32bit
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
fld_mem_32bit:
mov [base_code],0D9h
jmp instruction_ready
4086,11 → 4007,7
je fild_mem_64bit
or al,al
jnz invalid_operand_size
cmp [error_line],0
jne fild_mem_32bit
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
fild_mem_32bit:
mov [base_code],0DBh
jmp instruction_ready
5648,7 → 5565,7
jne invalid_operand
call get_address
cmp [operand_size],0
je mmx_imm8
je instruction_ready
mov al,[mmx_size]
cmp al,[operand_size]
jne invalid_operand_size
5854,7 → 5771,7
mov [opcode_prefix],66h
mov [base_code],0Fh
mov [extended_code],38h
mov [supplemental_code],2Ah
mov [supplemental_code],al
lods byte [esi]
call get_size_operator
cmp al,10h
5979,11 → 5896,7
crc32_reg32_mem_store:
jmp instruction_ready
crc32_unknown_size:
cmp [error_line],0
jne crc32_reg32_mem_store
mov eax,[current_line]
mov [error_line],eax
mov [error],operand_size_not_specified
call recoverable_unknown_size
jmp crc32_reg32_mem_store
crc32_reg32_reg:
lods byte [esi]
6301,6 → 6214,8
call operand_autodetect
jmp nomem_instruction_ready
rdfsbase_instruction:
cmp [code_type],64
jne illegal_instruction
mov [opcode_prefix],0F3h
mov [base_code],0Fh
mov [extended_code],0AEh
6318,6 → 6233,70
call operand_autodetect
jmp nomem_instruction_ready
 
xabort_instruction:
lods byte [esi]
call get_size_operator
cmp ah,1
ja invalid_operand_size
cmp al,'('
jne invalid_operand
call get_byte_value
mov dl,al
mov ax,0F8C6h
stos word [edi]
mov al,dl
stos byte [edi]
jmp instruction_assembled
xbegin_instruction:
lods byte [esi]
cmp al,'('
jne invalid_operand
mov al,[code_type]
cmp al,64
je xbegin_64bit
cmp al,32
je xbegin_32bit
xbegin_16bit:
call get_address_word_value
add edi,4
call calculate_relative_offset
sub edi,4
shl eax,16
mov ax,0F8C7h
stos dword [edi]
jmp instruction_assembled
xbegin_32bit:
call get_address_dword_value
jmp xbegin_address_ok
xbegin_64bit:
call get_address_qword_value
xbegin_address_ok:
add edi,5
call calculate_relative_offset
sub edi,5
mov edx,eax
cwde
cmp eax,edx
jne xbegin_rel32
mov al,66h
stos byte [edi]
mov eax,edx
shl eax,16
mov ax,0F8C7h
stos dword [edi]
jmp instruction_assembled
xbegin_rel32:
sub edx,1
jno xbegin_rel32_ok
cmp [code_type],64
je relative_jump_out_of_range
xbegin_rel32_ok:
mov ax,0F8C7h
stos word [edi]
mov eax,edx
stos dword [edi]
jmp instruction_assembled
 
convert_register:
mov ah,al
shr ah,4
6456,11 → 6435,7
cdq
cmp edx,[address_high]
je address_high_ok
cmp [error_line],0
jne address_high_ok
mov ebx,[current_line]
mov [error_line],ebx
mov [error],value_out_of_range
call recoverable_overflow
address_high_ok:
mov edx,eax
ror ecx,16
6559,7 → 6534,7
cmp [code_type],64
jne invalid_operand
test al,0B0h
jnz prefix_conflict
jnz disallowed_combination_of_registers
stos byte [edi]
rex_prefix_ok:
mov al,[base_code]
6617,13 → 6592,11
test bx,8080h
jz address_value_ok
address_value_out_of_range:
cmp [error_line],0
jne address_value_ok
mov edx,[current_line]
mov [error_line],edx
mov [error],value_out_of_range
call recoverable_overflow
address_value_ok:
call store_segment_prefix_if_necessary
test [vex_required],4
jnz address_vsib
or bx,bx
jz address_immediate
cmp bx,0F800h
6733,6 → 6706,22
or al,cl
stos byte [edi]
ret
address_vsib:
mov al,bl
shr al,4
cmp al,0Ch
je vector_index_ok
cmp al,0Dh
jne invalid_address
vector_index_ok:
mov al,bh
shr al,4
cmp al,4
je postbyte_32bit
cmp [code_type],64
je address_prefix_ok
test al,al
jnz invalid_address
postbyte_32bit:
call address_32bit_prefix
jmp address_prefix_ok
6779,6 → 6768,7
or ah,bl
and bh,111b
or ah,bh
sib_ready:
test ch,44h
jnz sib_address_32bit_value
test ch,88h