Chapter 11 Writing Macro Control Statements

11.3 Macro Calls and Expansion

Syntax

macro_name

[parameter (, parameter)... ]

 

 

 

NOTE:

Up to10 dummy parameters can be specified.

 

 

 

Functional description

A macro is called by coding its name in the operation field of a source statement. The assembler then inserts the text of the macro body at that position.

When parameters are specified, their values are passed in the same order as the dummy parameter when the macro was defined.

mac1

macro

para1, para2, para3

;macro

definition

 

.

 

 

 

 

.

 

 

 

 

endm

 

 

 

main

mac1

address, data, count

;macro

call

In this example para1, para2, and para3 are dummy parameters. The parameters of the macro call are passed to the dummy parameters as follows.

para1 = address para2 = data para3 = count

Coding rules

Any string can be specified as a parameter. To specify a string that includes commas or spaces, use the macro operator <>. Refer to section 11.4 "Macro Operators", for details.

If there are more parameters than there were dummy parameters in the macro definition, an error will occur.

If there are fewer parameters than there were dummy parameters in the macro definition, the assembler will process the remaining parameters as though null characters were specified.

In the list file, the line numbers of source statements with macro calls will be prefixed by the letter 'M'. The source statements resulting from macro expansion will have a '+' appended to the line number.

Macro Calls and Expansion 209

Page 221
Image 221
Panasonic MN1030 Macro Calls and Expansion, Macroname Parameter , parameter, Up to10 dummy parameters can be specified