{File name:  StartLisp4K.mc
 don 29-Dec-83 10:17:06
 }

Reserve[0F6F]; Reserve[0F78]; Reserve[0F7F,0FFF];	{Kernel}

SetTask[0];

StartAddress[Germ];

Germ:
	rhTT ←  0, CANCELBR[SetMDS,0F],	c1, at[0,2,Germ];
	rhTT ←  0, CANCELBR[SetMDS,0F],	c1, at[1,2,Germ];

SetMDS:
	TT ← 0FF,	c2;
	TT{0FF00} ← TT LRot8,	c3;

	Rx ← 40,	c1;
	Rx ← Rx LRot8,	c2;
	uPageFault ← 0{notFaulting},	c3;

	Map ← [rhTT,TT],	c1;
	MDR ← Rx{4000} or {0B1}31,	c2;
	Q ← 0,	c3;

	L ← 41,	c1;
	IOPCtl ← IOPInMode,	c2;
	DCtl ← L LRot0,	c3;

	uWP ← 0, ClrIntErr,	c1;
	TOS ← 0, rhMDS ← 0	c2;
	rhTT ← TT ← uIOPage,	c3;

{set all keys up; 1403D thru 14043 ← -1}
	stackP ← 0,	c1;
	T ← 0FF LShift1, SE ← 1,	c2;
	Q ← 7,	c3;

KeyLoop:	MAR ← [rhTT,IOPage.keyBitsm1+Q], BRANCH[$,KeyDone],	c1;
	MDR ← L xor ~L, CANCELBR[$,0],	c2;
	Q ← Q - 1, ZeroBr, GOTO[KeyLoop],	c3;

KeyDone:
	KCtl ← 0, PC ← 0+0+1, CANCELBR[$,0],	c2;
	uWDC ← PC,	c3;

	MAR ← [rhTT, IOPage.DSCB.fieldCmd+0],	c1;
	MDR ← L,	c2;
	T ← T + 3,	c3;

LastChance:
	MAR ← [rhTT, IOPage.DSCB.syncCmd+0],	c1;
	MDR ← L,	c2;
	L ← 0, GOTO[EFCHaveLink],	c3;