Although you definitely can define a macro instruction that receives no parameters at all, you would rarely need to do this. Most of the time, you would define macro instructions that need at least one parameter. Let us take, for example, a macro instruction that implements the procedure prolog:
macro prolog frameSize
{
push ebp
mov ebp, esp
sub esp, frameSize
}
The frameSize property in the preceding macro instruction is a macro parameter which, in this case, is used to specify the size of the stack frame in bytes. The usage of such a macro instruction would be as follows:
my_proc:
prolog 8
; body of the procedure
mov esp, ebp
pop ebp
ret
The preceding code is logically equivalent to (and is expanded by the preprocessor into) the following:
my_proc:
push ebp
mov ebp, esp
sub esp, 8
; body of the procedure
mov esp, ebp
pop ebp
ret
In addition, we may define the return macro, which would implement the destruction of the stack frame and return from the procedure:
macro return
{
mov ebp, esp
pop ebp
ret
}
This would make our procedure even shorter:
my_proc:
prolog 8
; body of the procedure
return
Here, the return macro is also a good example of parameterless macro instruction.