Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_1_19910112 - 7/ft3/monitor/stanford/phypar.mac
There are 53 other files named phypar.mac in the archive. Click here to see a list.
;[MACBETH.STANFORD.EDU]SRC:<7.FT3.MONITOR.STANFORD>PHYPAR.MAC.2, 20-Jun-88 15:34:26, Edit by A.APPLEHACKS
; FT7 Clock Merge
;
; UPD ID= 8701, RIP:<7.MONITOR>PHYPAR.MAC.5,  20-Apr-88 10:34:26 by RASPUZZI
;TCO 7.1276 - Add U1.NOL for login structures hang
;
;[MACBETH]SRC:<7.FT2.MONITOR.STANFORD>PHYPAR.MAC.2,  6-Apr-88 15:53:03, Edit by A.APPLEHACKS
; FT7.2 Merge
; UPD ID= 8593, RIP:<7.MONITOR>PHYPAR.MAC.4,  11-Feb-88 16:56:54 by GSCOTT
;TCO 7.1218 - Update copyright date.
; UPD ID= 8464, RIP:<7.MONITOR>PHYPAR.MAC.3,   5-Feb-88 11:34:29 by GSCOTT
;TCO 7.1075 - Add TOC
;[MACBETH]SRC:<7.FT1.MONITOR.STANFORD>PHYPAR.MAC.2,  1-Feb-88 22:50:46, Edit by A.APPLEHACKS
; FT7 Merge
;
;[SIERRA.STANFORD.EDU]SRC:<6.1.MONITOR.STANFORD.MARS>PHYPAR.MAC.8, 13-Mar-87 11:42:27, Edit by ALDERSON
; Assign some DEC device-type numbers to SA10 devices for SC30-M:
;	.UTCT1 = .UTT45
;	.UTCC1 = .UTRS4
;	.UTCC2 = .UTRP5
;[SIERRA.STANFORD.EDU]SRC:<6.1.MONITOR.STANFORD.MARS>PHYPAR.MAC.7, 13-Mar-87 11:41:23, Edit by ALDERSON
; Put SC30-M changes under SC30SW
;
; UPD ID= 133, RIP:<7.MONITOR>PHYPAR.MAC.2,  23-Sep-87 15:46:23 by MCCOLLUM
;TCO 7.1063 - Add U1.SOF to UDBST1
;------------------------- Autopatch Tape # 13 -------------------------
;------------------------- Autopatch Tape # 12 -------------------------
;<6-1-MONITOR.FT6>PHYPAR.MAC.2, 12-Aug-85 16:54:59, Edit by WHP4
; FT6 merge
;Stanford changes:
; Definitions for MEIS iorb offsets and fields
; Define unit and massbus types for the MEIS
; Symbols for MEIS data modes
;
; UPD ID= 2280, SNARK:<6.1.MONITOR>PHYPAR.MAC.61,  25-Jun-85 15:02:51 by GRANT
;TCO 6.1.1473 - Add UDB%MA
; UPD ID= 2245, SNARK:<6.1.MONITOR>PHYPAR.MAC.60,  19-Jun-85 18:55:41 by GRANT
;TCO 6.1.1462 - Enhance comments describing CO.BTS
; UPD ID= 2165, SNARK:<6.1.MONITOR>PHYPAR.MAC.59,   5-Jun-85 10:43:34 by MCCOLLUM
;TCO 6.1.1406  - Update copyright notice.
; UPD ID= 1913, SNARK:<6.1.MONITOR>PHYPAR.MAC.58,   6-May-85 17:06:14 by TBOYLE
;TCO 6.1.1366 - Add U1.ODT overdue indicator.
; UPD ID= 1279, SNARK:<6.1.MONITOR>PHYPAR.MAC.57,   6-Jan-85 21:31:32 by GRANT
;Enhance definitions of UDBST1 bits
; UPD ID= 1244, SNARK:<6.1.MONITOR>PHYPAR.MAC.56,  30-Dec-84 10:11:44 by GRANT
;More TCO 6.1.1099 - Fix definition of UDBSTR.
; UPD ID= 1243, SNARK:<6.1.MONITOR>PHYPAR.MAC.55,  30-Dec-84 06:47:20 by GRANT
;TCO 6.1.1099 - Improve the definitions of UDBSLV and CDBUDB.
; UPD ID= 1226, SNARK:<6.1.MONITOR>PHYPAR.MAC.54,  18-Dec-84 16:45:49 by TBOYLE
; UPD ID= 1112, SNARK:<6.1.MONITOR>PHYPAR.MAC.53,  20-Nov-84 15:46:49 by MCLEAN
;ADD U1.VV
; UPD ID= 5041, SNARK:<6.MONITOR>PHYPAR.MAC.52,  30-Oct-84 15:33:40 by MCLEAN
;ADD PDBLEN AND REMOVE UDBP16,UDBP17
; UPD ID= 4827, SNARK:<6.MONITOR>PHYPAR.MAC.51,  17-Sep-84 10:43:59 by PURRETTA
;Update copyright notice
; UPD ID= 4756, SNARK:<6.MONITOR>PHYPAR.MAC.50,  27-Aug-84 09:23:27 by GRANT
;CDCHN should be 3 bits not 4.
; UPD ID= 4752, SNARK:<6.MONITOR>PHYPAR.MAC.49,  26-Aug-84 21:01:15 by MCLEAN
;REMOVE 1 EXTRANEOUS WORD IN UDB BEFORE UDBNPR
; UPD ID= 4577, SNARK:<6.MONITOR>PHYPAR.MAC.48,  23-Jul-84 09:25:27 by GRANT
;Add UDB%WA and UDB%WB
; UPD ID= 4399, SNARK:<6.MONITOR>PHYPAR.MAC.47,  27-Jun-84 22:29:17 by MCLEAN
;MANY CHANGES FOR DUAL PORT SUPPORT
; UPD ID= 4372, SNARK:<6.MONITOR>PHYPAR.MAC.45,  22-Jun-84 10:02:20 by MCLEAN
;FIX COMMENTS ON US.BAT!!**!!
; UPD ID= 4252, SNARK:<6.MONITOR>PHYPAR.MAC.44,  29-May-84 22:16:51 by MCLEAN
;ADD IRBPAD FOR DOP%PS
; UPD ID= 4191, SNARK:<6.MONITOR>PHYPAR.MAC.43,   9-May-84 12:06:56 by MOSER
;MORE 6.1562 - REMOVE IOOFF AND IOON - BETTER SOLUTION EXISTS
; UPD ID= 3996, SNARK:<6.MONITOR>PHYPAR.MAC.42,  28-Mar-84 14:25:22 by MOSER
;MORE 6.1562 - EXTEND UC.OLB
; UPD ID= 3983, SNARK:<6.MONITOR>PHYPAR.MAC.41,  27-Mar-84 13:19:26 by MCLEAN
;CHANGE US.CIU TO US.UNA
; UPD ID= 3948, SNARK:<6.MONITOR>PHYPAR.MAC.40,  20-Mar-84 07:41:51 by GRANT
;Change CSSTA to CFSTA
; UPD ID= 3885, SNARK:<6.MONITOR>PHYPAR.MAC.39,  11-Mar-84 07:18:09 by GRANT
;Change CSLDJ to CSLDF and CSDML to CSDMF.
; UPD ID= 3852, SNARK:<6.MONITOR>PHYPAR.MAC.38,   5-Mar-84 12:14:07 by GRANT
;Redefine DEFSTR CSSTA.  Add DEFSTRs CSLDJ and CSDMJ.
;Add CDBDMU and change CDBDGB to CDBLDU.
; UPD ID= 3782, SNARK:<6.MONITOR>PHYPAR.MAC.37,  28-Feb-84 13:16:44 by MOSER
;MORE 6.1562 - CHANGE PHYIOF TO PHYIF
; UPD ID= 3773, SNARK:<6.MONITOR>PHYPAR.MAC.36,  27-Feb-84 13:55:02 by GRANT
;Add CI.IDL
; UPD ID= 3750, SNARK:<6.MONITOR>PHYPAR.MAC.35,  25-Feb-84 06:06:12 by GRANT
;Add CHNDMC
; UPD ID= 3727, SNARK:<6.MONITOR>PHYPAR.MAC.34,  22-Feb-84 12:19:58 by MOSER
;TCO 6.1562 - ALLOW STACKING OF IOPIOFF WITH NEW IOOFF MACRO (IOON TOO)
; UPD ID= 3700, SNARK:<6.MONITOR>PHYPAR.MAC.33,  19-Feb-84 06:36:42 by GRANT
;Add DEFSTRs for fields in CDBVER offset.  These match SPEAR entry.
;Remove CB.VOK and CB.PST.
; UPD ID= 3695, SNARK:<6.MONITOR>PHYPAR.MAC.32,  15-Feb-84 15:00:40 by GRANT
;Add CHNxxx, states of the KLIPA.  Remove CS.MNR and CB.DED.
; UPD ID= 3422, SNARK:<6.MONITOR>PHYPAR.MAC.31,   8-Jan-84 15:48:16 by MCLEAN
;ADD US.TPD -- DISABLE FOR THREE PORTED DISK
; UPD ID= 3107, SNARK:<6.MONITOR>PHYPAR.MAC.30,   7-Nov-83 21:19:57 by MCLEAN
;ADD UDSPRL FOR PORT RELEASE
; UPD ID= 3076, SNARK:<6.MONITOR>PHYPAR.MAC.29,  25-Oct-83 13:05:53 by GRANT
;Move CHCNT and CHADR here from MSCPAR
; UPD ID= 2973, SNARK:<6.MONITOR>PHYPAR.MAC.28,   3-Oct-83 11:03:23 by MCLEAN
;NO LONGER NEED US.DUP
;TCO 1713
; UPD ID= 2966, SNARK:<6.MONITOR>PHYPAR.MAC.27,   2-Oct-83 06:05:17 by GRANT
;Add CO.LAR to KLIPA CONO bits
; UPD ID= 2938, SNARK:<6.MONITOR>PHYPAR.MAC.26,  27-Sep-83 09:45:04 by GRANT
;Move KLIPA CONI/CONO bits here from PHYKLP and its CDB offsets here from SCAPAR
; UPD ID= 2882, SNARK:<6.MONITOR>PHYPAR.MAC.25,   9-Sep-83 10:41:57 by CDUNN
;More TCO 6.1127 - Temporarily make PHYIPD positivily huge until we can fix
;PHYKLP.
; UPD ID= 2826, SNARK:<6.MONITOR>PHYPAR.MAC.24,  11-Aug-83 15:34:03 by CDUNN
;More TCO 6.1127 - Increase the size of PHYPDL to accomodate the CI
; UPD ID= 2584, SNARK:<6.MONITOR>PHYPAR.MAC.23,  15-Jun-83 13:11:38 by MCLEAN
;TCO 6.1681 MAKE TWO NEW ENTRIES FOR CI AND NI TO BE CHANNEL TYPES.
; UPD ID= 2509, SNARK:<6.MONITOR>PHYPAR.MAC.22,  24-May-83 16:31:49 by MCLEAN
;TCO 6.1665 MAKE UDBDSN TWO WORDS
; UPD ID= 2397, SNARK:<6.MONITOR>PHYPAR.MAC.21,   3-May-83 05:37:03 by WACHS
;More TCO 6.1127 - add 10 more to LPHIPD
; UPD ID= 2388, SNARK:<6.MONITOR>PHYPAR.MAC.20,  30-Apr-83 11:09:28 by LEAPLINE
;TCO 6.1.1001 Add bit (CS.NIP) in CDBSTS for KLNI.
; UPD ID= 2346, SNARK:<6.MONITOR>PHYPAR.MAC.19,  26-Apr-83 10:10:48 by MOSER
;TCO 6.1562 - ADD SOME NEW BITS US.BDK, US.CIA, US.CIU, UC.OLB
; UPD ID= 2237, SNARK:<6.MONITOR>PHYPAR.MAC.17,  12-Apr-83 09:57:01 by MILLER
;TCO 6.1610. Define US.DUP
; UPD ID= 2212, SNARK:<6.MONITOR>PHYPAR.MAC.16,   8-Apr-83 07:05:16 by GRANT
;TCO 6.1127 - DECnet SYSAP causes MONPDL, increase LPHIPD from 120 to 200
; UPD ID= 2201, SNARK:<6.MONITOR>PHYPAR.MAC.15,   8-Apr-83 05:33:12 by WACHS
;TCO 6.1602 - Microcode needs reloading
; UPD ID= 2149, SNARK:<6.MONITOR>PHYPAR.MAC.14,   4-Apr-83 14:11:12 by MILLER
;TXO 6.1589. Allocate field for error retry count
; UPD ID= 1979, SNARK:<6.MONITOR>PHYPAR.MAC.13,  11-Mar-83 15:55:47 by HAUDEL
;TCO 6.1538 - Add UDBSTS bit definitions for rewind timer.
; UPD ID= 1760, SNARK:<6.MONITOR>PHYPAR.MAC.12,   4-Feb-83 05:13:51 by WACHS
;TCO 6.3355 - Change name from "port" to "node"
; UPD ID= 1428, SNARK:<6.MONITOR>PHYPAR.MAC.10,   9-Nov-82 04:33:24 by WACHS
;TCO 6.1355 - Add TA78, change name to RA60
; UPD ID= 1044, SNARK:<6.MONITOR>PHYPAR.MAC.9,   6-Aug-82 14:33:26 by PAETZOLD
;TCO 6.1217 - Add UDBRVC word in the UDB
; UPD ID= 1014, SNARK:<6.MONITOR>PHYPAR.MAC.8,  30-Jul-82 04:45:36 by WACHS
;TCO 6.1198  Increase length of PHYSIO's PD list
; UPD ID= 723, SNARK:<6.MONITOR>PHYPAR.MAC.7,  11-May-82 04:23:28 by CDUNN
;TCO 6.1127 - Add definitions for KLIPA and CI support
; UPD ID= 61, SNARK:<6.MONITOR>PHYPAR.MAC.6,   3-Sep-81 17:00:22 by UHLER
;TCO 5.1487 ADD DEF'S FOR SUPPORT OF CHANNEL WRITE PARITY DETECTION IN PHYH2
; UPD ID= 1850, SNARK:<6.MONITOR>PHYPAR.MAC.4,  21-Apr-81 06:21:52 by WACHS
;TCO 5.1288 ADD MAGTAPE READS/WRITES PER MODE
; UPD ID= 1598, SNARK:<6.MONITOR>PHYPAR.MAC.3,  27-Feb-81 07:21:31 by WACHS
;TCO 6.1002 - ADD DEFINITION UDB2ND, USED FOR DUAL-PORTED DISKS
; UPD ID= 1577, SNARK:<6.MONITOR>PHYPAR.MAC.2,  24-Feb-81 10:14:00 by LYONS
; UPD ID= 1574, SNARK:<5.MONITOR>PHYPAR.MAC.9,  23-Feb-81 16:12:02 by LYONS
; MAKE THE INTERUPT STACK FOR PHYSIO BIGGER.  WE CALL PHYSIO ON OUR STACK,
; AND COULD RUN OUT OF ROOM
; UPD ID= 1364, SNARK:<5.MONITOR>PHYPAR.MAC.8,  18-Dec-80 10:14:33 by WACHS
; TCO 5.1206 CHANGE DEVICE TYPES FOR TM78, RP07
; UPD ID= 734, SNARK:<5.MONITOR>PHYPAR.MAC.7,   7-Jul-80 00:47:06 by DBELL
;TCO 5.1096 - ADD UDSCCK DISPATCH OFFSET
; UPD ID= 626, SNARK:<5.MONITOR>PHYPAR.MAC.6,  11-Jun-80 17:02:29 by LYONS
;TCO 5.0162 - ADD DEFINITIONS FOR WRITE VERIFICATION
; UPD ID= 579, SNARK:<5.MONITOR>PHYPAR.MAC.5,  31-May-80 23:04:19 by DBELL
;TCO 5.1048 - ADD DEFINITIONS NEEDED FOR MULTIPLE-PAGE DSKOPS
; UPD ID= 503, SNARK:<5.MONITOR>PHYPAR.MAC.3,   1-May-80 15:19:11 by DBELL
;TCO 4.1.1153 - INCREASE NUIORB FROM 6 TO 15
; UPD ID= 365, SNARK:<4.1.MONITOR>PHYPAR.MAC.15,  26-Mar-80 11:07:27 by DBELL
;TCO 4.1.1119 - MAKE NECESSARY CHANGES FOR RP20 SUPPORT
;<4.MONITOR>PHYPAR.MAC.14, 25-Oct-79 18:56:45, EDIT BY DBELL
;TCO 4.2551 - ADD KS.HLT TO REMEMBER MICROCODE IS HALTED
;<4.MONITOR>PHYPAR.MAC.13, 19-Sep-79 15:45:04, EDIT BY DBELL
;TCO 4.2476 - ADD DISPATCHES UDSEXT AND CDSEXT
;<4.MONITOR>PHYPAR.MAC.12,  6-Mar-79 09:32:09, EDIT BY KONEN
;UPDATE COPYRIGHT FOR RELEASE 4
;<2BOSACK>PHYPAR.MAC.3, 14-Feb-79 10:54:52, EDIT BY BOSACK
;ADD TU77 HW DEVICE TYPE
;<4.MONITOR>PHYPAR.MAC.10, 26-Jul-78 00:20:36, Edit by MCLEAN
;DECOMMITT US.IDB AND MAKE IT BE US.PSI
;<4.MONITOR>PHYPAR.MAC.6, 18-Jul-78 01:03:21, Edit by MCLEAN
;ADD ONLINE/OFFLINE TRANSITION PSI (USED BY TAPE ONLY)
;<FORTMILLER>PHYPAR.MAC.3, 24-May-78 14:57:15, Edit by FORTMILLER
;ADD CHARACTERISTICS WORD TO UDB - UDBCHR
; AND DX20 SUPPORT
;<3A.MONITOR>PHYPAR.MAC.1, 19-Apr-78 02:28:35, Edit by MCLEAN
;ADD TY.T78 (TM78)
;<2BOSACK>PHYPAR.MAC.58, 24-Feb-78 01:09:25, EDIT BY BOSACK
;RENAME DATA AND DEVICE ERROR BITS IN IORB
;<1MCLEAN>PHYPAR.MAC.57, 27-Jan-78 16:48:20, Edit by MCLEAN
;ENLARGE INTERRUPT STACK FOR CALL TO ALLOCATE FREE SPACE

