flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > How to get the label in front of a macro |
Author |
|
Tomasz Grysztar 04 Nov 2010, 21:11
fasm uses a "struc" directive for such purpose, which is a special kind of macro that need to have a label before it. Also you do not add colon between the label and name of struc macro, just like you do not put colon between the label and data definition directive (like "mydata DB 1"). The struc label can be accessed with "." name. You use it like this:
Code: struc MYMACRO p1,p2 { . = p1*p2 } mylabel MYMACRO 7,6 ; ... mov al,mylabel ; should be 42 |
|||
04 Nov 2010, 21:11 |
|
PaoloR 04 Nov 2010, 21:32
Tomasz: Thanks for the quick reply. I need access to the label to implement LEAVE and ITERATE (break and continue in the C/Java world). When there are multiple nesting of, say LOOP, I would like to sometimes to target an outer LOOP instead of the inner LOOP. That is the reason I need access to the label, but not always.
So the LOOP macro would have an optional label in front of it, that could be the target of the LEAVE or ITERATE. From your message I am not sure I can do it with a struct type macro since struct always requires a label. Thanks again |
|||
04 Nov 2010, 21:32 |
|
baldr 05 Nov 2010, 08:54
PaoloR,
macro wrapper for struc is easy to implement. Moreover, macro versions of leave/iterate could take shortcuts if handling for innermost and other nesting levels is different. |
|||
05 Nov 2010, 08:54 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.