{File name LispMapB2.mc
Created: 24-Apr-84 10:00:25 
}

SetTask[0];

{*************************
	Read Map Update Subroutine 
**************************}
{Timing: 4 cycles}
{Enter at cycle 3, returns to cycle1}
{returns thru L0 if map fixed ok}
{returns thru L1 if wants to trap}


RLMapFixB2:
	Xbus ← Rx LRot0, XwdDisp,	c3;

	Map ← [rhTT,TT], DISP2[RFixRFlagsB2],	c1;

	MDR ← Rx or 10, L0Disp, GOTO[ReReadB2],	c2, at[0, 4, RFixRFlagsB2];
	MDR ← Rx or 10, L0Disp, GOTO[ReReadB2],	c2, at[1, 4, RFixRFlagsB2];
	MDR ← Rx or 10, L0Disp, GOTO[ReReadB2],	c2, at[2, 4, RFixRFlagsB2];
	L1Disp, GOTO[RWTrapB2],	c2, at[3, 4, RFixRFlagsB2];

ReReadB2:
	Xbus ← 1, XDisp, RET[RMapFixCallerB2],	c3;

{*************************
	Write Map Update Subroutine 
**************************}
{Timing: 4 cycles}
{Enter at cycle 3, returns to cycle1}
{returns thru L0 if map fixed ok}
{returns thru L1 if wants to trap}

WLMapFixB2:
	Xbus ← Rx LRot0, XwdDisp,	c3;
	Map ← [rhTT, TT], DISP2[FixWFlagsB2],	c1;

	MDR ← Rx or 030, L0Disp, GOTO[ReWriteB2],	c2, at[0, 4, FixWFlagsB2];
	MDR ← Rx or 030, L0Disp, GOTO[ReWriteB2],	c2, at[1, 4, FixWFlagsB2];
	L1Disp, GOTO[RWTrapB2],	c2, at[2, 4, FixWFlagsB2];
	L1Disp, GOTO[RWTrapB2],	c2, at[3, 4, FixWFlagsB2];

ReWriteB2:
	Xbus ← 1, XDisp, RET[WMapFixCallerB2],	c3;

RWTrapB2:
	DISP4[TrapFixesB2],	c3;

	GOTO[TrapFixesDoneB2c2],	c1, at[L1.NoFixesB2, 10, TrapFixesB2];

	TOS ← uTOS,	c1, at[L1.RestoreTosB2, 10, TrapFixesB2];
	TOSH ← uTOSH, GOTO[TrapFixesDoneB2c3],	c2;

{	GOTO[DLFix],	c1, at[L1.DLFixesB2, 10, TrapFixesB2];}
{	GOTO[FFTFix],	c1, at[L1.FFTFixesB2, 10, TrapFixesB2];}

TrapFixesDoneB2c2:
	,	c2;
TrapFixesDoneB2c3:
	,	c3;

B2CrossToPFaultc1:
	Bank ← EmuBank,	c1;
	L1 ← L1.NoFixes,	c2;
	CROSS[PFaultB1],	c3;

ufnZ3:
	,	c3;
ufnZ1:
	,	c1;
ufnZ2:
	TOS ← uTOS,	c2;
	TOSH ← uTOSH, GOTO[ufnX1],	c3;

ufnX2:
	,	c2;
ufnX3:
	,	c3;

ufnX1:
	Bank ← EmuBank,	c1;
	,	c2;
	S ← S + 1, CROSS[ufnB1],	c3;

OpTable:
	Bank ← EmuBank,	c1, at[OpcodeBase];
	,	c2;
	CROSS[OpcodeBase],	c3;

	{ E N D }