;	COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1976, 1988.
;	ALL RIGHTS RESERVED.
;
;	THIS SOFTWARE IS FURNISHED UNDER A  LICENSE AND MAY BE USED AND  COPIED
;	ONLY IN  ACCORDANCE  WITH  THE  TERMS OF  SUCH  LICENSE  AND  WITH  THE
;	INCLUSION OF THE ABOVE  COPYRIGHT NOTICE.  THIS  SOFTWARE OR ANY  OTHER
;	COPIES THEREOF MAY NOT BE PROVIDED  OR OTHERWISE MADE AVAILABLE TO  ANY
;	OTHER PERSON.  NO  TITLE TO  AND OWNERSHIP  OF THE  SOFTWARE IS  HEREBY
;	TRANSFERRED.
;
;	THE INFORMATION IN THIS  SOFTWARE IS SUBJECT  TO CHANGE WITHOUT  NOTICE
;	AND SHOULD  NOT  BE CONSTRUED  AS  A COMMITMENT  BY  DIGITAL  EQUIPMENT
;	CORPORATION.
;
;	DIGITAL ASSUMES NO  RESPONSIBILITY FOR  THE USE OR  RELIABILITY OF  ITS
;	SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL.


	UNIVERSAL PHYPAR - Universal For PHYSIO And Associated Modules
	SUBTTL L.BOSACK/T.HESS 16-MAY-75
	SALL
	SEARCH MONSYM,MACSYM
	Subttl	Table of Contents

