{File: otMapBank0.mc

	 1-Aug-84 18:27:13      

Lase Edited by
T.Tokunaga   9-Apr-85 10:15:47  add otMap1Bank0 routine 
Makoto Udagawa 16-Mar-85 17:38:35  otMap routine for Bank0.
Makoto Udagawa 28-Feb-85 15:13:55  Comment out Leaf check for Extended memory.
}





	
{

 inputs - otLow is the oop whose mapping is desired -- better not supply a SmallInteger --,
 	  L1 is the return linkage register
 output - high portion of address is returned in temp1High, low portion in temp1Low
 
 }
 
 
 
 
 
 {todo --- put in a check and trap for trying to otMapBank0 lambda!}
	otMapBank0:
	
  IfEqual[otMapDebug, debug,,SkipTo[endOtMapBank0Debug]];	
  
		{some debugging code to ensure that the oop is even}
		Ybus ←  otLow, YDisp,							c1;
		BRANCH[goodOop-otMapBank0, badOop-otMapBank0, 0e],			c2;
		
	badOop-otMapBank0:
		GOTO[bailoutBank0],							c3;
	
	goodOop-otMapBank0:
		Noop,									c3;
  endOtMapBank0Debug!
  		
		{the real code for otMapBank0 starts here}
		
		  {we can get by with the + 1 because a page cross is impossible --
		   the OT entry must be at an even address, and only incrementing an
		   odd address can cause a page fault}
		MAR ← [otHigh, otLow + 1],						c1;
		CANCELBR[$,2],								c2;
		temp1High ← MD,{ XLDisp {check if this object is a leaf},}		c3;
					
		MAR ← [otHigh, otLow + 0], {BRANCH[$,isLeaf-otMapBank0,1],}			c1;
		L1Disp {this is not a leaf},						c2;
		temp1Low ← MD, RET[otMapBank0-return],					c3;
		
	
   {Loom: needs to punt to Mesa to handle this leaf}
				
{	isLeaf-otMapBank0:
		GOTO[bailout3Bank0],								c2; }			
		
		
		
		
		



{todo --- put in a check and trap for trying to otMapBank0 lambda!}
	otMap1Bank0:
	
  IfEqual[otMapDebug, debug,,SkipTo[endOtMap1Bank0Debug]];	
  
		{some debugging code to ensure that the oop is even}
		Ybus ←  otLow, YDisp,							c1;
		BRANCH[goodOop-otMap1Bank0, badOop-otMap1Bank0, 0e],			c2;
		
	badOop-otMap1Bank0:
		GOTO[bailoutBank0],							c3;
	
	goodOop-otMap1Bank0:
		Noop,									c3;
  endOtMap1Bank0Debug!
  		
		{the real code for otMap1Bank0 starts here}
		
		  {we can get by with the + 1 because a page cross is impossible --
		   the OT entry must be at an even address, and only incrementing an
		   odd address can cause a page fault}
		MAR ← [otHigh, otLow + 1],						c1;
otMap1Bank01:
		CANCELBR[$,2],								c2;
		temp1High ← MD,{ XLDisp {check if this object is a leaf},}		c3;
					
		MAR ← [otHigh, otLow + 0], {BRANCH[$,isLeaf-otMap1Bank0,1],}			c1;
		L1Disp {this is not a leaf},						c2;
		temp1Low ← MD, RET[otMap1Bank0-return],					c3;
		
	
   {Loom: needs to punt to Mesa to handle this leaf}
				
{	isLeaf-otMap1Bank0:
		GOTO[bailout3Bank0],								c2; }