Google
 

Trailing-Edge - PDP-10 Archives - BB-H138E-BM - galaxy-sources/mtrmac.mac
There are 12 other files named mtrmac.mac in the archive. Click here to see a list.
;MTRMAC - Universal file for MOUNTR et al
SUBTTL	Preliminaries

;
;
;               COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION
;               	     1984,1985
;
;     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  WHICH  IS  NOT SUPPLIED BY
;     DIGITAL.

IFNDEF REL,<REl==0>		;if ~0 assemble rel
  IFE REL,<
	Universal MTRMAC - MOUNTR Macro and Data definitions
IF2,<
	PRINTX [Assembling MTRMAC.UNV]
> ; End IF2
	.directive .nobin
          >
  IFN REL,<
	Title MTRMAC - MOUNTR Macro and Data definitions
IF2,<
	PRINTX [Assembling MTRMAC.REL]
> ; End IF2
	  >

	SALL				;FOR CLEAN LISTINGS
SUBTTL	Required files 

	SEARCH MONSYM
	SEARCH MACSYM
	SEARCH ACTSYM
	SEARCH SERCOD
	SEARCH GLXMAC
	SEARCH QSRMAC
	SEARCH ORNMAC
SUBTTL	Version Information

	MACMAN==:1			;Maintenance edit number
	MACDEV==:35			;Development edit number
	VERSIN (MAC)			;Gerate edit number
	SUBTTL	Table of Contents


;		Table of Contents for MTRMAC
;
;
;			   Section			      Page
;   1. Preliminaries. . . . . . . . . . . . . . . . . . . . .    1
;   2. Required files . . . . . . . . . . . . . . . . . . . .    2
;   3. Version Information. . . . . . . . . . . . . . . . . .    3
;   4. Table of Contents. . . . . . . . . . . . . . . . . . .    4
;   5. Revision History . . . . . . . . . . . . . . . . . . .    5
;   6. PROGRAM-WIDE MACROS. . . . . . . . . . . . . . . . . .    6
;   7. MACROS FOR LINKED LISTS. . . . . . . . . . . . . . . .    8
;   8. EQUATES. . . . . . . . . . . . . . . . . . . . . . . .    9
;   9. Device Status Entries
;        9.1.   Explanation of device status organization . .   12
;        9.2.   Format of device status file. . . . . . . . .   13
;        9.3.   Format of device entry. . . . . . . . . . . .   14
;        9.4.   MTA Status Block (MSB). . . . . . . . . . . .   15
;        9.5.   MSB field definitions . . . . . . . . . . . .   16
;        9.6.   MT Status Block . . . . . . . . . . . . . . .   17
;        9.7.   Disk Status Block (DSB) . . . . . . . . . . .   18
;        9.8.   DSB Field Definitions . . . . . . . . . . . .   19
;        9.9.   Structure Status Block (SSB). . . . . . . . .   20
;        9.10.  SSB Field Definitions . . . . . . . . . . . .   21
;  10. WTB - Write To Operator with reply Block . . . . . . .   22
;  11. Request Status Block
;       11.1.   Tape Mount RSB. . . . . . . . . . . . . . . .   23
;       11.2.   Tape Mount Field Definitions. . . . . . . . .   24
;       11.3.   Structure Mount RSB . . . . . . . . . . . . .   26
;       11.4.   Structure Mount Field Definitions . . . . . .   27
;       11.5.   Port RSB. . . . . . . . . . . . . . . . . . .   28
;       11.6.   Port Field Definitions. . . . . . . . . . . .   29
;  12. MAGTAPE ACCOUNT STATUS BLOCK
;       12.1.   Description . . . . . . . . . . . . . . . . .   30
;       12.2.   Field Definitions . . . . . . . . . . . . . .   31
;  13. STRUCTURE ACCOUNT STATUS BLOCK . . . . . . . . . . . .   32
;  14. ADDRESS SPACE ALLOCATION . . . . . . . . . . . . . . .   33
SUBTTL 	Revision History

COMMENT \
*****	Release 4.2 -- Begin Maintenance Edits *****

1	4.2.1615	26-Apr-85
	Define NTRY to be the number of times to get a system PID via a
MUTIL% JSYS.

*****	Release 5.0 -- Begin Development edits *****

1	gco 5.1015	4-mar-83
	Create MTRMAC.UNV with data and macro definitions.

2	5.1018		16-mar-83
	Move command definitions back to MOUNTR.

3	4.2.1544	17-mar-83
	Correct definition for bad home block in unit.

4	5.1020		29-mar-83
	Add definitions for divided ipcf.

5	5.1022		7-apr-83
	Add value CIPORT for demarcating the CI port on disk status displays.

6	5.1029		24-may-83
	Add support for SET PORT CI command.  Add Port status block.

7	5.1030		22-june-83
	Add RSBSUP and RSBDSK so that the state of the port request can be
	maitained while doing a port operation requested dismount.

10	5.1037		23-sept-83
	Add bit definitions for exclusive.

11	5.1055		8-Nov-83
	Add bit definition for REMOVE/NOREMOVE.

12	5.1054		15-Nov-83
	Add a bit, R%EXC, to say we are setting a structure exclusive.
	Add the displacement to the characteristic to set in the right
	half of RSBMS1.

13	5.1060		28-Nov-83
	Add a bit, R%REP, to RSBIFL to indicate a FORCE action to a port 
	operation.  Set if FORCE.

14	5.1061		28-Nov-83
	Define a PORT entry for the DEVICE-STATUS.BIN file.

15	5.1078		4-Feb-84
	Lots of changes:
1.  Eliminate second "Assembling MTRMAC.UNV" message during assembly.
2.  Add table of contents
3.  Define $STOP macro.
4.  Add explanation of device status organization.
5.  Reformat device status file entries
6.  Rearrange order of description of the various types of status blocks.
7.  Add pointers to the DDB in the status blocks.
8.  Add a second structure status word to the SSB.  STRFLG contains the
    most recent results of asking the monitor the state of the structure.
    STRFL1 contains additional information flags to tell if the structure
    was previously mounted, previously with errors, or is currently being
    dismounted.
9.  Quit defining the MSTR status flags in MTRMAC. Use definitions from MONSYM.

16	5.1084		10-Feb-84
	Add bit definition for DSPFLG, the display message flag word.

17	5.1088		11-Feb-84
	Remove structure command table used by old MOUNTR.CMD code.

20	5.1101		20-Feb-84
	Add some new bits to the "don't care" MS%NTC.

21	5.1102		20-Feb-84
	Add new TMCTI macro that will accept an address to a TMCT argument
string.

22	5.1105		21-Feb-84
	Increase space of the TMCT buffer, TMCMSG, from 1 to 5 pages.

23	5.1106		23-Feb-84
	Add bit (STR%EP) to indicate structure has been set exclusive due to
port operation.  Also, update comment on what is in RSBDSK in the port RSB.

24	5.1118		16-Mar-84
	Express size of the TMCT buffer as the symbol, MSGLEN

25	5.1142		16-May-84
	Define STR%UD to state that this structure is unavailable due to
dismount/remove.

26	5.1146		31-May-84
	Add the third word, DSB.VE to the DDB diagram.

27	5.1150		11-Jul-84
	Increase the size of RMKLEN to decimal 50 words.

30	5.1151		11-Jul-84
	Define DEFPRO as the default tape protection value when initializing a
tape.

31	5.1165		3-Oct-84
	Define a new MACRO, DVTGEN, to generate device table.  Add new symbol 
MTADVT for device type.

32	5.1181		29-Nov-84
	Add word in SSB and DSB for structure unique code.  Add RST.WD for
waiting for dismount.

33	5.1185		5-Dec-84
	Add a new bit (MSG%FR) to print the "Free" disk drive message if there
is an online but not mounted disk drive.

34	5.1203		21-Feb-85
	Add disk drive serial number to the DSB.  (For use with the addition
	of the SHOW CONFIGURATION DISK command.)

35	5.1206		18-Mar-85
	Increase DSFPGS to two.
 \	;End of Revision History
SUBTTL PROGRAM-WIDE MACROS

; MACRO TO PROVIDE A VALUE 1 GREATER THAT IT DID THE LAST TIME

DEFINE NEXT <NEXT$		;;GIVE CURRENT VALUE
	NEXT$==NEXT$+1		;;INCREMENT IT
>

; MACRO TO DEFINE OFFSETS TO FIELDS WITHIN A MEMORY BLOCK

DEFINE FLDDEF (FLDSYM,FLDLEN) <
	FLDSYM==FLDPTR		;;DEFINE FIELD-OFFSET SYMBOL
	FLDPTR==FLDPTR+FLDLEN	;;RESERVE ROOM FOR FIELD
>

