Keil™, An ARM® Company

Ax51 User's Guide

Exiting a Macro

The EXITM directive immediately terminates a macro expansion. When this directive is detected, the macro processor stops expanding the current macro and resumes processing after the next ENDM directive. The EXITM directive is useful in conditional statements. For example:

WAIT    MACRO X            ; macro definition
        IF NUL X           ; make sure X has a value
          EXITM            ; if not then exit
        ENDIF
        REPT X             ; generate X NOP instructions
                NOP
        ENDM               ; end REPT
ENDM                       ; end MACRO