[comp.sys.ibm.pc] Submitted Without Comment

leff@smu.edu (Laurence Leff) (12/19/89)

This item is extracted from IBM PC Assembly Language: A Guide for
Programmers Page 43
Leo J. Scanlon

The EXITM Pseudo-Op

The EXITM pseudo-op makes the macro expansion terminate early, based on the
outcome of a preceding test.  For instance, recall the ALLOCATE macro that
we defined with the REPT pseudo-op.  You might like to redefine this macro so
that the assembler only allocates the table space if the LENGTH parameter is
less than 50.  A macro that makes this determination is:

ALL_LT_50   MACRO  LENGTH
            LOCAL  OKAY
VALUE       =      0
            MOV    AX,LENGTH
            CMP    AX,50             ;Is LENGTH < 50
            JB     OKAY
            EXITM                    ; If not, exit
OKAY:       REPT   LENGTH            ; If so, allocate the table
VALUE       =      VALUE+1
            DB     VALUE
            ENDM
 Laurence Leff, Ph.D               |A job is like sex, when you do it for money
CS,SMU, Dallas, Texas 75275-0122,  |You take away all the fun.
Phone: 214-692-3459 Moderator comp.doc.techreports/TRLIST, Symbolic Math List 
 convex!smu!leff leff%smu.uucp@uunet  E1AR0002 at SMUVM1 (BITNET)