
Features of Macro Facility
A macro call results in a macro expansion.
In macro expansion, a sequence of assembly statements replaces the macro call statement.
Macro expansion makes use of two essential concepts.
Expansion time control flow
Lexical substitution.
Algorithm for macro-expansion
Set the Macro Expansion Counter to zero (MEC)
Check that the statement alluded to by MEC is not a MEND statement.
a) If the statement is model statement
then
expand the statement and
increment the MEC by 1
else
MEC := new value specified in the statement;3. Exit from the macro expansion
Tasks involved in macro expansion
1. Locate all of the program's macro calls.
2. The formal parameter values are noted.
3. Preserve the values of variables for expansion time that were specified in a macro.
4. The flow of expansion time control is coordinated.
5. Determining the values of the symbols used in sequencing.
6. A statement from a model is expanded.
The statements that make up the macro body will be extended from each macro invocation statement. The parameters in the macro prototype are replaced with arguments from the macro invocation (according to their positions).
Parameter is a part of the definition of macro.
Argument is used in the macro invocation.
The macro body's comment lines will be removed. A remark line has been added for the macro invocation declaration itself. The first statement produced by the macro expansion uses the label from the macro invocation statement as its label. The method in which we may remember an assembly language mnemonic and a macro command are same.
Each argument starts with a character, allowing for parameter replacement during macro expansion.
A pattern or prototype for the macro instruction used by the programmer is defined by the macro name and arguments. The MACRO directive statement defines the macro definition's body. These assertions are produced through macro expansion. The MEND assembler instruction specifies the conclusion of the macro definition.
The name of the macro instruction being called and the parameters to be utilised for expanding the macro are provided in the macro invocation statement.
The statements that make up the macro's body have been extended versions of each macro invocation statement, with the arguments from the macro invocation replacing the prototype macro's parameters. Arguments and parameters are related to one another based on where they fall on the political spectrum.
The extended file can be used as input to the assembler after macro processing.
Appreciate the creator