.MACRO


Defines a set of statements written between the .MACRO and .ENDM directives as a macro having the name specified in the symbol field.

[Syntax]

Symbol field
Mnemonic field
Operand field
Comment field
name
.MACRO
   :
Macro body
   :
[formal-parameter[, ... ]] 
[; comment]

[Function]

-

Defines a set of statements (called "a macro body") written between the .MACRO and .ENDM directives as a macro having the name specified in the symbol field.
When this macro name is referenced (called "a macro call"), it is handled as the macro body corresponding to the macro name written at that location (called "a macro expansion").

[Description]

-

If there is no .ENDM directive corresponding to a .MACRO directive within the same file, the CCRL outputs a message.
For example, if only .MACRO or .ENDM exists in an include file, an error will occur.

-

The maximum number of formal parameters depends on the usable amount of memory.

-

If a macro call includes excess arguments, a warning will be output.

-

If a macro is called before it has been defined, the compiler outputs an error.

-

If a currently defined macro is called in a macro body, the CC-RL outputs the error message.

-

If there are multiple formal parameters having the same name, an error will occur.

-

Numeric constants or Symbol can be specified as an argument in a macro call; if another type of argument is specified, an error will be output.

-

A line of a sentence can be designated in the macro-body. Such as operand can't designate the part of the sentence.

[Example]

ADMAC  .MACRO  PARA1, PARA2  ; Macro definition
       MOV     A, #PARA1
       ADD     A, #PARA2
       .ENDM
       
       ADMAC  0x10, 0x20     ; Macro call