I think it would be really practical if fasm can provide exitm macro function to return address of string or register as in masm do....
Posted on 2002-12-23 20:47:01 by Hume
pardon my ignorance, but can you post some code to show what does exitm do. I thought registers have no adress at all. and why can't you use string labels to access them. :confused:
Posted on 2002-12-24 00:11:47 by longer
EXITM is keyword from MASM macro language. When assembler meets this keyword it finishes processing macro.
For example:

somemacro macro a, b, c
ifb a
[some stuff here]

This macro will generate no code if "a" is blank (not defined).
Posted on 2002-12-24 02:08:01 by wanderer
wanderer is right,I think I can do some OOP stuff or use inline coding with the exitm ability,this would make fasm more powerful in macro coding.
Posted on 2002-12-25 03:01:38 by Hume
Such directive would be completely unuseful in fasm, just because "if" directive is processed at the assembly stage (so it is also pass-dependent), and therefore "exitm" would mean the same as "}". But it's all only the matter of coding style, use "if", "else", "else if" blocks instead of "exitm", the result will be the same.
Posted on 2002-12-30 16:08:04 by Tomasz Grysztar

EXITM does more than just immediately exit a MACRO. It also allows a MACRO to be used as an inline function. Look at the examples below. Ratch

BYTER MACRO ARG:VARARG ;inline code for byte string and IMPLICIT label
LBYTER MACRO ARG1,ARG:VARARG ;inline code for byte string and EXPLICIT label

INVOKE MessageBox,0,@ BYTER('TEXT FOR MSGBOX1 HERE',0),@ LBYTER(TITLE1,'TITLE OF BOX',0),MB_OK ; this function pins a label on the string
INVOKE MessageBox,0,@ BYTER('TEXT FOR MSGBOX2 HERE',0),@ TITLE1,MB_OK ;now we use the explicit label defined above

As you can see, the string will be in the DATA section, and is easier to implement than putting it somewhere away from the code that references it. I hope FASM has or will have this MACRO FUNCTION capability, and be able to do it as easily as MASM does it. Ratch
Posted on 2002-12-31 21:21:09 by Ratch
No, this way cannot be allowed in fasm, just because of its architecture. I can't change it without rewriting the whole preprocessor once again. But you can still obtain similar results using the existing techniques - as I said, there's usually more than one way do things you need. Look at other threads on this forum for some examples of extending the syntax of "invoke" macro. By redefining the "push" instruction as a macro you could get even better results, similar to your "BYTER" and "LBYTER". When I have some spare time, I can make some sample for you.

The other thing is that in fasm you cannot mix sections - the "flat ideology" of this assembler forces the output code to be generated in exactly order as the source. But if you were using COFF ouput feature, the good linker could concatenate the sections correctly for you, well - I haven't checked it yet.
Posted on 2003-01-01 09:56:31 by Tomasz Grysztar
Yep I'm pretty sure Link which comes with masm32 does just that :) .
Posted on 2003-01-01 13:54:01 by Eóin