bryce@cbmvax.commodore.com (Bryce Nesbitt) (04/12/90)
;----------------------------------------------------------------------------
;
; Push a set of registers onto the stack - undo with POPM. Eliminates manual
; updating of register lists at both the top and bottom of functions. May be
; used for functions with multiple exit points.
;
; Assumes that an optimizing assembler will convert the MOVEM to the short
; form if only one register is used.
;
; -Bryce Nesbitt, Commodore-Amiga, Inc.
;
;
; These macros do not nest. Example usage:
;
; PUSHM d2/a2/a5
; ...code...
; POPM
; RTS
;
; ...more code...
; POPM
; RTS
;
PUSHM_COUNT SET 0
PUSHM MACRO
IFGT NARG-1
FAIL !!!! TOO MANY ARGUMENTS TO PUSHM !!!!
ENDC
PUSHM_COUNT SET PUSHM_COUNT+1
PUSHM_\*VALOF(PUSHM_COUNT) REG \1
movem.l PUSHM_\*VALOF(PUSHM_COUNT),-(sp)
ENDM
;
;Undo most recent PUSHM
;
POPM MACRO
movem.l (sp)+,PUSHM_\*VALOF(PUSHM_COUNT)
ENDM
;----------------------------------------------------------------------------
--
|\_/| . ACK!, NAK!, EOT!, SOH!
{o O} . Bryce Nesbitt, Commodore-Amiga, Inc.
(") BIX: bnesbitt
U USENET: bryce@commodore.COM -or- uunet!cbmvax!bryce
Lawyers: America's untapped export market.