;		     Table of Contents for PHYPAR
;
;				  Section		      Page
;
;
;    1. Channel Data Block . . . . . . . . . . . . . . . . . .   3
;        1.1    Bits and Bytes . . . . . . . . . . . . . . . .   4
;        1.2    Channel Service Routine Dispatch . . . . . . .   5
;    2. Kontroller Data Block  . . . . . . . . . . . . . . . .   6
;    3. Unit Data Block  . . . . . . . . . . . . . . . . . . .   7
;        3.1    Bits and Bytes . . . . . . . . . . . . . . . .   9
;        3.2    Unit Service Routine Entry Dispatch  . . . . .  11
;    4. IO Request Block . . . . . . . . . . . . . . . . . . .  12
;        4.1    Functions and Modes  . . . . . . . . . . . . .  13
;        4.2    Bits and Bytes . . . . . . . . . . . . . . . .  14
;    5. Parameters - Usually determine maximum # of devices  .  15
;    6. Macro Definitions  . . . . . . . . . . . . . . . . . .  16
;    7. Type Codes . . . . . . . . . . . . . . . . . . . . . .  17
;    8. KLIPA Parameters . . . . . . . . . . . . . . . . . . .  19
;    9. End of PHYPAR  . . . . . . . . . . . . . . . . . . . .  21
	SUBTTL Channel Data Block

CDBINT==-6			;JSR TO HERE IF VECTOR DEVICE
				;CDBINT+1 CONTAINS MOVEM P1,.+2+CDBSVQ
				;CDBINT+2 CONTAINS XPCW PHYINT
CDBSTS==0			;STATUS AND CONFIGURATION INFORMATION
CDBMBW==1			;MEMORY BANDWIDTH SCHEDULING INFORMATION
CDBODT==2			;OVERDUE TIMER WHEN DATA XFR ACTIVE
CDBICP==3			;EXEC VIRTUAL ADDR OF INAD/ICCW
CDBIUN==4			;INITIAL AOBJN PTR TO UDB TABLE
CDBCUN==5			;CURRENT AOBJN PTR TO UDB TABLE
CDBDSP==6			;UNIT UTILITIES DISPATCH,,MAIN ENTRY DISPATCH
CDBFCT==7			;FAIRNESS COUNT FOR LATENCY
CDBPAR==10			;CHANNEL MEMORY PARITY ERRORS
CDBNXM==11			;CHANNEL NXMS
CDBXFR==12			;CURRENTLY TRANSFERRING UDB
CDBCCL==13			;3 WORD BLOCK, CHANNEL COMMAND LIST
CDBUDB==16			;UDB OR KDB TABLE - 16. WORDS.
				; IF THERE ARE NO CONTROLLERS, THIS TABLE,
				; INDEXED BY UNIT NUMBER, HAS UDB ADDRESSES.
				; IF THERE ARE CONTROLLERS, THIS TABLE, INDEXED
				; BY CONTROLLER NUBER, HAS KDB ADDRESSES.
CDBSVQ==36			;P1 SAVED HERE ON VECTOR INTERRUPT ENTRY
CDBJEN==37			;INTERRUPT DISMISS (3 WORDS)
				;CDBJEN CONTAINS BLT 17,17
				;CDBJEN+1 CONTAINS DATAO RH,CDBRST
				;CDBJEN+2 CONTAINS JEN @CDBINT
CDBRST==42			;LOC USED BY CDBJEN
CDBCNI==43			;CHANNEL CONI AT START OF INTERRUPT
CDBONR==44			;FORK WHO HAS CHANNEL IN MAINT MODE
CDBADR==45			;NUMBER OF THIS CHANNEL (CHNTAB INDEX)
CDBCS0==46			;CHAN STATUS 0 AT ERROR
CDBCS1==47			;CHAN STATUS 1
CDBCS2==50			;CHAN STATUS 2
CDBCC1==51			;FIRST CCW
CDBCC2==52			;SECOND CCW
CDBOVR==53			;NUMBER OF OVERRUNS
CDBICR==54			;INITIAL STCR WHEN DEVICE STARTED
CDBCL2==55			;3 WD BLOCK, ALTERNATE CCW LIST
CDBIRB==60			;IORB WE MOST WANT TO START TRANSFER FOR
CDBLUN==61			;LAST UDB WHICH DID TRANSFER OR POSITIONING
CDBCAD==62			;2 WD BLOCK, ADDRESS OF CCW FOR FIRST AND
				; SECOND COMMANDS
CDBDDP==64			;START OF DEVICE DEPENDENT CDB
	SUBTTL Channel Data Block -- Bits and Bytes

;BITS AND BYTES

;CDBSTS

CS.OFL==1B0			;OFFLINE
CS.AC1==1B1			;PRIMARY COMMAND ACTIVE
CS.AC2==1B2			;SECONDARY COMMAND ACTIVE
CS.ACT==CS.AC1!CS.AC2		;ANY ACTIVE
CS.MAI==1B3			;CHANNEL IS IN MAINT MODE
CS.MRQ==1B4			;MAINT MODE REQUESTED FOR SOME UNIT
CS.ERC==1B5			;ERROR RECOVERY IN PROGRESS
CS.STK==1B6			;CHANNEL SUPPORTS COMMAND STACKING
CS.ACL==1B7			;ALTERNATE CCW LIST IS CURRENT
CS.CWP==1B8			;CHANNEL WRITE PARITY ERROR DETECTED ON THIS
CS.CIP==1B9			;THIS IS A CI-PORT CHANNEL
CS.DEN==1B10			;(CI PORT) DIAG TO TAKE CHAN IS ENABLED
CS.NIP==1B12			;THIS IS A NI-PORET CHANNEL
IFN STANSW&SC30SW,<
CS.MUX==1B14			;MULTIPLEXOR CHANNEL
>;IFN STANSW&SC30SW
CSSTYP==SIZ.UT			;SIZE OF TYPE FIELD
CSPTYP==^D35			;POSITION OF TYPE FIELD
CSSPIA==3			;SIZE OF PIA FIELD
CSPPIA==XSPTYP-XSSTYP		;POSITION OF PIA FIELD
	SUBTTL Channel Data Block -- Channel Service Routine Dispatch

;CHANNEL SERVICE ROUTINE MAIN ENTRY DISPATCH

CDSINI==0			;INITIALIZE AND BUILD DATA STRUCTURE
CDSSTK==1			;STACK SECOND CHANNEL COMMAND, SKIP IF OK
CDSSIO==2			;START IO, SKIP IF STARTED OK.
CDSPOS==3			;DO POSITIONING TO IDLE UNIT, SKIP IF OK.
CDSLTM==4			;RETURN LATENCY AND BEST REQUEST
CDSINT==5			;INTERRUPT ENTRY
CDSCCW==6			;GENERATE SINGLE CCW ENTRY
CDSHNG==7			;HUNG RESET
CDSRST==10			;RESET CHANNEL AND ALL DEVICES, ON RESTART
CDSCHK==11			;PERIODIC CHECK ENTRY, CHECK PIA, ETC.
CDSEXT==12			;CHECK LEGALITY OF A UNIT, SKIP IF EXISTANT
CDSCCA==13			;EXTRACT ADDRESS FROM CCW WORD

;CALLING SEQUENCES
;THE P&Q ACS ARE ASSUMED PRESERVED UNLESS STATED OTHERWISE.
;THE T ACS ARE ASSUMED DESTROYED UNLESS STATED OTHERWISE.
;INPUT ARGUMENTS ARE THOSE ACS WHICH MUST BE SETUP FOR THE CALL.
;OUTPT ARGUMENTS ARE THOSE ACS WHICH WILL BE SET TO A SPECIFIED VALUE
;BY THE CALL.

;ENTRY INPUT OUTPUT	;COMMENTS

;INI P4 P4	;TAKES FIRST FREE CHAN # IN P4, UPDATES P4
;			;CAN CLOBBER ALL OTHER ACS
;PRQ P4,P1,3 P4,P1,3	;SKIPS IF THE IORB IN P4 REQUIRES POSITIONING
;			;BEFORE TRANSFER CAN BE DONE
;SIO P4,P1,3 P4,P1,3	;STARTS IO ON THE IORB IN P4. SKIPS IF START OK
;POS P4,P1,3		;STARTS POSITIONING TO THE CYL OF THIS IORB.
;			;SKIPS IF SEEK STARTED OK.
;LTM T1,P1,3		;RETURNS THE BEST IORB TO XFR ON THIS UNIT.
;		T1,2,3	;T1/ TIME TO GO IN USEC,T2/ PREDECESSOR IORB, T3/ IORB
;INT P1 P4,P3	;CALLED ON AN INTERRUPT FOR THE CDB IN P1.
;			;RETURNS:P4/ 0=EXIT INTERRUPT,-1=DO SCHED CYCLE
;			;	POSITIVE=IORB COMPLETED
;CCW T1,2, T1	;BUILDS A SINGLE CCW FOR THE CHAN IN P1
;	P1		;T1/ DATA MODE,,BYTE COUNT (1B0 IF BACKWARDS XFR)
;			;T2/ PHYSICAL MEM ADDR. RETURNS CCW IN T1
	SUBTTL Kontroller Data Block

