/*
 *	sav_regs.h
 *
 *	Copyright (c) 1991 by Markus Nick
 *	
	---------------------------------------------------------------

	This program is distributed in the hope that it will be useful, 
	but WITHOUT ANY WARRANTY; without even the implied warranty of 
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
	documentation `docs\ruby.tex' for more details.

	---------------------------------------------------------------
 *
 *	Definitionen fr save_regs() und return_restore_regs() passend 
 *	fr die untersttzten Compiler.  Wird fr die USERBLK-Routinen 
 *	ben”tigt.
 *
 *	Dieser Source ist Teil von Ruby.  Ruby ist Freeware. Es gelten 
 *	die in der Dokumentation `docs\ruby.tex' aufgefhrten 
 *	Lizenzbedingungen.
 *
 *	Autoren:		Markus M. Nick
 *		
 *	History:
 *	04.04.92 mmn v1.0	Source aus ruby.c extrahiert.
 *
 */

#ifdef MEGAMAX
#define	save_regs()			asm{ movem.l D1-D7/A0-A6,-(A7) }
#define return_restore_regs(value)	\
							asm{ movem.l (A7)+,D1-D7/A0-A6 }	\
							return(value)
#endif

#ifdef __GNUC__
/* GNU-CC automatically saves the registers! */
#define	save_regs()	/*({asm("moveml d1-d7/a0-a6, sp@-");})*/
#define	return_restore_regs(value)		return(value)
			/*(({	mcl_new_state = (value);	\
			 	asm("moveml sp@+, d1-d7/a0-a6
		 			 movl mcl_new_state, d0"); }) *, mcl_new_state*)*/
#endif

#ifdef __TURBOC__
volatile void save_regs _((void));
volatile int restore_regs _((int value));
	/* ^ without handing value through `restore_regs()', TC code will
		crash behind `restore_regs()' while trying to access `mcl_new_state' 
		or something like that */
#define	return_restore_regs(value)	return restore_regs(value)
#endif
