flat assembler
Message board for the users of flat assembler.
Index
> Main > fasm reserved symbols |
Author |
|
DimonSoft 21 Jul 2018, 09:14
Ali.A wrote: if someone can till me the uses of these, thanks. <> 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). |
|||
21 Jul 2018, 09:14 |
|
Ali.Z 21 Jul 2018, 13:07
thanks for the details.
|
|||
21 Jul 2018, 13:07 |
|
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? |
|||
23 Jul 2018, 13:39 |
|
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 |
|||
23 Jul 2018, 17:55 |
|
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. |
|||
23 Jul 2018, 18:10 |
|
DimonSoft 23 Jul 2018, 18:14
Ali.A wrote: 1more confusing question: 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. |
|||
23 Jul 2018, 18:14 |
|
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. |
|||
23 Jul 2018, 23:48 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.