KDBSTS==0			;FLAGS, UNIT TYPE
KDBIUN==1			;INITIAL AOBJN WORD TO UDB TABLE
KDBCUN==2			;CURRENT AOBJN WORD TO UDB TABLE
KDBDSP==3			;DISPATCH FOR SERVICE RTN
KDBACT==4			;CURRENTLY ACTIVE UDB OR 0
KDBDDP==5			;START OF DEVICE DEPENDENT PART
KDBUDB==KDBDDP			;THE BLOCK FOR UDB ADDRESSES STARTS
				; AT THE DEVICE DEPENDENT PORTION
				; SINCE THERE CAN BE ONLY 8 UNITS
				; ON A TM02/TM03 AND THERE CAN
				; BE UP TO 16 UNITS ON A DX20/TX02

;BITS AND BYTES

;KDBSTS

KS.ACT==1B1			;ACTIVE
KS.HLT==1B2			;MICROCODE IS HALTED
KS.DSK==1B3			;THIS CONTROLLER IS FOR DISKS
	SUBTTL Unit Data Block

UDBSTS==0			;STATUS AND CONFIGURATION INFORMATION
UDBST1==UDBSTS+1		;SECONDARY STATUS WORD
UDBMBW==UDBST1+1		;MEMORY BANDWIDTH SCHEDULING INFORMATION
UDBODT==UDBMBW+1		;OVERDUE TIMER FOR SEEKS AND THE LIKE
UDBERR==UDBODT+1		;ERROR RECOVERY STATE WORD
UDBERP==UDBERR+1		;ERROR REPORTING WORK AREA IF NONZERO
UDBDSP==UDBERP+1		;UNIT ROUTINE MAIN ENTRY DISPATCH
UDBCDB==UDBDSP+1		;SECONDARY,,PRIMARY CDB
UDBADR==UDBCDB+1		;SECONDARY,,PRIMARY ADDRESS OF UNIT ON CHANNEL
UDBAKA==UDBADR+1		;CURRENT CDB,,CURRENT CHAN ADDR
UDBVID==UDBAKA+1		;VOLUME ID
UDBSTR==UDBVID+1		;LOGICAL UNIT # WITHIN STRUCTURE ,, STRUCTURE #
UDBKDB==UDBSTR+1		;POINTER TO KDB, IF ANY
UDBDSH==UDBKDB+1		;HIGH ORDER DRIVE SERIAL NUMBER
UDBDSN==UDBDSH+1		;DRIVE SERIAL NUMBER
UDBSEK==UDBDSN+1		;SEEKS
UDBRED==UDBSEK+1		;READS - SECTORS IF DISK, FRAMES IF TAPE
UDBWRT==UDBRED+1		;WRITES - SECTORS IF DISK, FRAMES IF TAPE
UDBRCT==UDBWRT+1		;ACTUAL READ COUNT
UDBWCT==UDBRCT+1		;ACTUAL WRITE COUNT
UDBRVC==UDBWCT+1		;ACTUAL SKIP READ (READ VERIFY) COUNT
UDBSRE==UDBRVC+1		;SOFT READ ERRORS
UDBSWE==UDBSRE+1		;SOFT WRITE ERRORS
UDBHRE==UDBSWE+1		;HARD READ ERRORS
UDBHWE==UDBHRE+1		;HARD WRITE ERRORS
UDBPS1==UDBHWE+1		;CURRENT CYL IF DISK,FILE IF TAPE
UDBPS2==UDBPS1+1		;CURRENT SECTOR WITHIN CYL IF DISK, RECORD IN FILE IF TAPE
UDBPWQ==UDBPS2+1		;POSITION WAIT QUEUE - TAIL,,HEAD
UDBTWQ==UDBPWQ+1		;TRANSFER WAIT QUEUE - TAIL,,HEAD
UDBONR==UDBTWQ+1		;FORK WHO OWNS THIS UNIT (MAINT MODE)
UDBERC==UDBONR+1		;CURRENT RETRY COUNT
UDBSPE==UDBERC+1		;SOFT POSITIONING ERROR
UDBHPE==UDBSPE+1		;HARD POS ERR
UDBPNM==UDBHPE+1		;PROGRAM NAME TO LOG ON ERROR
UDBUDR==UDBPNM+1		;USER DIRECTORY NUMBER TO LOG ON ERROR
UDBSIZ==UDBUDR+1		;UNIT SIZE (NUMBER OF CYLINDERS)
UDBFCT==UDBSIZ+1		;SEEK FAIRNESS COUNT
UDBCHB==UDBFCT+1		;IORB USED BY HOME BLOCK CHECK
UDBFCR==UDBCHB+1		;FAIRNESS COUNT FOR READ SEEK PREF
UDBSLV==UDBFCR+1		;UNIT NUMBER (IF UNIT HAS A CONTROLLER)
UDBCHR==UDBSLV+1		;CHARACTERISTICS WORD
UDB2ND==UDBCHR+1		;POINTER TO UDB FOR DYNAMIC ALTERNATE PORT
UDBALT==UDB2ND+1		;POINTER TO UDB FOR STATIC ALTERNATE PORT
UDBNAM==UDBALT+1		;DISK'S AND TAPES DIVERGE HERE**********
				;WORD 0 OF THE HOME BLOCKS
UDBHID==UDBNAM+1		;HOMID
UDBHM2==UDBHID+1
UDBSNM==UDBHM2+1		;HOMSNM
UDBLUN==UDBSNM+1		;HOMSNM
UDBMID==UDBLUN+1
UDBDCF==UDBMID+1		;DON'T CARE FLAGS WORD
UDBCOD==UDBDCF+1		;HOME CODE
UDBPDB==UDBCOD+1
UDBSER==UDBPDB			;TWO WORD SERIAL NUMBER
UDBNPR==UDBSER+2		;NON-CI PROCESSOR
UDBP00==UDBNPR+1		;NODE 0
UDBP01==UDBP00+1		;NODE 1
UDBP02==UDBP01+1		;NODE 2
UDBP03==UDBP02+1		;NODE 3
UDBP04==UDBP03+1		;NODE 4
UDBP05==UDBP04+1		;NODE 5
UDBP06==UDBP05+1		;NODE 6
UDBP07==UDBP06+1		;NODE 7
UDBP08==UDBP07+1		;NODE 8
UDBP09==UDBP08+1		;NODE 9
UDBP10==UDBP09+1		;NODE 10
UDBP11==UDBP10+1		;NODE 11
UDBP12==UDBP11+1		;NODE 12
UDBP13==UDBP12+1		;NODE 13
UDBP14==UDBP13+1		;NODE 14
UDBP15==UDBP14+1		;NODE 15
PDBLEN==UDBP15-UDBSER+1		;LENGTH OF PDB WRITE
	UDB%MA==:1B33		;NODE IN MAINTENANCE MODE
	UDB%WA==:1B34		;WIRE A (BIT OFF MEANS NO-RESPONSE)
	UDB%WB==:1B35		;WIRE B (BIT OFF MEANS NO-RESPONSE)
UDBDDD==UDBP15+1		;DEVICE DEPENDENT PART OF DISK DATA
UDBRNR==UDBNAM			;FRAMES READ IN NRZI (MAGTAPE)
UDBRPE==UDBRNR+1		;FRAMES READ IN PE
UDBRGC==UDBRPE+1		;FRAMES READ IN GCR
UDBWNR==UDBRGC+1		;FRAMES WRITTEN IN NRZI
UDBWPE==UDBWNR+1		;FRAMES WRITTEN IN PE
UDBWGC==UDBWPE+1		;FRAMES WRITTEN IN GCR
UDBDDM==UDBWGC+1		;DEVICE DEPENDENT PART IF A MAGTAPE
	SUBTTL Unit Data Block -- Bits and Bytes

;BITS AND BYTES

;UDBSTS

US.OFS==1B0			;OFFLINE OR UNSAFE (MUST BE SIGN BIT)

US.CHB==1B1			;CHECK HOME BLOCKS BEFORE ANY NORMAL IO
US.POS==1B2			;POSITIONING IN PROGRESS
US.ACT==1B3			;ACTIVE
US.BAT==1B4			;OFF IF BAD BAT BLOCKS ON THIS UNIT
				;WATCH THIS ONE IT IS LOGICALLY BACKWARDS!!!!***!!!
US.BLK==1B5			;LOCK BIT FOR THIS UNITS BAT BLOCKS
US.PGM==1B6			;DUAL PORT SWITCH IN (A OR B) (RP04,5,6)
US.MAI==1B7			;UNIT IS IN MAINT MODE
US.MRQ==1B8			;MAINT MODE IS REQUESTED ON THIS UNIT
US.BOT==1B9			;UNIT IS AT BOT
US.REW==1B10			;UNIT IS REWINDING (FOR MAGTAPES)
US.WLK==1B11			;UNIT IS WRITE LOCKED
;US.MAL==1B12			;MAINT MODE ALLOWED ON THIS UNIT
US.CIP==1B12			;UNIT IS ON A CI PORT
US.OIR==1B13			;OPERATOR INTERVENTION REQUIRED.
				;SET AT INTERRUPT LEVEL, CHECKED AT SCHED.
US.OMS==1B14			;ONCE A MINUTE MESSAGE TO OPR. USED IN
				;CONJUNCTION WITH US.OIR
US.PRQ==1B15			;POSITIONING REQUIRED ON THIS UNIT
US.TAP==1B16			;TAPE TYPE DEVICE
US.PSI==1B17			;PSI ONLINE/OFFLINE/REWIND DONE TRANSITION OCCURRED
US.DSK==1B18			;DISK TYPE DEVICE
US.OR1==1B19			;1ST OVERDUE REWIND TIMER BIT
US.OR2==1B20			;2ND OVERDUE REWIND TIMER BIT
US.2PT==1B21			;DRIVE IS POTENTIALLY DUAL-PORTED BETWEEN SYSTEMS
US.ORC==US.OR1!US.OR2		;OVERDUE REWIND FIELD
US.TPD==1B22			;DISK IS OFFLINE TO PREVENT THREE PORTS
US.BDK==1B23			;CI BROADCAST NEEDED
US.RTY==7B26			;Retry count field (bits 24,25,26)
US.CIA==1B27			;CI AVAILABLE
US.UNA==1B28			;DEVICE UNAVAILABLE (LIKE 16 BIT DISK)

