; D0Tables.Asm -- Midas/D0 machine description tables
;	Last edited: 20 October 1981

.get "d0regmem.d"

; MMPRGN
.bext RDatatoCSS,MDatatoCSS,BadAltIn

; D0PRIN0
.bext PrinCYCLECONTROL,PrinParity,PrinBootReason,PrinALUResult
.bext PrinSALUF,PrinMNBR,PrintMADDR,PrinAATOVA,PrintMAP,PrinTask
.bext PrintWrdByt,PrinIMAddr	; APC, CIA, CALLER, RETURN, TPC

; D0PRIN1
.bext PrinIM		; Instruction

; D0TYPEIN
.bext InstructionIn,WrdBytIn

; Defined here
.bextz MEMNAM,MEMFORMS,MEMWID,MEMLEN,MEMCON,NMEMS
.bext AltMForms,AltMInput
.bextz REGNAM,REGFORMS,REGWID,REGCON,NREGS
.bext AltRForms,AltRInput

.txtm B

.srel

AltMForms:	.AltMForms
AltRForms:	.AltRForms
AltMInput:	.AltMInput
AltRInput:	.AltRInput

.zrel

; Order registers and memories in the following tables so that TestAll
; will test the most basic ones first.

MEMNAM:		.MName
MEMFORMS:	.MForm
MEMLEN:		.MLen
MEMWID:		.MWid
MEMCON:		.MCon
NMEMS:		.MCon-.MWid

REGNAM:		.RName
REGFORMS:	.RForm
REGWID:		.RWid
REGCON:		.RCon
NREGS:		.RCon-.RWid

.nrel

; *Note that the tables must be in the order given here because of*
; *the length error checks in MINIT0.*
.RName:	APCTASKn-.
	APCn-.
	CTASKn-.
	CIAn-.
	CYCLECONTROLn-.
	PAGEn-.
	PARITYn-.
	BOOTREASONn-.
	PCXREGn-.
	PCFREGn-.
	DBREGn-.
	SBREGn-.
	MNBRn-.
	ALURESULTn-.
	SALUFn-.
	SSTKPn-.
	STKPn-.
	MEMSYNDROMEn-.
	CALLERn-.
	AATOVAn-.

.RForm:	0		; APCTASK
	FormIMAddr-.	; APC
	0		; CTASK
	FormIMAddr-.	; CIA
	0		; CYCLECONTROL
	0		; PAGE
	0		; PARITY
	0		; BOOTREASON
	0		; PCXREG
	0		; PCFREG
	0		; DBREG
	0		; SBREG
	0		; MNBR
	0		; ALURESULT
	0		; SALUF
	0		; SSTKP
	0		; STKP
	0		; MEMSYNDROME
	FormIMAddr-.	; CALLER
	FormAATOVA-.	; AATOVA

.RWid:	4		; APCTASK
	14		; APC
	4		; CTASK
	14		; CIA
	10		; CYCLECONTROL
	4		; PAGE
	4		; PARITY
	10		; BOOTREASON
	4		; PCXREG
	4		; PCFREG
	6		; DBREG
	6		; SBREG
	20		; MNBR
	4		; ALURESULT
	10		; SALUF
	10		; SSTKP
	10		; STKP
	20		; MEMSYNDROME
	14		; CALLER
	20		; AATOVA

; **See MRType structure in MCOMMON.D**
; Bit 0 = value can be accessed when machine is running; read is ok
;	if passive-read bit is set, write ok if passive-write bit set
; Bit 1 = defined (= can be examined on the display)
; Bit 2 to 4 = --
; Bit 5 = can be read passively
; Bit 6 = read-only
; Bit 7 = can be written passively
; Bit 10 = look for Symbols with SearchBlocks(memories only)
; Bits 11-12 = default radix (0=octal, 1=decimal, 2=hex)
; Bits 13-14 = default display mode (0=numeric, 1=SearchBlocks, 2=symbolic)
; Bit 15 = automatic prettyprint
; Bit 16 = always read value and update display if necessary
; Bit 17 = tested in "Test-All"
.RCon:	 40000		; APCTASK
	 40000		; APC
	 40000		; CTASK
	 40010		; CIA
	 40004		; CYCLECONTROL
	 41000		; PAGE
	 41000		; PARITY
	 41000		; BOOTREASON
	 41000		; PCXREG
	 41000		; PCFREG
	 40001		; DBREG
	 40001		; SBREG
	 40000		; MNBR
	 40004		; ALURESULT
	 40005		; SALUF
	 41000		; SSTKP
	 40001		; STKP
	 41000		; MEMSYNDROME
	 41010		; CALLER
	142404		; AATOVA

