MEXIT
None
MEXIT is usually used together with conditional assembly within a macro. In that case it may happen that the macro expansion should terminate prior to termination of the macro definition. The MEXIT directive causes macro expansion to skip any remaining source lines ahead of the ENDM - End macro definition directive.
The code in the following listing allows the replication of simple instructions or directives using MACRO with MEXIT.
XDEF entry storage: EQU $00FF save: MACRO ; Start macro definition LD X,#storage LD D6, \1 ST D6,(0,x) ; Save first argument LD D6, \2 ST D6, (2,x) ; Save second argument IFC '\3', '' ; Is there a third argument? MEXIT ; No, exit from macro ENDC LD D6, \3 ; Save third argument ST D6,(4,X) ENDM ; End of macro definition datSec: SECTION char1: ds.b 1 char2: ds.b 1 codSec: SECTION entry: save char1, char2
The following listing shows the macro expansion of the previous macro.
Abs. Rel. Loc Obj. code Source line ---- ---- ------ --------- ----------- 1 1 XDEF entry 2 2 0000 00FF storage: EQU $00FF 3 3 save: MACRO ; Start macro definition 4 4 LD X,#storage 5 5 LD D6, \1 6 6 ST D6,(0,x) ; Save first argument 7 7 LD D6, \2 8 8 ST D6, (2,x) ; Save second argument 9 9 IFC '\3','';Is there a third argument? 10 10 MEXIT ; No, exit from macro 11 11 ENDC 12 12 LD D6, \3 ; Save third argument 13 13 ST D6,( 4,X) 14 14 ENDM ; End of macro definition 15 15 datSec: SECTION 16 16 000000 char1: ds.b 1 17 17 000001 char2: ds.b 1 18 18 codSec: SECTION 19 19 entry: 20 20 save char1, char2 21 4m 000000 9800 00FF + LD X,#storage 22 5m 000004 B6xx xxxx + LD D6, char1 23 6m 000008 C640 + ST D6,(0,x) ; Save first argument 24 7m 00000A B6xx xxxx + LD D6, char2 25 8m 00000E C642 + ST D6, (2,x) ; Save second argument 26 9m 0000 0001 + IFC '','';Is there a third argument? 28 10m + MEXIT ; No, exit from macro 29 11m + ENDC 30 12m + LD D6, ;Save third argument 31 13m + ST D6,( 4,X)