USSTYP==SIZ.UT			;UNIT TYPE FIELD SIZE
USPTYP==^D35			;UNIT TYPE FIELD POSITION
DEFSTR (USTYP,UDBSTS,USPTYP,USSTYP) ;UNIT TYPE IN UDBSTS

MSKSTR (USOFL,UDBSTS,US.OFS)	;UNIT OFFLINE
;UDBST1

U1.OFS==1B0			;DUAL-PORTED DISK FORCED OFFLINE BY TOPS-20
U1.FED==1B1			;DRIVE PORTED TO FRONT-END
U1.DCD==1B2			;DISK HAS DON'T-CARE FLAG SET IN ITS HOMEBLOCK
U1.DCU==1B3			;DRIVE DECLARED DON'T-CARE
U1.HBR==1B4			;HOME BLOCK READ IN PROGRESS
U1.PDW==1B5			;PDB WRITE IN PROGRESS
U1.STC==1B6			;CI STATUS CHANGE WHILE READING HOME BLOCKS,
				; THEREFORE WE MUST DO IT AGAIN
U1.DCR==1B7			;DON'T-CARE ABOUT THIS DUAL-PORTED DISK (U1.DCD!U1.DCU COMPOSITE)
U1.PHB==1B8			;PRIMARY HOMEBLOCK BAD
U1.SHB==1B9			;SECONDARY HOMEBLOCK BAD
U1.PDR==1B10			;PDB READ IN PROGRESS
U1.VV==1B11			;VOLUME VALID (TO FIX PROBLEM WITH RP07'S
				;AND DUAL PORTED DISKS)
U1.ODT==1B12			;OVERDUE IORB INDICATOR
U1.SOF==1B13			;[7.1063]This unit caused a structure
U1.NOL==1B14                    ;[7.1276] This unit has not been onlined
                                ;[7.1276] yet so wait a specified amount of
                                ;[7.1276] time if this is set when searching
                                ;[7.1276] for a login structure
				;[7.1063] timer to be triggered

;UDBCHR

UC.7TK==1B0			;7 TRACK TAPE DRIVE

;DENSITYS DRIVE IS CAPABLE OF
UC.200==1B1			;200 BPI
UC.556==1B2			;556 BPI
UC.800==1B3			;800 BPI
UC.160==1B4			;1600 BPI
UC.625==1B5			;6250 BPI

;DATA MODES DRIVE IS CAPABLE OF
UC.CD==1B6			;CORE DUMP MODE
UC.6B==1B7			;SIXBIT MODE
UC.AA==1B8			;ANSI ASCII MODE
UC.IC==1B9			;INDUSTRY COMPATIBLE MODE
UC.HD==1B10			;HI-DENSITY MODE
IFN STANSW&SC30SW,<
UC.PT==1B11			;PETIT MODE
>;IFN STANSW&SC30SW

UC.OLB==777B35			;ONLINE BITS FOR MSCP SERVICED DISKS
				; BITS 27-35

;UDBALT
UA.PAT==1B0			;PORT ATTACHED (MUST BE SIGN BIT)
	SUBTTL Unit Data Block -- Unit Service Routine Entry Dispatch

;UNIT ROUTINE MAIN ENTRY POINTS

UDSINI==0			;INITIALIZE
UDSSIO==1			;START IO,SKIPS IF OK.
UDSINT==2			;INTERRUPT ROUTINE
UDSERR==3			;ERROR RECOVERY,SKIP IF DONE.
UDSHNG==4			;HUNG RESET
UDSCNV==5			;CONVERT LINEAR ADDR TO CYL,SURF,SEC
UDSLTM==6			;RETURN LATENCY/BEST REQUEST
UDSPOS==7			;START POSITION,SKIP IF OK.
UDSATN==10			;ATTENTION INTERUPT
UDSPRQ==11			;SKIP IF POSITIONING REQUIRED
UDSSTK==12			;STACK SECOND COMMAND, SKIP IF OK
UDSEXT==13			;CHECK LEGALITY OF A UNIT, SKIP IF EXISTANT
UDSCCK==14			;CHECK FOR HALTED MICROCODE IN CONTROLLERS
UDSPRL==15			;RELEASE PORT

;CALLING SEQUENCES

;ENTRY	INPUT	OUTPUT	;COMMENTS

;INI	P1,Q2	P2,3	;CALLED ONCE PER UNIT. Q2/ UNIT NUMBER
;			;Q3/ SUBUNIT # IF GT 1 SUBUNITS
;			;RETURNS UDB IN P3,MAY RETURN KDB IN P2.
;SIO	P4,P1,3		;STARTS IO ON AN IORB. SKIPS IF OK.
;INT	P1,P3		;CALLED ON INTERRUPT FOR XFR DONE.
;ERR	P4,P1,3		;INITIATE ERROR RETRY. SKIPS IF NO MORE RETRYS.
;HNG	P1,3		;CALLED FROM TIMER TO RESET HUNG DEVICE.
;CNV	T1,P1,3	T1,2,3	;CONVERTS FROM UNIT LINEAR ADDR TO CYL,SURF,SEC
;			;T1/ LINEAR ADDR, ON RETURN: T1/ SAME, T2/CYL,T3/SURF,,SEC
;LTM	P1,3	T1,2,3	;SEE CDSLTM
;POS	P4,P1,3		;START POSITIONING ON IORB. SKIPS IF OK
;ATN	P1,3,Q1	P4,2	;CALLED ON DRIVE ATTENTION INTERRUPT.
;			;RETURNS P4=0 IF NO ERRORS (SEEK ERRORS)
;			;SETS LH(Q1) TO -1 IF IORB POSITION DONE
;			;NOTE: TAPE SHOULD RETURN P4=0, Q1 UNCHANGED
	SUBTTL IO Request Block

IRBSTS==0			;STATUS,, NEXT IORB
IRBLNK==0			;WHEN REFERING TO LINK
IRBMOD==1			;PRIO,DENSITY,PAR,MORE
IRBCNT==2			;COUNT OF DATA TRANSFERRED
IRBXFL==3			;XFR LIST TAIL,,HEAD
IRBIVA==4			;SIO EXIT,,ROUTINE TO CALL ON TERMINATION
IRBADR==5			;PHYSICAL DEVICE ADDRESS (IF NEEDED)
IRBPAD==:1B0			;PHYSICAL DEVICE ADDRESS (IF NEEDED)
IRBLEN==:6			;LENGTH OF IORB
IRBCCW==:6			;FIRST IRB CCW WORD ADDRESS

;STRUCTURE DEFINITIONS FOR THE IORB

DEFSTR (IRLNK,IRBLNK,35,18)	;LINK TO NEXT IORB
DEFSTR (IRBHD,IRBXFL,35,18)	;POINTER TO HEAD OF TRANSFER LIST
DEFSTR (IRBTL,IRBXFL,17,18)	;POINTER TO TAIL OF TRANSFER LIST
	SUBTTL IO Request Block -- Functions and Modes

;FUNCTIONS, POINTER IRYFCN
ISSFCN==4			;FUNCTION CODE SIZE
ISPFCN==^D17			;POSITION IN IRBSTS
DEFSTR (ISFCN,IRBSTS,ISPFCN,ISSFCN) ;FUNCTION CODE IN IORB

	IRFRED==1		;READ DATA
	IRFRDF==2		;READ DATA AND FORMAT (COUNT, KEY, HEADER)
	IRFWRT==3		;WRITE DATA
	IRFWTF==4		;WRITE FORMAT
	IRFSEK==5		;SEEK
	IRFFSB==6		;FORWARD SPACE BLOCK
	IRFBSB==7		;BACKSPACE BLOCK
	IRFWTM==10		;WRITE TAPE MARK
	IRFERG==11		;ERASE GAP
	IRFREW==12		;REWIND
	IRFRUN==13		;REWIND AND UNLOAD
	IRFRDR==14		;READ REVERSE
	IRFRCR==15		;RECOVERY READ
	IRFWVC==16		;WRITE WITH VALIDITY CHECK
	IRFRVC==17		;READ VALIDITY CHECK


;MODES

IMSMOD==3			;SIZE OF MODE WHAT
IMPMOD==^D17			;POSITION OF MODE FIELD
DEFSTR (IRBDM,IRBMOD,IMPMOD,IMSMOD) ;DATA MODE
IRBSDN==4			;SIZE OF DENSITY FIELD
DEFSTR (IRBDN,IRBMOD,35,IRBSDN)	;DENSITY FIELD
DEFSTR (IRBPAR,IRBMOD,31,1)	;PARITY BIT
DEFSTR (IRBPRI,IRBMOD,30,4)	;PRIORITY FIELD

	IRMWRD==1		;WORD MODE
	IRM6BT==2		;SIXBIT
	IRM7BT==3		;SEVEN BIT MODE
	IRM8BT==4		;EIGHT BIT MODE
	IRMHID==5		;HIGH DENSITY MODE
IFN STANSW&SC30SW,<
	IRMPET==6		;PETIT MODE
	IRMMAX==6		;MAXIMUM LEGAL MODE
>;IFN STANSW&SC30SW
IFE STANSW&SC30SW,<
	IRMMAX==5		;MAXIMUM LEGAL MODE
>;IFE STANSW&SC30SW
	SUBTTL IO Request Block -- Bits and Bytes

;BITS AND BYTES

;LH IRBSTS

