flat assembler
Message board for the users of flat assembler.

Index > Main > fasm reserved symbols

Author
Thread Post new topic Reply to topic
Ali.Z



Joined: 08 Jan 2018
Posts: 716
Ali.Z 21 Jul 2018, 01:27
these symbols cant be used for labels, they have special use.
i dont understand some of them, let me count what i know.
Code:
+ - / * = < > ( )  [ ] { } : , | & ~ # `    

+ ADD
- SUB
/ DIV
* MUL
= EQU
[] value of
, separate registers and other stuff
| logical OR
& logical AND

if someone can till me the uses of these, thanks.

<> less and greater and other stuff that i dont know
: label and other stuff that i dont know
() i dont know
{} i dont know
~ i dont know
# i dont know
` i dont know

_________________
Asm For Wise Humans
Post 21 Jul 2018, 01:27
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1228
Location: Belarus
DimonSoft 21 Jul 2018, 09:14
Ali.A wrote:
if someone can till me the uses of these, thanks.

<> less and greater and other stuff that i dont know
: label and other stuff that i dont know
() i dont know
{} i dont know
~ i dont know
# i dont know
` i dont know


<> are also used for grouping symbols in in checks (see chapter 2.2.2 in FASM.pdf) and for passing stuff containing commas to macroinstructions (see chapter 2.3.3 in FASM.pdf). Although, I guess, these cases are technically the same case.

: lets you specify starting offset in file directive (1.2.2), separates segment number and offset in fully-qualified addresses (see examples in 2.1.6, 2.1.8, and it’s a commonly used notation), specifies the base counter value for rept directive (2.3.5), is used as a delimiter for some standard macros (say, proc macro, see 3.1.3). Double colon is also used in addressing space labels (2.2.4).

() override operator precedence in expressions (see numerous examples throughout FASM.pdf), group values for dup operator (1.2.2).

{} enclose macro bodies (2.3.3).
~ means logical negation (2.2.2).
# concatenates operands in macros (2.3.3).
` converts operands to their string representations in macros (2.3.3).
Post 21 Jul 2018, 09:14
View user's profile Send private message Visit poster's website Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 716
Ali.Z 21 Jul 2018, 13:07
thanks for the details.
Post 21 Jul 2018, 13:07
View user's profile Send private message Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 716
Ali.Z 23 Jul 2018, 13:39
1more confusing question:
i do use labels that starts with 1 dot, however i couldnt understand what double dots mean?
technically?
Post 23 Jul 2018, 13:39
View user's profile Send private message Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 798
Location: Russian Federation, Sochi
ProMiNick 23 Jul 2018, 17:55
let suppose that in fasm internally exist label "." - root label for all others (it is hidden from direct access but as any other label it can have descendants).
so we define descendants:
first parent name -"."
than descendant joiner - "."
than name of descendant
Post 23 Jul 2018, 17:55
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 23 Jul 2018, 18:10
See the manual, section 1.2.3:
Quote:
Labels beginning with two dots are the exception - they are like global, but they don't become the new prefix for local labels.
Post 23 Jul 2018, 18:10
View user's profile Send private message Visit poster's website Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1228
Location: Belarus
DimonSoft 23 Jul 2018, 18:14
Ali.A wrote:
1more confusing question:
i do use labels that starts with 1 dot, however i couldnt understand what double dots mean?
technically?

It’s in FASM.pdf, chapter 1.2.3, but seems to be too between-the-lines. The idea is that there’re global and local labels. A local label is “tied” to the nearest preceding global label (NPGL) thus having two names: short one starting with dot and long one that can be obtained by concatenating the NPGL name with the name of the local label.

Now, sometimes, mostly in macros which generate code that might be placed anywhere, you want to have a global label but don’t want it to break the outer code. That’s where double-dotted labels come in handy. Consider the following example:
Code:
macro breakifeaxz {
  test eax, eax
  jnz Skip
  int 3
Skip:
}

MyProc:
  push ebp
  mov ebp, esp
  ...
.InternalLoop:
  call OtherProc
  test eax, eax
  jnz .InternalLoop

  call OneMoreProc
  test eax, eax
  jz .EndProc

  call CriticalProc
  breakifeaxz

.EndProc:
  ...
  pop bp
  ret    

Labels .InternalLoop and .EndProc generally have MyProc.InternalLoop and MyProc.EndProc as their full names. But since the macro adds its own label and it’s a global label, their full names become MyProc.InternalLoop and Skip.EndProc respectively while the check after OneMoreProc call tried to jump to MyProc.EndProc. So, the compilation fails.

You might say that for such a macro an anonymous label might be a better idea but it would break code that uses anonymouse labels around the macro. Technically, you could use local label (with one dot) and make its name unique with local directive but that would mean that your namespace would be trashed with local labels randomly attached to global ones.

Double-dotted label lets you define a label that will behave as global one except that local labels will not attach to it i.e. will skip it when looking for NGPL.
Post 23 Jul 2018, 18:14
View user's profile Send private message Visit poster's website Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 716
Ali.Z 23 Jul 2018, 23:48
DimonSoft wrote:
Double-dotted label lets you define a label that will behave as global one except that local labels will not attach to it i.e. will skip it when looking for NGPL.

this is exactly what i wanted to know, thanks.
Post 23 Jul 2018, 23:48
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.