{File name:  <tajo>StartLisp12K.mc
 don 29-Dec-83 10:17:06
last modified by don    13-Mar-84 14:58:44 added logout
last modified by don    8-Feb-84 18:29:05 for LCS
last modified by don    17-Sep-85 10:01:54 Removed Kernel reserved -- use HiRes.

 }

SetTask[0];

StartAddress[Germ];

Germ:
	TT{0FF00} ← ~0FF, CANCELBR[SetMDS,0F],	c1, at[0,2,Germ];
	TT{0FF00}, CANCELBR[SetMDS,0F],	c1, at[1,2,Germ];

SetMDS:
	uFF00 ← TT,	c2;
	Rx ← 41,	c3;

	DCtl ← Rx LRot0,	c1;
	Rx ← 40,	c2;
	Rx ← Rx LRot8,	c3;

	ClrIntErr,	c1;
	IOPCtl ← IOPInMode,	c2;
	rhTT ← TT ← uIOPage,	c3;

{set all keys up; 1403D thru 14043 ← -1}
	stackP ← 0,	c1;
	TOSH ← 0,	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:
	PC ← 0+1, CANCELBR[$,0],	c2;
	uWDC ← PC,	c3;

	Rx ← 88, CANCELBR[$, 0F],	c1;
	Rx ← Rx LRot8,	c2;
	PC ← 1 + PC + PC16,	c3;

	MAR ← [rhTT, 0EB{WakeupLoc}+0],	c1;
	MDR ← 0,	c2;
	uWP ← 0,	c3;

	MAR ← [rhTT, 0EC{DBitsLoc}+0],	c1;
	MDR ← uFF00{was 0},	c2;
	Q ← 71,	c3;

	MAR ← [rhTT, 0ED{BorderLoc}+0],	c1;
	MDR ← Rx{8800} or 22,	c2;
	TOS ← LH.FMP,	c3;

	DCtl← Q LRot0,	c1;
	TOS ← TOS LRot8,	c2;
	TOS ← TOS or RH.FMP,	c3;

Stall:	MAR ← [rhTT, IOPage.MP+0], BRANCH[Stall0, StallContinue],	c1;
Stall0:	MDR ← TOS or 1, GOTO[StallJn],	c2;
StallJn:	Rx ← Rx  - 1, ZeroBr, BRANCH[Stall, StallDone],	c3;

StallContinue:
	Q ← Q - 1, ZeroBr, GOTO[StallJn],	c2;

Burdock:
	IOPCtl ← 1, CANCELBR[$, 0F],	c1;
	Rx ← 41,	c2;
	DCtl ← Rx LRot0, TOSH ← 0,	c3;

StallDone:
	TOS ← KTval, CANCELBR[$],	c1;
	Q ← 0,	c2;
	TT ← 8,				c3;

	Bank ← LispStartBank,,	c1;
	uFLmode ← TT,	c2;
	uSTATE ← 0, CROSS[LispStart],	c3;

Off:
	MAR ← [rhRx, IOPage.ProcessorCommand+0],	c1, at[LOGOUT];
	MDR{4} ←  4,	c2;
	Noop,  GOTO[Off],	c3;

	
	{END}