IS.SHT==1B0			;SHORT FORM (PAGEM) REQUEST
IS.DON==1B1			;DONE WITH THIS IORB
IS.ERR==1B2			;ERROR ON THIS OPERATION
IS.NRT==1B3			;NO MORE RETRIES
IS.WGU==1B4			;WRONG UNIT INTERRUPTED
IS.TPM==1B5			;HIT TAPE MARK
IS.EOT==1B6			;ON WRITE ONLY: HIT PHYSICAL EOT
IS.WLK==1B7			;WRITE LOCKED
IS.IER==1B8			;INHIBIT ERROR RECOVERY
IS.DTE==1B9			;DATA ERROR
IS.DVE==1B10			;DEVICE (HARDWARE) ERROR
IS.BOT==1B11			;HIT BEGINING OF TAPE
IS.RTL==1B12			;RECORD TOO LONG (BUFFER TOO SMALL?)
IS.IEL==1B13			;INHIBIT ERROR LOGGING

IS.ALE==IS.ERR!IS.NRT!IS.WGU!IS.DTE!IS.DVE!IS.RTL ;ALL ERROR BITS
MSKSTR (ISERR,IRBSTS,IS.ERR)	;ERROR ON THIS OPERATION
MSKSTR (ISTPM,IRBSTS,IS.TPM)	;TAPE MARK HIT

IFN STANSW,<
;THESE DEFINITIONS ARE USED BY PHYMEI AND ITS CALLERS

;IORB EXTENSIONS
IRBCC0==7			;CCW WORD
IRBCC1==10			;CCW WORD
IRBCC2==11			;CCW WORD
IRBDUN==12			;ROUTINES FOR BUFFER HANDLING ON TERMINATION
IRBLLN==13			;LENGTH OF A MEIS IORB

;MEIS IORB FIELD DEFINITIONS
DEFSTR IRHDR,IRBADR,0,1		;HEADER DATA MODE (0 IS .PM16, 1 IS .PM32)
DEFSTR IRTRF,IRBADR,1,1		;TRAILER DATA IS VALID
DEFSTR IRPMD,IRBADR,5,4		;DATA MODE OF DATAGRAM BODY
DEFSTR IRHLN,IRBADR,11,6	;COUNT OF 16-BIT BYTES IN HEADER
				;8 FREE BITS BETWEEN IRHLN AND IRCHK
DEFSTR IRCHK,IRBADR,35,16	;16 BITS OF TRAILER DATA
DEFSTR IRBUF,IRBLEN,35,36	;BUFFER'S GLOBAL ADDRESS
DEFSTR IRDUN,IRBDUN,35,18	;PACKET DISPOSAL ROUTINE ON SUCCESS
DEFSTR IRBAD,IRBDUN,17,18	;PACKET DISPOSAL ROUTINE ON ERROR

;MEIS DATA MODES IN CASE NOT DEFINED IN MONSYM
.PM16==0
.PM32==1
.PM36==2
.PMASC==3
.PM16S==4
.PM9==5
>;IFN STANSW
	SUBTTL Parameters - Usually determine maximum # of devices

PZSSIZ==20			;PAGE ZERO STORAGE
CHNN==^D8			;MAXIMUM NUMBER OF CHANNELS
MAXRH==10			;MAXIMUM NUMBER OF UNITS ON RH20
NUIORB==^D55			;NUMBER OF IORBS FOR UDSKIO MUST BE GE 2
UIOLEN==IRBLEN+10		;LENGTH OF FREE STG BLOCK IN IORB POOL
CCWMAX==^D50			;GREATEST NUMBER OF CCW WORDS ALLOWABLE

LPHYPD==150			;PRIVATE PDL

LPHIPD==220			;INTERRUPT PDL
	SUBTTL Macro Definitions

;PI SYSTEM CONTROL
PHYCHN==:5			;CHANNEL FOR PHYSIO DEVICES

DEFINE IOPIOF<
	CHNOFF PHYCHN
>

DEFINE IOPION<
	CHNON PHYCHN
>
	SUBTTL Type Codes

;BLOCK TYPES

SIZ.UT==5			;CHANNEL/UNIT TYPE CODE SIZE

XSSTYP==2		;SIZE OF BLOCK TYPE FIELD
XSPTYP==^D35-SIZ.UT	;POSITION OF BLOCK TYPE FIELD

.BTCDB==1		;CDB
.BTKDB==2		;KDB
.BTUDB==3		;UDB

;CHANNEL TYPES
.CTRH1==1			;RH10
.CTRH2==2			;RH20
.CTRH3==3			;RH11
.CTCI==4			;KLIPA (CI)
.CTNI==5			;KLIPA (NI)
IFN STANSW&SC30SW,<
.CTSSA==6			;FA10
>;IFN STANSW&SC30SW

;UNIT TYPES

.UTRP4==1			;RP04
.UTRS4==2			;RS04
.UTT45==3			;TU45
.UTTM2==4			;TM02 (AS UNIT)
.UTRP5==5			;RP05
.UTRP6==6			;RP06
.UTRP7==7			;RP07
.UTRP8==10			;RP08
.UTRM3==11			;RM03
.UTTM3==12			;TM03
.UTT77==13			;TU77
.UTTM7==14			;TM78
.UTT78==15			;TU78
.UTDXA==16			;DX20A FOR TAPES
.UTT70==17			;TU70 (800/1600 200IPS 9TRK)
.UTT71==20			;TU71 (200,556,800 200IPS 7TRK)
.UTT72==21			;TU72 (1600/6250 125IPS 9TRK)
.UTT73==22			;TU7x (1600/6250 200IPS 9TRK)
				;DO NOT REORDER .UTT70 - 3 WITHOUT
				; ALSO REORDERING TABLES IN PHYX2
.UTDXB==23			;DX20B FOR RP20 DISKS
.UTP20==24			;RP20
.UTNOD==25			;CI OR KLIPA NODE, WITH NO MSCP SERVER
.UTHSC==26			;HSC50
.UTR80==27			;RA80
.UTR81==30			;RA81
.UTR60==31			;RA60
.UTR82==32			;RA82 (FUTURE)
.UTR62==33			;RA62 (FUTURE)
.UTTA7==34			;TA78
IFN STANSW,<
.UTMEI==35			;MEIS CONTROLLER
IFN SC30SW,<
.UTTAP==:36			;IBM-COMPATIBLE TAPE
.UTDSK==:37			;IBM-COMPATIBLE DISK
.UTCT1==:3			;ISI SA10 IBM COMPATABLE TAPE
.UTCC1==:2			;ISI SA10 CALCOMP 230 (=IBM 3330 MOD I)
.UTCC2==:5			;ISI SA10 CALCOMP 235 (=IBM 3330 MOD II)
>;IFN SC30SW
>;IFN STANSW
;MASSBUS DEVICE TYPES

TY.RP4==020			;RP04
TY.RP5==021			;RP05
TY.RP6==022			;RP06
TY.RM3==24			;RM03
TY.R7F==42			;RP07 FIXED HEAD
TY.R7M==41			;MOVING RP07
 TY.RPL==TY.RP4			;LOWEST "RP04" TYPE
 TY.RPH==TY.R7F			;HIGHEST "RP04" TYPE
TY.RS4==002			;RS04 DRIVE TYPE
TY.T2L==010			;LOWEST TM02 TYPE
TY.T2H==017			;HIGHEST TM02 TYPE
TY.T3L==050			;LOWEST TM03 TYPE
TY.T3H==057			;HIGHEST TM03 TYPE
TY.T77==014			;TU77 NOTE: TM03 HAS 40 BIT ON
TY.DXA==060			;DX20A TYPE (FOR TUXX TAPES)
TY.DXB==061			;DX20B TYPE (FOR RP20 DISKS)
TY.T78==101			;TM78
IFN STANSW,<
TY.MEI==700			;MEIS CONTROLLER
>;IFN STANSW
	SUBTTL KLIPA Parameters

;KLIPA PARAMETERS

KLPRH2==7			;KLIPA IS ALWAYS (AND ONLY) ON RH#7
KLP==540+KLPRH2*4		;DEVICE CODE

;CONI/CONO BITS

CI.PPT==1B0			;PORT PRESENT
CI.CPE==1B6			;CRAM PARITY ERROR
CI.MBE==1B7			;MBUS ERROR
CI.IDL==1B11			;IDLE LOOP
CI.DCP==1B12			;DISABLE COMPLETE
CI.ECP==1B13			;ENABLE COMPLETE
CI.KDT==400003,,0		;KLIPA DEVICE TYPE
CO.CPT==1B18			;CLEAR PORT
CO.LAR==1B21			;READ LAR
CI.EPE==1B24			;EBUS PARITY ERROR
CI.FQE==1B25			;FREE QUEUE ERROR
CO.CQA==1B27			;COMMAND QUEUE AVAILABLE
CI.RQA==1B28			;RESPONSE QUEUE AVAILABLE
CO.DIS==1B30			;DISABLE
CO.ENA==1B31			;ENABLE
CO.MRN==1B32			;MICRO-PROCESSOR RUN
CO.BTS==CO.ENA+CO.MRN		;BITS WHICH NEED TO BE ON IN ALL CONOS, UNLESS
				;YOU WANT THE PORT TO REMAIN IN (OR ENTER) THE
				;DISABLED STATE

;KLIPA DEVICE DEPENDENT WORDS AT END OF CDB
CDBPCB==CDBDDP			;ADDR OF PCB 
CDBSBS==CDBDDP+1		;ADDR OF 1ST SYSTEM BLOCK
CDBNOD==CDBDDP+2		;OUR PORT'S CI NODE NUMBER
CDBLDU==CDBDDP+3		;LAST USER WHO LOADED THE PORT'S U-CODE
CDBDMU==CDBDDP+4		;LAST USER WHO DUMPED THE PORT'S U-CODE
;KLIPA CHANGES TO CDB