; SAVEQ MACRO - WORKS LIKE SAVEAC <Q1,Q2,Q3>
; SAVET MACRO - WORKS LIKE SAVEAC <T1,T2,T3,T4>
; STAKT MACRO - WORKS LIKE ASUBR WITH NO ARGUMENTS, DOESN'T USE AC15
;   Tn ON STACK MAY BE REFERENCED AS CTn

DEFINE SAVEQ <JSP CX,SAVEQR>
DEFINE SAVET <JSP CX,SAVETR>
DEFINE STAKT <JSP CX,STAKTR>
DEFINE CT1<-4(P)>		;CALLER'S T1
DEFINE CT2<-3(P)>		;CALLER'S T2
DEFINE CT3<-2(P)>		;CALLER'S T3
DEFINE CT4<-1(P)>		;CALLER'S T4

; ASSEMBLY-CONTROL

DEFINE PRINT1(PR1) <IF1 <PRINTX PR1>> ;PRINTX FOR PASS1 ONLY

; MACRO TO DEFINE ASSOCIATED-PROCESS TABLES

DEFINE APTABL <
	APENT QSR		;;QUASAR
	APENT ORN		;;ORION
>

; MACROS TO GENERATE BYTE POINTERS TO FIELDS IN LBUF2
;  LPTR(ARG)  - BYTE POINTER TO FIELD FOR LDB/DPB
;  ILPTR(ARG) - BYTE POINTER TO FIELD FOR ILDB/IDPB
; ARGUMENT IS BYTE POSITION OF FIELD (VALUE BETWEEN 1 AND 80)

DEFINE LPTR (LCP1)
 <POINT 7,LBUF2+<LCP1+4>/5-1,<LCP1-<<LCP1-1>/5*5>>*7-1>
DEFINE ILPTR (LCP1)
 <POINT 7,LBUF2+<LCP1+3>/5-1,<LCP1-<<LCP1+3>/5-1>*5>*7-8>

; CONDITIONAL ASSEMBLY MACROS FOR "NOSHIP" CODE

IFNDEF SHIPSW,<SHIPSW==-1>
DEFINE NOSHIP<IFE SHIPSW>
; MACROS TO GENERATE CALLS TO ASCIZ TEXT MESSAGE COMPOSER

DEFINE TMCT (TMCTA) <
	MOVEI CX,[ASCIZ\TMCTA\]	;;GET ADDRESS OF FORMATTING STRING
	CALL TMCT0		;;CALL FORMATTING ROUTINE
>

DEFINE TMCTI (ADDR) <
	MOVEI CX,ADDR		;;Get address of formatting string
	CALL TMCT0		;;Call formatting routine
>

DEFINE TMCTO (TMCTA) <
	CALL TMCT0		;;CALL FORMATTING ROUTINE ONLY
>

DEFINE TMCTN (TMCTA) <
	MOVEI CX,[ASCIZ\TMCTA\]	;;GET ADDRESS OF FORMATTING STRING ONLY
>

DEFINE TMCTR (TMCTA) <
	JSP CX,TMCT0		;;POINT CX AT STRING AND CALLRET TMCT0
	ASCIZ\TMCTA\
>

; MACROS TO ABORT USER MOUNT REQUEST - RSB ADDRESS MUST BE IN RSB AC

DEFINE ABTREQ (ABTCOD,ABTFLG<0>) <
	CALL AREQ		;;CALL ABORT ROUTINE
	EXP ABTCOD+ABTFLG
>

DEFINE ABTRET (ABTCOD,ABTFLG<0>) <
	CALL ARET		;;CALL ABORT-AND-RET ROUTINE
	EXP ABTCOD+ABTFLG
>

ABT%OP==:1B0			;OPERATOR RESPONSE IS PRESENT
ABT%IN==:1B1			;ABTCOD IS ADDRESS OF LOC CONTAINING CODE

; MACRO TO EXECUTE AND TIME OUT I/O JSYS

DEFINE IOXCT (IOJSYS,IOERR,IOTIMO) <
	CALL IOXCTR		;;CALL DRIVER ROUTINE
	 IOJSYS			;;JSYS TO BE EXECUTED
	 XWD IOERR,IOTIMO	;;ERROR ADDRESS, TIMEOUT ADDRESS
>

; MACRO TO CREATE AND INIT STACK AREA AND QSB AC FOR QUEUE SCAN
; ARGUMENT IS ADDRESS OF QUEUE DESCRIPTOR BLOCK (QDB)

DEFINE QSCANI (QDBADR) <
	JSP CX,QSCNIR 		;;CALL DRIVER
	SETZ QDBADR		;;QDB ADDRESS IN IFIW FORMAT
>

; MACRO TO MARK PLACES THAT HAVE TO CHANGE IF MORE LABEL TYPES ARE ADDED

DEFINE MAXLT <IFN .LTMAX-4,<IF2 <PRINTX LABEL TYPE ADDED>>>

;  Macro to cause a stop while using a reasonable message
;  Note: the resulting macro generates one executable instruction so
;	 it can be SKIPed.

DEFINE $STOP (MESS) <
	CALL STOPNW
	JUMP [ASCIZ/MESS/]
>

