// AltIO.decl -- common declarations for AltIO

//	Last modified March 14, 1981  3:37 PM

manifest
[
//fixed Maxc memory locations (names consistent with Maxc 11.6)
aSWICH = #0	//switches
aLITES = #1	//lights
aMTBS = #3	//address of MAXLOC, the main communication region
aDLSBS = #4	//address of DLSLOC, the DLS communication region
aMAXNV = #5	//Maxc to Alto request bits
aNVMAX = #6	//Alto to Maxc request bits
aSTADR = #7	//PDP-10 program starting address

//offsets in MAXLOC region (relative to the address in MTBS)
xTMCCO = #0	//magtape command
xMTIWC = #1	//computed magtape record length
xNVCHKA = #2	//argument for AltIO bug checks
xTMSCI = #3	//magtape status
xMTAC1 = #4	//magtape word count, starting address, remap words
xTODCLK = #11	//millisecond clock updated by AltIO
xCCHS = #12	//command and argument for CDVS request
xNVCHK = #13	//pointer to AltIO bug check word
xTMSI0 = #14	//magtape unit 0-7 status words
xPSCAN = #24	//parity error control word
xMEMER = #25	//memory status following errors
//#26-#240 are MCA communication words unused in Maxc2
xNVMSG = #241	//80-byte text string for register display
xPTRS = #265	//pointers to 5 main memory words to be displayed
xPUPIB = #272	//pup input buffer communication word
xPUPOB = #273	//pup output buffer communication word
xIMPIB = #274	//imp input buffer communication word
xIMPOB = #275	//imp output buffer communication word
xIMPSI = #276	//imp status
xMAR = #277	//contents of MAR after last memory error
xMDR = #300	//contents of MDR
xMDRL = #301	//contents of MDRL
xKMAR = #302	//contents of KMAR
xKMDR = #303	//contents of KMDR
xKMDRL = #304	//contents of KMDRL

//offsets in DLSLOC region (relative to the address in DLSBS)
xDLSOD = #0	//DLS output done bit word
xDLSO = #2	//DLS output request bit word
xDLSIN = #3	//DLS input done bit word
xDLSB = #4	//DLS data buffer, 2 words per line (input,output)

//offsets in Pup packet buffers known to AltIO
xPBPHYS = 1	//physical net/host and size
xPBHEAD = 5	//start of Pup proper
]

structure PBPHYS:  //PBPHYS word in packet buffer
   [
   net byte	//physical net number
   host byte	//physical host number
   words word	//number of Maxc words occupied by Pup
   blank word	//bits 32-35 unused
   ]


structure NBP:	//converted Net Buffer Pointer
[
adr1↑0,1 word	//Maxc address of first part of transfer
count1 word	//Maxc words in first part of transfer
adr2↑0,1 word	//Maxc address of second part of transfer, if any
]
manifest lenNBP = size NBP/16

manifest
[
//bits in MAXNV
mnPUPOBG = 4	//pup begin output
mnPUPIBG = 5	//pup begin input
mnCDVS = 6	//CDVS (miscellaneous requests)
mnIMPIBG = 7	//imp begin input
mnIMPOBG = 9	//imp begin output
mnMTCREQ = 12	//magtape request
mnDLSOBG = 14	//DLS begin output
mnIORST = 15	//i/o reset

//bits in NVMAX
nmHALT = 0	//console halt
nmNXM = 1	//nonexistent memory
nmPARERR = 2	//parity error
nmPUPODN = 20	//pup output done
nmPUPIDN = 21	//pup input done
nmIMPODN = 22	//imp output done
nmIMPIDN = 23	//imp input done
nmDLSDN = 24	//dls done (input or output)
nmMTCDN = 26	//magtape done
nmCLOCK = 27	//clock

//CDVS request sub-types
cdvsSetClock = 5	//set clock interrupt interval
cdvsSetConfiguration = 6  //set memory configuration

//Maxc processor states (software convention)
stateRunning = 0	//processor running
stateBreakpoint = 1	//at micro-breakpoint
stateLocalMemPE = 2	//local memory parity error
stateMainBusPE = 3	//main memory bus parity error
stateHalted = 4		//halted for other reason

//published addresses in PDP-10 emulator microcode
emulatorReset = #21	//(IM) reset emulator
emulatorStart = #23	//(IM) set pc to c(7) and start emulation
emulatorCheck = #25	//(IM) check microcode
emulatorPC = #352	//(SM) PDP-10 program counter

//other constants
maxBlt = 150	//max number of Maxc words to block transfer at a time
		// (about 1 ms worth; > max Pup length)
numDLSLines = 2	//number of simulated DLS lines
clockUpdateInterval = 8403  //approximately 5 ms between updates
netEther = 3	// Pup net number of the Ethernet on which Maxc2 resides
netArpa = 4	// Pup net number of the Arpanet
]

structure ParData:  //data saved by parity handler
[
flag word		//nonzero if error has occurred
dcbr word		//6 words of data saved by parity task
knmar word
dwa word
cba word
pc word
sad word
numErrors word		//number of errors detected by sweep
errorAdr word		//address of bad word
errorData word		//contents of bad word
]