flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > MASM-like structures and procedures |
Author |
|
decard 11 Jun 2005, 21:18
Wow, FASM preprocessor is so powerfull now :O
Could you explain how does it work, ie. why structure and proc name can be written before macro? |
|||
11 Jun 2005, 21:18 |
|
Tomasz Grysztar 11 Jun 2005, 21:32
The struc directive is used for this purpose, as it allows now to use the symbol constisting of individual dot to get the name of structure instance, and if preprocessor detects that this symbol was used inside the structure, it doesn't automatically generate the main label for structure, leaving this to you, so you can customize the definition to whatever you want. The difference shown on example:
Code: struc byte value { db value } a byte ? ; a: db ? struc byte value { . db value } b byte ? ; b db ? In second case the label is applied directly do the "db", so the label is defined with the byte type. As you should easily notice, this allows also to use the name of structure instance for completely different purposes than just label definition. This fragment from the above defines just a wrapper for the "struct" and "ends" macros: Code: struc struct { struct . name@struct equ . } struc ends { match =.,name@struct \{ ends \} } It still can be improved, as such "ends" wrapper silently ignores when is used with name that doesn't match the name of currently used structure - it can be corrected to show an error or warning in such case. The notes from this thread should also help understanding some of those macros. |
|||
11 Jun 2005, 21:32 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.