CDBFLG==CDBCAD			;FLAGS
	DEFSTR (CFSTA,CDBFLG,5,6) ;STATE OF THE PORT
	CHNUNK==0		;unknown (system startup)
	CHNSTP==1		;stopped (and needs to be started)
	CHNNRL==2		;needs to have ucode reloaded
	CHNRIP==3		;ucode reload in progress
	CHNNDM==4		;needs to have dump taken
	CHNDIP==5		;dump in progress
	CHNMAI==6		;maintenace mode (owned by diagnostic)
	CHNDED==7		;dead (we are not trying to start it)
	CHNRUN==10		;running
	CHNRLC==11		;ucode reload complete
	CHNDMC==12		;ucode dump complete
	DEFSTR (CSLDF,CDBFLG,26,9) ;LAST FORK THAT LOADED THE PORT'S U-CODE
	DEFSTR (CSDMF,CDBFLG,35,9) ;LAST FORK THAT DUMPED THE PORT'S U-CODE
CDBVER==CDBCAD+1		;VERSION
	DEFSTR (CDPRT,CDBVER,0,1)	;PORT: 0=CI, 1= NI
	DEFSTR (CDCHN,CDBVER,17,3)	;RH20 CHANNEL NUMBER
	DEFSTR (CDVER,CDBVER,35,18)	;U-CODE VERSION NUMBER
CDBLG0==CDBCC1			;LOGOUT WORD 0
CDBLG1==CDBCC2			;LOGOUT WORD 2
CDBLG2==CDBICR			;LOGOUT WORD 3
CDBQRQ==CDBRST			;NON-0 IF HAD TO REQUEUE A REQUEST
CDBCTR==CDBCL2			;MONOTONIC NUMBER,,FORK WHICH OWNS COUNTERS
CDBFQE==CDBCL2+1		;MESSAGE,,DATAGRAM FREE QUEUE ERROR COUNT
CDBECW==CDBCL2+2		;CCW FROM PCB AT ERROR

CDBLEN==CDBDDP+4-CDBINT		;LENGTH OF KLIPA CDB

RHEPT==0			;EPT ADDRESS OF FIRST RH20 SLOT

CHCNT==MASKB(3,13)		;MASK FOR WORD COUNT IN CCW
CHADR==MASKB(14,35)		;MASK FOR PHYSICAL ADDRESS IN CCW
IFN STANSW&SC30SW,<
	SUBTTL ISI SA10 parameters

;Parameters for SA10 channel and IBM style devices used on SA10.

SSANSC==4			;number of subchannels on an SA10
SA10BF==1			;all are model "B" SA10s

SA0==274			;device number of 1st SA10
SA1==374			;device number of 2nd SA10

SSACHN==:PHYCHN			;PI channel for SA10

MAXSAU==^D8			;maximum units supported on each SA10 subchan.

PGSIZ==:1000			;Better be same as in prolog
NWREC==PGSIZ			;size of physical record
NBREC==NWREC*9/2		;number of bytes per record
NRECS==5			;number of records per track, mod I or II

;PARAMETERS USED IN SA10 AND IBM-STYLE DEVICES

; 8 bit bytes in a word

BYTE0==MASKB(0,7)
BYTE1==MASKB(8,15)
BYTE2==MASKB(16,23)
BYTE3==MASKB(24,31)

; bits in an 8 bit byte

BB0==200
BB1==100
BB2==040
BB3==020
BB4==010
BB5==004
BB6==002
BB7==001
;CONO TO SSA

SA%INI==1B18		;Initialize whole SA10
SA%CME==1B19		;Clear memory error flags
SA%CLK==1B26		;Clock control in SA10 microprocessor
SA%FCN==MASKB(27,29)	;Function selection
 .SANOP==0		;NOP=0
 .SAHIO==2		;Halt I/O
 .SARSC==3		;Reset channel
 .SAGOF==4		;Go flag for channel
 .SASRQ==5		;Status request flag
 .SASTS==6		;Status done flag
 .SAPIE==7		;Interrupt enable for a channel
SA%SET==1B30		;Set/do one of above flags/functions.
SA%CLR==0B30		;Clear one of above flags.
SA%CHN==MASKB(31,32)	;(Sub)Channel select for above functions
 .SACH0==0		;Select channel 0
 .SACH1==1		;Select channel 1
 .SACH2==2		;Select channel 2
 .SACH3==3		;Select channel 3
SA%PIA==MASKB(33,35)	;PI assignment for the SA10 as a whole.

;CONI FROM SSA

SA%PIR==1B18		;A PI request is being made
SA%MPE==1B19		;Parity error flag
SA%NXM==1B20		;Non-existent memory flag
SA%IEN==MASKB(21,24)	;Interrupt enable bits
SA%GON==MASKB(25,28)	;Go flags
SA%SFN==MASKB(29,32)	;The status flags
 ;The following codes apply to SA%IEN, SA%FON,SA%SFN
 .SACB0==10		;Bit for channel 0
 .SACB1==04		;Bit for channel 1
 .SACB2==02		;Bit for channel 2
 .SACB3==01		;Bit for channel 3
;and the PIA comes back in bits 33-35 (SA%PIA)
; field sizes for 2 models of SA10

   IFE SA10BF,<
	WCSIZ==^D15		;size of word count field
	ADSIZ==^D20		;size of address field
   >
   IFN SA10BF,<
	WCSIZ==^D11		;size of word count field
	ADSIZ==^D24		;size of address field
   >

;Block Multiplexor Control Commands (entries in Device List)

   IFE SA10BF,<
BMX%CM==MASKB(0,3)		;command field
BMX%DV==MASKB(8,15)		;device field
   >
   IFN SA10BF,<
BMX%CM==MASKB(8,11)		;command field
BMX%DV==MASKB(0,7)		;device field
   >
BMX%AD==MASKB(36-ADSIZ,35)	;address field (points to CP)

; Commands in the command field

 .BMXS==^B1101			;Start this device
 .BMXW==^B1110			;Waiting on this device
 .BMXT==^B1111			;This device has terminated
 .BMXE==^B0000			;End of list

;Channel Program commands

TCH==1B1			;Transfer in Channel program
				; (valid in CP or at Base address)
BMX.LP==3B1			;Block multiplexor Device List Pointer
				; (only valid at Base address)
;Device Command Word

SC%CCF==BYTE0			;channel command flags
 .SCNMX==BB0			;No Memory Transfer
 .SCTMM==BB1			;Transfer mode modifier 
 .SCXCT==BB2			;execute this word
 .SCCHN==BB3			;chain to further words after this one
 .SCBYT==BB4			;transfer bytes, not words (byte = 8 bits)
				; (for tape, used with .SCTMM to specify mode)
 .SCINT==BB5			;cause an interrupt when this CMD executed
 .SCILE==BB6			;ignore length error
 .SCBOF==BB7			;byte offset. start 2 bytes over in word.
  .SCWDM==0*.SCBYT+0*.SCTMM	; Word mode
  .SCBTM==1*.SCBYT+0*.SCTMM	; Byte mode (SC name) [counts are byte counts]
  .SCICM==1*.SCBYT+0*.SCTMM	; "Industry Compatible" mode (DEC name) [byte count]
  .SCNLM==0*.SCBYT+1*.SCTMM	; Natural mode (SC name) 
  .SCHDM==0*.SCBYT+1*.SCTMM	; "High Density" mode (DEC name)
  .SCTCM==1*.SCBYT+1*.SCTMM	; "Tape Compatibility" mode (SC name)
  .SCCDM==1*.SCBYT+1*.SCTMM	; "Core Dump" mode (DEC name)

SC%CMD=BYTE1			;device command field
SC%DEV=BYTE2			;device address field

DEFINE DCW (BITS,CMD,DEV)<
	..CW==0
   IRP BITS,<..CW==..CW!.SC'BITS>
	EXP FLD(..CW,SC%CCF)+FLD(CMD,SC%CMD)+FLD(DEV,SC%DEV)>


;Device Chain Word (IOW) 

SC%LST==1B0			;last command in chain if on
SC%CNT==MASKB(1,WCSIZ)		;word count (negative)
SC%ADR==MASKB(36-ADSIZ,35) 	;core address
SC%PAG==<SC%ADR-<PGSIZ-1>>	;page number portion of address field


DEFINE IOW (CNT,ADR,CHN)<+<FLD(-CNT,SC%CNT)&SC%CNT>+FLD(ADR,SC%ADR)! IFB <CHN>,<SC%LST>>

; Halt command

DEFINE HLT.H <0B0>		;halt, hanging
DEFINE HLT.C <1B0>		;halt, continuing
DEFINE HLT <HLT.H>		;default to hang
;DEVICE CODES ON THE IBM BUS

.IDDSK==140			;Address of Disk drive 0
.IDMTA==200			;Address of Tape drive 0

;Channel status byte -- B0 - B7 of status word one in low core

S1%CHS==BYTE0			;channel status in status word 1
 S1%STY==MASKB(0,1)		;status type
  .S1INI==0			;Initial selection status 
  .S1END==1			;Ending status 
  .S1ASY==2			;Asynchronous status
  .S1DMY==3			;Dummy status (program requested)
 .S1SER==040			;Select err. no such device.
 .S1BIP==020			;Bus in parity error on IBM chan bus
 .S1CSE==004			;Control sequence error. Junk on BUS.
 .S1LNE==002			;Length error (data xfer word/byte count)
 .S1PIF==001			;Prog interrupt flag (req by chan prg)

;IBM-device status byte. Appears in B8-B15 of status wd 1

S1%DVS==BYTE1			;device status in status word 1
 .S1ATN==200			;Attention
 .S1SMD==100			;Status modifier
 .S1CUE==040			;Control unit end
 .S1BSY==020			;Busy (device or controller)
 .S1CHE==010			;Channel end (data xfr through)
 .S1DVE==004			;Device end
 .S1UCK==002			;Unit check
 .S1UEX==001			;Unit exception (unusual state, not error)
S1%DEV==BYTE2			;device code of unit interrupting
;IBM command codes - opcodes to tape or disk

