{File name:  Protected.mc
 Description: Protected microcode for Initial,
 Author: Jarvis,
 Created: December 5, 1980,
 Last Edited: Jarvis, March 23, 1981  9:52 AM}

Set[OverlayStart, Add[ProtectFence, 1]];

Reserve[OverlayStart, 0FFF];

SetTask[0];

{clobber only rC before going to external fault handler}

Trap:	rC ← RRot1 ErrnIBnStkp, ClrIntErr, CANCELBR[$, 0F],	c1, at[0];
	[] ← passTraps, ZeroBr,					c2;
	BRANCH[$, Trap1],					c3;
	GOTOABS[ErrorHandlerLoc],				c1; {pass the trap on}
Trap1:	acR ← bootTrap, GOTO[catchAll2],			c1;

catchAll1:	Noop,						c1, at[Maintenance1Loc];
catchAll2:	Noop,						c2, at[Maintenance2Loc];
catchAll3:	rB ← 0, rBrh ← 0,				c3, at[Maintenance3Loc];
	MAR ← [rBrh, rB+1],					c1;
	MDR ← acR and 0FF, CANCELBR[$, 0],			c2;
	IOPCtl ← IOPInMode,					c3; {enable IOP}
infinite:	GOTO[infinite],					c*, at[IdleLoc];

SetTask[1];  StartAddress[Refresh];

Refresh:	Refresh, CANCELBR[$, 0F],			c1;
	Noop,							c2;
	Noop,							c3;
	Refresh,						c1;
	Noop,							c2;
	ClrDPRq, GOTO[Refresh],					c3;