🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #3298

Handy macros for save/restore of registers

#3298
From: Bryce Nesbitt
Date: Thu, 12 Apr 1990 14:12
47 lines
1672 bytes
;----------------------------------------------------------------------------
;
; 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.
Technical Details
Message-ID: <10826@cbmvax.commodore.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!cbmvax!bryce

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!cbmvax!bryce
From: bryce@cbmvax.commodore.com (Bryce Nesbitt)
Newsgroups: comp.sys.amiga.tech
Subject: Handy macros for save/restore of registers
Message-ID: <10826@cbmvax.commodore.com>
Date: 12 Apr 90 14:12:22 GMT
Reply-To: bryce@cbmvax.UUCP (Bryce Nesbitt)
Organization: Commodore Technology, West Chester, PA
Lines: 47