// MDfields.d -- microinstruction field definitions for MicroD
// last edited July 5, 1980  8:22 AM

// Note: the real microinstruction must be the first part of the IM structure
// I.e. TI must line up with IM

structure TI :	// Dorado target instruction
[
	iw0 word
	// Dorado
	= [	RSTK bit 3	// RM address or stack control
		ALUF bit 4	// ALU function
		BSEL bit 3	// BMux selection
		LC bit 3	// T← and R← control
		ASEL bit 3	// AMux selection
	  ]
	// D0
	= [	blank bit 12
		F1 bit 4	// newpage relevant if =F1swpageV0
	  ]

	iw1 word
	// Dorado
	= [	BLOCK bit 1	// BLOCK or stack selection bit
		FF bit 8	// Function, constant, or extension for branch address
		JCN bit 7	// Jump control and address
		// model 0
		= [ JClocal bit 1; JNlocal bit 6 ]
		= [ JClong bit 3; JNlong bit 4 ]
		= [ JCglobal bit 3; JNglobal bit 4 ]
		= [ JCfast bit 2; JCcond0thru1 bit 2; JNfast bit 2; JCcond2 bit 1 ]
		// model 1
		= [ JC1local bit 2; JN1local2thru6 bit 5 ]
		= [ JC1global bit 2; JN1global2thru6 bit 5 ]
		= [ JC1long bit 4; JN1long4thru6 bit 3 ]
		= [ JC1fast bit 1; JN1fast2thru3 bit 2; JN1fast5thru6 bit 2; JC1cond0thru1 bit 2 ]
	  ]
	// D0
	= [	blank bit 2
		newpage bit 4	// new page # (F2) if swpage set
		blank bit 3
		JA2thru7 bit 6	// low 6 bits of JA
		= [	JA2thru6 bit 5	// for conditionals (JA7 extends JC)
			blank bit 1
		  ]
		parity0 bit 1	// odd parity bit
	  ]

	iw2 word
	// Dorado model 1
	= [	RSTK1top bit 1	// Top bit of RSTK
		JN1bit7 bit 1	// Bottom bit of JN
			= JC1cond2 bit 1	// Bottom bit of JC condition
		brkP1 bit 2	// Breakpoint (bad parity) bits
		blank bit 12
	  ]
	// Dorado model 0 -- not used
	// D0
	= [	blank bit 2
		JA0thru1 bit 2	//0   D top 2 bits of JA
		blank bit 12
	  ]
]


manifest	// JCN format values
[	// Dorado model 1
	JC1localV = 2
	JC1longV = 0
	JC1globalV = 3
	JC1fastV = 0
	// Dorado model 0
	JClocalV = 0	// put in JClocal for a local branch
	JClongV = 5	// put in JClong for a long branch
	JCglobalV = 4	// put in JCglobal for a global call
	JCfastV = 3
]

manifest	// JN fields for external ref.s in .MB file
[	JNfield0 = (offset TI.JA2thru7)*401b+size TI.JA2thru7-1	// D0
	JNfield1 = (offset TI.JNlong)*401b+size TI.JNlong-1	// Dorado 0
	JNfield2 = (offset TI.JN1long4thru6+1)*401b+size TI.JN1long4thru6	// Dorado 1
		// field is 1 bit over (because of RSTK0) and 1 bit longer (because of JN1bit7)
]

manifest	// values for other fields -- D0
[	// F1
	F1newpageV0 = 5	// newpage relevant if F1=this
]


// IFUM layout

structure TIFUM:
[	PA bit 6	// only uses low bit
	notIFADr2 bit 10	// not (address rshift 2)

	iw1 word
	= [	Sign bit 1
		IPar bit 3
		notLength bit 2
		notRBaseB bit 1
		MemB bit 3
		notTPause bit 1
		notTJump bit 1
		N bit 4
	  ]
]