* SR_REGS.s  (PureC version)
* definition of save and restore function for registers (all except D0).
* 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.
*
*	---------------------------------------------------------------


	GLOBL save_regs, restore_regs

	TEXT
	
save_regs:
	move.l	A0, _A0_sav_area
	move.l	_sav_regs_ptr, A0
	movem.l	D1-D7/A1-A6, -(A0)
	move.l	_A0_sav_area, -(A0)
	move.l	A0, _sav_regs_ptr
	move.l	_A0_sav_area, A0
	rts

restore_regs:
	move.l	_sav_regs_ptr, A0
	move.l	(A0)+, _A0_sav_area
	movem.l	(A0)+, D1-D7/A1-A6
	move.l	A0, _sav_regs_ptr
	move.l	_A0_sav_area, A0
	rts	
	
	
	DATA

_sav_regs_ptr:
	dc.l	_sav_regs_area+16*20
	
	BSS
_A0_sav_area:
	ds.l	1
_sav_regs_area:
	ds.l	16*20
	
	