;  Macro to generate table of device types, for output show status tape-drive
DEFINE DVTGEN(TYPE),<
IRP TYPE,<
	XWD [ASCIZ/ TU'TYPE/],.MTT'TYPE
>>
SUBTTL MACROS FOR LINKED LISTS
SUBTTL EQUATES

; IT IS EXPECTED THAT THE EQUATES ON THIS PAGE MAY CHANGE TO
; REFLECT CHANGES IN TOPS-20 OR IN THE REQUIREMENTS OF THIS PROGRAM

; TABLE OF VALID TOPS-20 DENSITIES INDEXED BY MONSYM DENSITY CODE

DEFINE DENLST <
	0		;;ZEROTH ENTRY UNUSED
	^D200		;;.SJDN2
	^D556		;;.SJDN5
	^D800		;;.SJDN8
	^D1600		;;.SJD16
	^D6250		;;.SJD62
>
; MISCELLANEOUS

POLINT==:^D120		;NUMBER OF SECONDS BETWEEN MAGTAPE POLLS
MAXACC==:400		;NUMBER OF ACCOUNTING-BLOCKS
MAXDSK==:100		;MAXIMUM # OF DISK DRIVES SUPPORTED
MAXMRQ==:400		;MAXIMUM # OF MOUNT REQUESTS
MAXMT==:100		;MAXIMUM # OF MT DEVICES
MAXMTA==:100		;MAXIMUM # OF MTA DEVICES
ANSV==:"3"		;ANSI LABELING STANDARD VERSION NUMBER
DECV==:"1"		;DEC LABELING STANDARD VERSION NUMBER
PDLEN==:140		;LENGTH OF PUSH-DOWN LIST (WORDS)
RMKLEN==:^D50		;MAXIMUM SIZE (WORDS) OF ASCIZ MOUNT REMARK
DSFPGS==:2		;# OF PAGES IN DEVICE-STATUS FILE
SYRMSZ==:40		;MAX WORDS IN SYSERR MSG EXCLUDING HEADER
IFNDEF TST,<TST==:0>	;1=TEST VERSION, 0=REAL VERSION
SYRHSZ==:4		;# OF WORDS IN SYSERR ENTRY HEADER
MOSTAL==:.MODVT+1	;LENGTH OF .MOSTA MTOPR ARGUMENT BLOCK
NTRY==5 		;Number of times to get PID via MUTIL%
PBMAX==<WTOMAX-.OHDRS-3>*5 ;Maximum number of bytes orion can handle.
CIPORT==7		;CI PORT NUMBER FOR KL
.PTSET==4		;Request type for Port request block
DEFPRO==:777777		;Default tape protection when initializing a tape
; ACCUMULATOR DEFINITIONS

	F==:0		;FLAGS
	T1==:1		;TEMPORARY
	T2==:2		;TEMPORARY
	T3==:3		;TEMPORARY
	T4==:4		;TEMPORARY
	Q1==:5		;PRESERVED
	Q2==:6		;PRESERVED
	Q3==:7		;PRESERVED
	MTA==:10		;ADDRESS OF MTA STATUS BLOCK
	DSK==:10		;ADDRESS OF DISK STATUS BLOCK
	RSB==:11		;ADDRESS OF USER REQUEST STATUS BLOCK
	MT==:12		;ADDRESS OF MT STATUS BLOCK
	STR==:12		;ADDRESS OF STRUCTURE STATUS BLOCK
	QSB==:13		;ADDRESS OF QUEUE-SCAN BLOCK
	ACC==:14		;ADDRESS OF ACCOUNT BLOCK
	CX==:16		;USED BY SUPPORT CODE
	P==:17		;PUSH-DOWN POINTER

; DEFINITIONS OF BITS IN FLAG REGISTER (F)

IRETF==:1B35		;1 = EXTERNAL INTERRUPTS DEBRK TO SCHEDULER
MRMSF==:1B34		;1 = DO MRECV
MRPGF==:1B33		;1 = DO MRECV IN PAGE MODE
ABORTF==:1B32		;1 = ABORTED REQUEST(S) EXIST IN RSB QUEUE
NOMTF==:1B31		;1 = MT SHORTAGE EXISTS
JTOAF==:1B30		;1 = JSYS TIMER ARMED
TALCF==:1B29		;1 = TAPE-DRIVE ALLOCATION BY SETSPD
POLLF==:1B28		;1 = MAGTAPE POLLING IN PROGRESS
INITF==:1B27		;1 = IN INITIALIZATION SEQUENCE
CDENF==:1B26		;1 = ^D INTERRUPT ENABLED (^D SCHEDULES DDT)
ARGF==:1B25		;1 = ARGUMENT PRESENT (TMCT0 ROUTINE)
PORTF==:1B24	        ;1 = PORT OPERATION IN PROCES

; PSI PRIORITY EQUATES (IN ORDER OF DESCENDING PRIORITY)

PRIPAN==:1		;PANIC (CRASH) HANDLERS
PRIEXT==:3		;EXTERNAL INTERRUPTS

;DEFINITIONS FOR COMND JSYS

CMKEY==:<.CMKEY>B8	;PARSE A KEYWORD
CMNOI==:<.CMNOI>B8	;PARSE A GUIDE WORD
CMCFM==:<.CMCFM>B8	;CONFIRM
CMFLD==:<.CMFLD>B8	;PARSE AN ARBITRARY FIELD

; OTHER EQUATES

DAYSEC==:^D60*^D60*^D24	;# OF SECONDS IN A DAY (NEVER CHANGES)
DSFSZ==:DSFPGS*1000	;# OF WORDS IN DEVICE-STATUS FILE
LBLSIZ==:^D80		;SIZE OF TAPE LABELS IN FRAMES
LB7WDS==:<LBLSIZ+4>/5	;LENGTH IN WORDS OF 7-BIT-BYTE LABEL
LB8WDS==:<LBLSIZ+3>/4	;LENGTH IN WORDS OF 8-BIT-BYTE LABEL
MTNAV==:1		;MTRSB VALUE THAT INDICATES MT NOT AVAILABLE
USRLH==:500000		;LEFT HALF OF USER NUMBER WORD
.MNTDT==:77		;REQUEST TYPE FOR DECTAPE-MOUNT
; OFFSETS OF LABEL FIELDS (VALUES IN THE RANGE 1-80)

V1VID==:^D5		;VOL1 - VOLUME IDENTIFIER
V1ACS==:^D11		;VOL1 - ACCESSIBILITY
V1SCD==:^D25		;VOL1 - SYSTEM CODE
V1OWN==:^D38		;VOL1 - OWNER IDENTIFIER
V1INAM==:^D41		;VOL1 - INSTALLATION NAME (ANSI, TOPS-20)
V1INME==:^D42		;VOL1 - INSTALLATION NAME (EBCDIC)
TPNMSZ==:^D10		;VOL1 - LENGTH OF V1INAM AND V1INME FIELDS
V1DECV==:^D51		;VOL1 - DEC STANDARD VERSION #
V1ANSV==:^D80		;VOL1 - ANSI STANDARD VERSION #

V2PRO==:^D5		;VOL2 - PROTECTION CODE
V2PPN==:^D11		;VOL2 - PROJECT-PROGRAMMER NUMBER
V2OWN==:^D23		;VOL2 - OWNER'S NAME
V2OWNL==:^D39		;VOL2 - LENGTH OF OWNER'S NAME

H1SET==:^D22		;HDR1 - FILE SET IDENTIFIER (SETNAME)
H1CRE==:^D42		;HDR1 - CREATION DATE
H1EXP==:^D48		;HDR1 - FILE EXPIRATION DATE
H1ACS==:^D54		;HDR1 - ACCESSIBILITY

H2PRO==:^D38		;HDR2 - PROTECTION CODE (TOPS-20 ONLY)
SUBTTL Device Status Entries -- Explanation of device status organization

COMMENT %

The device status information in MOUNTR for a device will normally
be composed of two specific entities.  This is because some of the
information needs to be preserved across system failures.  To make
things reasonably efficient, only the essential information will
be stored in this "static" Disk Data Base.  There is additional
information that is stored about the status of a particular device
which is stored in the Status Block for the device.  For example
consider the entries for a disk drive:

	Disk
	Status                          .      .  Static Disk Data Base
	Block                           .      .
	                                .      .
	+------+                        |------|
	|      |----------------------->|      |  Disk DDB Entry
	|      |                        |      |
	|      |<-----------------------|      |
	|      |                        |------|
	+------+                        .      .

In this example, the disk DDB entry contains the static information
about the disk drive (available/unavailable) and the Disk Status
Block (DSB) contains the information based on the current use of the
disk drive such as the structure currently mounted on the drive etc.

The following devices have this kind of storage arrangement:

	o  Disk Drives
	o  Mag Tape Drives
	o  Structures

In addition, there are two special cases:

	o  Ports (the CI) have only a DDB since that contains all the
	   information that MOUNTR needs to be concerned with.
	o  MT devices have only status blocks since there is no information
	   to be preserved across system crashes.

%  ;End comment
SUBTTL Device Status Entries -- Format of device status file

;	DEVICE STATUS FILE
;	==================

; TOPS-20 DEVICE STATUS IS KEPT IN SYSTEM:DEVICE-STATUS.BIN. IT
; IS MAINTAINED AND EXAMINED SOLELY BY THIS PROGRAM. ITS PURPOSE IS
; TO PRESERVE SYSTEM PERIPHERAL DEVICE STATUS ACROSS  RELOADS.  THE
; FILE IS TREATED AS A MONOLITHIC SET OF PAGES THAT  IS  MAPPED  IN
; ITS ENTIRETY INTO THE AREA DSBUF, WHICH HAS THIS FORMAT:

;		!=====================================!
;	DSB.CK	!          CHECKSUM OF FILE           !
;		!-------------------------------------!
;	DSB.PS	!          APR SERIAL NUMBER          !
;		!-------------------------------------!
;	DSB.NE	!      # OF ENTRIES IN FILE (n)       !
;		!-------------------------------------!
;	DSB.VE	!	VERSION # OF FORMAT OF FILE   !
;		!-------------------------------------!
;	DSB.EO	!                                     !
;		\               ENTRY 1               \
;		!                                     !
;		!-------------------------------------!
;		!                  .                  !
;		\                  .                  \
;		!                  .                  !
;		!-------------------------------------!
;		!                                     !
;		\               ENTRY n               \
;		!                                     !
;		!=====================================!


; ENTRY SIZE IS FIXED, SET BY THE EQUATE FOR DSFESZ
; ALL ENTRIES BEGIN AS FOLLOWS:
;
;	WORD 0 - DEVICE TYPE CODE
;	WORD 1 - DEVICE IDENTIFIER (UNIQUE WITHIN DEVICE TYPE)
;	Word 2 - Flags
;	Word 3 - Pointer to status block for this entry
SUBTTL Device Status Entries -- Format of device entry

DSFTYP==:0		;Device type (if DSFSPC is -1, then this entry
			;  is a free entry and this field is pointer to
			;  next freen entry or -1 if no more free entries)

; .DVDSK		;Disk drive device -- defined in MONSYM
; .DVMTA		;Mag tape device -- defined in MONSYM
  .DVSTR==:1		;Structure device
  .DVPRT==:3		;Port device

DSFSPC==:1		;Device specification (-1 if free entry)

; contains:	tape		TOPS-20 device designator
;		disk drive	CKU Number (Channel, Kontroller, Unit)
;		structure	Alias name in SIXBIT
;		port		Channel number (7)

DSFFLG==:2		;Device flags

  DSF%AV==:1B0		;On if unavailable, off if available
  DSF%PO==:1B1		;On if effected by port operation, off if no effect
  DSF%EX==:1B2		;On if exclusive, off if don't care (can be shared)
			;	Structure only attribute
  DSF%DO==:1B3		;On if domestic, off if foreign
			;	Structure only attribute
  DSF%IG==:1B4		;On if ignored, off if acknowledged
			;	Structure only attribute
  DSF%RG==:1B5		;On if unregulated, off if regulated
			;	Structure only attribute

DSFPNT==:3		;Pointer to the status block for this entry
			;-1 indicates that the device exists but there
			;   is no device status block.  Port device currently
			;   has no device status block.
			; 0 indicates the device does not exist
			;+n indicates the address of the status block

DSFESZ==:4		;SIZE OF DEVICE-STATUS FILE ENTRIES (WORDS)
SUBTTL Device Status Entries -- MTA Status Block (MSB)

; EACH MTA DEVICE SUPPORTED BY THE SYSTEM HAS A STATUS  BLOCK  THAT
; CONTAINS VARIOUS PIECES OF DEVICE-DEPENDENT INFORMATION. THE  MTA
; AC CONTAINS A POINTER TO THE FIRST WORD OF THE BLOCK THAT BELONGS
; TO THE MTA DEVICE CURRENTLY BEING SERVICED.

;	!=======================================================!
;MTAVOL	!           VOLID OF CURRENTLY-MOUNTED VOLUME           !
;	!-------------------------------------------------------!
;MTASET	!          SETNAME OF CURRENTLY-MOUNTED VOLUME          !
;	!-------------------------------------------------------!
;MTAIDV	!              VOLID FROM IDENTIFY COMMAND              !
;	!-------------------------------------------------------!
;MTAFLG	!                   SINGLE-BIT FLAGS                    !
;	!-------------------------------------------------------!
;MTAFIL	!            JFN            !        GTJFN COUNT        !
;	!-------------------------------------------------------!
;MTAP1	!             !    STATE    ! LABEL TYPE  !   DENSITY   !
;	!-------------------------------------------------------!
;MTAP2	!  MT STATUS BLOCK ADDRESS  ! REWIND END-ACTION ADDRESS !
;	!-------------------------------------------------------!
;MTASDN	!    SUPPORTED DENSITIES    !      DRIVE TYPE CODE      !
;	!-------------------------------------------------------!
;MTAV1	!                                                       !
;	\              IMAGE OF VOL1 LABEL ON TAPE              \
;	!            (ASCII OR EBCDIC, 8-BIT BYTES)             !
;	!-------------------------------------------------------!
;MTAV2	!                                                       !
;	\              IMAGE OF VOL2 LABEL ON TAPE              \
;	!            (ASCII OR EBCDIC, 8-BIT BYTES)             !
;	!-------------------------------------------------------!
;MTAPNT	!              Pointer to MTA DDB Entry                 !
;	!=======================================================!
SUBTTL Device Status Entries -- MSB field definitions

;  Definitions of fields within MTA Status Block

FLDPTR==0

FLDDEF MTAVOL,1		;CURRENT MTA VOLID (SIXBIT), 0 IF NONE
FLDDEF MTASET,1		;CURRENT MTA SETNAME (SIXBIT), 0 IF NONE
FLDDEF MTAIDV,1		;QUEUE LINKAGE WORD
FLDDEF MTAFLG,1		;SINGLE-BIT FLAGS
  MA%LOD==:1B0		;DRIVE IS LOADED
  MA%OPN==:1B1		;JFN IS OPEN
  MA%AVE==:1B2		;AVR ENABLED
  MA%AVS==:1B3		;AVR SUPPORTED FOR THIS DRIVE
  MA%WEN==:1B4		;WRITE PERMITTED
  MA%SCR==:1B5		;VOLUME IS SCRATCH
  MA%UXV==:1B6		;UNEXPIRED LABELED VOLUME
  MA%VMG==:1B7		;VOLUME-MOUNTED MESSAGE GIVEN TO OPERATOR
  MA%ULP==:1B8		;UNLOAD DRIVE WHEN REWIND COMPLETES
  MA%OPF==:1B9		;OVERWRITE-PROTECTION FLAG, IF SET:
			; ANSI - VOLUME MAY NOT BE OVERWRITTEN
			; TOPS-20 - NON-OWNER MAY NOT OVERWRITE
FLDDEF MTAFIL,1		;FILE STATUS
FLDDEF MTAP1,1		;DEFSTR-DEFINED DATA
FLDDEF MTAP2,1		;DEFSTR-DEFINED DATA
FLDDEF MTASDN,1		;DEFSTR-DEFINED DATA
FLDDEF MTAV1,LB8WDS	;IMAGE OF VOL1 LABEL ON TAPE
FLDDEF MTAV2,LB8WDS	;IMAGE OF VOL2 LABEL ON TAPE
FLDDEF MTAPNT,1		;Pointer to MTA DDB Entry
MTASZ==:FLDPTR	;SIZE OF MTA STATUS BLOCK IN WORDS

DEFSTR (MTAJFN,MTAFIL(MTA),17,18)	;JFN
DEFSTR (MTAJCT,MTAFIL(MTA),35,18)	;JFN-IN-USE COUNT
DEFSTR (MTASTE,MTAP1(MTA),17,9)	;CURRENT STATE OF DRIVE
  ; MTASTE/ 0 IF AND ONLY IF MTA NOT ASSIGNED TO MY JOB (VIA ASND)
  S.UNAV==:0				;UNAVAILABLE TO MOUNTR
  S.AV==:1				;AVAILABLE FOR USE BY USERS
  S.INIT==:2				;INITIALIZING TAPE VOLUMES
DEFSTR (MTALT,MTAP1(MTA),26,9)		;LABEL TYPE
DEFSTR (MTADEN,MTAP1(MTA),35,9)		;DENSITY
DEFSTR (MTAMT,MTAP2(MTA),17,18)		;MT STAT BLK ADDR OR 0 IF NONE
DEFSTR (MTAREA,MTAP2(MTA),35,18)	;REWIND END-ACTION SCHEDULE ADDR
DEFSTR (MTADRV,MTASDN(MTA),26,9)	;Drive type (1 7-track, 2 9-track)
DEFSTR (MTADVT,MTASDN(MTA),35,9)	;Device type. (.MTTxx)
SUBTTL Device Status Entries -- MT Status Block

; EACH MT DEVICE SUPPORTED BY THE SYSTEM HAS A  STATUS  BLOCK  THAT
; CONTAINS DEVICE-RELATED INFORMATION. THE  MT  AC  POINTS  TO  THE
; FIRST WORD OF THE STATUS BLOCK OF THE MT CURRENTLY BEING SERVICED.

;	!=======================================================!
;MTP1	! ADDR OF MTA STATUS BLOCK  !ADDR OF REQUEST STATUS BLK !
;	!=======================================================!

; DEFINITIONS OF FIELDS WITHIN MT STATUS BLOCK

FLDPTR==0

FLDDEF MTP1,1		;DEFSTR-DEFINED DATA
MTSZ==:FLDPTR	;SIZE OF MT STATUS BLOCK

DEFSTR (MTMTA,MTP1(MT),17,18)		;MTA STATUS BLOCK ADDRESS
DEFSTR (MTRSB,MTP1(MT),35,18)		;REQUEST STATUS BLK ADDRESS
SUBTTL Device Status Entries -- Disk Status Block (DSB)

;EACH DISK ON THE SYSTEM HAS A STATUS BLOCK THAT CONTAINS INFORMATION
;ABOUT THAT DRIVE.  THE DSK AC CONTAINS A POINTER TO THE FIRST WORD
;OF THE BLOCK THAT BELONGS TO THE DISK CURRENTLY BEING SERVICED.

;	!=======================================================!
;DSKSTN !                 SIXBIT STRUCTURE NAME                 !
;	!-------------------------------------------------------!
;DSKSTA !                 SIXBIT STRUCTURE ALIAS                !
;	!-------------------------------------------------------!
;DSKPNT !               Pointer to Disk DDB Entry               !
;	!-------------------------------------------------------!
;DSKFLG !                    STATUS OF UNIT                     !
;	!-------------------------------------------------------!
;DSKNS  !    LOGICAL UNIT NUMBER    !      NUMBER OF UNITS      !
;	!-------------------------------------------------------!
;DSKUNQ !		Structure Unique Code			!
;	!-------------------------------------------------------!
;DSKP2  !  STR STATUS BLOCK ADDRESS !             0             !
;	!-------------------------------------------------------!
;DSKCKU !  CKU NUMBERS (CHANNEL, CONTROLLER, AND UNIT NUMBERS)  !
;	!-------------------------------------------------------!
;DSKSNH !	   Drive Serial Number (HIGH ORDER)		!
;	!-------------------------------------------------------!
;DSKSNL !	   Drive Serial Number (LOW ORDER)		!
;	!=======================================================!
SUBTTL Device Status Entries -- DSB Field Definitions

; DEFINITIONS OF FIELDS WITHIN DISK STATUS BLOCK

FLDPTR==0

FLDDEF DSKSTN,1		;CURRENT FILE STRUCTURE NAME(SIXBIT) - 0 IF NONE
FLDDEF DSKSTA,1		;CURRENT FILE STRUCTURE ALIAS(SIXBIT)-0 IF NONE
FLDDEF DSKPNT,1		;Pointer to Disk DDB Entry
FLDDEF DSKFLG,1		;STATUS OF UNIT
;ITEMS BELOW DEFINED IN MONSYM
;  MS%MNT==:1B0		;UNIT IS PART OF A MOUNTED STRUCTURE
;  MS%DIA==:1B2		;UNIT IS BEING USED BY ON-LINE DIAGNOTIC PROGRAM
;  MS%OFL==:1B3		;UNIT IS OFF LINE
;  MS%ERR==:1B4		;UNIT HAS ERROR THAT WAS DETECTED DURING READING
;  MS%BBB==:1B5		;UNIT HAS A BAD BAT BLOCK
;  ms%hbb==:1b6		;Unit has bad home block
;  MS%WLK==:1B7		;UNIT IS WRITE-LOCKED
;  MS%TYP==:777B17	;TYPE OF DISK UNIT
;    .MSRP4==:1		;RP04
;    .MSRP5==:5		;RP05
;    .MSRP6==:6		;RP06
;    .MSRP7==:7		;RP07
FLDDEF DSKNS,1		;LOGICAL UNIT # WITHIN STR,,# OF UNITS IN STR
FLDDEF DSKUNQ,1		;Unique Code
FLDDEF DSKP2,1		;STR STATUS BLOCK ADDR
FLDDEF DSKCKU,1		;CHANNEL, CONTROLLER, AND UNIT NUMBERS
FLDDEF DSKSNH,1		;DISK DRIVE SERIAL NUMBER (HIGH ORDER)
FLDDEF DSKSNL,1		;DISK DRIVE SERIAL NUMBER (LOW ORDER)
DSKSZ==:FLDPTR		;SIZE OF DSK STATUS BLOCK

DEFSTR (DSKTYP,DSKFLG,17,11)	;TYPE OF DISK UNIT
DEFSTR (DSKLUN,DSKNS,17,18)	;LOGICAL UNIT NUMBER OF DISK WITHIN STR
DEFSTR (DSKNOU,DSKNS,35,18)	;NUMBER OF DISK UNITS IN STRUCTURE
DEFSTR (DSKSSA,DSKP2,17,18)	;STRUCTURE STATUS BLOCK ADDRESS
MSKSTR (DSKCHN,DSKCKU,DOP%C2)	;CHANNEL NUMBER
MSKSTR (DSKCTR,DSKCKU,DOP%K2)	;CONTROLLER NUMBER
MSKSTR (DSKDRV,DSKCKU,DOP%U2)	;DRIVE NUMBER
SUBTTL Device Status Entries -- Structure Status Block (SSB)

;EACH STRUCTURE HAS A STATUS BLOCK THAT CONTAINS INFORMATION.  THE STR
;AC POINTS TO THE FIRST WORD OF THE STATUS BLOCK OF THE STRUCTURE
;CURRENTLY BEING SERVICED.

;	!=======================================================!
;STRALI !                SIXBIT STRUCTURE ALIAS                 !
;	!-------------------------------------------------------!
;STRNAM !                SIXBIT STRUCTURE NAME                  !
;	!-------------------------------------------------------!
;STRFLG !              STRUCTURE FLAGS FROM MSTR                !
;	!-------------------------------------------------------!
;STRFL1 !                OTHER STRUCTURE FLAGS                  !
;	!-------------------------------------------------------!
;STRCNT ! # OF UNITS ! MOUNT COUNT  ! ADDR OF REQUEST STATUS BLK!
;	!-------------------------------------------------------!
;STRUNQ	!		Structure Unique Code			!
;	!-------------------------------------------------------!
;STRPNT	!               POINTER TO STRUCTURE DDB                !
;	!-------------------------------------------------------!
;STRADD !                                                       !
;       \           ADDRESS(ES) OF DISK STATUS BLOCK(S)         \
;	\         (Displacement based on Disk Entry number      !
;	\           such as "2nd of 3 disks in structure")      !
;	!                                                       !
;	!=======================================================!
SUBTTL Device Status Entries -- SSB Field Definitions

;  Definitions of fields in the Structure Status Block

FLDPTR==0
FLDDEF STRALI,1			;STRUCTURE ALIAS IN SIXBIT
				;  (free list pointer if free entry)
FLDDEF STRNAM,1			;STRUCTURE NAME IN SIXBIT
				;  (0 if free entry)
FLDDEF STRFLG,1			;STRUCTURE STATUS

;  The following bits set in this word are defined in MONSYM

;  MS%PS==:1B0			;THIS STRUCTURE IS PUBLIC
;  MS%DIS==:1B1			;STRUCTURE IS BEING DISMOUNTED
;  MS%DOM==:1B2			;STRUCTURE IS DOMESTIC ???
;  MS%PPS==:1B3			;STRUCTURE IS PRIMARY PUBLIC STRUCTURE
;  MS%INI==:1B4			;STRUCTURE IS BEING INITIALIZED
;  MS%LIM==:1B5			;STRUCTURE LIMITED TO 2050 SIZES
;  MS%NRS==:1B6			;STRUCTURE IS NOT REGULATED ???
;  MS%EXC==:1B15		;STRUCTURE IS EXCLUSIVE ???

;  Bits we normally don't care about in MOUNTR

   MS%NTC==:MS%PS+MS%PPS+MS%INI+MS%LIM+MS%RWS+MS%RWD+MS%ASG+MS%MXB+MS%CRY+MS%IDT+MS%IUS+MS%IDX+MS%CRD
				;PS, initializing, or limited direct.

FLDDEF STRFL1,1			;OTHER STRUCTURE STATUS

  STR%MT==:1B0			;Structure is mounted
  STR%DT==:1B1			;Structure is dismounted
  STR%DE==:1B2			;Structure is on a disk with errors
  STR%EP==:1B3			;Structure is exclusive due to port operation
  STR%UD==:1B4			;Structure is unavailable due to dismount

;  Additional status bits are contained in the structure DDB

FLDDEF STRCNT,1			;# OF UNITS IN STR,,RSB ADDR
FLDDEF STRUNQ,1			;Structure Unique Code
FLDDEF STRPNT,1			;POINTER TO STRUCTURE DDB
FLDDEF STRADD,10		;ADDRESSES OF DISK STRUCTURE BLOCKS
STRSZ==:FLDPTR			;SIZE OF STR STATUS BLOCK

DEFSTR (STRUNI,STRCNT,8,9)	;NUMBER OF UNITS IN STRUCTURE
DEFSTR (STRMCT,STRCNT,17,9)	;COUNT OF UNITS MOUNTED IN STRUCTURE
DEFSTR (STRRSB,STRCNT,35,18)	;ADDRESS OF REQUEST STATUS BLOCK
SUBTTL WTB - Write To Operator with reply Block

; WHEN A ROUTINE MUST ISSUE A MESSAGE TO THE OPERATOR AND RECEIVE A
; RESPONSE, IT CALLS  THE  BTWTOR  ROUTINE.  BTWTOR  SENDS  A  WTOR
; REQUEST TO ORION, BUILDS A WTB, AND PLACES THE WTB ON A QUEUE  OF
; OUTSTANDING  WTOR  REQUESTS.  WHEN  THE  OPERATOR'S  RESPONSE  IS
; RECEIVED FROM ORION,  INWTOR  DEQUEUES  THE  WTB  AND  CALLS  THE
; ROUTINE SPECIFIED IN T1 OF THE BTWTOR CALL WITH:
;  T1/ BYTE POINTER TO ASCIZ REPLY FROM OPERATOR
;  T2/ ADDRESS OF WTB

;	!=======================================================!
;WTBLNK	!                WTB QUEUE LINKAGE WORD                 !
;	!-------------------------------------------------------!
;WTBCOD	!         ACKNOWLEDGMENT CODE FOR THIS MESSAGE          !
;	!-------------------------------------------------------!
;WTBENT	!       ORIGINATOR'S ROUTINE ADDRESS (BTWTOR T1)        !
;	!=======================================================!

FLDPTR==0
FLDDEF WTBLNK,1		;QUEUE LINKAGE WORD
FLDDEF WTBCOD,1		;ORION ACKNOWLEDGMENT CODE
FLDDEF WTBENT,1		;ORIGINATOR'S ROUTINE ADDRESS
WTBSIZ==:FLDPTR		;SIZE OF WTB
SUBTTL Request Status Block -- Tape Mount RSB

;	!=======================================================!
;RSBLNK	!                  QUEUE LINKAGE WORD                   !
;	!-------------------------------------------------------!
;RSBIFL	!                    INTERNAL FLAGS                     !
;	!-------------------------------------------------------!
;RSBUFL	!                  USER-SUPPLIED FLAGS                  !
;	!-------------------------------------------------------!
;RSBMC1	!     USER'S JOB NUMBER     !       REQUEST TYPE        !
;	!-------------------------------------------------------!
;RSBMC2	!CURRENT STATE OR ERROR CODE!   ADDR OF ACCOUNT BLOCK   !
;	!-------------------------------------------------------!
;RSBITN	!           INTERNAL TASK NUMBER FROM QUASAR            !
;	!-------------------------------------------------------!
;RSBUNO	!                  USER'S USER NUMBER                   !
;	!-------------------------------------------------------!
;RSBPID	!                      USER'S PID                       !
;	!-------------------------------------------------------!
;RSBCOD	!              USER'S ACKNOWLEDGEMENT CODE              !
;	!-------------------------------------------------------!
;RSBRNM	!               SIXBIT MOUNT REQUEST NAME               !
;	!-------------------------------------------------------!
;RSBWTB	!                                                       !
;	\       WRITE-TO-OPERATOR-WITH-REPLY BLOCK (WTB)        \
;	!                                                       !
;	!-------------------------------------------------------!
;RSBACT	!                                                       !
;	\                 USER'S ACCOUNT STRING                 \
;	!                                                       !
;	!-------------------------------------------------------!
;RSBRMK	!                                                       !
;	\                     USER'S REMARK                     \
;	!                                                       !
;	!-------------------------------------------------------!
;RSBSUP	!                          !     SUPERIOR RSB ADDR      !
;	!=======================================================!
;RSBSSN	!         USER-SUPPLIED VOLUME SET NAME (SIXBIT)        !
;	!-------------------------------------------------------!
;RSBASN	!             ACTUAL VOLUME SET NAME (SIXBIT)           !
;	!-------------------------------------------------------!
;RSBVLS	!          QUEUE DESCRIPTOR BLOCK FOR VOLID LIST        !
;	!-------------------------------------------------------!
;RSBMT1	!   DENSITY   ! DRIVE TYPE  ! LABEL TYPE  !      0      !
;	!-------------------------------------------------------!
;RSBMT2	!  ADDR OF MT STATUS BLOCK  !  VOLUME PROTECTION CODE   !
;	!-------------------------------------------------------!
;RSBMT3	!    CURRENT VOLID INDEX    !             0             !
;	!=======================================================!
SUBTTL Request Status Block -- Tape Mount Field Definitions

; USER TAPE MOUNT  REQUESTS  THAT  ARE  RECEIVED  FROM  QUASAR  ARE
; TRANSFORMED UPON  ARRIVAL  INTO  A  FIXED-FORMAT  REQUEST  BLOCK,
; DESCRIBED BELOW. WHEN A GIVEN MOUNT REQUEST IS BEING  REFERENCED,
; RSB POINTS TO THE FIRST WORD OF THE BLOCK.

FLDPTR==0
FLDDEF RSBLNK,1		;LINKAGE TO NEXT ENTRY IN QUEUE
FLDDEF RSBIFL,1		;INTERNAL FLAGS
  R%PRIV==:1B0		;USER IS PRIVILEGED
  R%ORES==:1B1		;OPERATOR RESPONSE PRESENT
  R%WVL==:1B2		;VOLUME LABELS SHOULD BE WRITTEN
  R%ONV==:1B3		;OPERATOR WAS NOTIFIED OF VOLID LIST
  R%OPR==:1B4		;REQUEST FROM OPR
  R%DSM==:1B5		;DISMOUNT REQUEST
  R%ONR==:1B6		;MOUNT-REQUEST MESSAGE SENT TO OPERATOR
  R%PRT==:1B7		;Port request
  R%RNR==:1B10		;Remove=1, Noremove=0
  R%REP==:1B11		;Reply bit, Force=1  Cont=0
  R%EXC==:1B15		;This is the same as MS%EXC, 1=exclusive
FLDDEF RSBUFL,1		;USER-DEFINED FLAGS
FLDDEF RSBMC1,1		;MISCELLANEOUS DATA
FLDDEF RSBMC2,1		;MISCELLANEOUS DATA
FLDDEF RSBITN,1		;QUASAR INTERNAL TASK NUMBER
FLDDEF RSBUNO,1		;USER'S USER NUMBER
FLDDEF RSBPID,1		;USER'S PID
FLDDEF RSBCOD,1		;USER'S ACKNOWLEDGMENT CODE
FLDDEF RSBRNM,1		;MOUNT REQUEST NAME (SIXBIT)
FLDDEF RSBWTB,WTBSIZ	;WTOR BLOCK
FLDDEF RSBACT,10	;USER'S ACCOUNT STRING (ASCIZ)
FLDDEF RSBRMK,RMKLEN	;USER'S REMARK (ASCIZ)
FLDDEF RSBSUP,1		;RSB of superior request (for subordinate requests)
RSBCSZ==:FLDPTR		;SIZE OF AREA COMMON TO ALL RSB'S
FLDDEF RSBSSN,1		;USER-SUPPLIED VOLUME SET NAME (SIXBIT)
FLDDEF RSBASN,1		;ACTUAL VOLUME SET NAME (SIXBIT)
FLDDEF RSBVLS,1		;QUEUE DESCR BLOCK FOR VOLID LIST
FLDDEF RSBMT1,1		;MISCELLANEOUS DATA
FLDDEF RSBMT2,1		;MISCELLANEOUS DATA
FLDDEF RSBMT3,1		;MISCELLANEOUS DATA
MTRSBS==:FLDPTR	;SIZE OF TAPE MOUNT RSB

DEFSTR (RSBJNO,RSBMC1(RSB),17,18)	;USER'S JOB NUMBER
DEFSTR (RSBTYP,RSBMC1(RSB),35,18)	;REQUEST TYPE CODE
DEFSTR (RSBSTE,RSBMC2(RSB),17,18)	;CURRENT STATE OF REQUEST
DEFSTR (RSBACC,RSBMC2(RSB),35,18)	;ADDRESS OF ACCOUNT BLOCK

DEFSTR (RSBDEN,RSBMT1(RSB),8,9)		;DENSITY
DEFSTR (RSBDRV,RSBMT1(RSB),17,9)	;DRIVE TYPE
DEFSTR (RSBLT,RSBMT1(RSB),26,9)		;LABEL TYPE
DEFSTR (RSBMT,RSBMT2(RSB),17,18)	;MT STATUS BLOCK ADDRESS
DEFSTR (RSBVPR,RSBMT2(RSB),35,18)	;VOLUME PROTECTION CODE
DEFSTR (RSBCV,RSBMT3(RSB),17,18)	;INDEX TO CURRENT VOLID

  NEXT$==:0				;DEFINE MAGTAPE REQUEST STATES
  RST.IN==:NEXT				  ;RSB BEING INITIALIZED
  RST.WV==:NEXT				  ;WAITING FOR VOLID KEYIN
  RST.WM==:NEXT				  ;WAITING FOR TAPE MOUNT
  RST.AC==:NEXT				  ;ACTIVE (USING VOLUME)
  RST.WD==:NEXT				  ;Waiting for dismount
;STATE CODES .GE. .ERBAS IMPLY THAT THE REQUEST IS ABORTED
  ABRTNR==:.ERBAS			  ;ABORTED, NO RESPONSE TO USER

;DECTAPE RSB DEF'S

RSBDTA==:RSBASN		;DECTAPE DEVICE DESIGNATOR
; WHEN THE "SET TAPE-DRIVE INITIALIZE" OPR COMMAND IS USED TO
; INITIALIZE TAPES, A SPECIAL RSB WITH R%OPR SET IS ALLOCATED
; AND ATTACHED TO THE MTA VIA A FAKE MT STATUS BLOCK WITHIN
; THE RSB. SPECIAL RSB FIELDS REQUIRED FOR THIS FUNCTION WILL
; OVERLAY THE RSBACT FIELD WHICH IS IGNORED HERE.

; SPECIAL RSB FIELDS FOR OPR-REQUESTED VOLUME INITIALIZATION:

RSBICT==:RSBACT+0		;# OF VOLUMES TO INITIALIZE
RSBIVI==:RSBACT+1		;NUMERIC VOLID INCREMENT
RSBIVL==:RSBACT+2		;CURRENT VOLID BEING INITIALIZED
RSBIVN==:RSBACT+3		;INTEGER VOLID
RSBIMT==:RSBACT+4		;FAKE MT STATUS BLOCK
SUBTTL Request Status Block -- Structure Mount RSB

;	!=======================================================!
;RSBLNK	!                  QUEUE LINKAGE WORD                   !
;	!-------------------------------------------------------!
;RSBIFL	!                    INTERNAL FLAGS                     !
;	!-------------------------------------------------------!
;RSBUFL	!                  USER-SUPPLIED FLAGS                  !
;	!-------------------------------------------------------!
;RSBMC1	!     USER'S JOB NUMBER     !       REQUEST TYPE        !
;	!-------------------------------------------------------!
;RSBMC2	!CURRENT STATE OR ERROR CODE!   ADDR OF ACCOUNT BLOCK   !
;	!-------------------------------------------------------!
;RSBITN	!           INTERNAL TASK NUMBER FROM QUASAR            !
;	!-------------------------------------------------------!
;RSBUNO	!                  USER'S USER NUMBER                   !
;	!-------------------------------------------------------!
;RSBPID	!                      USER'S PID                       !
;	!-------------------------------------------------------!
;RSBCOD	!              USER'S ACKNOWLEDGEMENT CODE              !
;	!-------------------------------------------------------!
;RSBRNM	!               SIXBIT MOUNT REQUEST NAME               !
;	!-------------------------------------------------------!
;RSBWTB	!                                                       !
;	\       WRITE-TO-OPERATOR-WITH-REPLY BLOCK (WTB)        \
;	!                                                       !
;	!-------------------------------------------------------!
;RSBACT	!                                                       !
;	\                 USER'S ACCOUNT STRING                 \
;	!                                                       !
;	!-------------------------------------------------------!
;RSBRMK	!                                                       !
;	\                     USER'S REMARK                     \
;	!                                                       !
;	!=======================================================!
;RSBSTN	!                STRUCTURE NAME (SIXBIT)                !
;	!-------------------------------------------------------!
;RSBSTA	!               STRUCTURE ALIAS (SIXBIT)                !
;	!-------------------------------------------------------!
;RSBMS1	! ADDR OF STR STATUS BLOCK  ! 		0	        !
;	!=======================================================!
SUBTTL Request Status Block -- Structure Mount Field Definitions

FLDPTR==:RSBCSZ			;SET POINTER TO END OF COMMON SECTION

FLDDEF RSBSTN,1			;STRUCTURE NAME (SIXBIT)
FLDDEF RSBSTA,1			;STRUCTURE ALIAS (SIXBIT)
FLDDEF RSBMS1,1			;MISCELLANEOUS DATA

STRSBS==:FLDPTR			;SIZE OF STRUCTURE-MOUNT RSB

DEFSTR (RSBSS,RSBMS1(RSB),17,18) ;STR STATUS BLOCK ADDR
DEFSTR (RSBEX,RSBMS1(RSB),35,18) ;OFFSET TO THE CHARACTERISTIC

; SET RSBSIZ = MAX(MTRSBS,STRSBS)

RSBSIZ==:MTRSBS
IFG STRSBS-MTRSBS,<RSBSIZ==:STRSBS>
SUBTTL Request Status Block -- Port RSB

;	!=======================================================!
;RSBLNK	!                  QUEUE LINKAGE WORD                   !
;	!-------------------------------------------------------!
;RSBIFL	!                    INTERNAL FLAGS                     !
;	!-------------------------------------------------------!
;RSBUFL	!                  USER-SUPPLIED FLAGS                  !
;	!-------------------------------------------------------!
;RSBMC1	!     USER'S JOB NUMBER     !       REQUEST TYPE        !
;	!-------------------------------------------------------!
;RSBMC2	!CURRENT STATE OR ERROR CODE!   ADDR OF ACCOUNT BLOCK   !
;	!-------------------------------------------------------!
;RSBITN	!           INTERNAL TASK NUMBER FROM QUASAR            !
;	!-------------------------------------------------------!
;RSBUNO	!                  USER'S USER NUMBER                   !
;	!-------------------------------------------------------!
;RSBPID	!                      USER'S PID                       !
;	!-------------------------------------------------------!
;RSBCOD	!              USER'S ACKNOWLEDGEMENT CODE              !
;	!-------------------------------------------------------!
;RSBRNM	!               SIXBIT MOUNT REQUEST NAME               !
;	!-------------------------------------------------------!
;RSBWTB	!                                                       !
;	\       WRITE-TO-OPERATOR-WITH-REPLY BLOCK (WTB)        \
;	!                                                       !
;	!-------------------------------------------------------!
;RSBACT	!                                                       !
;	\                 USER'S ACCOUNT STRING                 \
;	!                                                       !
;	!-------------------------------------------------------!
;RSBRMK	!                                                       !
;	\                     USER'S REMARK                     \
;	!                                                       !
;	!=======================================================!
;RSBPRT	!   FLAGS                   |        CHANNEL #          !
;	!-------------------------------------------------------!
;RSBDSK !       DDB Pointer         |        DSK POINTER        !
;	!=======================================================!
SUBTTL Request Status Block -- Port Field Definitions

FLDPTR==:RSBCSZ			;SET POINTER TO END OF COMMON SECTION


FLDDEF	RSBPRT,1		;Flags,,Channel #
FLDDEF	RSBDSK,1		;Loop counter,,disk being processed

PRTSBS==:FLDPTR			;SIZE OF STRUCTURE-MOUNT RSB

DEFSTR (RSBPF,RSBPRT(RSB),17,18) ;Port request flags
DEFSTR (RSBCH,RSBPRT(RSB),35,36) ;Channel requested

NEXT$==:0			;Define port request states
PRT.IN==:NEXT			;RSB being initialized
PRT.WT==:NEXT			;Waiting for operator response
PRT.DS==:NEXT			;Dismounting
PRT.FC==:NEXT			;Dismounting by force
PRT.MT==:NEXT			;Mounting disks
PRT.AB==:NEXT			;Abort request

; SET RSBSIZ = MAX(MTRSBS,STRSBS,RSBPRT)

RSBSIZ==:MTRSBS
IFG STRSBS-MTRSBS,<RSBSIZ==:STRSBS>
SUBTTL MAGTAPE ACCOUNT STATUS BLOCK -- Description

;EACH TAPE DISMOUNT CAUSES AN ACCOUNT RECORD TO BE PUT INTO THE SYSTEM
;USAGE FILE.  THE ACCOUNT STATUS BLOCK IS MADE WHEN A TAPE IS MOUNTED.

;	!=======================================================!
;ACCLNK	!                     QUEUE LINKAGE                     !
;	!-------------------------------------------------------!
;ACCDD	!                   DEVICE DESIGNATOR                   !
;	!-------------------------------------------------------!
;ACCNO	!             JOB NUMBER    !        LINE NUMBER        !
;	!-------------------------------------------------------!
;ACCUSR	!                                                       !
;	\                       USER NAME                       \
;	!                                                       !
;	!-------------------------------------------------------!
;ACCSTG	!                                                       !
;	\                 USER'S ACCOUNT STRING                 \
;	!                                                       !
;	!-------------------------------------------------------!
;ACCCRT	!             DATE/TIME OF REQUEST CREATION             !
;	!-------------------------------------------------------!
;ACCSCD	!               DATE/TIME WHEN SCHEDULED                !
;	!-------------------------------------------------------!
;ACCSVT	!                DATE/TIME WHEN SERVICED                !
;	!-------------------------------------------------------!
;ACCEUT !                  ELAPSED TIME OF USE                  !
;	!-------------------------------------------------------!
;ACCDSP	!		       DISPOSITION			!
;	!-------------------------------------------------------!
;ACCVID	!                   VOLUME IDENTIFIER                   !
;	!                                                       !
;	!-------------------------------------------------------!
;ACCMC1	!CONTROLLER! LABEL!  LABEL  !            0              !
;	!-------------------------------------------------------!
;ACCPR	!                    RECORDS READ			!
;	!-------------------------------------------------------!
;ACCPW	!                   RECORDS WRITTEN			!
;	!-------------------------------------------------------!
;ACCFR	!                FRAMES READ / 1000.			!
;	!-------------------------------------------------------!
;ACCFW	!              FRAMES WRITTEN / 1000.			!
;	!-------------------------------------------------------!
;ACCSR	!            NUMBER OF SOFT READ ERRORS			!
;	!-------------------------------------------------------!
;ACCSW	!            NUMBER OF SOFT WRITE ERRORS		!
;	!-------------------------------------------------------!
;ACCHR	!            NUMBER OF HARD READ ERRORS			!
;	!-------------------------------------------------------!
;ACCHW	!            NUMBER OF HARD WRITE ERRORS		!
;	!-------------------------------------------------------!
;ACCFSI	!                  FILE SET IDENTIFIER                  !
;	!=======================================================!
SUBTTL MAGTAPE ACCOUNT STATUS BLOCK -- Field Definitions

FLDPTR==0
FLDDEF ACCLNK,1			;LINKAGE TO NEXT ENTRY IN QUEUE
FLDDEF ACCDD,1			;DEVICE DESIGNATOR AS DEFINED BY SYSTEM
FLDDEF ACCNO,1			;USER JOB NUMBER,,USER LINE NUMBER
FLDDEF ACCUSR,10		;ASCIZ USER NAME
FLDDEF ACCSTG,10		;USER ACCOUNT STRING
FLDDEF ACCCRT,1			;DATE AND TIME OF REQUEST CREATION
FLDDEF ACCSCD,1			;DATE AND TIME REQUEST SERVICED
FLDDEF ACCSVT,1			;DATE AND TIME WHEN REQUEST SERVICED
FLDDEF ACCEUT,1			;ELAPSED TIME OF USE
FLDDEF ACCDSP,1			; DISPOSITION OF REQUEST
ACCCSZ==:FLDPTR			;SIZE OF AREA COMMON TO ALL ACC BLOCKS
FLDDEF ACCVID,2			;VOLUME IDENTIFIER
FLDDEF ACCMC1,1			;CONTROLLER TYPE,LABEL TYPE,LABEL STATE
FLDDEF ACCPR,1			;NUMBER OF PHYSICAL RECORDS READ
FLDDEF ACCPW,1			;NUMBER OF PHYSICAL RECORDS WRITTEN
FLDDEF ACCFR,1			;NUMBER OF FRAMES READ/1000.
FLDDEF ACCFW,1			;NUMBER OF FRAMES WRITTEN/1000.
FLDDEF ACCSR,1			;NUMBER OF SOFT READ ERRORS
FLDDEF ACCSW,1			;NUMBER OF SOFT WRITE ERRORS
FLDDEF ACCHR,1			;NUMBER OF HARD READ ERRORS
FLDDEF ACCHW,1			;NUMBER OF HARD WRITE ERRORS
FLDDEF ACCFSI,1			;FILE SET IDENTIFIER (ASCIZ)
ACCSIZ==:FLDPTR			;SIZE OF MAGTAPE ACCOUNT BLOCK

DEFSTR (ACCJN,ACCNO(ACC),17,18)	;USER'S JOB NUMBER
DEFSTR (ACCLN,ACCNO(ACC),35,18)	;USER'S LINE NUMBER
DEFSTR (ACCKT,ACCMC1(ACC),5,6)	;CONTROLLER TYPE
DEFSTR (ACCLT,ACCMC1(ACC),11,6)	;LABEL TYPE
DEFSTR (ACCLS,ACCMC1(ACC),17,6)	;VOLUME LABEL STATE
SUBTTL STRUCTURE ACCOUNT STATUS BLOCK

;EACH STRUCTURE DECREMENT CAUSES AN ACCOUNT RECORD TO BE PUT INTO THE
;SYSTEM USAGE FILE.  THE ACCOUNT STATUS BLOCK IS MADE WHEN A STRUCURE
;IS INCREMENTED.

;	!=======================================================!
;ACCLNK	!                     QUEUE LINKAGE                     !
;	!-------------------------------------------------------!
;ACCDD	!                   DEVICE DESIGNATOR                   !
;	!-------------------------------------------------------!
;ACCNO	!             JOB NUMBER    !        LINE NUMBER        !
;	!-------------------------------------------------------!
;ACCUSR	!                                                       !
;	\                       USER NAME                       \
;	!                                                       !
;	!-------------------------------------------------------!
;ACCSTG	!                                                       !
;	\                 USER'S ACCOUNT STRING                 \
;	!                                                       !
;	!-------------------------------------------------------!
;ACCCRT	!             DATE/TIME OF REQUEST CREATION             !
;	!-------------------------------------------------------!
;ACCSCD	!               DATE/TIME WHEN SCHEDULED                !
;	!-------------------------------------------------------!
;ACCSVT	!                DATE/TIME WHEN SERVICED                !
;	!-------------------------------------------------------!
;ACCEUT !                  ELAPSED TIME OF USE                  !
;	!-------------------------------------------------------!
;ACCDSP	!		       DISPOSITION			!
;	!-------------------------------------------------------!
;ACCSTN	!                    STRUCTURE NAME                     !
;	!-------------------------------------------------------!
;ACCMCT	!    MOUNT COUNT BEFORE     !     MOUNT COUNT AFTER     !
;	!-------------------------------------------------------!
;ACCMC2	!CONTROLLER! DEVICE!   STR  !      NUMBER OF UNITS      !
;	!-------------------------------------------------------!
;ACCFRK	!     NUMBER OF JOB FORKS INCREMENTING MOUNT COUNT      !
;	!=======================================================!


FLDPTR==:ACCCSZ			;SET POINTER TO END OF COMMON SECTION

FLDDEF ACCSTN,1			;ASCIZ STRUCTURE PHYSICAL ID
FLDDEF ACCMCT,1			;MOUNT COUNT BEFORE,,MOUNT COUNT AFTER
FLDDEF ACCMC2,1			;CONTROLLER,DEVICE,STR TYPE,# OF UNITS
FLDDEF ACCFRK,1			;NUMBER OF JOB FORKS INCREMENTING COUNT

DEFSTR (ACCDT,ACCMC2(ACC),11,6)	;DEVICE TYPE
DEFSTR (ACCST,ACCMC2(ACC),17,6)	;STRUCTURE TYPE
DEFSTR (ACCNU,ACCMC2(ACC),35,18) ;NUMBER OF UNITS IN STRUCTURE
DEFSTR (ACCMB,ACCMCT(ACC),17,18) ;MOUNT COUNT BEFORE MOUNTING STR
DEFSTR (ACCMA,ACCMCT(ACC),35,18) ;MOUNT COUNT AFTER DISMOUNTING STR
SUBTTL ADDRESS SPACE ALLOCATION

; MACRO TO ASSIGN LARGE REGIONS OF ADDRESS SPACE

DEFINE ADASN (ADSYM,ADSIZ,ADPAG) <
	IFNB <ADPAG>,<ADPTR==<<ADPTR+777>&777000>> ;;PAGE BOUNDARY
	ADSYM=ADPTR		;;DEFINE START OF REGION
	ADPTR==ADPTR+ADSIZ	;;INCREMENT ALLOCATION POINTER
>
ADLOW==:50000			;START ASSIGNING SPACE AT THIS ADDRESS
ADPTR==:ADLOW			;INITIALIZE CURRENT ASSIGNMENT LOCATION

; ASSIGNMENT OF ADDRESS SPACE

ADASN RBUF,1000,PAGE		;BUFFER FOR RECEIVING IPCF MESSAGES
ADASN TBUF,1000,PAGE		;MSEND MESSAGES BUILT HERE
ADASN BADMSG,1000,PAGE		;BAD GALAXY IPCF MESSAGES SAVED HERE
ADASN DSBUF,DSFSZ,PAGE		;DEVICE-STATUS FILE BUFFER PAGE
;NOTE - LBUF1W MUST BE .GE. MAXPPB*1000 (MAXPPB IS DEFINED IN STG)
LBUF1W==:30000
ADASN LBUF1,LBUF1W,PAGE		;DUMPI/DUMPO LABEL BUFFER
ADASN SRQ,^D100*3		;SCHEDULER REQUEST QUEUE
MSGLEN==:5000			;Length of the TMCMSG buffer
ADASN TMCMSG,MSGLEN		;TEXT MESSAGE COMPOSITION AREA
ATMSIZ==:100
ADASN ATMBFR,ATMSIZ		;ATOM BUFFER FOR COMND JSYS
ADASN MTA0,MTASZ*MAXMTA		;MTA STATUS BLOCKS
ADASN MT0,MTSZ*MAXMT		;MT STATUS BLOCKS
ADASN RSB0,<<MAXMRQ+1>*RSBSIZ>	;RSB POOL
ADASN DSKSTB,DSKSZ*MAXDSK	;DSK STATUS BLOCKS
ADASN STRSTB,STRSZ*MAXDSK	;STR STATUS BLOCKS
  MAXSSB==:STRSZ*MAXDSK+STRSTB	;Max ssb entry address
VOLPN==:<MAXMRQ+1>*5		;AVERAGE 5 VOLIDS PER TAPE REQUEST
ADASN VOLP0,VOLPN*2		;VOLID STORAGE POOL
IGNLEN==:20
ADASN IGNTBL,IGNLEN		;STRUCTURE NAMES TO BE IGNORED
ADASN ACC0,<<MAXACC+1>*ACCSIZ>	;ACCOUNT BLOCK POOL

IFG ADPTR-700000,<PRINT1 <ADDRESS SPACE OVERFLOW>>


; DEVICE STATUS BUFFER EQUATES

DSB.CK==:DSBUF			;CHECKSUM WORD
DSB.PS==:DSBUF+1		;APR SERIAL NUMBER
DSB.NE==:DSBUF+2		;# OF ENTRIES IN DEVICE-STATUS FILE
DSB.VE==:DSBUF+3		;Version number of format of file
  DSBVER==:10			;Current version number
DSB.EO==:DSBUF+4		;ORIGIN OF ENTRY LIST IN BUFFER

;  Display message type

MSG%CI==:1B0			;Channel 7 message
MSG%CO==:1B1			;Conflicting bits in STRFLG message
MSG%AN==:1B3			;There is at least one disk to print
MSG%DU==:1B4			;Dual ported message
MSG%FR==:1B5			;Free drive doesn't mean can be removed

	END