.AltRForms:
	PrinTask		; APCTASK
	PrinIMAddr		; APC
	PrinTask		; CTASK
	PrinIMAddr		; CIA
	PrinCYCLECONTROL	; CYCLECONTROL
	RDatatoCSS		; PAGE
	PrinParity		; PARITY
	PrinBootReason		; BOOTREASON
	RDatatoCSS		; PCXREG
	RDatatoCSS		; PCFREG
	RDatatoCSS		; DBREG
	RDatatoCSS		; SBREG
	PrinMNBR		; MNBR
	PrinALUResult		; ALURESULT
	PrinSALUF		; SALUF
	RDatatoCSS		; SSTKP
	RDatatoCSS		; STKP
	PrintWrdByt		; MEMSYNDROME
	PrinIMAddr		; CALLER
	PrinAATOVA		; AATOVA

.AltRInput:
	BadAltIn		; APCTASK
	BadAltIn		; APC
	BadAltIn		; CTASK
	BadAltIn		; CIA
	BadAltIn		; CYCLECONTROL
	BadAltIn		; PAGE
	BadAltIn		; PARITY
	BadAltIn		; BOOTREASON
	BadAltIn		; PCXREG
	BadAltIn		; PCFREG
	BadAltIn		; DBREG
	BadAltIn		; SBREG
	WrdBytIn		; MNBR
	BadAltIn		; ALURESULT
	BadAltIn		; SALUF
	BadAltIn		; SSTKP
	BadAltIn		; STKP
	BadAltIn		; MEMSYNDROME
	BadAltIn		; CALLER
	BadAltIn		; AATOVA

.MName:	IMn-.
	IMXn-.
	RMn-.
	Tn-.
	TPCn-.
	VMn-.
	MAPn-.
	BPn-.
	MIMn-.
	MDATAn-.
	MADDRn-.

.MForm:	FormIMv-.	; IM
	FormIMa-.	; IMX
	0		; RM
	0		; T
	FormIMAddr-.	; TPC
	0		; VM
	0		; MAP
	FormBP-.	; BP
	FormIMm-.	; MIM
	FormIMa-.	; MDATA (modified dynamically)
	Form32-.	; MADDR

; Double-precision memory lengths
.MLen:	     0		; IM
	 IMlen
	     0		; IMX
	 10000
	     0		; RM
	   400
	     0		; T
	    20
	     0		; TPC
	    20
	   100		; VM
	     0
	     0		; MAP
	 40000
	     0		; BP
	 BPlen
	     0		; MIM
	MIMlen
	     0		; MDATA
	MDATAlen
	     0		; MADDR
	MADDRlen

.MWid:	100		; IM
	 44		; IMX
	 20		; RM
	 20		; T
	 14		; TPC
	 20		; VM
	 20		; MAP
	100		; BP
	 60		; MIM
	MDATAwid	; MDATA (modified dynamically)
	 40		; MADDR

