{Page Numbers: Yes X: 500 Y: -.5" First Page: 1
Heading:
}{BurdockInitial.mcPage}
{File name: BurdockInitial.mc}

{last edit: Sturgis: 17-Jul-83 15:08:22}

{This program is a modification of SAx000Initial.mc, designed to be used during an initialization of the machine using Burdock}

{initBurdock is assembled from: Dandelion/d Boot/d CoreInitial BurdockInitial DiskDLion/d InitDLion}

{Dlion.germ is an ordinary d-lion germ}

{ the Burdock command sequence should be:

Boot[];

SetBank[0];
Load[InitBurdock];
Break[AllMarked];
Start[go,0];
Unbreak[AllMarked];

LoadGerm[Dlion];
Break[DPYOff];

Start[FindGermEnd,0];
Unbreak[DPYOff];

Reset[];

now one can continue to load the desired microcode, then

LoadIOPNoSymbols["Domino"];
Start[Germ];
StartIOP[2000];
}



{burdock germ definitions}
Set[BurdockGermBank, 1];
Set[BurdockGermBasePage, 41];

{germ definitions}
Set[germTargetBank, 0];
Set[germPageHigh, 3E]; {virtual page number of origin of germ -- 37002B}
Set[germPageLow, 2];
Set[germRequest, 0F0]; {offset in first page of germ, POINTER TO Request= LOOPHOLE[1360B]}
Set[bootPhysicalVolume, 2]; {first word of request}
Set[germDevice, 0F1]; {tells germ the boot device}
Set[germSA4000, 3];
Set[germSA1000, 2];
DoneOnceOnlyInit:

{first we mark the pages in which the Germ may be placed by Burdock}
rBrh ← BurdockGermBank, c1;
rB ← BurdockGermBasePage, c2;
rB ← rB LRot8, c3; {on 17 July 83, this results in <rBrh,rB> = <1,4100>, the first page past IO page?}


markLoop:
MAR ← [rBrh, rB+0], c1;
MDR ← rB, c2;
rB ← rB+0FF+1, c3;

[] ← rB, ZeroBr, c1;
BRANCH[$, allMarked3], c2;
GOTO[markLoop], c3;

allMarked3:
{noop} c3;

AllMarked: {Burdock plants a break point here}
{noop} c1;
GOTO[allMarked3], c2;

FindGermEnd:
rBrh ← BurdockGermBank, c1;
rB ← ~0FF, c2; {inspect <BurdockGermBank, FF00> first}
{noop} c3;

findLoop:
MAR ← [rBrh, rB+0], c1;
{noop} c2;
rC ← MD, c3;

[] ← rB xor rC, ZeroBr, c1;
BRANCH[endFound, $], c2;
rB ← rB-0FF-1, GOTO[findLoop], c3;

endFound:
{noop} c3;

rC ← BurdockGermBasePage, c1;
germStart ← rC, c2;
rB ← rB LRot8, c3; {convert to a page number}

{at this point, rB contains the page number of the last page of the Germ, within Burdock Germ Bank}
rB ← rB+1, c1;
nextPage ← rB, c2;
rCrh ← germTargetBank, c3;

rErh ← 1, c1; {map bank}
{noop} c2;
{noop} c3;

{end of the code added for Burdock, now continue with code from Sax000Initial.mc}
{the following code believes that it is moving the germ from some place in Bank 0, actually Burdock has placed the Germ in BurdockGermBank}




{move the germ out of the visible display region}
rC← nextPage, c1;
rC← rC+1, c2; {throw in an extra page}
rB← rC LRot8, c3;
rB← rB-1, c1; {last word of germ}
acR← germStart, c2;
acR← rC-acR, c3;
transferCount← acR, ZeroBr, c1; {number pages in germ}
rC← rC xor ~rC, BRANCH[moveGerm1, $], c2;
acR← bootNullGerm, GOTOABS[Maintenance1Loc], c3;
moveGerm1: germStart← rC, c3;
acR← acR LRot8, c1; {number words in germ}
Noop, c2;
[]← acR, ZeroBr, c3;
moveGerm: MAR← [rBrh, rB+0], BRANCH[$, setGermReq], c1;
germStart← rC, c2; {first word of germ}
rE← MD, c3;
MAR← [rCrh, rC+0], c1;
MDR← rE, c2;
rB← rB-1, c3;
rC← rC-1, c1;
Noop, c2;
acR← acR-1, ZeroBr, GOTO[moveGerm], c3;

setGermReq: Noop, c2;
rC← germStart, c3;
MAR← [rCrh, germRequest+0], c1;
MDR← bootPhysicalVolume, c2;
Xbus← KStatus, XwdDisp, c3;
MAR← [rCrh, germDevice+0], BRANCH[setGerm1000, $, 2], c1;
MDR← germSA4000, GOTO[setGerm1], c2;
setGerm1000: MDR← germSA1000, c2;
setGerm1: Noop, c3;
MAR← [rCrh, germDevice+1], c1;
MDR← 0, CANCELBR[restoreMap, 0], c2;

restoreMap: {noop} c3; {this code has been removed, as map is ok}

{get machine ready for the emulator, first map in the germ}
mapGerm: rE← germPageHigh, c1, at[0B, 10, subrRet];
rE← rE LRot8, c2;
rE← rE or germPageLow, c3;
acR← transferCount, c1; {number pages in germ}
rC← germStart, L0← 0, c2;
rC← rC and ~0FF, CALL[mapZap], c3;

{This enterprise maps the page before the germ (which just happens to be in the display bank) to virtual page 0FE. The germ uses this page as a disk buffer. In order to avoid losing the page initially mapped to 0FE, we first make page 0FE vacant by swapping it with the first vacant page in the map.}

{first swap entries for virtual page 0FE and page just past end (left in rE by mapZap)}
germMapped:
rB← 0FE, c1, at[0, 10, miscRet];
rE← topPage, L0← 0E, c2;
rBrh← 1, CALL[memSwap], c3;

rE← rE+1, {now the next available page in the map} c1, at[0E, 10, subrRet];
acR← germStart, {page 0FE is now unmapped} c2;
acR← acR-0FF-1, c3;
MAR← [rBrh, rB+0], c1; {map in page before germ}
MDR← acR or present, c2;
topPage← rE, GOTO[exitToEmulator], c3;