// Mcommon.d -- structures common to both machine-independent and
//		machine-dependent parts of Midas
//	Last edited: 29 November 1979

// Structure of vector used to preserve state across RunProg
// MachRunning is only word used by machine-dependent code.
structure MStatus:
[	RunProg			word	//1 if RunProg, 2 if Dtach,
					//0 afterwards
	CFileStream		word
	CFOutStream		word
	TextCmdOutStream	word
	ShowActionForm		word
	MachRunning		word
	g0			word	//extra
]


//Structure of MEMCON and REGCON tables
structure MRType:
[	RunAccess	bit	//Register/memory can be accessed while
				//machine is running; read ok if
				//Passive bit is also true; write ok
				//if PassiveWrite is also true.
	Defined		bit	//Register/memory is defined, so it can be
				//examined on the display (some regs/mems
				//are fakes used for various reasons)
	LdFlush		bit	//Flush syms in "Load" or "Dump"
	Retain		bit	//Retain syms in "LoadData"
	HasParity	bit	//Appears in PE-scan menu
	Passive		bit	//Value can be read passively
	ReadOnly	bit	//Value is read-only
	PassiveWrite	bit	//Value can be written without side effects
	MaybeAddresses	bit	//Look for symbols with SearchBlocks
	DefRadix	bit 2	//Coded 0=octal, 1=decimal, 2=hex,
	DefMode		bit 2	//0=numeric, 1=SearchBlocks, 2=symbolic
	AutoPrettyPrint	bit	//A+1, A-1 will prettyprint value
	AlwaysUpdate	bit	//Always updated on the display
	TestAll		bit	//Tested by TestAll
]

//Structure of GoVec
structure Go:
[	AVec	word 2
	Task	word
	RunP	byte
	Branch	byte
]

structure BT:		//BlockTable entry
[	Core		word
	Dirty		bit
	Kind		bit 2
	BlockAddr	bit 13
]


manifest
[
//Mouse buttons
	TopButton = #4; MiddleButton = #1; BottomButton = #2

//Number of MPD menu lines
	MaxLineN = 20

//Record file stuff needed by machine-independent code for symbol table
//and by machine-dependent code for VA/AA tables.
	IMKind = 0
	SymKind = 1
	VAKind = 2
	AAKind = 3
	NPagesPerStandardBlock = 4	//Typically 7 words/symbol
	NPagesPerHeadBlock = 1		//Roughly 6 words/symbol block
	MaxBlockPages = 200
	PageSize = 256
	MaxInCoreBlocks = 15		//Length of BlockTable
	BlockSize = NPagesPerStandardBlock*PageSize
	BlockMask = BlockSize-1		//For D0VM
	BlockShift = 10			//For D0VM (must agree with BlockSize)

//CantContinue reasons
//  machine-independent:
	didTest		= 100000B
	didLoad		=  40000B
	didPEscan	=  20000B
	didCall		=  10000B
//  machine-dependent:
	didLoadPage	=   4000B
	didBoot		=   2000B
	didIMXPE	=   1000B
	didRBusPE	=    400B
	didMemoryError	=    200B
	didStkOvf	=    100B
	didMultBP	=     40B
]

structure Bytes: [ Byte↑0,(BlockSize+BlockSize-1) byte ]