I think Macro Procedure is the super set, so it can accomplish all the tasks finished by Text Macro and Macro Function. But why does MASM still provide Text Macro and Macro Function to bu used in program?
Posted on 2008-10-04 01:04:45 by qlmi
for buildtime macros, we usually wish to express a syntactical statement, but for runtime macros, we want to exitm and express a value into a register.
Posted on 2008-10-04 04:50:47 by Homer

for buildtime macros, we usually wish to express a syntactical statement, but for runtime macros, we want to exitm and express a value into a register.



but which is buildtime macro, which is runtime macro?
Posted on 2008-10-04 08:18:48 by qlmi
A runtime macro generally ends with a statement like EXITM <EAX>
This implies that the output of the macro is to be shoved directly into EAX register, ready for use within the code that called the macro.

Buildtime macros generally don't return values in this way - instead, they express sourcecode - once such a macro has been completely 'expanded' into a series of plaintext sourcecode statements, the assembler will then interpret them - first it Expands the macro into plaintext, then it Interprets the expanded series of statements.
We use these to compose the sourcecode differently depending on the inputs presented to the macro.
This means we don't need to write several versions of some very similar block of code.

But just to confuse you - theres no reason why a buildtime macro can't emit a runtime macro !!!
Its possible to write a macro that creates a macro !


Posted on 2008-10-04 21:26:41 by Homer
Oh, a very difficult topic!
Basically, I want to know when I should use text macro, when I should use macro procedure, and  macro function.
Posted on 2008-10-05 02:36:39 by qlmi
Use string equates where the macro is working specifically on string manipulation,and at buildtime.
Otherwise use macros to express either repeats of a common block of code, or slight variations of them.
The purpose of a macro is not to hide whats really happening in a block of code, but to eliminate laborious typing of quite similar blocks of code.
Posted on 2008-10-05 04:07:43 by Homer