flat assembler
Message board for the users of flat assembler.

Index > Main > What this and how this using ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1775
Roman 18 Aug 2022, 10:56
I found in sources fasmw 1.73 this in TABLES.inc
Code:
directive_operators:
 db 5,'align',8Ch
 db 2,'as',86h
 db 2,'at',80h
 db 7,'defined',88h
 db 8,'definite',8Ah
 db 3,'dup',81h
 db 2,'eq',0F0h
 db 6,'eqtype',0F7h
 db 4,'from',82h ;what this and how using ?
 db 2,'in',0F6h
 db 2,'on',84h ;what this and how using ?
 db 3,'ptr',85h ;what this and how using ?
 db 10,'relativeto',0F8h ;what this and how using ?
 db 4,'used',89h  ;what this and how using ?
 db 0
    
Post 18 Aug 2022, 10:56
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 934
Location: Russia
macomics 18 Aug 2022, 11:12
2.2.4 Addressing spaces wrote:
The load directive allows to define constant with a binary value loaded from the already assembled code. This directive should be followed by the name of the constant, then optionally size operator, then from operator and a numerical expression specifying a valid address in current addressing space.
Code:
virtual
dd 1.0
load a byte from $$
end virtual    

And:
2.4.2 Portable Executable wrote:
Also resource data can be generated automatically from the resource file, it can be achieved by writing the from operator and quoted file name after the resource identifier.

Code:
section '.rsrc' data readable resource from 'main.res'    


2.4.2 Portable Executable wrote:
After those settings can follow the at operator and the numerical expression specifying the base of PE image and then optionally on operator followed by the quoted string containing file name selects custom MZ stub for PE program (when specified file is not a MZ executable, it is treated as a flat binary executable file and converted into MZ format). The default code setting for this format is 32-bit. The example of fully featured PE format declaration:
Code:
format PE GUI 5.0 at 0x00010000 on 'stub.exe'    


1.2.1 Instruction syntax wrote:
When operand is a data in memory, the address of that data (also any numerical expression, but it may contain registers) should be enclosed in square brackets or preceded by ptr operator.
Code:
a dd 1.1
mov eax, ptr a    


2.2.2 Conditional assembly wrote:
With relativeto operator it is possible to check whether values of two expressions differ only by constant amount. The valid syntax is a numerical expression followed by relativeto and then another expression (possibly register-based). Labels that have no simple numerical value can be tested this way to determine what kind of operations may be possible with them.

Code:
virtual at ebp
a dd 0, 1, 2
b dd 1.0
end virtual
if a relativeto ebp

end if    


2.2.2 Conditional assembly wrote:
The used operator followed by a symbol name, is the logical value that checks whether the given symbol is used somewhere (it returns correct result even if symbol is used only after this check). The defined operator can be followed by any expression, usually just by a single symbol name; it checks whether the given expression contains only symbols that are defined in the source and accessible from the current position. The definite operator does a similar check with restriction to symbols defined before current position in source

Code:
if used x
x dd 1.0
end if    
Post 18 Aug 2022, 11:12
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1775
Roman 18 Aug 2022, 15:17
What difference Used and if defined?
Post 18 Aug 2022, 15:17
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 934
Location: Russia
macomics 18 Aug 2022, 16:03
Code:
format binary
use32
x dd 1.0
if used x
  display "x used", 13, 10
end if
if defined x
  display "x defined", 13, 10
end if
if definite x
  display "x definite", 13, 10
end if
;----------------------
if used y
  display "y used", 13, 10
end if
if defined y
  display "y defined", 13, 10
end if
if definite y
  display "y definite", 13, 10
end if
y dd 5.0
mov eax, [y]
;----------------------
if used z
  display "z used", 13, 10
end if
if defined z
  display "z defined", 13, 10
end if
if definite z
  display "z definite", 13, 10
end if
mov eax, [z]    
Post 18 Aug 2022, 16:03
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.