flat assembler
Message board for the users of flat assembler.
Index
> Main > Do fasmg use special names for local? |
Author |
|
revolution 08 Feb 2019, 03:38
The same problem exists in fasm also
Code: x?0 = '2' macro f { local x x = '4' cusdis x } macro cusdis x { display `x,' = ',x,13,10 } display 'x?0 = ',x?0,13,10 f display 'x?0 = ',x?0,13,10 Code: x?0 = 2 x?0 = 4 x?0 = 4 |
|||
08 Feb 2019, 03:38 |
|
l4m2 08 Feb 2019, 05:17
If not can't be used to make local group
Code: macro test i local t t equ 49 t#1 equ 51 display i cusdis i display t cusdis t display i#1 cusdis i#1 display t#1 cusdis t#1 end macro macro cusdis x display 32,`x,10 end macro t equ 48 t1 equ 50 test t Code: 0 t 1 t 3 t#1 3 t#1 |
|||
08 Feb 2019, 05:17 |
|
Tomasz Grysztar 08 Feb 2019, 06:38
In fasmg local symbols are not replaced with a different names like fasm's preprocessor does it, instead they reside in a different namespace - a special namespace associated with macro. When you use such symbol, for example in parameters to call other macros (or in symbolic variables), the "recognition context" which states in which namespace the name should be understood, is copied along with it (invisible to normal text processing, think of it as a text attribute like color).
Therefore even if you attach a number to such name, it is still going to be interpreted in the local namespace - it is enough that the beginning of a name is "colored" as such. Thanks to that your above snippet does in fact show the same values as analogous code for fasm 1. Definitions "t equ 48" and "t1 equ 50" do not have any effect, because they are symbols in a completely different namespace. In fasm you could "hack" the local symbols separation by defining a conflicting name manually, in fasmg it is not possible, because you have no access to macro's local namespace other than through LOCAL directive. Perhaps you should tell us what problem you are trying to solve. |
|||
08 Feb 2019, 06:38 |
|
l4m2 08 Feb 2019, 10:27
Quote: Therefore even if you attach a number to such name, it is still going to be interpreted in the local namespace - it is enough that the beginning of a name is "colored" as such. Code: display i#1 EDIT: Am I using a too old version(0.97.1470594768)? |
|||
08 Feb 2019, 10:27 |
|
Tomasz Grysztar 08 Feb 2019, 11:39
It displays 2 for me. Why are you using such an antique version? It's been a long time since I switched to a base 36 versioning scheme. 0.9x should be considered pre-releases.
|
|||
08 Feb 2019, 11:39 |
|
l4m2 08 Feb 2019, 14:26
I guess I downloaded fasmg years ago and don't update...
|
|||
08 Feb 2019, 14:26 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.