flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > (?) need help to understand |
Author |
|
Tomasz Grysztar 29 Nov 2011, 22:58
The "{" character has no special meaning inside a macro block, only the "}" character is special in that it closes the definition of macroinstruction. The "{" character will be just put into generated macro text, like any other character (while if you want to do it with "}" you always have to escape it, otherwise it is going to be interpreted as end of the macro you're defining).
It was done this way to allow one macro to start the definition of another one, like "tmacro" example at the end of section 2.3.3 of manual. I also already gave you some more examples (though not all are useful ones). Also the good old globals macros (which were adopted by the Fresh project) utilize this feature. |
|||
29 Nov 2011, 22:58 |
|
ouadji 30 Nov 2011, 01:33
thank you Tomasz for your reply. I have read all articles! (from beginning to end) I don't understand everything, (I do my best) So, how do you explain this? I understand why the macro A does compile and i understand the result of 6bytes. But in the macro B, where is the end of the macro ? B1? or B2? (i think B1) if B1 is the end of macro B then why "}"(B2) alone does not trigger an error ? and if B2 is the end of macro B why "2bytes" and not 6 like macro A ? I think B1 is the end of the macro B. In this case, the result of 2 bytes is correct. But in this case, why B does compile ... (because B2?) |
|||
30 Nov 2011, 01:33 |
|
addes3 30 Nov 2011, 19:34
I believe B2 is being used to end the "struc" definition, which generates no code.
|
|||
30 Nov 2011, 19:34 |
|
ouadji 30 Nov 2011, 21:21
Quote: I believe B2 is being used to end the "struc" definition, which generates no code. |
|||
30 Nov 2011, 21:21 |
|
Tomasz Grysztar 30 Nov 2011, 22:34
ouadji wrote: one "}" to end "rept", and another "}" to end "struct" ? Code: rept 1 { mov eax,eax struc myS { .mydata dd 1 } abc myS } |
|||
30 Nov 2011, 22:34 |
|
ouadji 01 Dec 2011, 00:23
Here is finaly the explanation I expected from the beginning of this thread! All manuals and all examples would never have given this explanation. How this macros engine works is really surprising. It will be very difficult to implement the highlighting of macros (in all cases) with this kind of nestings. Thank you Tomasz.
|
|||
01 Dec 2011, 00:23 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.