*-----------------------------------------------------------
Title[GermLoad.mc...November 23, 1982  1:29 PM...Taft];
* Pilot Germ boot sequence
*-----------------------------------------------------------

TopLevel;
DontKnowRBase;
Set[XTask, IP[EMU]];


*-----------------------------------------------------------
* Data structures, from Boot.mesa
*-----------------------------------------------------------

* Germ conventions:
MC[pageGerm, 1];		* Page where germ's image starts

* pRequest: POINTER TO Request = @SD[sFirstGermRequest];
MC[pRequest, SD, sFirstGermRequest];

* Request: TYPE = MACHINE DEPENDENT RECORD [
MC[Req.requestBasicVersion, 0];	* requestBasicVersion: CARDINAL ←
  MC[currentRequestBasicVersion, 7123];  * currentRequestBasicVersion,
MC[Req.action, 1];		* action: Action,
MC[Req.deviceType, 2];		* deviceType: Device.type,
MC[Req.deviceOrdinal, 3];	* deviceOrdinal: CARDINAL,
MC[Req.vp, 4];			* vp: SELECT OVERLAID * FROM
				*   disk => [diskFileID: DiskFileID],
				*   ethernet => [bfn, net, host: CARDINAL];

* Device.Type: TYPE = {...};
MC[DType.t80, 303];		* FIRST[Device.PilotDisk]+131
MC[DType.ethernetOne, 7];	* FIRST[Device.Ethernet]+2

* Action: TYPE = {inLoad, outLoad, bootPhysicalVolume, teleDebug, noOp};
MC[Act.bootPhysicalVolume, 2];


*-----------------------------------------------------------
* Entry conditions:
*	Real memory has been mapped contiguously at the bottom of virtual
*	memory, and zeroed.  Base registers have been set up.
*	I/O devices have been initialized and are quiescent.
* Exit conditions:
*	Germ loaded into memory and Mesa emulator started executing it.
*-----------------------------------------------------------

GermLoad:
	RBase← RBase[BTemp0];
	MemBase← IOBR;
	BootDataPtr← LShift[pageGerm!, 10]C; * Where to load it
	BTemp2← Desc.bi.germ, SCall[DiskBootSoft]; * What to load
GermBootFailed:
	 Breakpoint, Branch[.];		* +1: boot failed

* Store into the Germ the magic values that tell it what to do.
	T← HighByte[pRequest];		* Set up the Request
	T← T OR (LowByte[pRequest]);
	BTemp0← HighByte[currentRequestBasicVersion];
	BTemp0← (BTemp0) OR (LowByte[currentRequestBasicVersion]);
	T← (Store← T)+1, DBuf← BTemp0;	* Req.requestBasicVersion
	T← (Store← T)+1, DBuf← Act.bootPhysicalVolume; * Req.action
	T← (Store← T)+1, DBuf← DType.t80; * Req.deviceType
	Store← T, DBuf← 0C,		* Req.deviceOrdinal
		Branch[MesaInitialize];	* Go start it up!