Calling MPL Macros
The following defines a macro named BMOVE that takes three arguments: source, destination, and count. The macro produces code that copies any number of bytes from one part of memory to another.
%*DEFINE (BMOVE (src, dst, cnt)) LOCAL lab (
MOV R2,#%cnt
MOV R1,#%src
MOV R0,#%dst
%lab: MOVB [R0+],[R1]
ADD R1,#1
CMPD1 R2,#0
JMP CC_NZ, %lab
)
To call this macro, specify the meta character followed by the macro name and the list of parameters (if any). The actual parameters must have balanced text and may contain calls to other macros. For example, the above macro may be called as follows:
%BMOVE (array1,array2,10)
The macro is expanded as:
MOV R2,#10
MOV R1,#array1
MOV R0,#array2
??LAB?0: MOVB [R0+],[R1]
ADD R1,#1
CMPD1 R2,#0
JMP CC_NZ, ??LAB?0
Note
- The above example produces assembly errors because the source file includes no section definitions.
- The GEN and GENONLY directives may be used to include macro definition and macro calls in the assembler listing file.