*-----------------------------------------------------------
Title[RegisterDefs.mc...January 27, 1984  10:32 AM...Taft];
* This file contains all RMRegion assignments for the Alto Emulator and
* I/O tasks, and register assignments that are used in multiple source files
* or that occupy shared RMRegions.
*-----------------------------------------------------------

* Note that in many cases, only the RMRegion name is declared here.
* Registers within the region are defined within the module in which
* they are used:
*	SetRMRegion[regionName];
*	RVN[regName0];
*	...

* Macro to define synonyms for RM locations: RME[newName, oldName];
M[RME, RM[#1, IP[#2]]];

*-----------------------------------------------------------
* Region 0 -- IFU-addressable
RMRegion[RMForIFU];		* Reserved for IFU-based emulators
*-----------------------------------------------------------
:If[Not[AltoMode]];	******** PrincOps version ********
	RVN[NWW];		* New Wakeups Waiting
:EndIf;			**********************************
* Other registers defined in DMesaDefs.mc (for Mesa)


*-----------------------------------------------------------
* Region 1 -- IFU-addressable
RMRegion[AEmRegs]; 		* AltoEmulator Registers
Set[rbAemRegs, 1];
*-----------------------------------------------------------
	RVN[R400];		* Constant 400 -- must be first

:If[AltoMode];		********** Alto version **********
	RVN[Cry];		* Carry (must be all zeroes or all ones)
	RVN[RCode];		* Copy of low 16 bits of IFU base register
	RVN[NWW];		* New Wakeups Waiting
	RVN[spAC0];		* StkP value that addresses AC0
	RVN[spAC1];		* StkP value that addresses AC1
	RVN[spAC2];		* StkP value that addresses AC2
	RVN[spAC3];		* StkP value that addresses AC3
	RVN[EmuBRHiReg];	* holds hi bits of emulator normal space
	RVN[EmuXMBRHiReg];	* holds hi bits of emulator alternate space
:Else;			******** PrincOps version ********
	Reserve[11];		* Reassigned for other purposes (Mesa, Initial)
:EndIf;			**********************************

	RVN[ETemp0]; RME[ETemp, ETemp0]; * Emulator temporaries
	RVN[ETemp1];
	RVN[ETemp2];
	RVN[ETemp3];
	RVN[ETemp4];		* 16 must be a temporary (for DivSub)
	RVN[Temp17];		* temp for MulSub and DivSub - must be 17b

* Aliases for LoadRam.  Note that these must never change, even if the above
* registers are shuffled around, since the LoadRam microcode is blown into EPROMs.
* Furthermore, it is to the caller's benefit to arrange to overlay LoadRam's
* registers with its own temporaries.

SetRMRegion[AEmRegs];
	Reserve[12];
	RVN[LRFlag];		* RM 32: flag word passed to LoadRam
	RVN[LRTemp0];		* RM 33: temporary
	RVN[LRTemp1];		* RM 34:
	RVN[LRItem];		* RM 35: ending address returned by LoadRam
	RVN[LRTemp2];		* RM 36:

*-----------------------------------------------------------
* Region 2
RMRegion[BBRegs];		* BitBlt registers
* Individual RM locations defined in BitBlt.mc.
* This region may be re-used by any other emulator-level microcode requiring
* an entire region of temporary storage and no permanent storage.
*-----------------------------------------------------------


*-----------------------------------------------------------
* Region 3
RMRegion[EIRegs];
*-----------------------------------------------------------
	Reserve[4];		* Ethernet input task registers

	RVN[FltPipe0];		* Information left by fault task
	RVN[FltPipe1];
	RVN[FltPointers];
	RVN[FltErrors];
	RVN[FaultVal];
	RVN[FaultMapVal];
	RVN[FaultInfo];
	RVN[FltMemPtr];
	RVN[FltTemp];		* one always needs a temp
	RVN[FltEmuPC];


*-----------------------------------------------------------
* Region 4
RMRegion[EORegs];
*-----------------------------------------------------------
	Reserve[7];		* Ethernet output task registers

	RVN[AUTPC];		* Request PC for Asynchronous Utility Task

	RVN[VirtualBanks];	* Size of virtual memory in units of 64K words
	RVN[RealPages];		* Size of real memory in pages

* Remaining registers are used as temps by InitMem.mc (only during initialization).


*-----------------------------------------------------------
* Region 5
RMRegion[DiskRegs];		* disk registers
*-----------------------------------------------------------
:If[AltoMode];		********** Alto version **********
	RVN[DefaultPartition];	* Default disk partition
	RVN[MaxPartition];	* Maximum legal partition
:EndIf;			**********************************

* Remaining registers are defined in DiskDefs.mc

*-----------------------------------------------------------
* The following 2 regions are for Alto terminal emulation.
* Region 6
RMRegion[TWTRegion];		* Terminal word task registers
* Individual RM locations defined in DisplayDefs.mc
*-----------------------------------------------------------

*-----------------------------------------------------------
* Region 7
RMRegion[THTRegion];		* Terminal horizontal task registers
* Individual RM locations defined in DisplayDefs.mc
*-----------------------------------------------------------


*-----------------------------------------------------------
* The following 3 regions are for special displays, NOT for Alto
* terminal emulation.
* Region 10
RMRegion[AChannelRegion];	* Display A-channel registers
* Individual RM locations defined in DisplayDefs.mc
*-----------------------------------------------------------
* AChannelRegion must be assigned an RBase value with zero in bit 2.
* BChannelRegion must equal AChannelRegion, but with one in bit 2.

*-----------------------------------------------------------
* Region 11
RMRegion[DHTRegion];		* Display horizontal task (DHT) registers
* Individual RM locations defined in DisplayDefs.mc
*-----------------------------------------------------------

*-----------------------------------------------------------
* Region 12
RMRegion[BChannelRegion];	* Display B-channel registers
* Individual RM locations defined in DisplayDefs.mc
*-----------------------------------------------------------


*-----------------------------------------------------------
* Region 13
RMRegion[Events];		* Junk task -- clock and event counters
* Registers defined here because lots of people look at RTC430.
*-----------------------------------------------------------
	RVN[RTClock];		* Real-time clock
	RVN[RTCDeltaLo];	* Constant delta for DDA increment
	RVN[RTC430];		* Copy of VM 430
:If[AltoMode];		********** Alto version **********
	RVN[RTCFrac];		* Low part of DDA fraction
:Else;			******** PrincOps version ********
	RVN[WakeupTime];	* RTClock value at which wakeup is to occur
:EndIf;			**********************************

	RVN[EventAHi0];		* Event counter shadow registers
	RVN[EventAHi1];
	RVN[EventALo];
	RVN[EventAPrev];
	RVN[EventBHi0];
	RVN[EventBHi1];
	RVN[EventBLo];
	RVN[EventBPrev];
	RVN[EventUpdateTimer];

	RVN[EventTemp0];	* Used only by emulator task
	RVN[EventTemp1];	* Used only by emulator task
	RVN[JunkTemp];		* Used only by junk task


*-----------------------------------------------------------
* Unused regions -- declare so that non-standard microcode can refer to them.
RMRegion[Region14];
RMRegion[Region15];
RMRegion[Region16];
RMRegion[Region17];
*-----------------------------------------------------------