;;; Copyright (c) 1999 Massachusetts Institute of Technology
;;; See the COPYING file at the top-level directory of this project.

.AUXIL

IFNDEF DEFSYM,[	;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES.
		;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK.
DEFINE DEFSYM X/
IRPS Z,,[X]
IFNDEF Z,X
.ELSE [
   $$TEM1==Z
   X
   IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/`
]
.ISTOP
TERMIN TERMIN

IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1.
.MLLIT==1
$$TEMP==1
]
.ELSE $$TEMP==0


;SYSTEMS CONCEPTS DC10 PHYSICAL CHARACTERISTICS

DEFSYM	NCYLS==400.	;# CYLINDERS NORMALLY USED
DEFSYM	XCYLS==6	;# EXTRA CYLINDERS FOR SPARES, HACKS, ETC.
DEFSYM	NHEDS==20.	;# TRACKS/CYLINDER
DEFSYM	NSECS==2	;# BLKS/TRK
DEFSYM	SECBLK==1	;# SECTORS/BLOCK
DEFSYM	NBLKSC==NHEDS*NSECS	;# BLKS/CYL
DEFSYM	NBLKS==NCYLS*NBLKSC	;TOTAL # REG BLKS
DEFSYM	XBLKS==XCYLS*NBLKSC	;# XTRA BLKS
DEFSYM	TBLKS==NBLKS+XBLKS	;TOTAL BLOCKS

DEFSYM	NTUTBL==2	;2 BLOCKS PER TUT (DUAL-DENSITY CALCOMPS THESE DAYS)
DEFSYM	DECADE==20.	;NUMBER OF BLOCKS TO ALLOCATE AT A TIME
			;QSWAPA AND QLASTB MUST BE MULTIPLES OF THIS

;EXTRA WORDS IN BLOCK

DEFSYM	XWBWC==0
DEFSYM	 XWBLK==1700,,		;BP TO PREV BLK # IN FILE FLD
DEFSYM	 XWAWC==171200,,	;BP TO ACTIVE WD CNT
DEFSYM	XWSYSN==1
DEFSYM	XWFN1==2
DEFSYM	XWFN2==3
DEFSYM	NXWDS==4		;NUMBER OF EXTRA WORDS

DEFSYM	DC0==610		;MAIN DEVICE CODE
DEFSYM	DC1==614		;READS ERR STATUS ETC, SETS TIMER DRIVER # ON CONO

;FIELDS IN HEADER WORD 0

DEFSYM	DPKID==240700,,		;PACK ID FIELD
DEFSYM	DCYL==131100,,		;CYLINDER CHECK FIELD
DEFSYM	DSURF==60500,,		;SURFACE CHECK FIELD
DEFSYM	DSECT==600,,		;SECTOR FIELD

;WORD 1 HEADER

DEFSYM	DHIND==1000,,		;4.1 INDIRECT IF 1, CYL, SURF, SECTOR SAME AS ABOVE
DEFSYM	DHSPRT==400,,		;BIT 3.9  SOFTWARE PROTECT
DEFSYM	DHHPRT==200,,		;3.8 HARDWARE PROTECT
DEFSYM	DHNXAD==270200,,	;3.7, 3.6 HOW TO COMPUTE NEXT DISK ADR
				;=00 ADD 1 TO SECTOR
				;01 SET SECTOR TO 0, ADD 1 TO SURF
				;10 SET SECTOR AND SURFACE TO 0, ADD 1 TO CYL
				;11 END OF DISK
DEFSYM	DHEPB==10,,		;PARITY BIT FOR EVEN BITS OF 56 BIT HEADER
DEFSYM	DHOPB==4,,		;PARITY BIT FOR ODD BITS OF 56 BIT HEADER
DEFSYM	DHSLNG==1600,,		;-LENGTH OF SECTOR FIELD

;DISK ADDRESS DATA COMMANDS (OP CODES)

DEFSYM	DRC==400000,,		;READ COMPARE
DEFSYM	DWRITE==440000,,	;WRITE
DEFSYM	DREAD==500000,,		;READ
DEFSYM	DSEEK==540000,,		;SEEK
DEFSYM	DRCC==600000,,		;READ COMPARE CONTINUOUS
DEFSYM	DWRITC==640000,,	;WRITE CONTINUOUS
DEFSYM	DREADC==700000,,	;READ CONTINUOUS

DEFSYM	DUNENB==20000,,		;ENABLE LOAD UNIT FIELD
DEFSYM	DUNFLD==330400,,	;UNIT FIELD
;PKID, CYL, SURF, AND SECTOR SAME AS ABOVE

;COPY / COMPARE / SKIP COMMAND

DEFSYM	DCOPY==40000,,		;COPY
DEFSYM	DCCOMP==100000,,	;COMPARE
DEFSYM	DCSKIP==140000,,	;SKIP

DEFSYM	DCWC==241400,,		;-WC FIELD
DEFSYM	DCCA==2400,,		;CORE ADDRES
DEFSYM	DCBN==121200,,		;BLOCK NUMBER

;JUMP COMMANDS
DEFSYM	DHLT==0		;0 IN 4.9-4.5 = JUMP AND IN 3.5,3.6 = HALT
DEFSYM	DXCT==20,,	;XCT
DEFSYM	DJMP==40,,	;JUMP
DEFSYM	DJSR==60,,	;JSR

;"B" COMMAND BITS 3.3, 3.4
;0 ALWAYS
DEFSYM	DAOJNC==4,,	;AOJN THE CONTROL COUNTER
DEFSYM	DDOK==10,,	;ON NO DATA ERROR
DEFSYM	DSRQF==14,,	;IF SEEK RQ FLAG ON

;STORE REGISTER COMMAND
DEFSYM	DSREG==240400,,	;STORE REG
;USE, UNIT BITS SAME
DEFSYM	DSREGS==240300,, ;SOURCE REGISTER SELECT FIELD
DEFSYM	DSRDB==0	;STORE DATA BUFFER
DEFSYM	DSRDL==4,,	;STORE DISK LOCATION
DEFSYM	DSRCC==10,,	;STORE COMMAND COUNT
DEFSYM	DSRPC==24,,	;STORE PC (IN FORM OF JMP INST.)
DEFSYM	DSRWC==30,,	;STORE WORD COUNT
DEFSYM	DSRCA==34,,	;STORE CORE ADDRESS (TO XFER DATA TO OR FROM)

;ALU COMMAND
DEFSYM	DALU==300000,,	;BASIC ALU OP CODE
DEFSYM	DALUX==40000,,	;INDEX BIT (ADD CC TO ADR)
DEFSYM	DALUD==40,,	;DIRECT BIT IF 1, REF MEM OT GET B OP

DEFSYM	DASL==4000,,	;SKIP ON <0
DEFSYM	DASE==10000,,	;SKIP ON = 0
DEFSYM	DASLE==14000,,	;SKIP ON < OR = 0
DEFSYM	DASA==20000,,	;ALWAYS SKIP
DEFSYM	DASGE==24000,,	;SKIP ON > OR = 0
DEFSYM	DASN==30000,,	;SKIP ON NOT = 0
DEFSYM	DASG==34000,,	;SKIP ON > 0

;DESTINATION SUB OP (ALSO SPECIFIES SOURCE A)
DEFSYM	DLDB==0		;OP A FROM DB, STORE IN DB
DEFSYM	DLDL==4,,	;OP FROM DL, STORE IN DL
DEFSYM	DLCC==10,,	;OP FROM CC, STORE IN CC
DEFSYM	DLCA==14,,	;OP A =0, STORE IN CA
DEFSYM	DLTDB==20,,	;TEST DB (OP A FROM DB, NO STORE)
DEFSYM	DLDBPC==24,,	;OP A FROM DB, STORE IN PC
DEFSYM	DLDBWC==30,,	;OP A FROM DB, STORE IN WC
DEFSYM	DLDBM==34,,	;OP A FROM DB, STORE IN MEM (DIRECT MUST BE ONE TO REALLY MAKE IT)

;SOME USEFUL (?) OPS
DEFSYM	DLADD==100,,	;A+B
DEFSYM	DLSOS==200,,	;B-1
DEFSYM	DLLB==300,,	;B
DEFSYM	DLSUB==400,,	;B-A

DEFSYM	DLAND==2300,,	;A&B
DEFSYM	DLIOR==2500,,	;A IOR B
DEFSYM	DLLA==3100,,	;LOAD A
DEFSYM	DLSETO==3200,,	;-1
DEFSYM	DLSETZ==3300,,	;0

;OPR COMMAND
DEFSYM	DOPR==200000,,	;BASIC OPR
DEFSYM	DOHXFR==400,,	;HALT DURING XFER (SO MB WILL BE SAFE)
DEFSYM	DOCSRQ==200,,	;CLEAR SEEK RQ
DEFSYM	DOSSRQ==100,,	;SET SEEK RQ
DEFSYM	DOSCFL==40,,	;SET C FLAG

;STORE DRIVE STATUS
DEFSYM	DSDRST==240000,,	;STORE DRIVE STATUS
;UNIT ENABLE, UNIT FIELD SAME
DEFSYM	DSDCNT==240400,,	;COUNT-1 FIELD

;BITS IN DRIVE STATUS STORED

DEFSYM	DDSWC==40,,		;WRITE CURRENT SENSED
DEFSYM	DDSUNS==20,,		;DRIVE UNSAFE
DEFSYM	DDSRDO==10,,		;READ ONLY
DEFSYM	DDSSIC==4,,		;SEEK INCOMPLETE
DEFSYM	DDSRDY==2,,		;DRIVE READY
DEFSYM	DDSONL==1,,		;DRIVE ON LINE
DEFSYM	DDSSEL==400000		;DRIVE SELECTED
DEFSYM	DDSCYL==101000,,	;PRESENT CYLINDER
DEFSYM	DDSLAT==1000,,		;LATENCY TIMER

;DISK ADR "SPECIAL COMMAND"

DEFSYM	DSPC==740000,,	;BASIC OP CODE
;USE, UNIT FIELDS AS NORMAL

; E CONDITION (WAIT)
;0 NONE
DEFSYM	DSWIDX==20,,	;WAIT UNTIL INDEX PULSE
DEFSYM	DSWSEC==40,,	;WAIT UNTIL SECTOR PULSE
DEFSYM	DSWINF==60,,	;NEVER (USE WITH G=3 OR 7)

; F CONDITION (OTHER WAIT)
DEFSYM	DSWHDM==0	;WAIT FOR MATCHING HEADER
DEFSYM	DSWAGH==4,,	;ANY GOOD HEADER
DEFSYM	DSWAH==10,,	;ANY HEADER
DEFSYM	DSWNUL==14,,	;NO WAIT

;G OPERATION
DEFSYM	DSCRDC==0	;READ DATA THRU DECODERS
DEFSYM	DSCRIM==100,,	;READ DATA IMAGE
DEFSYM	DSCRHD==200,,	;READ HEADER WORDS
DEFSYM	DSRCAL==300,,	;(RECALIBRATE)
DEFSYM	DSCWDC==400,,	;WRITE THRU DECODERS
DEFSYM	DSCWIM==500,,	;WRITE IMAGE
DEFSYM	DSMAIT==700,,	;MAINTENANCE  (PUT CYL FIELD ON BUS LINES WITH CONTROL TAG)

;BITS IN CONI DC0,
DEFSYM	DASSGN==400000,, ;ASSIGNED TO PROC (WITH SWITCH)
DEFSYM	DPIRQC==400000	;PI REQ BEING GENERATED
DEFSYM	DSSRQ==200000	;SEEK REQUEST
DEFSYM	DSDEEB==10000	;ENABLE INTERRUPT ON DATA ERROR OR READ/ COMP ERROR
DEFSYM	DSSERR==4000	;ERROR FLAG
DEFSYM	DSSAEB==2000	;ATTENTION ENABLE FLAG
DEFSYM	DSSATT==1000	;ATTENTION FLAG
DEFSYM	DSIENB==400	;IDLE FLAG ENABLE
DEFSYM	DSSRUN==200	;RUN
DEFSYM	DSSACT==100	;ACTIVE
DEFSYM	DSSCEB==40	;CHANNEL ENABLE
DEFSYM	DSSCHF==20	;CHANNEL FLAG
DEFSYM	DSSCFL==10	;CPU FLAG
;PIA 1.3-1.1

;DATAO DC0, SENDS COMMAND TO DISK
;  (IGNORED IF EXECUTING COMMANDS FROM MEMORY)

;CONO DC0, 
DEFSYM	DCSET==400000	;SET SELECTED
DEFSYM	DCCLR==200000	;CLEAR SELECTED
DEFSYM	DCCSET==600000	;RESET CONTROLLER THEN SET SELECTED
DEFSYM	DCDENB==10000	;DATA ERROR ENABLE
DEFSYM	DCERR==4000	;SET ERROR FLAG OR CLEAR ALL ERRORS
DEFSYM	DCATEB==2000	;ATTENTION ENABLE
DEFSYM	DCCATT==1000	;CLEAR ATTENTION
DEFSYM	DCSSRQ==1000	;SET SEEK REQUEST
DEFSYM	DCIENB==400	;IDLE ENABLE
DEFSYM	DCSTAR==200	;START (SET)
DEFSYM	DCSSTP==200	;STOP (CLEAR)
DEFSYM	DCSGL==100	;DO SINGLE COMMAND
DEFSYM	DCCENB==40	;CHANNEL ENABLE
DEFSYM	DCCFLG==20	;CHANNEL FLAG
DEFSYM	DCCPUF==10	;CPU FLAG
;1.1-1.3 PIA

;CONO DC1,

;SET TIMER DRIVE # FROM 1.1-1.3

;CONI DC1,
;LH
DEFSYM	DSATDN==360400,,	;ATTENTION DRIVE #
DEFSYM	DSTMDN==320400,,	;TIMER DRIVE #
DEFSYM	DSLAT==221000,,		;LATENCY TIMER FOR DRIVE ABOVE

;RH (ERROR FLAGS)
DEFSYM	DIPE==4000	;INTERNAL PARITY ERROR
DEFSYM	DRLNER==2000	;RECORD LENGTH
DEFSYM	DRCER==1000	;READ COMPARE ERROR
DEFSYM	DOVRRN==400	;OVERRUN
DEFSYM	DCKSER==200	;CKSUM OR DECODER ERR
DEFSYM	DWTHER==100	;WATCHDOG TIMER
DEFSYM	DFUNSF==40	;FILE UNSAFE, SEEK INCOMPLETE OR END OR DSK
DEFSYM	DOFFL==20	;OFF LINE OR MULT SEL
DEFSYM	DPROT==10	;WRT KEY OR RD ONLY OR PROTECT
DEFSYM	DDOBSY==4	;DATAO WHEN BSY
DEFSYM	DNXM==2		;NON-EX MEM
DEFSYM	DCPERR==1	;CORE PARITY ERR

DEFSYM	LRIBLK==16	;CONSISTENCY CHECK DSKDMP VS MARK


IFN $$TEMP,EXPUNG DEFSYM
