{File name:  MultiBankStartMesa.mc
Last Edited by :

 Makoto Udagawa	25-Feb-85 11:23:56  Delete MCtl set routine.
 Makoto Udagawa	22-Feb-85 15:35:52  Add MCtl set routine{+++}.
 Makoto Udagawa	20-Feb-85 14:46:37  Comment out "Reserve[1,7F];".
 Makoto Udagawa	29-Jan-85 15:38:12  Modify for smalltalk.
 murage.pa	 1-Feb-84 17:12:57  Fix for MultiBank machine.
 Amy Fasnacht:  30-Nov-83 14:06:28  Move rhTT out of conditional assembly
 Amy Fasnacht:  10-Nov-83 16:57:40  Change comments only
 Amy Fasnacht:  31-Aug-83  9:32:08  Move the IOPage for larger VM
 Daniels:  24-Jun-83 17:25:54  Get xtFC0 from Mesa.df
 Amy Fasnacht:  June 29, 1982  9:00 AM  Add PCtl ← 11 for LSEP
 Amy Fasnacht:  April 27, 1982  11:25 AM  Add TCtl ← 1 for mag tape
 Amy Fasnacht:  April 23, 1982  1:40 PM  Add assembly configs for MagTapeMesa
 Johnsson:  December 28, 1981  3:53 PM  Floppy boot MDS 0
 Sandman  November 13, 1981  2:33 PM  New instruction set
 Last Edited by Jim Frandeen: November 3, 1981  2:20 PM: change Display CSB for smooth scrolling. Init uWP and uPCCross in InitDLion.
 Last Edited: By Ev. Neely October 9, 1981  3:56 PM Added Trident Init under switch.
 Description: Mesa Emulator initialization,
 Author: R. Johnsson}

{Reserve[1,7F];} {Reserve[800,801];for smalltalk} Reserve[0F6F]; Reserve[0F6F]; Reserve[0F78]; Reserve[0F7F,0FFF];	{Kernel}

{Assembly Configs:

Config#		File
0	Mesa.db
1	RavenMesa.db
2	TridentMesa.db
3	TridentRavenMesa.db
4	MagTapeMesa.db
5	TridentMagTapeMesa.db}


{ - - - - begin - - - -}

Set[MyLabel1,0F79];  
Set[MyLabel2,0F7A];  
Set[MyLabel3,0F7B];  


{SetTask[0];	StartAddress[Germ];  MyFix - jmm  24-Oct-83 11:34:06}


			Noop,				c1, at[MyLabel1];
			Noop,				c2, at[MyLabel2];
			Noop,				c3, at[MyLabel3];
			
{ - - - - end - - - -}
	

{Normal boot starts at Germ, Floppy boot starts at Germ+1}
Germ:	TOS ← 0, rhMDS ← 0, CANCELBR[SetMDS,0F],		c1, at[Add[GermRumHookup,0]];{for smalltalk}
	TOS ← 0, rhMDS ← 0, CANCELBR[SetMDS,0F],		c1, at[Add[GermRumHookup,1]];{for smalltalk}

{Start at Go for Burdock loaded bootfile without germ}
Go:	TOS ← 2, rhMDS ← 2, CANCELBR[SetMDS,0F],			c1;

SetMDS:	UvMDS ← TOS,							c2;
	IOPCtl ← IOPInMode,						c3;

	uWP ← 0, ClrIntErr,						c1;

IfGreater[Config, 3, SkipTo[MagTape], ];
IfEqual[Config, 3, SkipTo[Printer], ];
IfEqual[Config, 1, SkipTo[Printer], ];

	L ← 41,								c2;
	DCtl ← L LRot0,							c3;

	Noop,								c1;
	L ← 11,								c2;
	PCtl ← L LRot0,							c3;

SkipTo[DisplayOrPrinterOrMagTape];
Printer!
	DCtl ← 2,							c2;
	PCtl ← 3,							c3;

SkipTo[DisplayOrPrinterOrMagTape];
MagTape!
	DCtl ← 2,							c2;
	TCtl ← 1,							c3;

DisplayOrPrinterOrMagTape!

MoreInit:
	UvG ← TOS ← 0,							c1;
	UBrkByte ← 0,							c2;
	TT ← uIOPage,							c3;
	
	rhTT ← IOPageHigh,						c1;
	Noop,								c2;
	Noop,								c3;

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

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

KeyDone:
IfGreater[Config, 1, , SkipTo[ShugartInit]];
IfEqual[Config, 4, SkipTo[ShugartInit],];

	PC ← 0+0+1, CANCELBR[$,0],				c2;  {Trident}
	uWDC ← PC,						c3;  {Trident}

	RCnt ← 0F,						c1;  {Trident}
	KCtl ← RCnt LRot12,					c2;  {Trident}
	KCmd ← U0400,						c3;  {Trident}

SkipTo[EitherDisk];

ShugartInit!
	KCtl ← 0, PC ← 0+0+1, CANCELBR[$,0],			c2;  {SAx000}
	uWDC ← PC,						c3;  {SAx000}

EitherDisk!

	MAR ← [rhTT, IOPage.DSCB.fieldCmd+0],				c1;
	MDR ← L{picture off, enable display request},			c2;
	T ← T + 3{@SD[sBoot]},						c3;

LastChance:
	MAR ← [rhTT, IOPage.DSCB.syncCmd+0],				c1;
	MDR ← L, rhT ← xtFC0 {picture off, enable display request},	c2;
	uDestLo ← T, YDisp, L ← 0, GOTO[XFER],				c3;