.ICNOP==003			;No-operation
.ICWRT==001			;Write data (Tape)
.ICRDT==002			;Read data (Tape)
.ICRDD==006			;Read data area of DSK record
.ICWRD==005			;Write data area of DSK record
.ICSNS==004			;Request sense bytes from device
.ICREW==007			;Rewind (Tape)
.ICSEK==007			;Seek (Disk)
.ICRDR==014			;Read reverse (Tape)
.ICRUN==017			;Rewind-unload (Tape)
.ICERG==027			;Erase gap (Tape)
.ICWEF==037			;Write tape mark (end of file)
.ICBSB==047			;Backspace block
.ICBSF==057			;Backspace file
.ICSKB==067			;Skip block
.ICSKF==077			;Skip file
.ICSSC==043			;Set sector (Disk) wait for right angular pos.
.ICSIE==061			;Search id equal (Disk)
.ICRCL==027			;Recalibrate (restore) (Disk)
.ICRDC==022			;Read count (Disk)
.IC962==323			;Set mode 9-trk, higher density (6250) (Tape)
.IC916==303			;Set mode to 9-track, Hi density (1600) (Tape)
.IC908==313			;Set mode to 9-track, Lo density (800) (Tape)
; Sense byte bits

;Sense byte 0
SN%CRJ==FLD(BB0,BYTE0)		;command reject
SN%IRQ==FLD(BB1,BYTE0)		;intervention required
SN%BOP==FLD(BB2,BYTE0)		;bus out parity check
SN%EQC==FLD(BB3,BYTE0)		;equipment check
SN%DC== FLD(BB4,BYTE0)		;data check
SN%OVR==FLD(BB5,BYTE0)		;overrun
SN%WCZ==FLD(BB6,BYTE0)		;word count zero (tape)
SN%DCC==FLD(BB7,BYTE0)		;data converter check (tape)

;sense byte 1 (disk)

SN%PRM==FLD(BB0,BYTE1)		;permanent error
SN%ITF==FLD(BB1,BYTE1)		;invalid track format
SN%EOC==FLD(BB2,BYTE1)		;end of cylinder
;	FLD(BB3,BYTE1)
SN%NRF==FLD(BB4,BYTE1)		;no record found
SN%FPR==FLD(BB5,BYTE1)		;file protect
SN%WIN==FLD(BB6,BYTE1)		;write inhibit
SN%OPI==FLD(BB7,BYTE1)		;operation incomplete

;sense byte 2 (disk)

SN%COR==FLD(BB1,BYTE2)		;correctable
SN%EDP==FLD(BB3,BYTE2)		;environmental data present

;
; macro to generate a channel program for disk
;
DEFINE CC1CP(LABEL,SHORT)<
...BEG:
...RCL:	DCW <NMX,XCT,CHN,ILE>,.ICRCL,.IDDSK ;recalibrate command
LABEL:				;normal channel program begins here
...SKC:	DCW <XCT,CHN,BYT>,.ICSEK,.IDDSK ;seek cylinder
	IOW 6,LABEL+DPOSEK	; address of cylinder
...SSC:	DCW <XCT,CHN,BYT>,.ICSSC,.IDDSK ;set sector
	IOW 1,LABEL+DPOSEK+2	; address of sector number
...SRC:	DCW <XCT,CHN,BYT,BOF>,.ICSIE,.IDDSK ;search ID equal
	IOW 5,LABEL+DPOSEK	; address of search address
...TCC:	TCH .-2			;keep searching
...OPC:	DCW <XCT>,.ICRDD,.IDDSK	;read data or write data

IFB <SHORT>,<
...ADR:	EXP 0,0,0,0		;room for up to 3 IOW's + HLT **
	EXP 0			;#2 extra halt for safety

...PSK:	DCW <XCT,BYT>,.ICSEK,.IDDSK ;#2 seek cylinder (no chaining)
	IOW 6,LABEL+DPOSEK	;#2  address of cylinder
	HLT.C			;#2 end of Seek-only program
	EXP 0			;#2 extra halt for safety

...SNP:
	DCW <XCT,CHN,BYT>,.ICSNS,.IDDSK ;sense command
	IOW ^D24,.-.		;where to store sense bytes
	HLT.H			;end of sense program (hang when done)

...SEK:	EXP 0,0,0		;seek argument for drive 
...LEN:				;end of CP
>				;end of IFB <SHORT>

IFB <SHORT>,<
DPORCL==:...RCL-LABEL		;displacement to Recalibrate command
DPOSKC==:...SKC-LABEL		;displacement to Seek command
DPOSSC==:...SSC-LABEL		;displacement to Set sector command
DPOSRC==:...SRC-LABEL		;displacement to Search command
DPOTCC==:...TCC-LABEL		;displacement to TCH back to Search
DPOOPC==:...OPC-LABEL		;displacement to Read/Write command
DPOADR==:...ADR-LABEL		;displacement to Read/Write IOW (address)
DPOPSK==:...PSK-LABEL		;#2 displacement to Position only Seek cmd
DPOSNP==:...SNP-LABEL		;displacement to Sense command
DPOSEK==:...SEK-LABEL		;displacement to Seek buffer
DPOCPL==:...SNP-...BEG		;length of standard channel program
DPOLEN==:...LEN-...BEG		;length of command program
>				;end of IFB <SHORT>

	PURGE ...BEG,...END,...RCL,...OPC,...ADR,...SNP,...SEK
	PURGE ...SKC,...SSC,...SRC,...TCC
>
	SUBTTL FA10 parameters

; FA10 command block

.FAUNS==:0			; unit/sector
  DEFSTR (FAUNT,.FAUNS,27,8)	; unit number
  DEFSTR (FASEC,.FAUNS,35,8)	; sector number
.FATSE==:1			; timer/state code/error control
  DEFSTR (FATIM,.FATSE,27,8)	; timer
  DEFSTR (FASTC,.FATSE,31,4)	; state code
	.FAIDL==:0		; idle
	.FAGO==:1		; go
	.FADON==:17		; done
  DEFSTR (FAERC,.FATSE,35,4)	; error control
	FA.NSC==:1		; no stop on correctable error
	FA.RCL==:10		; recalibrate
.FAPCM==:2			; priority/command
  DEFSTR (FAPRI,.FAPCM,27,8)	; priority
  DEFSTR (FACMD,.FAPCM,35,8)	; command
	.FANOP==:0		; no-op, check state of unit
	.FASEK==:20		; seek
	.FARED==:100		; read data
	.FAWRT==:200		; write data
	.FARCD==:300		; read/compare data
.FACYL==:3			; cylinder
  DEFSTR (FACYL,.FACYL,35,16)	; cylinder
.FAHRC==:4			; head/record
  DEFSTR (FAHED,.FAHRC,27,8)	; head
  DEFSTR (FAREC,.FAHRC,35,8)	; record
.FABCR==:5			; byte count returned
  DEFSTR (FABCR,.FABCR,35,16)	; byte count returned
.FADFL==:6			; low two bytes of DF10 ICW pair
  DEFSTR (FADFL,.FADFL,35,16)	; DF10 ICW pair low bytes
.FADFH==:7			; transfer mode/high byte of DF10 ICW pair
  DEFSTR (FAXFM,.FADFH,27,8)	; transfer mode:
	FA.DFM==:200		; DF10 mode
	FA.22B==:100		; 22-bit mode
  DEFSTR (FADFH,.FADFH,35,8)	; DF10 ICW pair high
.FACBL==.FADFH+1		; length of FA10 command block
; FA10 communications page

MAXFA==:^D16			; number of FA10 command blocks
FACPSZ==:300			; size of FA10 communications page

; Helper macro to allocate words in FA10 communications page

DEFINE ALOCFA(NAM,VAL) <
 NAM==:...FAC
 ...FAC==...FAC+VAL
 IFLE <FACPSZ-...FAC>,PRINTX ? FA10 communications page overflow!
>;DEFINE ALOCFA
...FAC==0			; initialize mechanism

ALOCFA (.FACBA,<MAXFA*.FACBL>)	; command block area
ALOCFA (.FASTA,0)		; origin of status area
ALOCFA (.FAXXX,2)		; "spare longword"
ALOCFA (.FAGFW,1)		; go flag word
ALOCFA (.FAGF2,1)		; second go flag word (n.y.i.)
ALOCFA (.FASTW,1)		; status word
  DEFSTR (FASTW,.FASTW,35,16)	; status word
	.FAOKS==:000001		; OK status
	.FARCE==:002000		; read/compare error
	.FADCC==:004000		; correctable data check
	.FADCU==:001000		; uncorrectable data check
	.FAORN==:014000		; overrun
	.FAATN==:020000		; attention
	.FADNR==:040400		; drive not ready
	.FADOL==:041000		; drive off-line
	.FACOL==:041400		; controller off-line
	.FAHCE==:043000		; header check end
	.FANRF==:043400		; no record found
	.FAHFE==:044000		; header format error
	.FAHNC==:044400		; header non-compare
	.FAWLK==:046400		; write-lock
	.FASEM==:160000		; mask for "serious errors"
ALOCFA (.FAUSB,.FACBL)		; updated command block
ALOCFA (.FAMSC,50)		; miscellaneous status

	PURGE ALOCFA,...FAC
	SUBTTL SYSERR definitions

SEC%SD==121			;SA10 disk error
 SD%IOW==34			;IOW from transfer
 SD%STS==35			;Device specific status
 SD%ES1==47			;Error status (Base+1)
 SD%ES2==50			;More error status (Base+2)
 SD%SEN==51			;Sense bytes (6 words)
 SD%SCP==57			;Pointer to first channel program
 SD%XCP==61			;Pointer to extra channel program
 SD%CCP==60			;Current channel program address
 SD%CP1==62			;First channel program
 SD%CP2==77			;Second channel program
 SD%CPE==114			;Extra channel program

SEC%SM==122			;SA10 magtape error
 SM%DVA==46			;Device address
 SM%ES1==47			;Status word 1 (Base+1)
 SM%ES2==50			;Status word 2 (Base+2)
 SM%SEN==51			;Sense bytes (6 words)

>;IFN STANSW&SC30SW
	SUBTTL End of PHYPAR
	END