qa.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.
RestoreRegs
   Example  Back  Contents  Index
──────────────────────────────────────────────────────────────────────────────
 
;* RestoreRegs - Macro to generate a pop instruction for registers saved
;* by the SaveRegs macro.  Restores the group of registers most recently
;* pushed -- that is, RestoreRegs pops the group of registers saved by the
;* last use of SaveRegs.
;*
;* Shows:   Directives - INSTR     SUBSTR     SIZESTR
;*          Operators - GT
;*
;* Params:  None
 
RestoreRegs MACRO
    numloc  INSTR  regpushed, "#"       ;; Find location of # marker
    reglist SUBSTR regpushed, 1, numloc - 1     ;; Get list of registers
    reglen  SIZSTR regpushed            ;; Adjust numloc if # marker is
    IF reglen GT numloc                 ;;  not last item in string
        numloc = numloc + 1
    ENDIF
    regpushed SUBSTR regpushed, numloc  ;; Remove list from regpushed
    IRP reg, <reglist>                  ;; Generate pop for each register
        IFNB <reg>
           pop reg
        ENDIF
    ENDM                                ;; Terminator for IRP
ENDM                                    ;; Terminator for MACRO
 
 
;* WordStore - Macro to define a series of word storage locations with
;* labels consisting of a name followed by a sequential number.  Each
;* defined word is initialized to 0.
;*
;* Shows:   Directive - REPT
;*          Operators - &     %
;*
;* Params:  slabel - Base name for labels
;*          s1 - Starting number for labels
;*          s2 - Ending number for labels
 
WordStore MACRO slabel, s1, s2
    maxct = s2 - s1 + 1                 ;; Determine number of locations
    count = s1                          ;; Begin with first number
    REPT maxct
        lbl CATSTR <&slabel>, %count    ;; Create label.  The % operator
        count = count + 1               ;;   forces evaluation of count
        lbl DW 0                        ;; Create word storage location
    ENDM                                ;; Terminator for REPT
ENDM                                    ;; Terminator for MACRO
                                    -♦-