A251 User's GuideA251 Introduction Assembling Programs Writing Assembly Programs Control Statements Macro Processor Standard Macro Processor Standard Macro Controls Defining Standard Macros Calling Standard Macros Local Symbols Exiting a Macro Built-in Macros REPT IRP IRPC Standard Macro Operators NUL Operator & Operator < and > Operators % Operator ;; Operator ! Operator MPL Macro Processor MPL Macro Overview MPL Meta Character Defining MPL Macros Calling MPL Macros Local Symbols Expressions Common Functions Bracket Function Comment Function Escape Function METACHAR Function SET Function EVAL Function Comparison Functions Conditional Functions EXIT Function IF Function REPEAT Function WHILE Function Console I/O Functions String Functions LEN Function MATCH Function SUBSTR Function Advanced Literal Delimiters Blank Delimiters Identifier Delimiters Literal and Normal Modes C Preprocessor Exceptions Side-Effects Predefined Macros Examples Error Messages Appendix
Defining Standard Macros
Standard macros are defined as follows:
macro-name MACRO <[>parameter-list<]> <[>LOCAL local-labels<]> . . . macro-body . . . ENDM
LOAD_R0 MACRO R0_Val MOV R0, #R0_Val ENDM
defines a macro named LOAD_R0 which loads register 0 with the value of the first parameter passed to the macro.
Parameters in the body of the macro are represented with the parameter name (src, dst, and cnt in the above example). They may be used any number of times and in any order within the macro body. If a parameter has the same name as the macro and is used in the macro body, the parameter is expanded. The macro is not called.
Standard macros may have up to 16 parameters. Parameters must be separated by commas (',') in the macro definition and invocation. For example:
mymacro MACRO P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16
You would invoke this macro as follows:
You may pass a NULL value for a parameter by omitting that parameter from the macro invocation. The separating comma is still required. For example:
Null parameters may be tested using the NUL macro operator.
of your data.