{NewMLisp12K.mc
created by cal:   5-Nov-84 15:59:32
}

{*****************************************************************************
	BITBLT
*****************************************************************************}
@BBLT:	opcode[166'b],
	Bank ← 2,	c1;
	,	c2;
	CROSS[BBEntry],	c3;

	PC ← PC + PC16{***1}, GOTO[IBDispOnly]	,c1, at[BBExit];
IBDispOnly:
	IBDisp, L2 ← L2.0,	c2;
	TOSH ← smallpl, L2 ← L2.0, DISPNI[OpTable],	c3;

{*****************************************************************************
	MISC	Input
*****************************************************************************}

@MISC1:	opcode[170'b],
	L2 ← L2.0, GOTO[Misc],	c1;
@MISC2:	opcode[171'b],
	L2 ← L2.0,	c1;
Misc:	PC ← PC + 1, Xbus ← ib, XDisp,	c2;
	uTOS ← TOS, YDisp, DISP4[MiscDisp, 0C],	c3;

Misc0:	Q ← 121'd, CANCELBR[sink2, 0F],	c1, at[0C,10, MiscDisp];{MP9121}
Misc3:	Q ← 121'd, CANCELBR[sink2, 0F],	c1, at[0F,10, MiscDisp];{MP9121}

{*****************************************************************************
	INPUT	Input
*****************************************************************************}

INPUT:	TOSH ← smallpl, DISP4[MiscIn],	c1, at[0D,10, MiscDisp];
	TOS ← EIData, IBDisp, L2 ← L2.0, GOTO[MiscInEnd],	c2, at[0,10,MiscIn];
	TOS ← EStatus, IBDisp, L2 ← L2.0, GOTO[MiscInEnd],	c2, at[1,10,MiscIn];
	TOS ← KIData, IBDisp, L2 ← L2.0, GOTO[MiscInEnd],	c2, at[2,10,MiscIn];
	TOS ← KStatus, IBDisp, L2 ← L2.0, GOTO[MiscInEnd],	c2, at[3,10,MiscIn];
	TOS ← uSTATE, IBDisp, L2 ← L2.0, GOTO[MiscInEnd],	c2, at[4,10,MiscIn];
	TOS ← MStatus, IBDisp, L2 ← L2.0, GOTO[MiscInEnd],	c2, at[5,10,MiscIn];
	TOS ← KTest, IBDisp, L2 ← L2.0, GOTO[MiscInEnd],	c2, at[6,10,MiscIn];
	{TOS ← PPort}Q ← 122'd, GOTO[sink3],	c2, at[7,10,MiscIn];
	TOS ← VersionHi, GOTO[MiscVers],	c2, at[8,10,MiscIn];
	{**}{Q ← 122'd, GOTO[sink3],	c2, at[09,10,MiscIn];}{MP9122}
	{Q ← 122'd, GOTO[sink3],	c2, at[0A,10,MiscIn];}{MP9122}
	TOS ← uFLmode, IBDisp, L2 ← L2.0, GOTO[MiscInEnd],	c2, at[0B,10,MiscIn];
	Q ← 122'd, GOTO[sink3],	c2, at[0C,10,MiscIn];{MP9122}
	Q ← 122'd, GOTO[sink3],	c2, at[0D,10,MiscIn];{MP9122}
	Q ← 122'd, GOTO[sink3],	c2, at[0E,10,MiscIn];{MP9122}
	Q ← 122'd, GOTO[sink3],	c2, at[0F,10,MiscIn];{MP9122}
MiscInEnd:
	TOSH ← smallpl, L2 ← L2.0, DISPNI[OpTable],	c3;

MiscVers:
	TOS ← TOS LRot8,	c3;
	TOS ← TOS or VersionLo,	c1;
	IBDisp, L2 ← L2.0, TOS ← TOS or 1, GOTO[MiscInEnd],	c2;


{*****************************************************************************
	OUTPUT	Output
*****************************************************************************}

OUTPUT:
	MAR ← S ← [rhS, S + 0], Xbus ← uTOS, XDisp, CANCELBR[$, 0F],	c1, at[0E,10, MiscDisp];
	S ← S - 2, DISP4[MiscOut],	c2;

	{**}{IOPOData ← MD, GOTO[OutEnd],	c3, at[0,10,MiscOut];}
	IOPCtl ← MD, GOTO[OutEnd],	c3, at[1,10,MiscOut];
	{**}{KOData ← MD, GOTO[OutEnd],	c3, at[2,10,MiscOut];}
	TT ← MD, GOTO[OutSetFPmode],	c3, at[2,10,MiscOut];
	KCtl ← MD, GOTO[OutEnd],	c3, at[3,10,MiscOut];
	EOData ← MD, GOTO[OutEnd],	c3, at[4,10,MiscOut];
	EICtl ← MD, GOTO[OutEnd],	c3, at[5,10,MiscOut];
	DCtl ← MD, GOTO[OutEnd],	c3, at[6,10,MiscOut];
	TT ← MD, GOTO[OutSetBBTime],	c3, at[7,10,MiscOut];
	TT ← MD, GOTO[OutSetOpt],	c3, at[8,10,MiscOut];
	PCtl ← MD, GOTO[OutEnd],	c3, at[9,10,MiscOut];
	TT ← MD, GOTO[OutMCtl],	c3, at[0A,10,MiscOut];
	{**}{   Q ← 120'd, GOTO[sink1],		c3, at[0B,10,MiscOut];}{MP9120}
	EOCtl ← MD, GOTO[OutEnd],	c3, at[0C,10,MiscOut];
	KCmd ← MD, GOTO[OutEnd],	c3, at[0D,10,MiscOut];
	TT ← MD, GOTO[OutPPort],	c3, at[0E,10,MiscOut];
	POData ← MD, GOTO[OutEnd],	c3, at[0F,10,MiscOut];

OutSetFPmode:
	uFLmode ← TT, GOTO[IB.nop],	c1;
OutSetBBTime:
	uBBTime ← TT, GOTO[IB.nop],	c1;
OutEnd:
	Noop, GOTO[IB.nop],	c1;
OutPPort:
	PPort ← TT, GOTO[IB.nop],	c1;
OutSetOpt:
	uLispOptions ← TT, GOTO[IB.nop],	c1;
OutMCtl:
	MCtl ← TT, GOTO[IB.nop],	c1;

{*******************************************************************
	READPRINTERPORT		3 clicks
*******************************************************************}
@READPRINTERPORT:	opcode[164'b],
	MAR ← S ← [rhS, S + 1],	c1;
ReadRet:
	MDR ← TOSH, S ← S + 1, BRANCH[$, ReadCarry, 1],	c2;
	Ybus ← S xor uStkLimO, ZeroBranch,	c3;

	MAR ← [rhS, S + 0], BRANCH[$, ReadStkLim],	c1;
	MDR ← TOS,	c2;
	TOSH ← smallpl,	c3;

	TOS ← PPort, GOTO[IB.pc1],	c1;

{page cross:}
ReadCarry:	S ← S + 0FF,	c3;
	MAR ← [rhS, S + 0], GOTO[ReadRet],	c1;

{Stack Limit:}
ReadStkLim:	MDR ← TOS, 	c2;
	TOSH ← smallpl,	c3;

	TOS ← PPort,	c1;
	,	c2;
	PC ← PC + PC16, GOTO[StackOverflow],	c3;

{*******************************************************************
	WRITEPRINTERPORT		1 click
*******************************************************************}
@WRITEPRINTERPORT:	opcode[165'b],
	PPort ← TOS, L2 ← L2.0,	c1;
	PC ← PC + PC16, IBDisp,	c2;
	uPPsave ← TOS, L2 ← L2.0, DISPNI[OpTable],	c3;


{*******************************************************************}
logout:	TT ← 55{password to mesa},	c2;
	uLispBootMsg ← TT,	c3;

	Bank ← LOGOBank ,	c1;		{MPL  1-Jan-84 13:20:12 Changed for Domino 10}
	TT ← 0,	c2;
	rhRx ← Rx ← uIOPage, CROSS[LOGOUT]	c3;

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

Burdx:
	Rx ← 41, CANCELBR[$, 0F],	c1;
	DCtl ← Rx LRot0,	c2;
	IOPCtl ← 1, GOTO[Reset],	c3;

	{ E N D }