/* --- Copyright University of Sussex 1994. All rights reserved. ----------
 > File:			S.axpvms/src/asm.ph
 > Purpose:			Include file for .s files
 > Author:			John Gibson, Sep 20 1994
 */

#_INCLUDE 'declare.ph'
#_INCLUDE 'registers.ph'

define :inline lconstant FIELD_lb(_offs);
	lblock
		lvars (b, l) = _pint(_offs) // 4;
		_int(l<<2), _int(b)
	endlblock
enddefine;

define :inline lconstant REGNAME(reg=item);
	'r' sys_>< reg
enddefine;

lconstant macro (
	rt0		= REGNAME(RGt0),
	rt1		= REGNAME(RGt1),
	rt2		= REGNAME(RGt2),
	rt3		= REGNAME(RGt3),
	rt4		= REGNAME(RGt4),
	rt5		= REGNAME(RGt5),
	rt6		= REGNAME(RGt6),

	rpl0	= REGNAME(RGpl0),
	rpl1	= REGNAME(RGpl1),
	rpl2	= REGNAME(RGpl2),
	rpl3	= REGNAME(RGpl3),
	rpl4	= REGNAME(RGpl4),
	rpl5	= REGNAME(RGpl5),
	rpl6	= REGNAME(RGpl6),
	rpl7	= REGNAME(RGpl7),
	rpl8	= REGNAME(RGpl8),
	rpl9	= REGNAME(RGpl9),
	rpl10	= REGNAME(RGpl10),

	rnpl0	= REGNAME(RGnpl0),
	rnpl1	= REGNAME(RGnpl1),
	rnpl2	= REGNAME(RGnpl2),
	rnpl3	= REGNAME(RGnpl3),
	rnpl4	= REGNAME(RGnpl4),

	rfalse	= REGNAME(RGfalse),
	rsvb	= REGNAME(RGsvb),
	rusp	= REGNAME(RGusp),
	rchain	= REGNAME(RGchain),
	rret	= REGNAME(RGret),
	rpb		= REGNAME(RGpb),
	rzero	= REGNAME(RGzero),

	_TRUEOFFS		= @@(struct BOOLEAN)++,

	_KEY			= @@KEY,
	_K_APPLY		= @@K_APPLY,
	_RF_CONT		= @@RF_CONT,
	_PD_EXECUTE		= @@PD_EXECUTE,
	_PD_EXIT		= @@PD_EXIT,
	_PD_UPDATER		= @@PD_UPDATER,
	_P_BACK			= @@P_BACK,
	_P_FRONT		= @@P_FRONT,
	_SF_OWNER		= @@SF_OWNER,
	_SF_RETURN_ADDR	= @@SF_RETURN_ADDR,
	_V_BYTES		= @@V_BYTES,

	(_PD_FRAME_LEN_l, _PD_FRAME_LEN_b)
					= FIELD_lb(@@PD_FRAME_LEN),

	_svb_FALSE			= [_SVB_OFFS(false)(rsvb)],
	_svb_SAVED_SP		= [_SVB_OFFS(Sys$-Extern$- _saved_sp)(rsvb)],
	_svb_SAVED_USP		= [_SVB_OFFS(Sys$-Extern$- _saved_usp)(rsvb)],
	_svb_IN_USER_EXTERN	= [_SVB_OFFS(Sys$- _in_user_extern)(rsvb)],
);

define lconstant macro INIT_POP_REGISTERS;
	lvars n;
	for n from 0 to 10 do
		[\t	mov \t	rfalse, %consword('rpl'><n)% \n ].dl
	endfor
enddefine;
