User’s Manual MCUez HC12 Assembler
190 Assembler Directives MOTOROLA
Assembler Directives
8.24 MEXIT — Terminate Macro ExpansionSyntax: MEXIT
Description: MEXIT is usually used together with conditional assembly
within a macro. In that case, macro expansion might terminate
prior to terminating the macro definition. The MEXITdirective
causes macro expansion to skip any remaining source lines
ahead of the ENDM directive.
Example: This portion of code:
sav2: MACRO ; Start macro definition
ldx savet
ldaa \1
staa 0,x ; save first argument
ldaa \2
staa 2,x ; save second argument
ifc '\3', '' ; is there a 3rd argument?
mexit ; no, exit from macro.
endif
ldaa \3 ; save third argument
staa 4, x
endm ; End of macro definition
entry:
sav2 char1, char2
Generates this listing file:
27 11m 000000 FE xxxx + ldx savet
28 12m 000003 B6 xxxx + ldaa char1
29 13m 000006 6A00 + staa 0,x;save first
; argument
30 14m 000008 B6 xxxx + ldaa char2
31 15m 00000B 6A02 + staa 2,x ;save second
; argument
32 16m +
33 17m 0000 0001 + ifc '','' ;is there a
; 3rd arg.
35 18m + mexit ;no,exit macro.
36 19m + endif
37 20m +
38 21m + ldaa ;save third
; argument
39 22m + staa 4, x