qa.hlp (Table of Contents; Topic list)
SaveRegs
   Example  Back  Contents  Index
──────────────────────────────────────────────────────────────────────────────
 
;* SaveRegs - Macro to generate a push instruction for each register in
;* argument list.  Saves each register name in the string equate REGPUSHED.
;* See also the RestoreRegs and the LoadPtr macros for examples of other
;* macro directives.
;*
;* Shows:   Directives - CATSTR    IRP    IFNB
;*
;* Params:  r1 to r9 - registers to be pushed
 
regpushed EQU <>                        ;; Initialize to the null string
 
SaveRegs MACRO r1, r2, r3, r4, r5, r6, r7, r8, r9
    regpushed CATSTR <#>, regpushed     ;; Mark a new group of registers
    IRP reg, <r1, r2, r3, r4, r5, r6, r7, r8, r9>
        IFNB <reg>                      ;; Push and record the register
            push reg
            regpushed CATSTR <reg>, <,>, <regpushed>
        ELSE
            EXITM                       ;; Quit if blank argument
        ENDIF
    ENDM                                ;; Terminator for IRP
ENDM                                    ;; Terminator for MACRO
                                    -♦-