{
File : NRMAP.mc
Author : Gwan Santosa
Date : 21-Jun-85 10:28:03

}

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}


NRLMapFixB2:
	Xbus ← Rx LRot0, XwdDisp,		c3;

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

	MDR ← Rx or 10, L0Disp, GOTO[NReReadB2],	c2, at[0, 4, NRFixRFlagsB2];
	MDR ← Rx or 10, L0Disp, GOTO[NReReadB2],	c2, at[1, 4, NRFixRFlagsB2];
	MDR ← Rx or 10, L0Disp, GOTO[NReReadB2],	c2, at[2, 4, NRFixRFlagsB2];
	L1Disp, GOTO[NRWTrapB2],			c2, at[3, 4, NRFixRFlagsB2];

NReReadB2:
	Xbus ← 1, XDisp, RET[NRMapFixCallerB2],	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}
{
NWLMapFixB2:
	Xbus ← Rx LRot0, XwdDisp,	c3;
	Map ← [rhTT, TT], DISP2[NFixWFlagsB2],	c1;

	MDR ← Rx or 030, L0Disp, GOTO[NReWriteB2],	c2, at[0, 4, NFixWFlagsB2];
	MDR ← Rx or 030, L0Disp, GOTO[NReWriteB2],	c2, at[1, 4, NFixWFlagsB2];
	L1Disp, GOTO[NRWTrapB2],			c2, at[2, 4, NFixWFlagsB2];
	L1Disp, GOTO[NRWTrapB2],			c2, at[3, 4, NFixWFlagsB2];

NReWriteB2:
	Xbus ← 1, XDisp, RET[NWMapFixCallerB2],	c3;}
	
{*************************
	Read 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}

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

	MDR ← Rx or 030, L0Disp, GOTO[NRReWriteB2],	c2, at[0, 4, NFixRWFlagsB2];
	MDR ← Rx or 030, L0Disp, GOTO[NRReWriteB2],	c2, at[1, 4, NFixRWFlagsB2];
	L1Disp, GOTO[NRWTrapB2],			c2, at[2, 4, NFixRWFlagsB2];
	L1Disp, GOTO[NRWTrapB2],			c2, at[3, 4, NFixRWFlagsB2];

NRReWriteB2:
	Xbus ← 1, XDisp, RET[NRWMapFixCallerB2],	c3;

NRWTrapB2:
	DISP4[NTrapFixesB2],			c3;

	GOTO[NTrapFixesDoneB2c2],		c1, at[L1.NoFixesB2, 10, NTrapFixesB2];

	TOS ← uTOS,				c1, at[L1.RestoreTosB2, 10, NTrapFixesB2];
	TOSH ← uTOSH, GOTO[NTrapFixesDoneB2c3],	c2;
	
NTrapFixesDoneB2c2:
	,					c2;
NTrapFixesDoneB2c3:
	,					c3;

NB2CrossToPFaultc1:

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