Assembly Language Help (alang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
SaveRegs
 Map                                       Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
;* @SaveRegs and @RestoreRegs - Macros to save and restore a list
;* of macros. @SaveRegs pushes each register in the argument list.
;* and saves each register name in a text macro. @RestoreRegs uses
;* the saved register list to pop each register.
;*
;* Shows:   Directives - CATSTR    INSTR
;*
;*
;* Params:  For @SaveRegs, the registers to be pushed
;*          For @RestoreRegs, none
 
pregs   TEXTEQU <>  ; Initialize global text macro to empty
 
@SaveRegs MACRO regs:VARARG
        LOCAL reg
pregs   CATSTR  <!<>, <regs>, <!>>
%       FOR reg, <regs>
            push reg                                ;; Push each register
        ENDM
ENDM
 
@RestoreRegs MACRO
    LOCAL   reg
%   FOR reg, @ArgRev( pregs )                   ;; @ArgRev from MACROS.INC
        pop reg                                 ;; Pop each register
    ENDM
ENDM
                                    -♦-