; Bit 0 = value can be accessed when machine is running; read is ok if
;	passive-read is also true, write ok if passive-write is true.
; Bit 1 = defined (can be put on the display)
; Bit 2 = flush symbols in "Load" or "Dump" (for fake memories
;	used only as artifacts of the assembly)
; Bit 3 = retain symbol even in "LdData"
; Bit 4 = has parity (appears in PE-scan menu)
; Bit 5 = can be read passively
; Bit 6 = read-only
; Bit 7 = can be written passively
; Bit 10 = look for symbols with SearchBlocks
; Bits 11-12 default radix (0=octal, 1=decimal, 2=hex)
; Bits 13-14 = default display mode (0=numeric, 1=SearchBlocks,
;	2=symbolic)
; Bit 15 = pretty-print value after A+1/A-1 and SetValue actions
; Bit 16 = always read value and update display
; Bit 17 = tested by "Test-All"
.MCon:	 40204	; IM
	 44005	; IMX
	 44201	; RM
	 40001	; T
	 40001	; TPC
	 40000	; VM
	 40004	; MAP
	 43000	; BP
	142604	; MIM (substitute target for IM before Initialized)
	152604	; MDATA
	152604	; MADDR

.AltMForms:
	PrinIM		; IM
	PrinIM		; IMX
	PrintWrdByt	; RM
	PrintWrdByt	; T
	PrinIMAddr	; TPC
	PrintWrdByt	; VM
	PrintMAP	; MAP
	MDatatoCSS	; BP
	PrinIM		; MIM
	MDatatoCSS	; MDATA
	PrintMADDR	; MADDR

.AltMInput:
	InstructionIn	; IM
	InstructionIn	; IMX
	WrdBytIn	; RM
	WrdBytIn	; T
	BadAltIn	; TPC
	WrdBytIn	; VM
	BadAltIn	; MAP
	BadAltIn	; BP
	InstructionIn	; MIM
	BadAltIn	; MDATA
	BadAltIn	; MADDR

APCTASKn:	.txt "APCTASK"
APCn:		.txt "APC"
CTASKn:		.txt "CTASK"
CIAn:		.txt "CIA"
CYCLECONTROLn:	.txt "CYCLECONTROL"
PAGEn:		.txt "PAGE"
PARITYn:	.txt "PARITY"
BOOTREASONn:	.txt "BOOTREASON"
PCXREGn:	.txt "PCXREG"
PCFREGn:	.txt "PCFREG"
DBREGn:		.txt "DBREG"
SBREGn:		.txt "SBREG"
MNBRn:		.txt "MNBR"
ALURESULTn:	.txt "ALURESULT"
SALUFn:		.txt "SALUF"
SSTKPn:		.txt "SSTKP"
STKPn:		.txt "STKP"
MEMSYNDROMEn:	.txt "MEMSYNDROME"
CALLERn:	.txt "CALLER"
AATOVAn:	.txt "AATOVA"

IMn:		.txt "IM"
IMXn:		.txt "IMX"
RMn:		.txt "RM"
Tn:		.txt "T"
TPCn:		.txt "TPC"
VMn:		.txt "VM"
MAPn:		.txt "MAP"
BPn:		.txt "BP"
MIMn:		.txt "MIM"
MDATAn:		.txt "MDATA"
MADDRn:		.txt "MADDR"

; Format tables are:
; Word 0: Number of word-pairs
; Words 1 and 2: First bit and number of bits
; Words 3 and 4, etc. same as words 1 and 2
; The bits selected by a pair are printed in octal followed by a blank
; then the next group, etc.
; Going backward from the pointer:
; Word -1: MemX used in SearchBlocks DisplayMode (-1 if unmeaningful)
; Word -2: lv Procedure for symbolic DisplayMode (0 if unmeaningful)

	0
	IMx
FormIMAddr:
	1
	0
	14

	0
	IMx
FormAATOVA:
	1
	0
	20

	0
	-1
FormIMv:
	 4
	64
	14
	40
	 4
	 0
	20
	20
	20

	0
	-1
FormIMa:
	 3
	40
	 4
	 0
	20
	20
	20

	 0
	-1
FormIMm:
	 4
	44
	14
	40
	 4
	 0
	20
	20
	20

	0
	-1
FormBP:
	 5
	63
	 1
	64
	14
	40
	 4
	 0
	20
	20
	20

	0
	-1
Form32:	2
	0
	20
	20
	20


.end