TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page   0
Table of contents

    (1)        3        Copyright and History
    (2)      212        Data Structure Definitions
    (3)      288        Data Structure Connection Diagrams.
    (5)      365        External References
    (6)      401        Select the TMSCP server timeout.
    (7)      423        Local Storage
    (8)      495        Define the Field Access Macros.
    (9)      709        Server Action Routines
    (10)     740        -	START  -  Initialization Routine
    (11)     881        -	ADD - Add a Tape Unit
    (12)    1085        -	NEW_DEVICE - Serve a new DSA device unit
    (13)    1326        -	MV_SET_OFFLINE - Mount Verification set a device to the "offline" state.
    (14)    1393        -	LISTEN - Listen for a Connect Request
    (15)    1533        -	Virtual Circuit Error Routine
    (16)    1885        Main Line Routine
    (17)    2056        IMMEDIATE class commands
    (18)    2100        -	ABORT					(- 1 -)
    (19)    2250        -	GET COMMAND STATUS			(- 2 -)
    (20)    2388        -	GET UNIT STATUS				(- 3 -)
    (21)    2596        -	SET CONTROLLER CHARACTERISTICS		(- 4 -)
    (22)    2688        SEQUENTIAL class commands
    (23)    2799        -	SET_CLEAR_SEX
    (24)    2841        -	SET_IMMED
    (25)    2883        -	SET_CLEAR_CDL
    (26)    2927        -	AVAILABLE				(- 8 -)
    (27)    3093        -	ONLINE					(- 9 -)
    (28)    3256        -	SET UNIT CHARACTERISTICS		(- 10 -)
    (29)    3472        -	DETERMINE ACCESS PATHS			(- 11 -)
    (30)    3510        -	ACCESS					(- 16 -)
    (31)    3544        -	COMPARE HOST DATA			(- 32 -)
    (32)    3582        -	ERASE					(- 18 -)
    (33)    3789        -	ERGAP
    (34)    3825        -	REPOSITION
    (35)    4164        -	FLUSH					(- 19 -)
    (36)    4239        -	READ					(- 33 -)
    (37)    4526        -	WRITE_TAPE_MARK
    (38)    4631        -	WRITE					(- 34 -)
    (39)    4901        Utility Routines
    (39)    4902        -	ALLOCATE - Allocate a local buffer for the request
    (40)    4977        -	SEND_IRP -  prepare and issue an I/O to a tape
    (40)    4978        -	DRIVE_TRANSFER -  prepare and issue read/write type I/O
    (40)    4979        -	DRIVE_CHECK -  prepare and issue ONLINE, AVAIL, SUC, and FLUSH
    (41)    5129        -	BACK  -  return from tape I/O and continue
    (42)    5237        -	ALLOCATE_HRB -  Host Request Block Allocation
    (43)    5369        -	CLEANUP_HRB -  Host Request Resource Deallocation
    (44)    5522        -	UNBLOCK - Restart Any Blocked Commands
    (44)    5523        -	SEQ_STALL - Synchronize Sequential Commands
    (45)    5680        -	CHECK_XFER_STATUS - Translate the class driver message to a MSCP message
    (46)    6012        -	FIND UQB - Find the UQB corresponding to this request
    (47)    6141        -	SEND END - Respond To The Request
    (48)    6324        -	UNHOOK CDRP - Action routine to dequeue CDRP's
    (49)    6397        -	DEALLOCATE HQB - Remove an HQB if there are no requests 
    (50)    6470        Macros for Density Tables
    (51)    6543        Density and Speed Conversion Tables
    (52)    6613        Density Conversion Routines
    (52)    6614        .   TMSCP$VMSTOMSCP_DENS
    (53)    6666        .   TMSCP$MSCPTOVMS_DENS
    (54)    6699        .   TMSCP$FIND_SECTION
    (55)    6740        Speed Conversion Routines
    (55)    6741        .   TMSCP$SPEEDTOMSCP
    (56)    6780        .   TMSCP$MSCPTOSPEED
    (57)    6829        Debugging Routines
    (57)    6830        -	PC History recording
    (58)    6925        -	Current Counter Sanity Test
    (61)    7216        Read Only Length and Modifier Tables
    (62)    7346        Patch Area
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page   1
X-2A6A1                                                                  27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (1)

                                     0000     1 
                                     0000     2 	.TITLE	TMSCP - TMSCP Server - Emulator
                                     0000     3 	.SBTTL	Copyright and History
                                     0000     4 	.IDENT	'X-2A6A1'
                                     0000     5 
                           00000006  0000     6 	SOFTWARE_REV = 6		; Keep software rev level equal
                                     0000     7 					; to ident field for easier remote
                                     0000     8 					; diagnosis.
                           00000001  0000     9 	HARDWARE_REV = 1		; Increment this field in the event
                                     0000    10 					; of incompatible driver/server
                                     0000    11 					; changes.
                                     0000    12 
                                     0000    13 ;****************************************************************************
                                     0000    14 ;*									    *
                                     0000    15 ;*  COPYRIGHT (c) 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992 BY	    *
                                     0000    16 ;*  DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS.		    *
                                     0000    17 ;*  ALL RIGHTS RESERVED.						    *
                                     0000    18 ;* 									    *
                                     0000    19 ;*  THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED   *
                                     0000    20 ;*  ONLY IN  ACCORDANCE WITH  THE  TERMS  OF  SUCH  LICENSE  AND WITH THE   *
                                     0000    21 ;*  INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR  ANY  OTHER   *
                                     0000    22 ;*  COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY   *
                                     0000    23 ;*  OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE IS  HEREBY   *
                                     0000    24 ;*  TRANSFERRED.							    *
                                     0000    25 ;* 									    *
                                     0000    26 ;*  THE INFORMATION IN THIS SOFTWARE IS  SUBJECT TO CHANGE WITHOUT NOTICE   *
                                     0000    27 ;*  AND  SHOULD  NOT  BE  CONSTRUED AS  A COMMITMENT BY DIGITAL EQUIPMENT   *
                                     0000    28 ;*  CORPORATION.							    *
                                     0000    29 ;* 									    *
                                     0000    30 ;*  DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE  OR  RELIABILITY OF ITS   *
                                     0000    31 ;*  SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.		    *
                                     0000    32 ;* 									    *
                                     0000    33 ;*									    *
                                     0000    34 ;****************************************************************************
                                     0000    35 
                                     0000    36 ;+
                                     0000    37 ; FACILITY:	TMSCP Server
                                     0000    38 ;                         
                                     0000    39 ; ABSTRACT:
                                     0000    40 ;
                                     0000    41 ;	This program implements a Tape MSCP(Mass Storage Control Protocol) 
                                     0000    42 ;	server. It serves local tapes to remote systems (hosts). Valid 
                                     0000    43 ;	MSCP command packets are accepted as input from other cluster 
                                     0000    44 ;	members. Local tapes are then accessed via the proper tape driver 
                                     0000    45 ;	according to their type to perform the indicated operations. 
                                     0000    46 ;	
                                     0000    47 ;	A lot of this code was gleaned from MSCP.MAR. See modification
                                     0000    48 ;	history of that module if pursuing details of a particular
                                     0000    49 ;	implementation.
                                     0000    50 ;
                                     0000    51 ;
                                     0000    52 ; ENVIORNMENT:	Interrupt stack, system context
                                     0000    53 ;
                                     0000    54 ; AUTHOR:	Cheryl J. Bulmer
                                     0000    55 ;
                                     0000    56 ; CREATION DATE:  09-March-1990
                                     0000    57 ;
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page   2
X-2A6A1                         Copyright and History                    27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (1)

                                     0000    58 ; MODIFIED BY:
                                     0000    59 ;
                                     0000    60 ;	X-2A6A1 MGB0001		Michael Beeler			27-Aug-1992
                                     0000    61 ;		In ABORT routine, add missing # to BBS HRB$V_STATE_INVALID
                                     0000    62 ;
                                     0000    63 ;	X-2A6	JSSTS0030	John S.Simakauskas		7-Apr-1992
                                     0000    64 ;		Correct the UQB$W_NUM_QUE counter handling when aborting
                                     0000    65 ;		sequential commands. Previously it was possible for this
                                     0000    66 ;		counter to be decremented twice for a request.
                                     0000    67 ;
                                     0000    68 ;	X-2A5	RNH0163		Richard N. Holstein	13-Feb-1992
                                     0000    69 ;		Fix SMP problem when dealing with UCB$W_QLEN.  Update ident
                                     0000    70 ;		to agree with master pack reorg.
                                     0000    71 ;
                                     0000    72 ;	X-6A1	JSSTS0023	John Simakauskas		22-Jan-1992
                                     0000    73 ;		Disable packet logging (debug).
                                     0000    74 ;
                                     0000    75 ;	X-6	JSSTS0021	John S. Simakauskas		 6-Jan-1992
                                     0000    76 ;		Fix the order of restoring and register use in SEQ_STALL (UNBLOCK)
                                     0000    77 ;
                                     0000    78 ;	X-5	JSSTS0016	John S. Simakauskas		25-Oct-1991
                                     0000    79 ;		Change VC failure handling in the UNBLOCK routine.
                                     0000    80 ;		There are situations, when using the NI, where VC failures 
                                     0000    81 ;		can cause the servING node to crash. This problem has not 
                                     0000    82 ;		been reproducable when using the CI.
                                     0000    83 ;
                                     0000    84 ;	X-3A	JSSTS0014	John S. Simakauskas		03-Oct-1991
                                     0000    85 ;		Fix VC_ERR code to prevent BUG_CHECKing during
                                     0000    86 ;		an abort.
                                     0000    87 ;		Change CLEANUP_HRB to decrement UQB$NUM_QUE only if the
                                     0000    88 ;		UQB exists.
                                     0000    89 ;		Make TMSCP abort code more like MSCP code.
                                     0000    90 ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                                     0000    91 ;		make ident match new masd X-3
                                     0000    92 ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                                     0000    93 ;
                                     0000    94 ;	X-7a	JSSTS00xx	John S. Simakauskas		25-June-1991
                                     0000    95 ;		1.) Replace calls to TMSCP$SET_IMMED in the ERASE,
                                     0000    96 ;		    REPOSITION and WRITE_TAPE_MARK routines. Use the 
                                     0000    97 ;		    MD_IMMED value passed in packet in these routines.
                                     0000    98 ;		2.) Modify the TMSCP$SET_UNIT_CHAR routine such 
                                     0000    99 ;		    to use IO$_SETMODE in place of IO$_SETCHAR.
                                     0000   100 ;
                                     0000   101 ;	X-6	LPL0005		Lee Leahy			27 Aug 1990
                                     0000   102 ;		1.)  Fixed TMSCP$MSCPTOVMS_DENS to use default density
                                     0000   103 ;		     in table if a format is not specified.
                                     0000   104 ;		2.)  Fixed TMSCP$FIND_SECTION to verify that the requested section
                                     0000   105 ;		     is contained in the specified tables.
                                     0000   106 ;		3.)  Fixed TMSCP$SPEEDTOMSCP to use default density
                                     0000   107 ;		     in table if a format is not specified.
                                     0000   108 ;		4.)  Fixed TMSCP$MSCPTOSPEED to use default density
                                     0000   109 ;		     in table if a format is not specified.
                                     0000   110 ;		5.)  Zero the entire AVATN message to be sent in TMSCP$ADD.
                                     0000   111 ;		6.)  Properly set the tape density and speed in TMSCP$SET_UNIT_CHAR.
                                     0000   112 ;		7.)  Fixed GET_TAPE_FORMAT to support non-MSCP tapes.
                                     0000   113 ;		8.)  Fixed GET_TAPE_FORMENU to support non-MSCP tapes.
                                     0000   114 ;		9.)  Fixed GET_TAPE_SPEED to support non-MSCP tapes.
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page   3
X-2A6A1                         Copyright and History                    27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (1)

                                     0000   115 ;		10.) Fixed blown register in TMSCP$COMMON_TRANSFER that was 
                                     0000   116 ;		     corrupting the UCB$L_DEVDEPEND field of the UCB on the serving
                                     0000   117 ;		     system.  This was a royal pain to find!
                                     0000   118 ;
                                     0000   119 ;	X-5	LPL0004		Lee Leahy			23 Aug 1990
                                     0000   120 ;		1.)  Fixed PC logging in SEQ_STALL.
                                     0000   121 ;		2.)  Fix accvio crash caused when killing thread in 
                                     0000   122 ;		     TMSCP$COMMON_TRANSFER.
                                     0000   123 ;		3.)  Changed SS$_SERIOUSEXCP to MSCP$K_ST_PRESE in 
                                     0000   124 ;		     TMSCP$COMMON_TRANSFER.
                                     0000   125 ;		4.)  Saved registers in TMSCP$CHECK_CACHE
                                     0000   126 ;		5.)  Moved queue empty check in FLUSH_CACHE.
                                     0000   127 ;		6.)  Get TMSCP message address from HRB in TMSCP$ERR_EOT.
                                     0000   128 ;		7.)  Get TMSCP message address from HRB in TMSCP$ERR_PLOST.
                                     0000   129 ;		8.)  Get TMSCP message address from HRB in TMSCP$ERR_DLS.
                                     0000   130 ;		9.)  Get IRP address in TMSCP$ERASE after call to 
                                     0000   131 ;		     TMSCP$CHECK_XFER_STATUS.
                                     0000   132 ;		10.) Log PCs in TMSCP$ERROR_NO_UNIT and TMSCP$PACKET_ERROR.
                                     0000   133 ;		11.) Set IRP$W_FUNC field before checking for internally
                                     0000   134 ;		     generated AVAILABLE request in TMSCP$AVAILABLE.
                                     0000   135 ;		12.) Increased controller timeout to prevent command timeouts.
                                     0000   136 ;		13.) No need to call TMSCP$SET_CLEAR_SEX twice in TMSCP$REPOSTION.
                                     0000   137 ;		14.) Always update the tape position in TMSCP$REPOSITION.
                                     0000   138 ;		15.) Use correct field names for return record and tape mark count
                                     0000   139 ;		     in TMSCP$REPOSTION.
                                     0000   140 ;		16.) Removed references to HRB$L_ABCNT.
                                     0000   141 ;		17.) Fix path when AVAILABLE message received and unit is not online
                                     0000   142 ;		     to any host.
                                     0000   143 ;		18.) Saved command number in PC trace.
                                     0000   144 ;		19.) Use MACRO to access FORMAT field in UCB.
                                     0000   145 ;		20.) Use MACRO to access SPEED field in UCB.
                                     0000   146 ;		21.) Removed additional calls to TMSCP$SEQ_STALL in TMSCP$REPLACE
                                     0000   147 ;		     to preserve sequentiallity!
                                     0000   148 ;		22.) Moved call to TMSCP$SEQ_STALL into TMSCP$SEQUENTIAL.  This
                                     0000   149 ;		     fixes several synchronization bugs related to accessing the
                                     0000   150 ;		     other data structures (HQB, UCB, and UQB) within the processing
                                     0000   151 ;		     routines.
                                     0000   152 ;		23.) Properly enable write back caching and disable read caching on
                                     0000   153 ;		     a per unit basis in TMSCP$SET_UNIT_CHARACTERISTICS.
                                     0000   154 ;		24.) Removed the TMSCP server write back cache since this no 
                                     0000   155 ;		     feedback is available for end of tape and this cache can not
                                     0000   156 ;		     be shutdown prior to end of tape.  This form of caching is
                                     0000   157 ;		     broken!
                                     0000   158 ;		25.) Compare the same flags in TMSCP$ONLINE.
                                     0000   159 ;		26.) Use MACRO to access MAXWRCNT field in UCB.
                                     0000   160 ;		27.) Use MACRO to access NOISE field in UCB.
                                     0000   161 ;		28.) Converted tape speed from the MSCP to the VMS format in 
                                     0000   162 ;		     TMSCP$SET_UNIT_CHAR.
                                     0000   163 ;		29.) Converted tape format from the MSCP to the VMS format in
                                     0000   164 ;		     TMSCP$SET_UNIT_CHAR.
                                     0000   165 ;		30.) Copied the MSCP to VMS and VMS to MSCP conversion routines
                                     0000   166 ;		     from TUDRIVER.
                                     0000   167 ;		31.) Fixed TMSCP$SEQ_STALL and TMSCP$UNBLOCK to correctly stall 
                                     0000   168 ;		     additional sequential commands.
                                     0000   169 ;		32.) Moved call to TMSCP$UNBLOCK into TMSCP$CLEANUP_HRB.
                                     0000   170 ;		33.) Enable MSCP modifiers in TMSCP$SET_CLEAR_CDL.
                                     0000   171 ;		34.) Logging more of the IRP in the PC history buffer.
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page   4
X-2A6A1                         Copyright and History                    27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (1)

                                     0000   172 ;		35.) TMSCP$ONLINE now calls TMSCP$SET_UNIT_CHAR to properly set the
                                     0000   173 ;		     unit characteristics for TMSCP and non-TMSCP tapes.
                                     0000   174 ;		36.) Set buffer length in TMSCP$SET_UNIT_CHAR.
                                     0000   175 ;
                                     0000   176 ;	X-4	LPL0003		Lee Leahy			 4 Jul 1990
                                     0000   177 ;		1.)  Fixed initialization of TSRV structure.
                                     0000   178 ;		2.)  Use actual PCs in the history buffer.
                                     0000   179 ;		3.)  Only initialize the PC history buffer once.
                                     0000   180 ;		4.)  Log a few more PCs in the history buffer.
                                     0000   181 ;		5.)  Moved the calls to SET_CLEAR_SEX and SET_CLEAR_CDL
                                     0000   182 ;		     in TMSCP$READ_TRANSFER.
                                     0000   183 ;		6.)  Moved the calls to SET_CLEAR_SEX, SET_CLEAR_CDL, and
                                     0000   184 ;		     SET_IMMED in TMSCP$WRITE_TRANSFER.
                                     0000   185 ;		7.)  Changed names from TMSCP. to TMSCP$ since SDA does not
                                     0000   186 ;		     allow periods (.) in symbol names.
                                     0000   187 ;		8.)  Fixed initialization of UQB address in TMSCP$SET_IMMED.
                                     0000   188 ;
                                     0000   189 ;	X-3	LPL0002		Lee Leahy			 2 Jul 1990
                                     0000   190 ;		1.)  Changed access to TSRV structure in TMSCP$ERASE.
                                     0000   191 ;		2.)  Fixed build bug.  Duplicate HARDWARE_REV symbol in 
                                     0000   192 ;		     object library.
                                     0000   193 ;
                                     0000   194 ;	X-2	LPL0001		Lee Leahy			 7 Jun 1990
                                     0000   195 ;		1.)  Added debug flags.
                                     0000   196 ;		2.)  Fixed bad branch in TMSCP$ERR_PLOST at 5$.  
                                     0000   197 ;		             BBSS #UQB$M_ST_PLS -> $V.
                                     0000   198 ;		3.)  Fixed bad branch in TMSCP$GET_UNIT_STATUS at 160$.  
                                     0000   199 ;		             BBC #MSCP$M_UF_WRTPD -> $V.
                                     0000   200 ;		4.)  Fixed bad branch in TMSCP$ERR_EOF.
                                     0000   201 ;		             BBC #MT$M_BOT -> $V.
                                     0000   202 ;		5.)  Fixed blown register in TMSCP$SET_CLEAR_SEX.  UQB uses R5 not 
                                     0000   203 ;		     R3.
                                     0000   204 ;		6.)  Make symbols global for symbol table generation.
                                     0000   205 ;		7.)  Added data structure connection diagrams.
                                     0000   206 ;
                                     0000   207 ;	X-1	CJB0001		Cheryl J. Bulmer		09-March-1990
                                     0000   208 ;		Initial checkin.
                                     0000   209 ;-
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page   5
X-2A6A1                         Data Structure Definitions               27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (2)

                                     0000   212 	.SBTTL	Data Structure Definitions
                                     0000   213 
                                     0000   214 	.DISABLE	GLOBAL
                                     0000   215 
                                     0000   216 ;
                                     0000   217 ; INCLUDE FILES:
                                     0000   218 ;
                                     0000   219 
                                     0000   220 ;;	.NOCROSS
                                     0000   221 	$CDDBDEF		; Class Driver Data Block
                                     0000   222 	$CDRPDEF		; Class Driver Request Packet
                                     0000   223 	$CDTDEF			; Connection Descriptor Table
                                     0000   224 	$DCDEF			; Device Adapter, Type and Class Codes
                                     0000   225 	$DDBDEF			; Driver Data Block
                                     0000   226 	$DDTDEF			; Driver Dispatch Table
                                     0000   227 	$DEVDEF			; Device Characteristics
                                     0000   228 	$TSRVDEF		; MSCP Server structure definition
                                     0000   229 	$DYNDEF			; Data Structure type definitions
                                     0000   230 	$HQBDEF			; Host Queue Block structure definition
                                     0000   231 	$HRBDEF			; Host Request Block structure definition
                                     0000   232 	$IODEF			; I/O function code definitions
                                     0000   233 	$IPLDEF			; Interupt level definitions
                                     0000   234 	$IRPDEF			; I/O Request Packet structure definition
                                     0000   235 	$MSCPDEF		; Tape Mass Storage Control Protocol packet
                                     0000   236 	$MTDEF			; Define MAGTAPE STATUS bits
                                     0000   237 	$MT2DEF			; Define MAGTAPE extended characteristics
                                     0000   238 	$PBDEF			; Path Block offsets
                                     0000   239 	$PDTDEF			; Port Descriptor Table
                                     0000   240 	$PRDEF			; Processor Register
                                     0000   241 	$SBDEF			; System Block offsets
                                     0000   242 	$SCSDEF			; System Communications Services
                                     0000   243 	$SDIRDEF		; SCS Directory defs
                                     0000   244 	$SLVDEF			; System Loadable Vector
                                     0000   245 	$SRVBUFDEF		; Internal buffer area definition
                                     0000   246 	$SPLCODDEF		; Define spinlock indicies
                                     0000   247 	$SSDEF			; System Service message definitions
                                     0000   248 	$UCBDEF			; Unit Control Block structure definition
                                     0000   249 	$UQBDEF			; Unit Queue Block structure definition
                                     0000   250 	$VADEF			; Virtual Address Field Definitions
                                     0000   251 	$VAXDEF			; VAX model definitions
                                     0000   252 	$VCBDEF			; Volume Control Block Definitions
                                     0000   253 
                                     0000   254 
                                     0000   255 ;
                                     0000   256 ; Debugging switches
                                     0000   257 ;
                                     0000   258 ;		DEBUG$PC_HISTORY	= 0	; Assemble PC history code
                                     0000   259 ;		DEBUG$CURRENT_SANITY	= 0	; Assemble the current counter checks
                                     0000   260 ;		DEBUG$REJECT_TRACKING	= 0	; Monitor the reason for rejects
                                     0000   261 ;		DEBUG$LOG		= 0	; Enable logging of packets
                                     0000   262 ;
                                     0000   263 
                                     0000   264 ;
                                     0000   265 ; MACROS:
                                     0000   266 ;
                                     0000   267 
                                     0000   268 	.MACRO	ACTION,SYSERR,TMSCPERR,ROUTINE
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page   6
X-2A6A1                         Data Structure Definitions               27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (2)

                                     0000   269 	 .WORD	SYSERR
                                     0000   270 	 .WORD	TMSCPERR
                                     0000   271 	 .IF B ROUTINE
                                     0000   272 	  .WORD	0
                                     0000   273 	 .IFF
                                     0000   274 	  .WORD	ROUTINE-.
                                     0000   275 	 .ENDC
                                     0000   276 	.ENDM		
                                     0000   277 
                                     0000   278 ; A longword is needed in the CDRP so that when it is returned to the server
                                     0000   279 ; the corresponding HRB can be determined.  Since the server is doing its
                                     0000   280 ; own internal I/O, we can use the ASTPRM field for the HRB address.
                                     0000   281 ;
                           FFFFFFB4  0000   282 	CDRP$L_HRB = CDRP$L_ASTPRM
                           00000014  0000   283 	IRP$L_HRB  = IRP$L_ASTPRM
                                     0000   284 
                                     0000   285 	.DEFAULT DISPLACEMENT WORD		; Make relative offsets a word.
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page   7
X-2A6A1                         Data Structure Connection Diagrams.      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (3)

                                     0000   288 	.SBTTL	Data Structure Connection Diagrams.
                                     0000   289 
                                     0000   290 
                                     0000   291 ;	HRB  =  Host Request Block
                                     0000   292 ;	HQB  =  Host Queue Block
                                     0000   293 ;	UQB  =  Unit Queue Block
                                     0000   294 ;
                                     0000   295 ;			Host request linkage.
                                     0000   296 ;
                                     0000   297 ;	+-------------------+
                                     0000   298 ;	!        HRB        !
                                     0000   299 ;	!                   !
                                     0000   300 ;	!            msgbuf !--------------------------------->+------------------+
                                     0000   301 ;	!                   !                                  !   MSCP message   !
                                     0000   302 ;	!          irp_cdrp !------>+-------------------+      !                  !
                                     0000   303 ;	!                   !       !        IRP        !      +------------------+
                                     0000   304 ;	+-------------------+       !                   !
                                     0000   305 ;	                            !              fqfl !------>+------------------+
                                     0000   306 ;	                            !                   !       !       CDRP       !
                                     0000   307 ;	                            +-------------------+       !                  !
                                     0000   308 ;	                                                        +------------------+
                                     0000   309 ;
                                     0000   310 ;			MSCP message processing.
                                     0000   311 ;	
                                     0000   312 ;	+-------------------+
                                     0000   313 ;	!        HQB        !
                                     0000   314 ;	!               cdt !---------------------------------->+------------------+
                                     0000   315 ;	!                   !                                   !        CDT       !
                                     0000   316 ;	!            hrb_fl !------>+-------------------+       !                  !
                                     0000   317 ;	!            hrb_bl !<------!        HRB        !       !                  !
                                     0000   318 ;	!                   !       !                   !       +------------------+
                                     0000   319 ;	!                   !<------! hqb               !
                                     0000   320 ;	!      f/blink      !       !      f/blink      !
                                     0000   321 ;	+-------------------+       +-------------------+
                                     0000   322 ;	        |   ^                       |   ^
                                     0000   323 ;	         ...                         ...
                                     0000   324 ;	        |   |                       |   |
                                     0000   325 ;	        V   |                       V   |
                                     0000   326 ;	+-------------------+       +-------------------+
                                     0000   327 ;	!      f/blink      !       !      f/blink      !
                                     0000   328 ;	!                   !       !                   !
                                     0000   329 ;	!        HQB        !       !        HRB        !
                                     0000   330 ;	+-------------------+       +-------------------+
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page   8
X-2A6A1                         Data Structure Connection Diagrams.      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (4)

                                     0000   333 
                                     0000   334 ;		Sequential command synchronization.
                                     0000   335 ;
                                     0000   336 ;	+-------------------+
                                     0000   337 ;	!        UQB        !
                                     0000   338 ;	!                   !
                                     0000   339 ;	!        blocked_fl !------>+-------------------+
                                     0000   340 ;	!        blocked_bl !<------!        HRB        !
                                     0000   341 ;	!                   !       !                   !
                                     0000   342 ;	!                   !<------! uqb               !
                                     0000   343 ;	!      f/blink      !       !     wait_fl/bl    !
                                     0000   344 ;	+-------------------+       +-------------------+
                                     0000   345 ;	        |   ^                       |   ^
                                     0000   346 ;	         ...                         ...
                                     0000   347 ;	        |   |                       |   |
                                     0000   348 ;	        V   |                       V   |
                                     0000   349 ;	+-------------------+       +-------------------+
                                     0000   350 ;	!      f/blink      !       !     wait_fl/bl    !
                                     0000   351 ;	!                   !       !                   !
                                     0000   352 ;	!        UQB        !       !        HRB        !
                                     0000   353 ;	+-------------------+       +-------------------+
                                     0000   354 ;
                                     0000   355 ;	Note: The flag UQB$V_SEQ indicates that a sequential 
                                     0000   356 ;	command is currently being processed.  When additional
                                     0000   357 ;	sequential commands are received, they are placed on
                                     0000   358 ;	the BLOCKED queue.  As each sequential command completes, 
                                     0000   359 ;	the next sequential command is started until no more
                                     0000   360 ;	sequential commands remain.  At this time, the flag
                                     0000   361 ;	UQB$V_SEQ is cleared.  Each sequential command is noted
                                     0000   362 ;	by the flag HRB$V_UNBLOCK.
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page   9
X-2A6A1                         External References                      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (5)

                                     0000   365 	.SBTTL	External References
                                     0000   366 
                                     0000   367 	.EXTERNAL	BUG$_MSCPSERV
                                     0000   368 
                                     0000   369 	.EXTERNAL	CLU$GL_TAPE_ALLOCLS
                                     0000   370 
                                     0000   371 	.EXTERNAL	EXE$ALONONPAGED
                                     0000   372 	.EXTERNAL	EXE$DEANONPAGED
                                     0000   373 	.EXTERNAL	EXE$DEANONPGDSIZ
                                     0000   374 	.EXTERNAL	EXE$GL_ABSTIM_TICS
                                     0000   375 	.EXTERNAL	EXE$GL_ERASEPPT
                                     0000   376 	.EXTERNAL	EXE$INSIOQC
                                     0000   377 
                                     0000   378 	.EXTERNAL	INI$BRK
                                     0000   379 
                                     0000   380 	.EXTERNAL	MMG$GL_SPTBASE
                                     0000   381 
                                     0000   382 	.EXTERNAL	PMS$END_RQ
                                     0000   383 	.EXTERNAL	PMS$GL_IOPFMPDB
                                     0000   384 	.EXTERNAL	PMS$GL_IOPFMSEQ
                                     0000   385 	.EXTERNAL	PMS$START_RQ
                                     0000   386 
                                     0000   387 	.EXTERNAL	SCS$ALLOC_RSPID
                                     0000   388 	.EXTERNAL	SCS$DEALL_RSPID
                                     0000   389 	.EXTERNAL	SCS$DISCONNECT
                                     0000   390 	.EXTERNAL	SCS$LKP_MSGWAIT
                                     0000   391 	.EXTERNAL	SCS$LKP_RDTCDRP
                                     0000   392 	.EXTERNAL	SCS$LKP_RDTWAIT
                                     0000   393 
                                     0000   394 	.EXTERNAL	SCS$GB_SYSTEMID
                                     0000   395 	.EXTERNAL	SCS$GL_CDL
                                     0000   396 	.EXTERNAL	SCS$GL_TMSCP
                                     0000   397 	.EXTERNAL	SCS$GL_TMSCP_MV
                                     0000   398 	.EXTERNAL	SCS$GQ_DIRECT
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  10
X-2A6A1                         Select the TMSCP server timeout.         27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (6)

                                     0000   401 	.SBTTL	Select the TMSCP server timeout.
                                     0000   402 
                                     0000   403 	.MACRO	NEW_TIMEOUT	controller, timeout
                                     0000   404 	.IF	EQUAL	timeout
                                     0000   405 CNTRL_TIMEOUT_'controller	=	255
                                     0000   406 	.IFF
                                     0000   407 CNTRL_TIMEOUT_'controller	=	timeout
                                     0000   408 	.ENDC
                                     0000   409 	.IF	GREATER	CNTRL_TIMEOUT_'controller-SERVER_TIMEOUT
                                     0000   410 SERVER_TIMEOUT	=	CNTRL_TIMEOUT_'controller
                                     0000   411 	.ENDC
                                     0000   412 	.ENDM	NEW_TIMEOUT
                                     0000   413 
                                     0000   414 
                                     0000   415 
                                     0000   416 
                           0000001E  0000   417 SERVER_TIMEOUT	=	30		; Set default timeout value.
                                     0000   418 
                                     0000   419 	NEW_TIMEOUT	TK50	<^X 0078>
                                     0000   420 	NEW_TIMEOUT	HSC	<^X 00FF>
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  11
X-2A6A1                         Local Storage                            27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (7)

                                     0000   423 	.SBTTL	Local Storage
                                 00000000   424 	.PSECT	$$$100_TMSCP_VECTOR_TABLE,QUAD
                                     0000   425 
                                     0000   426 	.SHOW MEB
                                     0000   427 
                                     0000   428 TMSCP$BEGIN::
                                     0000   429 
                                     0000   430 ;
                                     0000   431 ;		The following data structures are used for loading the
                                     0000   432 ;		TMSCP server.  After that they are over written with the
                                     0000   433 ;		TSRV data structure.
                                     0000   434 ;
                                     0000   435 
                           00000001  0000   436 	PRMSW	=  1
                                     0000   437 
                                     0000   438 	SLVTAB	END	= TMSCP$END,-
                                     0000   439 		INITRTN	= TMSCP$INIT,-
                                     0000   440 ;		SUBTYP	= DYN$C_LC_TMSCP,-
                                     0000   441 		SUBTYP	= DYN$C_LC_MSCP,-
                                     0000   442 		FACILITY= <TMSCP_SERVER>
                                     0000       	.SAVE	LOCAL_BLOCK
                                 00000000       	.RESTORE
                                     0000       30000$:
                           00002370' 0000       	.LONG	TMSCP$END-30000$
                           00000770' 0004       	.LONG	TMSCP$INIT-30000$
                               2370' 0008       	.WORD	TMSCP$END-30000$
                                 62  000A       	.BYTE	DYN$C_LOADCODE
                                 08  000B       	.BYTE	DYN$C_LC_MSCP
                                 07  000C       	.BYTE	PRT$C_ER
                                 05  000D       	.BYTE	PRT$C_EW
                               0000  000E       	.WORD	0
                           00000000  0010       	.LONG	0
45 56 52 45 53 5F 50 43 53 4D 54 00' 0014       30001$:	.ASCIC	/TMSCP_SERVER/
                                 52  0020       
                                 0C  0014       
                           00000024  0021       	.=30001$+16
                                     0024   443 
                                     0024   444 	LOADVEC	TYPE	  = SLV$K_SDATA,-
                                     0024   445 		ENTRY	  = SCS$GL_TMSCP,-
                                     0024   446 		SEC_LABEL = TMSCP$BEGIN
                                 04  0024       	   .BYTE SLV$K_SDATA
                           00000000' 0025       	   .ADDRESS SCS$GL_TMSCP
                           FFFFFFD7  0029       	   .LONG   <TMSCP$BEGIN-.>
                                     002D   447 
         FFFFFFFF FFFFFFFF FFFFFFFF  002D   448 	.LONG	-1,-1,-1
                                     0039   449 
                                     0039   450 	.ALIGN	QUAD
                                     0040   451 
                                     0040   452 ;
                                     0040   453 ; Allocate space for the TSRV data structure.
                                     0040   454 ;
                                     0040   455 
                           00000040  0040   456 OVERLAY_AREA	=	. - TMSCP$BEGIN
                                     0040   457 
                           0000076C  0040   458 	.BLKB	TSRV$K_LENGTH - OVERLAY_AREA
                                     076C   459 
                                     076C   460 ;
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  12
X-2A6A1                         Local Storage                            27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (7)

                                     076C   461 ; Definition of constants
                                     076C   462 ;
                           00000100  076C   463 	MAX_UNITS   =   256
                           00000100  076C   464 	MAX_HOSTS   =   256
                           00000000  076C   465 	VERSION	    =	0
                                     076C   466 
                                     076C   467 
                                     076C   468 	.IF DEFINED DEBUG$PC_HISTORY
                                     076C   469 ;
                                     076C   470 ; Space is allocated here for PC history storage
                                     076C   471 ;
                                     076C   472 
                                     076C   473 	$EQU	PCHIST_ENTRIES	1024		; Number of entries in the history
                                     076C   474 
                                     076C   475 TMSCP$PCHISTBEG::	.LONG	0		; Address of the start of the table
                                     076C   476 TMSCP$PCHISTCUR::	.LONG	0		; Pointer to next available slot
                                     076C   477 TMSCP$PCHISTEND::	.LONG	0		; Address of the end of the table
                                     076C   478 TMSCP$PCHISTFUL::	.LONG	0		; Table full counter
                                     076C   479 TMSCP$PCHISTBUF::	.BLKL	PCHIST_ENTRIES	; Table for storing server offsets
                                     076C   480 TMSCP$PCTBLEND::
                                     076C   481 
                                     076C   482 	.ENDC	   ;DEBUG$PC_HISTORY
                                     076C   483 
                                     076C   484 	$VIELD	TMSCP, 0, < -
                                     076C   485 		< DBG_START, , M >, -		; Breakpoint in TMSCP$START.
                                     076C   486 		< DBG_MSG_IN, , M >, -		; Breakpoint in TMSCP$MSG_IN.
                                     076C   487 		< DBG_SEND_PKT, , M > -		; Breakpoint in TMSCP$SEND_PKT.
                                     076C   488 		>
                                     076C   489 
                                     076C   490 	.WEAK	TMSCP$C_DEBUG_FLAGS
                                     076C   491 
                           00000000' 076C   492 TMSCP$L_DEBUG_FLAGS::	.LONG	0 \ TMSCP$C_DEBUG_FLAGS
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  13
X-2A6A1                         Define the Field Access Macros.          27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (8)

                                     0770   495 	.SBTTL	Define the Field Access Macros.
                                     0770   496 
                                     0770   497 	.MACRO	GET_TAPE_FORMAT	ucb, ?not_mscp, ?tape_format_set
                                     0770   498 
                                     0770   499 ;
                                     0770   500 ;		Return the MSCP tape format when possible.
                                     0770   501 ;
                                     0770   502 
                                     0770   503 	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                                     0770   504 		UCB$L_DEVCHAR2('ucb'), not_mscp	; Not MSCP tape - branch.
                                     0770   505 	MOVW	UCB$W_TU_FORMAT('ucb'), -	; Steal tape format from UCB.
                                     0770   506 		MSCP$W_FORMAT(R2)
                                     0770   507 	BRB	tape_format_set
                                     0770   508 
                                     0770   509 ;
                                     0770   510 ;		Get the VMS tape format value.
                                     0770   511 ;
                                     0770   512 
                                     0770   513 not_mscp:
                                     0770   514 	MOVQ	R0, -(SP)
                                     0770   515 	EXTZV	# MT$V_DENSITY, -		; Extract VMS density from the UCB.
                                     0770   516 		# MT$S_DENSITY, -
                                     0770   517 		UCB$L_DEVDEPEND('ucb'), R0
                                     0770   518 
                                     0770   519 ;
                                     0770   520 ;		Convert the VMS tape format into the MSCP equivalent.
                                     0770   521 ;
                                     0770   522 
                                     0770   523 	CLRL	R1				; Use default VMS density table.
                                     0770   524 	BSBW	TMSCP$VMSTOMSCP_DENS		; Convert tape density value.
                                     0770   525 
                                     0770   526 ;
                                     0770   527 ;		Return the MSCP tape format.
                                     0770   528 ;
                                     0770   529 
                                     0770   530 	MOVW	R1, MSCP$W_FORMAT(R2)		; Return the tape format.
                                     0770   531 	MOVQ	(SP)+, R0
                                     0770   532 
                                     0770   533 tape_format_set:
                                     0770   534 	.ENDM	GET_TAPE_FORMAT
                                     0770   535 
                                     0770   536 
                                     0770   537 
                                     0770   538 
                                     0770   539 	.MACRO	GET_TAPE_FORMENU	ucb, ?not_mscp, ?tape_formenu_set
                                     0770   540 
                                     0770   541 ;
                                     0770   542 ;		Return the MSCP tape formenu when possible.
                                     0770   543 ;
                                     0770   544 
                                     0770   545 	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                                     0770   546 		UCB$L_DEVCHAR2('ucb'), not_mscp	; Not MSCP tape - branch.
                                     0770   547 	MOVW	UCB$W_TU_FORMENU('ucb'), -	; Steal tape formenu from UCB.
                                     0770   548 		MSCP$W_FORMENU(R2)
                                     0770   549 	BRB	tape_formenu_set
                                     0770   550 
                                     0770   551 ;
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  14
X-2A6A1                         Define the Field Access Macros.          27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (8)

                                     0770   552 ;		Get the VMS tape formenu value.
                                     0770   553 ;
                                     0770   554 
                                     0770   555 not_mscp:
                                     0770   556 	MOVQ	R0, -(SP)
                                     0770   557 	EXTZV	# MT$V_DENSITY, -		; Extract VMS density from the UCB.
                                     0770   558 		# MT$S_DENSITY, -
                                     0770   559 		UCB$L_DEVDEPEND('ucb'), R0
                                     0770   560 
                                     0770   561 ;
                                     0770   562 ;		Convert the VMS tape density into the MSCP equivalent.
                                     0770   563 ;
                                     0770   564 
                                     0770   565 	CLRL	R1				; Use default VMS density table.
                                     0770   566 	BSBW	TMSCP$VMSTOMSCP_DENS		; Convert tape density value.
                                     0770   567 
                                     0770   568 ;
                                     0770   569 ;		Return the MSCP tape formenu.
                                     0770   570 ;
                                     0770   571 
                                     0770   572 	MOVB	R1, MSCP$W_FORMENU(R2)		; Return the current tape format.
                                     0770   573 	MOVB	R1, 1+MSCP$W_FORMENU(R2)	; Return the supported densities.
                                     0770   574 	MOVQ	(SP)+, R0
                                     0770   575 
                                     0770   576 tape_formenu_set:
                                     0770   577 	.ENDM	GET_TAPE_FORMENU
                                     0770   578 
                                     0770   579 
                                     0770   580 
                                     0770   581 
                                     0770   582 	.MACRO	GET_TAPE_MAXWRCNT	ucb, tmp, ?not_mscp, ?tape_maxwrcnt_set
                                     0770   583 
                                     0770   584 ;
                                     0770   585 ;		Return the MSCP tape maxwrcnt when possible.
                                     0770   586 ;
                                     0770   587 
                                     0770   588 	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                                     0770   589 		UCB$L_DEVCHAR2('ucb'), not_mscp	; Not MSCP tape - branch.
                                     0770   590 	MOVL	UCB$L_TU_MAXWRCNT('ucb'), -	; Steal tape maxwrcnt from UCB.
                                     0770   591 		MSCP$L_MAXWTREC(R2)
                                     0770   592 	BRB	tape_maxwrcnt_set
                                     0770   593 
                                     0770   594 ;
                                     0770   595 ;		Get the VMS tape maxwrcnt value.
                                     0770   596 ;
                                     0770   597 
                                     0770   598 not_mscp:
                                     0770   599 	MOVZWL	#^XFFFF, tmp			; Supply the default tape maxwrcnt.
                                     0770   600 
                                     0770   601 ;
                                     0770   602 ;		Convert the VMS tape maxwrcnt into the MSCP equivalent.
                                     0770   603 ;
                                     0770   604 
                                     0770   605 ;
                                     0770   606 ;		Return the MSCP tape maxwrcnt.
                                     0770   607 ;
                                     0770   608 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  15
X-2A6A1                         Define the Field Access Macros.          27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (8)

                                     0770   609 	MOVL	tmp, MSCP$L_MAXWTREC(R2)	; Return the tape maxwrcnt.
                                     0770   610 
                                     0770   611 tape_maxwrcnt_set:
                                     0770   612 	.ENDM	GET_TAPE_MAXWRCNT
                                     0770   613 
                                     0770   614 
                                     0770   615 
                                     0770   616 	.MACRO	GET_TAPE_NOISE	ucb, tmp, ?not_mscp, ?tape_noise_set
                                     0770   617 
                                     0770   618 ;
                                     0770   619 ;		Return the MSCP tape noise when possible.
                                     0770   620 ;
                                     0770   621 
                                     0770   622 	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                                     0770   623 		UCB$L_DEVCHAR2('ucb'), not_mscp	; Not MSCP tape - branch.
                                     0770   624 	MOVW	UCB$W_TU_NOISE('ucb'), -	; Steal tape noise from UCB.
                                     0770   625 		MSCP$W_NOISEREC(R2)
                                     0770   626 	BRB	tape_noise_set
                                     0770   627 
                                     0770   628 ;
                                     0770   629 ;		Get the VMS tape noise value.
                                     0770   630 ;
                                     0770   631 
                                     0770   632 not_mscp:
                                     0770   633 	CLRL	tmp				; Supply the default tape noise.
                                     0770   634 
                                     0770   635 ;
                                     0770   636 ;		Convert the VMS tape noise into the MSCP equivalent.
                                     0770   637 ;
                                     0770   638 
                                     0770   639 ;
                                     0770   640 ;		Return the MSCP tape noise.
                                     0770   641 ;
                                     0770   642 
                                     0770   643 	MOVW	tmp, MSCP$W_NOISEREC(R2)	; Return the tape noise.
                                     0770   644 
                                     0770   645 tape_noise_set:
                                     0770   646 	.ENDM	GET_TAPE_NOISE
                                     0770   647 
                                     0770   648 
                                     0770   649 
                                     0770   650 	.MACRO	GET_TAPE_SPEED	ucb, mscp_format, ?not_mscp, ?tape_speed_set
                                     0770   651 
                                     0770   652 ;
                                     0770   653 ;		Return the MSCP tape speed when possible.
                                     0770   654 ;
                                     0770   655 
                                     0770   656 	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                                     0770   657 		UCB$L_DEVCHAR2('ucb'), not_mscp	; Not MSCP tape - branch.
                                     0770   658 	MOVW	UCB$W_TU_SPEED('ucb'), -	; Steal tape speed from UCB.
                                     0770   659 		MSCP$W_SPEED(R2)		; (Kilobytes per second)
                                     0770   660 	BRB	tape_speed_set
                                     0770   661 
                                     0770   662 not_mscp:
                                     0770   663 	MOVQ	R0, -(SP)
                                     0770   664 	.IF	BLANK	mscp_format
                                     0770   665 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  16
X-2A6A1                         Define the Field Access Macros.          27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (8)

                                     0770   666 ;
                                     0770   667 ;		Get the VMS tape density value.
                                     0770   668 ;
                                     0770   669 
                                     0770   670 	EXTZV	# MT$V_DENSITY, -		; Extract VMS density from the UCB.
                                     0770   671 		# MT$S_DENSITY, -
                                     0770   672 		UCB$L_DEVDEPEND('ucb'), R0
                                     0770   673 
                                     0770   674 ;
                                     0770   675 ;		Convert the VMS tape density into the MSCP equivalent.
                                     0770   676 ;
                                     0770   677 
                                     0770   678 	CLRL	R1				; Use default VMS density table.
                                     0770   679 	BSBW	TMSCP$VMSTOMSCP_DENS		; Convert tape density value.
                                     0770   680 	.IFF
                                     0770   681 	MOVZWL	mscp_format, R1			; Get the MSCP tape format.
                                     0770   682 	.ENDC
                                     0770   683 
                                     0770   684 ;
                                     0770   685 ;		Get the VMS tape speed value.
                                     0770   686 ;
                                     0770   687 
                                     0770   688 	EXTZV	# MT$V_SPEED, -			; Extract VMS tape speed from UCB
                                     0770   689 		# MT$S_SPEED, -			; and return as the tape speed.
                                     0770   690 		UCB$L_DEVDEPEND('ucb'), R0
                                     0770   691 
                                     0770   692 ;
                                     0770   693 ;		Convert the VMS tape speed into the MSCP equivalent.
                                     0770   694 ;
                                     0770   695 
                                     0770   696 	BSBW	TMSCP$SPEEDTOMSCP		; Convert speed value.
                                     0770   697 
                                     0770   698 ;
                                     0770   699 ;		Return the MSCP tape speed.
                                     0770   700 ;
                                     0770   701 
                                     0770   702 	MOVW	R0, MSCP$W_SPEED(R2)		; Return the tape speed.
                                     0770   703 	MOVQ	(SP)+, R0
                                     0770   704 
                                     0770   705 tape_speed_set:
                                     0770   706 	.ENDM	GET_TAPE_SPEED
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  17
X-2A6A1                         Server Action Routines                   27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1             (9)

                                     0770   709 	.SBTTL	Server Action Routines
                                     0770   710 
                                     0770   711 ;+
                                     0770   712 ; These routines are called to carry out actions that must be done 
                                     0770   713 ; from high IPL code that resides in non-paged pool.
                                     0770   714 ;
                                     0770   715 ; Inputs:
                                     0770   716 ;
                                     0770   717 ;	AP -->	#arguments
                                     0770   718 ;		action code
                                     0770   719 ;		parameter(s)
                                     0770   720 ;
                                     0770   721 ; Outputs:
                                     0770   722 ;
                                     0770   723 ;	R0 = status code
                                     0770   724 ;-
                                     0770   725 
                                     0770   726 TMSCP$INIT::
                                     0770   727 
                                     0770   728 	ASSUME	TSRV$K_AR_ADD EQ 1+TSRV$K_AR_START
                                     0770   729 
                                     0770   730 	CASE	4(AP), -
                                     0770   731 		LIMIT=#TSRV$K_AR_START, -
                                     0770   732 		TYPE=B, -
                                     0770   733 		<TMSCP$START,-		; Startup
                                     0770   734 		 TMSCP$ADD>		; Add a unit
               01'  01   04 AC   8F  0770       	CASEB	4(AP),#TSRV$K_AR_START,S^#<<30003$-30002$>/2>-1
                                     0775       30002$:
                               0008' 0775       	.SIGNED_WORD	TMSCP$START-30002$
                               00D5' 0777       	.SIGNED_WORD	TMSCP$ADD-30002$
                                     0779       30003$:
                                     0779   735 
                       50   14   3C  0779   736 	MOVZWL	#SS$_BADPARAM, R0	; Command out of range
                                 05  077C   737 	RSB				; Leave
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  18
X-2A6A1                         - START  -  Initialization Routine       27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (10)

                                     077D   740 	.SBTTL	-	START  -  Initialization Routine
                                     077D   741 
                                     077D   742 ;+
                                     077D   743 ; Functional Description:
                                     077D   744 ; 
                                     077D   745 ; Evaluate all values specified in the SYSGEN command used to 
                                     077D   746 ; invoke the server. Examine the values for validity,  and store them 
                                     077D   747 ; away in the TSRV for future use. Initiate a connection to the port 
                                     077D   748 ; driver, and establish ourselves as a listener.
                                     077D   749 ;
                                     077D   750 ; This routine is called from the stand-alone configure process (STACONFIG) 
                                     077D   751 ; at IPL 0. All registers used in this routine are preserved except for R0.
                                     077D   752 ;
                                     077D   753 ; Inputs:
                                     077D   754 ;
                                     077D   755 ;	None
                                     077D   756 ;
                                     077D   757 ; Outputs:
                                     077D   758 ;
                                     077D   759 ;	R0  =	status code
                                     077D   760 ;-
                                     077D   761 
                                     077D   762 TMSCP$START::
                 06 EB AF   00   E1  077D   763 	BBC	# TMSCP$V_DBG_START, -	; Not debugging - branch.
                                     0782   764 		TMSCP$L_DEBUG_FLAGS, 0$
                   00000000'GF   16  0782   765 	JSB	G^INI$BRK
                                     0788   766 
                                     0788   767 0$:
                                     0788   768 
                                     0788   769 	.IF DEFINED DEBUG$PC_HISTORY
                                     0788   770 ;
                                     0788   771 ; Do any initialization needed for tracing a history of the PC as
                                     0788   772 ; the server code is executed.
                                     0788   773 ;
                                     0788   774 	TSTL	TMSCP$PCHISTBEG			; PC history buffer initialized?
                                     0788   775 	BNEQ	1$				; Yes - branch.
                                     0788   776 	MOVAL	TMSCP$PCHISTBUF,TMSCP$PCHISTBEG	; Initialize the table address
                                     0788   777 	MOVAL	TMSCP$PCHISTBUF,TMSCP$PCHISTCUR	; Start current at the table start
                                     0788   778 	MOVAL	TMSCP$PCTBLEND, TMSCP$PCHISTEND	; Address of the end of the table
                                     0788   779 	CLRL	TMSCP$PCHISTFUL			; Clear the counter to start
                                     0788   780 
                                     0788   781 1$:
                                     0788   782 	BSBW	TMSCP$PCHIST			; Log the initialization.
                                     0788   783 	.ENDC  ;DEBUG$PC_HISTORY
                                     0788   784 
                            26   BB  0788   785 	PUSHR	#^M<R1,R2,R5>		; Save the registers to be used
              55   00000000'GF   D0  078A   786 	MOVL	G^SCS$GL_TMSCP,R5	; Get the address of the TSRV structure
                            3F   BB  0791   787 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                  00   6E   00   2C  0793   788 	MOVC5	#0,(SP),#0,-		; Initialize entire structure in
               08 A5   0764 8F       0797   789 		#TSRV$K_LENGTH-TSRV$W_SIZE, -	;  in one fell swoop. 
                                     079C   790 		TSRV$W_SIZE(R5)		; Don't initialize first 2 longwords
                            3F   BA  079C   791 	POPR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                                     079E   792 
                                     079E   793 ; 
                                     079E   794 ; Initialize size, type, and subtype.
                                     079E   795 ;
                       076C 8F   B0  079E   796 	MOVW	#TSRV$K_LENGTH,-	; Save the length of the structure
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  19
X-2A6A1                         - START  -  Initialization Routine       27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (10)

                         08 A5       07A2   797 		TSRV$W_SIZE(R5)		;  in the size field
                         73 8F   90  07A4   798 	MOVB	#DYN$C_TSRV,-		; This structure belongs
                         0A A5       07A7   799 		TSRV$B_TYPE(R5)		;  to the tape server.
                            01   90  07A9   800 	MOVB	#DYN$C_TSRV_TSRV,-	; The substructure is
                         0B A5       07AB   801 		TSRV$B_SUBTYPE(R5)	;  a TSRV.
                                     07AD   802 
                                     07AD   803 ;
                                     07AD   804 ; Initialize the list heads in the TSRV.
                                     07AD   805 ;
                         60 A5   DE  07AD   806 	MOVAL	TSRV$L_HQB_FL(R5),-	; Initialize the forward and
                         60 A5       07B0   807 		TSRV$L_HQB_FL(R5)	;  backward pointers to point to
                         60 A5   DE  07B2   808 	MOVAL	TSRV$L_HQB_FL(R5),-	;  the HQB forward link
                         64 A5       07B5   809 		TSRV$L_HQB_BL(R5)	; 
                         68 A5   DE  07B7   810 	MOVAL	TSRV$L_UQB_FL(R5),-	; Initialize the forward and
                         68 A5       07BA   811 		TSRV$L_UQB_FL(R5)	;  backward pointers to point to
                         68 A5   DE  07BC   812 	MOVAL	TSRV$L_UQB_FL(R5),-	;  the HQB forward link
                         6C A5       07BF   813 		TSRV$L_UQB_BL(R5)	; 
                                     07C1   814 
                                     07C1   815 ;
                                     07C1   816 ; The TMSCP version is set to zero. Host class drivers must supply a 
                                     07C1   817 ; TMSCP version number when setting the controller characteristics. If
                                     07C1   818 ; a version of TMSCP is ever introduced that is incompatable with the 
                                     07C1   819 ; current version this number will be changed.
                                     07C1   820 ;  Set the multi-host controller flag. This notifies the class drivers
                                     07C1   821 ; on the remote systems to use the allocation class passed in the 
                                     07C1   822 ; attention message instead of using their local value.
                                     07C1   823 ;                                         
                            00   B0  07C1   824 	MOVW	#VERSION,-		; Set the server version number 
                         3C A5       07C3   825 		TSRV$W_VERSION(R5)	;  to return in Set Unit Char
                            04   B0  07C5   826 	MOVW	#MSCP$M_CF_MLTHS,-	; Identify ourself as a
                         3E A5       07C7   827 		TSRV$W_CFLAGS(R5)	;  multi host controller
                                     07C9   828 
                                     07C9   829 ;
                                     07C9   830 ; Uniquely identify this controller among all devices accessable via T/MSCP.
                                     07C9   831 ;
                   00000000'GF   7D  07C9   832 	MOVQ	G^SCS$GB_SYSTEMID,-	; Construct the controller ID using
                         44 A5       07CF   833 		TSRV$Q_CTRL_ID(R5)	;  the system ID for the first three
                            04   90  07D1   834 	MOVB	#MSCP$K_CM_EMULA,-	;  words, then use an emulator for
                         4A A5       07D3   835 		TSRV$Q_CTRL_ID+6(R5)	;  the controller model, and 
                            01   90  07D5   836 	MOVB	#MSCP$K_CL_CNTRL,-	;  define the device class as an
                         4B A5       07D7   837 		TSRV$Q_CTRL_ID+7(R5)	;  MSCP controller.
                       0AB5'CF   DE  07D9   838 	MOVAL	TMSCP$MV_SET_OFFLINE,-	; Set address of TMSCP$MV_SET_OFFLINE 
                   00000000'GF       07DD   839 		G^SCS$GL_TMSCP_MV	;  into cell for mount verification
                                     07E2   840 ;
                                     07E2   841 ; Establish a link with PORT_DRIVER
                                     07E2   842 ;
                                     07E2   843 	LOCK	LOCKNAME=SCS,-		; Lock SCS access
                                     07E2   844 		PRESERVE=NO, -		; Don't preserve R0
                                     07E2   845 		SAVIPL=-(SP)		; Save the current IPL.
                                     07E2       	.SAVE	LOCAL_BLOCK
                                     07E2       	.PSECT	$ABS$,ABS
                                 000007E2       	.RESTORE
                       7E   12   DB  07E2       	 MFPR	S^#PR$_IPL,-(SP)
                0B 00000000'GF   E9  07E5       	BLBC	G^SMP$GL_FLAGS,30006$
                       50   34   9A  07EC       	 MOVZBL	S^#SPL$C_SCS,R0
                   00000000'GF   16  07EF       	 JSB	G^SMP$ACQUIRE
                            03   11  07F5       	BRB	30007$
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  20
X-2A6A1                         - START  -  Initialization Routine       27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (10)

                                     07F7       30006$:
                       12   08   DA  07F7       		MTPR	S^#IPL$_SCS,S^#PR$_IPL
                                     07FA       30007$:
                                     07FA   846 	LISTEN	MSGADR=W^TMSCP$LISTEN,-	; Forwarding address
                                     07FA   847 		ERRADR=W^20$,-		; If an error occurs during the listen
                                     07FA   848 		LPRNAM=W^TMSCP$SERV_NAME,-
                                     07FA   849 		PRINFO=W^TMSCP$SERV_INFO
                         13'AF   9F  07FA       		PUSHAB	B^30011$
                       223C'CF   9F  07FD       		PUSHAB	W^TMSCP$SERV_INFO
                       223C'CF   9F  0801       		PUSHAB	W^TMSCP$SERV_NAME
                       082C'CF   9F  0805       		PUSHAB	W^20$
                       0B16'CF   9F  0809       		PUSHAB	W^TMSCP$LISTEN
                   00000000'GF   17  080D       		JMP	G^SCS$LISTEN
                                     0813       30011$:
                                     0813   850 	UNLOCK	LOCKNAME=SCS,-		; Release SCS access
                                     0813   851 		PRESERVE=NO,-		; Don't preserve R0,
                                     0813   852 		NEWIPL=(SP)+,-		;  lower the IPL and
                                     0813   853 		CONDITION=RESTORE	;  restore spinlock to previous state
                09 00000000'GF   E9  0813       	BLBC	G^SMP$GL_FLAGS,30014$
                       50   34   9A  081A       	 MOVZBL	S^#SPL$C_SCS,R0
                   00000000'GF   16  081D       	 JSB	G^SMP$RESTORE
                                     0823       30014$:
                       12   8E   DA  0823       	 MTPR	(SP)+,S^#PR$_IPL
                       50   01   D0  0826   854 	MOVL	#SS$_NORMAL,R0		; Set success
                                     0829   855 	.IF DEFINED DEBUG$LOG
                                     0829   856 	BSBW	TMSCP$CREATE_LOG	; Allocate T/MSCP packet logging buffer.
                                     0829   857 	.ENDC	; DEBUG$LOG
                                     0829   858 
                                     0829   859 10$:
                            26   BA  0829   860 	POPR	#^M<R1,R2,R5>		; Restore the registers 
                                 05  082B   861 	RSB				; Return to caller
                                     082C   862 
                                     082C   863 ;
                                     082C   864 ; If an error occurs during the listen macro, control will be passed here.
                                     082C   865 ; the connection is simply disconnected (no reason given) and control is
                                     082C   866 ; returned to caller.
                                     082C   867 ;
                                     082C   868 
                                     082C   869 20$:
                                     082C   870 	.IF	DEFINED DEBUG$PC_HISTORY
                                     082C   871 	BSBW	TMSCP$PCHIST		; Log the PC for debugging.
                                     082C   872 	.ENDC  ;DEBUG$PC_HISTORY
                                     082C   873 	DISCONNECT #1			; Do a disconnect
                       50   01   D0  082C       		MOVL	#1, R0
                   00000000'GF   16  082F       		JSB	G^SCS$DISCONNECT
                                     0835   874 	UNLOCK	LOCKNAME=SCS,-		; Release SCS access
                                     0835   875 		PRESERVE=NO,-		; Don't preserve R0,
                                     0835   876 		NEWIPL=(SP)+,-		;  lower the IPL and
                                     0835   877 		CONDITION=RESTORE	;  restore spinlock to previous state
                09 00000000'GF   E9  0835       	BLBC	G^SMP$GL_FLAGS,30020$
                       50   34   9A  083C       	 MOVZBL	S^#SPL$C_SCS,R0
                   00000000'GF   16  083F       	 JSB	G^SMP$RESTORE
                                     0845       30020$:
                       12   8E   DA  0845       	 MTPR	(SP)+,S^#PR$_IPL
                            DF   11  0848   878 	BRB	10$
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  21
X-2A6A1                         - ADD - Add a Tape Unit                  27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (11)

                                     084A   881 	.SBTTL	-	ADD - Add a Tape Unit
                                     084A   882 
                                     084A   883 ;+
                                     084A   884 ; Functional Description:
                                     084A   885 ;
                                     084A   886 ; This routine is called from ADDUNIT when a SET DEV/SERVED command is 
                                     084A   887 ; executed. This routine is called, and executes while holding the 
                                     084A   888 ; SPL$C_SCS spinlock. An MSCP attention message is sent out to all 
                                     084A   889 ; known hosts to notify them of the availability of this tape.
                                     084A   890 ;
                                     084A   891 ;
                                     084A   892 ; Inputs:
                                     084A   893 ;
                                     084A   894 ;	AP -->	argument count
                                     084A   895 ;		action code (ADD)
                           00000008  084A   896 		UQB = 8	    		; UQB address
                                     084A   897 ;
                                     084A   898 ; Outputs:
                                     084A   899 ;
                                     084A   900 ;	R0  =  status code to be returned to the caller
                                     084A   901 ;	R3  =  Host Request Buffer address
                                     084A   902 ;-
                                     084A   903 
                                     084A   904 
                                     084A   905 TMSCP$ADD::
                                     084A   906 	.IF DEFINED DEBUG$PC_HISTORY
                                     084A   907 	BSBW	TMSCP$PCHIST		; Save this PC if we are keeping track
                                     084A   908 	.ENDC	   ;DEBUG$PC_HISTORY
                                     084A   909 
                                     084A   910 ;
                                     084A   911 ; If this routine is stalled and has to wait for resources while trying
                                     084A   912 ; to allocate a message buffer, we want to return to the caller to resume
                                     084A   913 ; working on something else. 
                                     084A   914 ; 
                            36   BB  084A   915 	PUSHR	#^M<R1,R2,R4,R5>	; Save all the registers before starting
                            03   10  084C   916 	BSBB	10$			; Treat this whole routine as a big
                            36   BA  084E   917 	POPR	#^M<R1,R2,R4,R5>	;  subroutine so that if this thread
                                 05  0850   918 	RSB				;  stalls the registers can be restored
                                     0851   919 
                                     0851   920 ;
                                     0851   921 ; Send out an attention message to every host we know, anouncing
                                     0851   922 ; the discovery of a new tape.
                                     0851   923 ;
                                     0851   924 
                                     0851   925 10$:
              55   00000000'GF   D0  0851   926 	MOVL	G^SCS$GL_TMSCP,R5	; Pick up the TSRV address
                       50   01   3C  0858   927 	MOVZWL	# SS$_NORMAL, R0	; No hosts found status.
                    51   60 A5   D0  085B   928 	MOVL	TSRV$L_HQB_FL(R5),R1	; Get the address of the first HQB
                       52   51   D0  085F   929 	MOVL	R1,R2			; and save it for checking.
                                     0862   930 
                                     0862   931 	ASSUME	HQB$L_FLINK EQ 0
                                     0862   932 
                                     0862   933 13$:
                       52   61   D1  0862   934 	CMPL	HQB$L_FLINK(R1),R2	; Check for an empty queue
                            01   12  0865   935 	BNEQ	19$			; Queue not empty, continue
                                     0867   936 
                                     0867   937 15$:
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  22
X-2A6A1                         - ADD - Add a Tape Unit                  27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (11)

                                 05  0867   938 	RSB				; No good hosts, return
                                     0868   939 
                                     0868   940 19$:
                         28 A1   D5  0868   941 	TSTL	HQB$L_CDT(R1)		; Check the HQB for a good CDT address
                            05   12  086B   942 	BNEQ	20$			;  Good CDT.
                       51   61   D0  086D   943 	MOVL	HQB$L_FLINK(R1),R1	;  No CDT... move on to the next host
                            F0   11  0870   944 	BRB	13$			;  and try again
                                     0872   945 
                                     0872   946 20$:
                          13D2   30  0872   947 	BSBW	TMSCP$ALLOCATE_HRB	; Allocate and set up an HRB
                                     0875   948 					; IRP included automatically
                         EF 50   E9  0875   949 	BLBC	R0,15$			; Return to the caller with the error
                    54   08 AC   D0  0878   950 	MOVL	UQB(AP),R4		; Get the UQB address
                    58 A3   54   D0  087C   951 	MOVL	R4,HRB$L_UQB(R3)	; Save this address
                         12 A4   B6  0880   952 	INCW	UQB$W_CURRENT(R4)	; Another request active on this unit
                                     0883   953 
                                     0883   954 ;
                                     0883   955 ; The attention message will actually be sent to all hosts that are linked
                                     0883   956 ; into the HQB queue in the TSRV. 
                                     0883   957 ;
                                     0883   958 
                                     0883   959 30$:
                    54 A3   51   D0  0883   960 	MOVL	R1,HRB$L_HQB(R3)	; Store the address of the HRB.
                    24 B1   63   0E  0887   961 	INSQUE	HRB$L_FLINK(R3), -	; Insert the HRB into tail of queue.
                                     088B   962 		@HQB$L_HRB_BL(R1)
                         1C A1   B6  088B   963 	INCW	HQB$W_NUM_QUE(R1)	; Bump host queue reference count
                         1C A1   B1  088E   964 	CMPW	HQB$W_NUM_QUE(R1),-	; Is this number <= max?
                         1E A1       0891   965 		HQB$W_MAX_QUE(R1)	; 
                            05   1B  0893   966 	BLEQU	40$			; Yes, skip
                         1C A1   B0  0895   967 	MOVW	HQB$W_NUM_QUE(R1),-	; No, set new max
                         1E A1       0898   968 		HQB$W_MAX_QUE(R1)	;
                                     089A   969 
                                     089A   970 40$:
                    55   1C A3   D0  089A   971 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Put the IRP address in R5
                    55   60 A5   DE  089E   972 	MOVAL	IRP$L_FQFL(R5),R5	; Move down to the CDRP portion
                    54   28 A1   D0  08A2   973 	MOVL	HQB$L_CDT(R1),R4	; Get the address of the CDT
                                     08A6   974 ;
                                     08A6   975 ; Initialize the CDRP
                                     08A6   976 ;
                    24 A5   54   D0  08A6   977 	MOVL	R4,CDRP$L_CDT(R5)	; Get the address of the CDT 
                    54   10 A4   D0  08AA   978 	MOVL	CDT$L_PDT(R4),R4	; Prepare the PDT address for SCS
                    5C A3   54   D0  08AE   979 	MOVL	R4,HRB$L_PDT(R3)	;  and also store it away for future use
                                     08B2   980 
                                     08B2   981 ;
                                     08B2   982 ; Allocate and send out the attention message. Set the state, in case
                                     08B2   983 ; the connection to the host is lost, and we need to clean up. This module
                                     08B2   984 ; is called like a subroutine to allow us an opportunity to clean up the
                                     08B2   985 ; registers that were pushed on the stack in the event of failure.
                                     08B2   986 ;
                            01   B0  08B2   987 	MOVW	#HRB$K_ST_MSG_WAIT,-	; Set the state of the request to
                         14 A3       08B4   988 		HRB$W_STATE(R3)		;  reflect possible stall 
                                     08B6   989 	ALLOC_MSG_BUF			; Allocate a message buffer
                         14 B4   16  08B6       		JSB	@PDT$L_ALLOCMSG(R4)
                            3F   BB  08B9   990 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                                     08BB   991 
                                     08BB   992 	ASSUME	MSCP$K_MXCMDLEN LE MSCP$K_LEN
                                     08BB   993 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  23
X-2A6A1                         - ADD - Add a Tape Unit                  27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (11)

                  00   6E   00   2C  08BB   994 	MOVC5	#0,(SP),#0,-		; Initialize entire structure in
                       62   32       08BF   995 		#MSCP$K_LEN,(R2)	;  in one fell swoop. 
                            3F   BA  08C1   996 	POPR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                       8000 8F   A8  08C3   997 	BISW	#HRB$M_STATE_INVALID,-	; The state of this request is "current"
                         14 A3       08C7   998 		HRB$W_STATE(R3)		;  leave the old state for diagnosis
                         4B 50   E9  08C9   999 	BLBC	R0, 60$			; If LBC connection is broken, skip host
                                     08CC  1000 
                                     08CC  1001 ;
                                     08CC  1002 ; The address of the allocated message buffer is returned in R2.
                                     08CC  1003 ; Initialize the proper fields to turn the message buffer into an
                                     08CC  1004 ; attention message.
                                     08CC  1005 ;
                    18 A3   52   D0  08CC  1006 	MOVL	R2,HRB$L_MSGBUF(R3)	; Save the message buffer address
                         40 8F   90  08D0  1007 	MOVB	#MSCP$K_OP_AVATN,-	; Set the attn msg op-code
                         08 A2       08D3  1008 		MSCP$B_OPCODE(R2)	;  
                    54   58 A3   D0  08D5  1009 	MOVL	HRB$L_UQB(R3),R4	; Get the address of the UQB
                         5E A4   B0  08D9  1010 	MOVW	UQB$W_SLUN(R4),-	; Get the unit number
                         04 A2       08DC  1011 		MSCP$W_UNIT(R2)
                         18 A4   7D  08DE  1012 	MOVQ	UQB$Q_UNIT_ID(R4),-	; Copy unit identifier
                         14 A2       08E1  1013 		MSCP$Q_UNIT_ID(R2)	; 
                         16 A4   B0  08E3  1014 	MOVW	UQB$W_UNIT_FLAGS(R4),-	; Get the unit_flags
                         0E A2       08E6  1015 		MSCP$W_UNT_FLGS(R2)	; 
                    51   24 A4   D0  08E8  1016 	MOVL	UQB$L_UCB(R4),R1	; Get the UCB address
                       00A0 C1   D0  08EC  1017 	MOVL	UCB$L_MEDIA_ID(R1),-	;  then copy the media identifier
                         1C A2       08F0  1018 		MSCP$L_MEDIA_ID(R2)	;  from the UCB into the msg packet
                                     08F2  1019 
                                     08F2  1020 ;
                                     08F2  1021 ; Get the CDRP fields and the registers properly set up to send out the 
                                     08F2  1022 ; attention message to all interested hosts.
                                     08F2  1023 ;
                    55   1C A3   D0  08F2  1024 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the address of IRP for this 
                    55   60 A5   DE  08F6  1025 	MOVAL	IRP$L_FQFL(R5),R5	;  request and position at the CDRP
                         28 A5   D4  08FA  1026 	CLRL	CDRP$L_RWCPTR(R5)	; 
                         20 A5   D4  08FD  1027 	CLRL	CDRP$L_RSPID(R5)	; Clear since no response is expected
                    54   5C A3   D0  0900  1028 	MOVL	HRB$L_PDT(R3),R4	; Pick up the PDT address for SCS
                       51   32   D0  0904  1029 	MOVL	#MSCP$K_LEN,R1		; Size of the message to be sent
                         18 A3   D4  0907  1030 	CLRL	HRB$L_MSGBUF(R3)	; The message buffer is no longer ours
                                     090A  1031 
                                     090A  1032 	.IF DEFINED DEBUG$LOG
                                     090A  1033 
                                     090A  1034 	ASSUME TSRV$V_LOG_ENABLD  EQ  0
                                     090A  1035 
                                     090A  1036 	MOVL	G^SCS$GL_TMSCP,R0	; Get the TSRV address.
                                     090A  1037 	BLBC	TSRV$W_STATE(R0),50$	; Branch if logging is disabled.
                                     090A  1038 	BSBW	TMSCP$LOG_END_PKT	; Otherwise, log the attention message.
                                     090A  1039 
                                     090A  1040 50$:
                                     090A  1041 	.ENDC	; DEBUG$LOG
                                     090A  1042 
                            08   B0  090A  1043 	MOVW	#HRB$K_ST_SNDMS_WAIT,-	; Set the state for this request
                         14 A3       090C  1044 		HRB$W_STATE(R3)		;  before calling the SCS service
                                     090E  1045 	SEND_CNT_MSG_BUF		; Send it out
                         60 B4   16  090E       		JSB	@PDT$L_SNDCNTMSG(R4)
                       8000 8F   A8  0911  1046 	BISW	#HRB$M_STATE_INVALID,-	; The state of this request is "current"
                         14 A3       0915  1047 		HRB$W_STATE(R3)		;  leave the old state for diagnosis
                                     0917  1048 
                                     0917  1049 ;
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  24
X-2A6A1                         - ADD - Add a Tape Unit                  27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (11)

                                     0917  1050 ; Remove the HRB from the queue and loop to send the same attention 
                                     0917  1051 ; message to the next host. Continue sending out these messages until 
                                     0917  1052 ; all the hosts have been notified.
                                     0917  1053 ;
                                     0917  1054 
                                     0917  1055 	ASSUME	HRB$L_FLINK EQ 0
                                     0917  1056 
                                     0917  1057 60$:
                       53   63   0F  0917  1058 	REMQUE	HRB$L_FLINK(R3), R3	; Take the HRB out of the queue
                    55   54 A3   D0  091A  1059 	MOVL	HRB$L_HQB(R3),R5	; Restore the HQB address
                         1C A5   B7  091E  1060 	DECW	HQB$W_NUM_QUE(R5)	; Take care of the reference count
                            63   D4  0921  1061 	CLRL	HRB$L_FLINK(R3)		; Show this HRB as unhooked
                                     0923  1062 
                                     0923  1063 70$:
                       51   65   D0  0923  1064 	MOVL	HQB$L_FLINK(R5),R1	; Get the addr of the next HQB
                    55   32 A5   D0  0926  1065 	MOVL	HQB$L_TSRV(R5),R5	; Get the address of the TSRV structure
                    50   60 A5   DE  092A  1066 	MOVAL	TSRV$L_HQB_FL(R5),R0	; If the next HQB address does not 
                       51   50   D1  092E  1067 	CMPL	R0,R1			;  not match the queue header
                            0D   13  0931  1068 	BEQL	90$			;  then we have another host to notify
                         28 A1   D5  0933  1069 	TSTL	HQB$L_CDT(R1)		; Before sending out the message, check
                            05   12  0936  1070 	BNEQ	85$			;  for a valid CDT. If none, this host.
                       55   51   D0  0938  1071 	MOVL	R1,R5			;  Get the next one off the queue.
                            E6   11  093B  1072 	BRB	70$			;
                                     093D  1073 
                                     093D  1074 85$:
                          FF43   31  093D  1075 	BRW	30$			; This one is good, send the message
                                     0940  1076 
                                     0940  1077 ;
                                     0940  1078 ;		Final status is set by CLEANUP_HRB which places SS$_NORMAL in R0.
                                     0940  1079 ;
                                     0940  1080 
                                     0940  1081 90$:
                          139F   31  0940  1082 	BRW	TMSCP$CLEANUP_HRB	; We are finished with this request.
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  25
X-2A6A1                         - NEW_DEVICE - Serve a new DSA device un 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (12)

                                     0943  1085 	.SBTTL	-	NEW_DEVICE - Serve a new DSA device unit
                                     0943  1086 
                                     0943  1087 ;+
                                     0943  1088 ; Functional Description:
                                     0943  1089 ;
                                     0943  1090 ; This is an entry point provided for the tape class driver to call 
                                     0943  1091 ; directly with the address of a newly discovered UCB. This avoids the
                                     0943  1092 ; time delay that used to occur when the tape had to be discovered by
                                     0943  1093 ; the configure process. This change was originally conceived to solve
                                     0943  1094 ; a problem with mounting shadow set virtual units cluster wide, but
                                     0943  1095 ; has found universal benefit, and so now is used for all newly found
                                     0943  1096 ; DSA (tape class driver) devices.
                                     0943  1097 ;
                                     0943  1098 ;
                                     0943  1099 ; Inputs:
                                     0943  1100 ;
                                     0943  1101 ;	R5  =  UCB address of device to be served
                                     0943  1102 ;
                                     0943  1103 ; Outputs:
                                     0943  1104 ;
                                     0943  1105 ;	R0  =  status code to be returned to the caller
                                     0943  1106 ;		SS$_NORMAL 	- Unit Available attention messages have been sent
                                     0943  1107 ;		SS$_DEVACTIVE	- This device is already being served
                                     0943  1108 ;		SS$_DEVICEFULL	- There are already MAX_UNITS being served
                                     0943  1109 ;		SS$_DEVNOTDISM	- This device is not mounted for cluster access
                                     0943  1110 ;		SS$_INSFMEM	- Not enough memory to allocate HQB
                                     0943  1111 ;
                                     0943  1112 ;	R5  =  UCB address of device to be served
                                     0943  1113 ;-
                                     0943  1114 
                                     0943  1115 ; 
                                     0943  1116 ; This is a list of the premature end codes. 
                                     0943  1117 ;
                                     0943  1118 
                                     0943  1119 TMSCP$NOSERV::	
                                     0943  1120 TMSCP$NORMAL::
                       50   01   D0  0943  1121 	MOVL	#SS$_NORMAL,R0		; They already have what they want
                                     0946  1122 
                                     0946  1123 TMSCP$RESTOR::
                       101E 8F   BA  0946  1124 	POPR	#^M<R1,R2,R3,R4,AP>	; Restore all the registers used 
                                 05  094A  1125 	RSB				;  and return to the caller
                                     094B  1126 
                                     094B  1127 TMSCP$NEW_DEVICE::
                                     094B  1128 	.IF	DEFINED DEBUG$PC_HISTORY
                                     094B  1129 	BSBW	TMSCP$PCHIST		; Log the PC for debugging.
                                     094B  1130 	.ENDC  ;DEBUG$PC_HISTORY
                       101E 8F   BB  094B  1131 	PUSHR	#^M<R1,R2,R3,R4,AP>	; Save all the registers before starting
                                     094F  1132 
                                     094F  1133 ;
                                     094F  1134 ; If auto-serving is not turned on, we know this device should not be served. 
                                     094F  1135 ; Control can be returned to caller with no further action. Otherwise, the 
                                     094F  1136 ; device  information needs to be checked to make sure it complies with the 
                                     094F  1137 ; serving guidelines.
                                     094F  1138 ;
                                     094F  1139 
                    4C A5   02   91  094F  1140 	CMPB	#DC$_TAPE, -		; Make sure this device is a tape
                                     0953  1141 		UCB$B_DEVCLASS(R5)	;  before we go any farther
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  26
X-2A6A1                         - NEW_DEVICE - Serve a new DSA device un 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (12)

                            EE   12  0953  1142 	BNEQ	TMSCP$NORMAL		; Not a tape, get out now!
                    54   2C A5   D0  0955  1143 	MOVL	UCB$L_DDB(R5),R4	; Get the DDB address
                   00000000'GF   D1  0959  1144 	CMPL	G^CLU$GL_TAPE_ALLOCLS,-	; Compare allocation class of host
                         3C A4       095F  1145 		DDB$L_ALLOCLS(R4)	;  with allocation class of device
                            E0   12  0961  1146 	BNEQ	TMSCP$NOSERV		; Must be the same (for now at least)
                            07   E0  0963  1147 	BBS	#DEV$V_SRV,-		; If the device is already
                         40 A5       0965  1148 		UCB$L_DEVCHAR2(R5),-	;  served,
                            DB       0967  1149 		TMSCP$NOSERV		;  don't serve it again
                                     0968  1150 
                                     0968  1151 ;
                                     0968  1152 ; Now we are dealing with a valid device for serving. Check for a local 
                                     0968  1153 ; connection that the allocation class is properly set.
                                     0968  1154 ; 
                            05   E1  0968  1155 	BBC	#DEV$V_MSCP,-		; If not a MSCP tape, this device is
                      34 40 A5       096A  1156 		UCB$L_DEVCHAR2(R5),10$	;  ok to serve due to non-zero serve_all
                            03   E0  096D  1157 	BBS	#DEV$V_CDP,-		; If the class driver created this UCB
                         40 A5       096F  1158 		UCB$L_DEVCHAR2(R5),-	;  for temporary use, this is not a real
                            D1       0971  1159 		TMSCP$NOSERV		;  device and should not be served.
                  50   00D8 C5   D0  0972  1160 	MOVL	UCB$L_CDDB(R5),R0	; Get a pointer to the CDDB
                            CA   13  0977  1161 	BEQL	TMSCP$NOSERV		; If this is a "temp" UCB don't serve
                   00000000'GF   D5  0979  1162 	TSTL	G^CLU$GL_TAPE_ALLOCLS	; If the allocation class of this
                            08   12  097F  1163 	BNEQ	7$			;  node is zero,
                                     0981  1164 
                                     0981  1165 5$:
                            02   E1  0981  1166 	BBC	#MSCP$V_CF_MLTHS,-	; or the controller for this device
                      03 28 A0       0983  1167 		CDDB$W_CNTRLFLGS(R0),7$	;  is an HSC, don't serve it.
                                     0986  1168 
                                     0986  1169 6$:
                          FFBA   31  0986  1170 	BRW	TMSCP$NOSERV		; Provide a place to reach exit
                                     0989  1171 
                                     0989  1172 7$:
                            04   91  0989  1173 	CMPB	#MSCP$K_CM_EMULA,-	; Otherwise,
                         26 A0       098B  1174 		CDDB$B_CNTRLMDL(R0)	; If this is not a served path
                            12   12  098D  1175 	BNEQ	10$			; Serve the device       
                                     098F  1176 
                            04   E1  098F  1177 	BBC	#DEV$V_2P,-		; Check to make sure this is a 
                      F2 40 A5       0991  1178 		UCB$L_DEVCHAR2(R5),6$	;  dual path device
                  50   00DC C5   D0  0994  1179 	MOVL	UCB$L_2P_CDDB(R5),R0	; Get a pointer to the CDDB
                            EB   13  0999  1180 	BEQL	6$			; Give up if there is no alternate
                            04   91  099B  1181 	CMPB	#MSCP$K_CM_EMULA,-	; Check to see if the alternate path
                         26 A0       099D  1182 		CDDB$B_CNTRLMDL(R0)	;  is to a server also
                            E5   13  099F  1183 	BEQL	6$			; This is a server path too give up 
                                     09A1  1184 
                                     09A1  1185 10$:
              54   00000000'GF   D0  09A1  1186 	MOVL	G^SCS$GL_TMSCP,R4	;  and the address of the TSRV 
                            53   D4  09A8  1187 	CLRL	R3			; Init this reg for table index later
                    50   5E A4   3C  09AA  1188 	MOVZWL	TSRV$W_NUM_UNIT(R4),R0	; Get the number of units
              00000100 8F   50   D1  09AE  1189 	CMPL	R0,#MAX_UNITS		;  and see if we are over the max
                            1A   14  09B5  1190 	BGTR	TMSCP$FULL		;  if we are, return an error
                                     09B7  1191 
                            13   E1  09B7  1192 	BBC	#DEV$V_MNT,-		; If the tape is not mounted yet,
                      02 3C A5       09B9  1193 		UCB$L_DEVCHAR(R5),20$	;  we can begin serving it
                            1D   11  09BC  1194 	BRB	TMSCP$NOTSHR		; Can't serve an allocated device.
                                     09BE  1195 
                                     09BE  1196 ;
                                     09BE  1197 ; Search through the UQB queue to make sure that a UQB for this unit does 
                                     09BE  1198 ; not already exist. If none is found, memory is allocated, the UQB is 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  27
X-2A6A1                         - NEW_DEVICE - Serve a new DSA device un 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (12)

                                     09BE  1199 ; filled in, and linked into the UQB list in proper order by ascending 
                                     09BE  1200 ; unit number.
                                     09BE  1201 ;
                                     09BE  1202 
                                     09BE  1203 20$:
                51   00C4 C443   D0  09BE  1204 	MOVL	TSRV$L_UNITS(R4)[R3],R1	; Get UQB address from the table
                            27   13  09C4  1205 	BEQL	TMSCP$CREATE_UQB	; If this is the end, create one
                            53   D6  09C6  1206 	INCL	R3			; Add one to the index
                    55   24 A1   D1  09C8  1207 	CMPL	UQB$L_UCB(R1),R5	; See if the UCB for this unit matches
                            F0   12  09CC  1208 	BNEQ	20$			; No match, keep looking
                          FF72   31  09CE  1209 	BRW	TMSCP$NORMAL		; They already have what they want
                                     09D1  1210 
                                     09D1  1211 TMSCP$FULL::
              50   00000850 8F   D0  09D1  1212 	MOVL	#SS$_DEVICEFULL,R0	; There are already MSX_UNITS
                          FF6B   31  09D8  1213 	BRW	TMSCP$RESTOR		;  being served
                                     09DB  1214 
                                     09DB  1215 TMSCP$NOTSHR::
              50   000021B4 8F   D0  09DB  1216 	MOVL	#SS$_DEVNOTDISM,R0	; This device is not mounted for 
                          FF61   31  09E2  1217 	BRW	TMSCP$RESTOR		;  cluster wide access
                                     09E5  1218 
                                     09E5  1219 TMSCP$NOMEM::
                  50   0124 8F   3C  09E5  1220 	MOVZWL	#SS$_INSFMEM,R0		; Not enough memory to allocate
                          FF59   31  09EA  1221 	BRW	TMSCP$RESTOR		;  a decent UQB
                                     09ED  1222 
                                     09ED  1223 ;
                                     09ED  1224 ; There is no UQB for a device with this unit number.
                                     09ED  1225 ;
                                     09ED  1226 
                                     09ED  1227 TMSCP$CREATE_UQB::
                                     09ED  1228 	.IF	DEFINED DEBUG$PC_HISTORY
                                     09ED  1229 	BSBW	TMSCP$PCHIST		; Log the PC for debugging.
                                     09ED  1230 	.ENDC  ;DEBUG$PC_HISTORY
                  51   00CA 8F   3C  09ED  1231 	MOVZWL	#UQB$K_LENGTH,R1	; Set size of the UQB structure
                   00000000'GF   16  09F2  1232 	JSB	G^EXE$ALONONPAGED	; Grab some pool
                         EA 50   E9  09F8  1233 	BLBC	R0,TMSCP$NOMEM		; If there was insf memory for alloc
                                     09FB  1234 
                            3F   BB  09FB  1235 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                  00   6E   00   2C  09FD  1236 	MOVC5	#0,(SP),#0,-		; Initialize entire structure in
                  62   00CA 8F       0A01  1237 		#UQB$K_LENGTH,(R2)	;  in one fell swoop. 
                            3F   BA  0A05  1238 	POPR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                                     0A07  1239 ;
                                     0A07  1240 ; Make the allocated memory look like a UQB. R2 points to the allocated region
                                     0A07  1241 ;
                                 C8  0A07  1242 	BISL	#<DEV$M_CLU!-		; Set the 'Avail Cluster wide' bit
                                     0A08  1243 		DEV$M_SRV>,-		;  and 'MSCP SERVER' bits
           40 A5   00000081 8F       0A08  1244 		UCB$L_DEVCHAR2(R5)
                    08 A2   51   B0  0A0F  1245 	MOVW	R1,UQB$W_SIZE(R2)	; Set the size
                    24 A2   55   D0  0A13  1246 	MOVL	R5,UQB$L_UCB(R2)	; Save away the UCB address
                         73 8F   90  0A17  1247 	MOVB	#DYN$C_TSRV,-		; This is the tape based server
                         0A A2       0A1A  1248 		UQB$B_TYPE(R2)		;  data structure
                            04   90  0A1C  1249 	MOVB	#DYN$C_TSRV_UQB,-	; More specifically, it is a 
                         0B A2       0A1E  1250 		UQB$B_SUBTYPE(R2)	;  Unit Queue Block structure
                            04   B0  0A20  1251 	MOVW	#UQB$K_ST_AVAILABLE,-	; Set the initial state of this
                         0C A2       0A22  1252 		UQB$W_STATE(R2)		;  unit to available
                         68 A5   B0  0A24  1253 	MOVW	UCB$W_UNIT(R5),-	; Get the "real" unit number
                         1C A2       0A27  1254 		UQB$W_UNIT(R2)		;  (the one off the plug)
                                     0A29  1255 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  28
X-2A6A1                         - NEW_DEVICE - Serve a new DSA device un 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (12)

                    50   2C A5   D0  0A29  1256 	MOVL	UCB$L_DDB(R5),R0	; Get the device data block
                         3C A0   D0  0A2D  1257 	MOVL	DDB$L_ALLOCLS(R0),-	; Move the allocation class into
                         18 A2       0A30  1258 		UQB$L_ALLOCLS(R2)	;  the unit ID field
                         5E A4   B0  0A32  1259 	MOVW	TSRV$W_NUM_UNIT(R4),-	; Then assign the local unit
                         5E A2       0A35  1260 		UQB$W_SLUN(R2)		;  number (unit table index)
                       4000 8F   A8  0A37  1261 	BISW	#MSCP$M_SLUN,-		; Set the bit in the unit number
                         5E A2       0A3B  1262 		UQB$W_SLUN(R2)		;  indicating a server local unit
                         5E A4   B6  0A3D  1263 	INCW	TSRV$W_NUM_UNIT(R4)	; Ratchet the number of known units
                    51   15 A0   9A  0A40  1264 	MOVZBL	DDB$T_NAME+1(R0),R1	; Put the first letter in a reg
                    51   40 8F   82  0A44  1265 	SUBB2	#^X40,R1		;  and normalize it 
                            51   F0  0A48  1266 	INSV	R1,-			; Add to those the first letter of 
                                     0A4A  1267 		#UQB$V_D0,-		;  the device name
                       05   0A       0A4A  1268 		#UQB$S_D0,-		; 
                         1E A2       0A4C  1269 		UQB$W_DEVNAME(R2)	; 
                    51   16 A0   9A  0A4E  1270 	MOVZBL	DDB$T_NAME+2(R0),R1	; Put the second character in a reg
                    51   40 8F   82  0A52  1271 	SUBB2	#^X40,R1		;  and normalize it
                            51   F0  0A56  1272 	INSV	R1,-			; Get the second letter
                                     0A58  1273 		#UQB$V_D1,-		;  of the device name
                       05   05       0A58  1274 		#UQB$S_D1,-		;  and save that also
                         1E A2       0A5A  1275 		UQB$W_DEVNAME(R2)	; 
                    51   17 A0   9A  0A5C  1276 	MOVZBL	DDB$T_NAME+3(R0),R1	; Put the controller letter in a reg
                    51   40 8F   82  0A60  1277  	SUBB2	#^X40,R1		;  and normalize that before saving
                            51   F0  0A64  1278 	INSV	R1,-			; Retrieve the controller letter
                                     0A66  1279 		#UQB$V_C,-		;  and save that away as the
                       05   00       0A66  1280        		#UQB$S_C,-		;  last of the device name
                         1E A2       0A68  1281 		UQB$W_DEVNAME(R2)	;  to be saved
                                     0A6A  1282 
                                     0A6A  1283 ;
                                     0A6A  1284 ; For the unique multi unit code, use the server local unit number as the 
                                     0A6A  1285 ; spindle specifier in the high byte, and set the low byte (access path) 
                                     0A6A  1286 ; to zero.
                                     0A6A  1287 ;
                    50   5E A2   3C  0A6A  1288 	MOVZWL	UQB$W_SLUN(R2),R0	; Get the "local" unit number
              50   0000C000 8F   CA  0A6E  1289 	BICL	#<MSCP$M_SHADOW!-	; Clear out the shadow bit
                                     0A75  1290 		MSCP$M_SLUN>,R0		;  and the SLUN bit before range checking
                00C4 C440   52   D0  0A75  1291 	MOVL	R2,TSRV$L_UNITS(R4)[R0]	; Save the UQB address in the table
                  50   50   08   78  0A7B  1292 	ASHL	#8,R0,R0		; Shift it into the high byte
                    14 A2   50   B0  0A7F  1293 	MOVW	R0,UQB$W_MULT_UNIT(R2)	; Save it away in the UQB
                       00FA C5   B0  0A83  1294 	MOVW	UCB$W_UNIT_FLAGS(R5),-	; Use the unit flags from the UCB 
                         16 A2       0A87  1295 		UQB$W_UNIT_FLAGS(R2)	;  just as they are in the UQB
                            19   E1  0A89  1296 	BBC	#DEV$V_SWL,-		; Check the device characteristics
                      06 3C A5       0A8B  1297 		UCB$L_DEVCHAR(R5),60$	;  for software writelock
                       2000 8F   A8  0A8E  1298 	BISW	#MSCP$M_UF_WRTPH,-	; If it is, set the hw flag 
                         16 A2       0A92  1299 		UQB$W_UNIT_FLAGS(R2)	;  so we don't issue writes to it
                                     0A94  1300 
                                     0A94  1301 ;
                                     0A94  1302 ; Set the queue header counters and list heads to their initial values.
                                     0A94  1303 ;
                                     0A94  1304 
                                     0A94  1305 60$:
                         2C A2   DE  0A94  1306 	MOVAL	UQB$L_BLOCKED_FL(R2),-	; Initialize the forward and 
                         2C A2       0A97  1307 		UQB$L_BLOCKED_FL(R2)	; 
                         2C A2   DE  0A99  1308 	MOVAL	UQB$L_BLOCKED_FL(R2),-	;  backward pointers to point to
                         30 A2       0A9C  1309 		UQB$L_BLOCKED_BL(R2)	;  the forward link of the blocked que
                    6C B4   62   0E  0A9E  1310 	INSQUE	UQB$L_FLINK(R2), -	; Insert the UQB into the queue
                                     0AA2  1311 		@TSRV$L_UQB_BL(R4)
                                     0AA2  1312 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  29
X-2A6A1                         - NEW_DEVICE - Serve a new DSA device un 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (12)

                                     0AA2  1313 ;
                                     0AA2  1314 ; Go off to MSCP to ADD a tape unit. When the ADDUNIT routine is eliminated,
                                     0AA2  1315 ; change this call format to use a simple JSB and leave the stack alone. 
                                     0AA2  1316 ;
                            52   DD  0AA2  1317 	PUSHL	R2			; Copy UQB pointer
                            02   DD  0AA4  1318 	PUSHL	#TSRV$K_AR_ADD		; Opcode for MSCP action routines
                            02   DD  0AA6  1319 	PUSHL	#2			; Only 2 parameters
                       5C   5E   D0  0AA8  1320 	MOVL	SP,AP			; Set address of parameter area
                       FD9B CF   16  0AAB  1321 	JSB	TMSCP$ADD		; Go to the routine
                       5E   0C   C0  0AAF  1322 	ADDL	#12,SP			; Clean up the stack before returning
                          FE8E   31  0AB2  1323 	BRW	TMSCP$NORMAL		; Return a successful status
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  30
X-2A6A1                         - MV_SET_OFFLINE - Mount Verification se 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (13)

                                     0AB5  1326 	.SBTTL	-	MV_SET_OFFLINE - Mount Verification set a device to the "offline" state.
                                     0AB5  1327 
                                     0AB5  1328 ;+
                                     0AB5  1329 ; Functional Description:
                                     0AB5  1330 ;
                                     0AB5  1331 ; This routine is JSB'd to from a mount verification thread. 
                                     0AB5  1332 ; The UCB of a particular tape is passed to this routine in
                                     0AB5  1333 ; R5. The corresponding UQB for this device is found, the
                                     0AB5  1334 ; field UQB$L_ONLINE_HQB is cleared, and the state is changed to
                                     0AB5  1335 ; "AVAILABLE".
                                     0AB5  1336 ;
                                     0AB5  1337 ;
                                     0AB5  1338 ; Inputs:
                                     0AB5  1339 ;
                                     0AB5  1340 ;	R5  =  UCB address
                                     0AB5  1341 ;
                                     0AB5  1342 ; Outputs:
                                     0AB5  1343 ;
                                     0AB5  1344 ;	None - all registers preserved
                                     0AB5  1345 ;-
                                     0AB5  1346 
                                     0AB5  1347 TMSCP$MV_SET_OFFLINE::
                            17   BB  0AB5  1348 	PUSHR	#^M<R0,R1,R2,R4>	; Save all the registers before starting
                                     0AB7  1349 	LOCK	LOCKNAME=SCS,-		; Lock SCS access
                                     0AB7  1350 		PRESERVE=NO,-		;  no need to preserve R0
                                     0AB7  1351 		SAVIPL=-(SP)		;  save the current IPL
                       7E   12   DB  0AB7       	 MFPR	S^#PR$_IPL,-(SP)
                0B 00000000'GF   E9  0ABA       	BLBC	G^SMP$GL_FLAGS,30026$
                       50   34   9A  0AC1       	 MOVZBL	S^#SPL$C_SCS,R0
                   00000000'GF   16  0AC4       	 JSB	G^SMP$ACQUIRE
                            03   11  0ACA       	BRB	30027$
                                     0ACC       30026$:
                       12   08   DA  0ACC       		MTPR	S^#IPL$_SCS,S^#PR$_IPL
                                     0ACF       30027$:
                                     0ACF  1352 	.IF	DEFINED DEBUG$PC_HISTORY
                                     0ACF  1353 	BSBW	TMSCP$PCHIST		; Log the PC for debugging.
                                     0ACF  1354 	.ENDC  ;DEBUG$PC_HISTORY
              51   00000000'GF   D0  0ACF  1355 	MOVL	G^SCS$GL_TMSCP,R1	; Get the address of the server
                    54   68 A1   DE  0AD6  1356 	MOVAL	TSRV$L_UQB_FL(R1),R4	; Get the queue list head address
                       52   54   D0  0ADA  1357 	MOVL	R4,R2			;  and save it to verify the whole
                                     0ADD  1358 
                                     0ADD  1359 	ASSUME	UQB$L_FLINK EQ 0
                                     0ADD  1360 
                                     0ADD  1361 10$:
                       54   64   D0  0ADD  1362 	MOVL	UQB$L_FLINK(R4),R4	;  queue has been searched
                       52   54   D1  0AE0  1363 	CMPL	R4,R2			; End of UQB list?
                            1B   13  0AE3  1364 	BEQL	60$			; If eql yes
                    55   24 A4   D1  0AE5  1365 	CMPL	UQB$L_UCB(R4),R5	; Is this the UQB for this unit?
                            F2   12  0AE9  1366 	BNEQ	10$			; If neq no
                                     0AEB  1367 
                                     0AEB  1368 ;
                                     0AEB  1369 ; A UQB was found that corresponds to the UCB address passed.
                                     0AEB  1370 ; The HQB field that represented the host that held 
                                     0AEB  1371 ; the tape online is cleared. The UCB online count is sanity tested.
                                     0AEB  1372 ;
                                     0AEB  1373 
                            04   B0  0AEB  1374 	MOVW	#UQB$K_ST_AVAILABLE,-	; Now set the state of this device to
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  31
X-2A6A1                         - MV_SET_OFFLINE - Mount Verification se 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (13)

                         0C A4       0AED  1375 		UQB$W_STATE(R4)		;   offline.
                         70 A4   D4  0AEF  1376 	CLRL	UQB$L_ONLINE_HQB(R4)	; Not online to any host now.
                       00C2 C5   97  0AF2  1377 	DECB	UCB$B_ONLCNT(R5)	;  and note the change in online count
                       00C2 C5   95  0AF6  1378 	TSTB	UCB$B_ONLCNT(R5)	; Online count should be zero
                            04   13  0AFA  1379 	BEQL	60$			;
                                     0AFC  1380 
                                     0AFC  1381 	BUG_CHECK MSCPSERV, FATAL	; Online count was not "1" when we entered
                               FEFF  0AFC       		.WORD	^XFEFF
                               0004' 0AFE       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_MSCPSERV!4
                                     0B00  1382 					;  this routine.
                                     0B00  1383 
                                     0B00  1384 60$:
                                     0B00  1385 	UNLOCK	LOCKNAME=SCS,-		; Release SCS access
                                     0B00  1386 		PRESERVE=NO,-		;  don't preserve R0
                                     0B00  1387 		NEWIPL=(SP)+,-		;  return to former IPL
                                     0B00  1388 		CONDITION=RESTORE	;  restore spinlock to previous state
                09 00000000'GF   E9  0B00       	BLBC	G^SMP$GL_FLAGS,30033$
                       50   34   9A  0B07       	 MOVZBL	S^#SPL$C_SCS,R0
                   00000000'GF   16  0B0A       	 JSB	G^SMP$RESTORE
                                     0B10       30033$:
                       12   8E   DA  0B10       	 MTPR	(SP)+,S^#PR$_IPL
                            17   BA  0B13  1389 	POPR	#^M<R0,R1,R2,R4>	; Restore all the registers 
                                 05  0B15  1390 	RSB				; And resume mount verification
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  32
X-2A6A1                         - LISTEN - Listen for a Connect Request  27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (14)

                                     0B16  1393 	.SBTTL	-	LISTEN - Listen for a Connect Request
                                     0B16  1394 
                                     0B16  1395 ;+
                                     0B16  1396 ; Functional Description:
                                     0B16  1397 ;
                                     0B16  1398 ; When another cluster member wants to connect with the server, control
                                     0B16  1399 ; is passed here as a fork process initiated by the port driver at IPL$_SCS.
                                     0B16  1400 ; Upon a successful acceptance, this routine allocates a host queue block 
                                     0B16  1401 ; and is then prepared to receive MSCP request packets from that host.
                                     0B16  1402 ;
                                     0B16  1403 ; The connection application itself is not treated as a true request. No 
                                     0B16  1404 ; HRB is created for it, and no context is saved. It is either accepted or 
                                     0B16  1405 ; rejected in this routine.
                                     0B16  1406 ;
                                     0B16  1407 ; Inputs:                                 
                                     0B16  1408 ;	R0  =  Scratch
                                     0B16  1409 ;	R1  =  Scratch
                                     0B16  1410 ;	R2  =  Connect message packet address
                                     0B16  1411 ;	R3  =  CDT
                                     0B16  1412 ;	R4  =  PDT
                                     0B16  1413 ;	R5  =  Scratch
                                     0B16  1414 ;
                                     0B16  1415 ; Outputs:
                                     0B16  1416 ;	None (the connection is either accepted or rejected)
                                     0B16  1417 ;
                                     0B16  1418 ; All registers are preserved.
                                     0B16  1419 ;-
                                     0B16  1420 
                                     0B16  1421 TMSCP$LISTEN::
                                     0B16  1422 	.IF DEFINED DEBUG$PC_HISTORY
                                     0B16  1423 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0B16  1424 	.ENDC	   ;DEBUG$PC_HISTORY
                                     0B16  1425 
                                     0B16  1426 ;
                                     0B16  1427 ; Allocate an HQB for this host.
                                     0B16  1428 ;
                                     0B16  1429 
                                     0B16  1430 10$:
                            52   DD  0B16  1431 	PUSHL	R2			; Save the connect message address
                       51   3E   3C  0B18  1432 	MOVZWL	#HQB$K_LENGTH,R1	; Get the size of the host queue block
                   00000000'GF   16  0B1B  1433 	JSB	G^EXE$ALONONPAGED	;  and allocate that much memory
                       55   52   D0  0B21  1434 	MOVL	R2,R5			; Get the HQB address in R5
                            52 8ED0  0B24  1435 	POPL	R2			; Pop the saved connect message address
                         03 50   E8  0B27  1436 	BLBS	R0,15$			; Continue if successful
                                     0B2A  1437 	.IF DEFINED DEBUG$REJECT_TRACKING
                                     0B2A  1438 	MOVL	G^ SCS$GL_TMSCP, R1	; Get TSRV address.
                                     0B2A  1439 	MOVL	R0,TSRV$L_REPLC_CNT+8(R1); Save away the error code
                                     0B2A  1440 	INCL	TSRV$L_REPLC_CNT+12(R1)	; Save away a record of the reject
                                     0B2A  1441 	.ENDC	   ;DEBUG$REJECT_TRACKING
                          00A1   31  0B2A  1442 	BRW	TMSCP$REJECT		; Reject this connection.
                                     0B2D  1443 
                                     0B2D  1444 ;
                                     0B2D  1445 ; Fill in as many fields as possible to initialize the HQB for use.
                                     0B2D  1446 ;
                                     0B2D  1447 
                                     0B2D  1448 15$:
                            3F   BB  0B2D  1449 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  33
X-2A6A1                         - LISTEN - Listen for a Connect Request  27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (14)

                  00   6E   00   2C  0B2F  1450 	MOVC5	#0,(SP),#0,-		; Initialize entire structure in
                       65   3E       0B33  1451 		#HQB$K_LENGTH,(R5)	;  in one fell swoop. 
                            3F   BA  0B35  1452 	POPR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                    08 A5   51   B0  0B37  1453 	MOVW	R1,HQB$W_SIZE(R5)	; Set length of the data structure
                         73 8F   90  0B3B  1454 	MOVB	#DYN$C_TSRV,-		; The structure type
                         0A A5       0B3E  1455 		HQB$B_TYPE(R5)		;  is tape server
                            02   90  0B40  1456 	MOVB	#DYN$C_TSRV_HQB,-	; The structure subtype
                         0B A5       0B42  1457 		HQB$B_SUBTYPE(R5)	;  is Host Queue Block
                                     0B44  1458 
                    50   20 A2   D0  0B44  1459 	MOVL	<SCS$B_CON_DAT-SCS$T_DST_PROC>(R2),R0	; Get the address of
                                     0B48  1460 					;  the data field
                            09   13  0B48  1461 	BEQL	25$			; Can't talk to V4.x class drivers - branch.
              322E3556 8F   50   D1  0B4A  1462 	CMPL	R0,#^A/V5.2/		; Does remote class driver support tape
                            03   13  0B51  1463 	BEQL	30$			; servers?  Yes - branch.
                                     0B53  1464 
                                     0B53  1465 25$:					; If not, we can't communicate.
                          006F   31  0B53  1466 	BRW	TMSCP$REJECT_REQUEST	; Kill this request.
                                     0B56  1467 
                                     0B56  1468 30$:
                            02   A8  0B56  1469 	BISW	#HQB$M_V5CL,-		; Tape servers supported, use SLUNS (V5).
                         12 A5       0B58  1470 		HQB$W_FLAGS(R5)		;  flag (let's save a flag in $HQBDEF.)
                         20 A5   DE  0B5A  1471 	MOVAL	HQB$L_HRB_FL(R5),-	; Initialize the list head for the
                         20 A5       0B5D  1472 		HQB$L_HRB_FL(R5)	;  Host Request Blocks that are
                         20 A5   DE  0B5F  1473 	MOVAL	HQB$L_HRB_FL(R5),-	;  currently being processed on 
                         24 A5       0B62  1474 		HQB$L_HRB_BL(R5)	;  behalf of this host
                    28 A5   53   D0  0B64  1475 	MOVL	R3,HQB$L_CDT(R5)	; Save away the CDT address
              51   00000000'GF   D0  0B68  1476 	MOVL	G^SCS$GL_TMSCP,R1	; Get the TSRV address
                    32 A5   51   D0  0B6F  1477 	MOVL	R1,HQB$L_TSRV(R5)	;  and store it away in the HQB
                                     0B73  1478 
                         5C A1   B1  0B73  1479 	CMPW	TSRV$W_NUM_HOST(R1),-	; Max number of hosts being served?
                       0100 8F       0B76  1480 		#MAX_HOSTS		;
                            4A   18  0B79  1481 	BGEQ	TMSCP$NO_ROOM		;  beyond the end of the table
                    10 A5   3C   B0  0B7B  1482 	MOVW	#60,HQB$W_HTIMO(R5)	; Default host access timeout 
                                     0B7F  1483 
                                     0B7F  1484 ;
                                     0B7F  1485 ; ACCEPT the connection request, and link in the HQB.
                                     0B7F  1486 ;		R3  =  CDT address
                                     0B7F  1487 ;		R4  =  PDT address
                                     0B7F  1488 ;		R5  =  HQB address
                                     0B7F  1489 ;
                                     0B7F  1490 
                                     0B7F  1491 	ASSUME	HQB$L_FLINK EQ 0
                                     0B7F  1492 
                                     0B7F  1493 	ACCEPT	MSGADR=TMSCP$MSG_IN,-	; Message input address
                                     0B7F  1494 		ERRADR=TMSCP$VC_ERR,-	; Virtual circuit error address
                                     0B7F  1495 		INITCR=#30,-		; Initial credit extended
                                     0B7F  1496 		MINSCR=#1,-		; Minimum send credit
                                     0B7F  1497 		CONDAT=TSRV$W_VERSION(R1),- ; CONNECT/ACCEPT data
                                     0B7F  1498 		AUXSTR=HQB$L_FLINK(R5)	; HQB address
                         AC'AF   9F  0B7F       		PUSHAB	B^30037$
                            04   DD  0B82       	PUSHL	 #4
                            00   DD  0B84       		PUSHL	#0
                            00   DD  0B86       		PUSHL	#0
                            65   9F  0B88       		PUSHAB	HQB$L_FLINK(R5)
                         3C A1   9F  0B8A       		PUSHAB	TSRV$W_VERSION(R1)
                       7E   00   9B  0B8D       		MOVZBW	#0,-(SP)
                       7E   00   B0  0B90       		MOVW	#0,-(SP)
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  34
X-2A6A1                         - LISTEN - Listen for a Connect Request  27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (14)

                       7E   01   B0  0B93       		MOVW	#1,-(SP)
                       7E   1E   B0  0B96       		MOVW	#30,-(SP)
                       0BD6'CF   9F  0B99       		PUSHAB	TMSCP$VC_ERR
                            00   DD  0B9D       		PUSHL	#0
                       0D86'CF   9F  0B9F       		PUSHAB	TMSCP$MSG_IN
                       7E   0C   D0  0BA3       		MOVL	#12,-(SP)
                   00000000'GF   17  0BA6       		JMP	G^SCS$ACCEPT
                                     0BAC       30037$:
                         06 50   E8  0BAC  1499 	BLBS	R0,40$			; If acceptance was unsuccessful,
                    53   28 A5   D0  0BAF  1500 	MOVL	HQB$L_CDT(R5),R3	;  restore the CDT address and 
                                     0BB3  1501 	.IF DEFINED DEBUG$REJECT_TRACKING
                                     0BB3  1502 	MOVL	G^ SCS$GL_TMSCP, R1	; Get TSRV address.
                                     0BB3  1503 	MOVL	R0,TSRV$L_REPLC_CNT+16(R1); Save away the error code
                                     0BB3  1504 	INCL	TSRV$L_REPLC_CNT+20(R1)	;  and keep a count	
                                     0BB3  1505 	.ENDC	   ;DEBUG$REJECT_TRACKING
                            10   11  0BB3  1506 	BRB	TMSCP$REJECT_CONNECTION	; Reject this request.
                                     0BB5  1507 
                                     0BB5  1508 40$:
                    51   32 A5   D0  0BB5  1509 	MOVL	HQB$L_TSRV(R5),R1	; Restore the TSRV address 
                            65   0E  0BB9  1510 	INSQUE	HQB$L_FLINK(R5),-	; Link this HQB into the list of
                         64 B1       0BBB  1511 		@TSRV$L_HQB_BL(R1)	;  all hosts being served
                         5C A1   B6  0BBD  1512 	INCW	TSRV$W_NUM_HOST(R1)	; Add one to the host count
                    28 A5   53   D0  0BC0  1513 	MOVL	R3,HQB$L_CDT(R5)	; Keep the CDT address
                                 05  0BC4  1514 	RSB
                                     0BC5  1515 
                                     0BC5  1516 TMSCP$NO_ROOM::
                                     0BC5  1517 TMSCP$REJECT_REQUEST::
                                     0BC5  1518 	.IF DEFINED DEBUG$REJECT_TRACKING
                                     0BC5  1519 	MOVL	G^ SCS$GL_TMSCP, R1	; Get TSRV address.
                                     0BC5  1520 	MOVL	R0,TSRV$L_REPLC_CNT+24(R1); Save away the bit number
                                     0BC5  1521 	INCL	TSRV$L_REPLC_CNT+28(R1)	;  and keep a count	
                                     0BC5  1522 	.ENDC	   ;DEBUG$REJECT_TRACKING
                                     0BC5  1523 
                                     0BC5  1524 TMSCP$REJECT_CONNECTION::
                       50   55   D0  0BC5  1525 	MOVL	R5,R0			; Address of the structure to deallocate
                   00000000'GF   16  0BC8  1526 	JSB	G^EXE$DEANONPAGED	; Free the memory allocated to the HQB
                                     0BCE  1527 
                                     0BCE  1528 TMSCP$REJECT::
                                     0BCE  1529 	REJECT	#1			; Reject the connect application
                       50   01   D0  0BCE       		MOVL	#1, R0
                         4C B4   16  0BD1       		JSB	@PDT$L_REJECT(R4)
                                 05  0BD4  1530 	RSB				;  and return to the caller
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  35
X-2A6A1                         - Virtual Circuit Error Routine          27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (15)

                                     0BD5  1533 	.SBTTL	-	Virtual Circuit Error Routine
                                     0BD5  1534 
                                     0BD5  1535 ;+
                                     0BD5  1536 ; Functional Description:
                                     0BD5  1537 ;
                                     0BD5  1538 ; This routine handles a virtual circuit failure, cleaning up all the 
                                     0BD5  1539 ; requests that were outstanding for the host whose connection failed,
                                     0BD5  1540 ; and then removing the HQB for the failed host from the T/MSCP server
                                     0BD5  1541 ; data structures. 
                                     0BD5  1542 ;
                                     0BD5  1543 ; This routine is set up as the virtual circuit error handling routine
                                     0BD5  1544 ; when the connect is issued. Control is passed here in fork context when
                                     0BD5  1545 ; a link failure is detected, or a disconnect is issued.
                                     0BD5  1546 ;
                                     0BD5  1547 ; Inputs:
                                     0BD5  1548 ;
                                     0BD5  1549 ;	R0  =  Scratch
                                     0BD5  1550 ;	R1  =  Scratch
                                     0BD5  1551 ;	R2  =  Scratch
                                     0BD5  1552 ;	R3  =  CDT address
                                     0BD5  1553 ;	R4  =  PDT address
                                     0BD5  1554 ;	R5  =  Scratch
                                     0BD5  1555 ;
                                     0BD5  1556 ; Outputs:
                                     0BD5  1557 ;	
                                     0BD5  1558 ;	None
                                     0BD5  1559 ;
                                     0BD5  1560 ;-
                                     0BD5  1561 
                                     0BD5  1562 TMSCP$VC_ERR_ABORT::
                                 05  0BD5  1563 	RSB				; Out of line return to caller this
                                     0BD6  1564 					;  connection is already being terminated
                                     0BD6  1565 
                                     0BD6  1566 TMSCP$VC_ERR::
                                     0BD6  1567 	.IF DEFINED DEBUG$PC_HISTORY
                                     0BD6  1568 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0BD6  1569 	.ENDC	   ;DEBUG$PC_HISTORY
                    55   5C A3   D0  0BD6  1570 	MOVL	CDT$L_AUXSTRUC(R3),R5	; Pick up the HQB address
                            01   E2  0BDA  1571 	BBSS	#HQB$V_DISCON_INIT,-	; If this system is VERY low on NPP
                         0D A5       0BDC  1572 		HQB$B_STATE(R5),-	;  this routine could be called from
                            F6       0BDE  1573 		TMSCP$VC_ERR_ABORT	;  within the server (see TMSCP$MSG_IN)
                    51   32 A5   D0  0BDF  1574 	MOVL	HQB$L_TSRV(R5),R1	; Get the address of the server struct
                       0564 C1   D6  0BE3  1575 	INCL	TSRV$L_VCFAIL_CNT(R1)	; Keep a count of the link disconnects
                                     0BE7  1576 
                                     0BE7  1577 ;
                                     0BE7  1578 ; Retrieve all CDRPs that are active on this CDT.
                                     0BE7  1579 ;
                            20   BB  0BE7  1580 	PUSHR	#^M<R5>			; Save the registers from destruction
                                     0BE9  1581 	SCAN_RSPID_WAIT-		; Scan message buffer and send credit wait
                                     0BE9  1582 		action = TMSCP$UNHOOK_CDRP  ;  queues for CDRP with given CDT in R3.
                  50   20B6'CF   9E  0BE9       		MOVAB	TMSCP$UNHOOK_CDRP, R0
                   00000000'GF   16  0BEE       		JSB	G^SCS$LKP_RDTWAIT
                                     0BF4  1583 	.IF DEFINED DEBUG$PC_HISTORY
                                     0BF4  1584 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0BF4  1585 	.ENDC	   ;DEBUG$PC_HISTORY
                                     0BF4  1586 	SCAN_RDT-			; Scan RDT for CDRP.
                                     0BF4  1587 		action = TMSCP$UNHOOK_CDRP
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  36
X-2A6A1                         - Virtual Circuit Error Routine          27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (15)

                  50   20B6'CF   9E  0BF4       		MOVAB	TMSCP$UNHOOK_CDRP, R0
                   00000000'GF   16  0BF9       		JSB	G^SCS$LKP_RDTCDRP
                                     0BFF  1588 	.IF DEFINED DEBUG$PC_HISTORY
                                     0BFF  1589 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0BFF  1590 	.ENDC	   ;DEBUG$PC_HISTORY
                                     0BFF  1591 	SCAN_MSGBUF_WAIT- 		; Scan RSPID wait queue for CDRP.
                                     0BFF  1592 		action = TMSCP$UNHOOK_CDRP
                  50   20B6'CF   9E  0BFF       		MOVAB	TMSCP$UNHOOK_CDRP, R0
                   00000000'GF   16  0C04       		JSB	G^SCS$LKP_MSGWAIT
                                     0C0A  1593 	.IF DEFINED DEBUG$PC_HISTORY
                                     0C0A  1594 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0C0A  1595 	.ENDC	   ;DEBUG$PC_HISTORY
                            20   BA  0C0A  1596 	POPR	#^M<R5>			; Restore the saved registers
                                     0C0C  1597 
                                     0C0C  1598 ;
                                     0C0C  1599 ; Go through the list of host request blocks and dequeue all the outstanding
                                     0C0C  1600 ; requests that are not in progress. If the request involves a transfer that 
                                     0C0C  1601 ; is in progress, the HRB is marked "abort", and is dequeued when the transfer
                                     0C0C  1602 ; completes.
                                     0C0C  1603 ; 
                                     0C0C  1604 ; States: 
                                     0C0C  1605 ;	
                                     0C0C  1606 ;	HRB$K_ST_MSG_WAIT is set in 1) ADD when a message buffer is allocated
                                     0C0C  1607 ;			  to use as the buffer to notify all hosts of a new
                                     0C0C  1608 ;			  unit and 2) in TMSCP$SEND_END when a command packet is
                                     0C0C  1609 ;			  recycled to be an end packet.
                                     0C0C  1610 ;
                                     0C0C  1611 ;	HRB$K_ST_SEQ_WAIT is set in BLOCKED when a sequential command is put on
                                     0C0C  1612 ;			  the blocked queue.
                                     0C0C  1613 ;	
                                     0C0C  1614 ;	HRB$K_ST_SNDAT_WAIT is set in 1) READ when sending data to host buffer
                                     0C0C  1615 ;			    and 2) in WRITE when receiving data from the host.
                                     0C0C  1616 ;
                                     0C0C  1617 ;	HRB$K_ST_DRV_WAIT is set in SEND_IRP, the routine which queues an
                                     0C0C  1618 ;			  IRP to the local driver.
                                     0C0C  1619 ;
                                     0C0C  1620 ;	HRB$K_ST_MAP_WAIT is set in 1) READ when mapping a buffer for a read request
                                     0C0C  1621 ;			  and 2) in WRITE when mapping a buffer for a write request
                                     0C0C  1622 ;
                                     0C0C  1623 ;
                    51   20 A5   DE  0C0C  1624 	MOVAL	HQB$L_HRB_FL(R5),R1	; Get the address of the HRB list head
                       52   51   D0  0C10  1625 	MOVL	R1,R2			;  and move it to a new register
                                     0C13  1626 
                                     0C13  1627 	ASSUME	HRB$L_FLINK EQ 0
                                     0C13  1628 
                                     0C13  1629 30$:
                       51   61   D0  0C13  1630 	MOVL	HRB$L_FLINK(R1),R1	; Get the address of the next HRB
                       52   51   D1  0C16  1631 	CMPL	R1,R2			; If we are back at the list head,
                            56   13  0C19  1632 	BEQL	70$			;  the queue had been traversed
                            01   A8  0C1B  1633 	BISW	#HRB$M_ABORT,-		; Set the abort bit to signify that
                         16 A1       0C1D  1634 		HRB$W_FLAGS(R1)		;  this transaction has been visited
                                     0C1F  1635 	DISPATCH HRB$W_STATE(R1),-	; Dispatch based on request state
                                     0C1F  1636 		type=W,-		;  which is a word field
                                     0C1F  1637 		prefix=HRB$K_ST_,<-	; 
                                     0C1F  1638 		<MSG_WAIT,   60$>,-	; Leave this request with the abort flag set
                                     0C1F  1639 		<SEQ_WAIT,   60$>,-	; Command on the blocked queue can be punted now.
                                     0C1F  1640 		<SNDAT_WAIT, 60$>,-	; Sending or receiving data
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  37
X-2A6A1                         - Virtual Circuit Error Routine          27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (15)

                                     0C1F  1641 		<DRV_WAIT,   60$>,-	; Wait til the drivers done for this one
                                     0C1F  1642 		<MAP_WAIT,   50$>,-	; The only way to get this is to yank it
                                     0C1F  1643 		>			; Should not fail with requests in SNDMS state
               05   01   14 A1   AF  0C1F       	CASEW	HRB$W_STATE(R1),#$$BASE,#$$LIMIT
                                     0C24       30038$:
                               0030' 0C24       	.SIGNED_WORD	60$-30038$
                               0030' 0C26       	.SIGNED_WORD	60$-30038$
                               000C  0C28       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               0030' 0C2A       	.SIGNED_WORD	60$-30038$
                               0030' 0C2C       	.SIGNED_WORD	60$-30038$
                               0010' 0C2E       	.SIGNED_WORD	50$-30038$
                                     0C30  1644                                                
                                     0C30  1645      	BUG_CHECK MSCPSERV,FATAL	; ERROR
                               FEFF  0C30       		.WORD	^XFEFF
                               0004' 0C32       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_MSCPSERV!4
                                     0C34  1646 
                                     0C34  1647 ;
                                     0C34  1648 ; Now all the request specific processing is done, do some common processing
                                     0C34  1649 ; here, setting the flags and status bits.
                                     0C34  1650 ;
                                     0C34  1651 
                                     0C34  1652 50$:
                                     0C34  1653 	.IF DEFINED DEBUG$PC_HISTORY
                                     0C34  1654 	MOVL	R1, R0			; Get HRB address.
                                     0C34  1655 	BSBW	TMSCP$PCHIST_R3R0	; Save this PC if we are keeping track
                                     0C34  1656 	.ENDC	   ;DEBUG$PC_HISTORY
                    50   1C A1   D0  0C34  1657 	MOVL	HRB$L_IRP_CDRP(R1),R0	; Get the address of the IRP-CDRP
                    50   60 A0   DE  0C38  1658 	MOVAL	IRP$L_FQFL(R0),R0	;  and move down to the CDRP portion
                         04 A0   D5  0C3C  1659 	TSTL	CDRP$L_FQBL(R0)		; Check for the presence of a pointer
                            D2   13  0C3F  1660 	BEQL	30$			; If the field is 0 don't dequeue
                                     0C41  1661 
                                     0C41  1662 	ASSUME	CDRP$L_FQFL EQ 0
                                     0C41  1663 
                    50   04 B0   D1  0C41  1664 	CMPL	@CDRP$L_FQBL(R0),R0	; If the field is nonzero,
                            CC   12  0C45  1665 	BNEQ	30$			;  make sure it is in a queue
                                     0C47  1666 
                                     0C47  1667 	ASSUME	CDRP$L_FQFL EQ 0
                                     0C47  1668 
                       50   60   0F  0C47  1669 	REMQUE	CDRP$L_FQFL(R0), R0	; Remove the CDRP from its queue
                                     0C4A  1670 
                            06   B1  0C4A  1671 	CMPW	#HRB$K_ST_MAP_WAIT,-	; Are we in a map wait
                         14 A1       0C4C  1672 		 HRB$W_STATE(R1)	;  state ?
                            04   12  0C4E  1673 	BNEQ	60$			; BR if No
                            20   A8  0C50  1674 	BISW	#HRB$M_UNBLOCK,-	; Unblock this request after
                         16 A1       0C52  1675 		 HRB$W_FLAGS(R1)	;  cleanup
                                     0C54  1676 	
                                     0C54  1677 
                                     0C54  1678 60$:
                                     0C54  1679 	.IF DEFINED DEBUG$PC_HISTORY
                                     0C54  1680 	MOVL	R1, R0			; Get HRB address.
                                     0C54  1681 	BSBW	TMSCP$PCHIST_R3R0	; Save this PC if we are keeping track
                                     0C54  1682 	.ENDC	   ;DEBUG$PC_HISTORY
                         4C A1   D5  0C54  1683 	TSTL	HRB$L_WAIT_FL(R1)	; Are we on the blocked queue? 
                            BA   13  0C57  1684 	BEQL	30$			; SNDDAT state during READ means 
                                     0C59  1685 					; we've already dequeued this request
                    50   4C A1   0F  0C59  1686 	REMQUE	HRB$L_WAIT_FL(R1),R0	; Remove from UQB sequential wait queue.
                    50   58 A1   D0  0C5D  1687 	MOVL	HRB$L_UQB(R1),R0	; Get the address of the UQB
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  38
X-2A6A1                         - Virtual Circuit Error Routine          27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (15)

                         28 A0   B7  0C61  1688 	DECW	UQB$W_NUM_QUE(R0)	; Decrement the number on the queue
                       8000 8F   A8  0C64  1689 	BISW	#HRB$M_STATE_INVALID,-	; The state of the request as indicated
                         14 A1       0C68  1690 		HRB$W_STATE(R1)		;  is no longer valid, change it
                            04   A8  0C6A  1691 	BISW	#HRB$M_DEQUEUED,-	; Mark this request as unhooked... 
                         16 A1       0C6C  1692 		HRB$W_FLAGS(R1)		;  its resources can be deallocated
                          FFA2   31  0C6E  1693 	BRW	30$			; Check for more HRBs to process
                                     0C71  1694 
                                     0C71  1695 ;
                                     0C71  1696 ; All requests for this host have been removed from the resource wait queues,
                                     0C71  1697 ; we are almost ready to disconnect. There is one resource that must be dealt
                                     0C71  1698 ; with before we issue the disconnect though, and that is the message buffer.
                                     0C71  1699 ; Since we have to use the CDT to deallocate message buffers, they must all be 
                                     0C71  1700 ; deallocated before the disconnect is issued.
                                     0C71  1701 ;
                                     0C71  1702 ; The current sanity subroutine cannot be called from any point from here to
                                     0C71  1703 ; the end of this routine. If there were commands outstanding for the client
                                     0C71  1704 ; node that just failed, the algorithm used to verify that the current counter
                                     0C71  1705 ; is correct cannot be used. This is because the request in question has been
                                     0C71  1706 ; removed from the wait queue (and the UQB num_que counter adjusted), but it
                                     0C71  1707 ; has not been cleaned up (and the current counter adjusted). These counters
                                     0C71  1708 ; are resynchronized at the end of this routine.
                                     0C71  1709 ;
                                     0C71  1710 
                                     0C71  1711 70$:
                    51   20 A5   DE  0C71  1712 	MOVAL	HQB$L_HRB_FL(R5),R1	; Get the address of the HRB list head
                       52   51   D0  0C75  1713 	MOVL	R1,R2			;  and move it to a new register
                    53   28 A5   D0  0C78  1714 	MOVL	HQB$L_CDT(R5),R3	; Get the CDT address for disc @90$
                                     0C7C  1715 
                                     0C7C  1716 	ASSUME	HRB$L_FLINK EQ 0
                                     0C7C  1717 
                                     0C7C  1718 80$:
                       51   61   D0  0C7C  1719 	MOVL	HRB$L_FLINK(R1),R1	; Get the address of the next HRB
                       52   51   D1  0C7F  1720 	CMPL	R1,R2			; If we are back at the list head,
                            25   13  0C82  1721 	BEQL	90$			;  the queue had been traversed
                                     0C84  1722 
                                     0C84  1723 ;
                                     0C84  1724 ; Deallocate any MSCP message buffer that is found. This may start up another
                                     0C84  1725 ; thread, but it won't be one associated with this CDT since we have unhooked 
                                     0C84  1726 ; all the requests pertaining to the connection that has failed before getting
                                     0C84  1727 ; to this point.
                                     0C84  1728 ;
                         18 A1   D5  0C84  1729 	TSTL	HRB$L_MSGBUF(R1)	; Check for allocated message buffer
                            F3   13  0C87  1730 	BEQL	80$			; Continue, if none is allocated
                            2E   BB  0C89  1731 	PUSHR	#^M<R1,R2,R3,R5>	; Save the registers from destruction
                    55   1C A1   D0  0C8B  1732 	MOVL	HRB$L_IRP_CDRP(R1),R5	; Get the address of the IRP-CDRP
                    55   60 A5   DE  0C8F  1733 	MOVAL	IRP$L_FQFL(R5),R5	;  and move down to the CDRP portion
                    52   18 A1   D0  0C93  1734 	MOVL	HRB$L_MSGBUF(R1),R2	; Get the message buffer address
                         18 A1   D4  0C97  1735 	CLRL	HRB$L_MSGBUF(R1)	;  and clear out the address in the HRB
                    50   54 A1   D0  0C9A  1736 	MOVL	HRB$L_HQB(R1),R0	; Get the address of the HQB
                    53   28 A0   D0  0C9E  1737 	MOVL	HQB$L_CDT(R0),R3	;  so we can get the CDT address
                                     0CA2  1738 	DEALLOC_MSG_BUF_REG		; Get rid of the message buffer
                         24 B4   16  0CA2       		JSB	@PDT$L_DEALRGMSG(R4)
                            2E   BA  0CA5  1739 	POPR	#^M<R1,R2,R3,R5>	; Restore the registers
                            D3   11  0CA7  1740 	BRB	80$			; Move on to the next request
                                     0CA9  1741 
                                     0CA9  1742 ;
                                     0CA9  1743 ; In order to assure that none of the pending requests for this host are
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  39
X-2A6A1                         - Virtual Circuit Error Routine          27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (15)

                                     0CA9  1744 ; started up after the invocation of this routine, no resources held by
                                     0CA9  1745 ; pending requests are deallocated until the disconnect is issued. At that 
                                     0CA9  1746 ; time, resources allocated for all requests (except ones held by the tape 
                                     0CA9  1747 ; driver) can be deallocated.
                                     0CA9  1748 ;
                                     0CA9  1749 
                                     0CA9  1750 90$:
                                     0CA9  1751 	DISCONNECT			; The disconnect can be issued now, but
                   00000000'GF   16  0CA9       		JSB	G^SCS$DISCONNECT
                         28 A5   D4  0CAF  1752 	CLRL	HQB$L_CDT(R5)		;  the CDT should not be used anymore!
                                     0CB2  1753 
                                     0CB2  1754 ;
                                     0CB2  1755 ; Now that the disconnect has been issued and the CDT has been returned, start
                                     0CB2  1756 ; any requests that had been blocked, and then continue cleaning up the 
                                     0CB2  1757 ; requests that were left aborted, making sure the units reflect the 
                                     0CB2  1758 ; change in state for the host that just went away.
                                     0CB2  1759 ;
                    54   32 A5   D0  0CB2  1760 	MOVL	HQB$L_TSRV(R5),R4	; Get the address of the server struct
                    52   68 A4   DE  0CB6  1761 	MOVAL	TSRV$L_UQB_FL(R4),R2	; Loop through the UQBs making
                       54   52   D0  0CBA  1762 	MOVL	R2,R4			;  any units available that have this
                                     0CBD  1763 
                                     0CBD  1764 	ASSUME	UQB$L_FLINK EQ 0
                                     0CBD  1765 
                                     0CBD  1766 100$:
                       54   64   D0  0CBD  1767 	MOVL	UQB$L_FLINK(R4),R4	;  host's online bit set.
                       52   54   D1  0CC0  1768 	CMPL	R4,R2			; Check for the end of the queue
                            66   13  0CC3  1769 	BEQL	140$			; If they are the same...All done!
                    70 A4   55   D1  0CC5  1770 	CMPL	R5,UQB$L_ONLINE_HQB(R4)	; Online to the host represented by
                                     0CC9  1771 					;  the HQB in R5?
                            F2   12  0CC9  1772 	BNEQ	100$			; If not, check next unit.
                                     0CCB  1773 ;
                                     0CCB  1774 ; A unit was found that still thinks the host is out there. An HRB needs to 
                                     0CCB  1775 ; be allocated and the available processing done for this host. Since we
                                     0CCB  1776 ; no longer have a CDT, we will call the sequential command subroutine at
                                     0CCB  1777 ; its alternate entry point and get along the best we can without actually
                                     0CCB  1778 ; allocating a message buffer of our own.
                                     0CCB  1779 ;
                          0F79   30  0CCB  1780 	BSBW	TMSCP$ALLOCATE_HRB	; Returns the HRB address in R3
                         48 50   E9  0CCE  1781 	BLBC	R0,120$			; Out of memory? BIG trouble
                       8000 8F   A8  0CD1  1782 	BISW	#HRB$M_STATE_INVALID,-	; Start off with the state
                         14 A3       0CD5  1783 		HRB$W_STATE(R3)		;  of this request as current
                       0040 8F   A8  0CD7  1784 	BISW	#HRB$M_VCFAILED,-	; Set the bit indicating that this is
                         16 A3       0CDB  1785 		HRB$W_FLAGS(R3)		;  not really a request from the host
                    58 A3   54   D0  0CDD  1786 	MOVL	R4,HRB$L_UQB(R3)	; Save the Unit Queue Block address
                    54 A3   55   D0  0CE1  1787 	MOVL	R5,HRB$L_HQB(R3)	; Save the Host Queue Block address
                            63   0E  0CE5  1788 	INSQUE	HRB$L_FLINK(R3),-	; Link this HRB to the host that is
                         24 B5       0CE7  1789 		@HQB$L_HRB_BL(R5)	;  failing to clean it up later
                         1C A5   B6  0CE9  1790 	INCW	HQB$W_NUM_QUE(R5)	; Up the counter of queue elements
                         1C A5   B1  0CEC  1791 	CMPW	HQB$W_NUM_QUE(R5),-	; Check to see if the new value is
                         1E A5       0CEF  1792 		HQB$W_MAX_QUE(R5)	;  higher than any previous value
                            05   15  0CF1  1793 	BLEQ	110$			;  if its not, conitnue on
                         1C A5   B0  0CF3  1794 	MOVW	HQB$W_NUM_QUE(R5),-	; If it is, make the current value
                         1E A5       0CF6  1795 		HQB$W_MAX_QUE(R5)	;  a new high water mark
                                     0CF8  1796 
                                     0CF8  1797 110$:
                         12 A4   B6  0CF8  1798 	INCW	UQB$W_CURRENT(R4)	; Keep the HRB counter current
                                     0CFB  1799 	.IF DEFINED DEBUG$PC_HISTORY
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  40
X-2A6A1                         - Virtual Circuit Error Routine          27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (15)

                                     0CFB  1800 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0CFB  1801 	.ENDC	   ;DEBUG$PC_HISTORY
                            34   BB  0CFB  1802 	PUSHR	#^M<R2,R4,R5>		; Save the termination criteria
                            52   D4  0CFD  1803 	CLRL	R2			; There is no MSCP packet availale
                       51   08   D0  0CFF  1804 	MOVL	#MSCP$K_OP_AVAIL,R1	; Set an opcode value
              54   00000000'GF   D0  0D02  1805 	MOVL	G^SCS$GL_TMSCP,R4	; Get the address of the server struct
                       04C4 C4   D6  0D09  1806 	INCL	TSRV$L_OPCOUNT(R4)	;  then set the count of total operations
                     04C4 C441   D6  0D0D  1807 	INCL	TSRV$L_OPCOUNT(R4)[R1]	;  and the count of avails straight
                          0461   30  0D12  1808 	BSBW	TMSCP$SEQ_ALT		; Call the seq command alt entry
                            34   BA  0D15  1809 	POPR	#^M<R2,R4,R5>		; Restore the saved ending criteria
                            A4   11  0D17  1810 	BRB	100$			; Continue checking...
                                     0D19  1811 
                                     0D19  1812 ;
                                     0D19  1813 ; As an emergency measure, if there is insufficient memory to allocate a
                                     0D19  1814 ; HRB, the online bits in the UQB for this host are cleared anyway, so that
                                     0D19  1815 ; when the host establishes a new connection, it will not hang.
                                     0D19  1816 ;
                                     0D19  1817 
                                     0D19  1818 120$:
                         70 A4   D4  0D19  1819 	CLRL	UQB$L_ONLINE_HQB(R4)	; No longer online to this host
                    50   24 A4   D0  0D1C  1820 	MOVL	UQB$L_UCB(R4),R0	; Get the UCB address
                            08   AA  0D20  1821 	BICW	#UQB$M_ONLINE,-		; Clear online bit in state field
                         0E A4       0D22  1822 		UQB$W_FLAGS(R4)		;
                                     0D24  1823 
                                     0D24  1824 130$:
                       00C2 C0   97  0D24  1825 	DECB	UCB$B_ONLCNT(R0)	; Decrement the online count
                          FF92   31  0D28  1826 	BRW	100$			; And continue with next unit...
                                     0D2B  1827 ;
                                     0D2B  1828 ; Now all the units that the failed host was holding online have been freed. 
                                     0D2B  1829 ; The next items to be taken care of are the requests that were pending when
                                     0D2B  1830 ; the virtual circuit to the host failed. First, try to deallocate the HQB.
                                     0D2B  1831 ; If there are no requests pending for this host, the HQB will be deallocated
                                     0D2B  1832 ; and we are finished. If there are HRBs that still have to be cleaned up,
                                     0D2B  1833 ; the deallocate attempt will return a failed status, indicating that more
                                     0D2B  1834 ; cleanup is necessary.
                                     0D2B  1835 ;
                                     0D2B  1836 
                                     0D2B  1837 140$:
                            54   D4  0D2B  1838 	CLRL	R4			; No UQB addr if no cmds active
                    52   20 A5   DE  0D2D  1839 	MOVAL	HQB$L_HRB_FL(R5),R2	; Save away the queue header address
                       53   52   D0  0D31  1840 	MOVL	R2,R3			; Get set up for the first element
                                     0D34  1841 
                                     0D34  1842 150$:
                                     0D34  1843 	.IF DEFINED DEBUG$PC_HISTORY
                                     0D34  1844 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0D34  1845 	.ENDC	   ;DEBUG$PC_HISTORY
                                     0D34  1846 
                                     0D34  1847 	ASSUME	HRB$L_FLINK EQ 0
                                     0D34  1848 
                       53   63   D0  0D34  1849 	MOVL	HRB$L_FLINK(R3),R3	; Get the address of the next HRB 
                       52   53   D1  0D37  1850 	CMPL	R3,R2			; If it is the same as the header, 
                            32   13  0D3A  1851 	BEQL	160$			;  we are finished checking the queue 
                    54   58 A3   D0  0D3C  1852 	MOVL	HRB$L_UQB(R3),R4	; Get the addr of UQB from last command 
                            06   E0  0D40  1853 	BBS	#HRB$V_VCFAILED,-	; If this request is the result of the 
                      EF 16 A3       0D42  1854 		HRB$W_FLAGS(R3),150$	;  VC failure let it finish normally 
                            05   B1  0D45  1855 	CMPW	#HRB$K_ST_DRV_WAIT,-	; If we are waiting for the tape 
                         14 A3       0D47  1856 		HRB$W_STATE(R3)		;  then continue waiting... 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  41
X-2A6A1                         - Virtual Circuit Error Routine          27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (15)

                            E9   13  0D49  1857 	BEQL	150$			;  continue traversing the queue... 
                            02   E0  0D4B  1858 	BBS	#HRB$V_DEQUEUED,-	; If the request has been dequeued
                      14 16 A3       0D4D  1859 		HRB$W_FLAGS(R3),155$	;    cleanup
                            06   B1  0D50  1860 	CMPW	#HRB$K_ST_MAP_WAIT,-	; If we are waiting for the mapping 
                         14 A3       0D52  1861 		HRB$W_STATE(R3)		;  then continue waiting... 
                            DE   13  0D54  1862 	BEQL	150$			;  continue traversing the queue... 
                            04   B1  0D56  1863 	CMPW	#HRB$K_ST_SNDAT_WAIT,-	; If we are waiting for data transfer 
                         14 A3       0D58  1864 		HRB$W_STATE(R3)		;   to complete 
                            19   13  0D5A  1865 	BEQL	170$			;  we are hopelessly lost 
                            05   E0  0D5C  1866 	BBS	#HRB$V_UNBLOCK,-	; If this bit is set we need to call 
                      03 16 A3       0D5E  1867 		HRB$W_FLAGS(R3),155$	;  the UNBLOCK routine after cleanup 
                         58 A3   D4  0D61  1868 	CLRL	HRB$L_UQB(R3)		;  Otherwise we can defuse it  
                                     0D64  1869  
                                     0D64  1870 155$: 
                            55   DD  0D64  1871 	PUSHL	R5			; Save the HQB address
                          0F79   30  0D66  1872 	BSBW	TMSCP$CLEANUP_HRB	; Deallocate the HRB and its resources
                            55 8ED0  0D69  1873 	POPL	R5			; Restore the saved HQB
                            BD   11  0D6C  1874 	BRB	140$			;  Continue through the list
                                     0D6E  1875 
                                     0D6E  1876 160$:
                            01   88  0D6E  1877 	BISB2	#HQB$M_VC_FAILED,-	; Set this bit in the status field
                         0D A5       0D70  1878 		HQB$B_STATE(R5)		;  indicating that the HQB can now be
                          135D   31  0D72  1879 	BRW	TMSCP$DEALLOC_HQB	;  deleted, and then try
                                     0D75  1880 
                                     0D75  1881 170$:
                                     0D75  1882 	BUG_CHECK MSCPSERV,FATAL	; ERROR
                               FEFF  0D75       		.WORD	^XFEFF
                               0004' 0D77       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_MSCPSERV!4
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  42
X-2A6A1                         Main Line Routine                        27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (16)

                                     0D79  1885 	.SBTTL	Main Line Routine
                                     0D79  1886 
                                     0D79  1887 ;+
                                     0D79  1888 ; Functional Description:
                                     0D79  1889 ;
                                     0D79  1890 ; MSCP requests are received from remote hosts in this routine. The packet 
                                     0D79  1891 ; is inspected for validity and if its good, an HRP is made up to represent
                                     0D79  1892 ; this request. The request is then dispatched to the proper handling
                                     0D79  1893 ; routine to be processed further.
                                     0D79  1894 ;
                                     0D79  1895 ; Inputs:
                                     0D79  1896 ;
                                     0D79  1897 ;	R0  =  Scratch
                                     0D79  1898 ;	R1  =  Length of MSCP packet
                                     0D79  1899 ;	R2  =  MSCP packet address
                                     0D79  1900 ;	R3  =  CDT address
                                     0D79  1901 ;	R4  =  PDT address
                                     0D79  1902 ;	R5  =  Scratch
                                     0D79  1903 ;
                                     0D79  1904 ; Oututs:
                                     0D79  1905 ;
                                     0D79  1906 ;	R0  =  When an error is encountered R0 is packed with an op-code
                                     0D79  1907 ;		an error code and the offset of the bad field within the
                                     0D79  1908 ;		MSCP packet.
                                     0D79  1909 ;	R3  =  HRB address
                                     0D79  1910 ;-
                                     0D79  1911  
                                     0D79  1912 ;
                                     0D79  1913 ; Out of line error routines are placed before this module so they can be 
                                     0D79  1914 ; reached with condition code branch instructions to optimize the main path.
                                     0D79  1915 ;
                                     0D79  1916 ; There was insufficient memory on the server system to allocate the required
                                     0D79  1917 ; data structures to accept this request. In this case we will deallocate the
                                     0D79  1918 ; MSCP packet we have, and take down the virtual circuit. 
                                     0D79  1919 ;
                                     0D79  1920 
                                     0D79  1921 TMSCP$NO_MEM::
                       53   54   D0  0D79  1922 	MOVL	R4,R3			; Put the CDT address back
                    54   10 A3   D0  0D7C  1923 	MOVL	CDT$L_PDT(R3),R4	;  and then restore the PDT address
                                     0D80  1924 	DEALLOC_MSG_BUF_REG		; Deallocate the message buffer
                         24 B4   16  0D80       		JSB	@PDT$L_DEALRGMSG(R4)
                          FE50   31  0D83  1925 	BRW	TMSCP$VC_ERR		; Break and clean up virtual curcuit
                                     0D86  1926 
                                     0D86  1927 ;
                                     0D86  1928 ; First, make sure we have a valid MSCP command packet. Check to make sure
                                     0D86  1929 ; the incoming packet is the proper length, and that it does not have any 
                                     0D86  1930 ; modifiers set that the server does not support.
                                     0D86  1931 ;
                                     0D86  1932 
                                     0D86  1933 TMSCP$MSG_IN::
                                     0D86  1934 	.IF	DEFINED DEBUG$PC_HISTORY
                                     0D86  1935 	MOVL	MSCP$L_CMD_REF(R2), R0	; Save command reference number in PC trace.
                                     0D86  1936 	BSBW	TMSCP$PCHIST_R3R0	; Log the PC for debugging.
                                     0D86  1937 	.ENDC  ;DEBUG$PC_HISTORY
               06 F9E1 CF   01   E1  0D86  1938 	BBC	# TMSCP$V_DBG_MSG_IN, -	; Not debugging - branch.
                                     0D8C  1939 		TMSCP$L_DEBUG_FLAGS, 0$
                   00000000'GF   16  0D8C  1940 	JSB	G^ INI$BRK
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  43
X-2A6A1                         Main Line Routine                        27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (16)

                                     0D92  1941 
                                     0D92  1942 0$:
              55   00000000'GF   D0  0D92  1943 	MOVL	G^SCS$GL_TMSCP,R5	; Get the server data structure
                       04C4 C5   D6  0D99  1944 	INCL	TSRV$L_OPCOUNT(R5)	;  and count each request received
                                     0D9D  1945 
                                     0D9D  1946 ;
                                     0D9D  1947 ; Allocate an HRB and an IRP to represent this request, and save the addresses
                                     0D9D  1948 ; that are important for this request.
                                     0D9D  1949 ;
                       54   53   D0  0D9D  1950 	MOVL	R3,R4			; Move the CDT address to a safe place
                          0EA4   30  0DA0  1951 	BSBW	TMSCP$ALLOCATE_HRB	; Create a Host Request Buffer
                         D3 50   E9  0DA3  1952 	BLBC	R0,TMSCP$NO_MEM		; Insufficient memory, shutdown the link
                       8000 8F   A8  0DA6  1953 	BISW	#HRB$M_STATE_INVALID,-	; Change the state of this request 
                         14 A3       0DAA  1954 		HRB$W_STATE(R3)		;  to "current"
                         10 A4   D0  0DAC  1955 	MOVL	CDT$L_PDT(R4),-		; Get the address of the PDT
                         5C A3       0DAF  1956 		HRB$L_PDT(R3)		;  save it to make requests faster
                         5C A4   D0  0DB1  1957 	MOVL	CDT$L_AUXSTRUC(R4),-	; Get the HQB address passed by SCS
                         54 A3       0DB4  1958 		HRB$L_HQB(R3)		; Save it for later reference
                    18 A3   52   D0  0DB6  1959 	MOVL	R2,HRB$L_MSGBUF(R3)	; Save the address of the MSCP packet
                                     0DBA  1960 
                                     0DBA  1961 ;
                                     0DBA  1962 ; Now continue processing this request.
                                     0DBA  1963 ;
                       0C   51   B1  0DBA  1964 	CMPW	R1, #MSCP$K_MIN_SIZ	; Packet big enough?
                            60   19  0DBD  1965 	BLSS	TMSCP$BAD_LEN		; Too small...
                    50   08 A2   9A  0DBF  1966 	MOVZBL	MSCP$B_OPCODE(R2),R0	; Get the op-code from the packet
                            53   13  0DC3  1967 	BEQL	TMSCP$BAD_OPC		; It cannot be zero
                                     0DC5  1968 ;	ASSUME	TMSCP_MAX_OPCODE EQ MSCP$K_OP_REPOS
                       25   50   D1  0DC5  1969 	CMPL	R0,#MSCP$K_OP_REPOS	; The server only supports up to write
                            4E   14  0DC8  1970 	BGTR	TMSCP$BAD_OPC		;  table size limitation
                55   224C'CF40   9A  0DCA  1971 	MOVZBL	TMSCP$COM_PKT_LEN[R0],R5	; Get the expected length
                            46   13  0DD0  1972 	BEQL	TMSCP$BAD_OPC		; If it is zero, then unsupported opcode
                                     0DD2  1973 ;
                                     0DD2  1974 ; This next test assumes all tape controllers return the
                                     0DD2  1975 ; command length value specified by the T/MSCP spec.
                                     0DD2  1976 ; This assumption may not be valid.
                                     0DD2  1977 ;
                       55   51   B1  0DD2  1978 	CMPW	R1,R5			; Is command packet correct length?
                            48   19  0DD5  1979 	BLSS	TMSCP$BAD_LEN
             0A A2   2298'CF40   B3  0DD7  1980 	BITW	TMSCP$MOD_TBL[R0],-	; Compare modifiers we don't allow,
                                     0DDE  1981 		MSCP$W_MODIFIER(R2)	;  to the ones that are set
                            44   12  0DDE  1982 	BNEQ	TMSCP$BAD_MOD		; Bad modifiers used with this op-code
                         09 A2   95  0DE0  1983 	TSTB	MSCP$B_FLAGS(R2)	; The flags field is reserved on 
                            46   12  0DE3  1984 	BNEQ	TMSCP$BAD_FLAGS		;  incoming packets and should be clear
                                     0DE5  1985 
                                     0DE5  1986        	.IF DEFINED DEBUG$LOG
                                     0DE5  1987 
                                     0DE5  1988 	ASSUME TSRV$V_LOG_ENABLD  EQ  0
                                     0DE5  1989 
                                     0DE5  1990 	MOVL	G^SCS$GL_TMSCP,R5	; Get the server data structure
                                     0DE5  1991 	BLBC	TSRV$W_STATE(R5),10$	; Branch if logging is disabled.
                                     0DE5  1992 	BSBW	TMSCP$LOG_CMD_PKT	; Otherwise, log the command packet.
                                     0DE5  1993 	.ENDC	; DEBUG$LOG
                                     0DE5  1994 
                                     0DE5  1995 10$:
                    55   54 A3   D0  0DE5  1996 	MOVL	HRB$L_HQB(R3),R5	; Get the Host Queue Block adress
                            63   0E  0DE9  1997 	INSQUE	HRB$L_FLINK(R3),-	; Link this HRB to the host 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  44
X-2A6A1                         Main Line Routine                        27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (16)

                         24 B5       0DEB  1998 		@HQB$L_HRB_BL(R5)	;  it came from
                         1C A5   B6  0DED  1999 	INCW	HQB$W_NUM_QUE(R5)	; Up the counter of queue elements
                         1C A5   B1  0DF0  2000 	CMPW	HQB$W_NUM_QUE(R5),-	; Check to see if the new value is
                         1E A5       0DF3  2001 		HQB$W_MAX_QUE(R5)	;  higher than any previous value.
                            05   15  0DF5  2002 	BLEQ	20$			; If it's not, continue on.
                         1C A5   B0  0DF7  2003 	MOVW	HQB$W_NUM_QUE(R5),-	; If it is, make the current value
                         1E A5       0DFA  2004 		HQB$W_MAX_QUE(R5)	;  a new high water mark.
                                     0DFC  2005 
                                     0DFC  2006 20$:
                    51   32 A5   D0  0DFC  2007 	MOVL	HQB$L_TSRV(R5),R1	; Server structure address for stats
                     04C4 C140   D6  0E00  2008 	INCL	TSRV$L_OPCOUNT(R1)[R0]	; Receipt of a valid operation code
               50   50   FD 8F   78  0E05  2009 	ASHL	#-3,R0,R0		; Pick up class field.
                                     0E0A  2010 ;
                                     0E0A  2011 ; The TMSCP spec does not neatly divide up the 3 opcode classes of
                                     0E0A  2012 ; IMMEDIATE, SEQUENTIAL(IMMEDIATE COMPLETION), and SEQUENTIAL 
                                     0E0A  2013 ; Therefore, this case statement will take advantage of the only 
                                     0E0A  2014 ; clear division, between IMMEDIATE and the rest of the world. 
                                     0E0A  2015 ;
                                     0E0A  2016 ;	R0  =  Opcode class, scratch
                                     0E0A  2017 ;	R1  =  Scratch
                                     0E0A  2018 ;	R2  =  MSCP packet address
                                     0E0A  2019 ;	R3  =  HRB address
                                     0E0A  2020 ;	R4  =  Scratch
                                     0E0A  2021 ;	R5  =  Scratch
                                     0E0A  2022 ;
                                     0E0A  2023 
                                     0E0A  2024 	CASE	R0, < -			; Dispatch on opcode.
                                     0E0A  2025 		 TMSCP$IMMEDIATE, -	; Immediate.
                                     0E0A  2026 		 TMSCP$SEQUENTIAL, -	; Sequential commands.
                                     0E0A  2027 		 TMSCP$SEQUENTIAL, -	; Sequential commands.
                                     0E0A  2028 		 TMSCP$BAD_OPC, -	; Maintenance commands.		
                                     0E0A  2029 		 TMSCP$SEQUENTIAL >	; Sequential commands.
                  04'  00   50   AF  0E0A       	CASEW	R0,#0,S^#<<30040$-30039$>/2>-1
                                     0E0E       30039$:
                               0024' 0E0E       	.SIGNED_WORD	TMSCP$IMMEDIATE-30039$
                               035F' 0E10       	.SIGNED_WORD	TMSCP$SEQUENTIAL-30039$
                               035F' 0E12       	.SIGNED_WORD	TMSCP$SEQUENTIAL-30039$
                               000A' 0E14       	.SIGNED_WORD	TMSCP$BAD_OPC-30039$
                               035F' 0E16       	.SIGNED_WORD	TMSCP$SEQUENTIAL-30039$
                                     0E18       30040$:
                                     0E18  2030 
                                     0E18  2031 	
                                     0E18  2032 ;
                                     0E18  2033 ; When a packet with illegal modifiers, or an improper length is received,
                                     0E18  2034 ; the bad opcode or other information is placed in the high byte of R0 and
                                     0E18  2035 ; control is passed on to here. The packet received is altered and sent back
                                     0E18  2036 ; with the error information.
                                     0E18  2037 ;
                                     0E18  2038 
                                     0E18  2039 TMSCP$BAD_OPC::
                  50   08   18   9C  0E18  2040 	ROTL	#24,#MSCP$B_OPCODE,R0	; The op-code passed in the MSCP packet
                          1281   31  0E1C  2041 	BRW	TMSCP$PACKET_ERROR	;  was out of bounds or not supported
                                     0E1F  2042 
                                     0E1F  2043 TMSCP$BAD_LEN::
                            50   D4  0E1F  2044 	CLRL	R0			; Since there is no length field to 
                          127C   31  0E21  2045 	BRW	TMSCP$PACKET_ERROR	;  point to, just clear R0
                                     0E24  2046 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  45
X-2A6A1                         Main Line Routine                        27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (16)

                                     0E24  2047 TMSCP$BAD_MOD::
                  50   0A   18   9C  0E24  2048 	ROTL	#24,#MSCP$W_MODIFIER,R0	; Prepare for a modifier error return
                          1275   31  0E28  2049 	BRW	TMSCP$PACKET_ERROR	;  point to, just clear R0
                                     0E2B  2050 
                                     0E2B  2051 TMSCP$BAD_FLAGS::
                  50   09   18   9C  0E2B  2052 	ROTL	#24,#MSCP$B_FLAGS,R0	; The incoming packet did not have the 
                          126E   31  0E2F  2053 	BRW	TMSCP$PACKET_ERROR	;  flags field cleared
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  46
X-2A6A1                         IMMEDIATE class commands                 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (17)

                                     0E32  2056 	.SBTTL	IMMEDIATE class commands
                                     0E32  2057 
                                     0E32  2058 ;+
                                     0E32  2059 ; Functional Description:
                                     0E32  2060 ;
                                     0E32  2061 ; Immediate commands require very little time to complete and do not 
                                     0E32  2062 ; cause any unit context switches. Servers process immediate commands 
                                     0E32  2063 ; without waiting for any other commands to complete. The server guarantees
                                     0E32  2064 ; the completion of all outstanding immediate commands plus an additional
                                     0E32  2065 ; GET COMMAND STATUS within the controller timeout interval.
                                     0E32  2066 ;
                                     0E32  2067 ; Inputs:
                                     0E32  2068 ;
                                     0E32  2069 ;	R0  =  Scratch
                                     0E32  2070 ;	R1  =  Scratch
                                     0E32  2071 ;	R2  =  MSCP packet address
                                     0E32  2072 ;	R3  =  HRB address
                                     0E32  2073 ;	R4  =  Scratch
                                     0E32  2074 ;	R5  =  Scratch
                                     0E32  2075 ;
                                     0E32  2076 ; Outputs:
                                     0E32  2077 ;
                                     0E32  2078 ;	R2  =  MSCP packet address
                                     0E32  2079 ;	R3  =  HRB address
                                     0E32  2080 ;-
                                     0E32  2081 
                                     0E32  2082 TMSCP$IMMEDIATE::
                                     0E32  2083 	.IF DEFINED DEBUG$PC_HISTORY
                                     0E32  2084 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0E32  2085 	.ENDC	   ;DEBUG$PC_HISTORY
                                     0E32  2086 	DISPATCH MSCP$B_OPCODE(R2),-	; Dispatch on command subtype
                                     0E32  2087 		type=B,-		; Data type we are dispatching on
                                     0E32  2088 		prefix=MSCP$K_OP_,<-			; 
                                     0E32  2089 		<ABORT,	TMSCP$ABORT>, -			; Abort command
                                     0E32  2090 		<GTCMD, TMSCP$GET_COMMAND_STATUS>, -	; Get Command Status
                                     0E32  2091 		<GTUNT, TMSCP$GET_UNIT_STATUS>, -	; Get Unit Status
                                     0E32  2092 		<STCON, TMSCP$SET_CONTROLLER_CHAR>, -	; Set Controller 
                                     0E32  2093 		>					;    Characteristics
               03   01   08 A2   8F  0E32       	CASEB	MSCP$B_OPCODE(R2),#$$BASE,#$$LIMIT
                                     0E37       30041$:
                               000F' 0E37       	.SIGNED_WORD	TMSCP$ABORT-30041$
                               00C7' 0E39       	.SIGNED_WORD	TMSCP$GET_COMMAND_STATUS-30041$
                               0142' 0E3B       	.SIGNED_WORD	TMSCP$GET_UNIT_STATUS-30041$
                               0291' 0E3D       	.SIGNED_WORD	TMSCP$SET_CONTROLLER_CHAR-30041$
                                     0E3F  2094 
                  50   08   18   9C  0E3F  2095 	ROTL	#24,#MSCP$B_OPCODE,R0	; Identify the bad field
                          125A   31  0E43  2096 	BRW	TMSCP$PACKET_ERROR	; Return an end msg with error status
                                     0E46  2097 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  47
X-2A6A1                         - ABORT     (- 1 -)                      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (18)

                                     0E46  2100 	.SBTTL	-	ABORT					(- 1 -)
                                     0E46  2101 
                                     0E46  2102 ;+
                                     0E46  2103 ; Functional Description:
                                     0E46  2104 ;
                                     0E46  2105 ; The abort command causes a specified command to be aborted at the earliest
                                     0E46  2106 ; time possible for the server. If the specified request is found and cannot
                                     0E46  2107 ; be aborted immediately because it is outside the servers jurisdiction, a
                                     0E46  2108 ; successful end message is returned and the request is aborted when the 
                                     0E46  2109 ; server regains control of the IRP_CDRP data structure.
                                     0E46  2110 ;
                                     0E46  2111 ;Inputs:
                                     0E46  2112 ;
                                     0E46  2113 ;	R0  =  Scratch
                                     0E46  2114 ;	R1  =  Scratch
                                     0E46  2115 ;	R2  =  MSCP packet address
                                     0E46  2116 ;	R3  =  HRB address
                                     0E46  2117 ;	R4  =  Scratch
                                     0E46  2118 ;	R5  =  Scratch
                                     0E46  2119 ;
                                     0E46  2120 ; Outputs:
                                     0E46  2121 ;
                                     0E46  2122 ;	R0  =  Status to return in the MSCP end message
                                     0E46  2123 ;	R2  =  MSCP packet address
                                     0E46  2124 ;	R3  =  HRB address
                                     0E46  2125 ;-
                                     0E46  2126 
                                     0E46  2127 TMSCP$ABORT::
                                     0E46  2128 	.IF DEFINED DEBUG$PC_HISTORY
                                     0E46  2129 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0E46  2130 	.ENDC	   ;DEBUG$PC_HISTORY
                    55   54 A3   D0  0E46  2131 	MOVL	HRB$L_HQB(R3),R5	; Get the host queue block
                    51   20 A5   DE  0E4A  2132 	MOVAL	HQB$L_HRB_FL(R5),R1	;  and get the HRB queue list head
                       55   51   D0  0E4E  2133 	MOVL	R1,R5			; Prepare to start through the list
                                     0E51  2134 
                                     0E51  2135 	ASSUME	HRB$L_FLINK EQ 0
                                     0E51  2136 
                                     0E51  2137 10$:
                       51   61   D0  0E51  2138 	MOVL	HRB$L_FLINK(R1),R1	; Move on to the next request in line
                       55   51   D1  0E54  2139 	CMPL	R1,R5			; If the new value is not the list head
                            06   12  0E57  2140 	BNEQ	12$			;  check to see if it's the one we want
                       50   00   D0  0E59  2141 	MOVL	#MSCP$K_ST_SUCC,R0	; If we are back at the queue header and 
                          117F   31  0E5C  2142 	BRW	TMSCP$SEND_END		;  still not successful, it doesn't matter
                                     0E5F  2143 
                                     0E5F  2144 12$:
                    54   18 A1   D0  0E5F  2145 	MOVL	HRB$L_MSGBUF(R1),R4	; Get the packet address for the request
                            EC   13  0E63  2146 	BEQL	10$			; Request with no msgbuf cannot be aborted
                         0C A2   D1  0E65  2147 	CMPL	MSCP$L_OUT_REF(R2),-	; Compare the outstanding reference number
                            64       0E68  2148 		MSCP$L_CMD_REF(R4)	;  to the command reference number
                            E6   12  0E69  2149 	BNEQ	10$			; This is not the one... keep looking
                         04 A2   B1  0E6B  2150 	CMPW	MSCP$W_UNIT(R2),-	; Compare the unit number passed
                         04 A4       0E6E  2151 		MSCP$W_UNIT(R4)		;  to the request we found
                            DF   12  0E70  2152 	BNEQ	10$			; If they are not the same keep looking
                                     0E72  2153 
                                     0E72  2154 ;
                                     0E72  2155 ; The request was found, now process it depending on its state
                                     0E72  2156 ;
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  48
X-2A6A1                         - ABORT     (- 1 -)                      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (18)

                            08   BB  0E72  2157 	PUSHR	#^M<R3>			; Save the abort command HRB address
                    54   5C A1   D0  0E74  2158 	MOVL	HRB$L_PDT(R1),R4	; Set up the registers here for the 
                    55   54 A1   D0  0E78  2159 	MOVL	HRB$L_HQB(R1),R5	;  calls to the SCAN SCS routines
                    53   28 A5   D0  0E7C  2160 	MOVL	HQB$L_CDT(R5),R3	;  this way they ser set up only once
                            02   A8  0E80  2161 	BISW	#HRB$M_ABORTWS,-	; Mark the request we just found
                         16 A1       0E82  2162 		HRB$W_FLAGS(R1)		;  as "aborted"
                                     0E84  2163 	DISPATCH HRB$W_STATE(R1),-	; Dispatch based on request state
                                     0E84  2164 		type=W,-		;  which is a word field           
                                     0E84  2165 		prefix=HRB$K_ST_,<-	; 
                                     0E84  2166 		<MSG_WAIT,   30$>,-	; This one will just have to finish
                                     0E84  2167 		<SEQ_WAIT,   30$>,-	; These requests can be yanked immediately
                                     0E84  2168 		<SNDAT_WAIT, 20$>,-	; Sending or receiving data
                                     0E84  2169 		<DRV_WAIT,   70$>,-	; Wait til the drivers done for this one
                                     0E84  2170 		<MAP_WAIT,   70$>,-	; The only way to get this is to yank it
                                     0E84  2171 		>			; Cannot receive an abort for a command
               05   01   14 A1   AF  0E84       	CASEW	HRB$W_STATE(R1),#$$BASE,#$$LIMIT
                                     0E89       30042$:
                               002D' 0E89       	.SIGNED_WORD	30$-30042$
                               002D' 0E8B       	.SIGNED_WORD	30$-30042$
                               000C  0E8D       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               0010' 0E8F       	.SIGNED_WORD	20$-30042$
                               0069' 0E91       	.SIGNED_WORD	70$-30042$
                               0069' 0E93       	.SIGNED_WORD	70$-30042$
                                     0E95  2172 					;  in SNDMS_WAIT state (only ATN msgs)
                                     0E95  2173 
                                     0E95  2174 	BUG_CHECK	MSCPSERV,FATAL	; Trap any strange behavior here!
                               FEFF  0E95       		.WORD	^XFEFF
                               0004' 0E97       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_MSCPSERV!4
                                     0E99  2175 
                                     0E99  2176 ;
                                     0E99  2177 ; Commands that have already started sending or receiving data, or messages
                                     0E99  2178 ; could actually be in one of three states. They could be waiting for RSPIDs,
                                     0E99  2179 ; waiting for message buffers, or they could actually be involved in the 
                                     0E99  2180 ; transfer of data. If they are in one of the first two states, the CDRP
                                     0E99  2181 ; can be pulled off the queue and the request terminated. If, however, the
                                     0E99  2182 ; CDRP is not waiting for a SCS resource, the best we can do is flag the 
                                     0E99  2183 ; request, and abort the command when the transfer completes.
                                     0E99  2184 ;
                                     0E99  2185 
                                     0E99  2186 20$:
                                     0E99  2187 	SCAN_RSPID_WAIT-		; Find the CDRPs in this queue for this
                                     0E99  2188 		action =TMSCP$ABORT_UNHOOK_CDRP ; CDT and if HRB matches, dequeue it
                  50   20AF'CF   9E  0E99       		MOVAB	TMSCP$ABORT_UNHOOK_CDRP, R0
                   00000000'GF   16  0E9E       		JSB	G^SCS$LKP_RDTWAIT
                                     0EA4  2189 	SCAN_MSGBUF_WAIT- 		; If request is waiting for msgbuf
                                     0EA4  2190 		action =TMSCP$ABORT_UNHOOK_CDRP ;  this scan will find it
                  50   20AF'CF   9E  0EA4       		MOVAB	TMSCP$ABORT_UNHOOK_CDRP, R0
                   00000000'GF   16  0EA9       		JSB	G^SCS$LKP_MSGWAIT
                            02   E0  0EAF  2191 	BBS	#HRB$V_DEQUEUED,-	; If the request has been dequeued,
                      17 16 A1       0EB1  2192 		HRB$W_FLAGS(R1),60$	;  the CDRP was found in UNHOOK
                            3C   11  0EB4  2193 	BRB	70$			; Continue with the common code
                                     0EB6  2194 
                                     0EB6  2195 ;
                                     0EB6  2196 ; This command is found on the blocked queue awaiting the completion
                                     0EB6  2197 ; of a sequential command. It can be removed from the queue and the 
                                     0EB6  2198 ; count of queue elements decremented.
                                     0EB6  2199 ;
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  49
X-2A6A1                         - ABORT     (- 1 -)                      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (18)

                                     0EB6  2200 
                                     0EB6  2201 30$:
                         4C A1   D5  0EB6  2202 	TSTL	HRB$L_WAIT_FL(R1)	; Are we still on the blocked queue?
                            10   13  0EB9  2203 	BEQL	60$			; EQL implies not.
                    50   4C A1   0F  0EBB  2204 	REMQUE	HRB$L_WAIT_FL(R1),R0	; Remove the request from the queue
                    50   58 A1   D0  0EBF  2205 	MOVL	HRB$L_UQB(R1),R0	; Get the address of the UQB
                                     0EC3  2206 ;
                                     0EC3  2207 ; If for some reason we land here with the state INVALID (Abort requst while
                                     0EC3  2208 ; a sequetial request is stalled while MAPping or transfering data,
                                     0EC3  2209 ; we don't want to decrement the counter.
                                     0EC3  2210 ; 
                 03 14 A1   0F   E0  0EC3  2211    	BBS	#HRB$V_STATE_INVALID, -	; don't decrement the counter
                                     0EC8  2212    		HRB$W_STATE(R1), -	;  here - do it in UNBLOCK   
                                     0EC8  2213    		60$
                         28 A0   B7  0EC8  2214    	DECW	UQB$W_NUM_QUE(R0)	;  so we can update the counter 
                                     0ECB  2215  
                                     0ECB  2216 ;                                                                        
                                     0ECB  2217 ; Now all the request specific processing is done, do some common processing 
                                     0ECB  2218 ; here, setting the flags and status bits. Then send off the end message for 
                                     0ECB  2219 ; the aborted command.  
                                     0ECB  2220 ; 
                                     0ECB  2221  
                                     0ECB  2222 60$: 
                       8000 8F   A8  0ECB  2223 	BISW	#HRB$M_STATE_INVALID,-	; The state of the request as indicated
                         14 A1       0ECF  2224 		HRB$W_STATE(R1)		;  is no longer valid, change it
                            04   A8  0ED1  2225 	BISW	#HRB$M_DEQUEUED,-	; Mark this request as unhooked... 
                         16 A1       0ED3  2226 		HRB$W_FLAGS(R1)		;  its resounces can be deallocated
                         58 A1   D4  0ED5  2227 	CLRL	HRB$L_UQB(R1)		; Defuse UCB$W_CURRENT update by UNBLOCK
                       50   02   D0  0ED8  2228 	MOVL	#MSCP$K_ST_ABRTD,R0	; Return a status of aborted
                    55   1C A1   D0  0EDB  2229 	MOVL	HRB$L_IRP_CDRP(R1),R5	; Get the address of the IRP
                    55   60 A5   DE  0EDF  2230 	MOVAL	IRP$L_FQFL(R5),R5	;  so we can get the CDRP address
                    52   18 A1   D0  0EE3  2231 	MOVL	HRB$L_MSGBUF(R1),R2	; Get the associated MSCP packet addr
                         E0 A5   D0  0EE7  2232 	MOVL	CDRP$L_ABCNT(R5),-	; Load up the accumulated byte count
                         0C A2       0EEA  2233 		MSCP$L_BYTE_CNT(R2)	;  to show how far we got
                       53   51   D0  0EEC  2234 	MOVL	R1,R3			; Prepare to return the aborted msg
                          10EC   30  0EEF  2235 	BSBW	TMSCP$SEND_END		;  and then send the packet out
                                     0EF2  2236 
                                     0EF2  2237 ;
                                     0EF2  2238 ; Now that the target request has been finished off (or it has been 
                                     0EF2  2239 ; determined that it cannot be finished off at this time), the end 
                                     0EF2  2240 ; message for the abort command itself can be sent out.
                                     0EF2  2241 ;
                                     0EF2  2242 
                                     0EF2  2243 70$:
                            08   BA  0EF2  2244 	POPR	#^M<R3>			; Restore the original HRB address
                       50   00   D0  0EF4  2245 	MOVL	#MSCP$K_ST_SUCC,R0	; Set the status to success
                    52   18 A3   D0  0EF7  2246 	MOVL	HRB$L_MSGBUF(R3),R2	;  restore the message buffer addr
                          10E0   31  0EFB  2247 	BRW	TMSCP$SEND_END		;  and send out the ABORT end message
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  50
X-2A6A1                         - GET COMMAND STATUS   (- 2 -)           27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (19)

                                     0EFE  2250 	.SBTTL	-	GET COMMAND STATUS			(- 2 -)
                                     0EFE  2251 
                                     0EFE  2252 ;+
                                     0EFE  2253 ; Functional Description:
                                     0EFE  2254 ;
                                     0EFE  2255 ; The GET COMMAND STATUS command is used to monitor the progress of
                                     0EFE  2256 ; a command towards completion. The command status of a TMSCP server's
                                     0EFE  2257 ; oldest outstanding command is guaranteed to decrease within the
                                     0EFE  2258 ; controller timeout interval. The GET COMMAND STATUS command always
                                     0EFE  2259 ; succeeds. If the command being referenced is not known, then the server
                                     0EFE  2260 ; returns a zero as the command status.
                                     0EFE  2261 ;
                                     0EFE  2262 ; When the HRB is allocated, a -1 is placed in the command status field. As
                                     0EFE  2263 ; any information is requested or sent from one of the other cluster members, 
                                     0EFE  2264 ; or one of the tapes attached to this processor, the command status value
                                     0EFE  2265 ; is decremented.
                                     0EFE  2266 ;
                                     0EFE  2267 ; For all devices, the the Host Queue Block for the remote host is
                                     0EFE  2268 ; grabbed. The list of HRBs is scanned looking for a match between the RSPID
                                     0EFE  2269 ; and the unit number to the command, to those in the requesting packet. If
                                     0EFE  2270 ; a match is not made, then a zero is returned.
                                     0EFE  2271 ;
                                     0EFE  2272 ; If the unit is a non-TMSCP device, the status in that HRB is returned.
                                     0EFE  2273 ; If the unit is a TMSCP device, the server maintains progress counters that 
                                     0EFE  2274 ; mirror the criteria in the TMSCP class driver's timeout mechanism. If this is
                                     0EFE  2275 ; the first time a GCS is being done on this command, return the status from
                                     0EFE  2276 ; the HRB status counter, which should be -2 or less, and initialize the UQB
                                     0EFE  2277 ; counters. If it is not the first time a GCS was done, if the oldest 
                                     0EFE  2278 ; outstanding command in the local controller has made progress, decrement
                                     0EFE  2279 ; UQB counter and return this value in the MSCP packet.
                                     0EFE  2280 ;
                                     0EFE  2281 ; The flag HRB$V_DRIVER is set any time that a thread forks to the local driver.
                                     0EFE  2282 ; Upon return, this bit is cleared. HRB$L_CMD_STS is decremented in this
                                     0EFE  2283 ; routine as well as strategic locations throughout the server to ensure that
                                     0EFE  2284 ; progress is being reflected.
                                     0EFE  2285 ;
                                     0EFE  2286 ; Inputs:
                                     0EFE  2287 ;
                                     0EFE  2288 ;	R0  =  Scratch
                                     0EFE  2289 ;	R1  =  Scratch
                                     0EFE  2290 ;	R2  =  MSCP packet address
                                     0EFE  2291 ;	R3  =  HRB address
                                     0EFE  2292 ;	R4  =  Scratch
                                     0EFE  2293 ;	R5  =  Scratch
                                     0EFE  2294 ;
                                     0EFE  2295 ; Outputs:
                                     0EFE  2296 ;
                                     0EFE  2297 ;	R0  =  MSCP status to return in the end message
                                     0EFE  2298 ;	R2  =  MSCP packet address
                                     0EFE  2299 ;	R3  =  HRB address
                                     0EFE  2300 ;-
                                     0EFE  2301 
                                     0EFE  2302 TMSCP$GET_COMMAND_STATUS::
                                     0EFE  2303 	.IF DEFINED DEBUG$PC_HISTORY
                                     0EFE  2304 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0EFE  2305 	.ENDC	   ;DEBUG$PC_HISTORY
                                     0EFE  2306 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  51
X-2A6A1                         - GET COMMAND STATUS   (- 2 -)           27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (19)

                    54   54 A3   D0  0EFE  2307 	MOVL	HRB$L_HQB(R3),R4	; R4 <= HQB
                    50   20 A4   DE  0F02  2308 	MOVAL	HQB$L_HRB_FL(R4),R0	; R0 <= HRB queue list head
                       55   50   D0  0F06  2309 	MOVL	R0,R5			; Prepare to start through the list
                                     0F09  2310 
                                     0F09  2311 	ASSUME	HRB$L_FLINK EQ 0
                                     0F09  2312 
                                     0F09  2313 10$:
                       55   65   D0  0F09  2314 	MOVL	HRB$L_FLINK(R5),R5	; Move on to the next request in line
                       50   55   D1  0F0C  2315 	CMPL	R5,R0			; If it is not the the list head
                            05   12  0F0F  2316 	BNEQ	20$			;  continue checking...
                         10 A2   D4  0F11  2317 	CLRL	MSCP$L_CMD_STS(R2)	; If the command was not found,
                            5D   11  0F14  2318 	BRB	150$			;  return a command status of zero
                                     0F16  2319 
                                     0F16  2320 20$:
                    54   18 A5   D0  0F16  2321 	MOVL	HRB$L_MSGBUF(R5),R4	; Get the packet address for the request
                         0C A2   D1  0F1A  2322 	CMPL	MSCP$L_OUT_REF(R2),-	; Compare outstanding reference number
                            64       0F1D  2323 		MSCP$L_CMD_REF(R4)	;  to the command reference number
                            E9   12  0F1E  2324 	BNEQ	10$			; This is not the one... keep looking
                         04 A2   B1  0F20  2325 	CMPW	MSCP$W_UNIT(R2),-	; Compare the unit number passed
                         04 A4       0F23  2326 		MSCP$W_UNIT(R4)		;  to the request we found
                            E2   12  0F25  2327 	BNEQ	10$			; If they are not the same keep looking
                            05   B1  0F27  2328 	CMPW	#HRB$K_ST_DRV_WAIT,-	; If we are waiting for driver to
                         14 A3       0F29  2329 		HRB$W_STATE(R3)		;  return control to us, then we check
                            41   12  0F2B  2330 	BNEQ	140$			;  for progress within the driver by
                                     0F2D  2331 					;  falling through.
                    54   58 A5   D0  0F2D  2332 	MOVL	HRB$L_UQB(R5),R4	; R4 <= UQB
                    51   24 A4   D0  0F31  2333 	MOVL	UQB$L_UCB(R4),R1	; R1 <= UCB
                            05   E1  0F35  2334 	BBC	#DEV$V_MSCP,-		; Fall through if an MSCP device, to
                      31 40 A1       0F37  2335 		UCB$L_DEVCHAR2(R1),130$	;  check if progress if being made in
                                     0F3A  2336 					;  the class driver.
                                     0F3A  2337 					; For now, if it is a non-MSCP class
                                     0F3A  2338 					;  driver, always indicate progress
                                     0F3A  2339 					;  so that lengthy commands such as
                                     0F3A  2340 					;  REPOSITION and ERASE will have time
                                     0F3A  2341 					;  to complete.
                  51   00D8 C1   D0  0F3A  2342 	MOVL	UCB$L_CDDB(R1),R1	; R1 <= CDDB
                                     0F3F  2343 
                                     0F3F  2344 ;	R1 <= CDDB
                                     0F3F  2345 ;	R2 <= MSCP packet address.
                                     0F3F  2346 ;	R4 <= UQB
                                     0F3F  2347 ;	R5 <= HRB containing the I/O request we are doing the GCS on.
                                     0F3F  2348 ;
                                     0F3F  2349 
                         0C A2   D1  0F3F  2350 	CMPL	MSCP$L_OUT_REF(R2),-	; Is this the first time we did a GCS
                       00A0 C4       0F42  2351 		UQB$L_SERV_RSPID(R4)	;  for this packet?
                            12   12  0F45  2352 	BNEQ	110$			; Yes, initialize all counters.
                         2C A1   D1  0F47  2353 	CMPL	CDDB$L_OLDRSPID(R1),-	; Is the class driver's oldest message
                       00A4 C4       0F4A  2354 		UQB$L_CLASS_RSPID(R4)	;  the same as the last time the server
                                     0F4D  2355 					;  was called to do a GCS?
                            10   12  0F4D  2356 	BNEQ	115$			; If the server and class RSPIDs match,
                         30 A1   D1  0F4F  2357 	CMPL	CDDB$L_OLDCMDSTS(R1),-	; is the command status still the same
                       00A8 C4       0F52  2358 		UQB$L_OLD_CLSSTS(R4)	; since the last GCS?
                            0E   12  0F55  2359 	BNEQ	120$			; If not, decrement counter to
                                     0F57  2360 					;  indicate progress.
                            15   11  0F57  2361 	BRB	140$			;  else, no progress is being made in
                                     0F59  2362 					;  the local class driver.
                                     0F59  2363 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  52
X-2A6A1                         - GET COMMAND STATUS   (- 2 -)           27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (19)

                                     0F59  2364 110$:
                         0C A2   D0  0F59  2365 	MOVL	MSCP$L_OUT_REF(R2),-	; Save RSPID of command we are currently
                       00A0 C4       0F5C  2366 		UQB$L_SERV_RSPID(R4)	;  doing a GCS for.
                                     0F5F  2367 
                                     0F5F  2368 115$:
                         2C A1   D0  0F5F  2369 	MOVL	CDDB$L_OLDRSPID(R1),-	; Save RSPID of oldest command that the
                       00A4 C4       0F62  2370 		UQB$L_CLASS_RSPID(R4)	;  local class driver has queued.
                                     0F65  2371 
                                     0F65  2372 120$:
                         30 A1   D0  0F65  2373 	MOVL	CDDB$L_OLDCMDSTS(R1),-	; is the command status still the same
                       00A8 C4       0F68  2374 		UQB$L_OLD_CLSSTS(R4)	; since the last GCS?
                                     0F6B  2375 
                                     0F6B  2376 130$:
                         60 A5   D7  0F6B  2377 	DECL	HRB$L_CMD_STS(R5)	; Indicate that progress is being made.
                                     0F6E  2378 
                                     0F6E  2379 140$:
                         60 A5   D0  0F6E  2380 	MOVL	HRB$L_CMD_STS(R5),-	; Get the status from the target rqst
                         10 A2       0F71  2381 		MSCP$L_CMD_STS(R2)	;  and put it in the requesting packet
                                     0F73  2382 
                                     0F73  2383 150$:
                       50   00   D0  0F73  2384 	MOVL	#MSCP$K_ST_SUCC,R0	; Zero means the command was successful
                          1065   31  0F76  2385 	BRW	TMSCP$SEND_END		; Return an end packet with status
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  53
X-2A6A1                         - GET UNIT STATUS    (- 3 -)             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (20)

                                     0F79  2388 	.SBTTL	-	GET UNIT STATUS				(- 3 -)
                                     0F79  2389 
                                     0F79  2390 ;+
                                     0F79  2391 ; Functional Description:
                                     0F79  2392 ;
                                     0F79  2393 ; The GET UNIT STATUS command returns the current state of a unit plus
                                     0F79  2394 ; certain unit characteristics.  In particular, this command is used to
                                     0F79  2395 ; obtain host settable characteristics and those fixed unit characteristics
                                     0F79  2396 ; that are not normally needed by the class driver. 
                                     0F79  2397 ;
                                     0F79  2398 ; Inputs:
                                     0F79  2399 ;
                                     0F79  2400 ;	R0  =  Scratch
                                     0F79  2401 ;	R1  =  Scratch
                                     0F79  2402 ;	R2  =  MSCP packet address
                                     0F79  2403 ;	R3  =  HRB address
                                     0F79  2404 ;	R4  =  Scratch
                                     0F79  2405 ;	R5  =  Scratch
                                     0F79  2406 ;
                                     0F79  2407 ; Outputs:
                                     0F79  2408 ;
                                     0F79  2409 ;	R0  =  Completion status
                                     0F79  2410 ;	R2  =  MSCP packet address
                                     0F79  2411 ;	R3  =  HRB address
                                     0F79  2412 ;-
                                     0F79  2413 
                                     0F79  2414 TMSCP$GET_UNIT_STATUS::
                                     0F79  2415 	.IF DEFINED DEBUG$PC_HISTORY
                                     0F79  2416 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0F79  2417 	.ENDC	   ;DEBUG$PC_HISTORY
                    50   54 A3   D0  0F79  2418 	MOVL	HRB$L_HQB(R3),R0	; Get the address of the HQB to
                            01   E1  0F7D  2419 	BBC	#HQB$V_V5CL,-		; If this request is from an old class
                      17 12 A0       0F7F  2420 		HQB$W_FLAGS(R0),5$	; driver, we're in trouble.
                                     0F82  2421 
                                     0F82  2422 ;
                                     0F82  2423 ; The unit number has bit 14 set to indicate that the unit no. is a Server Local
                                     0F82  2424 ; Unit Number (SLUN).  After the bit is cleared, the unit number that remains
                                     0F82  2425 ; is used as an index into the unit table to locate the address of the Unit 
                                     0F82  2426 ; Queue Block (UQB) for this tape.  If the next unit specifier was set
                                     0F82  2427 ; and the table location for the specified unit number is zero, the remaining
                                     0F82  2428 ; locations are examined until a nonzero value is found or the end of the 
                                     0F82  2429 ; table is reached.  The only occasions when SLUN should not be set is if
                                     0F82  2430 ; the unit is 0 (NOP sent by class driver to prohibit timeout) or if the
                                     0F82  2431 ; unit is 1 (used at the very start of unit polling to find the first unit).
                                     0F82  2432 ;
                                     0F82  2433 
                    55   32 A0   D0  0F82  2434 	MOVL	HQB$L_TSRV(R0),R5	;  get the server structure address
                    50   04 A2   3C  0F86  2435 	MOVZWL	MSCP$W_UNIT(R2),R0	; Pick up the unit number passed
                            2E   13  0F8A  2436 	BEQL	40$			; If unit 0, return harmless offline
                            00   E1  0F8C  2437 	BBC	#MSCP$V_MD_NXUNT,-	; If the next unit modifier is clear
                         0A A2       0F8E  2438 		MSCP$W_MODIFIER(R2),-	;  branch to process the specified unit
                            2F       0F90  2439 		80$			;  with common code
                                     0F91  2440 
                                     0F91  2441 ;
                                     0F91  2442 ; The next unit modifier requests that the controller return the status of the
                                     0F91  2443 ; next unit (in order of ascending unit numbers) that the controller knows to
                                     0F91  2444 ; exist and whose unit number is greater than or equal to the unit number 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  54
X-2A6A1                         - GET UNIT STATUS    (- 3 -)             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (20)

                                     0F91  2445 ; specified in the command.
                                     0F91  2446 ;
                                     0F91  2447 
                    0A 50   0E   E4  0F91  2448 	BBSC	#MSCP$V_SLUN,R0,20$	; Branch if SLUN set, clear it for index
                            50   D7  0F95  2449 	DECL	R0			; Is this the start of unit polling?
                            06   13  0F97  2450 	BEQL	20$			; Branch if unit was = 1, start lookup
                                     0F99  2451 
                                     0F99  2452 5$:
                                     0F99  2453 	BUG_CHECK MSCPSERV, FATAL	; Wrong class driver 
                               FEFF  0F99       		.WORD	^XFEFF
                               0004' 0F9B       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_MSCPSERV!4
                                     0F9D  2454 
                                     0F9D  2455 10$:
                            50   D6  0F9D  2456 	INCL	R0			; Bump to next "unit" in table
                                     0F9F  2457 
                                     0F9F  2458 20$:
                  50   0100 8F   B1  0F9F  2459 	CMPW	#MAX_UNITS,R0		; Make sure "unit" specified is in table
                            11   1B  0FA4  2460 	BLEQU	30$			; If not, end polling with unit 0
                54   00C4 C540   D0  0FA6  2461 	MOVL	TSRV$L_UNITS(R5)[R0],R4	; Find the UQB address in the table
                            EF   13  0FAC  2462 	BEQL	10$			; Try next unit if there isn't one here
                    58 A3   54   D0  0FAE  2463 	MOVL	R4,HRB$L_UQB(R3)	; Save away the UQB address we found,
                         12 A4   D6  0FB2  2464 	INCL	UQB$W_CURRENT(R4)	;  increment the current count for unit,
                            0F   11  0FB5  2465 	BRB	90$			;  and continue in the common code
                                     0FB7  2466 
                                     0FB7  2467 ;
                                     0FB7  2468 ; If there are no units that are both known to the controller and whose
                                     0FB7  2469 ; unit numbers are greater than or equal to the unit number specified in
                                     0FB7  2470 ; the command message, then zero is returned in the "unit number" field
                                     0FB7  2471 ; of the end message.  Since in SLUN versions there is no true unit "0",
                                     0FB7  2472 ; the rest of the status is set harmlessly to OFFLN via TMSCP$ERROR_NO_UNIT.
                                     0FB7  2473 ;
                                     0FB7  2474 
                                     0FB7  2475 30$:
                         04 A2   B4  0FB7  2476 	CLRW	MSCP$W_UNIT(R2)		; Give special code (Unit 0)
                                     0FBA  2477 
                                     0FBA  2478 40$:
                       50   03   D0  0FBA  2479 	MOVL	#MSCP$K_ST_OFFLN,R0	; Return a status of offline
                          101E   31  0FBD  2480 	BRW	TMSCP$SEND_END		; Let the client find another path
                                     0FC0  2481 
                                     0FC0  2482 ;
                                     0FC0  2483 ; The request is for a specific unit
                                     0FC0  2484 ;
                                     0FC0  2485 
                                     0FC0  2486 80$:
                          0FA8   30  0FC0  2487 	BSBW	TMSCP$FIND_UQB		; Find the UQB for this request
                         F4 50   E9  0FC3  2488 	BLBC	R0,40$			; Branch if no such unit found.
                                     0FC6  2489 
                                     0FC6  2490 ;
                                     0FC6  2491 ; A UQB address was found and has been placed in the HRB.
                                     0FC6  2492 ;
                                     0FC6  2493 
                                     0FC6  2494 90$:
                    54   58 A3   D0  0FC6  2495 	MOVL	HRB$L_UQB(R3),R4	; Get the address of the UQB
                         5E A4   B0  0FCA  2496 	MOVW	UQB$W_SLUN(R4),-	; Assume we are using the new driver
                         04 A2       0FCD  2497 		MSCP$W_UNIT(R2)		; Unit whose status we are returning
                    50   24 A4   D0  0FCF  2498 	MOVL	UQB$L_UCB(R4),R0	; Get the UCB address for this unit
                       00A0 C0   D0  0FD3  2499 	MOVL	UCB$L_MEDIA_ID(R0),-	; Get the media identifier out of the
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  55
X-2A6A1                         - GET UNIT STATUS    (- 3 -)             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (20)

                         1C A2       0FD7  2500 		MSCP$L_MEDIA_ID(R2)	;  UCB just in case it changes!
                         26 A2   94  0FD9  2501 	CLRB	MSCP$B_FREECAP(R2)	; Unknown amount of free capacity.
                                     0FDC  2502 ;	CLRL	MSCP$B_FMTR_SRV(R2)	; MSCP$B_FMTR_SVR <= 0
                                     0FDC  2503 					; MSCP$B_FMTR_HVR <= 0
                                     0FDC  2504 					; MSCP$B_UNIT_SVR <= 0
                                     0FDC  2505 					; MSCP$B_UNIT_HVR <= 0
                                     0FDC  2506 
                                     0FDC  2507 ;
                                     0FDC  2508 ;		The following fields are documented in Tables C-1 and C-2
                                     0FDC  2509 ;		in the TMSCP specification.
                                     0FDC  2510 ;
                                     0FDC  2511 
                                     0FDC  2512 	GET_TAPE_FORMENU	R0	; Supported tape formats.
                    40 A0   05   E1  0FDC       	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                            07       0FE0       		UCB$L_DEVCHAR2(R0), 30043$	; Not MSCP tape - branch.
                 24 A2   54 A0   B0  0FE1       	MOVW	UCB$W_TU_FORMENU(R0), -	; Steal tape formenu from UCB.
                            19   11  0FE6       	BRB	30044$
                                     0FE8       30043$:
                       7E   50   7D  0FE8       	MOVQ	R0, -(SP)
                       05   08   EF  0FEB       	EXTZV	# MT$V_DENSITY, -		; Extract VMS density from the UCB.
                         50 A0       0FEE       		# MT$S_DENSITY, -
                            50       0FF0       		UCB$L_DEVDEPEND(R0), R0
                            51   D4  0FF1       	CLRL	R1				; Use default VMS density table.
                          1171   30  0FF3       	BSBW	TMSCP$VMSTOMSCP_DENS		; Convert tape density value.
                    24 A2   51   90  0FF6       	MOVB	R1, MSCP$W_FORMENU(R2)		; Return the current tape format.
                    25 A2   51   90  0FFA       	MOVB	R1, 1+MSCP$W_FORMENU(R2)	; Return the supported densities.
                       50   8E   7D  0FFE       	MOVQ	(SP)+, R0
                                     1001       30044$:
                                     1001  2513 	GET_TAPE_FORMAT		R0	; Current tape format.
                    40 A0   05   E1  1001       	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                            08       1005       		UCB$L_DEVCHAR2(R0), 30045$	; Not MSCP tape - branch.
               20 A2   0110 C0   B0  1006       	MOVW	UCB$W_TU_FORMAT(R0), -	; Steal tape format from UCB.
                            15   11  100C       	BRB	30046$
                                     100E       30045$:
                       7E   50   7D  100E       	MOVQ	R0, -(SP)
                       05   08   EF  1011       	EXTZV	# MT$V_DENSITY, -		; Extract VMS density from the UCB.
                         50 A0       1014       		# MT$S_DENSITY, -
                            50       1016       		UCB$L_DEVDEPEND(R0), R0
                            51   D4  1017       	CLRL	R1				; Use default VMS density table.
                          114B   30  1019       	BSBW	TMSCP$VMSTOMSCP_DENS		; Convert tape density value.
                    20 A2   51   B0  101C       	MOVW	R1, MSCP$W_FORMAT(R2)		; Return the tape format.
                       50   8E   7D  1020       	MOVQ	(SP)+, R0
                                     1023       30046$:
                                     1023  2514 	GET_TAPE_SPEED		R0, -	; Data rate in kilobytes per second.
                                     1023  2515 				MSCP$W_FORMAT(R2)
                    40 A0   05   E1  1023       	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                            08       1027       		UCB$L_DEVCHAR2(R0), 30047$	; Not MSCP tape - branch.
               22 A2   0112 C0   B0  1028       	MOVW	UCB$W_TU_SPEED(R0), -	; Steal tape speed from UCB.
                            17   11  102E       	BRB	30048$
                                     1030       30047$:
                       7E   50   7D  1030       	MOVQ	R0, -(SP)
                    51   20 A2   3C  1033       	MOVZWL	MSCP$W_FORMAT(R2), R1			; Get the MSCP tape format.
                       08   18   EF  1037       	EXTZV	# MT$V_SPEED, -			; Extract VMS tape speed from R0
                         50 A0       103A       		# MT$S_SPEED, -			; and return as the tape speed.
                            50       103C       		UCB$L_DEVDEPEND(R0), R0
                          1198   30  103D       	BSBW	TMSCP$SPEEDTOMSCP		; Convert speed value.
                    22 A2   50   B0  1040       	MOVW	R0, MSCP$W_SPEED(R2)		; Return the tape speed.
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  56
X-2A6A1                         - GET UNIT STATUS    (- 3 -)             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (20)

                       50   8E   7D  1044       	MOVQ	(SP)+, R0
                                     1047       30048$:
                                     1047  2516 
                                     1047  2517 ;
                                     1047  2518 ; If this is an MSCP device and it is in mount verification or no connection
                                     1047  2519 ; return a status of offline.
                                     1047  2520 ;
                                     1047  2521 
                            0E   E0  1047  2522 	BBS	#UCB$V_MNTVERIP,-	; If the volume is in local mount
                      1B 78 A0       1049  2523 		UCB$W_STS(R0),125$	;  verification then offline
                            05   E1  104C  2524 	BBC	#DEV$V_MSCP,-		; If this is a MSCP device,
                      1E 40 A0       104E  2525 		UCB$L_DEVCHAR2(R0),140$	;  and there are already requests
                  51   00D8 C0   D0  1051  2526 	MOVL	UCB$L_CDDB(R0),R1	; Follow the link to its CDDB
                            07   E0  1056  2527 	BBS	#CDDB$V_NOCONN,-	; If there is no connection to the
                      06 12 A1       1058  2528 		CDDB$W_STATUS(R1),120$	;  device, set it offline
                            04   91  105B  2529 	CMPB	#MSCP$K_CM_EMULA,-	; Check to see if the controller
                         26 A1       105D  2530 		CDDB$B_CNTRLMDL(R1)	;  model is an emulator (server)
                            0E   12  105F  2531 	BNEQ	140$			; If it is, leave it offline
                                     1061  2532 
                                     1061  2533 120$:
                       50   03   D0  1061  2534 	MOVL	#MSCP$K_ST_OFFLN,R0	;  Return a status of offline and let
                          0F77   31  1064  2535 	BRW	TMSCP$SEND_END		;  the client find another path
                                     1067  2536 
                                     1067  2537 125$:
                       50   03   D0  1067  2538 	MOVL	#MSCP$K_ST_OFFLN,R0	; Return a status of offline, but
                       50   20   A8  106A  2539 	BISW	#MSCP$M_SC_NOVOL,R0	;  reflect doubt about the volume
                            47   11  106D  2540 	BRB	170$			;  UCB will be built on client node
                                     106F  2541 ;
                                     106F  2542 ; Everything is alright with this unit. The MSCP end message
                                     106F  2543 ; is now filled in and returned to the client node.
                                     106F  2544 ;
                                     106F  2545 	ASSUME	UQB$K_ST_AVAILABLE  EQ  MSCP$K_ST_AVLBL
                                     106F  2546 	ASSUME	UQB$K_ST_OFFLINE  EQ  MSCP$K_ST_OFFLN
                                     106F  2547 
                                     106F  2548 140$:
                    50   0C A4   3C  106F  2549 	MOVZWL	UQB$W_STATE(R4),R0	; Get the state for offline or avail
                       04   50   B1  1073  2550 	CMPW	R0, #UQB$K_ST_AVAILABLE	; State of the device available?
                            3E   13  1076  2551 	BEQL	170$			; If eql yes, return it
                         0C A4   B1  1078  2552 	CMPW	UQB$W_STATE(R4),-	; If the state of the device
                            02       107B  2553 		#UQB$K_ST_ONLINE	;  is online, skip on down
                            21   13  107C  2554 	BEQL	160$			; The status in R0 will be fine
                                     107E  2555 
                                     107E  2556 ;
                                     107E  2557 ; The status of this device as stored in the UQB indicates that some sort of
                                     107E  2558 ; error has been encountered that has caused this device to go offline. The
                                     107E  2559 ; server must now determine if the device is still offline, or may now be
                                     107E  2560 ; made available to client nodes.
                                     107E  2561 ;
                    51   24 A4   D0  107E  2562 	MOVL	UQB$L_UCB(R4),R1	; Get the address of the UCB
                            04   E1  1082  2563 	BBC	#UCB$V_ONLINE,-		; If the device is not UCB online
                      2F 78 A1       1084  2564 		UCB$W_STS(R1),170$	;  leave the device offline for now
                            05   E1  1087  2565 	BBC	#DEV$V_MSCP,-		; Don't try any of the remaining tests
                      2A 40 A1       1089  2566 		UCB$L_DEVCHAR2(R1),170$	;  unless this is a class driver!
                  51   00D8 C1   D0  108C  2567 	MOVL	UCB$L_CDDB(R1),R1	;  and follow the link to its CDDB
                            04   91  1091  2568 	CMPB	#MSCP$K_CM_EMULA,-	; Check to see if the controller
                         26 A1       1093  2569 		CDDB$B_CNTRLMDL(R1)	;  model is an emulator (server)
                            1F   13  1095  2570 	BEQL	170$			; If it is, leave it offline
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  57
X-2A6A1                         - GET UNIT STATUS    (- 3 -)             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (20)

                                 B3  1097  2571 	BITW	#<CDDB$M_NOCONN! -	; If there is no connection or
                                     1098  2572 		CDDB$M_DISABLED>,-	; the controller is disabled
               12 A1   2080 8F       1098  2573 		CDDB$W_STATUS(R1)	;  then leave it offline
                            17   12  109D  2574 	BNEQ	170$			; If neq offline
                                     109F  2575 
                                     109F  2576 160$:
                       50   04   D0  109F  2577 	MOVL	#UQB$K_ST_AVAILABLE,R0	; Assume the device is available
                         70 A4   D1  10A2  2578 	CMPL	UQB$L_ONLINE_HQB(R4),-	; Does the host who requested this GUS
                         54 A3       10A5  2579 		HRB$L_HQB(R3)		;  have this unit online?
                            0D   12  10A7  2580 	BNEQ	170$			; If not, return status in R0 (offline)
                       50   00   3C  10A9  2581 	MOVZWL	#MSCP$K_ST_SUCC,R0	; Return a status of success
                            08   E1  10AC  2582 	BBC	#MSCP$V_UF_WRTPD,-	; If Data Safety Write Protect 
                      05 16 A4       10AE  2583 		UQB$W_UNIT_FLAGS(R4),170$;  due to some condition in the unit,
                  50   1000 8F   A8  10B1  2584 	BISW	#MSCP$M_SC_RDONY,R0	;  then set Read Only subcode in R0.
                                     10B6  2585 
                                     10B6  2586 170$:
                         16 A4   B0  10B6  2587 	MOVW	UQB$W_UNIT_FLAGS(R4),-	; Put the set unit flags in the
                         0E A2       10B9  2588 		MSCP$W_UNT_FLGS(R2)	;  end packet to return
                 0C A2   14 A4   D0  10BB  2589 	MOVL	UQB$W_MULT_UNIT(R4), -	;  the tape class driver, so stop here.
                                     10C0  2590 		MSCP$W_MULT_UNT(R2)	; Copy mult_unit & unit_flags
                 14 A2   18 A4   7D  10C0  2591 	MOVQ	UQB$Q_UNIT_ID(R4), -	;  
                                     10C5  2592 		MSCP$Q_UNIT_ID(R2)	; Copy unit identifier
                          0F16   31  10C5  2593 	BRW	TMSCP$SEND_END
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  58
X-2A6A1                         - SET CONTROLLER CHARACTERISTICS  (- 4 - 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (21)

                                     10C8  2596 	.SBTTL	-	SET CONTROLLER CHARACTERISTICS		(- 4 -)
                                     10C8  2597 
                                     10C8  2598 ;+
                                     10C8  2599 ; Functional Description:
                                     10C8  2600 ;
                                     10C8  2601 ; This command is the mechanism whereby certain host settable controller
                                     10C8  2602 ; characteristics are determined. The information sent to the server by 
                                     10C8  2603 ; the host includes; controller flags, the host timeout interval, the
                                     10C8  2604 ; current time and date on the host system, and controller dependant
                                     10C8  2605 ; tuning parameters. In the end message, the server returns the following
                                     10C8  2606 ; information as it is currently set; the controller flags, the controller
                                     10C8  2607 ; timeout interval, the controller hardware and software revision numbers,
                                     10C8  2608 ; and a unique MSCP device identifier.
                                     10C8  2609 ;
                                     10C8  2610 ; Inputs:
                                     10C8  2611 ;
                                     10C8  2612 ;	R0  =  Scratch
                                     10C8  2613 ;	R1  =  Scratch
                                     10C8  2614 ;	R2  =  MSCP packet address
                                     10C8  2615 ;	R3  =  HRB address
                                     10C8  2616 ;	R4  =  Scratch
                                     10C8  2617 ;	R5  =  Scratch
                                     10C8  2618 ;
                                     10C8  2619 ; Outputs:
                                     10C8  2620 ;
                                     10C8  2621 ;	R0  =  Completion status
                                     10C8  2622 ;	R2  =  MSCP packet address
                                     10C8  2623 ;	R3  =  HRB address
                                     10C8  2624 ;-
                                     10C8  2625 
                                     10C8  2626 TMSCP$SET_CONTROLLER_CHAR::
                                     10C8  2627 	.IF DEFINED DEBUG$PC_HISTORY
                                     10C8  2628 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     10C8  2629 	.ENDC	   ;DEBUG$PC_HISTORY
                    54   54 A3   D0  10C8  2630 	MOVL	HRB$L_HQB(R3),R4	; Get the HQB address so we can
                    55   32 A4   D0  10CC  2631 	MOVL	HQB$L_TSRV(R4),R5	;  get the address of the server struct
                         0C A2   B1  10D0  2632 	CMPW	MSCP$W_VERSION(R2),-	; This is a check to assure the
                         3C A5       10D3  2633 		TSRV$W_VERSION(R5)	;  compatability of versions of MSCP
                            07   13  10D5  2634 	BEQL	10$			; We are speaking the same language
                  50   0C   18   9C  10D7  2635 	ROTL	#24,#MSCP$W_VERSION,R0	; A change has been made to MSCP to
                          0FC2   31  10DB  2636 	BRW	TMSCP$PACKET_ERROR	;  make it no longer downward compat
                                     10DE  2637 
                                     10DE  2638 10$:
                         0E A2   B0  10DE  2639 	MOVW	MSCP$W_CNT_FLGS(R2),-	; Copy the controller flag values
                         0E A4       10E1  2640 		HQB$W_CNT_FLGS(R4)	;  to the server structure
                                     10E3  2641 	READ_SYSTIME -			; Get the time this command was
                                     10E3  2642 		HQB$Q_TIME(R4)		;  issued on the remote machine
                       7E   12   DB  10E3       	 MFPR	S^#PR$_IPL,-(SP)
                10 00000000'GF   E9  10E6       	BLBC	G^SMP$GL_FLAGS,30051$
                            50   DD  10ED       	 PUSHL	R0
                       50   23   9A  10EF       	 MOVZBL	S^#SPL$C_HWCLK,R0
                   00000000'GF   16  10F2       	 JSB	G^SMP$ACQUIRE
                            50 8ED0  10F8       	 POPL	R0
                            03   11  10FB       	BRB	30052$
                                     10FD       30051$:
                       12   18   DA  10FD       		MTPR	S^#IPL$_HWCLK,S^#PR$_IPL
                                     1100       30052$:
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  59
X-2A6A1                         - SET CONTROLLER CHARACTERISTICS  (- 4 - 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (21)

           14 A4   00000000'GF   7D  1100       	  MOVQ	G^EXE$GQ_SYSTIME,HQB$Q_TIME(R4)
                0E 00000000'GF   E9  1108       	BLBC	G^SMP$GL_FLAGS,30058$
                            50   DD  110F       	 PUSHL	R0
                       50   23   9A  1111       	 MOVZBL	S^#SPL$C_HWCLK,R0
                   00000000'GF   16  1114       	 JSB	G^SMP$RELEASE
                            50 8ED0  111A       	 POPL	R0
                                     111D       30058$:
                       12   8E   DA  111D       	 MTPR	(SP)+,S^#PR$_IPL
                         10 A2   B0  1120  2643 	MOVW	MSCP$W_HST_TMO(R2),-	; Copy the host access timeout
                         10 A4       1123  2644 		HQB$W_HTIMO(R4)		;  interval to the HQB
                            18   13  1125  2645 	BEQL	30$			; Disables host access timeouts
               00FF 8F   10 A4   B1  1127  2646 	CMPW	HQB$W_HTIMO(R4),#255	; "Treat all values greater than 255
                            06   15  112D  2647 	BLEQ	20$			;  as if 255 had been specified"
               10 A4   00FF 8F   B0  112F  2648 	MOVW	#255,HQB$W_HTIMO(R4)	; 			- the spec
                                     1135  2649 
                                     1135  2650 20$:
                    0A   10 A4   B1  1135  2651 	CMPW	HQB$W_HTIMO(R4),#10	; "Treat all values between 1 and 9
                            04   18  1139  2652 	BGEQ	30$			;  as if 10 had been specified"
                    10 A4   0A   B0  113B  2653 	MOVW	#10,HQB$W_HTIMO(R4)	; 			- the spec
                                     113F  2654 
                                     113F  2655 30$:
                                     113F  2656 
                                     113F  2657 ;
                                     113F  2658 ; Return controller information to host
                                     113F  2659 ;
                                     113F  2660 
                   00000000'GF   90  113F  2661 	MOVB	G^CLU$GL_TAPE_ALLOCLS,-	; Transfer the allocation class
                         04 A2       1145  2662 		MSCP$B_CNT_ALCS(R2)	; 
                         3C A5   B0  1147  2663 	MOVW	TSRV$W_VERSION(R5),-	; Return all the current settings of
                         0C A2       114A  2664 		MSCP$W_VERSION(R2)	;  the server software version number,
                         3E A5   B0  114C  2665 	MOVW	TSRV$W_CFLAGS(R5),-	; 
                         0E A2       114F  2666 		MSCP$W_CNT_FLGS(R2)	;  the server controller flag settings,
                       01FF 8F   B0  1151  2667 	MOVW	#<SERVER_TIMEOUT*2>+1,-	;  and the controller timeout value
                         10 A2       1155  2668 		MSCP$W_CNT_TMO(R2)
                         44 A5   7D  1157  2669 	MOVQ	TSRV$Q_CTRL_ID(R5),-	; Also, uniquely identify this MSCP
                         14 A2       115A  2670 		MSCP$Q_CNT_ID(R2)	;  device to the host
                         1C A2   D4  115C  2671 	CLRL	MSCP$L_MAXBCNT(R2)	; Class driver will use 64K as max.
                                     115F  2672 
                                     115F  2673 	ASSUME	SOFTWARE_REV  GT  0	; Software and hardware revisions
                                     115F  2674 	ASSUME	SOFTWARE_REV  LE  255	;  are byte fields. The following
                                     115F  2675 	ASSUME	HARDWARE_REV  GT  0	;  two MOVB instructions are not a MOVW
                                     115F  2676 	ASSUME	HARDWARE_REV  LE  255	;  for easier patching, if necessary.
                                     115F  2677 
                    12 A2   06   90  115F  2678 	MOVB	#SOFTWARE_REV, -	; Set software version number in
                                     1163  2679 		MSCP$B_CNT_SVR(R2)	;  end message.
                    13 A2   01   90  1163  2680 	MOVB	#HARDWARE_REV, -	; Set hardware version number in
                                     1167  2681 		MSCP$B_CNT_HVR(R2)	;  end message as well.
                                     1167  2682 
                       50   00   D0  1167  2683 	MOVL	#MSCP$K_ST_SUCC,R0	; Set success
                                     116A  2684 ;	CLRL	HRB$L_UQB(R3)		;  make sure the unblock won't work
                          0E71   31  116A  2685 	BRW	TMSCP$SEND_END		;  and send off the end packet
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  60
X-2A6A1                         SEQUENTIAL class commands                27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (22)

                                     116D  2688 	.SBTTL	SEQUENTIAL class commands
                                     116D  2689 
                                     116D  2690 ;+
                                     116D  2691 ; Functional Description:
                                     116D  2692 ;
                                     116D  2693 ; All TMSCP command that are not immediate are sequential. This section 
                                     116D  2694 ; of code sets up for sequential command processing.  Steps are 
                                     116D  2695 ; taken in this routine to asure sequentiality. When a sequential command is 
                                     116D  2696 ; in progress, no other commands received may begin execution until the 
                                     116D  2697 ; completion of the sequential command. These commands are queued up on
                                     116D  2698 ; the UQB$L_BLOCKED queue and retrieved in a FIFO manner.
                                     116D  2699 ;
                                     116D  2700 ; There are two types of SEQUENTIAL commands, SEQUENTIAL and SEQUENTIAL 
                                     116D  2701 ; IMMEDIATE. SEQUENTIAL IMMEDIATE commands can be used so that lengthy
                                     116D  2702 ; non-data transfer operations complete asynchronously. These commands
                                     116D  2703 ; are ERASE, REPOSITION (rewind) and AVAILABLE. When the server receives
                                     116D  2704 ; one of these commands, it sets the immediate completion modifier in
                                     116D  2705 ; the function code and sends the request off to the local driver. Upon
                                     116D  2706 ; receipt of the completed I/O, the server sends the end message back to
                                     116D  2707 ; the requesting host. So in this case, immediate completion is accomplished
                                     116D  2708 ; by the actual controller, not the emulator.
                                     116D  2709 ;
                                     116D  2710 ; SEQUENTIAL IMMEDIATE commands can also be executed as "write-back" caching
                                     116D  2711 ; enabled "write" type commands. In this case, the TMSCP server emulator will
                                     116D  2712 ; return the end message to the remote host as soon as the data for the write
                                     116D  2713 ; data operation is completely buffered by the TMSCP server in a local buffer
                                     116D  2714 ; These commands are WRITE, WRITE TAPE MARK, and ERASE GAP.
                                     116D  2715 ; 
                                     116D  2716 ; Inputs:
                                     116D  2717 ;
                                     116D  2718 ;	R0  =  Scratch
                                     116D  2719 ;	R1  =  Scratch
                                     116D  2720 ;	R2  =  MSCP packet address
                                     116D  2721 ;	R3  =  HRB address
                                     116D  2722 ;	R4  =  Scratch
                                     116D  2723 ;	R5  =  Scratch
                                     116D  2724 ;
                                     116D  2725 ; Outputs:
                                     116D  2726 ;
                                     116D  2727 ;	R2  =  MSCP packet address
                                     116D  2728 ;	R3  =  HRB address
                                     116D  2729 ;	R4  =  UQB address
                                     116D  2730 ;-
                                     116D  2731 
                                     116D  2732 TMSCP$SEQUENTIAL::
                                     116D  2733 	.IF DEFINED DEBUG$PC_HISTORY
                                     116D  2734 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     116D  2735 	.ENDC	   ;DEBUG$PC_HISTORY
                                     116D  2736 
                                     116D  2737 10$:
                          0DFB   30  116D  2738 	BSBW	TMSCP$FIND_UQB		; Find the UQB that corresponds to 
                         03 50   E8  1170  2739 	BLBS	R0,TMSCP$SEQ_ALT	;  this request and put addr in HRB
                          0F24   31  1173  2740 	BRW	TMSCP$ERROR_NO_UNIT	; Return an error (see TMSCP$SEND_END)
                                     1176  2741 
                                     1176  2742 ;
                                     1176  2743 ; This alternate entry point into the processing of a sequential command is
                                     1176  2744 ; used during the cleanup of a virtual circuit error. Control is passed here
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  61
X-2A6A1                         SEQUENTIAL class commands                27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (22)

                                     1176  2745 ; with  the HRB address, and the UQB address, but there is no MSCP packet
                                     1176  2746 ; to be used.
                                     1176  2747 ;
                                     1176  2748 
                                     1176  2749 TMSCP$SEQ_ALT::
                    54   58 A3   D0  1176  2750 	MOVL	HRB$L_UQB(R3),R4	; Get the address of the UQB
                                     117A  2751 
                                     117A  2752 ;
                                     117A  2753 ;		Serialize all the sequential commands.
                                     117A  2754 ;
                                     117A  2755 
                          0C14   30  117A  2756 	BSBW	TMSCP$SEQ_STALL		; Serialize all the sequential commands.
                                     117D  2757 
                                     117D  2758 ;
                                     117D  2759 ;		R0  =  Scratch
                                     117D  2760 ;		R1  =  Scratch
                                     117D  2761 ;		R2  =  Scratch
                                     117D  2762 ;		R3  =  HRB address
                                     117D  2763 ;		R4  =  UQB address, scratch
                                     117D  2764 ;		R5  =  Scratch
                                     117D  2765 ;
                                     117D  2766 
                    52   18 A3   D0  117D  2767 	MOVL	HRB$L_MSGBUF(R3),R2	; Get the address of the message buffer
                            06   13  1181  2768 	BEQL	30$			; Cleanup after VC failure - branch.
                    51   08 A2   9A  1183  2769 	MOVZBL	MSCP$B_OPCODE(R2),R1	; Put the op code into a safe reg
                            03   11  1187  2770 	BRB	40$			;  and skip around
                                     1189  2771 
                                     1189  2772 30$:
                       51   08   D0  1189  2773 	MOVL	#MSCP$K_OP_AVAIL,R1	; Cleanup always uses the same code
                                     118C  2774 
                                     118C  2775 40$:
                                     118C  2776 	DISPATCH R1,-			; Dispatch on command opcode
                                     118C  2777 		type=B,-		;  which is a byte field 
                                     118C  2778 		prefix=MSCP$K_OP_,< -	;  and the beginning looks like this
                                     118C  2779 		<AVAIL,	TMSCP$AVAILABLE>, -	; available, ALWAYS immediate 
                                     118C  2780 		-				;   completion!
                                     118C  2781 		<ONLIN,	TMSCP$ONLINE>, -	; online opcode 9
                                     118C  2782 		<STUNT,	TMSCP$SET_UNIT_CHAR>, -	; set unit characteristics opcode 10
                                     118C  2783 		<DTACP,	TMSCP$DET_ACC_PATH>, -	; determine access path opcode 11
                                     118C  2784 		<ACCES, TMSCP$ACCESS>, -	; access
                                     118C  2785 		<ERASE, TMSCP$ERASE>, -		; erase from current position to PEOT
                                     118C  2786 		<FLUSH, TMSCP$FLUSH>, -		; flush write-back cache
                                     118C  2787 		<ERGAP, TMSCP$ERASE_GAP>, -	; fill with specified block pattern
                                     118C  2788 		<COMP,  TMSCP$COMPARE_HOST_DATA>, - ; compare data with host buffer
                                     118C  2789 		<READ,  TMSCP$READ>, -		; read from tape
                                     118C  2790 		<WRITE, TMSCP$WRITE>, -		; write to tape
                                     118C  2791 		<WRITM, TMSCP$WRITE_TAPE_MARK>,-; write tape mark
                                     118C  2792 		<REPOS, TMSCP$REPOSITION>, -	; reposition
                                     118C  2793 		>
                  1D   08   51   8F  118C       	CASEB	R1,#$$BASE,#$$LIMIT
                                     1190       30062$:
                               00C8' 1190       	.SIGNED_WORD	TMSCP$AVAILABLE-30062$
                               016A' 1192       	.SIGNED_WORD	TMSCP$ONLINE-30062$
                               0218' 1194       	.SIGNED_WORD	TMSCP$SET_UNIT_CHAR-30062$
                               0359' 1196       	.SIGNED_WORD	TMSCP$DET_ACC_PATH-30062$
                               003C  1198       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  119A       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  62
X-2A6A1                         SEQUENTIAL class commands                27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (22)

                               003C  119C       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  119E       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               035F' 11A0       	.SIGNED_WORD	TMSCP$ACCESS-30062$
                               003C  11A2       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               036C' 11A4       	.SIGNED_WORD	TMSCP$ERASE-30062$
                               05D5' 11A6       	.SIGNED_WORD	TMSCP$FLUSH-30062$
                               003C  11A8       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11AA       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               0453' 11AC       	.SIGNED_WORD	TMSCP$ERASE_GAP-30062$
                               003C  11AE       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11B0       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11B2       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11B4       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11B6       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11B8       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11BA       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11BC       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11BE       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               0366' 11C0       	.SIGNED_WORD	TMSCP$COMPARE_HOST_DATA-30062$
                               0606' 11C2       	.SIGNED_WORD	TMSCP$READ-30062$
                               07C1' 11C4       	.SIGNED_WORD	TMSCP$WRITE-30062$
                               003C  11C6       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               0760' 11C8       	.SIGNED_WORD	TMSCP$WRITE_TAPE_MARK-30062$
                               0459' 11CA       	.SIGNED_WORD	TMSCP$REPOSITION-30062$
                                     11CC  2794 
                  50   08   18   9C  11CC  2795 	ROTL	#24,#MSCP$B_OPCODE,R0	; Identify the bad field
                          0ECD   31  11D0  2796 	BRW	TMSCP$PACKET_ERROR	; Return an end msg with error status
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  63
X-2A6A1                         - SET_CLEAR_SEX                          27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (23)

                                     11D3  2799 	.SBTTL	-	SET_CLEAR_SEX
                                     11D3  2800 
                                     11D3  2801 ;+
                                     11D3  2802 ; This routine sets clear serious exception if the remote host requested it
                                     11D3  2803 ; and this device supports it.
                                     11D3  2804 ;-
                                     11D3  2805 ; Inputs:
                                     11D3  2806 ;
                                     11D3  2807 ;	R3  =  HRB address
                                     11D3  2808 ;
                                     11D3  2809 ; Outputs:
                                     11D3  2810 ;
                                     11D3  2811 ;	All registers preserved.
                                     11D3  2812 ;
                                     11D3  2813 ;	IO$M_CLSEREXCP set in IRP if appropriate
                                     11D3  2814 ;-
                                     11D3  2815 
                                     11D3  2816 TMSCP$SET_CLEAR_SEX::
                                     11D3  2817 	.IF DEFINED DEBUG$PC_HISTORY
                                     11D3  2818 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     11D3  2819 	.ENDC	   ;DEBUG$PC_HISTORY
                            24   BB  11D3  2820 	PUSHR	#^M<R2,R5>
                    52   18 A3   D0  11D5  2821 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore MSCP buffer address.
                    55   58 A3   D0  11D9  2822 	MOVL	HRB$L_UQB(R3),R5	; Restore UQB so that
                            0D   E1  11DD  2823 	BBC	#MSCP$V_MD_CLSEX,-	; Clear serious exception enabled?
                      19 0A A2       11DF  2824 		MSCP$W_MODIFIER(R2),999$;
                            05   E5  11E2  2825 	BBCC	#UQB$V_ST_SEREX,-	; Clear the serious exception
                    00 00C8 C5       11E4  2826 		UQB$W_ST_FLAGS(R5),10$	;
                                     11E8  2827 
                                     11E8  2828 10$:
                    55   24 A5   D0  11E8  2829 	MOVL	UQB$L_UCB(R5),R5	;  that we can get the UCB
                            05   E1  11EC  2830 	BBC	#DEV$V_MSCP,-		; If we are not dealing with a MSCP type
                      0A 40 A5       11EE  2831 		UCB$L_DEVCHAR2(R5),999$	;  device, then we can't  enable it
                    55   1C A3   D0  11F1  2832 	MOVL	HRB$L_IRP_CDRP(R3),R5	;
                       0200 8F   A8  11F5  2833 	BISW	#IO$M_CLSEREXCP,-	;
                         20 A5       11F9  2834 		IRP$W_FUNC(R5)
                                     11FB  2835 
                                     11FB  2836 999$:
                            24   BA  11FB  2837 	POPR	#^M<R2,R5>
                                 05  11FD  2838 	RSB
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  64
X-2A6A1                         - SET_IMMED                              27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (24)

                                     11FE  2841 	.SBTTL	-	SET_IMMED
                                     11FE  2842 
                                     11FE  2843 ;+
                                     11FE  2844 ; This routine sets the immediate completion modifier if the device
                                     11FE  2845 ; supports it. It always sets the HRB immediate completion modifier
                                     11FE  2846 ; so that caching can at least be supported at the server level
                                     11FE  2847 ;-
                                     11FE  2848 ; Inputs:
                                     11FE  2849 ;
                                     11FE  2850 ;	R3  =  HRB address
                                     11FE  2851 ;
                                     11FE  2852 ; Outputs:
                                     11FE  2853 ;
                                     11FE  2854 ;	All registers preserved.
                                     11FE  2855 ;
                                     11FE  2856 ;	IO$M_CLSEREXCP set in IRP if appropriate
                                     11FE  2857 ;-
                                     11FE  2858 
                                     11FE  2859 TMSCP$SET_IMMED::
                                     11FE  2860 	.IF DEFINED DEBUG$PC_HISTORY
                                     11FE  2861 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     11FE  2862 	.ENDC	   ;DEBUG$PC_HISTORY
                            24   BB  11FE  2863 	PUSHR	#^M<R2,R5>
                    52   18 A3   D0  1200  2864 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore MSCP buffer address.
                    55   58 A3   D0  1204  2865 	MOVL	HRB$L_UQB(R3),R5	; Restore the UQB address
                            06   E0  1208  2866       	BBS	#MSCP$V_MD_IMMED,-	; Immediate completion specified?
                      05 0A A2       120A  2867 		MSCP$W_MODIFIER(R2),10$	; If so, set flag in HRB.
                            06   E1  120D  2868       	BBC	#MSCP$V_UF_WBKNV,-	; Write back caching enabled on
                      13 16 A5       120F  2869 		UQB$W_UNIT_FLAGS(R5),999$; a per unit basis?
                                     1212  2870 
                                     1212  2871 10$:
                    55   24 A5   D0  1212  2872 	MOVL	UQB$L_UCB(R5),R5	;  that we can get the UCB
                            0A   E1  1216  2873 	BBC	#DEV$V_WBC,-		; If we are not dealing with a caching
                      0A 40 A5       1218  2874 		UCB$L_DEVCHAR2(R5),999$	;  controller, then we can't  enable it
                    55   1C A3   D0  121B  2875 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Restore CDRP/IRP address
                       0080 8F   A8  121F  2876 	BISW	#IO$M_NOWAIT,-		; Set nowait in the function itself
                         20 A5       1223  2877 		IRP$W_FUNC(R5)
                                     1225  2878 999$:
                            24   BA  1225  2879 	POPR	#^M<R2,R5>
                                 05  1227  2880 	RSB
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  65
X-2A6A1                         - SET_CLEAR_CDL                          27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (25)

                                     1228  2883 	.SBTTL	-	SET_CLEAR_CDL
                                     1228  2884 
                                     1228  2885 ;+
                                     1228  2886 ; This routine clears the cached data lost condition in the server if
                                     1228  2887 ; clear cached data lost was specified in the MSCP packet. It also
                                     1228  2888 ; sends the clear cached data modifier in the IRP to the local unit,
                                     1228  2889 ; if the unit is an MSCP device.
                                     1228  2890 ;-
                                     1228  2891 ; Inputs:
                                     1228  2892 ;
                                     1228  2893 ;	R3  =  HRB address
                                     1228  2894 ;
                                     1228  2895 ; Outputs:
                                     1228  2896 ;
                                     1228  2897 ;	All registers preserved.
                                     1228  2898 ;
                                     1228  2899 ;	MSCP$M_MD_CDATL set in IRP$L_MEDIA+6 if appropriate.
                                     1228  2900 ;-
                                     1228  2901 
                                     1228  2902 TMSCP$SET_CLEAR_CDL::
                                     1228  2903 	.IF DEFINED DEBUG$PC_HISTORY
                                     1228  2904 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1228  2905 	.ENDC	   ;DEBUG$PC_HISTORY
                            24   BB  1228  2906 	PUSHR	#^M<R2,R5>
                    52   18 A3   D0  122A  2907 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore MSCP buffer address.
                            0C   E1  122E  2908 	BBC	#MSCP$V_MD_CDATL,-	; Clear cached data lost set?
                      22 0A A2       1230  2909 		MSCP$W_MODIFIER(R2),999$; 
                    55   58 A3   D0  1233  2910 	MOVL	HRB$L_UQB(R3),R5	; Restore the UQB address
                            02   AA  1237  2911 	BICW	#UQB$M_ST_DLS,-		; If clear cached data lost set
                       00C8 C5       1239  2912 		UQB$W_ST_FLAGS(R5)	;  then clear the state in the UQB
                    55   24 A5   D0  123C  2913 	MOVL	UQB$L_UCB(R5),R5	; Restore the UCB
                            0A   E1  1240  2914 	BBC	#DEV$V_WBC,-		; If we are not dealing with a caching
                      10 40 A5       1242  2915 		UCB$L_DEVCHAR2(R5),999$	;  controller, then we can't  enable it
                    55   1C A3   D0  1245  2916 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Restore CDRP/IRP address
                       0040 8F   A8  1249  2917 	BISW	#MSCP$M_UF_WBKNV,-	; Clear cached data lost set in IRP
                         3E A5       124D  2918 		IRP$L_MEDIA+6(R5)
               20 A5   0100 8F   A8  124F  2919 	BISW	#IO$M_MSCPMODIFS, -	; Enable MSCP modifiers.
                                     1255  2920 		IRP$W_FUNC(R5)
                                     1255  2921 
                                     1255  2922 999$:
                            24   BA  1255  2923 	POPR	#^M<R2,R5>
                                 05  1257  2924 	RSB
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  66
X-2A6A1                         - AVAILABLE    (- 8 -)                   27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (26)

                                     1258  2927 	.SBTTL	-	AVAILABLE				(- 8 -)
                                     1258  2928 
                                     1258  2929 ;+
                                     1258  2930 ; Functional Description:
                                     1258  2931 ;
                                     1258  2932 ; All outstanding host commands are completed after which the tape unit
                                     1258  2933 ; is placed in the "Unit Available" state relative to the host. The tape
                                     1258  2934 ; is rewound to BOT.  For TMSCP tapes, the Available command is always treated 
                                     1258  2935 ; as an immediate command, regardless of the Immediate Completion
                                     1258  2936 ; modifier being set or clear. IO$V_NOWAIT is set in the function code,
                                     1258  2937 ; and as soon as the I/O completes in the local driver, the end
                                     1258  2938 ; message is returned to the requesting host.
                                     1258  2939 ; 
                                     1258  2940 ;
                                     1258  2941 ; Inputs:
                                     1258  2942 ;
                                     1258  2943 ;	R0  =  Scratch
                                     1258  2944 ;	R1  =  Scratch
                                     1258  2945 ;	R2  =  MSCP packet address
                                     1258  2946 ;	R3  =  HRB address
                                     1258  2947 ;	R4  =  UQB address, scratch
                                     1258  2948 ;	R5  =  Scratch
                                     1258  2949 ;
                                     1258  2950 ; Outputs:
                                     1258  2951 ;
                                     1258  2952 ;	R0  =  Completion status
                                     1258  2953 ;	R2  =  MSCP packet address
                                     1258  2954 ;	R3  =  HRB address
                                     1258  2955 ;-
                                     1258  2956 
                                     1258  2957 TMSCP$AVAILABLE::
                                     1258  2958 	.IF DEFINED DEBUG$PC_HISTORY
                                     1258  2959 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1258  2960 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1258  2961 
                                     1258  2962 ;
                                     1258  2963 ; Make sure the unit this request is for is ONLINE to the requesting host.
                                     1258  2964 ;
                                     1258  2965 
                         70 A4   D1  1258  2966 	CMPL	UQB$L_ONLINE_HQB(R4),-	; Is this unit online
                         54 A3       125B  2967 		HRB$L_HQB(R3)		;  to the requesting host?
                            0E   13  125D  2968 	BEQL	3$			; If not, get out.
                       50   00   D0  125F  2969 	MOVL	#MSCP$K_ST_SUCC,R0	; Set success status
                         70 A4   D5  1262  2970 	TSTL	UQB$L_ONLINE_HQB(R4)	; Is unit online to another host?
                            03   13  1265  2971 	BEQL	2$			; No, unit is available - branch.
                       50   03   D0  1267  2972 	MOVL	#MSCP$K_ST_OFFLN,R0	; Set unit offline.
                                     126A  2973 
                                     126A  2974 2$:
                          007D   31  126A  2975 	BRW	87$			; Branch assist.
                                     126D  2976 
                                     126D  2977 3$:
                         70 A4   D4  126D  2978 	CLRL	UQB$L_ONLINE_HQB(R4)	; We're no longer ONLINE.
                    55   24 A4   D0  1270  2979 	MOVL	UQB$L_UCB(R4),R5	; 
                       00C2 C5   97  1274  2980 	DECB	UCB$B_ONLCNT(R5)	; Drop the count
                            04   13  1278  2981 	BEQL	7$			; Should be at zero.
                                     127A  2982 
                                     127A  2983 	BUG_CHECK MSCPSERV,FATAL	; Online count zapped.
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  67
X-2A6A1                         - AVAILABLE    (- 8 -)                   27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (26)

                               FEFF  127A       		.WORD	^XFEFF
                               0004' 127C       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_MSCPSERV!4
                                     127E  2984 ;
                                     127E  2985 ; Change the state of this unit to available.
                                     127E  2986 ;
                                     127E  2987 
                                     127E  2988 7$:
                            04   B0  127E  2989 	MOVW	#UQB$K_ST_AVAILABLE,-	; Change the state of this unit
                         0C A4       1280  2990 		UQB$W_STATE(R4)		;  to "available" for client hosts
                       54   55   D0  1282  2991 	MOVL	R5,R4			; Save the UCB address for TMSCP$DRIVE_CHECK
                    55   1C A3   D0  1285  2992 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the IRP address for the I/O
                    1C A5   54   D0  1289  2993 	MOVL	R4,IRP$L_UCB(R5)	; Save the UCB address in the IRP
                                     128D  2994 
                                     128D  2995 ;
                                     128D  2996 ; The class driver can issue three possible modifiers for the AVAILABLE
                                     128D  2997 ; command: MSCP$M_MD_CLSEX, MSCP$M_MD_UNLOD, MSCP$M_MD_CDATL. Two other
                                     128D  2998 ; modifiers are allowed by the spec but are not currently used: 
                                     128D  2999 ; MSCP$M_MD_EXCAC and MSCP$M_MD_ALLCD.
                                     128D  3000 ;
                                     128D  3001 ; The server recognizes MSCP$M_MD_CLSEX and MSCP$M_MD_UNLOD. It cannot
                                     128D  3002 ; issue any I/O function modifier for clearing cached data.
                                     128D  3003 ;
                                     128D  3004 
                    20 A5   11   B0  128D  3005 	MOVW	#IO$_AVAILABLE, -	; Assume it is an AVAILABLE function.
                                     1291  3006 		IRP$W_FUNC(R5)		; 
                            52   D5  1291  3007 	TSTL	R2			; If this was an internally generated
                            1A   13  1293  3008 	BEQL	60$			;  available, don't unload the drive
                            04   E1  1295  3009 	BBC	#MSCP$V_MD_UNLOD,-	; If UNLOAD modifier set,
                      04 0A A2       1297  3010 		MSCP$W_MODIFIER(R2),10$	;  set function
                    20 A5   01   B0  129A  3011 	MOVW	#IO$_UNLOAD, -		;  to UNLOAD
                                     129E  3012 		IRP$W_FUNC(R5)		;  
                                     129E  3013 
                                     129E  3014 10$:
                          FF32   30  129E  3015 	BSBW	TMSCP$SET_CLEAR_SEX
                            05   E1  12A1  3016 	BBC	#DEV$V_MSCP,-		; If this is a TMSCP device, set
                      09 40 A4       12A3  3017 		UCB$L_DEVCHAR2(R4),60$	;  immediate completion modifier, else
                       0080 8F   A8  12A6  3018 	BISW	#IO$M_NOWAIT,-		;  leave clear until non-class tape
                         20 A5       12AA  3019 		IRP$W_FUNC(R5)		;  drivers support this.
                          FF79   30  12AC  3020 	BSBW	TMSCP$SET_CLEAR_CDL
                                     12AF  3021 
                                     12AF  3022 60$:
                    14 A5   53   D0  12AF  3023 	MOVL	R3,IRP$L_HRB(R5)	; Save HRB in IRP.
                    54   58 A3   D0  12B3  3024 	MOVL	HRB$L_UQB(R3),R4	; Restore UQB for seq synch.
                                     12B7  3025 
                                     12B7  3026 ;
                                     12B7  3027 ;	R0  =  Scratch
                                     12B7  3028 ;	R1  =  Scratch
                                     12B7  3029 ;	R2  =  Scratch
                                     12B7  3030 ;	R3  =  HRB address
                                     12B7  3031 ;	R4  =  UQB address
                                     12B7  3032 ;	R5  =  Scratch
                                     12B7  3033 ;
                                     12B7  3034 
                          0844   30  12B7  3035 	BSBW	TMSCP$DRIVE_CHECK	; Send the packet to the tape
                                     12BA  3036 
                                     12BA  3037 ;
                                     12BA  3038 ; Control returns here from entry point TMSCP$BACK. 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  68
X-2A6A1                         - AVAILABLE    (- 8 -)                   27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (26)

                                     12BA  3039 ;
                                     12BA  3040 ;	R0  =  I/O status block, scratch
                                     12BA  3041 ;	R1  =  Scratch
                                     12BA  3042 ;	R2  =  Scratch
                                     12BA  3043 ;	R3  =  HRB address
                                     12BA  3044 ;	R4  =  UQB address
                                     12BA  3045 ;	R5  =  IRP address
                                     12BA  3046 ; 
                                     12BA  3047 ; The host-settable unit flags are cleared.
                                     12BA  3048 ;
                    52   54 A3   D0  12BA  3049 	MOVL	HRB$L_HQB(R3),R2	; Restore HQB
                       00C4 C4   D4  12BE  3050 	CLRL	UQB$L_POSITION(R4)	; We are back to the top.
                                     12C2  3051 
                                     12C2  3052 	ASSUME	UQB$W_MAX_IO EQ 2+UQB$W_NUM_IO
                                     12C2  3053 
                       00B8 C4   D4  12C2  3054 	CLRL	UQB$W_NUM_IO(R4)	; Zero out outstanding IOs, max IOs
                  00C8 C4   01   B0  12C6  3055 	MOVW	# UQB$M_ST_BOT, -	; Clear all status flags except BOT.
                                     12CB  3056 		UQB$W_ST_FLAGS(R4)
                                 AA  12CB  3057 	BICW	#<MSCP$M_UF_WRTPS!-	; Clear out the hardware write protect
                                     12CC  3058 		MSCP$M_UF_VSMSU!-	;  and variable speed suppression mode
                                     12CC  3059 		MSCP$M_UF_WBKNV!-	;  and write back caching enabled
                                     12CC  3060 		MSCP$M_UF_WRTPD!-	;  and data safety write protect
                                     12CC  3061     		MSCP$M_UF_WRTPH>,-	;  and software write protect
               16 A4   3160 8F       12CC  3062 		UQB$W_UNIT_FLAGS(R4)	;  flags
                                     12D1  3063 
                                     12D1  3064 80$:
                    52   18 A3   D0  12D1  3065 	MOVL	HRB$L_MSGBUF(R3),R2	; Make sure the packet address is there
                            1A   13  12D5  3066 	BEQL	90$			; This must be a call from TMSCP$VC_ERR
                    55   1C A3   D0  12D7  3067 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Restore CDRP/IRP
                    50   38 A5   D0  12DB  3068 	MOVL	IRP$L_IOST1(R5),R0	; Restore the IOSB
                         05 50   E9  12DF  3069 	BLBC	R0,85$			; If the I/O was successful, cont..
                       50   00   D0  12E2  3070 	MOVL	#MSCP$K_ST_SUCC,R0	; Set success status
                            03   11  12E5  3071 	BRB	87$			;  and send the end packet
                                     12E7  3072 
                                     12E7  3073 85$:
                          0B13   30  12E7  3074 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.	
                                     12EA  3075 
                                     12EA  3076 87$:
                    52   18 A3   D0  12EA  3077 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore end packet
                          0CED   31  12EE  3078 	BRW	TMSCP$SEND_END		; Return the status back to the client
                                     12F1  3079 
                                     12F1  3080 ;
                                     12F1  3081 ; A zero for a message buffer address in the HRB is an indication that this 
                                     12F1  3082 ; routine was called as part of the cleanup effort after a VC error. Since
                                     12F1  3083 ; there is no longer a circuit over which to send out an end message, just 
                                     12F1  3084 ; cleanup the request without returning any status.
                                     12F1  3085 ;
                                     12F1  3086 
                                     12F1  3087 90$:
                       0040 8F   AA  12F1  3088 	BICW	#HRB$M_VCFAILED,-	; Clear this flag when we return so
                         16 A3       12F5  3089 		HRB$W_FLAGS(R3)		;  the HRB will be cleaned up
                          09E8   31  12F7  3090 	BRW	TMSCP$CLEANUP_HRB	; Free resources used by this request.
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  69
X-2A6A1                         - ONLINE     (- 9 -)                     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (27)

                                     12FA  3093 	.SBTTL	-	ONLINE					(- 9 -)
                                     12FA  3094 
                                     12FA  3095 ;+
                                     12FA  3096 ; Functional Description:
                                     12FA  3097 ;
                                     12FA  3098 ; The ONLINE command is used to bring a tape unit into the "Unit-Online" state,
                                     12FA  3099 ; set host settable unit characteristics, and obtain those unit characteristics
                                     12FA  3100 ; that are essential for proper class driver operation.
                                     12FA  3101 ;
                                     12FA  3102 ; Inputs:
                                     12FA  3103 ;
                                     12FA  3104 ;	R0  =  Scratch
                                     12FA  3105 ;	R1  =  Scratch
                                     12FA  3106 ;	R2  =  MSCP packet address
                                     12FA  3107 ;	R3  =  HRB address
                                     12FA  3108 ;	R4  =  UQB address, scratch
                                     12FA  3109 ;	R5  =  Scratch
                                     12FA  3110 ;
                                     12FA  3111 ; Outputs:
                                     12FA  3112 ;
                                     12FA  3113 ;	R0  =  Completion status
                                     12FA  3114 ;	R2  =  MSCP packet address
                                     12FA  3115 ;	R3  =  HRB address
                                     12FA  3116 ;- 
                                     12FA  3117 
                                     12FA  3118 TMSCP$ONLINE::
                                     12FA  3119 	.IF DEFINED DEBUG$PC_HISTORY
                                     12FA  3120 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     12FA  3121 	.ENDC	   ;DEBUG$PC_HISTORY
                                     12FA  3122 
                                     12FA  3123 ;
                                     12FA  3124 ; If the unit is already online to this host, then the same unit
                                     12FA  3125 ; flags must be specified.
                                     12FA  3126 ;
                                     12FA  3127 
                                     12FA  3128 WRITABLE_UNIT_FLAGS =	MSCP$M_UF_CMPRD ! -	;  compare reads 
                                     12FA  3129 			MSCP$M_UF_CMPWR ! -	;  compare writes
                                     12FA  3130 			MSCP$M_UF_VSMSU ! -	;  variable speed mode suppression
                                     12FA  3131 			MSCP$M_UF_SCCHH ! -	;  supress high speed caching
                                     12FA  3132 			MSCP$M_UF_WBKNV ! -	;  write back caching enabled
                           00001863  12FA  3133 			MSCP$M_UF_WRTPS		;  software write protect
                                     12FA  3134 
                         70 A4   D5  12FA  3135 	TSTL	UQB$L_ONLINE_HQB(R4) 	; Pointer to online host	
                            21   13  12FD  3136 	BEQL	5$			; If not online to anyone, ok - branch.
                         54 A3   D1  12FF  3137 	CMPL	HRB$L_HQB(R3),-		; Were we already online to
                         70 A4       1302  3138 		UQB$L_ONLINE_HQB(R4) 	;  the remote host
                            1A   12  1304  3139 	BNEQ	5$			; Different host - branch.
          50   0E A2   E79C 8F   AB  1306  3140 	BICW3	#^C WRITABLE_UNIT_FLAGS, -	; Verify that the same unit flags 
                                     130D  3141 		MSCP$W_UNT_FLGS(R2), R0		; were specified.
          51   16 A4   E79C 8F   AB  130D  3142 	BICW3	#^C WRITABLE_UNIT_FLAGS, -
                                     1314  3143 		UQB$W_UNIT_FLAGS(R4), R1
                       51   50   B1  1314  3144 	CMPW	R0, R1			; Compare the MSCP flags to the UQB flags
                            07   13  1317  3145 	BEQL	5$			; Same unit flags specified - branch.
                  50   0E   18   9C  1319  3146 	ROTL	#24,#MSCP$W_UNT_FLGS,R0	; Identify the bad field
                          0D80   31  131D  3147 	BRW	TMSCP$PACKET_ERROR	; Return an end msg with error status
                                     1320  3148 
                                     1320  3149 5$:
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  70
X-2A6A1                         - ONLINE     (- 9 -)                     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (27)

                    54   24 A4   D0  1320  3150 	MOVL	UQB$L_UCB(R4),R4	; Get UCB address from UQB
                            05   E1  1324  3151 	BBC	#DEV$V_MSCP,-		; If this is a MSCP device,
                      2F 40 A4       1326  3152 		UCB$L_DEVCHAR2(R4),30$	;  and there are already requests
                         6A A4   B5  1329  3153 	TSTW	UCB$W_RWAITCNT(R4)	;  waiting, this might be a trap!
                            06   13  132C  3154 	BEQL	20$			;  Instead of falling in,
                                     132E  3155 
                                     132E  3156 10$:
                       50   03   D0  132E  3157 	MOVL	#MSCP$K_ST_OFFLN,R0	;  Return a status of offline and let
                          0CAA   31  1331  3158 	BRW	TMSCP$SEND_END		;  the client find another path
                                     1334  3159 
                                     1334  3160 ;
                                     1334  3161 ; A PACKACK is sent to the local class driver to determine if the device is 
                                     1334  3162 ; reachable. If a success is returned, the device is accessible. Any error
                                     1334  3163 ; returns causes a status of offline to return.
                                     1334  3164 ;
                                     1334  3165 
                                     1334  3166 20$:
                    55   1C A3   D0  1334  3167 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Make sure we have the IRP address
                    1C A5   54   D0  1338  3168 	MOVL	R4,IRP$L_UCB(R5)	; Save the UCB address
                    14 A5   53   D0  133C  3169 	MOVL	R3,IRP$L_HRB(R5)	; Save the HRB address
                            08   B0  1340  3170 	MOVW	#IO$_PACKACK,-		; Set up the function code,
                         20 A5       1342  3171 		IRP$W_FUNC(R5)		;  to do the mount verification
                          FE8C   30  1344  3172 	BSBW	TMSCP$SET_CLEAR_SEX	; Set clear serious exception
                          FEDE   30  1347  3173 	BSBW	TMSCP$SET_CLEAR_CDL	; Set clear cached data lost
                    54   58 A3   D0  134A  3174 	MOVL	HRB$L_UQB(R3),R4	; Restore UQB for seq. synch.
                                     134E  3175 
                                     134E  3176 ;
                                     134E  3177 ;	R0  =  Scratch
                                     134E  3178 ;	R1  =  Scratch
                                     134E  3179 ;	R2  =  Scratch
                                     134E  3180 ;	R3  =  HRB address
                                     134E  3181 ;	R4  =  UQB address
                                     134E  3182 ;	R5  =  Scratch
                                     134E  3183 ;
                                     134E  3184 
                          07AD   30  134E  3185 	BSBW	TMSCP$DRIVE_CHECK	; Call a subroutine to do the I/O
                                     1351  3186 
                                     1351  3187 ;
                                     1351  3188 ; Control returns here from entry point TMSCP$BACK. 
                                     1351  3189 ;
                                     1351  3190 ;	R0  =  I/O status block, scratch
                                     1351  3191 ;	R1  =  Scratch
                                     1351  3192 ;	R2  =  Scratch
                                     1351  3193 ;	R3  =  HRB address
                                     1351  3194 ;	R4  =  UQB address
                                     1351  3195 ;	R5  =  IRP address
                                     1351  3196 ;
                                     1351  3197 
                    52   18 A3   D0  1351  3198 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                         1A 50   E8  1355  3199 	BLBS	R0,80$			; If the I/O was successful cont...
                                     1358  3200 
                                     1358  3201 30$:
                    54   58 A3   D0  1358  3202 	MOVL	HRB$L_UQB(R3),R4	; Get the UQB so that 
                    54   24 A4   D0  135C  3203 	MOVL	UQB$L_UCB(R4),R4	;  we can restore the UCB
                            04   E1  1360  3204 	BBC	#UCB$V_ONLINE,-		; If device is online locally
                      08 78 A4       1362  3205 		UCB$L_STS(R4), 40$	;  then the device cannot be shared
                  50   0203 8F   3C  1365  3206 	MOVZWL	#<MSCP$K_SC_EXUSE@ -	; Return offline with exclusive use
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  71
X-2A6A1                         - ONLINE     (- 9 -)                     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (27)

                                     136A  3207 		MSCP$V_ST_SBCOD! -	;
                                     136A  3208 		MSCP$K_ST_OFFLN>,R0	;
                          0C71   31  136A  3209 	BRW	TMSCP$SEND_END		;  set the MSCP status and return
                                     136D  3210 
                                     136D  3211 40$:
                            12   E0  136D  3212 	BBS	#DEV$V_AVL,-		; If the device is offline, set status and
                      BC 3C A4       136F  3213 		UCB$L_DEVCHAR(R4), 10$	;  return MSCP end packet.
                                     1372  3214 
                                     1372  3215 ;
                                     1372  3216 ; Either a PACKACK to a TMSCP tape was successful or for non-TMSCP tapes, the
                                     1372  3217 ; unit was found to be available, which means the tape is accessible. Make sure
                                     1372  3218 ; all the status codes are set properly to reflect an "online" status and
                                     1372  3219 ; then return the device characteristics in the online end message.
                                     1372  3220 ; 
                                     1372  3221 
                                     1372  3222 80$:
                    52   18 A3   D0  1372  3223 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                    54   58 A3   D0  1376  3224 	MOVL	HRB$L_UQB(R3),R4	; Restore the UQB address
                            02   B0  137A  3225 	MOVW	#UQB$K_ST_ONLINE,-	; Update the state field
                         0C A4       137C  3226 		UQB$W_STATE(R4)		;  in the UQB
                       50   00   D0  137E  3227 	MOVL	#MSCP$K_ST_SUCC,R0	; Assume a successful status
                         70 A4   D5  1381  3228 	TSTL	UQB$L_ONLINE_HQB(R4) 	; Pointer to online host	
                            0B   13  1384  3229 	BEQL	90$			; If not online to anyone, ok
                         54 A3   D1  1386  3230 	CMPL	HRB$L_HQB(R3),-		; Were we already online to
                         70 A4       1389  3231 		UQB$L_ONLINE_HQB(R4) 	;  the remote host
                            13   13  138B  3232 	BEQL	100$
                                     138D  3233 
                                     138D  3234 ;
                                     138D  3235 ; Remove this check before shipping.
                                     138D  3236 ;
                                     138D  3237 
                                     138D  3238 	BUG_CHECK MSCPSERV,FATAL	; The assign system service should
                               FEFF  138D       		.WORD	^XFEFF
                               0004' 138F       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_MSCPSERV!4
                                     1391  3239 					;  have guaranteed that we would
                                     1391  3240 					;  not have gotten this far.
                                     1391  3241 
                                     1391  3242 90$:
                    51   24 A4   D0  1391  3243 	MOVL	UQB$L_UCB(R4),R1	; Get the address of the UCB
                         54 A3   D0  1395  3244 	MOVL	HRB$L_HQB(R3),-		; Get the HQB address
                         70 A4       1398  3245 		UQB$L_ONLINE_HQB(R4) 	; Pointer to online host	
                       00C2 C1   96  139A  3246 	INCB	UCB$B_ONLCNT(R1)	; Bump the online counter
                            08   11  139E  3247 	BRB	TMSCP$SET_UNIT_CHAR	; Update the device characteristics.
                                     13A0  3248 	
                                     13A0  3249 100$:
                  50   0100 8F   3C  13A0  3250 	MOVZWL	#<MSCP$K_SC_ALONL@ -	; Set the subcode indicating the unit
                                     13A5  3251 		MSCP$V_ST_SBCOD! -	;  was "already online"
                                     13A5  3252 		MSCP$K_ST_SUCC>,R0	;  and a status code of success
                          00BA   31  13A5  3253 	BRW	TMSCP$RECORD_COMMON	;  and finish off the request
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  72
X-2A6A1                         - SET UNIT CHARACTERISTICS  (- 10 -)     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (28)

                                     13A8  3256 	.SBTTL	-	SET UNIT CHARACTERISTICS		(- 10 -)
                                     13A8  3257 
                                     13A8  3258 ;+
                                     13A8  3259 ; Functional Description:
                                     13A8  3260 ;
                                     13A8  3261 ; This command is used to control host settable unit characteristics and obtain
                                     13A8  3262 ; those characteristics that are necessary for proper class driver operation.
                                     13A8  3263 ;
                                     13A8  3264 ; Inputs:
                                     13A8  3265 ; 
                                     13A8  3266 ;	R0  =  Scratch
                                     13A8  3267 ;	R1  =  Scratch
                                     13A8  3268 ;	R2  =  MSCP packet address
                                     13A8  3269 ;	R3  =  HRB address
                                     13A8  3270 ;	R4  =  UQB address, scratch
                                     13A8  3271 ;	R5  =  Scratch
                                     13A8  3272 ;
                                     13A8  3273 ; Outputs:
                                     13A8  3274 ;
                                     13A8  3275 ;	R0  =  Completion status
                                     13A8  3276 ;	R2  =  MSCP packet address
                                     13A8  3277 ;	R3  =  HRB address
                                     13A8  3278 ;-
                                     13A8  3279 
                                     13A8  3280 TMSCP$SET_UNIT_CHAR::
                                     13A8  3281 	.IF DEFINED DEBUG$PC_HISTORY
                                     13A8  3282 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     13A8  3283 	.ENDC	   ;DEBUG$PC_HISTORY
                                     13A8  3284 
                                     13A8  3285 ;
                                     13A8  3286 ; Is unit online to the requestor?
                                     13A8  3287 ;
                                     13A8  3288 	
                         70 A4   D1  13A8  3289 	CMPL	UQB$L_ONLINE_HQB(R4),-	; Is the host that has this unit
                         54 A3       13AB  3290 		HRB$L_HQB(R3)		;  online the same as the requesting host?
                            06   13  13AD  3291 	BEQL	10$			; If online, continue...
                       50   03   D0  13AF  3292 	MOVL	#MSCP$K_ST_OFFLN,R0	; Otherwise this is an invalid command
                          0C29   31  13B2  3293 	BRW	TMSCP$SEND_END
                                     13B5  3294 
                                     13B5  3295 ;
                                     13B5  3296 ; Unit ONLINE to this host - Check to see if write protect enabled.
                                     13B5  3297 ;
                                     13B5  3298 
                                     13B5  3299 10$:
                            02   E0  13B5  3300 	BBS 	#MSCP$V_MD_STWRP,-	; Check "enable set write protect"
                      06 0A A2       13B7  3301 		MSCP$W_MODIFIER(R2),15$	;  if it's set continue...
                       1000 8F   AA  13BA  3302 	BICW	#MSCP$M_UF_WRTPS,-	; If the set write protection bit
                         0E A2       13BE  3303 		MSCP$W_UNT_FLGS(R2)	;  was set, write protect is host settable
                                     13C0  3304 ;
                                     13C0  3305 ; Check all user specified device characteristics stored in 
                                     13C0  3306 ; MSCP$W_UNT_FLGS. Set them in the CDRP$L_MEDIA field.
                                     13C0  3307 ;
                                     13C0  3308 
                                     13C0  3309 15$:
                    51   24 A4   D0  13C0  3310 	MOVL	UQB$L_UCB(R4),R1	; Get the UCB address
                    55   1C A3   D0  13C4  3311 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the IRP address.
                                     13C8  3312 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  73
X-2A6A1                         - SET UNIT CHARACTERISTICS  (- 10 -)     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (28)

                                     13C8  3313 	ASSUME	UCB$L_DEVDEPND2 EQ 4+UCB$L_DEVDEPEND
                                     13C8  3314 
                    32 A5   08   B0  13C8  3315 	MOVW	# 8, IRP$W_BCNT(R5)	; Set the characteristics length.
                            05   E1  13CC  3316 	BBC	#DEV$V_MSCP,-		; Not a TMSCP type device - branch.
                      04 40 A1       13CE  3317 		UCB$L_DEVCHAR2(R1), 17$
                    32 A5   0C   B0  13D1  3318 	MOVW	# 12, IRP$W_BCNT(R5)	; Specify extended device characteristics.
                                     13D5  3319 
                                     13D5  3320 17$:
               16 A4   0840 8F   AA  13D5  3321 	BICW	# MSCP$M_UF_WBKNV ! -	; Disable write-back cache for this unit.
                                     13DB  3322 		  MSCP$M_UF_SCCHH, -	; Enable read-ahead caching for this unit.
                                     13DB  3323 		UQB$W_UNIT_FLAGS(R4)
                            06   E1  13DB  3324 	BBC	#MSCP$V_UF_WBKNV,-	; Write-back caching should be 
                      0E 0E A2       13DD  3325 		MSCP$W_UNT_FLGS(R2),20$ ;  disabled - branch.
                       0040 8F   A8  13E0  3326 	BISW	#MSCP$M_UF_WBKNV,-	; Write-back caching enabled for this unit.
                         16 A4       13E4  3327 		UQB$W_UNIT_FLAGS(R4)
                   00010000 8F   C8  13E6  3328 	BISL	#MT2$M_WBC_ENABLE,-	; Request write-back caching.
                         40 A5       13EC  3329 		IRP$L_MEDIA+8(R5)
                                     13EE  3330 
                                     13EE  3331 ;
                                     13EE  3332 ;		Kludge alert:  The buffer size, device class and device type
                                     13EE  3333 ;		are passed using one of the reserved fields in the TMSCP message.
                                     13EE  3334 ;		The location of this field must match the location used by the 
                                     13EE  3335 ;		TUDRIVER in the routine SETMODE_BEGIN_IVCMD.
                                     13EE  3336 ;
                                     13EE  3337 
                                     13EE  3338 20$:
                         10 A2   D0  13EE  3339 	MOVL	MSCP$W_UNT_FLGS+2(R2),-	; Restore buffer size, class and type
                         38 A5       13F1  3340 		IRP$L_MEDIA(R5)		;
                            0B   E1  13F3  3341 	BBC	#MSCP$V_UF_SCCHH,-	; Read-ahead caching should be enabled for
                         0E A2       13F5  3342 		MSCP$W_UNT_FLGS(R2),-	;  this unit - branch.
                            0E       13F7  3343 		30$
                       0800 8F   A8  13F8  3344 	BISW	#MSCP$M_UF_SCCHH,-	; Disable read-ahead caching for this unit.
                         16 A4       13FC  3345 		UQB$W_UNIT_FLAGS(R4)
                   00020000 8F   C8  13FE  3346 	BISL	#MT2$M_RDC_DISABLE,-	; Request read-ahead caching be disabled.
                         40 A5       1404  3347 		IRP$L_MEDIA+8(R5)
                                     1406  3348 
                                     1406  3349 30$:
                         1C A2   D0  1406  3350 	MOVL	MSCP$L_DEV_PARM(R2),-	; Set up device dependent
                       0100 C1       1409  3351 		UCB$L_MSCPDEVPARAM(R1)	;  in the local UCB
                                     140C  3352 
                                     140C  3353 ;
                                     140C  3354 ;		Convert the MSCP tape FORMAT to the VMS tape format.
                                     140C  3355 ;
                                     140C  3356 
                       7E   50   7D  140C  3357 	MOVQ	R0, -(SP)		; Save the required registers.
                    51   20 A2   3C  140F  3358 	MOVZWL	MSCP$W_FORMAT(R2), R1	; Get the MSCP format value.
                          0D80   30  1413  3359 	BSBW	TMSCP$MSCPTOVMS_DENS	; Convert to the VMS density value.
          3C A5   05   08   50   F0  1416  3360 	INSV	R0, # MT$V_DENSITY, -	; Set the VMS tape density.
                                     141C  3361 		# MT$S_DENSITY, -
                                     141C  3362 		IRP$L_MEDIA+4(R5)
                                     141C  3363 	.IF DEFINED DEBUG$PC_HISTORY
                                     141C  3364 	BSBW	TMSCP$R0HIST		; Save the density value.
                                     141C  3365 	.ENDC	   ;DEBUG$PC_HISTORY
                                     141C  3366 
                                     141C  3367 
                                     141C  3368 ;
                                     141C  3369 ;		Convert the MSCP tape SPEED to the VMS tape speed.
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  74
X-2A6A1                         - SET UNIT CHARACTERISTICS  (- 10 -)     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (28)

                                     141C  3370 ;
                                     141C  3371 
                    51   20 A2   3C  141C  3372 	MOVZWL	MSCP$W_FORMAT(R2), R1	; Get the MSCP format value.
                    50   22 A2   3C  1420  3373 	MOVZWL	MSCP$W_SPEED(R2), R0	; Get the MSCP speed value.
                          0DD9   30  1424  3374 	BSBW	TMSCP$MSCPTOSPEED	; Convert to the VMS speed value.
          3C A5   08   18   50   F0  1427  3375 	INSV	R0, # MT$V_SPEED, -	; Set the VMS tape speed.
                                     142D  3376 		# MT$S_SPEED, -
                                     142D  3377 		IRP$L_MEDIA+4(R5)
                                     142D  3378 	.IF DEFINED DEBUG$PC_HISTORY
                                     142D  3379 	BSBW	TMSCP$R0HIST		; Save the speed value.
                                     142D  3380 	.ENDC	   ;DEBUG$PC_HISTORY
                       50   8E   7D  142D  3381 	MOVQ	(SP)+, R0		; Restore the registers.
                                     1430  3382 
                                     1430  3383 ;
                                     1430  3384 ; Issue an IO$_SETMODE to the local driver.
                                     1430  3385 ;
                                     1430  3386 
                    18 A3   52   D0  1430  3387 	MOVL	R2,HRB$L_MSGBUF(R3)	; Restore packet address
                    1C A5   51   D0  1434  3388 	MOVL	R1,IRP$L_UCB(R5)	; Save the UCB address
                            23   B0  1438  3389 	MOVW	#IO$_SETMODE,-		; Set up the function code,
                         20 A5       143A  3390 		IRP$W_FUNC(R5)		;  to do the mount verification
                          FD94   30  143C  3391 	BSBW	TMSCP$SET_CLEAR_SEX	; Set clear serious exception
                          FDE6   30  143F  3392 	BSBW	TMSCP$SET_CLEAR_CDL	; Set clear cached data lost
                    14 A5   53   D0  1442  3393 	MOVL	R3,IRP$L_HRB(R5)	; Save HRB for I/O completion
                                     1446  3394 
                                     1446  3395 ;
                                     1446  3396 ;	R0  =  Scratch
                                     1446  3397 ;	R1  =  Scratch
                                     1446  3398 ;	R2  =  Scratch
                                     1446  3399 ;	R3  =  HRB address
                                     1446  3400 ;	R4  =  UQB address
                                     1446  3401 ;	R5  =  Scratch
                                     1446  3402 ;
                                     1446  3403 
                          06B5   30  1446  3404 	BSBW	TMSCP$DRIVE_CHECK	; Call a subroutine to do the I/O
                                     1449  3405 
                                     1449  3406 ;
                                     1449  3407 ; Control returns here from entry point TMSCP$BACK. 
                                     1449  3408 ;
                                     1449  3409 ;	R0  =  I/O status block, scratch
                                     1449  3410 ;	R1  =  Scratch
                                     1449  3411 ;	R2  =  Scratch
                                     1449  3412 ;	R3  =  HRB address
                                     1449  3413 ;	R4  =  UQB address
                                     1449  3414 ;	R5  =  IRP address
                                     1449  3415 ;
                                     1449  3416 
                         03 50   E8  1449  3417 	BLBS	R0,40$			; If the transfer was successful, cont...
                          09AE   30  144C  3418 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.
                                     144F  3419 
                                     144F  3420 40$:
                    55   1C A3   D0  144F  3421 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Restore IRP address
                    52   18 A3   D0  1453  3422 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore packet address
                    54   58 A3   D0  1457  3423 	MOVL	HRB$L_UQB(R3),R4	; Get the UQB to as to
                    51   24 A4   D0  145B  3424 	MOVL	UQB$L_UCB(R4),R1	;  get the UCB
                       50   00   D0  145F  3425 	MOVL	#MSCP$K_ST_SUCC,R0	; Return success status.
                                     1462  3426 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  75
X-2A6A1                         - SET UNIT CHARACTERISTICS  (- 10 -)     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (28)

                                     1462  3427 ;
                                     1462  3428 ; The IO$_SETMODE will cause the local driver to update several fields in
                                     1462  3429 ; the UCB. These fields will be returned to the remote host in the MSCP
                                     1462  3430 ; end packet.
                                     1462  3431 ;
                                     1462  3432 ;	R0  =  MSCP status value
                                     1462  3433 ;	R1  =  UCB address
                                     1462  3434 ;	R2  =  MSCP packet
                                     1462  3435 ;	R3  =  HRB address
                                     1462  3436 ;	R4  =  UQB address
                                     1462  3437 ;	R5  =  Scratch
                                     1462  3438 ;
                                     1462  3439 
                                     1462  3440 TMSCP$RECORD_COMMON::
                                     1462  3441 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1462  3442 	BSBW	TMSCP$PCHIST_R3		; Log the PC for debugging.
                                     1462  3443 	.ENDC  ;DEBUG$PC_HISTORY
                                     1462  3444 
                                     1462  3445 ;
                                     1462  3446 ;		Update the fields kept on the local host.
                                     1462  3447 ;
                                     1462  3448 
                         18 A4   7D  1462  3449 	MOVQ	UQB$Q_UNIT_ID(R4),-	;  returning a unit identifier
                         14 A2       1465  3450 		MSCP$Q_UNIT_ID(R2)	;  in the end packet also.
                         16 A4   B0  1467  3451 	MOVW	UQB$W_UNIT_FLAGS(R4),-	; Put the set unit flags in the
                         0E A2       146A  3452 		MSCP$W_UNT_FLGS(R2)	;  end packet to return
                         14 A4   B0  146C  3453 	MOVW	UQB$W_MULT_UNIT(R4),-	;  Update the multi-unit flags
                         0C A2       146F  3454 		MSCP$W_MULT_UNT(R2)	;  in the end packet.
                                     1471  3455 
                                     1471  3456 ;
                                     1471  3457 ;		Get the fields from the local UCB.
                                     1471  3458 ;
                                     1471  3459 
                       00A0 C1   D0  1471  3460 	MOVL	UCB$L_MEDIA_ID(R1),-	; Get the media identifier from
                         1C A2       1475  3461 		MSCP$L_MEDIA_ID(R2)	;  the unit control block
                                     1477  3462 
                                     1477  3463 	GET_TAPE_FORMAT		R1
                    40 A1   05   E1  1477       	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                            08       147B       		UCB$L_DEVCHAR2(R1), 30063$	; Not MSCP tape - branch.
               20 A2   0110 C1   B0  147C       	MOVW	UCB$W_TU_FORMAT(R1), -	; Steal tape format from UCB.
                            15   11  1482       	BRB	30064$
                                     1484       30063$:
                       7E   50   7D  1484       	MOVQ	R0, -(SP)
                       05   08   EF  1487       	EXTZV	# MT$V_DENSITY, -		; Extract VMS density from the UCB.
                         50 A1       148A       		# MT$S_DENSITY, -
                            50       148C       		UCB$L_DEVDEPEND(R1), R0
                            51   D4  148D       	CLRL	R1				; Use default VMS density table.
                          0CD5   30  148F       	BSBW	TMSCP$VMSTOMSCP_DENS		; Convert tape density value.
                    20 A2   51   B0  1492       	MOVW	R1, MSCP$W_FORMAT(R2)		; Return the tape format.
                       50   8E   7D  1496       	MOVQ	(SP)+, R0
                                     1499       30064$:
                                     1499  3464 	GET_TAPE_MAXWRCNT	R1, R5	; Maximum write record size.
                    40 A1   05   E1  1499       	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                            08       149D       		UCB$L_DEVCHAR2(R1), 30065$	; Not MSCP tape - branch.
               24 A2   010C C1   D0  149E       	MOVL	UCB$L_TU_MAXWRCNT(R1), -	; Steal tape maxwrcnt from UCB.
                            09   11  14A4       	BRB	30066$
                                     14A6       30065$:
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  76
X-2A6A1                         - SET UNIT CHARACTERISTICS  (- 10 -)     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (28)

                  55   FFFF 8F   3C  14A6       	MOVZWL	#^XFFFF, R5			; Supply the default tape maxwrcnt.
                    24 A2   55   D0  14AB       	MOVL	R5, MSCP$L_MAXWTREC(R2)	; Return the tape maxwrcnt.
                                     14AF       30066$:
                                     14AF  3465 	GET_TAPE_NOISE		R1, R5	; Size of noise records.
                    40 A1   05   E1  14AF       	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                            08       14B3       		UCB$L_DEVCHAR2(R1), 30067$	; Not MSCP tape - branch.
               28 A2   0114 C1   B0  14B4       	MOVW	UCB$W_TU_NOISE(R1), -	; Steal tape noise from UCB.
                            06   11  14BA       	BRB	30068$
                                     14BC       30067$:
                            55   D4  14BC       	CLRL	R5				; Supply the default tape noise.
                    28 A2   55   B0  14BE       	MOVW	R5, MSCP$W_NOISEREC(R2)	; Return the tape noise.
                                     14C2       30068$:
                                     14C2  3466 	GET_TAPE_SPEED		R1, -
                                     14C2  3467 				MSCP$W_FORMAT(R2)
                    40 A1   05   E1  14C2       	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                            08       14C6       		UCB$L_DEVCHAR2(R1), 30069$	; Not MSCP tape - branch.
               22 A2   0112 C1   B0  14C7       	MOVW	UCB$W_TU_SPEED(R1), -	; Steal tape speed from UCB.
                            17   11  14CD       	BRB	30070$
                                     14CF       30069$:
                       7E   50   7D  14CF       	MOVQ	R0, -(SP)
                    51   20 A2   3C  14D2       	MOVZWL	MSCP$W_FORMAT(R2), R1			; Get the MSCP tape format.
                       08   18   EF  14D6       	EXTZV	# MT$V_SPEED, -			; Extract VMS tape speed from R1
                         50 A1       14D9       		# MT$S_SPEED, -			; and return as the tape speed.
                            50       14DB       		UCB$L_DEVDEPEND(R1), R0
                          0CF9   30  14DC       	BSBW	TMSCP$SPEEDTOMSCP		; Convert speed value.
                    22 A2   50   B0  14DF       	MOVW	R0, MSCP$W_SPEED(R2)		; Return the tape speed.
                       50   8E   7D  14E3       	MOVQ	(SP)+, R0
                                     14E6       30070$:
                                     14E6  3468 
                          0AF5   31  14E6  3469 	BRW	TMSCP$SEND_END		; Send it all back as an end message
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  77
X-2A6A1                         - DETERMINE ACCESS PATHS   (- 11 -)      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (29)

                                     14E9  3472 	.SBTTL	-	DETERMINE ACCESS PATHS			(- 11 -)
                                     14E9  3473 
                                     14E9  3474 ;+
                                     14E9  3475 ; Functional Description:
                                     14E9  3476 ;
                                     14E9  3477 ; The DETERMINE ACCESS PATHS command is used by class drivers to determine
                                     14E9  3478 ; the topology of multi-access drive configurations. When sent to a unit
                                     14E9  3479 ; that is "Unit-Online", it causes that unit and any other units that share
                                     14E9  3480 ; the same access path to identify themselves to any other controllers to 
                                     14E9  3481 ; which they are connected. For the Host Based TMSCP Server, this command
                                     14E9  3482 ; is treated as a no-op that always returns success, since units cannot be 
                                     14E9  3483 ; connected to more than one controller (Host Based MSCP Server).
                                     14E9  3484 ;
                                     14E9  3485 ; Inputs:
                                     14E9  3486 ; 
                                     14E9  3487 ;	R0  =  Scratch
                                     14E9  3488 ;	R1  =  Scratch
                                     14E9  3489 ;	R2  =  MSCP packet address
                                     14E9  3490 ;	R3  =  HRB address
                                     14E9  3491 ;	R4  =  UQB address, scratch
                                     14E9  3492 ;	R5  =  Scratch
                                     14E9  3493 ;
                                     14E9  3494 ; Outputs:
                                     14E9  3495 ;
                                     14E9  3496 ;	R0  =  Completion status
                                     14E9  3497 ;	R2  =  MSCP packet address
                                     14E9  3498 ;	R3  =  HRB address
                                     14E9  3499 ;	R4  =  UQB address
                                     14E9  3500 ;-
                                     14E9  3501 
                                     14E9  3502 TMSCP$DET_ACC_PATH::
                                     14E9  3503 	.IF DEFINED DEBUG$PC_HISTORY
                                     14E9  3504 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     14E9  3505 	.ENDC	   ;DEBUG$PC_HISTORY
                       50   00   D0  14E9  3506 	MOVL	#MSCP$K_ST_SUCC,R0	; Set a successful status code
                          0AEF   31  14EC  3507 	BRW	TMSCP$SEND_END		;  and return the end packet
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  78
X-2A6A1                         - ACCESS     (- 16 -)                    27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (30)

                                     14EF  3510 	.SBTTL	-	ACCESS					(- 16 -)
                                     14EF  3511 
                                     14EF  3512 ;+
                                     14EF  3513 ; Functional Description:
                                     14EF  3514 ;
                                     14EF  3515 ; Data is read from the unit, checked for errors, and discarded. The
                                     14EF  3516 ; purpose of this command is to verify that the designated data can be
                                     14EF  3517 ; accessed (read) without error. 
                                     14EF  3518 ;
                                     14EF  3519 ; Inputs:
                                     14EF  3520 ;
                                     14EF  3521 ;	R0  =  Scratch
                                     14EF  3522 ;	R1  =  Scratch
                                     14EF  3523 ;	R2  =  MSCP packet address
                                     14EF  3524 ;	R3  =  HRB address
                                     14EF  3525 ;	R4  =  UQB address, scratch
                                     14EF  3526 ;	R5  =  Scratch
                                     14EF  3527 ;
                                     14EF  3528 ; Outputs:
                                     14EF  3529 ;
                                     14EF  3530 ;	R0  =  The high byte contains the offset (within the MSCP packet)
                                     14EF  3531 ;		of the field in which the error was found.
                                     14EF  3532 ;	R2  =  MSCP packet address
                                     14EF  3533 ;	R3  =  HRB address
                                     14EF  3534 ;-
                                     14EF  3535 
                                     14EF  3536 TMSCP$ACCESS::
                                     14EF  3537 	.IF DEFINED DEBUG$PC_HISTORY
                                     14EF  3538 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     14EF  3539 	.ENDC	   ;DEBUG$PC_HISTORY
                  50   08   18   9C  14EF  3540 	ROTL	#24,#MSCP$B_OPCODE,R0	; This command is not supported 
                          0BAA   31  14F3  3541 	BRW	TMSCP$PACKET_ERROR	;  by the host based tape server
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  79
X-2A6A1                         - COMPARE HOST DATA   (- 32 -)           27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (31)

                                     14F6  3544 	.SBTTL	-	COMPARE HOST DATA			(- 32 -)
                                     14F6  3545 
                                     14F6  3546 ;+
                                     14F6  3547 ; Functional Description:
                                     14F6  3548 ;
                                     14F6  3549 ; Data is read from the requesting cluster member and compared to the data
                                     14F6  3550 ; on the specified tape. A compare error is reported unless the data is 
                                     14F6  3551 ; identical. Note that the occurance of any other error, except a forced
                                     14F6  3552 ; error, at the same point as the compare error overrrides the compare 
                                     14F6  3553 ; error.
                                     14F6  3554 ; 
                                     14F6  3555 ; This command provides a write function. The write routine can be used if
                                     14F6  3556 ; we just skip over the check for writelock and use a different function code.
                                     14F6  3557 ;
                                     14F6  3558 ; Inputs:
                                     14F6  3559 ;
                                     14F6  3560 ;	R0  =  Scratch
                                     14F6  3561 ;	R1  =  Scratch
                                     14F6  3562 ;	R2  =  MSCP packet address
                                     14F6  3563 ;	R3  =  HRB address
                                     14F6  3564 ;	R4  =  UQB address, scratch
                                     14F6  3565 ;	R5  =  Scratch
                                     14F6  3566 ;
                                     14F6  3567 ; Outputs:
                                     14F6  3568 ;
                                     14F6  3569 ;	R0  =  I/O function code
                                     14F6  3570 ;	R2  =  MSCP packet address
                                     14F6  3571 ;	R3  =  HRB address
                                     14F6  3572 ;-
                                     14F6  3573 
                                     14F6  3574 TMSCP$COMPARE_HOST_DATA::
                                     14F6  3575 	.IF DEFINED DEBUG$PC_HISTORY
                                     14F6  3576 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     14F6  3577 	.ENDC	   ;DEBUG$PC_HISTORY
                       50   0A   3C  14F6  3578 	MOVZWL	#IO$_WRITECHECK,R0	; Set the function code to write check
                          0468   31  14F9  3579 	BRW	TMSCP$DO_WRT		;  and go do it
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  80
X-2A6A1                         - ERASE     (- 18 -)                     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (32)

                                     14FC  3582 	.SBTTL	-	ERASE					(- 18 -)
                                     14FC  3583 
                                     14FC  3584 ;+
                                     14FC  3585 ; Functional Description:
                                     14FC  3586 ;
                                     14FC  3587 ; If the tape is a TMSCP type device, no buffer is mapped, and the request is 
                                     14FC  3588 ; sent on to the driver. If however, the tape does not support the erase
                                     14FC  3589 ; command, the request is treated very much like a write command referencing
                                     14FC  3590 ; a buffer of zeroes out to the end of the tape. The tape is then rewound to
                                     14FC  3591 ; BOT.
                                     14FC  3592 ;
                                     14FC  3593 ; If the device is not MSCP device, WRITEs of (maximum controller byte count)
                                     14FC  3594 ; are issued to the local driver until SS$_ENDOFTAPE is reached. Since non-TMSCP
                                     14FC  3595 ; drivers can not issue immediate completion WRITE commands, we have to wait
                                     14FC  3596 ; for every I/O to return, even if the user specified IO$M_NOWAIT. However, during
                                     14FC  3597 ; the IO$_REWIND, all drivers can take advantage of the immediate completion 
                                     14FC  3598 ; modifier.
                                     14FC  3599 ;
                                     14FC  3600 ; Inputs:
                                     14FC  3601 ;
                                     14FC  3602 ;	R0  =  Scratch
                                     14FC  3603 ;	R1  =  Scratch
                                     14FC  3604 ;	R2  =  MSCP packet address
                                     14FC  3605 ;	R3  =  HRB address
                                     14FC  3606 ;	R4  =  UQB address, scratch
                                     14FC  3607 ;	R5  =  Scratch
                                     14FC  3608 ;
                                     14FC  3609 ; Outputs:
                                     14FC  3610 ;
                                     14FC  3611 ;	R0  =  The high byte contains the offset (within the MSCP packet)
                                     14FC  3612 ;		of the field in which the error was found.
                                     14FC  3613 ;	R2  =  MSCP packet address
                                     14FC  3614 ;	R3  =  HRB address
                                     14FC  3615 ;-
                                     14FC  3616 
                                     14FC  3617 TMSCP$ERASE::
                                     14FC  3618 	.IF DEFINED DEBUG$PC_HISTORY
                                     14FC  3619 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     14FC  3620 	.ENDC	   ;DEBUG$PC_HISTORY
                                 B3  14FC  3621 	BITW	#<MSCP$M_UF_WRTPS!-	; If this unit is not software or
                                     14FD  3622 		MSCP$M_UF_WRTPD!-	;  data safety write protected or
                                     14FD  3623 		MSCP$M_UF_WRTPH>,-	;  hardware write protected,
               16 A4   3100 8F       14FD  3624 		UQB$W_UNIT_FLAGS(R4)	;  then
                            0B   13  1502  3625 	BEQL	10$			;  go ahead and allow the write
                            20   A8  1504  3626 	BISW	#UQB$M_ST_SEREX,-	; Set serious exception
                       00C8 C4       1506  3627 		UQB$W_ST_FLAGS(R4)
                       50   06   D0  1509  3628 	MOVL	#MSCP$K_ST_WRTPR,R0	; Otherwise, set an error status
                          0ACF   31  150C  3629 	BRW	TMSCP$SEND_END		;  and return an end message
                                     150F  3630 
                                     150F  3631 10$:
              55   00000000'GF   D0  150F  3632 	MOVL	G^SCS$GL_TMSCP, R5	; Get TSRV structure address.
                         0C A2   D0  1516  3633 	MOVL	MSCP$L_BYTE_CNT(R2),-	; Get the byte count passed
                         38 A3       1519  3634 		HRB$L_OBCNT(R3)		;  and save it as the original byte cnt
                            0A   12  151B  3635 	BNEQ	30$			; If its nonzero then go through with it
                       0568 C5   D6  151D  3636 	INCL	TSRV$L_BLKCOUNT(R5)	; Count the zero block transfer
                       50   00   D0  1521  3637 	MOVL	#MSCP$K_ST_SUCC,R0	; Set a successful status to return
                          0AB7   31  1524  3638 	BRW	TMSCP$SEND_END		;  and we are finished!
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  81
X-2A6A1                         - ERASE     (- 18 -)                     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (32)

                                     1527  3639 
                                     1527  3640 ;
                                     1527  3641 ; Set up the IRP for a transfer, regardless of whether or not the
                                     1527  3642 ; device is a TMSCP device or not.
                                     1527  3643 ;
                                     1527  3644 
                                     1527  3645 30$:
                    55   1C A3   D0  1527  3646 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the address of the IRP
                    51   24 A4   D0  152B  3647 	MOVL	UQB$L_UCB(R4),R1	; Get the UCB address for this unit.
                    1C A5   51   D0  152F  3648 	MOVL	R1,IRP$L_UCB(R5)	; Save away the UCB address in the IRP
                         44 A3   B0  1533  3649 	MOVW	HRB$W_BOFF(R3),-	;  the byte offset within the page,
                         30 A5       1536  3650 		IRP$W_BOFF(R5)		;  of the start of the buffer
                    14 A5   53   D0  1538  3651 	MOVL	R3,IRP$L_HRB(R5)	; Set the HRB address for IO completion
                       00C8 C1   D0  153C  3652 	MOVL	UCB$L_MAXBCNT(R1),-	; Limit the size of this
                         46 A3       1540  3653 		HRB$L_BCNT(R3)		;  transfer to the device limit
                            05   E1  1542  3654 	BBC	#DEV$V_MSCP,-		; If we are not dealing with a MSCP type
                      18 40 A1       1544  3655 		UCB$L_DEVCHAR2(R1),40$	;  device, then we may have more work to do
                         4D A1   91  1547  3656 	CMPB	UCB$B_DEVTYPE(R1),-	; The TU78 can support IO$_DSE
                            05       154A  3657 		#DT$_TU78		;  as well.
                            12   13  154B  3658 	BEQL	40$			; 
                       50   15   D0  154D  3659 	MOVL	#IO$_DSE,R0		; Put the function code in a register
                                     1550  3660 ;
                                     1550  3661 ; Use the IMMEDIATE COMPLETION opcode modifier bit passed in the packet.
                                     1550  3662 ;
                            06   E1  1550  3663 	BBC	#MSCP$V_MD_IMMED,-	; Immediate completion specified?
                      05 0A A2       1552  3664 		MSCP$W_MODIFIER(R2),35$	; If not, don't change op code.
                       0080 8F   A8  1555  3665 	BISW	#IO$M_NOWAIT,-		; Set nowait in the function itself
                            50       1559  3666 		R0			;   (to return immediately)
                                     155A  3667 35$:
                         40 A3   D4  155A  3668 	CLRL	HRB$L_SVAPTE(R3)	; No SVAPTE is necessary if supported
                            0B   11  155D  3669 	BRB	50$			; Perform the I/O
                                     155F  3670 
                                     155F  3671 ;
                                     155F  3672 ; Since the erase command is using the pseudo page table and not actually
                                     155F  3673 ; allocating and mapping memory for its transfers, we will not check the
                                     155F  3674 ; byte count of the transfer.
                                     155F  3675 ; 
                                     155F  3676 
                                     155F  3677 40$:
                       50   0B   D0  155F  3678 	MOVL	#IO$_WRITEPBLK,R0	; Set the function code...
                   00000000'GF   D0  1562  3679 	MOVL	G^EXE$GL_ERASEPPT,-	; Save the system PPT in which all the 
                         40 A3       1568  3680 		HRB$L_SVAPTE(R3)	;  PTEs point to the same system EPB
                                     156A  3681 ;
                                     156A  3682 ; The IRP packet is ready to send to the tape. R0 contains the function code.
                                     156A  3683 ;
                                     156A  3684 
                                     156A  3685 50$:
                         46 A3   D0  156A  3686 	MOVL	HRB$L_BCNT(R3),-	; Save the byte count to be used for
                         32 A5       156D  3687 		IRP$L_BCNT(R5)		;  this (portion of the) transfer.
                         40 A3   D0  156F  3688 	MOVL	HRB$L_SVAPTE(R3),-	; Move the local buffer
                         2C A5       1572  3689 		IRP$L_SVAPTE(R5)	;  virtual page table entry,
                    52   18 A3   D0  1574  3690 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                    14 A5   53   D0  1578  3691 	MOVL	R3,IRP$L_HRB(R5)	; Save the HRB address
                    20 A5   50   B0  157C  3692 	MOVW	R0,IRP$W_FUNC(R5)	; Set the completed code in the IRP
                          FC50   30  1580  3693 	BSBW	TMSCP$SET_CLEAR_SEX	; Set clear serious exception
                          FCA2   30  1583  3694 	BSBW	TMSCP$SET_CLEAR_CDL	; Set clear cached data lost
                                     1586  3695 ;
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  82
X-2A6A1                         - ERASE     (- 18 -)                     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (32)

                                     1586  3696 ; Send this request to the tape. If the request is aborted while on the
                                     1586  3697 ; tape queue, it is cleaned up when control is returned to TMSCP$BACK, and 
                                     1586  3698 ; never heard from again.
                                     1586  3699 ;
                                     1586  3700 
                                     1586  3701 70$:
                                     1586  3702 
                                     1586  3703 ;
                                     1586  3704 ;	R0  =  Scratch
                                     1586  3705 ;	R1  =  Scratch
                                     1586  3706 ;	R2  =  Scratch
                                     1586  3707 ;	R3  =  HRB address
                                     1586  3708 ;	R4  =  UQB address
                                     1586  3709 ;	R5  =  Scratch
                                     1586  3710 ;
                                     1586  3711 
                          0569   30  1586  3712 	BSBW	TMSCP$DRIVE_TRANSFER	; Give the request to the tape
                                     1589  3713 
                                     1589  3714 ;
                                     1589  3715 ; Control returns here from entry point TMSCP$BACK. 
                                     1589  3716 ;
                                     1589  3717 ;	R0  =  I/O status block, scratch
                                     1589  3718 ;	R1  =  Scratch
                                     1589  3719 ;	R2  =  Scratch
                                     1589  3720 ;	R3  =  HRB address
                                     1589  3721 ;	R4  =  UQB address
                                     1589  3722 ;	R5  =  IRP address
                                     1589  3723 ;
                                     1589  3724 
                         60 A3   D7  1589  3725 	DECL	HRB$L_CMD_STS(R3)	; Report progress on this request
                    55   1C A3   D0  158C  3726 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the address of the IRP back
                    51   20 A5   B0  1590  3727 	MOVW	IRP$W_FUNC(R5),R1	; If this was a device which didn't
                  51   0080 8F   AA  1594  3728 	BICW	#IO$M_NOWAIT,R1		;  support IO$_DSE, then we may have
                       15   51   B1  1599  3729 	CMPW	R1,#IO$_DSE		;  to do more writes of zeroes.
                            3B   13  159C  3730 	BEQL	200$
                  50   0878 8F   B1  159E  3731 	CMPW	#SS$_ENDOFTAPE,R0       ; If we reached EOT, we can start
                            11   13  15A3  3732 	BEQL	100$			;  the rewind.
                         07 50   E8  15A5  3733 	BLBS	R0,80$			; If the transfer was successful, cont...
                          0852   30  15A8  3734 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.
                    55   1C A3   D0  15AB  3735 	MOVL	HRB$L_IRP_CDRP(R3), R5	; Get the IRP address
                                     15AF  3736 
                                     15AF  3737 80$:
                         46 A3   D0  15AF  3738 	MOVL	HRB$L_BCNT(R3),-	; Use the maximum controller supported byte
                         32 A5       15B2  3739 		IRP$L_BCNT(R5)		;  count
                            D0   11  15B4  3740 	BRB	70$			; Send the next chunk of zeros
                                     15B6  3741 
                                     15B6  3742 100$:
                            24   B0  15B6  3743 	MOVW	#IO$_REWIND,-		;  before checking anything
                         20 A5       15B8  3744 		IRP$W_FUNC(R5)		;  else.
                    14 A5   53   D0  15BA  3745 	MOVL	R3,IRP$L_HRB(R5)	; Save HRB address
                          FC12   30  15BE  3746 	BSBW	TMSCP$SET_CLEAR_SEX
                                     15C1  3747 ;
                                     15C1  3748 ; Use the IMMEDIATE COMPLETION opcode modifier bit passed in the packet.
                                     15C1  3749 ;
                    52   18 A3   D0  15C1  3750 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore MSCP buffer address.
                            06   E1  15C5  3751 	BBC	#MSCP$V_MD_IMMED,-	; Immediate completion specified?
                      06 0A A2       15C7  3752 		MSCP$W_MODIFIER(R2),110$ ; If not, don't change op code.
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  83
X-2A6A1                         - ERASE     (- 18 -)                     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (32)

                       0080 8F   A8  15CA  3753 	BISW	#IO$M_NOWAIT,-		; Set nowait in the function itself
                         20 A5       15CE  3754 		IRP$W_FUNC(R5)		;    (to returm imediately)
                                     15D0  3755 110$:                                        
                                     15D0  3756 
                                     15D0  3757 ;
                                     15D0  3758 ;	R0  =  Scratch
                                     15D0  3759 ;	R1  =  Scratch
                                     15D0  3760 ;	R2  =  MSCP address
                                     15D0  3761 ;	R3  =  HRB address
                                     15D0  3762 ;	R4  =  UQB address
                                     15D0  3763 ;	R5  =  Scratch
                                     15D0  3764 ;
                                     15D0  3765 
                          051F   30  15D0  3766 	BSBW	TMSCP$DRIVE_TRANSFER	; Call a subroutine to do the I/O
                                     15D3  3767 
                                     15D3  3768 ;
                                     15D3  3769 ; Control returns here from entry point TMSCP$BACK. 
                                     15D3  3770 ;
                                     15D3  3771 ;	R0  =  I/O status block, scratch
                                     15D3  3772 ;	R1  =  Scratch
                                     15D3  3773 ;	R2  =  Scratch
                                     15D3  3774 ;	R3  =  HRB address
                                     15D3  3775 ;	R4  =  UQB address
                                     15D3  3776 ;	R5  =  IRP address
                                     15D3  3777 ;
                                     15D3  3778 
                         03 50   E8  15D3  3779 	BLBS	R0,200$			; If the transfer was successful, cont...
                          0824   30  15D6  3780 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.
                                     15D9  3781 
                                     15D9  3782 
                                     15D9  3783 200$:
                    52   18 A3   D0  15D9  3784 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                       50   00   D0  15DD  3785 	MOVL	#MSCP$K_ST_SUCC,R0	; Set the completion code to success
                          09FB   31  15E0  3786 	BRW	TMSCP$SEND_END		;  and return a response to the request
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  84
X-2A6A1                         - ERGAP                                  27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (33)

                                     15E3  3789 	.SBTTL	-	ERGAP
                                     15E3  3790 
                                     15E3  3791 ;+
                                     15E3  3792 ;Functional Description:
                                     15E3  3793 ;
                                     15E3  3794 ; The Write Inter-Record Gap command records a format dependent record gap, at
                                     15E3  3795 ; the current tape position. It is used for bypassing tape defects when write 
                                     15E3  3796 ; error recovery is host controlled. Since only TMSCP tapes support this function,
                                     15E3  3797 ; and there is no way to simulate this function in other drivers, this function
                                     15E3  3798 ; cannot be supported.
                                     15E3  3799 ;
                                     15E3  3800 ; Inputs:
                                     15E3  3801 ;
                                     15E3  3802 ;	R0  =  Scratch
                                     15E3  3803 ;	R1  =  Scratch
                                     15E3  3804 ;	R2  =  MSCP packet address
                                     15E3  3805 ;	R3  =  HRB address
                                     15E3  3806 ;	R4  =  UQB address, scratch
                                     15E3  3807 ;	R5  =  Scratch
                                     15E3  3808 ;
                                     15E3  3809 ; Outputs:
                                     15E3  3810 ;
                                     15E3  3811 ;	R0  =  MSCP completion status
                                     15E3  3812 ;	R2  =  MSCP packet address
                                     15E3  3813 ;	R3  =  HRB address
                                     15E3  3814 ;-
                                     15E3  3815 
                                     15E3  3816 
                                     15E3  3817 TMSCP$ERASE_GAP::
                                     15E3  3818 	.IF DEFINED DEBUG$PC_HISTORY
                                     15E3  3819 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     15E3  3820 	.ENDC	   ;DEBUG$PC_HISTORY
                       50   01   D0  15E3  3821 	MOVL	#MSCP$K_ST_ICMD, R0	; This command is not supported.
                          09F5   31  15E6  3822 	BRW	TMSCP$SEND_END
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  85
X-2A6A1                         - REPOSITION                             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (34)

                                     15E9  3825 	.SBTTL	-	REPOSITION
                                     15E9  3826 
                                     15E9  3827 ;+
                                     15E9  3828 ;Functional Description:
                                     15E9  3829 ;
                                     15E9  3830 ; The REPOSITION command is used to position the tape from one location to 
                                     15E9  3831 ; another. There are four subcommands defined within the realms of
                                     15E9  3832 ; the REPOSITION command. IO$_REWIND is implemented if MSCP$M_MD_REWND 
                                     15E9  3833 ; modifier is set. If the Object Count command modifier MSCP$M_MD_OBJCT
                                     15E9  3834 ; is set and the field MSCP$L_POSITION is non-zero, then a pseudo
                                     15E9  3835 ; Skip Tape Object is performed by using IO$_SKIPRECORDs. The Skip Tape
                                     15E9  3836 ; Object is requested by the class driver in routine BRING_UNIT_ONLINE.
                                     15E9  3837 ; After we have brought a unit back ONLINE after a connection failure,
                                     15E9  3838 ; we reposition back to where the tape was positioned at the time
                                     15E9  3839 ; of the failure by skipping the correct number of objects.
                                     15E9  3840 ;
                                     15E9  3841 ; If the object Count command modifier is clear and the field MSCP$L_REC_CNT
                                     15E9  3842 ; is non-zero, then an IO$_SKIPRECORD is issued for that number of
                                     15E9  3843 ; records. If the Object Count command modifier is clear and the
                                     15E9  3844 ; field MSCP$L_TMGP_CNT is non-zero, then an IO$_SKIPFILE is
                                     15E9  3845 ; issued.
                                     15E9  3846 ;
                                     15E9  3847 ; Table D-1 in the TMSCP spec shows all the possible combinations
                                     15E9  3848 ; of modifiers and field values for the REPOSITION command, and
                                     15E9  3849 ; the correct controller actions for each. Fortunately, the class
                                     15E9  3850 ; driver uses a subset of these actions, and only those actions
                                     15E9  3851 ; are implemented here.
                                     15E9  3852 ;
                                     15E9  3853 ; Inputs:
                                     15E9  3854 ;
                                     15E9  3855 ;	R0  =  Scratch
                                     15E9  3856 ;	R1  =  Scratch
                                     15E9  3857 ;	R2  =  MSCP packet address
                                     15E9  3858 ;	R3  =  HRB address
                                     15E9  3859 ;	R4  =  UQB address, scratch
                                     15E9  3860 ;	R5  =  Scratch
                                     15E9  3861 ;
                                     15E9  3862 ; Outputs:
                                     15E9  3863 ;
                                     15E9  3864 ;	R0  =  Status
                                     15E9  3865 ;	R2  =  MSCP packet address
                                     15E9  3866 ;	R3  =  HRB address
                                     15E9  3867 ;-
                                     15E9  3868 
                                     15E9  3869 TMSCP$REPOSITION::
                                     15E9  3870 	.IF DEFINED DEBUG$PC_HISTORY
                                     15E9  3871 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     15E9  3872 	.ENDC	   ;DEBUG$PC_HISTORY
                                     15E9  3873 ;
                                     15E9  3874 ; Is unit online to the requestor?
                                     15E9  3875 ;
                                     15E9  3876 	
                         70 A4   D1  15E9  3877 	CMPL	UQB$L_ONLINE_HQB(R4),-	; Is the host that has this unit
                         54 A3       15EC  3878 		HRB$L_HQB(R3)		;  online the same as the requesting host?
                            06   13  15EE  3879 	BEQL	10$			; If online, continue...
                       50   03   D0  15F0  3880 	MOVL	#MSCP$K_ST_OFFLN,R0	; Otherwise this is an invalid command
                          09E8   31  15F3  3881 	BRW	TMSCP$SEND_END
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  86
X-2A6A1                         - REPOSITION                             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (34)

                                     15F6  3882 
                                     15F6  3883 10$:
                    55   1C A3   D0  15F6  3884 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the IRP address.
                                     15FA  3885 ;
                                     15FA  3886 ; First, check for the Rewind modifier bit set. If set, no matter what other
                                     15FA  3887 ; modifier is set, an IO$_REWIND is always issued first.
                                     15FA  3888 ;
                            01   E0  15FA  3889 	BBS	#MSCP$V_MD_REWND,-	; If REWIND modifier set,
                      03 0A A2       15FC  3890 		MSCP$W_MODIFIER(R2),15$	;  issue an IO$_REWIND 
                          00C0   31  15FF  3891 	BRW	80$			; Branch assist.
                                     1602  3892 
                                     1602  3893 15$:
                            24   B0  1602  3894 	MOVW	#IO$_REWIND,-		;  Set rewind function in IRP.
                         20 A5       1604  3895 		IRP$W_FUNC(R5)
                          FBCA   30  1606  3896 	BSBW	TMSCP$SET_CLEAR_SEX
                                     1609  3897 ;
                                     1609  3898 ; Use the IMMEDIATE COMPLETION opcode modifier bit passed in the packet.
                                     1609  3899 ;
                            06   E1  1609  3900 	BBC	#MSCP$V_MD_IMMED,-	; Immediate completion specified?
                      06 0A A2       160B  3901 		MSCP$W_MODIFIER(R2),20$ ; If not, don't change op code.
                       0080 8F   A8  160E  3902 	BISW	#IO$M_NOWAIT,-		; Set nowait in the function itself
                         20 A5       1612  3903 		IRP$W_FUNC(R5)		;    (to returm imediately)
                                     1614  3904 20$:
                    14 A5   53   D0  1614  3905 	MOVL	R3,IRP$L_HRB(R5)	; Save HRB for I/O completion
                         24 A4   D0  1618  3906 	MOVL	UQB$L_UCB(R4),-		; Save UCB for I/O completion
                         1C A5       161B  3907 		IRP$L_UCB(R5)
                                     161D  3908 
                                     161D  3909 ;
                                     161D  3910 ;	R0  =  Scratch
                                     161D  3911 ;	R1  =  Scratch
                                     161D  3912 ;	R2  =  Scratch
                                     161D  3913 ;	R3  =  HRB address
                                     161D  3914 ;	R4  =  UQB address
                                     161D  3915 ;	R5  =  Scratch
                                     161D  3916 ;
                                     161D  3917 
                          04D2   30  161D  3918 	BSBW	TMSCP$DRIVE_TRANSFER	; Call a subroutine to do the I/O
                                     1620  3919 
                                     1620  3920 ;
                                     1620  3921 ; Control returns here from entry point TMSCP$BACK. 
                                     1620  3922 ;
                                     1620  3923 ;	R0  =  I/O status block, scratch
                                     1620  3924 ;	R1  =  Scratch
                                     1620  3925 ;	R2  =  Scratch
                                     1620  3926 ;	R3  =  HRB address
                                     1620  3927 ;	R4  =  UQB address
                                     1620  3928 ;	R5  =  IRP address
                                     1620  3929 ;
                                     1620  3930 ; The IO$_REWIND will cause the local driver to begin the first operation
                                     1620  3931 ; of this REPOSITION command. Possible further I/Os to the drive are
                                     1620  3932 ; investigated.
                                     1620  3933 ;
                                     1620  3934 
                         64 A3   D4  1620  3935 	CLRL	HRB$L_OBJECT_SKIP(R3)	; Initiate object counter
                    54   58 A3   D0  1623  3936 	MOVL	HRB$L_UQB(R3),R4	; Get the host queue block address
                    52   18 A3   D0  1627  3937 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore packet address
                    55   1C A3   D0  162B  3938 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Restore IRP-CDRP pair.
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  87
X-2A6A1                         - REPOSITION                             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (34)

                         05 50   E8  162F  3939 	BLBS	R0,30$			; If the transfer was successful, cont...
                          07C8   30  1632  3940 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.
                            0D   11  1635  3941 	BRB	32$
                                     1637  3942 
                                     1637  3943 30$:
                       50   00   D0  1637  3944 	MOVL	#MSCP$K_ST_SUCC,R0	; This command has completed successfuly
                            01   A8  163A  3945 	BISW	#UQB$M_ST_BOT,-		; If rewind was successful,
                       00C8 C4       163C  3946 		UQB$W_ST_FLAGS(R4)	;  we must be at BOT
                            04   AA  163F  3947 	BICW	#UQB$M_ST_EOT,-		; If rewind was successful,
                       00C8 C4       1641  3948 		UQB$W_ST_FLAGS(R4)	;  we can clear the EOT flag.
                                     1644  3949 
                                     1644  3950 32$:
                       00AC C4   B4  1644  3951 	CLRW	UQB$W_TAPEM_SKIP(R4) 	; Initialize tape mark counter
                       00AE C4   B4  1648  3952 	CLRW	UQB$W_RECORD_SKIP(R4)	;  as well as record counter.
                            02   E0  164C  3953 	BBS	#MSCP$V_MD_OBJCT,-	; If Skip Object specified, begin
                      03 0A A2       164E  3954 		MSCP$W_MODIFIER(R2),35$	;  issuing IO$_SKIPRECORD to simulate.
                          010A   31  1651  3955 	BRW	1000$			;  else we are done.
                                     1654  3956 ;
                                     1654  3957 ; None of the tape drivers support skipping objects, only tape marks or records.
                                     1654  3958 ; The class driver issues this command during the routine to bring an available
                                     1654  3959 ; unit online after a connection failure. The command is a REPOSITION rewind
                                     1654  3960 ; followed by a repositioning back to UCB$L_RECORD, which was the object count
                                     1654  3961 ; of the drive before the connection was lost.
                                     1654  3962 ;
                                     1654  3963 ; Issue an IO$_SKIPRECORD specifying the number of objects to skip as the number
                                     1654  3964 ; of records to skip. Either this many records will be skipped or a tape mark
                                     1654  3965 ; will be encountered. If a tape mark is encountered before the reposition is
                                     1654  3966 ; satisfied, subtract the object count by the number of records already skipped
                                     1654  3967 ; plus the tape mark, from the original count and reissue the IO$_SKIPRECORD
                                     1654  3968 ; with this new count.
                                     1654  3969 ;
                                     1654  3970 
                                     1654  3971 35$:
                         0C A2   D0  1654  3972 	MOVL	MSCP$L_REC_CNT(R2),-	; Initialize the number of objects 
                         64 A3       1657  3973 		HRB$L_OBJECT_SKIP(R3)	;   to skip
                                     1659  3974 
                                     1659  3975 40$:
                         64 A3   3C  1659  3976  	MOVZWL	HRB$L_OBJECT_SKIP(R3),- ; Skip records until tape mark hit
                         38 A5       165C  3977 		IRP$L_MEDIA(R5)		;  or object count satisfied
                            26   B0  165E  3978 	MOVW	#IO$_SKIPRECORD,-	; Issue an IO$_SKIPRECORD for the
                         20 A5       1660  3979 		IRP$W_FUNC(R5)		;  number of objects to skip.
                          FB6E   30  1662  3980 	BSBW	TMSCP$SET_CLEAR_SEX	; Set clear serious exception.
                                     1665  3981 
                                     1665  3982 50$:
                         30 A5   B4  1665  3983 	CLRW	IRP$W_BOFF(R5)		; No bytes to offset to.
                         2C A5   D4  1668  3984 	CLRL	IRP$L_SVAPTE(R5)	; No buffer.
                         32 A5   D4  166B  3985 	CLRL	IRP$L_BCNT(R5)		; No bytes to transfer.
                    14 A5   53   D0  166E  3986 	MOVL	R3,IRP$L_HRB(R5)	; Save HRB for I/O completion
                         24 A4   D0  1672  3987 	MOVL	UQB$L_UCB(R4),-		; Save UCB for I/O completion
                         1C A5       1675  3988 		IRP$L_UCB(R5)
                                     1677  3989 
                                     1677  3990 ;
                                     1677  3991 ;	R0  =  Scratch
                                     1677  3992 ;	R1  =  Scratch
                                     1677  3993 ;	R2  =  Scratch
                                     1677  3994 ;	R3  =  HRB address
                                     1677  3995 ;	R4  =  UQB address
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  88
X-2A6A1                         - REPOSITION                             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (34)

                                     1677  3996 ;	R5  =  Scratch
                                     1677  3997 ;
                                     1677  3998 
                          0478   30  1677  3999 	BSBW	TMSCP$DRIVE_TRANSFER	; Call a subroutine to do the I/O
                                     167A  4000 
                                     167A  4001 ;
                                     167A  4002 ; Control returns here from entry point TMSCP$BACK. 
                                     167A  4003 ;
                                     167A  4004 ;	R0  =  I/O status block, scratch
                                     167A  4005 ;	R1  =  Scratch
                                     167A  4006 ;	R2  =  Scratch
                                     167A  4007 ;	R3  =  HRB address
                                     167A  4008 ;	R4  =  UQB address
                                     167A  4009 ;	R5  =  IRP address
                                     167A  4010 ;
                                     167A  4011 
                    52   18 A3   D0  167A  4012 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore packet address
                  0870 8F   50   B1  167E  4013 	CMPW	R0,#SS$_ENDOFFILE	; Tape mark encountered?
                            0A   12  1683  4014 	BNEQ	60$			; If so then add a tape mark
                       00AC C4   B6  1685  4015 	INCW	UQB$W_TAPEM_SKIP(R4) 	; to the total number of tape marks
                       00AE C4   B7  1689  4016 	DECW	UQB$W_RECORD_SKIP(R4)   ; and compensate now for the tape mark
                                     168D  4017 					;  that is included in the count field
                                     168D  4018 					;  of the IOSB.
                            09   11  168D  4019 	BRB	70$			; 
                                     168F  4020 
                                     168F  4021 60$:
                         06 50   E8  168F  4022 	BLBS	R0,70$			; If the transfer was successful, cont...
                          0768   30  1692  4023 	BSBW	TMSCP$CHECK_XFER_STATUS
                          00C6   31  1695  4024 	BRW	1000$
                                     1698  4025 
                                     1698  4026 70$:
               50   50   F0 8F   78  1698  4027 	ASHL	#-16,R0,R0		; # of records skipped in low word.
                  00AE C4   50   A0  169D  4028 	ADDW2	R0,UQB$W_RECORD_SKIP(R4); Add records skipped (and tapem) to total.
                    55   1C A3   D0  16A2  4029 	MOVL	HRB$L_IRP_CDRP(R3), R5	; Get the IRP address.
                    68 A3   50   A2  16A6  4030 	SUBW	R0,HRB$L_CURRENT_SKIP(R3); Determine number of remaining objects left.
                            AD   12  16AA  4031 	BNEQ	40$			; Continue until all objects skipped
                                     16AC  4032 ;
                                     16AC  4033 ; Fill in appropriate MSCP fields.
                                     16AC  4034 ;
                       00AC C4   D0  16AC  4035 	MOVL	UQB$W_TAPEM_SKIP(R4),- 	; Update number of tape
                         10 A2       16B0  4036 		MSCP$L_TMGP_CNT(R2)	;  marks skipped.
                       00AE C4   D0  16B2  4037 	MOVL	UQB$W_RECORD_SKIP(R4),-	; Update number of records
                         0C A2       16B6  4038 		MSCP$L_REC_CNT(R2)	;  skipped.
                    54   24 A4   D0  16B8  4039 	MOVL	UQB$L_UCB(R4),R4	;  get the UCB
                       50   00   D0  16BC  4040 	MOVL	#MSCP$K_ST_SUCC,R0	; This command has completed successfuly
                          009C   31  16BF  4041 	BRW	1000$			
                                     16C2  4042 
                                     16C2  4043 ;
                                     16C2  4044 ; Process IO$_SKIPRECORD or IO$_SPACERECORD
                                     16C2  4045 ;
                                     16C2  4046 ;	R0  =  Scratch
                                     16C2  4047 ;	R1  =  Scratch
                                     16C2  4048 ;	R2  =  MSCP message address
                                     16C2  4049 ;	R3  =  HRB address
                                     16C2  4050 ;	R4  =  UQB address, scratch
                                     16C2  4051 ;	R5  =  IRP address, scratch
                                     16C2  4052 ;
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  89
X-2A6A1                         - REPOSITION                             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (34)

                                     16C2  4053 
                                     16C2  4054 80$:
                         0C A2   D0  16C2  4055 	MOVL	MSCP$L_REC_CNT(R2),-	; Set up number of records to skip and
                         38 A5       16C5  4056 		IRP$L_MEDIA(R5)		;  if non-zero, this is a Skip Record command
                            0F   13  16C7  4057 	BEQL	100$			;  else it is a Skip File or Seq Nop command
                                     16C9  4058 
                            26   B0  16C9  4059 	MOVW	#IO$_SKIPRECORD,-	; Issue the logical command IO$_SKIPRECORD for the
                         20 A5       16CB  4060 		IRP$W_FUNC(R5)		;  number of objects to skip
                            07   E1  16CD  4061 	BBC	#MSCP$V_MD_DLEOT,-	; If LEOT detection is not enabled, this
                      04 0A A2       16CF  4062 		MSCP$W_MODIFIER(R2), 90$;  is a physical command
                            09   B0  16D2  4063 	MOVW	#IO$_SPACERECORD,-	; Issue an IO$_SPACERECORD for the
                         20 A5       16D4  4064 		IRP$W_FUNC(R5)		;  number of objects to skip
                                     16D6  4065 
                                     16D6  4066 90$:
                            12   11  16D6  4067 	BRB	200$			;  and issue the I/O
                                     16D8  4068 ;
                                     16D8  4069 ; Process IO$_SKIPFILE and IO$_SPACEFILE.
                                     16D8  4070 ;
                                     16D8  4071 
                                     16D8  4072 100$:
                         10 A2   D0  16D8  4073 	MOVL	MSCP$L_TMGP_CNT(R2),-	; Set up number of files 
                         38 A5       16DB  4074 		IRP$L_MEDIA(R5)		;  to skip and 
                            25   B0  16DD  4075 	MOVW	#IO$_SKIPFILE,-		;  issue an IO$_SKIPFILES.
                         20 A5       16DF  4076 		IRP$W_FUNC(R5)		;  
                            07   E1  16E1  4077 	BBC	#MSCP$V_MD_DLEOT,-	; If LEOT detection is not enabled, this
                         0A A2       16E3  4078 		MSCP$W_MODIFIER(R2),-	;  is a physical command
                            04       16E5  4079 		200$
                            02   B0  16E6  4080 	MOVW	#IO$_SPACEFILE,-	;   so issue an IO$_SPACEFILE
                         20 A5       16E8  4081 		IRP$W_FUNC(R5)		;   instead
                                     16EA  4082 
                                     16EA  4083 200$:
                          FAE6   30  16EA  4084 	BSBW	TMSCP$SET_CLEAR_SEX
                            03   E1  16ED  4085 	BBC	#MSCP$V_MD_REVRS,-	; If the reverse modifier is set, then
                      05 0A A2       16EF  4086 		MSCP$W_MODIFIER(R2),220$ ;  the original I/O had a negative record count.
                         38 A5   AE  16F2  4087 	MNEGW	IRP$L_MEDIA(R5),-	; Negate the request                    
                         38 A5       16F5  4088 		IRP$L_MEDIA(R5)		;  so the a Skip Record reverse is performed.
                                     16F7  4089 
                                     16F7  4090 220$:
                    14 A5   53   D0  16F7  4091 	MOVL	R3,IRP$L_HRB(R5)	; Save HRB for I/O completion
                         24 A4   D0  16FB  4092 	MOVL	UQB$L_UCB(R4),-		; Save UCB for I/O completion
                         1C A5       16FE  4093 		IRP$L_UCB(R5)
                                     1700  4094 
                                     1700  4095 ;
                                     1700  4096 ;	R0  =  Scratch
                                     1700  4097 ;	R1  =  Scratch
                                     1700  4098 ;	R2  =  Scratch
                                     1700  4099 ;	R3  =  HRB address
                                     1700  4100 ;	R4  =  UQB address
                                     1700  4101 ;	R5  =  Scratch
                                     1700  4102 ;
                                     1700  4103 
                          03EF   30  1700  4104 	BSBW	TMSCP$DRIVE_TRANSFER	; Call a subroutine to do the I/O
                                     1703  4105 
                                     1703  4106 ;
                                     1703  4107 ; Control returns here from entry point TMSCP$BACK. 
                                     1703  4108 ;
                                     1703  4109 ;	R0  =  I/O status block, scratch
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  90
X-2A6A1                         - REPOSITION                             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (34)

                                     1703  4110 ;	R1  =  Scratch
                                     1703  4111 ;	R2  =  Scratch
                                     1703  4112 ;	R3  =  HRB address
                                     1703  4113 ;	R4  =  UQB address
                                     1703  4114 ;	R5  =  IRP address
                                     1703  4115 ;
                                     1703  4116 
                    55   1C A3   D0  1703  4117 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Restore IRP address
                    52   18 A3   D0  1707  4118 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore packet address
                    54   58 A3   D0  170B  4119 	MOVL	HRB$L_UQB(R3),R4	; Get the UQB to as to
                    54   24 A4   D0  170F  4120 	MOVL	UQB$L_UCB(R4),R4	;  get the UCB
               51   50   F0 8F   78  1713  4121 	ASHL	#-16,R0,R1		; Calculate record or file skipped count.
                         0C A2   D5  1718  4122 	TSTL	MSCP$L_REC_CNT(R2)	; Was this an IO$_SKIPRECORD or IO$_SPACERECORD?
                            09   13  171B  4123 	BEQL	400$			; If so, then
                    0C A2   51   3C  171D  4124 	MOVZWL	R1,MSCP$L_RCSKIPED(R2)	;  update number of records skipped
                         10 A2   D4  1721  4125 	CLRL	MSCP$L_TMSKIPED(R2)
                            07   11  1724  4126 	BRB	450$
                                     1726  4127 
                                     1726  4128 400$:
                    10 A2   51   3C  1726  4129 	MOVZWL	R1,MSCP$L_TMSKIPED(R2)	;  else update number of files skipped
                         0C A2   D4  172A  4130 	CLRL	MSCP$L_RCSKIPED(R2)
                                     172D  4131 
                                     172D  4132 450$:
                       00C4 C4   D0  172D  4133 	MOVL	UCB$L_RECORD(R4),-	; Update position of tape
                         1C A2       1731  4134 		MSCP$L_POSITION(R2)
                            05   E1  1733  4135 	BBC	#DEV$V_MSCP,-		; If we are not dealing with an MSCP
                      06 40 A4       1735  4136 		UCB$L_DEVCHAR2(R4),500$	;  device, then we can get the record
                       0080 C3   D0  1738  4137 	MOVL	HRB$L_RECORD(R3),-	;  count out of the HRB since the 
                         1C A2       173C  4138 		MSCP$L_POSITION(R2)	;  class driver set it for us.
                                     173E  4139 
                                     173E  4140 500$:
                         05 50   E8  173E  4141 	BLBS	R0,600$			; If the transfer was successful, cont...
                          06B9   30  1741  4142 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.
                            18   11  1744  4143 	BRB	1000$
                                     1746  4144 
                                     1746  4145 600$:
                       50   00   D0  1746  4146 	MOVL	#MSCP$K_ST_SUCC,R0	; This command has completed successfuly
                            10   E1  1749  4147 	BBC	#MT$V_BOT,-
                      10 50 A4       174B  4148 		UCB$L_DEVDEPEND(R4),1000$
                    54   58 A3   D0  174E  4149 	MOVL	HRB$L_UQB(R3), R4	; Get unit queue block address.
                       50   0D   D0  1752  4150 	MOVL	#MSCP$K_ST_BOT,R0
                            04   AA  1755  4151 	BICW	#UQB$M_ST_EOT,-		; Clear the end of tape flag
                       00C8 C4       1757  4152 		UQB$W_ST_FLAGS(R4)	;
                            10   A8  175A  4153 	BISW	#MSCP$M_EF_SEREX,-	; Set the serious exception flag
                         09 A2       175C  4154 		MSCP$B_FLAGS(R2)	
                                     175E  4155 	.IF DEFINED DEBUG$CURRENT_SANITY
                                     175E  4156 	BSBW	TMSCP$CHECK_CURRENT	; Sanity check the current counters
                                     175E  4157 	.ENDC	   ;DEBUG$CURRENT_SANITY
                                     175E  4158 
                                     175E  4159 1000$:
                    52   18 A3   D0  175E  4160 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore packet address
                          0879   31  1762  4161 	BRW	TMSCP$SEND_END		; Send an end packet with R0 status
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  91
X-2A6A1                         - FLUSH     (- 19 -)                     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (35)

                                     1765  4164 	.SBTTL	-	FLUSH					(- 19 -)
                                     1765  4165 
                                     1765  4166 ;+
                                     1765  4167 ; Functional Description:
                                     1765  4168 ;
                                     1765  4169 ; All controllers that do not support caching must treat this command as
                                     1765  4170 ; a no-op that always succeeds. This command is included in the minimal
                                     1765  4171 ; tape MSCP subset soley for compatability with controllers that do support
                                     1765  4172 ; caching.
                                     1765  4173 ;
                                     1765  4174 ; Inputs:
                                     1765  4175 ;
                                     1765  4176 ;	R0  =  Scratch
                                     1765  4177 ;	R1  =  Scratch
                                     1765  4178 ;	R2  =  MSCP packet address
                                     1765  4179 ;	R3  =  HRB address
                                     1765  4180 ;	R4  =  UQB address, scratch
                                     1765  4181 ;	R5  =  Scratch
                                     1765  4182 ;
                                     1765  4183 ; Outputs:
                                     1765  4184 ;
                                     1765  4185 ;	R0  =  Success
                                     1765  4186 ;	R2  =  MSCP packet address
                                     1765  4187 ;	R3  =  HRB address
                                     1765  4188 ;-
                                     1765  4189 
                                     1765  4190 TMSCP$FLUSH::
                                     1765  4191 	.IF DEFINED DEBUG$PC_HISTORY
                                     1765  4192 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1765  4193 	.ENDC	   ;DEBUG$PC_HISTORY
                    55   1C A3   D0  1765  4194 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Make sure we have the IRP address
                 1C A5   24 A4   D0  1769  4195 	MOVL	UQB$L_UCB(R4), -	; Save the UCB address
                                     176E  4196 		IRP$L_UCB(R5)
                    14 A5   53   D0  176E  4197 	MOVL	R3,IRP$L_HRB(R5)	; Save the HRB address
                            2A   B0  1772  4198 	MOVW	#IO$_FLUSH,-		; Set up the function code,
                         20 A5       1774  4199 		IRP$W_FUNC(R5)		;  to do the mount verification
                          FA5A   30  1776  4200 	BSBW	TMSCP$SET_CLEAR_SEX	; Set clear serious exception
                          FAAC   30  1779  4201 	BSBW	TMSCP$SET_CLEAR_CDL	; Set clear cached data lost
                                     177C  4202 
                                     177C  4203 ;
                                     177C  4204 ;	R0  =  Scratch
                                     177C  4205 ;	R1  =  Scratch
                                     177C  4206 ;	R2  =  Scratch
                                     177C  4207 ;	R3  =  HRB address
                                     177C  4208 ;	R4  =  UQB address
                                     177C  4209 ;	R5  =  Scratch
                                     177C  4210 ;
                                     177C  4211 
                    51   24 A4   D0  177C  4212 	MOVL	UQB$L_UCB(R4),R1	; R1 <= UCB
                            0A   E1  1780  4213 	BBC	#DEV$V_WBC,-		; Flush hardware cache if possible
                      0B 40 A1       1782  4214 		UCB$L_DEVCHAR2(R1),10$	;  
                          0376   30  1785  4215 	BSBW	TMSCP$DRIVE_CHECK	; Call a subroutine to do the I/O
                                     1788  4216 
                                     1788  4217 ;
                                     1788  4218 ; Control returns here from entry point TMSCP$BACK. 
                                     1788  4219 ;
                                     1788  4220 ;	R0  =  I/O status block, scratch
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  92
X-2A6A1                         - FLUSH     (- 19 -)                     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (35)

                                     1788  4221 ;	R1  =  Scratch
                                     1788  4222 ;	R2  =  Scratch
                                     1788  4223 ;	R3  =  HRB address
                                     1788  4224 ;	R4  =  UQB address
                                     1788  4225 ;	R5  =  IRP address
                                     1788  4226 ; 
                                     1788  4227 		
                         05 50   E8  1788  4228 	BLBS	R0,10$			; On success, continue
                          066F   30  178B  4229 	BSBW	TMSCP$CHECK_XFER_STATUS	; Check the error code
                            03   11  178E  4230 	BRB	20$			;  and send the end packet	
                                     1790  4231 
                                     1790  4232 10$:
                       50   00   3C  1790  4233 	MOVZWL	#MSCP$K_ST_SUCC,R0	; Return an illegal command
                                     1793  4234 
                                     1793  4235 20$:
                          0848   31  1793  4236 	BRW	TMSCP$SEND_END		; Send an end packet with R0 status
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  93
X-2A6A1                         - READ     (- 33 -)                      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (36)

                                     1796  4239 	.SBTTL	-	READ					(- 33 -)
                                     1796  4240 
                                     1796  4241 ;+
                                     1796  4242 ; Functional Description:
                                     1796  4243 ;
                                     1796  4244 ; This routine is called to process a MSCP read packet. It is called from the
                                     1796  4245 ; non-sequential buffer class command routine. When processing of this 
                                     1796  4246 ; command is complete, control is returned to the main line routine.
                                     1796  4247 ;
                                     1796  4248 ; Inputs:
                                     1796  4249 ;
                                     1796  4250 ;	R0  =  Scratch
                                     1796  4251 ;	R1  =  Scratch
                                     1796  4252 ;	R2  =  MSCP packet address
                                     1796  4253 ;	R3  =  HRB address
                                     1796  4254 ;	R4  =  UQB address, scratch
                                     1796  4255 ;	R5  =  Scratch
                                     1796  4256 ;
                                     1796  4257 ; Outputs:
                                     1796  4258 ;
                                     1796  4259 ;	R0  =  Read completion status
                                     1796  4260 ;	R2  =  MSCP packet address
                                     1796  4261 ;	R3  =  HRB address
                                     1796  4262 ;-
                                     1796  4263 
                                     1796  4264 TMSCP$READ::
                                     1796  4265 	.IF DEFINED DEBUG$PC_HISTORY
                                     1796  4266 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1796  4267 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1796  4268 
                                     1796  4269 ;
                                     1796  4270 ; Allocate and load mapping resources to map the transfer buffer area
                                     1796  4271 ; in the requesting system.
                                     1796  4272 ;
                                     1796  4273 
                         0C A2   B5  1796  4274 	TSTW	MSCP$L_BYTE_CNT(R2)	; Zero request size?
                            06   12  1799  4275 	BNEQ	10$
                       50   00   3C  179B  4276 	MOVZWL	#MSCP$K_ST_SUCC,R0	; Set success
                          083D   31  179E  4277 	BRW	TMSCP$SEND_END		; and return.
                                     17A1  4278 
                                     17A1  4279 10$:
                          02FB   30  17A1  4280 	BSBW	TMSCP$ALLOCATE		; Find some memory for the transfer
                                     17A4  4281 
                                     17A4  4282 ;
                                     17A4  4283 ; Now prepare the CDRP for mapping the local buffer just allocated
                                     17A4  4284 ; for use by SCS.
                                     17A4  4285 ;
                                     17A4  4286 ;	R0  =  Scratch
                                     17A4  4287 ;	R1  =  Scratch
                                     17A4  4288 ;	R2  =  MSCP packet address
                                     17A4  4289 ;	R3  =  HRB address
                                     17A4  4290 ;	R4  =  UQB address, scratch
                                     17A4  4291 ;	R5  =  Scratch
                                     17A4  4292 ;
                                     17A4  4293 
                    55   1C A3   D0  17A4  4294 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the IRP base address
                    55   60 A5   DE  17A8  4295 	MOVAL	IRP$L_FQFL(R5),R5	; Move down to the CDRP portion
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  94
X-2A6A1                         - READ     (- 33 -)                      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (36)

                         20 A3   DE  17AC  4296 	MOVAL	HRB$B_LBUFF(R3),-	; Define the local buffer handle as
                         2C A5       17AF  4297 		CDRP$L_LBUFH_AD(R5)	;  the address of LBUFF
                    54   54 A3   D0  17B1  4298 	MOVL	HRB$L_HQB(R3),R4	; Get the HQB temporarily
                         28 A4   D0  17B5  4299 	MOVL	HQB$L_CDT(R4),-		;  so we can put a fresh CDT address
                         24 A5       17B8  4300 		CDRP$L_CDT(R5)		;  in the CDRP
                    54   5C A3   D0  17BA  4301 	MOVL	HRB$L_PDT(R3),R4	; Pick up the PDT address
                            06   B0  17BE  4302 	MOVW	#HRB$K_ST_MAP_WAIT,-	; Set the state of this request to 
                         14 A3       17C0  4303 		HRB$W_STATE(R3)		;  mapping a buffer
                                     17C2  4304 
                                     17C2  4305 ;		Verify that the HRB fields are in the same order as the IRP fields.
                                     17C2  4306 ;		This is  a requirement of the MAP function.
                                     17C2  4307 
                                     17C2  4308 	ASSUME	<HRB$W_BOFF-HRB$L_SVAPTE> EQ <IRP$W_BOFF-IRP$L_SVAPTE>
                                     17C2  4309 	ASSUME	<HRB$L_BCNT-HRB$L_SVAPTE> EQ <IRP$L_BCNT-IRP$L_SVAPTE>
                                     17C2  4310 
                                     17C2  4311 ;		Verify that the correct base address is used.
                                     17C2  4312 
                                     17C2  4313 	ASSUME	HRB$W_BOFF GT HRB$L_SVAPTE
                                     17C2  4314 	ASSUME	HRB$L_BCNT GT HRB$L_SVAPTE
                                     17C2  4315 
                    51   40 A3   DE  17C2  4316 	MOVAL	HRB$L_SVAPTE(R3),R1	; Address of the three longword buffer
                            52   D4  17C6  4317 	CLRL	R2			; Access mode of transfer is kernel
                                     17C8  4318 	MAP				; Map the buffer
                         2C B4   16  17C8       		JSB	@PDT$L_MAP(R4)
                       8000 8F   A8  17CB  4319 	BISW	#HRB$M_STATE_INVALID,-	; The state of this request is "current"
                         14 A3       17CF  4320 		HRB$W_STATE(R3)		;  leave the old state for diagnosis
                                     17D1  4321 
                                     17D1  4322 ;
                                     17D1  4323 ; Since the processing of this request can be stalled while waiting for
                                     17D1  4324 ; the local buffer to be mapped, we need to check to see if the request
                                     17D1  4325 ; has been canceled before going on.
                                     17D1  4326 ;
                            10   A8  17D1  4327 	BISW	#HRB$M_MAP,-		; Indicate that we have allocated 
                         16 A3       17D3  4328 		HRB$W_FLAGS(R3)		;  mapping resources for this request
                                 B3  17D5  4329 	BITW	#<HRB$M_ABORT!-		; Check to see if this request has been
                                     17D6  4330 		HRB$M_ABORTWS>,-	;  aborted either by ^Y or by the 
                    16 A3   03       17D6  4331 		HRB$W_FLAGS(R3)		;  loss of connection to the client
                            03   13  17D9  4332 	BEQL	TMSCP$READ_TRANSFER	; Request was not aborted, continue...
                          0100   31  17DB  4333 	BRW	TMSCP$ABORT_READ	; Otherwise cleanup this request
                                     17DE  4334 
                                     17DE  4335 ;
                                     17DE  4336 ; Prepare the IRP for the transfer from tape
                                     17DE  4337 ;
                                     17DE  4338 
                                     17DE  4339 TMSCP$READ_TRANSFER::
                    55   1C A3   D0  17DE  4340 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the address of the IRP
                    54   58 A3   D0  17E2  4341 	MOVL	HRB$L_UQB(R3),R4	; Get the UQB address
                         24 A4   D0  17E6  4342 	MOVL	UQB$L_UCB(R4),-		;  so we can pull out the UCB address
                         1C A5       17E9  4343 		IRP$L_UCB(R5)		;  and save it away in the IRP
                         40 A3   D0  17EB  4344 	MOVL	HRB$L_SVAPTE(R3),-	; Move the local buffer
                         2C A5       17EE  4345 		IRP$L_SVAPTE(R5)	;  virtual page table entry,
                         44 A3   B0  17F0  4346 	MOVW	HRB$W_BOFF(R3),-	;  the byte offset within the page,
                         30 A5       17F3  4347 		IRP$W_BOFF(R5)		;  of the start of the buffer
                         46 A3   D0  17F5  4348 	MOVL	HRB$L_BCNT(R3),-	;  and the byte count to be used for
                         32 A5       17F8  4349 		IRP$L_BCNT(R5)		;  this (portion of the) transfer.
                                     17FA  4350 	.IF	DEFINED DEBUG$PC_HISTORY
                                     17FA  4351 	MOVL	IRP$L_BCNT(R5), R0	; Get the transfer count.
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  95
X-2A6A1                         - READ     (- 33 -)                      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (36)

                                     17FA  4352 	BSBW	TMSCP$PCHIST_R3R0	; Log the PC for debugging.
                                     17FA  4353 	.ENDC  ;DEBUG$PC_HISTORY
                                     17FA  4354 ;
                                     17FA  4355 ; Check for any supported modifiers in the MSCP request. If they are set
                                     17FA  4356 ; there, then we should set them in the IRP we send out also.
                                     17FA  4357 ;
                       50   0C   3C  17FA  4358 	MOVZWL	#IO$_READPBLK,R0	; Pass I/O function code to be used
                    52   18 A3   D0  17FD  4359 	MOVL	HRB$L_MSGBUF(R3),R2	; Get back the MSCP packet address
                            0E   E1  1801  4360 	BBC	#MSCP$V_MD_COMP,-	; If the compare modifier was set in
                      05 0A A2       1803  4361 		MSCP$W_MODIFIER(R2),3$	;  the MSCP packet,
                  50   4000 8F   A8  1806  4362 	BISW	#IO$M_DATACHECK,R0	;  then set it in the IRP also
                                     180B  4363 
                                     180B  4364 3$:
                            08   E1  180B  4365 	BBC	#MSCP$V_MD_SEREC,-	; If the  modifier was set in
                      05 0A A2       180D  4366 		MSCP$W_MODIFIER(R2),4$	;  the MSCP packet,
                  50   8000 8F   A8  1810  4367 	BISW	#IO$M_INHRETRY,R0	;  then set it in the IRP also
                                     1815  4368 
                                     1815  4369 4$:
                            03   E1  1815  4370 	BBC	#MSCP$V_MD_REVRS,-	; If the reverse modifier was set
                      05 0A A2       1817  4371 		MSCP$W_MODIFIER(R2),5$	;  in the MSCP packet
                  50   0040 8F   A8  181A  4372 	BISW	#IO$M_REVERSE,R0	;  then set it in the IRP also
                                     181F  4373 
                                     181F  4374 5$:
                    20 A5   50   B0  181F  4375 	MOVW	R0,IRP$W_FUNC(R5)	; Fill in the function code
                          F9AD   30  1823  4376 	BSBW	TMSCP$SET_CLEAR_SEX	; Set clear serious exception
                          F9FF   30  1826  4377 	BSBW	TMSCP$SET_CLEAR_CDL	; Set clear cached data lost
                    14 A5   53   D0  1829  4378 	MOVL	R3,IRP$L_HRB(R5)	; Save the HRB address
                                     182D  4379 	.IF	DEFINED DEBUG$PC_HISTORY
                                     182D  4380 	MOVZWL	IRP$W_FUNC(R5), R0	; Get the function value.
                                     182D  4381 	BSBW	TMSCP$R0HIST		; Log the value for debugging.
                                     182D  4382 	.ENDC  ;DEBUG$PC_HISTORY
                                     182D  4383 
                                     182D  4384 ;
                                     182D  4385 ; The IRP is queue to the local driver. If the command is aborted during
                                     182D  4386 ; this thread, the request is finished off in subroutine TMSCP$BACK and 
                                     182D  4387 ; resources are deallocated.
                                     182D  4388 ;
                                     182D  4389 ;
                                     182D  4390 ;	R0  =  Scratch
                                     182D  4391 ;	R1  =  Scratch
                                     182D  4392 ;	R2  =  Scratch
                                     182D  4393 ;	R3  =  HRB address
                                     182D  4394 ;	R4  =  UQB address
                                     182D  4395 ;	R5  =  Scratch
                                     182D  4396 ;
                                     182D  4397 
                          02C2   30  182D  4398 	BSBW	TMSCP$DRIVE_TRANSFER	; Execute a tape transfer
                                     1830  4399 
                                     1830  4400 ;
                                     1830  4401 ; Control returns here from entry point TMSCP$BACK. 
                                     1830  4402 ;
                                     1830  4403 ;	R0  =  I/O status block, scratch
                                     1830  4404 ;	R1  =  Scratch
                                     1830  4405 ;	R2  =  Scratch
                                     1830  4406 ;	R3  =  HRB address
                                     1830  4407 ;	R4  =  UQB address
                                     1830  4408 ;	R5  =  IRP address
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  96
X-2A6A1                         - READ     (- 33 -)                      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (36)

                                     1830  4409 ;
                                     1830  4410 
                         06 50   E8  1830  4411 	BLBS	R0,10$			; If the transfer was successful, cont...
                          05C7   30  1833  4412 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.
                          00A2   31  1836  4413 	BRW	40$
                                     1839  4414 ;
                                     1839  4415 ; Send the data to the host buffer
                                     1839  4416 ;
                                     1839  4417 
                                     1839  4418 10$:
                    55   1C A3   D0  1839  4419 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Restore IRP address
                         32 A5   D0  183D  4420 	MOVL	IRP$L_BCNT(R5),-	; Get the number of bytes transferred
                         46 A3       1840  4421 		HRB$L_BCNT(R3)		;  and save it away in the request block
                    55   60 A5   DE  1842  4422 	MOVAL	IRP$L_FQFL(R5),R5	; Move from the IRP to the CDRP address
                    51   58 A3   D0  1846  4423 	MOVL	HRB$L_UQB(R3),R1	; Get the UQB
                    51   24 A1   D0  184A  4424 	MOVL	UQB$L_UCB(R1),R1	;  and then the UCB.
                    52   18 A3   D0  184E  4425 	MOVL	HRB$L_MSGBUF(R3),R2	; Get the MSCP packet address back
                            10   E1  1852  4426 	BBC	#MT$V_BOT,-
                      07 50 A1       1854  4427 		UCB$L_DEVDEPEND(R1),20$
                       50   0D   D0  1857  4428 	MOVL	#MSCP$K_ST_BOT,R0
                            10   A8  185A  4429 	BISW	#MSCP$M_EF_SEREX,-
                         09 A2       185C  4430 		MSCP$B_FLAGS(R2)	
                                     185E  4431 
                                     185E  4432 ;
                                     185E  4433 ; Initialize a CDRP that SCS can use to send the retrieved data to the 
                                     185E  4434 ; requesting system.
                                     185E  4435 ;
                                     185E  4436 
                                     185E  4437 20$:
                    51   54 A3   D0  185E  4438 	MOVL	HRB$L_HQB(R3),R1	; Get the HQB address 
                         28 A1   D0  1862  4439 	MOVL	HQB$L_CDT(R1),-		; Get the address of the CDT 
                         24 A5       1865  4440 		CDRP$L_CDT(R5)		;  and place it in the CDRP for the call
                         46 A3   D0  1867  4441 	MOVL	HRB$L_BCNT(R3),-	; Use the number of bytes retrieved
                         3C A5       186A  4442 		CDRP$L_XCT_LEN(R5)	;  as the number to send to host
                         10 A2   DE  186C  4443 	MOVAL	MSCP$B_BUFFER(R2),-	; Get the remote buffer handle
                         34 A5       186F  4444 		CDRP$L_RBUFH_AD(R5)	;  and save it for the call
                         38 A5   D4  1871  4445 	CLRL	CDRP$L_RBOFF(R5)	; Set the remote buffer offset.
                         20 A3   DE  1874  4446 	MOVAL	HRB$B_LBUFF(R3),-	; Define the local buffer handle as
                         2C A5       1877  4447 		CDRP$L_LBUFH_AD(R5)	;  the address of LBUFF
                         30 A5   D4  1879  4448 	CLRL	CDRP$L_LBOFF(R5)	;  in the remote and local buffers
                    54   5C A3   D0  187C  4449 	MOVL	HRB$L_PDT(R3),R4	; Get the PDT address for the SCS call
                            04   B0  1880  4450 	MOVW	#HRB$K_ST_SNDAT_WAIT,-	; Set the state of this request to
                         14 A3       1882  4451 		HRB$W_STATE(R3)		;  SCS block transfer
                                     1884  4452 	SEND_DATA			; Send to remote host's buffer.
                   00000000'GF   16  1884       		JSB	G^SCS$ALLOC_RSPID
                         14 B4   16  188A       		JSB	@PDT$L_ALLOCMSG(R4)
                         03 50   E9  188D       		BLBC	R0,30071$
                         54 B4   16  1890       		JSB	@PDT$L_SENDDATA(R4)
                                     1893       	30071$:
                                     1893  4453 
                                     1893  4454 ;
                                     1893  4455 ; This thread is suspended until the block transfer completes. At that time,
                                     1893  4456 ; control is returned here with the following registers:
                                     1893  4457 ;
                                     1893  4458 ;		R0  =  status
                                     1893  4459 ; 		R3  =  Host Request Buffer address
                                     1893  4460 ;		R4  =  PDT address
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  97
X-2A6A1                         - READ     (- 33 -)                      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (36)

                                     1893  4461 ;		R5  =  CDRP address
                                     1893  4462 ;
                                     1893  4463 	.IF DEFINED DEBUG$PC_HISTORY
                                     1893  4464 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1893  4465 	.ENDC	   ;DEBUG$PC_HISTORY
                       8000 8F   A8  1893  4466 	BISW	#HRB$M_STATE_INVALID,-	; The state of this request is "current"
                         14 A3       1897  4467 		HRB$W_STATE(R3)		;  leave the old state for diagnosis
                         42 50   E9  1899  4468 	BLBC	R0,TMSCP$ABORT_READ	; If the send was not successful 
                                 B3  189C  4469 	BITW	#<HRB$M_ABORT!-		;  or if this request has been aborted,
                                     189D  4470 		HRB$M_ABORTWS>,-	;  or canceled,
                    16 A3   03       189D  4471 		HRB$W_FLAGS(R3)		;  just clean everything up
                            3C   12  18A0  4472 	BNEQ	TMSCP$ABORT_READ
                                     18A2  4473 ;
                                     18A2  4474 ; Update the byte count transferred, and send the end packet.
                                     18A2  4475 ;
                                     18A2  4476 
                                     18A2  4477 30$:
                    52   18 A3   D0  18A2  4478 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                    51   1C A3   D0  18A6  4479 	MOVL	HRB$L_IRP_CDRP(R3),R1	; Get the address of the IRP
                 20 A2   3A A1   3C  18AA  4480 	MOVZWL	2+IRP$L_IOST1(R1), -	; Get number of bytes actually 
                                     18AF  4481 		MSCP$L_TAPEREC(R2)	;  transferred.
                    51   58 A3   D0  18AF  4482 	MOVL	HRB$L_UQB(R3),R1	; Get the UQB
                    51   24 A1   D0  18B3  4483 	MOVL	UQB$L_UCB(R1),R1	;  and then the UCB.
                       00C4 C1   D0  18B7  4484 	MOVL	UCB$L_RECORD(R1),-	; Retrieve the position information
                         1C A2       18BB  4485 		MSCP$L_POSITION(R2)	;  to send back in the end packet.
                            05   E1  18BD  4486 	BBC	#DEV$V_MSCP,-		; If we are not dealing with an MSCP
                      06 40 A1       18BF  4487 		UCB$L_DEVCHAR2(R1),35$	;  device, then we can get the record
                       0080 C3   D0  18C2  4488 	MOVL	HRB$L_RECORD(R3),-	;  count out of the HRB since the 
                         1C A2       18C6  4489 		MSCP$L_POSITION(R2)	;  class driver set it for us.
                                     18C8  4490 
                                     18C8  4491 35$:
                    51   1C A3   D0  18C8  4492 	MOVL	HRB$L_IRP_CDRP(R3),R1	; Get the address of the IRP
                    50   38 A1   3C  18CC  4493 	MOVZWL	IRP$L_IOST1(R1),R0	; Get transfer completion status.
                         05 50   E8  18D0  4494 	BLBS	R0,37$			; If status is success, continue
                          0527   30  18D3  4495 	BSBW	TMSCP$CHECK_XFER_STATUS	; Check the error code
                            03   11  18D6  4496 	BRB	40$			;  and send back end packet
                                     18D8  4497 
                                     18D8  4498 37$:
                       50   00   D0  18D8  4499 	MOVL	#MSCP$K_ST_SUCC,R0	; This command has completed successfuly
                                     18DB  4500 	.IF DEFINED DEBUG$CURRENT_SANITY
                                     18DB  4501 	BSBW	TMSCP$CHECK_CURRENT	; Sanity check the current counters
                                     18DB  4502 	.ENDC	   ;DEBUG$CURRENT_SANITY
                                     18DB  4503 
                                     18DB  4504 40$:
                          0700   31  18DB  4505 	BRW	TMSCP$SEND_END		; Send an end packet with R0 status
                                     18DE  4506 
                                     18DE  4507 ;
                                     18DE  4508 ; If the send data was unsuccessful, just free the allocated resources, and
                                     18DE  4509 ; this request is finished off.
                                     18DE  4510 ; 
                                     18DE  4511 
                                     18DE  4512 TMSCP$ABORT_READ::
                                     18DE  4513 	.IF DEFINED DEBUG$PC_HISTORY
                                     18DE  4514 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     18DE  4515 	.ENDC	   ;DEBUG$PC_HISTORY
                            00   E0  18DE  4516 	BBS	#HRB$V_ABORT,-		; If this request was aborted due to a
                      0A 16 A3       18E0  4517 		HRB$W_FLAGS(R3),10$	;  disconnect, no end msg is necessary
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  98
X-2A6A1                         - READ     (- 33 -)                      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (36)

                    52   18 A3   D0  18E3  4518 	MOVL	HRB$L_MSGBUF(R3),R2	; Get the message buffer address 
                       50   02   D0  18E7  4519 	MOVL	#MSCP$K_ST_ABRTD,R0	; Set the status to aborted
                          06F1   31  18EA  4520 	BRW	TMSCP$SEND_END		;  and send out an end message
                                     18ED  4521 
                                     18ED  4522 10$:
                          03F2   31  18ED  4523 	BRW	TMSCP$CLEANUP_HRB	; Deallocate the resources used.
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page  99
X-2A6A1                         - WRITE_TAPE_MARK                        27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (37)

                                     18F0  4526 	.SBTTL	-	WRITE_TAPE_MARK
                                     18F0  4527 
                                     18F0  4528 ;+
                                     18F0  4529 ;
                                     18F0  4530 ; Write an extended interrecord gap followed by a tape mark.
                                     18F0  4531 ;	
                                     18F0  4532 ; If the immediate completion modifier was set, send the end packet back 
                                     18F0  4533 ; immediately, returning success.
                                     18F0  4534 ;
                                     18F0  4535 ; Inputs:
                                     18F0  4536 ;
                                     18F0  4537 ;	R0  =  Scratch
                                     18F0  4538 ;	R1  =  Scratch
                                     18F0  4539 ;	R2  =  MSCP packet address
                                     18F0  4540 ;	R3  =  HRB address
                                     18F0  4541 ;	R4  =  UQB address, scratch
                                     18F0  4542 ;	R5  =  Scratch
                                     18F0  4543 ;
                                     18F0  4544 ; Outputs:
                                     18F0  4545 ;
                                     18F0  4546 ;	R0  =  Write completion status
                                     18F0  4547 ;	R2  =  MSCP packet address
                                     18F0  4548 ;	R3  =  HRB address
                                     18F0  4549 ;-
                                     18F0  4550 
                                     18F0  4551 TMSCP$WRITE_TAPE_MARK::
                                     18F0  4552 	.IF DEFINED DEBUG$PC_HISTORY
                                     18F0  4553 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     18F0  4554 	.ENDC	   ;DEBUG$PC_HISTORY
                    55   1C A3   D0  18F0  4555 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Set up IRP-CDRP pair.
                            1C   B0  18F4  4556 	MOVW	#IO$_WRITEMARK,-	;  before checking anything
                         20 A5       18F6  4557 		IRP$W_FUNC(R5)		;  else.
                          F8D8   30  18F8  4558 	BSBW	TMSCP$SET_CLEAR_SEX	; Set clear serious exception
                                     18FB  4559 ;
                                     18FB  4560 ; Use the IMMEDIATE COMPLETION opcode modifier bit passed in the packet.
                                     18FB  4561 ;
                            06   E1  18FB  4562 	BBC	#MSCP$V_MD_IMMED,-	; Immediate completion specified?
                      06 0A A2       18FD  4563 		MSCP$W_MODIFIER(R2),10$ ; If not, don't change op code.
                       0080 8F   A8  1900  4564 	BISW	#IO$M_NOWAIT,-		; Set nowait in the function itself
                         20 A5       1904  4565 		IRP$W_FUNC(R5)		;    (to returm imediately)
                                     1906  4566 10$:
                          F91F   30  1906  4567 	BSBW	TMSCP$SET_CLEAR_CDL	; Set clear cached data lost
                                     1909  4568 
                                     1909  4569 ;
                                     1909  4570 ; The IRP is queue to the local driver. If the command is aborted during
                                     1909  4571 ; this thread, the request is finished off in subroutine TMSCP$BACK and 
                                     1909  4572 ; resources are deallocated.
                                     1909  4573 ;
                                     1909  4574 
                         24 A4   D0  1909  4575 	MOVL	UQB$L_UCB(R4),-		;  Save the UCB address in IRP.
                         1C A5       190C  4576 		IRP$L_UCB(R5)
                    14 A5   53   D0  190E  4577 	MOVL	R3,IRP$L_HRB(R5)	; Save HRB for I/O completion
                                     1912  4578 
                                     1912  4579 ;
                                     1912  4580 ;	R0  =  Scratch
                                     1912  4581 ;	R1  =  Scratch
                                     1912  4582 ;	R2  =  Scratch
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 100
X-2A6A1                         - WRITE_TAPE_MARK                        27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (37)

                                     1912  4583 ;	R3  =  HRB address
                                     1912  4584 ;	R4  =  UQB address
                                     1912  4585 ;	R5  =  Scratch
                                     1912  4586 ;
                                     1912  4587 
                          01DD   30  1912  4588 	BSBW	TMSCP$DRIVE_TRANSFER	; Do the tape transfer
                                     1915  4589 
                                     1915  4590 ;
                                     1915  4591 ; Control returns here from entry point TMSCP$BACK. 
                                     1915  4592 ;
                                     1915  4593 ;	R0  =  I/O status block, scratch
                                     1915  4594 ;	R1  =  Scratch
                                     1915  4595 ;	R2  =  Scratch
                                     1915  4596 ;	R3  =  HRB address
                                     1915  4597 ;	R4  =  UQB address
                                     1915  4598 ;	R5  =  IRP address
                                     1915  4599 ;
                                     1915  4600 
                         05 50   E8  1915  4601 	BLBS	R0,25$			; If the transfer was successful, cont...
                          04E2   30  1918  4602 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.
                            03   11  191B  4603 	BRB	30$			;
                                     191D  4604 
                                     191D  4605 25$:
                       50   00   3C  191D  4606 	MOVZWL	#MSCP$K_ST_SUCC,R0	; Set success for return
                                     1920  4607 ;
                                     1920  4608 ; Final clean up for transfer commands.  Set status, release resources.
                                     1920  4609 ;
                                     1920  4610 
                                     1920  4611 30$:
                    55   1C A3   D0  1920  4612 	MOVL	HRB$L_IRP_CDRP(R3), R5	; Get the IRP address
                    54   58 A3   D0  1924  4613 	MOVL	HRB$L_UQB(R3),R4	; Restore UQB address
                    51   24 A4   D0  1928  4614 	MOVL	UQB$L_UCB(R4),R1	; Restore UCB address
                       00C4 C1   D0  192C  4615 	MOVL	UCB$L_RECORD(R1),-	; Initialize the MCSP position
                       00C4 C4       1930  4616 		UQB$L_POSITION(R4)	;  with the UCB record count
                            05   E1  1933  4617 	BBC	#DEV$V_MSCP,-		; If we are not dealing with an MSCP
                      07 40 A1       1935  4618 		UCB$L_DEVCHAR2(R1),50$	;  device, then we can get the record
                       0080 C3   D0  1938  4619 	MOVL	HRB$L_RECORD(R3),-	;  count out of the HRB since the 
                       00C4 C4       193C  4620 		UQB$L_POSITION(R4)	;  class driver set it for us.
                                     193F  4621 
                                     193F  4622 50$:
                    52   18 A3   D0  193F  4623 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                 20 A2   3A A5   3C  1943  4624 	MOVZWL	2+IRP$L_IOST1(R5), -	; Save the byte count 
                                     1948  4625 		MSCP$L_TAPEREC(R2)	;  to be returned in the end packet
                       00C4 C4   D0  1948  4626 	MOVL	UQB$L_POSITION(R4),-	; Retrieve the position information
                         1C A2       194C  4627 		MSCP$L_POSITION(R2)	;  to send back in the end packet.
                          068D   31  194E  4628 	BRW	TMSCP$SEND_END		; Send an end packet with R0 status
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 101
X-2A6A1                         - WRITE     (- 34 -)                     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (38)

                                     1951  4631 	.SBTTL	-	WRITE					(- 34 -)
                                     1951  4632 
                                     1951  4633 ;+
                                     1951  4634 ; Functional Description:
                                     1951  4635 ;
                                     1951  4636 ; This routine is called to process an MSCP write request. The information 
                                     1951  4637 ; the cluster member wishes to place on the tape is transferred to the local
                                     1951  4638 ; serving processor (subject to availability of resources on that processor),
                                     1951  4639 ; and from there is written on to tape.
                                     1951  4640 ;
                                     1951  4641 ; If the immediate completion modifier was set, send the end packet back as
                                     1951  4642 ; soon as the remote host's data is buffered locally. In this case, the
                                     1951  4643 ; end packet always returns success.
                                     1951  4644 ;
                                     1951  4645 ; Inputs:
                                     1951  4646 ;
                                     1951  4647 ;	R0  =  Scratch
                                     1951  4648 ;	R1  =  Scratch
                                     1951  4649 ;	R2  =  MSCP packet address
                                     1951  4650 ;	R3  =  HRB address
                                     1951  4651 ;	R4  =  UQB address, scratch
                                     1951  4652 ;	R5  =  Scratch
                                     1951  4653 ;
                                     1951  4654 ; Outputs:
                                     1951  4655 ;
                                     1951  4656 ;	R0  =  Write completion status
                                     1951  4657 ;	R2  =  MSCP packet address
                                     1951  4658 ;	R3  =  HRB address
                                     1951  4659 ;-
                                     1951  4660 
                                     1951  4661 TMSCP$WRITE::
                                     1951  4662 	.IF DEFINED DEBUG$PC_HISTORY
                                     1951  4663 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1951  4664 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1951  4665 
                                     1951  4666 ;
                                     1951  4667 ; Before doing anything make sure that the unit is not write locked.
                                     1951  4668 ;
                                 B3  1951  4669 	BITW	#<MSCP$M_UF_WRTPS!-	; If this unit is not hardware
                                     1952  4670 		MSCP$M_UF_WRTPD!-	;  data safety write protected or
                                     1952  4671 		MSCP$M_UF_WRTPH>,-	;  or software write protected,
               16 A4   3100 8F       1952  4672 		UQB$W_UNIT_FLAGS(R4)	;  then
                            0B   13  1957  4673 	BEQL	TMSCP$DO_WRT		;  go ahead and allow the write
                            20   A8  1959  4674 	BISW	#UQB$M_ST_SEREX,-	; Set serious exception
                       00C8 C4       195B  4675 		UQB$W_ST_FLAGS(R4)
                       50   06   D0  195E  4676 	MOVL	#MSCP$K_ST_WRTPR,R0	; Otherwise, set an error status
                          067A   31  1961  4677 	BRW	TMSCP$SEND_END		; ... and return an end message
                                     1964  4678 
                                     1964  4679 TMSCP$DO_WRT::
                                     1964  4680 
                                     1964  4681 ;
                                     1964  4682 ; Allocate a local buffer area to use during the transfer, and map 
                                     1964  4683 ; that area for use by SCS routines.
                                     1964  4684 ;
                                     1964  4685 
                          0138   30  1964  4686 	BSBW	TMSCP$ALLOCATE		; Find some local memory for the xfer
                                     1967  4687 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 102
X-2A6A1                         - WRITE     (- 34 -)                     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (38)

                                     1967  4688 ;
                                     1967  4689 ; Now prepare the CDRP for mapping the local buffer just allocated
                                     1967  4690 ; for use by SCS.
                                     1967  4691 ;
                    55   1C A3   D0  1967  4692 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the IRP base address
                    55   60 A5   DE  196B  4693 	MOVAL	IRP$L_FQFL(R5),R5	; Move down to the CDRP portion
                         20 A3   DE  196F  4694 	MOVAL	HRB$B_LBUFF(R3),-	; Define the local buffer handle as
                         2C A5       1972  4695 		CDRP$L_LBUFH_AD(R5)	;  the address of LBUFF
                    54   54 A3   D0  1974  4696 	MOVL	HRB$L_HQB(R3),R4	; Get the HQB temporarily
                         28 A4   D0  1978  4697 	MOVL	HQB$L_CDT(R4),-		;  so we can put a fresh CDT address
                         24 A5       197B  4698 		CDRP$L_CDT(R5)		;  in the CDRP
                    54   5C A3   D0  197D  4699 	MOVL	HRB$L_PDT(R3),R4	; Pick up the PDT address
                            06   B0  1981  4700 	MOVW	#HRB$K_ST_MAP_WAIT,-	; Set the state of this request to 
                         14 A3       1983  4701 		HRB$W_STATE(R3)		;  mapping a buffer
                                     1985  4702 
                                     1985  4703 ;		Verify that the HRB fields are in the same order as the IRP fields.
                                     1985  4704 ;		This is  a requirement of the MAP function.
                                     1985  4705 
                                     1985  4706 	ASSUME	<HRB$W_BOFF-HRB$L_SVAPTE> EQ <IRP$W_BOFF-IRP$L_SVAPTE>
                                     1985  4707 	ASSUME	<HRB$L_BCNT-HRB$L_SVAPTE> EQ <IRP$L_BCNT-IRP$L_SVAPTE>
                                     1985  4708 
                                     1985  4709 ;		Verify that the correct base address is used.
                                     1985  4710 
                                     1985  4711 	ASSUME	HRB$W_BOFF GT HRB$L_SVAPTE
                                     1985  4712 	ASSUME	HRB$L_BCNT GT HRB$L_SVAPTE
                                     1985  4713 
                    51   40 A3   DE  1985  4714 	MOVAL	HRB$L_SVAPTE(R3),R1	; Address of the three longword buffer
                            52   D4  1989  4715 	CLRL	R2			; Access mode of transfer is kernel
                                     198B  4716 	MAP				; Map the buffer
                         2C B4   16  198B       		JSB	@PDT$L_MAP(R4)
                       8000 8F   A8  198E  4717 	BISW	#HRB$M_STATE_INVALID,-	; The state of this request is "current"
                         14 A3       1992  4718 		HRB$W_STATE(R3)		;  leave the old state for diagnosis
                                     1994  4719 
                                     1994  4720 ;
                                     1994  4721 ; Since the processing of this request can be stalled while waiting for
                                     1994  4722 ; the local buffer to be mapped, we need to check to see if the request
                                     1994  4723 ; has been canceled before going on.
                                     1994  4724 ;
                            10   A8  1994  4725 	BISW	#HRB$M_MAP,-		; Indicate that we have allocated 
                         16 A3       1996  4726 		HRB$W_FLAGS(R3)		;  mapping resources for this request
                                 B3  1998  4727 	BITW	#<HRB$M_ABORT!-		; If this command has not been aborted
                                     1999  4728 		HRB$M_ABORTWS>,-	;  or canceled,
                    16 A3   03       1999  4729 		HRB$W_FLAGS(R3)		;  then continue on...
                            03   13  199C  4730 	BEQL	TMSCP$WRITE_TRANSFER
                          00EC   31  199E  4731 	BRW	TMSCP$ABORT_WRITE	;  otherwise abort this request here
                                     19A1  4732 
                                     19A1  4733 TMSCP$WRITE_TRANSFER::
                    55   1C A3   D0  19A1  4734 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the address of the IRP
                    55   60 A5   DE  19A5  4735 	MOVAL	IRP$L_FQFL(R5),R5	; Move from the IRP to the CDRP address
                                     19A9  4736 
                                     19A9  4737 ;
                                     19A9  4738 ; Initialize a CDRP that SCS can use to send the retrieved data to the 
                                     19A9  4739 ; requesting system.
                                     19A9  4740 ;
                    51   54 A3   D0  19A9  4741 	MOVL	HRB$L_HQB(R3),R1	; Get the HQB address 
                         28 A1   D0  19AD  4742 	MOVL	HQB$L_CDT(R1),-		; Get the address of the CDT 
                         24 A5       19B0  4743 		CDRP$L_CDT(R5)		;  and place it in the CDRP for the call
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 103
X-2A6A1                         - WRITE     (- 34 -)                     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (38)

                         46 A3   D0  19B2  4744 	MOVL	HRB$L_BCNT(R3),-	; Use the number of bytes retrieved
                         3C A5       19B5  4745 		CDRP$L_XCT_LEN(R5)	;  as the number to send to host
                    52   18 A3   D0  19B7  4746 	MOVL	HRB$L_MSGBUF(R3),R2	; Get the MSCP packet address back
                         10 A2   DE  19BB  4747 	MOVAL	MSCP$B_BUFFER(R2),-	; Get the remote buffer handle
                         34 A5       19BE  4748 		CDRP$L_RBUFH_AD(R5)	;  and save it for the call
                         38 A5   D4  19C0  4749 	CLRL	CDRP$L_RBOFF(R5)	; Set the remote buffer offset.
                         20 A3   DE  19C3  4750 	MOVAL	HRB$B_LBUFF(R3),-	; Define the local buffer handle as
                         2C A5       19C6  4751 		CDRP$L_LBUFH_AD(R5)	;  the address of LBUFF
                         30 A5   D4  19C8  4752 	CLRL	CDRP$L_LBOFF(R5)	;  in the remote and local buffers
                    54   5C A3   D0  19CB  4753 	MOVL	HRB$L_PDT(R3),R4	; Get the PDT address for the SCS call
                            04   B0  19CF  4754 	MOVW	#HRB$K_ST_SNDAT_WAIT,-	; Reflect in the state, that we are
                         14 A3       19D1  4755 		HRB$W_STATE(R3)		;  awaiting data arrival from the host
                                     19D3  4756 	REQUEST_DATA			; Get the data from host
                   00000000'GF   16  19D3       		JSB	G^SCS$ALLOC_RSPID
                         14 B4   16  19D9       		JSB	@PDT$L_ALLOCMSG(R4)
                         03 50   E9  19DC       		BLBC	R0,30072$
                         50 B4   16  19DF       		JSB	@PDT$L_REQDATA(R4)
                                     19E2       	30072$:
                                     19E2  4757 
                                     19E2  4758 ;
                                     19E2  4759 ; This thread is suspended until the block transfer completes. At that time,
                                     19E2  4760 ; control is returned here with the following registers:
                                     19E2  4761 ;
                                     19E2  4762 ;		R0  =  Status
                                     19E2  4763 ;		R3  =  HRB address
                                     19E2  4764 ;		R4  =  PDT address
                                     19E2  4765 ;		R5  =  CDRP address
                                     19E2  4766 ;
                       8000 8F   A8  19E2  4767 	BISW	#HRB$M_STATE_INVALID,-	; Set the invalid bit showing this
                         14 A3       19E6  4768 		HRB$W_STATE(R3)		;  as a stale state
                         03 50   E8  19E8  4769 	BLBS	R0,5$			; Everything looks good so far
                          009F   31  19EB  4770 	BRW	TMSCP$ABORT_WRITE	; If the request failed, abort the cmd
                                     19EE  4771 
                                     19EE  4772 5$:
                                 B3  19EE  4773 	BITW	#<HRB$M_ABORT!-		; Check to make sure this request 
                                     19EF  4774 		HRB$M_ABORTWS>,-	;  has not been aborted while receiving
                    16 A3   03       19EF  4775 		HRB$W_FLAGS(R3)		;  data from the client system
                            03   13  19F2  4776 	BEQL	9$			; If it has not been aborted, continue..
                          0096   31  19F4  4777 	BRW	TMSCP$ABORT_WRITE	;  otherwise, do the proper cleanup
                                     19F7  4778 
                                     19F7  4779 ;
                                     19F7  4780 ; Prepare the IRP for a tape transfer, so the data can be transferred to
                                     19F7  4781 ; the tape.
                                     19F7  4782 ;
                                     19F7  4783 
                                     19F7  4784 9$:
                         60 A3   D7  19F7  4785 	DECL	HRB$L_CMD_STS(R3)	; Report progress on this request
                    55   1C A3   D0  19FA  4786 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the address of the IRP
                    54   58 A3   D0  19FE  4787 	MOVL	HRB$L_UQB(R3),R4	; Get the UQB address
                         24 A4   D0  1A02  4788 	MOVL	UQB$L_UCB(R4),-		;  so we can pull out the UCB address
                         1C A5       1A05  4789 		IRP$L_UCB(R5)		;  and save it away in the IRP
                         18 A5   D4  1A07  4790 	CLRL	IRP$L_WIND(R5)		; No window control blocks in the server
                         22 A5   94  1A0A  4791 	CLRB	IRP$B_EFN(R5)		; Clear out the event flag number
                         28 A5   B4  1A0D  4792 	CLRW	IRP$W_CHAN(R5)		; Clear the process I/O channel number
                         2A A5   B4  1A10  4793 	CLRW	IRP$W_STS(R5)		; Start out with a clear status field
                         40 A3   D0  1A13  4794 	MOVL	HRB$L_SVAPTE(R3),-	; Move the local buffer
                         2C A5       1A16  4795 		IRP$L_SVAPTE(R5)	;  virtual page table entry,
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 104
X-2A6A1                         - WRITE     (- 34 -)                     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (38)

                         44 A3   B0  1A18  4796 	MOVW	HRB$W_BOFF(R3),-	;  the byte offset within the page,
                         30 A5       1A1B  4797 		IRP$W_BOFF(R5)		;  of the start of the buffer
                         46 A3   D0  1A1D  4798 	MOVL	HRB$L_BCNT(R3),-	;  and the byte count to be used for
                         32 A5       1A20  4799 		IRP$L_BCNT(R5)		;  this (portion of the) transfer.
                    14 A5   53   D0  1A22  4800 	MOVL	R3,IRP$L_HRB(R5)	; Set the HRB address for IO completion
                                     1A26  4801 
                                     1A26  4802 ;
                                     1A26  4803 ; Check for any supported modifiers in the MSCP request. If they are set
                                     1A26  4804 ; there, then we should set them in the IRP we send out also.
                                     1A26  4805 ;
                       50   0B   B0  1A26  4806 	MOVW	#IO$_WRITEPBLK,R0	; Set the function code
                    52   18 A3   D0  1A29  4807 	MOVL	HRB$L_MSGBUF(R3),R2	; Get back the MSCP packet address
                            0E   E1  1A2D  4808 	BBC	#MSCP$V_MD_COMP,-	; If the compare modifier was set in
                      05 0A A2       1A2F  4809 		MSCP$W_MODIFIER(R2),10$	;  the MSCP packet,
                  50   4000 8F   A8  1A32  4810 	BISW	#IO$M_DATACHECK,R0	;  then set it in the IRP also
                                     1A37  4811 
                                     1A37  4812 10$:
                            08   E1  1A37  4813 	BBC	#MSCP$V_MD_SEREC,-	; If the  modifier was set in
                      05 0A A2       1A39  4814 		MSCP$W_MODIFIER(R2),12$	;  the MSCP packet,
                  50   8000 8F   A8  1A3C  4815 	BISW	#IO$M_INHRETRY,R0	;  then set it in the IRP also
                                     1A41  4816 
                                     1A41  4817 12$:
                    20 A5   50   B0  1A41  4818 	MOVW	R0,IRP$W_FUNC(R5)	; Fill in the function code
                          F78B   30  1A45  4819 	BSBW	TMSCP$SET_CLEAR_SEX
                          F7B3   30  1A48  4820 	BSBW	TMSCP$SET_IMMED		; Set immediate completion
                          F7DA   30  1A4B  4821 	BSBW	TMSCP$SET_CLEAR_CDL	; Set clear cached data lost
                                     1A4E  4822 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1A4E  4823 	MOVL	IRP$L_BCNT(R5), R0	; Get the transfer length.
                                     1A4E  4824 	BSBW	TMSCP$PCHIST_R3R0	; Log the value for debugging.
                                     1A4E  4825 	.ENDC  ;DEBUG$PC_HISTORY
                                     1A4E  4826 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1A4E  4827 	MOVZWL	IRP$W_FUNC(R5), R0	; Get the function value.
                                     1A4E  4828 	BSBW	TMSCP$R0HIST		; Log the value for debugging.
                                     1A4E  4829 	.ENDC  ;DEBUG$PC_HISTORY
                                     1A4E  4830 
                                     1A4E  4831 ;
                                     1A4E  4832 ; The IRP is queue to the local driver. If the command is aborted during
                                     1A4E  4833 ; this thread, the request is finished off in subroutine TMSCP$BACK and 
                                     1A4E  4834 ; resources are deallocated.
                                     1A4E  4835 ;
                                     1A4E  4836 ;	R0  =  Scratch
                                     1A4E  4837 ;	R1  =  Scratch
                                     1A4E  4838 ;	R2  =  Scratch
                                     1A4E  4839 ;	R3  =  HRB address
                                     1A4E  4840 ;	R4  =  UQB address
                                     1A4E  4841 ;	R5  =  Scratch
                                     1A4E  4842 ;
                                     1A4E  4843 
                          00A1   30  1A4E  4844 	BSBW	TMSCP$DRIVE_TRANSFER	; Do the tape transfer
                                     1A51  4845 
                                     1A51  4846 ;
                                     1A51  4847 ; Control returns here from entry point TMSCP$BACK. 
                                     1A51  4848 ;
                                     1A51  4849 ;	R0  =  I/O status block, scratch
                                     1A51  4850 ;	R1  =  Scratch
                                     1A51  4851 ;	R2  =  Scratch
                                     1A51  4852 ;	R3  =  HRB address
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 105
X-2A6A1                         - WRITE     (- 34 -)                     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (38)

                                     1A51  4853 ;	R4  =  UQB address
                                     1A51  4854 ;	R5  =  IRP address
                                     1A51  4855 ;
                                     1A51  4856 
                         05 50   E8  1A51  4857 	BLBS	R0,26$			; If the transfer was successful, cont...
                          03A6   30  1A54  4858 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.
                            03   11  1A57  4859 	BRB	30$			;
                                     1A59  4860 
                                     1A59  4861 26$:
                       50   00   3C  1A59  4862 	MOVZWL	#MSCP$K_ST_SUCC,R0	; Set success for return
                                     1A5C  4863 
                                     1A5C  4864 ;
                                     1A5C  4865 ; Final clean up for transfer commands.  Set status, release resources.
                                     1A5C  4866 ;
                                     1A5C  4867 
                                     1A5C  4868 30$:
                    54   58 A3   D0  1A5C  4869 	MOVL	HRB$L_UQB(R3),R4	; Restore UQB address
                    51   24 A4   D0  1A60  4870 	MOVL	UQB$L_UCB(R4),R1	; Restore UCB address
                       00C4 C1   D0  1A64  4871 	MOVL	UCB$L_RECORD(R1),-	; Initialize the MCSP position
                       00C4 C4       1A68  4872 		UQB$L_POSITION(R4)	;  with the UCB record count
                            05   E1  1A6B  4873 	BBC	#DEV$V_MSCP,-		; If we are not dealing with an MSCP
                      07 40 A1       1A6D  4874 		UCB$L_DEVCHAR2(R1),50$	;  device, then we can get the record
                       0080 C3   D0  1A70  4875 	MOVL	HRB$L_RECORD(R3),-	;  count out of the HRB since the 
                       00C4 C4       1A74  4876 		UQB$L_POSITION(R4)	;  class driver set it for us.
                                     1A77  4877 
                                     1A77  4878 50$:
                    52   18 A3   D0  1A77  4879 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                    51   1C A3   D0  1A7B  4880 	MOVL	HRB$L_IRP_CDRP(R3),R1	; Get the address of the IRP
                 20 A2   3A A1   3C  1A7F  4881 	MOVZWL	2+IRP$L_IOST1(R1), -	; Save the byte count
                                     1A84  4882 		MSCP$L_TAPEREC(R2)	;  to be returned in the end packet
                       00C4 C4   D0  1A84  4883 	MOVL	UQB$L_POSITION(R4),-	; Retrieve the position information
                         1C A2       1A88  4884 		MSCP$L_POSITION(R2)	;  to send back in the end packet.
                          0551   31  1A8A  4885 	BRW	TMSCP$SEND_END		; Send an end packet with R0 status
                                     1A8D  4886 
                                     1A8D  4887 TMSCP$ABORT_WRITE::
                                     1A8D  4888 	.IF DEFINED DEBUG$PC_HISTORY
                                     1A8D  4889 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1A8D  4890 	.ENDC	   ;DEBUG$PC_HISTORY
                            00   E0  1A8D  4891 	BBS	#HRB$V_ABORT,-		; If this request was aborted due to a
                      0A 16 A3       1A8F  4892 		HRB$W_FLAGS(R3),10$	;  disconnect, no end msg is necessary
                    52   18 A3   D0  1A92  4893 	MOVL	HRB$L_MSGBUF(R3),R2	; Get the message buffer address 
                       50   02   D0  1A96  4894 	MOVL	#MSCP$K_ST_ABRTD,R0	; Set the status to aborted
                          0542   31  1A99  4895 	BRW	TMSCP$SEND_END		;  and send out an end message
                                     1A9C  4896 
                                     1A9C  4897 10$:
                          0243   31  1A9C  4898 	BRW	TMSCP$CLEANUP_HRB	; Deallocate the resources used.
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 106
X-2A6A1                         Utility Routines                         27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (39)

                                     1A9F  4901 	.SBTTL	Utility Routines
                                     1A9F  4902 	.SBTTL	-	ALLOCATE - Allocate a local buffer for the request
                                     1A9F  4903 
                                     1A9F  4904 ;+
                                     1A9F  4905 ; Functional Description:
                                     1A9F  4906 ;
                                     1A9F  4907 ; This routine allocates a buffer on the serving node based on the 
                                     1A9F  4908 ; transfer size described in the MSCP request received. 
                                     1A9F  4909 ;
                                     1A9F  4910 ; Inputs:
                                     1A9F  4911 ;
                                     1A9F  4912 ;	R0  =  Scratch
                                     1A9F  4913 ;	R1  =  Scratch
                                     1A9F  4914 ;	R2  =  MSCP packet address
                                     1A9F  4915 ;	R3  =  HRB address
                                     1A9F  4916 ;	R4  =  UQB address, scratch
                                     1A9F  4917 ;	R5  =  Scratch
                                     1A9F  4918 ;
                                     1A9F  4919 ; Output:
                                     1A9F  4920 ;
                                     1A9F  4921 ;	R2  =  MSCP packet address
                                     1A9F  4922 ;	R3  =  HRB address
                                     1A9F  4923 ;
                                     1A9F  4924 ; Side Effects:
                                     1A9F  4925 ;
                                     1A9F  4926 ;	HRB$L_BCNT	filled in with the byte count from the MSCP packet.
                                     1A9F  4927 ;	HRB$L_OBCNT	filled in with the byte count from the MSCP packet
                                     1A9F  4928 ;	HRB$L_BUFLEN	is filled in with the length of the allocated buffer
                                     1A9F  4929 ;	HRB$L_BUFADR	is filled in with the address of the allocated buffer
                                     1A9F  4930 ;	HRB$L_SVAPTE	address of virtual page table entry for the buffer
                                     1A9F  4931 ;	HRB$W_BOFF	byte offset into the page table of start of buffer
                                     1A9F  4932 ;-
                                     1A9F  4933 
                                     1A9F  4934 	.ENABLE	LSB
                                     1A9F  4935 
                                     1A9F  4936 TMSCP$ALLOCATE::
                                     1A9F  4937 	.IF DEFINED DEBUG$PC_HISTORY
                                     1A9F  4938 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1A9F  4939 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1A9F  4940 
                                     1A9F  4941 ;
                                     1A9F  4942 ; Set up the count fields in the HRB to their initial values. 
                                     1A9F  4943 ;
                                     1A9F  4944 
                         0C A2   D0  1A9F  4945 	MOVL	MSCP$L_BYTE_CNT(R2),-	; Initialize byte count
                         38 A3       1AA2  4946 		HRB$L_OBCNT(R3)		;
                    51   38 A3   D0  1AA4  4947 	MOVL	HRB$L_OBCNT(R3),R1	; Set number of bytes to be transferred
                    18 A3   52   D0  1AA8  4948 	MOVL	R2,HRB$L_MSGBUF(R3)	; Save message buffer address.
                   00000000'GF   16  1AAC  4949 	JSB	G^EXE$ALONONPAGED
                         07 50   E8  1AB2  4950 	BLBS	R0,250$			; Continue if successful
                                     1AB5  4951 	.IF DEFINED DEBUG$TMSCP_REJECT_TRACKING
                                     1AB5  4952 	MOVL	G^SCS$GL_TMSCP, R5	; Get TSRV structure address.
                                     1AB5  4953 	MOVL	R0,TSRV$L_REPLC_CNT+8(R5); Save away the error code
                                     1AB5  4954 	INCL	TSRV$L_REPLC_CNT+12(R5)	; Save away a record of the reject
                                     1AB5  4955 	.ENDC	   ;DEBUG$TMSCP_REJECT_TRACKING
                                     1AB5  4956 	REJECT	#1			; If we were not able to satisfy this 
                       50   01   D0  1AB5       		MOVL	#1, R0
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 107
X-2A6A1                         - ALLOCATE - Allocate a local buffer for 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (39)

                         4C B4   16  1AB8       		JSB	@PDT$L_REJECT(R4)
                                 05  1ABB  4957 	RSB				;  memory request, reject the request
                                     1ABC  4958 
                                     1ABC  4959 250$:
                    2C A3   51   D0  1ABC  4960 	MOVL	R1,HRB$L_BUFLEN(R3)	; Save away the length and the
                    30 A3   52   D0  1AC0  4961 	MOVL	R2,HRB$L_BUFADR(R3)	;  address of the buffer allocated
                         38 A3   D0  1AC4  4962 	MOVL	HRB$L_OBCNT(R3),-	; Byte count is original request
                         46 A3       1AC7  4963 		HRB$L_BCNT(R3)		;  size from the packet.
          44 A3   52   FE00 8F   AB  1AC9  4964 	BICW3	#^C<VA$M_BYTE>,R2,-	; Determine the offset into the page
                                     1AD0  4965 		HRB$W_BOFF(R3)		;  and store that value away
                       15   09   EF  1AD0  4966 	EXTZV	#VA$V_VPN,#VA$S_VPN,-	; Then find the virtual page number
                       52   52       1AD3  4967 		R2, R2			;  to use as the destination.
              50   00000000'GF   D0  1AD5  4968 	MOVL	G^MMG$GL_SPTBASE,R0	; Get the address of the sys page table.
                  40 A3   6042   DE  1ADC  4969 	MOVAL	(R0)[R2],-		; Then get the address of the page
                                     1AE1  4970 		HRB$L_SVAPTE(R3)	;  table entry into the HRB.
                    52   18 A3   D0  1AE1  4971 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                                 05  1AE5  4972 	RSB
                                     1AE6  4973 
                                     1AE6  4974 	.DISABLE LSB
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 108
X-2A6A1                         - SEND_IRP -  prepare and issue an I/O t 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (40)

                                     1AE6  4977 	.SBTTL  -	SEND_IRP -  prepare and issue an I/O to a tape
                                     1AE6  4978 	.SBTTL  -	DRIVE_TRANSFER -  prepare and issue read/write type I/O
                                     1AE6  4979 	.SBTTL  -	DRIVE_CHECK -  prepare and issue ONLINE, AVAIL, SUC, and FLUSH
                                     1AE6  4980 
                                     1AE6  4981 ;+
                                     1AE6  4982 ; Functional Description:
                                     1AE6  4983 ;
                                     1AE6  4984 ; This routine can be called at two entry points. Entry DRIVE_TRANSFER is
                                     1AE6  4985 ; used for read/write type of commands. The tape drive is checked for being 
                                     1AE6  4986 ; unit online to the requesting host. Performance monitoring is activated 
                                     1AE6  4987 ; if enabled, and the I/O is then queued to the driver. We then RSB back to
                                     1AE6  4988 ; the caller's caller (most likely the port driver.) This thread suspends
                                     1AE6  4989 ; until I/O post calls us and resumes at subroutine TMSCP$BACK.
                                     1AE6  4990 ;
                                     1AE6  4991 ; Inputs:
                                     1AE6  4992 ;
                                     1AE6  4993 ;	R3  =  HRB address
                                     1AE6  4994 ;
                                     1AE6  4995 ; The second entry point, DRIVE_CHECK prepares an IRP for a tape I/O without 
                                     1AE6  4996 ; checking drive status. This routine is called by the ONLINE, AVAILABLE, and 
                                     1AE6  4997 ; SET UNIT CHAR code paths. The return to TMSCP$BACK is still the same.
                                     1AE6  4998 ;
                                     1AE6  4999 ; Inputs:
                                     1AE6  5000 ;
                                     1AE6  5001 ;	R3  =  HRB address
                                     1AE6  5002 ;
                                     1AE6  5003 ; Outputs:
                                     1AE6  5004 ;
                                     1AE6  5005 ;	None (See Outputs from routine TMSCP$BACK)
                                     1AE6  5006 ;
                                     1AE6  5007 ; Side Effects:
                                     1AE6  5008 ;
                                     1AE6  5009 ;	The IRP associated with the HRB is queued to be sent to the tape.
                                     1AE6  5010 ;-
                                     1AE6  5011 
                                     1AE6  5012 TMSCP$BLOCK_SEREX::
                                 11  1AE6  5013 	.BYTE	IO$_AVAILABLE
                                 01  1AE7  5014 	.BYTE	IO$_UNLOAD
                                 15  1AE8  5015 	.BYTE	IO$_DSE
                                 2A  1AE9  5016 	.BYTE	IO$_FLUSH
                                 0C  1AEA  5017 	.BYTE	IO$_READPBLK
                                 25  1AEB  5018 	.BYTE	IO$_SKIPFILE
                                 26  1AEC  5019 	.BYTE	IO$_SKIPRECORD
                                 02  1AED  5020 	.BYTE	IO$_SPACEFILE
                                 09  1AEE  5021 	.BYTE	IO$_SPACERECORD
                                 0B  1AEF  5022 	.BYTE	IO$_WRITEPBLK
                                 1C  1AF0  5023 	.BYTE	IO$_WRITEMARK
                                 0A  1AF1  5024 	.BYTE	IO$_WRITECHECK
                                     1AF2  5025 
                           0000000C  1AF2  5026 TMSCP$BLOCK_SEREX_LEN	=	. - TMSCP$BLOCK_SEREX
                                     1AF2  5027 
                                     1AF2  5028 TMSCP$DRIVE_TRANSFER::
                                     1AF2  5029 	.IF DEFINED DEBUG$PC_HISTORY
                                     1AF2  5030 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1AF2  5031 	.ENDC	   ;DEBUG$PC_HISTORY
                    55   1C A3   D0  1AF2  5032 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the IRP address 
                       4000 8F   A8  1AF6  5033 	BISW	#IRP$M_SRVIO,-		; Set server I/O for all transfer
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 109
X-2A6A1                         - DRIVE_CHECK -  prepare and issue ONLIN 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (40)

                         2A A5       1AFA  5034 		 IRP$W_STS(R5)		;  commands.
                            0A   11  1AFC  5035 	BRB	TMSCP$COMMON_TRANSFER	; Set up fields for I/O post.
                                     1AFE  5036 
                                     1AFE  5037 TMSCP$DRIVE_CHECK::
                                     1AFE  5038 	.IF DEFINED DEBUG$PC_HISTORY
                                     1AFE  5039 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1AFE  5040 	.ENDC	   ;DEBUG$PC_HISTORY
                    55   1C A3   D0  1AFE  5041 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the IRP address 
                       4100 8F   A8  1B02  5042 	BISW	#<IRP$M_SRVIO!IRP$M_PHYSIO>,- ; Set physical I/O and server I/O
                         2A A5       1B06  5043 		IRP$W_STS(R5)		;  for ONLINE, AVAILABLE, and SUC
                                     1B08  5044 
                                     1B08  5045 TMSCP$COMMON_TRANSFER::
                                     1B08  5046 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1B08  5047 	PUSHL	R0
                                     1B08  5048 	MOVZWL	IRP$W_FUNC(R5), R0	; Get the function value.
                                     1B08  5049 	BSBW	TMSCP$R0HIST		; Log the value for debugging.
                                     1B08  5050 	MOVL	IRP$L_MEDIA(R5), R0	; Log the MEDIA values.
                                     1B08  5051 	BSBW	TMSCP$R0HIST
                                     1B08  5052 	MOVL	4+IRP$L_MEDIA(R5), R0
                                     1B08  5053 	BSBW	TMSCP$R0HIST
                                     1B08  5054 	MOVL	8+IRP$L_MEDIA(R5), R0
                                     1B08  5055 	BSBW	TMSCP$R0HIST
                                     1B08  5056 	POPL	R0
                                     1B08  5057 	.ENDC  ;DEBUG$PC_HISTORY
                    54   58 A3   D0  1B08  5058 	MOVL	HRB$L_UQB(R3),R4	; Set up the UQB address in order to
                            0D   E1  1B0C  5059 	BBC	#MSCP$V_MD_CLSEX,-	; Is the clear serious exception modifier
                      07 3E A5       1B0E  5060 		IRP$L_MEDIA+6(R5),10$	;  set?
                            20   AA  1B11  5061 	BICW	#UQB$M_ST_SEREX,-	; If so, clear serious exception.
                       00C8 C4       1B13  5062 		UQB$W_ST_FLAGS(R4)
                            27   11  1B16  5063 	BRB	15$			;	
                                     1B18  5064 
                                     1B18  5065 10$:
                            05   E1  1B18  5066 	BBC	#UQB$V_ST_SEREX,-	; Is the serious exception bit set?
                    21 00C8 C4       1B1A  5067 		UQB$W_ST_FLAGS(R4),15$
                            00   EF  1B1E  5068 	EXTZV	#IO$V_FCODE,-		; Extract the function code
                            06       1B20  5069 		#IO$S_FCODE,-		;  
                    52   20 A5       1B21  5070 		IRP$W_FUNC(R5),R2	;
                            03   BB  1B24  5071 	PUSHR	#^M<R0,R1>		; Preserve registers destroyed by LOCC
                       0C   52   3A  1B26  5072 	LOCC	R2,#TMSCP$BLOCK_SEREX_LEN,-	; Is this a command which gets
                         BB AF       1B29  5073 		TMSCP$BLOCK_SEREX	;  blocked by serious exception?
                            03   BA  1B2B  5074 	POPR	#^M<R0,R1>		; Preserve registers destroyed by LOCC
                            10   13  1B2D  5075 	BEQL	15$			; EQL <= not a blocked command
                    52   18 A3   D0  1B2F  5076 	MOVL	HRB$L_MSGBUF(R3),R2	; MSCP packet address from the HRB
                            09   13  1B33  5077 	BEQL	12$			; Caching command; already sent end_packt
                       5E   04   C0  1B35  5078 	ADDL	# 4, SP			; Kill this thread by discarding return addr
                       50   12   D0  1B38  5079 	MOVL	#MSCP$K_ST_PRESE,R0	; Return serious exception and don't
                          04A0   30  1B3B  5080 	BSBW	TMSCP$SEND_END		;  even bother sending it to the drive
                                     1B3E  5081 
                                     1B3E  5082 12$:
                                 05  1B3E  5083 	RSB				; Return to lower IPL
                                     1B3F  5084 
                                     1B3F  5085 15$:
                         0C A3 8ED0  1B3F  5086 	POPL	HRB$L_RESPC(R3)		; Where to return after IOPOST
                    14 A5   53   D0  1B43  5087 	MOVL	R3,IRP$L_ASTPRM(R5)	; Store HRB in IRP for class driver use
               0C A5   1BC5'CF   9E  1B47  5088 	MOVAB	W^TMSCP$BACK, -		; Address to which IOPOST returns IRP
                                     1B4D  5089 		IRP$L_PID(R5)
                         58 A4   D6  1B4D  5090 	INCL	UQB$L_IOCNT(R4)		;  record the queue and total I/O
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 110
X-2A6A1                         - DRIVE_CHECK -  prepare and issue ONLIN 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (40)

                         5C A4   B6  1B50  5091 	INCW	UQB$W_QLEN(R4)		;  contribution the server initiates
                       53   55   D0  1B53  5092 	MOVL	R5,R3			; Set up R3 with IRP for EXE$INSIOQC
                    55   24 A4   D0  1B56  5093 	MOVL	UQB$L_UCB(R4),R5	; Set up the UCB address for EXE$INSIOQC
                   00000000'GF   D5  1B5A  5094 	TSTL	G^PMS$GL_IOPFMPDB	; I/O performance monitoring enabled?
                            08   13  1B60  5095 	BEQL	20$			; If not, don't monitor
                   00000000'GF   16  1B62  5096 	JSB	G^PMS$START_RQ		; Gather Start I/O Request statistics
                            39   11  1B68  5097 	BRB	30$			;  and start the I/O
                                     1B6A  5098 
                                     1B6A  5099 20$:
                                     1B6A  5100 	LOCK	LOCKNAME=PERFMON,-	; Lock PERFMON access
                                     1B6A  5101 		PRESERVE=NO,-		;  don't preserve R0
                                     1B6A  5102 		SAVIPL=-(SP)		;  save the current IPL
                       7E   12   DB  1B6A       	 MFPR	S^#PR$_IPL,-(SP)
                0B 00000000'GF   E9  1B6D       	BLBC	G^SMP$GL_FLAGS,30075$
                       50   26   9A  1B74       	 MOVZBL	S^#SPL$C_PERFMON,R0
                   00000000'GF   16  1B77       	 JSB	G^SMP$ACQUIRE
                            03   11  1B7D       	BRB	30076$
                                     1B7F       30075$:
                       12   0F   DA  1B7F       		MTPR	S^#IPL$_PERFMON,S^#PR$_IPL
                                     1B82       30076$:
                   00000000'GF   D0  1B82  5103 	MOVL	G^PMS$GL_IOPFMSEQ,-	; Insert the I/O sequence number
                         50 A3       1B88  5104 		IRP$L_SEQNUM(R3)	;  into the IRP
                   00000000'GF   D6  1B8A  5105 	INCL	G^PMS$GL_IOPFMSEQ	; And bump the global counter
                                     1B90  5106 	UNLOCK	LOCKNAME=PERFMON,-	; Release PERFMON access
                                     1B90  5107 		PRESERVE=NO,-		;  don't preserve R0
                                     1B90  5108 		NEWIPL=(SP)+		;  restore the saved IPL
                09 00000000'GF   E9  1B90       	BLBC	G^SMP$GL_FLAGS,30082$
                       50   26   9A  1B97       	 MOVZBL	S^#SPL$C_PERFMON,R0
                   00000000'GF   16  1B9A       	 JSB	G^SMP$RELEASE
                                     1BA0       30082$:
                       12   8E   DA  1BA0       	 MTPR	(SP)+,S^#PR$_IPL
                                     1BA3  5109 
                                     1BA3  5110 30$:
                    51   14 A3   D0  1BA3  5111 	MOVL	IRP$L_HRB(R3),R1	; Restore HRB address
                            05   B0  1BA7  5112 	MOVW	#HRB$K_ST_DRV_WAIT,-	; Set the state of this request
                         14 A1       1BA9  5113 		HRB$W_STATE(R1)		;  as queued to the driver
                       00B8 C4   B6  1BAB  5114 	INCW	UQB$W_NUM_IO(R4)	; Incrememt current IOs to the drive
                       00BA C4   B1  1BAF  5115 	CMPW	UQB$W_MAX_IO(R4),-	; Did we exceed the maximum current
                       00B8 C4       1BB3  5116 		UQB$W_NUM_IO(R4)	;  counter?
                            07   18  1BB6  5117 	BGEQ	40$			; No, go issue the IO
                       00B8 C4   B0  1BB8  5118 	MOVW	UQB$W_NUM_IO(R4),-	; Update maximum drive IO counter
                       00BA C4       1BBC  5119 		UQB$W_MAX_IO(R4)	;  
                                     1BBF  5120 
                                     1BBF  5121 40$:
                   00000000'GF   17  1BBF  5122 	JMP	G^EXE$INSIOQC		; Queue the IRP to the driver
                                     1BC5  5123 ;
                                     1BC5  5124 ; This routine now RSBs back to the caller's caller. This thread is
                                     1BC5  5125 ; suspended and will resume when IOPOST calls us at entry TMSCP$BACK.
                                     1BC5  5126 ;
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 111
X-2A6A1                         - BACK  -  return from tape I/O and cont 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (41)

                                     1BC5  5129 	.SBTTL	-	BACK  -  return from tape I/O and continue
                                     1BC5  5130 
                                     1BC5  5131 ;+
                                     1BC5  5132 ; Functional Description:
                                     1BC5  5133 ;
                                     1BC5  5134 ; On returning from performing an I/O, the state of the HRB is checked 
                                     1BC5  5135 ; to see if the request has been aborted while we were out to tape. If it 
                                     1BC5  5136 ; was, the allocated resources are deallocated and the request finished off 
                                     1BC5  5137 ; without returning to the caller.
                                     1BC5  5138 ;
                                     1BC5  5139 ; Inputs:
                                     1BC5  5140 ;
                                     1BC5  5141 ;	R0  =  Scratch
                                     1BC5  5142 ;	R1  =  Scratch
                                     1BC5  5143 ;	R2  =  Scratch
                                     1BC5  5144 ;	R3  =  Scratch
                                     1BC5  5145 ;	R4  =  Scratch
                                     1BC5  5146 ;	R5  =  IRP address returned from IOPOST
                                     1BC5  5147 ;
                                     1BC5  5148 ; Outputs:
                                     1BC5  5149 ;
                                     1BC5  5150 ;	R0  =  The first longword of the IOSB
                                     1BC5  5151 ;	R2  =  preserved
                                     1BC5  5152 ;	R3  =  HRB address
                                     1BC5  5153 ;
                                     1BC5  5154 ; Side Effects:
                                     1BC5  5155 ;
                                     1BC5  5156 ;	Control is resumed at the address stored in the resume PC 
                                     1BC5  5157 ;	field of the Host Request Block.
                                     1BC5  5158 ;-                               
                                     1BC5  5159 
                                     1BC5  5160 TMSCP$BACK::
                                     1BC5  5161 	LOCK	LOCKNAME=SCS,-		; Lock SCS access
                                     1BC5  5162 		PRESERVE=NO,-		;  don't preserve R0
                                     1BC5  5163 		SAVIPL=-(SP)		;  save the current IPL
                       7E   12   DB  1BC5       	 MFPR	S^#PR$_IPL,-(SP)
                0B 00000000'GF   E9  1BC8       	BLBC	G^SMP$GL_FLAGS,30088$
                       50   34   9A  1BCF       	 MOVZBL	S^#SPL$C_SCS,R0
                   00000000'GF   16  1BD2       	 JSB	G^SMP$ACQUIRE
                            03   11  1BD8       	BRB	30089$
                                     1BDA       30088$:
                       12   08   DA  1BDA       		MTPR	S^#IPL$_SCS,S^#PR$_IPL
                                     1BDD       30089$:
                    53   14 A5   D0  1BDD  5164 	MOVL	IRP$L_HRB(R5),R3	; Restore the HRB address
                                     1BE1  5165 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1BE1  5166 	BSBW	TMSCP$PCHIST_R3		; Log the PC for debugging.
                                     1BE1  5167 	.ENDC  ;DEBUG$PC_HISTORY
                       8000 8F   A8  1BE1  5168 	BISW	#HRB$M_STATE_INVALID,-	; The state of this request is "current"
                         14 A3       1BE5  5169 		HRB$W_STATE(R3)		;  leave the old state for diagnosis
                       4100 8F   AA  1BE7  5170 	BICW	#<IRP$M_PHYSIO!IRP$M_SRVIO>,- ; Clear physical I/O and server I/O flags
                         2A A5       1BEB  5171 		IRP$W_STS(R5)		;  only needed for ONLINE and AVAILABLE (physio)
                   00000000'GF   D5  1BED  5172 	TSTL	G^PMS$GL_IOPFMPDB	; I/O performance monitoring is 
                            06   13  1BF3  5173 	BEQL	10$			;  not enabled, skip
                   00000000'GF   16  1BF5  5174 	JSB	G^PMS$END_RQ		; Gather End I/O Request statistics
                                     1BFB  5175 
                                     1BFB  5176 10$:
                    54   58 A3   D0  1BFB  5177 	MOVL	HRB$L_UQB(R3),R4	; Restore UQB address
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 112
X-2A6A1                         - BACK  -  return from tape I/O and cont 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (41)

                       00B8 C4   B7  1BFF  5178 	DECW	UQB$W_NUM_IO(R4)	; Decrement counter for IOs to the drive.
                    51   1C A5   D0  1C03  5179 	MOVL	IRP$L_UCB(R5),R1	; Pick up UCB pointer
               7E A1   FFFF 8F   58  1C07  5180 	ADAWI	#-1,UCB$W_QLEN(R1)	; Drop queue length counter
                         5C A4   B7  1C0D  5181 	DECW	UQB$W_QLEN(R4)		; Drop the local queue length counter
                                 B3  1C10  5182 	BITW	#<HRB$M_ABORT!-		; Check to see if we lost the connection
                                     1C11  5183 		HRB$M_ABORTWS>,-	;  or if this request was canceled,
                    16 A3   03       1C11  5184 		HRB$W_FLAGS(R3)		;  since this I/O was sent to tape
                            13   13  1C14  5185 	BEQL	30$
                                     1C16  5186 
                                     1C16  5187 ;
                                     1C16  5188 ; If this command has been canceled by a ^Y, it is aborted with status (an
                                     1C16  5189 ; end message is returned). However, if this command has been aborted for any
                                     1C16  5190 ; other reason there is no one to send and end message to. In this case, start 
                                     1C16  5191 ; the next entry on the blocked queue if there is one, and deallocate any 
                                     1C16  5192 ; resources held by this request.
                                     1C16  5193 ;
                                     1C16  5194 
                    52   18 A3   D0  1C16  5195 	MOVL	HRB$L_MSGBUF(R3),R2	; Get the message buffer address 
                            08   13  1C1A  5196 	BEQL	20$			;  if none, don't return status
                       50   02   D0  1C1C  5197 	MOVL	#MSCP$K_ST_ABRTD,R0	;  otherwise return an aborted status
                          03BC   30  1C1F  5198 	BSBW	TMSCP$SEND_END		;  in an end message before returning
                            0F   11  1C22  5199 	BRB	40$			;  back to a lower IPL
                                     1C24  5200 
                                     1C24  5201 20$:
                          00BB   30  1C24  5202 	BSBW	TMSCP$CLEANUP_HRB	; Clean up this request
                            0A   11  1C27  5203 	BRB	40$			; Return back to a lower IPL
                                     1C29  5204 
                                     1C29  5205 30$:
                         60 A3   D7  1C29  5206 	DECL	HRB$L_CMD_STS(R3)	; Report progress on this request
                    50   38 A5   D0  1C2C  5207 	MOVL	IRP$L_IOST1(R5),R0	; Return the I/O status block in R0
                                     1C30  5208 
                                     1C30  5209 ;
                                     1C30  5210 ;	R0  =  I/O status block, scratch
                                     1C30  5211 ;	R1  =  Scratch
                                     1C30  5212 ;	R2  =  Scratch
                                     1C30  5213 ;	R3  =  HRB address
                                     1C30  5214 ;	R4  =  UQB address
                                     1C30  5215 ;	R5  =  IRP address
                                     1C30  5216 ;
                                     1C30  5217 
                                     1C30  5218 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1C30  5219 	PUSHAB	35$			; Set the return address.
                                     1C30  5220 	PUSHL	HRB$L_RESPC(R3)		; Resume previous thread.
                                     1C30  5221 	BRW	TMSCP$PCHIST_R3R0	; Log the PC for debugging.
                                     1C30  5222 
                                     1C30  5223 35$:
                                     1C30  5224 	BSBW	TMSCP$PCHIST		; Log the PC for debugging.
                                     1C30  5225 	.IFF
                         0C B3   16  1C30  5226 	JSB	@HRB$L_RESPC(R3)	; Resume where we left off
                                     1C33  5227 	.ENDC  ;DEBUG$PC_HISTORY
                                     1C33  5228 
                                     1C33  5229 40$:
                                     1C33  5230 	UNLOCK	LOCKNAME=SCS,-		; Release SCS access
                                     1C33  5231 		PRESERVE=NO,-		;  don't preserve R0
                                     1C33  5232 		NEWIPL=(SP)+,-		;  restore the saved IPL
                                     1C33  5233 		CONDITION=RESTORE	;  conditionally release spinlock
                09 00000000'GF   E9  1C33       	BLBC	G^SMP$GL_FLAGS,30095$
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 113
X-2A6A1                         - BACK  -  return from tape I/O and cont 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (41)

                       50   34   9A  1C3A       	 MOVZBL	S^#SPL$C_SCS,R0
                   00000000'GF   16  1C3D       	 JSB	G^SMP$RESTORE
                                     1C43       30095$:
                       12   8E   DA  1C43       	 MTPR	(SP)+,S^#PR$_IPL
                                 05  1C46  5234 	RSB				;  and return
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 114
X-2A6A1                         - ALLOCATE_HRB -  Host Request Block All 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (42)

                                     1C47  5237 	.SBTTL	-	ALLOCATE_HRB -  Host Request Block Allocation
                                     1C47  5238 
                                     1C47  5239 ;+
                                     1C47  5240 ; Functional Description:
                                     1C47  5241 ;
                                     1C47  5242 ; This module allocates enough memory for a Host Request Buffer, and
                                     1C47  5243 ; fills in the preliminary fields. The Connection Decsriptor Table and 
                                     1C47  5244 ; the Port Descriptor Table addresses are juggled around in this module 
                                     1C47  5245 ; too. When control is passed to the server at TMSCP$MSG_IN, the CDT is in
                                     1C47  5246 ; register 3 and the PDT is in register 4. Since R3 has been designated 
                                     1C47  5247 ; as the HRB address, and the PDT is stored away in the HRB, control is
                                     1C47  5248 ; returned to the caller with the CDT address in R4.
                                     1C47  5249 ;
                                     1C47  5250 ; Inputs:
                                     1C47  5251 ;
                                     1C47  5252 ;	None
                                     1C47  5253 ;
                                     1C47  5254 ; Outputs:
                                     1C47  5255 ;
                                     1C47  5256 ;	R0  =  completion status code
                                     1C47  5257 ;		SS$_INSFMEM - not enough memory to allocate the HRB
                                     1C47  5258 ;		SS$_NORMAL  - HRB and IRP were allocated and linked together
                                     1C47  5259 ;	R3  =  HRB address
                                     1C47  5260 ;
                                     1C47  5261 ;	R1,R2,R4,R5  -  preserved
                                     1C47  5262 ;-
                                     1C47  5263 
                                     1C47  5264 TMSCP$ALLOCATE_HRB::
                                     1C47  5265 	.IF DEFINED DEBUG$PC_HISTORY
                                     1C47  5266 	BSBW	TMSCP$PCHIST		; Save this PC if we are keeping track
                                     1C47  5267 	.ENDC	   ;DEBUG$PC_HISTORY
                            36   BB  1C47  5268 	PUSHR	#^M<R1,R2,R4,R5>	; Save the registers to be used
                    51   84 8F   9A  1C49  5269 	MOVZBL	#HRB$K_LENGTH,R1	; Length of the requested buffer
                   00000000'GF   16  1C4D  5270 	JSB	G^EXE$ALONONPAGED	; Get the memory
                         03 50   E8  1C53  5271 	BLBS	R0, 10$			; HRB allocated - branch.
                          0082   31  1C56  5272 	BRW	40$			; Unsuccessful return an error
                                     1C59  5273 
                                     1C59  5274 10$:
                       53   52   D0  1C59  5275 	MOVL	R2,R3			; Save the address of the request buffer
                                     1C5C  5276 	.IF DEFINED DEBUG$PC_HISTORY
                                     1C5C  5277 	BSBW	TMSCP$R3HIST		; Save this HRB address.
                                     1C5C  5278 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1C5C  5279 
                                     1C5C  5280 ;
                                     1C5C  5281 ; Initialize known fields in the newly allocated HRB.
                                     1C5C  5282 ;
                                     1C5C  5283 
                            3F   BB  1C5C  5284 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                  00   6E   00   2C  1C5E  5285 	MOVC5	#0,(SP),#0,-		; Initialize entire structure in
                  63   0084 8F       1C62  5286 		#HRB$K_LENGTH,(R3)		;  in one fell swoop. 
                            3F   BA  1C66  5287 	POPR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                    08 A3   51   B0  1C68  5288 	MOVW	R1,HRB$W_SIZE(R3)	; Fill in the size field
                                     1C6C  5289 
                                     1C6C  5290 	ASSUME	HRB$B_SUBTYPE EQ 1+HRB$B_TYPE
                                     1C6C  5291 
               0A A3   0373 8F   B0  1C6C  5292 	MOVW	#<DYN$C_TSRV_HRB@8>! -	; Set data structure subtype and type.
                                     1C72  5293 		DYN$C_TSRV, -
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 115
X-2A6A1                         - ALLOCATE_HRB -  Host Request Block All 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (42)

                                     1C72  5294 		HRB$B_TYPE(R3)
                    60 A3   02   CE  1C72  5295 	MNEGL	#2,HRB$L_CMD_STS(R3)	; Initialize the status field 
                                     1C76  5296 
                                     1C76  5297 ;
                                     1C76  5298 ; Allocate and link the IRP into the HRB.
                                     1C76  5299 ;
                                     1C76  5300 
                    51   A8 8F   9A  1C76  5301 	MOVZBL	#IRP$K_LENGTH,R1	; Size of buffer to be allocated
                   00000000'GF   16  1C7A  5302 	JSB	G^EXE$ALONONPAGED	; Get enough memory for an IRP-CDRP
                         4F 50   E9  1C80  5303 	BLBC	R0, 30$			; Return an error if unsuccessful
                                     1C83  5304 
                                     1C83  5305 ;
                                     1C83  5306 ; Fill in any of the IRP that we can at this point.
                                     1C83  5307 ;
                    1C A3   52   D0  1C83  5308 	MOVL	R2,HRB$L_IRP_CDRP(R3)	; Save away the IRP address
                            0A   90  1C87  5309 	MOVB	# DYN$C_IRP,-		; Fill in the type
                         0A A2       1C89  5310 		IRP$B_TYPE(R2)		; 
                         0B A2   94  1C8B  5311 	CLRB	IRP$B_RMOD(R2)		; Clear the access mode of the request
                    08 A2   51   B0  1C8E  5312 	MOVW	R1, IRP$W_SIZE(R2)	; Fill in the size
                         18 A2   D4  1C92  5313 	CLRL	IRP$L_WIND(R2)		; No window control blocks in the server
                         22 A2   94  1C95  5314 	CLRB	IRP$B_EFN(R2)		; Clear out the event flag number
                                     1C98  5315 
                                     1C98  5316 	ASSUME	IRP$W_STS	EQ  2+IRP$W_CHAN
                                     1C98  5317 
                         28 A2   D4  1C98  5318 	CLRL	IRP$W_CHAN(R2)		; Clear channel and status.
                       0080 C2   D4  1C9B  5319 	CLRL	IRP$L_RSPID(R2)		; Signify no response ID allocated
                         30 A2   B4  1C9F  5320 	CLRW	IRP$W_BOFF(R2)		; No bytes to offset to.
                         2C A2   D4  1CA2  5321 	CLRL	IRP$L_SVAPTE(R2)	; No buffer.
                         32 A2   D4  1CA5  5322 	CLRL	IRP$L_BCNT(R2)		; No bytes to transfer.
                         20 A2   B4  1CA8  5323 	CLRW	IRP$W_FUNC(R2)		; No function yet.
                    14 A2   53   D0  1CAB  5324 	MOVL	R3,IRP$L_HRB(R2)	; Set the HRB address for IO completion
                                     1CAF  5325 
                                     1CAF  5326 	ASSUME	IRP$L_IOST1	EQ    IRP$L_MEDIA
                                     1CAF  5327 	ASSUME	IRP$L_IOST2	EQ  4+IRP$L_IOST1
                                     1CAF  5328 	ASSUME	IRP$B_CARCON	EQ  4+IRP$L_MEDIA
                                     1CAF  5329 
                         38 A2   7C  1CAF  5330 	CLRQ	IRP$L_MEDIA(R2)		; Initialize the I/O parameters.
                                     1CB2  5331 
                                     1CB2  5332 	ASSUME	IRP$L_ABCNT	EQ  8+IRP$L_MEDIA
                                     1CB2  5333 	ASSUME	IRP$L_OBCNT	EQ  4+IRP$L_ABCNT
                                     1CB2  5334 
                         40 A2   7C  1CB2  5335 	CLRQ	IRP$L_ABCNT(R2)
                                     1CB5  5336 
                                     1CB5  5337 ;
                                     1CB5  5338 ; Initialize a few of the CDRP fields.
                                     1CB5  5339 ;
                                     1CB5  5340 
                    52   60 A2   DE  1CB5  5341 	MOVAL	IRP$L_FQFL(R2),R2	; Move down to the CDRP portion
                            62   7C  1CB9  5342 	CLRQ	CDRP$L_FQFL(R2)		; Show that we are not on any queue
                    0A A2   39   90  1CBB  5343 	MOVB	#DYN$C_CDRP, -		; Fill in the CDRP type field
                                     1CBF  5344 		CDRP$B_CD_TYPE(R2)	; 
                       FFA0 8F   B0  1CBF  5345 	MOVW	#CDRP$L_IOQFL,-		; Negative offset to start of IRP
                         08 A2       1CC3  5346 		CDRP$W_CDRPSIZE(R2)	;  on the front of this CDRP
                            34   90  1CC5  5347 	MOVB	#SPL$C_SCS,-		; Load the type of spinlock held
                         0B A2       1CC7  5348 		CDRP$B_FLCK(R2)		;  for the server
                         28 A2   D4  1CC9  5349 	CLRL	CDRP$L_RWCPTR(R2)	; 
                       50   01   D0  1CCC  5350 	MOVL	#SS$_NORMAL,R0		; Set success status
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 116
X-2A6A1                         - ALLOCATE_HRB -  Host Request Block All 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (42)

                                     1CCF  5351 
                                     1CCF  5352 ;
                                     1CCF  5353 ; Restore the registers to their original state and return.
                                     1CCF  5354 ;
                                     1CCF  5355 
                                     1CCF  5356 20$:
                            36   BA  1CCF  5357 	POPR	#^M<R1,R2,R4,R5>	; Put everything back
                                 05  1CD1  5358 	RSB				;  and return to the caller
                                     1CD2  5359 
                                     1CD2  5360 30$:
                       50   53   D0  1CD2  5361 	MOVL	R3,R0			; Address of structure to deallocate
                   00000000'GF   16  1CD5  5362 	JSB	G^EXE$DEANONPAGED	; Return the HRB to nonpaged pool
                                     1CDB  5363 
                                     1CDB  5364 40$:
                  50   0124 8F   3C  1CDB  5365 	MOVZWL	#SS$_INSFMEM,R0		; Set an error code
                            ED   11  1CE0  5366 	BRB	20$
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 117
X-2A6A1                         - CLEANUP_HRB -  Host Request Resource D 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (43)

                                     1CE2  5369 	.SBTTL	-	CLEANUP_HRB -  Host Request Resource Deallocation
                                     1CE2  5370 
                                     1CE2  5371 ;+
                                     1CE2  5372 ; Functional Description:
                                     1CE2  5373 ;
                                     1CE2  5374 ; This routine runs down through a HRB checking for resources that are 
                                     1CE2  5375 ; allocated for this request. As it finds them it deallocates the resources
                                     1CE2  5376 ; and cleanes up all the pointers used to link them all together.
                                     1CE2  5377 ;
                                     1CE2  5378 ; Inputs:
                                     1CE2  5379 ;
                                     1CE2  5380 ;	R3  =  HRB address
                                     1CE2  5381 ;
                                     1CE2  5382 ; Outputs:
                                     1CE2  5383 ;
                                     1CE2  5384 ;	R0  =  status code
                                     1CE2  5385 ;	R4  =  UQB address
                                     1CE2  5386 ;-
                                     1CE2  5387 
                                     1CE2  5388 TMSCP$CLEANUP_HRB::
                                     1CE2  5389 	.IF DEFINED DEBUG$PC_HISTORY
                                     1CE2  5390 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1CE2  5391 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1CE2  5392 
                                     1CE2  5393 ;
                                     1CE2  5394 ; Start the next sequential command. 
                                     1CE2  5395 ; 
                                     1CE2  5396  
                 09 16 A3   05   E1  1CE2  5397 	BBC	#HRB$V_UNBLOCK, -	; If this is not a sequential command 
                                     1CE7  5398 		HRB$W_FLAGS(R3), 5$	; then kill this thread - branch. 
                    54   58 A3   D0  1CE7  5399 	MOVL	HRB$L_UQB(R3), R4	; Get the Unit Queue Block address. 
                            03   13  1CEB  5400 	BEQL	5$			; VC_ERR processing - branch. 
                          00C6   30  1CED  5401 	BSBW	TMSCP$UNBLOCK		; Start the next sequential command. 
                                     1CF0  5402  
                                     1CF0  5403 5$: 
                                     1CF0  5404  
                                     1CF0  5405 ; 
                                     1CF0  5406 ; Dequeue this request from the blocked queue, if it's still hooked. 
                                     1CF0  5407 ; Commands that were aborted during the MAP_WAIT state, or the SNDAT_WAIT 
                                     1CF0  5408 ; can still be on the blocked for sequential completion queue. 
                                     1CF0  5409 ; 
                                     1CF0  5410  
                         4C A3   D5  1CF0  5411 	TSTL	HRB$L_WAIT_FL(R3)	; Are we still on the blocked queue? 
                            0D   13  1CF3  5412 	BEQL	7$			; EQL implies not. 
                    54   4C A3   0F  1CF5  5413 	REMQUE	HRB$L_WAIT_FL(R3),R4	; Remove the request from the queue 
                    55   58 A3   D0  1CF9  5414 	MOVL	HRB$L_UQB(R3),R5	; Get the address of the UQB 
                            03   13  1CFD  5415 	BEQL	7$			;  we can't decrement what doesn't exist
                         28 A5   B7  1CFF  5416 	DECW	UQB$W_NUM_QUE(R5)	;  so we can update the counter 
                                     1D02  5417 
                                     1D02  5418 ;
                                     1D02  5419 ; Set up the standard inputs for SCS calls; PDT in R4 and CDRP in R5
                                     1D02  5420 ;
                                     1D02  5421 
                                     1D02  5422 7$:
                    55   1C A3   D0  1D02  5423 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the address of the IRP
                    55   60 A5   DE  1D06  5424 	MOVAL	IRP$L_FQFL(R5),R5	; CDRP starting offset
                    54   5C A3   D0  1D0A  5425 	MOVL	HRB$L_PDT(R3),R4	; Set up the PDT address for SCS calls
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 118
X-2A6A1                         - CLEANUP_HRB -  Host Request Resource D 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (43)

                                     1D0E  5426 
                                     1D0E  5427 ;
                                     1D0E  5428 ; Release any mapping resources held.
                                     1D0E  5429 ;
                            04   E5  1D0E  5430 	BBCC	#HRB$V_MAP,-		; Check to see if this request has
                      08 16 A3       1D10  5431 		HRB$W_FLAGS(R3),10$	;  any mapping resources allocated
                         20 A3   DE  1D13  5432 	MOVAL	HRB$B_LBUFF(R3),-	; Get the local buffer descriptor addres
                         2C A5       1D16  5433 		CDRP$L_LBUFH_AD(R5)	;  from the HRB and put it in the CDRP
                                     1D18  5434 	UNMAP				; If it does, release them
                         64 B4   16  1D18       		JSB	@PDT$L_UNMAP(R4)
                                     1D1B  5435 
                                     1D1B  5436 ;
                                     1D1B  5437 ; Release a RSPID if one is held.
                                     1D1B  5438 ;
                                     1D1B  5439 
                                     1D1B  5440 10$:
                         20 A5   D5  1D1B  5441 	TSTL	CDRP$L_RSPID(R5)	; Check the response ID field
                            06   13  1D1E  5442 	BEQL	20$			; If it is zero none is held
                                     1D20  5443 	DEALLOC_RSPID			; Return the response ID to SCS
                   00000000'GF   16  1D20       		JSB	G^SCS$DEALL_RSPID
                                     1D26  5444 
                                     1D26  5445 ;
                                     1D26  5446 ; Deallocate the MSCP message buffer. (may start up another thread)
                                     1D26  5447 ;
                                     1D26  5448 
                                     1D26  5449 20$:
                         18 A3   D5  1D26  5450 	TSTL	HRB$L_MSGBUF(R3)	; Check for allocated message buffer
                            14   13  1D29  5451 	BEQL	30$			; Continue, if none is allocated
                         18 A3   D0  1D2B  5452 	MOVL	HRB$L_MSGBUF(R3),- 	; Get the message buffer address
                         1C A5       1D2E  5453 		CDRP$L_MSG_BUF(R5)	;  from the HRB and put it in the CDRP
                         18 A3   D4  1D30  5454 	CLRL	HRB$L_MSGBUF(R3)	;  and clear out the address in the HRB
                    50   54 A3   D0  1D33  5455 	MOVL	HRB$L_HQB(R3),R0	; Get the address of the HQB
                         28 A0   D0  1D37  5456 	MOVL	HQB$L_CDT(R0),-		;  so we can get the CDT address
                         24 A5       1D3A  5457 		CDRP$L_CDT(R5)		;  and put it in the CDRP for the call
                                     1D3C  5458 	DEALLOC_MSG_BUF			; Get rid of the message buffer
                         20 B4   16  1D3C       		JSB	@PDT$L_DEALLOMSG(R4)
                                     1D3F  5459 
                                     1D3F  5460 ;
                                     1D3F  5461 ; Deallocate any local buffer, and check for any requests that may be
                                     1D3F  5462 ; waiting for buffer space.
                                     1D3F  5463 ;
                                     1D3F  5464 
                                     1D3F  5465 30$:
                    54   58 A3   D0  1D3F  5466 	MOVL	HRB$L_UQB(R3),R4	; Restore UQB address
                            13   13  1D43  5467 	BEQL	35$			; Command without unit from VC_ERR - branch.
                         30 A3   D5  1D45  5468 	TSTL	HRB$L_BUFADR(R3)	; Check for any local buffers
                            0E   13  1D48  5469 	BEQL	35$			; No transfer buffer allocated to req
                    50   30 A3   D0  1D4A  5470 	MOVL	HRB$L_BUFADR(R3),R0	; Address of block to be deallocated
                    51   2C A3   D0  1D4E  5471 	MOVL	HRB$L_BUFLEN(R3),R1	; Size of block to be deallocated
                   00000000'GF   16  1D52  5472 	JSB	G^EXE$DEANONPGDSIZ	; Return the local buffer to pool
                                     1D58  5473 
                                     1D58  5474 ;
                                     1D58  5475 ; Deallocate any IRP that was allocated.
                                     1D58  5476 ;
                                     1D58  5477 
                                     1D58  5478 35$:
                         30 A3   D4  1D58  5479 	CLRL	HRB$L_BUFADR(R3)	; Clear out the buffer address
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 119
X-2A6A1                         - CLEANUP_HRB -  Host Request Resource D 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (43)

                    50   1C A3   D0  1D5B  5480 	MOVL	HRB$L_IRP_CDRP(R3),R0	; Get the address of the IRP
                            09   13  1D5F  5481 	BEQL	40$			; None was allocated, continue...
                   00000000'GF   16  1D61  5482 	JSB	G^EXE$DEANONPAGED	; Free the memory
                         1C A3   D4  1D67  5483 	CLRL	HRB$L_IRP_CDRP(R3)	;  and clear out the buffer pointer
                                     1D6A  5484 
                                     1D6A  5485 ;
                                     1D6A  5486 ; Unhook host request block from the list of requests pending for this host.
                                     1D6A  5487 ;
                                     1D6A  5488 
                                     1D6A  5489 40$:
                    55   54 A3   D0  1D6A  5490 	MOVL	HRB$L_HQB(R3),R5	; R5 -> HQB structure
                            63   D5  1D6E  5491 	TSTL	HRB$L_FLINK(R3)		; If this HRB is already unhooked
                            08   13  1D70  5492 	BEQL	55$			;  (from add) skip the remque
                                     1D72  5493 
                                     1D72  5494 	ASSUME	HRB$L_FLINK EQ 0
                                     1D72  5495 
                       53   63   0F  1D72  5496 	REMQUE	HRB$L_FLINK(R3),R3	; Remove entry but keep address handy
                            63   D4  1D75  5497 	CLRL	HRB$L_FLINK(R3)		; Show the entry removed from the queue
                         1C A5   B7  1D77  5498 	DECW	HQB$W_NUM_QUE(R5)	; Decrement pending for this host
                                     1D7A  5499 
                                     1D7A  5500 ;
                                     1D7A  5501 ; Deallocate the HRB, we don't need it any more.
                                     1D7A  5502 ;
                                     1D7A  5503 
                                     1D7A  5504 55$:
                       50   53   D0  1D7A  5505 	MOVL	R3,R0			; Address to deallocate as well
                   00000000'GF   16  1D7D  5506 	JSB	G^EXE$DEANONPAGED	; Deallocate the HRB
                       50   01   D0  1D83  5507 	MOVL	#SS$_NORMAL,R0		; Return a successful status
                            53   D4  1D86  5508 	CLRL	R3			; Clear out the old pointer
                                     1D88  5509 
                                     1D88  5510 ;
                                     1D88  5511 ; Check to see if this is the last request pending for this host. If it is,
                                     1D88  5512 ; we can send out the disconnect and delete the HQB for this host.
                                     1D88  5513 ;
                            00   E1  1D88  5514 	BBC	#HQB$V_VC_FAILED,-	; If the circuit has NOT failed,
                      03 0D A5       1D8A  5515 		HQB$B_STATE(R5),100$	;  just continue on...
                          0342   30  1D8D  5516 	BSBW	TMSCP$DEALLOC_HQB	; Otherwise send out the disconnect
                                     1D90  5517 
                                     1D90  5518 100$:
                                 05  1D90  5519 	RSB				; Return to the caller
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 120
X-2A6A1                         - UNBLOCK - Restart Any Blocked Commands 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (44)

                                     1D91  5522 	.SBTTL	-	UNBLOCK - Restart Any Blocked Commands
                                     1D91  5523 	.SBTTL	-	SEQ_STALL - Synchronize Sequential Commands
                                     1D91  5524 	.ENABLE LSB
                                     1D91  5525 
                                     1D91  5526 ;+
                                     1D91  5527 ; Functional Description:
                                     1D91  5528 ;
                                     1D91  5529 ; At the SEQ_STALL entry point, a TMSCP sequential command has been received
                                     1D91  5530 ; and must be synchronized with the other sequential commands for this unit
                                     1D91  5531 ; before it can be processed.  This routine increments the queued request
                                     1D91  5532 ; count and sets the sequential command processing flag (UQB$V_SEQ).
                                     1D91  5533 ;
                                     1D91  5534 ; The UNBLOCK entry point, releases the next TMSCP sequential command for
                                     1D91  5535 ; processing.  This routine decrements the queued request count and clears
                                     1D91  5536 ; the sequential command processing flag (UQB$V_SEQ) when all the commands
                                     1D91  5537 ; have completed.
                                     1D91  5538 ;
                                     1D91  5539 ; Inputs:
                                     1D91  5540 ;
                                     1D91  5541 ;	R3  =  HRB address
                                     1D91  5542 ;	R4  =  UQB address
                                     1D91  5543 ;
                                     1D91  5544 ; Outputs:
                                     1D91  5545 ;
                                     1D91  5546 ;	R3  =  HRB address
                                     1D91  5547 ;	R4  =  UQB address
                                     1D91  5548 ;	SEQ_STALL returns to caller's caller.
                                     1D91  5549 ;
                                     1D91  5550 ; Restored thread outputs:
                                     1D91  5551 ;
                                     1D91  5552 ;	R0  =  Scratch
                                     1D91  5553 ;	R1  =  Scratch
                                     1D91  5554 ;	R2  =  Scratch
                                     1D91  5555 ;	R3  =  HRB address
                                     1D91  5556 ;	R4  =  UQB address, scratch
                                     1D91  5557 ;	R5  =  Scratch
                                     1D91  5558 ;-
                                     1D91  5559 
                                     1D91  5560 TMSCP$SEQ_STALL::
                                     1D91  5561 	.IF DEFINED DEBUG$PC_HISTORY
                                     1D91  5562 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1D91  5563 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1D91  5564 	.IF DEFINED DEBUG$CURRENT_SANITY
                                     1D91  5565 	BSBW	TMSCP$CHECK_CURRENT	; Sanity check the current counters
                                     1D91  5566 	.ENDC	   ;DEBUG$CURRENT_SANITY
                                     1D91  5567 
                                     1D91  5568 ;
                                     1D91  5569 ;		Mark this request as a sequential command and prepare it
                                     1D91  5570 ;		for delayed processing.
                                     1D91  5571 ;
                                     1D91  5572 
                    16 A3   20   A8  1D91  5573 	BISW	# HRB$M_UNBLOCK, -	; This command must call TMSCP$UNBLOCK
                                     1D95  5574 		HRB$W_FLAGS(R3)		; upon command completion.
                            02   B0  1D95  5575 	MOVW	#HRB$K_ST_SEQ_WAIT,-	; We are now ready for transfer and
                         14 A3       1D97  5576 		HRB$W_STATE(R3)		;  only stalled be sequentiality.
                         0C A3 8ED0  1D99  5577 	POPL	HRB$L_RESPC(R3)		; Save the resume address
                                     1D9D  5578 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 121
X-2A6A1                         - SEQ_STALL - Synchronize Sequential Com 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (44)

                                     1D9D  5579 ;
                                     1D9D  5580 ;		Place this command in the BLOCKED queue and leave it there
                                     1D9D  5581 ;		until all prior sequential commands have completed.
                                     1D9D  5582 ;
                                     1D9D  5583 
                         28 A4   B6  1D9D  5584 	INCW	UQB$W_NUM_QUE(R4)	; Bump number of packets queued to unit
                         28 A4   B1  1DA0  5585 	CMPW	UQB$W_NUM_QUE(R4),-	; If this number is not a new high
                         2A A4       1DA3  5586 		UQB$W_MAX_QUE(R4)	;  for this unit,
                            05   1B  1DA5  5587 	BLEQU	10$			;  then continue processing
                         28 A4   B0  1DA7  5588 	MOVW	UQB$W_NUM_QUE(R4),-	; If it is a new max, save the new high
                         2A A4       1DAA  5589 		UQB$W_MAX_QUE(R4)	;  for the show MSCP command
                                     1DAC  5590 
                                     1DAC  5591 10$:
                 30 B4   4C A3   0E  1DAC  5592 	INSQUE	HRB$L_WAIT_FL(R3), -	; Insert this packet on the 
                                     1DB1  5593 		@UQB$L_BLOCKED_BL(R4)	;  blocked queue for execution later
                                     1DB1  5594 
                                     1DB1  5595 ;
                                     1DB1  5596 ;		Start the first sequential command.
                                     1DB1  5597 ;
                                     1DB1  5598 
                 35 0E A4   00   E2  1DB1  5599 	BBSS	# UQB$V_SEQ, -		; Flag sequential command processing and
                                     1DB6  5600 		UQB$W_FLAGS(R4), 130$	; delay this thread if not first - branch.
                                     1DB6  5601 
                                     1DB6  5602 ;
                                     1DB6  5603 ;		Resume execution of the next command on the BLOCKED queue.
                                     1DB6  5604 ;
                                     1DB6  5605 
                                     1DB6  5606 TMSCP$UNBLOCK::
                                     1DB6  5607 	.IF DEFINED DEBUG$PC_HISTORY
                                     1DB6  5608 	BSBW	TMSCP$PCHIST		; Save this PC if we are keeping track
                                     1DB6  5609 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1DB6  5610 	.IF DEFINED DEBUG$CURRENT_SANITY
                                     1DB6  5611 	BSBW	TMSCP$CHECK_CURRENT	; Sanity check the current counters
                                     1DB6  5612 	.ENDC	   ;DEBUG$CURRENT_SANITY
                            54   D5  1DB6  5613 	TSTL	R4			; Make sure we have a valid address
                            31   13  1DB8  5614 	BEQL	130$			;  if not, just return
                                     1DBA  5615 
                                     1DBA  5616 ;
                                     1DBA  5617 ; Check to see if there are any requests on the blocked queue. If the queue
                                     1DBA  5618 ; is populated, remove the next request off the queue
                                     1DBA  5619 ;
                                     1DBA  5620 
                            3F   BB  1DBA  5621 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>	; Save any registers used
                    53   2C B4   0F  1DBC  5622 	REMQUE	@UQB$L_BLOCKED_FL(R4),R3; Dequeue first request
                            2A   1D  1DC0  5623 	BVS	140$			; If the queue was empty, kill this 
                                     1DC2  5624 					;  request.
              53   0000004C 8F   C2  1DC2  5625 	SUBL	#HRB$L_WAIT_FL,R3	; Point to the start of the HRB
                         4C A3   D4  1DC9  5626 	CLRL	HRB$L_WAIT_FL(R3)	; Clear the queue link.
                                     1DCC  5627 ;
                                     1DCC  5628 ; If the sequential command is waiting to be started, we can do that now and
                                     1DCC  5629 ; update the queue count.
                                     1DCC  5630 ;
                            02   B1  1DCC  5631 	CMPW	#HRB$K_ST_SEQ_WAIT,-	; Is this sequential command ready
                         14 A3       1DCE  5632 		HRB$W_STATE(R3)		;  for transfer?
                            0B   13  1DD0  5633 	BEQL	20$			; ready for transfer, continue
                                     1DD2  5634 ;
                                     1DD2  5635 ; If it is not a sequential command, bail out
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 122
X-2A6A1                         - SEQ_STALL - Synchronize Sequential Com 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (44)

                                     1DD2  5636 ; The sequential command cannot be stopped at this point.
                                     1DD2  5637 ;
               14 A3   8002 8F   B1  1DD2  5638 	CMPW	#<HRB$K_ST_SEQ_WAIT! -	   ; Sequential command in progress?
                                     1DD8  5639 		  HRB$M_STATE_INVALID>, -
                                     1DD8  5640 		HRB$W_STATE(R3)		   
                            0C   13  1DD8  5641 	BEQL	25$                       ; Yes, continue processing.
                          001C   31  1DDA  5642 	BRW	150$			  ;  No, bail out
                                     1DDD  5643 20$:
                                     1DDD  5644 
                         28 A4   B7  1DDD  5645 	DECW	UQB$W_NUM_QUE(R4)	; Decrement queue counter.
                       8000 8F   A8  1DE0  5646 	BISW	#HRB$M_STATE_INVALID,-	; Set the state to invalid
                         14 A3       1DE4  5647 		HRB$W_STATE(R3)		;
                                     1DE6  5648 25$:
                                     1DE6  5649 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1DE6  5650 	PUSHAB	115$			; Set the return address.
                                     1DE6  5651 	PUSHL	HRB$L_RESPC(R3)		; Restart the blocked request.
                                     1DE6  5652 	BRW	TMSCP$PCHIST_R3		; Log the PC for debugging.
                                     1DE6  5653 
                                     1DE6  5654 115$:
                                     1DE6  5655 	BSBW	TMSCP$PCHIST		; Log the PC for debugging.
                                     1DE6  5656 	.IFF
                         0C B3   16  1DE6  5657 	JSB	@HRB$L_RESPC(R3)	; Resume where we left off
                                     1DE9  5658 	.ENDC  ;DEBUG$PC_HISTORY
                                     1DE9  5659 
                                     1DE9  5660 120$:
                            3F   BA  1DE9  5661 	POPR	#^M<R0,R1,R2,R3,R4,R5>	; restore
                                     1DEB  5662 130$:
                                 05  1DEB  5663 	RSB
                                     1DEC  5664 
                                     1DEC  5665 140$:
                    0E A4   01   AA  1DEC  5666 	BICW	# UQB$M_SEQ, -		; All sequential processing has completed.
                                     1DF0  5667 		UQB$W_FLAGS(R4)
                         28 A4   B5  1DF0  5668 	TSTW	UQB$W_NUM_QUE(R4)	; Any requests in queue?
                            F4   13  1DF3  5669 	BEQL	120$			; No, kill this thread - branch.
                                     1DF5  5670 	BUG_CHECK MSCPSERV,FATAL	; REMQUE indicates no requests in the queue,
                               FEFF  1DF5       		.WORD	^XFEFF
                               0004' 1DF7       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_MSCPSERV!4
                                     1DF9  5671 					; yet the count is non-zero, this is a bug.
                                     1DF9  5672 
                                     1DF9  5673 150$:
                                     1DF9  5674 	BUG_CHECK MSCPSERV,FATAL	; Only HRBs in the SEQ_WAIT state
                               FEFF  1DF9       		.WORD	^XFEFF
                               0004' 1DFB       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_MSCPSERV!4
                                     1DFD  5675 					; should be in the BLOCKED queue.
                                     1DFD  5676 
                                     1DFD  5677 	.DISABLE LSB
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 123
X-2A6A1                         - CHECK_XFER_STATUS - Translate the clas 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (45)

                                     1DFD  5680 	.SBTTL	-	CHECK_XFER_STATUS - Translate the class driver message to a MSCP message
                                     1DFD  5681 
                                     1DFD  5682 ;+
                                     1DFD  5683 ; Functional Description:
                                     1DFD  5684 ;
                                     1DFD  5685 ; This routine is called to translate the error from a system service 
                                     1DFD  5686 ; error message to the proper MSCP error code to return to the client 
                                     1DFD  5687 ; processor.
                                     1DFD  5688 ;
                                     1DFD  5689 ; Inputs:
                                     1DFD  5690 ;
                                     1DFD  5691 ;	R0  =  system service error code 
                                     1DFD  5692 ;	R1  =  Scratch
                                     1DFD  5693 ;	R2  =  Scratch
                                     1DFD  5694 ;	R3  =  HRB address
                                     1DFD  5695 ;	R4  =  Scratch
                                     1DFD  5696 ;	R5  =  Scratch
                                     1DFD  5697 ;
                                     1DFD  5698 ; Outputs:
                                     1DFD  5699 ;	R0  =  TMSCP error code.
                                     1DFD  5700 ;	R2  =  MSCP packet address.
                                     1DFD  5701 ;	R3  =  HRB address
                                     1DFD  5702 ;	R4  =  UQB address
                                     1DFD  5703 ;
                                     1DFD  5704 ;	R1, R5  Destroyed.
                                     1DFD  5705 ;
                                     1DFD  5706 ;-
                                     1DFD  5707 
                                     1DFD  5708 TMSCP$CHECK_XFER_STATUS::
                                     1DFD  5709 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1DFD  5710 	BSBW	TMSCP$PCHIST_R3R0	; Log the PC for debugging.
                                     1DFD  5711 	.ENDC  ;DEBUG$PC_HISTORY
                    54   58 A3   D0  1DFD  5712 	MOVL	HRB$L_UQB(R3),R4	; Get the UQB address
                  52   1E2C'CF   3E  1E01  5713 	MOVAW	TMSCP$ERR_TBL,R2	; Get the address of the error table
                                     1E06  5714 
                                     1E06  5715 10$:
                       51   82   3C  1E06  5716 	MOVZWL	(R2)+,R1		; Take the VMS error code out
                            0A   13  1E09  5717 	BEQL	20$			; Check for the end of the table
                       50   51   B1  1E0B  5718 	CMPW	R1,R0			; Compare the VMS error with that passed
                            05   13  1E0E  5719 	BEQL	20$			; They matched! do the translation
                       52   04   C0  1E10  5720 	ADDL	#4,R2			; Step to next entry
                            F1   11  1E13  5721 	BRB	10$			;  and start it all over again
                                     1E15  5722 
                                     1E15  5723 20$:
                       50   82   3C  1E15  5724 	MOVZWL	(R2)+,R0		; Pick up the corresponding MSCP error
                       51   62   32  1E18  5725 	CVTWL	(R2),R1			; Get possible routine
                            03   13  1E1B  5726 	BEQL	30$			; None
                                     1E1D  5727 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1E1D  5728 	PUSHAB	25$			; Set the return address.
                                     1E1D  5729 	PUSHAB	(R1)[R2]		; Get the routine to invoke.
                                     1E1D  5730 	BRW	TMSCP$PCHIST		; Log the PC for debugging.
                                     1E1D  5731 
                                     1E1D  5732 25$:
                                     1E1D  5733 	BSBW	TMSCP$PCHIST		; Log the PC for debugging.
                                     1E1D  5734 	.IFF
                          6142   16  1E1D  5735 	JSB	(R1)[R2]		; Invoke the routine
                                     1E20  5736 	.ENDC  ;DEBUG$PC_HISTORY
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 124
X-2A6A1                         - CHECK_XFER_STATUS - Translate the clas 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (45)

                                     1E20  5737 ;
                                     1E20  5738 ; Do some final cleaning up
                                     1E20  5739 ;
                                     1E20  5740 ;		R0  =  TMSCP error code
                                     1E20  5741 ;		R1  =  Scratch
                                     1E20  5742 ;		R2  =  MSCP packet address
                                     1E20  5743 ;		R3  =  HRB address
                                     1E20  5744 ;		R4  =  UQB address
                                     1E20  5745 ;		R5  =  Scratch
                                     1E20  5746 ;
                                     1E20  5747 
                                     1E20  5748 30$:
                    52   18 A3   D0  1E20  5749 	MOVL	HRB$L_MSGBUF(R3),R2	; MSCP packet address from the HRB
                            05   13  1E24  5750 	BEQL	35$
                            8E   D5  1E26  5751 	TSTL	(SP)+			; Return to caller's caller.
                          01B3   31  1E28  5752 	BRW	TMSCP$SEND_END		; Send an end packet with R0 status
                                     1E2B  5753 
                                     1E2B  5754 35$:
                                 05  1E2B  5755 	RSB
                                     1E2C  5756 
                                     1E2C  5757 	.NOSHOW	MEB
                                     1E2C  5758 
                                     1E2C  5759 TMSCP$ERR_TBL::
                                     1E2C  5760 	ACTION	SS$_ABORT,	MSCP$K_ST_ABRTD
                                     1E32  5761 	ACTION	SS$_BUGCHECK,	MSCP$K_ST_ICMD
                                     1E38  5762 	ACTION	SS$_CTRLERR,	MSCP$K_ST_CNTLR,	TMSCP$SET_SEX
                                     1E3E  5763 	ACTION	SS$_DATACHECK,	MSCP$K_ST_COMP,		TMSCP$SET_SEX
                                     1E44  5764 	ACTION	SS$_DATALATE,	<MSCP$K_SC_DLATE@MSCP$V_ST_SBCOD!MSCP$K_ST_CNTLR>
                                     1E4A  5765 	ACTION	SS$_DATALOST,	MSCP$K_ST_DATA,		TMSCP$ERR_DLS
                                     1E50  5766 	ACTION	SS$_DATAOVERUN,	MSCP$K_ST_RDTRN,	TMSCP$SET_SEX
                                     1E56  5767 	ACTION	SS$_DEVOFFLINE,	MSCP$K_ST_OFFLN,	TMSCP$ERR_OFFLINE
                                     1E5C  5768 	ACTION	SS$_DRVERR,	MSCP$K_ST_DRIVE,	TMSCP$SET_SEX
                                     1E62  5769 	ACTION	SS$_DUPUNIT,	<MSCP$K_SC_DUPUN@MSCP$V_ST_SBCOD!MSCP$K_ST_OFFLN>
                                     1E68  5770 	ACTION	SS$_ENDOFFILE,	MSCP$K_ST_TAPEM,	TMSCP$ERR_EOF
                                     1E6E  5771 	ACTION	SS$_ENDOFTAPE,	MSCP$K_ST_SUCC,		TMSCP$ERR_EOT
                                     1E74  5772 	ACTION	SS$_ENDOFVOLUME,MSCP$K_ST_LED,		TMSCP$ERR_LEOT
                                     1E7A  5773 	ACTION	SS$_FORMAT,	MSCP$K_ST_MFMTE
                                     1E80  5774 	ACTION	SS$_ILLIOFUNC,	MSCP$K_ST_ICMD,		TMSCP$SET_SEX
                                     1E86  5775 	ACTION	SS$_IVBUFLEN,	MSCP$K_ST_HSTBF,	TMSCP$SET_SEX
                                     1E8C  5776 	ACTION	SS$_MEDOFL,	MSCP$K_ST_OFFLN,	TMSCP$ERR_OFFLINE
                                     1E92  5777 	ACTION	SS$_OPINCOMPL,	MSCP$K_ST_DATA
                                     1E98  5778 	ACTION	SS$_PARITY,	<MSCP$K_SC_LGE@MSCP$V_ST_SBCOD!MSCP$K_ST_DATA>
                                     1E9E  5779 	ACTION	SS$_SERIOUSEXCP,MSCP$K_ST_PRESE
                                     1EA4  5780 	ACTION	SS$_TAPEPOSLOST	MSCP$K_ST_PLOST,	TMSCP$ERR_PLOST
                                     1EAA  5781 	ACTION	SS$_TIMEOUT,	<MSCP$K_SC_UNKNO@MSCP$V_ST_SBCOD!MSCP$K_ST_OFFLN>,TMSCP$ERR_OFFLINE
                                     1EB0  5782 	ACTION	SS$_VOLINV,	MSCP$K_ST_OFFLN,	TMSCP$ERR_OFFLINE
                                     1EB6  5783 	ACTION	SS$_WRITLCK,	MSCP$K_ST_WRTPR,	TMSCP$ERR_WRITLCK
                                     1EBC  5784 	ACTION	0,MSCP$K_ST_DRIVE	; PATCH SPACE
                                     1EC2  5785 	ACTION	0,MSCP$K_ST_DRIVE	; End of table - default error
                                     1EC8  5786 
                                     1EC8  5787 	.SHOW	MEB
                                     1EC8  5788 
                                     1EC8  5789 ;
                                     1EC8  5790 ;		R0  =  TMSCP error code
                                     1EC8  5791 ;		R1  =  Scratch
                                     1EC8  5792 ;		R2  =  Scratch
                                     1EC8  5793 ;		R3  =  HRB address
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 125
X-2A6A1                         - CHECK_XFER_STATUS - Translate the clas 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (45)

                                     1EC8  5794 ;		R4  =  UQB address
                                     1EC8  5795 ;		R5  =  Scratch
                                     1EC8  5796 ;
                                     1EC8  5797 
                                     1EC8  5798 TMSCP$ERR_OFFLINE::
                    55   24 A4   D0  1EC8  5799 	MOVL	UQB$L_UCB(R4),R5	;  and follow that to the UCB address
                         70 A4   D5  1ECC  5800 	TSTL	UQB$L_ONLINE_HQB(R4)
                            07   13  1ECF  5801 	BEQL	60$			;
                         70 A4   D4  1ED1  5802 	CLRL	UQB$L_ONLINE_HQB(R4)
                                     1ED4  5803 
                                     1ED4  5804 40$:
                       00C2 C5   97  1ED4  5805 	DECB	UCB$B_ONLCNT(R5)	;  and note the change in online count
                                     1ED8  5806 
                                     1ED8  5807 ;
                                     1ED8  5808 ; All the bits for this unit have been cleared. Now the status of this 
                                     1ED8  5809 ; device is changed in the UQB to "offline". This status may be changed
                                     1ED8  5810 ; to "available" by the GUS command, and then eventually to "online" 
                                     1ED8  5811 ; after the successful completion of an online command.
                                     1ED8  5812 ;
                                     1ED8  5813 
                                     1ED8  5814 60$:
                            03   B0  1ED8  5815 	MOVW	#UQB$K_ST_OFFLINE,-	; Now set the state of this device to
                         0C A4       1EDA  5816 		UQB$W_STATE(R4)		;   reflect the sum of individual states
                                 05  1EDC  5817 	RSB				;  and return with the device offline
                                     1EDD  5818 
                                     1EDD  5819 
                                     1EDD  5820 ;
                                     1EDD  5821 ;		R0  =  TMSCP error code
                                     1EDD  5822 ;		R1  =  Scratch
                                     1EDD  5823 ;		R2  =  Scratch
                                     1EDD  5824 ;		R3  =  HRB address
                                     1EDD  5825 ;		R4  =  UQB address
                                     1EDD  5826 ;		R5  =  Scratch
                                     1EDD  5827 ;
                                     1EDD  5828 
                                     1EDD  5829 TMSCP$ERR_WRITLCK::
                            0D   E2  1EDD  5830 	BBSS	#MSCP$V_UF_WRTPH,-	; Set the write protect bit in
                      07 16 A4       1EDF  5831 		UQB$W_UNIT_FLAGS(R4),10$;  the unit flag field
                       0040 8F   A8  1EE2  5832 	BISW	#UQB$M_ST_WRTPH,-
                       00C8 C4       1EE6  5833 		UQB$W_ST_FLAGS(R4)
                                     1EE9  5834 
                                     1EE9  5835 10$:
                                 05  1EE9  5836 	RSB
                                     1EEA  5837 
                                     1EEA  5838 ;
                                     1EEA  5839 ;	End of tape encountered
                                     1EEA  5840 ;
                                     1EEA  5841 ;		R0  =  TMSCP error code
                                     1EEA  5842 ;		R1  =  Scratch
                                     1EEA  5843 ;		R2  =  Scratch
                                     1EEA  5844 ;		R3  =  HRB address
                                     1EEA  5845 ;		R4  =  UQB address
                                     1EEA  5846 ;		R5  =  Scratch
                                     1EEA  5847 ;
                                     1EEA  5848 
                                     1EEA  5849 TMSCP$ERR_EOT::
                            02   E2  1EEA  5850 	BBSS	#UQB$V_ST_EOT,-		; Reflect it in the UQB
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 126
X-2A6A1                         - CHECK_XFER_STATUS - Translate the clas 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (45)

                    0D 00C8 C4       1EEC  5851 		UQB$W_ST_FLAGS(R4),5$	;	
                          0053   30  1EF0  5852 	BSBW	TMSCP$SET_SEX
                    52   18 A3   D0  1EF3  5853 	MOVL	HRB$L_MSGBUF(R3), R2	; No end packet means it is a
                            04   13  1EF7  5854 	BEQL	5$			;  caching type command
                            08   A8  1EF9  5855 	BISW	#MSCP$M_EF_EOT,-	; Set end of tape flag in MSCP
                         09 A2       1EFB  5856 		MSCP$B_FLAGS(R2)	;   packet
                                     1EFD  5857 
                                     1EFD  5858 5$:
                            53   11  1EFD  5859 	BRB	TMSCP$RECOVERABLE_ERROR
                                     1EFF  5860 
                                     1EFF  5861 ;
                                     1EFF  5862 ;	Position of tape lost
                                     1EFF  5863 ;
                                     1EFF  5864 ;		R0  =  TMSCP error code
                                     1EFF  5865 ;		R1  =  Scratch
                                     1EFF  5866 ;		R2  =  Scratch
                                     1EFF  5867 ;		R3  =  HRB address
                                     1EFF  5868 ;		R4  =  UQB address
                                     1EFF  5869 ;		R5  =  Scratch
                                     1EFF  5870 ;
                                     1EFF  5871 
                                     1EFF  5872 TMSCP$ERR_PLOST::
                    52   18 A3   D0  1EFF  5873 	MOVL	HRB$L_MSGBUF(R3), R2	; No end packet means it is a
                            04   13  1F03  5874 	BEQL	5$			;  caching type command
                            04   88  1F05  5875 	BISB	#MSCP$M_EF_PLS,-	; Set end of tape flag in MSCP
                         09 A2       1F07  5876 		MSCP$B_FLAGS(R2)	;   packet
                                     1F09  5877 
                                     1F09  5878 5$:
                            04   E2  1F09  5879 	BBSS	#UQB$V_ST_PLS,-		; Reflect it in the UQB
                    01 00C8 C4       1F0B  5880 		UQB$W_ST_FLAGS(R4),10$	;
                                 05  1F0F  5881 	RSB
                                     1F10  5882 
                                     1F10  5883 10$:
                          0033   30  1F10  5884 	BSBW	TMSCP$SET_SEX
                            3D   11  1F13  5885 	BRB	TMSCP$RECOVERABLE_ERROR
                                     1F15  5886 
                                     1F15  5887 ;
                                     1F15  5888 ;	Logical end of tape encountered
                                     1F15  5889 ;
                                     1F15  5890 ;		R0  =  TMSCP error code
                                     1F15  5891 ;		R1  =  Scratch
                                     1F15  5892 ;		R2  =  Scratch
                                     1F15  5893 ;		R3  =  HRB address
                                     1F15  5894 ;		R4  =  UQB address
                                     1F15  5895 ;		R5  =  Scratch
                                     1F15  5896 ;
                                     1F15  5897 
                                     1F15  5898 TMSCP$ERR_LEOT::
                            08   A8  1F15  5899 	BISW	#UQB$M_ST_LEOT,-	; Reflect it in the UQB
                       00C8 C4       1F17  5900 		UQB$W_ST_FLAGS(R4)
                          0029   30  1F1A  5901 	BSBW	TMSCP$SET_SEX
                            33   11  1F1D  5902 	BRB	TMSCP$RECOVERABLE_ERROR
                                     1F1F  5903 
                                     1F1F  5904 ;
                                     1F1F  5905 ;	Cached data lost
                                     1F1F  5906 ;
                                     1F1F  5907 ;		R0  =  TMSCP error code
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 127
X-2A6A1                         - CHECK_XFER_STATUS - Translate the clas 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (45)

                                     1F1F  5908 ;		R1  =  Scratch
                                     1F1F  5909 ;		R2  =  Scratch
                                     1F1F  5910 ;		R3  =  HRB address
                                     1F1F  5911 ;		R4  =  UQB address
                                     1F1F  5912 ;		R5  =  Scratch
                                     1F1F  5913 ;
                                     1F1F  5914 		
                                     1F1F  5915 TMSCP$ERR_DLS::
                    52   18 A3   D0  1F1F  5916 	MOVL	HRB$L_MSGBUF(R3), R2	; No end packet means it is a
                            04   13  1F23  5917 	BEQL	5$			;  caching type command
                            02   88  1F25  5918 	BISB	#MSCP$M_EF_DLS,-	; Set end of tape flag in MSCP
                         09 A2       1F27  5919 		MSCP$B_FLAGS(R2)	;   packet
                                     1F29  5920 
                                     1F29  5921 5$:
                            02   A8  1F29  5922 	BISW	#UQB$M_ST_DLS,-		; Reflect it in the UQB
                       00C8 C4       1F2B  5923 		UQB$W_ST_FLAGS(R4)	
                            16   11  1F2E  5924 	BRB	TMSCP$SET_SEX
                                     1F30  5925 
                                     1F30  5926 ;
                                     1F30  5927 ;	A Serious Exception condition was encountered...set the serious
                                     1F30  5928 ;	exception state flag in the end packet.
                                     1F30  5929 ;
                                     1F30  5930 
                                     1F30  5931 ;
                                     1F30  5932 ; End of file can not only mean we encountered a tape mark in the
                                     1F30  5933 ; forward direction, but that we hit on in reverse, and possibly
                                     1F30  5934 ; at BOT.
                                     1F30  5935 ;
                                     1F30  5936 ;		R0  =  TMSCP error code
                                     1F30  5937 ;		R1  =  Scratch
                                     1F30  5938 ;		R2  =  Scratch
                                     1F30  5939 ;		R3  =  HRB address
                                     1F30  5940 ;		R4  =  UQB address
                                     1F30  5941 ;		R5  =  Scratch
                                     1F30  5942 ;
                                     1F30  5943 
                                     1F30  5944 TMSCP$ERR_EOF::
                          0013   30  1F30  5945 	BSBW	TMSCP$SET_SEX
                    55   24 A4   D0  1F33  5946 	MOVL	UQB$L_UCB(R4),R5	; Restore UCB
                            10   E1  1F37  5947 	BBC	#MT$V_BOT,-		; Are we at BOT?
                      09 50 A5       1F39  5948 		UCB$L_DEVDEPEND(R5),10$	;
                       50   0D   3C  1F3C  5949 	MOVZWL	#MSCP$K_ST_BOT,R0	; Then return MSCP status as such
                            02   E5  1F3F  5950 	BBCC	#UQB$V_ST_EOT,-		;
                    00 00C8 C4       1F41  5951 		UQB$W_ST_FLAGS(R4),10$	;
                                     1F45  5952 
                                     1F45  5953 10$:
                                 05  1F45  5954 	RSB
                                     1F46  5955 	
                                     1F46  5956 ;
                                     1F46  5957 ;		R0  =  TMSCP error code
                                     1F46  5958 ;		R1  =  Scratch
                                     1F46  5959 ;		R2  =  Scratch
                                     1F46  5960 ;		R3  =  HRB address
                                     1F46  5961 ;		R4  =  UQB address
                                     1F46  5962 ;		R5  =  Scratch
                                     1F46  5963 ;
                                     1F46  5964 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 128
X-2A6A1                         - CHECK_XFER_STATUS - Translate the clas 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (45)

                                     1F46  5965 TMSCP$SET_SEX::
                            20   A8  1F46  5966 	BISW	#UQB$M_ST_SEREX,-	; Reflect it in the UQB
                       00C8 C4       1F48  5967 		UQB$W_ST_FLAGS(R4)
                                     1F4B  5968 ;	BBC	#UQB$V_FLUSH,-		; If the cache is being flushed and
                                     1F4B  5969 ;		UQB$W_FLAGS(R4),10$	;  we have gotten a serious error,
                                     1F4B  5970 ;	BISW	#UQB$M_ST_DLS,-		;  set the cached data lost bit
                                     1F4B  5971 ;		UQB$W_ST_FLAGS(R4)	;  in the UQB
                                     1F4B  5972 
                                     1F4B  5973 10$:
                                 05  1F4B  5974 	RSB
                                     1F4C  5975 
                                     1F4C  5976 TMSCP$ANCILLARY_TABLE::
                                 12  1F4C  5977 	.BYTE	MSCP$K_OP_ERASE
                                 16  1F4D  5978 	.BYTE	MSCP$K_OP_ERGAP
                                 21  1F4E  5979 	.BYTE	MSCP$K_OP_READ
                                 25  1F4F  5980 	.BYTE	MSCP$K_OP_REPOS
                                 22  1F50  5981 	.BYTE	MSCP$K_OP_WRITE
                                 24  1F51  5982 	.BYTE	MSCP$K_OP_WRITM
                           00000006  1F52  5983 TMSCP$ANCILLARY_TABLE_LEN	=	. - TMSCP$ANCILLARY_TABLE
                                     1F52  5984 
                                     1F52  5985 ;
                                     1F52  5986 ;		R0  =  TMSCP error code
                                     1F52  5987 ;		R1  =  Scratch
                                     1F52  5988 ;		R2  =  Scratch
                                     1F52  5989 ;		R3  =  HRB address
                                     1F52  5990 ;		R4  =  UQB address
                                     1F52  5991 ;		R5  =  Scratch
                                     1F52  5992 ;
                                     1F52  5993 
                                     1F52  5994 TMSCP$RECOVERABLE_ERROR::
                    52   18 A3   D0  1F52  5995 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore MSCP packet address
                            0F   13  1F56  5996 	BEQL	10$			; Immediate command - branch.
                    51   08 A2   9A  1F58  5997 	MOVZBL	MSCP$B_OPCODE(R2),R1	; Restore opcode
                            03   BB  1F5C  5998 	PUSHR	#^M<R0,R1>		; Save registers destroyed by LOCC
                       06   51   3A  1F5E  5999 	LOCC	R1,#TMSCP$ANCILLARY_TABLE_LEN,-; Is this a "move" command?
                         E9 AF       1F61  6000 		TMSCP$ANCILLARY_TABLE
                            03   BA  1F63  6001 	POPR	#^M<R0,R1>
                            03   13  1F65  6002 	BEQL	20$			; EQL <= not a "move" command
                                     1F67  6003 
                                     1F67  6004 10$:
                            51 8ED0  1F67  6005 	POPL	R1			; Remove caller's address and
                                     1F6A  6006 					;   return to caller of CHECK_XFER_STATUS.
                                     1F6A  6007 
                                     1F6A  6008 20$:
                                 05  1F6A  6009 	RSB
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 129
X-2A6A1                         - FIND UQB - Find the UQB corresponding  27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (46)

                                     1F6B  6012 	.SBTTL	-	FIND UQB - Find the UQB corresponding to this request
                                     1F6B  6013 
                                     1F6B  6014 ;+
                                     1F6B  6015 ; Functional Description:
                                     1F6B  6016 ;
                                     1F6B  6017 ; This routine is called when a MSCP command packet is being processed that
                                     1F6B  6018 ; references a specific unit. This routine searches the list of units known to
                                     1F6B  6019 ; the server and returns the UQB with the unit number corresponding to the one
                                     1F6B  6020 ; specified in the MSCP packet. If the proper UQB cannot be found we die trying.
                                     1F6B  6021 ; An illegal command end packet is returned to the host and the request is
                                     1F6B  6022 ; finished off. Control is not passed back to the caller unless we are 
                                     1F6B  6023 ; successful.
                                     1F6B  6024 ; 
                                     1F6B  6025 ; Inputs:
                                     1F6B  6026 ;
                                     1F6B  6027 ;	R2  =  MSCP packet address
                                     1F6B  6028 ;	R3  =  HRB address 
                                     1F6B  6029 ;
                                     1F6B  6030 ; Outputs:
                                     1F6B  6031 ;
                                     1F6B  6032 ;	R0  =  returned status
                                     1F6B  6033 ;		0 => UQB for the unit was not found
                                     1F6B  6034 ; 		SS$_NORMAL => the UQB was located
                                     1F6B  6035 ;	R2  =  MSCP packet address
                                     1F6B  6036 ;	R3  =  HRB address  (the UQB address is placed in the proper offset)
                                     1F6B  6037 ;
                                     1F6B  6038 ; All registers used in this subroutine are returned to their original state
                                     1F6B  6039 ; on return to the caller.
                                     1F6B  6040 ;-
                                     1F6B  6041 
                                     1F6B  6042 	.ENABLE	LOCAL_BLOCK
                                     1F6B  6043 
                                     1F6B  6044 TMSCP$FIND_UQB::
                            32   BB  1F6B  6045 	PUSHR	#^M<R1,R4,R5>		; Save any registers we plan on using
                    55   54 A3   D0  1F6D  6046 	MOVL	HRB$L_HQB(R3),R5	; Get the address of the HQB 
                            01   E1  1F71  6047 	BBC	#HQB$V_V5CL,-		; If this is a request from the old
                      53 12 A5       1F73  6048 		HQB$W_FLAGS(R5),100$	;  class driver, use the old code
                                     1F76  6049 
                                     1F76  6050 ;
                                     1F76  6051 ; The request just received was sent from a client system running a version
                                     1F76  6052 ; of the tape class driver that is V5.0 or later. This means that the unit 
                                     1F76  6053 ; number is of the new format. Bit 14 of the unit number, which indicates the
                                     1F76  6054 ; unit number is a Server Local Unit Number (SLUN) is cleared, and the unit 
                                     1F76  6055 ; number becomes the index into the unit table where the address of the UQB
                                     1F76  6056 ; for this unit can be found.
                                     1F76  6057 ;                                                                   
                    55   32 A5   D0  1F76  6058 	MOVL	HQB$L_TSRV(R5),R5	; Get the server structure address
                       7FFF 8F   B1  1F7A  6059 	CMPW	#MSCP$K_SLUN_RSVP,-	; Is this the magic SLUN unit number
                         04 A2       1F7E  6060 		MSCP$W_UNIT(R2)		;  that requests a search is needed?
                            1E   13  1F80  6061  	BEQL	20$			; Branch if yes and search for UQB
                                     1F82  6062 
                                     1F82  6063 10$:
                    50   04 A2   3C  1F82  6064 	MOVZWL	MSCP$W_UNIT(R2),R0	; Put the unit number in a register
                    12 50   0E   E5  1F86  6065 	BBCC	#MSCP$V_SLUN,R0,15$	; Check SLUN bit and clear index
                  50   0100 8F   B1  1F8A  6066 	CMPW	#MAX_UNITS,R0		; Past end of table?
                            08   1B  1F8F  6067 	BLEQU	13$			; Unit out of range - branch.
                54   00C4 C540   D0  1F91  6068 	MOVL	TSRV$L_UNITS(R5)[R0],R4	; Find the UQB address in the table
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 130
X-2A6A1                         - FIND UQB - Find the UQB corresponding  27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (46)

                            34   12  1F97  6069 	BNEQ	120$			; Continue if there is one
                                     1F99  6070 
                                     1F99  6071 13$:
                          003E   31  1F99  6072 	BRW	TMSCP$BAD_UNIT		; Else indicate no such unit
                                     1F9C  6073 
                                     1F9C  6074 15$:
                                     1F9C  6075 	BUG_CHECK MSCPSERV, FATAL	; No SLUN bit set from V5+ class driver
                               FEFF  1F9C       		.WORD	^XFEFF
                               0004' 1F9E       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_MSCPSERV!4
                                     1FA0  6076 
                                     1FA0  6077 ;
                                     1FA0  6078 ; The magic unit number means that this is the first get unit status command 
                                     1FA0  6079 ; received from a v5.0 class driver after a new connection has formed. The
                                     1FA0  6080 ; class driver is asking for the server local unit number that corresponds 
                                     1FA0  6081 ; to the unit with the unit identifier that is passed in the two longwords 
                                     1FA0  6082 ; beyond the end of the "normal" get unit status command. The server searches
                                     1FA0  6083 ; the list of known units for a match of the unit identifier, and returns the
                                     1FA0  6084 ; server local unit number as the unit number in the MSCP end message.
                                     1FA0  6085 ;                                                                
                                     1FA0  6086 
                                     1FA0  6087 20$:
                  51   00C4 C5   DE  1FA0  6088  	MOVAL	TSRV$L_UNITS(R5),R1	;  determine the start of the unit table
              50   00000100 8F   D0  1FA5  6089 	MOVL	#MAX_UNITS,R0		; Number of elements in the unit table
                                     1FAC  6090 
                                     1FAC  6091 30$:
                       54   81   D0  1FAC  6092 	MOVL	(R1)+,R4		; Get the address of the next table entry
                            0C   13  1FAF  6093 	BEQL	35$			;  skip it if zero
                            0F   BB  1FB1  6094 	PUSHR	#^M<R0,R1,R2,R3>	; Save the registers
                    14 A2   08   29  1FB3  6095 	CMPC3	#8,MSCP$Q_UNIT_ID(R2),-	;  and compare the unit-id passed 
                         18 A4       1FB7  6096 		UQB$Q_UNIT_ID(R4)	;  to the id in the UQB
                            0F   BA  1FB9  6097 	POPR	#^M<R0,R1,R2,R3>	;  and restore them back
                            05   13  1FBB  6098 	BEQL	40$			; If it is a match exit the loop
                                     1FBD  6099 
                                     1FBD  6100 35$:
                         EC 50   F5  1FBD  6101 	SOBGTR	R0,30$			; Otherwise search to the end of table
                            18   11  1FC0  6102 	BRB	TMSCP$BAD_UNIT		; If still not found return an error
                                     1FC2  6103 
                                     1FC2  6104 40$:
                         5E A4   B0  1FC2  6105 	MOVW	UQB$W_SLUN(R4),-	; Return the local unit number in the
                         04 A2       1FC5  6106 		MSCP$W_UNIT(R2)		;  end message to the client
                            B9   11  1FC7  6107 	BRB	10$			; Return to the main path
                                     1FC9  6108 
                                     1FC9  6109 ;
                                     1FC9  6110 ; This request was received from a pre-V5.0 class driver. Since ONLY V5 
                                     1FC9  6111 ; connections are established, this is a BUG!
                                     1FC9  6112 ;
                                     1FC9  6113 
                                     1FC9  6114 100$:
                                     1FC9  6115 	BUG_CHECK MSCPSERV, FATAL	; Wrong class driver 
                               FEFF  1FC9       		.WORD	^XFEFF
                               0004' 1FCB       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_MSCPSERV!4
                                     1FCD  6116 
                                     1FCD  6117 ;
                                     1FCD  6118 ; The proper UQB for this request was found. Place its address in the Host
                                     1FCD  6119 ; Request Block and return to the caller.
                                     1FCD  6120 ;
                                     1FCD  6121 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 131
X-2A6A1                         - FIND UQB - Find the UQB corresponding  27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (46)

                                     1FCD  6122 120$:
                    58 A3   54   D0  1FCD  6123 	MOVL	R4,HRB$L_UQB(R3)	; Otherwise save the UQB address
                         12 A4   B6  1FD1  6124 	INCW	UQB$W_CURRENT(R4)	; One more active request on this unit
                                     1FD4  6125 	.IF DEFINED DEBUG$CURRENT_SANITY
                                     1FD4  6126 	BSBW	TMSCP$CHECK_CURRENT	; Sanity check the current counters
                                     1FD4  6127 	.ENDC	   ;DEBUG$CURRENT_SANITY
                       50   01   D0  1FD4  6128 	MOVL	#SS$_NORMAL,R0		; Set a normal return status
                                     1FD7  6129 
                                     1FD7  6130 130$:
                            32   BA  1FD7  6131 	POPR	#^M<R1,R4,R5>		; Restore the registers we used
                                 05  1FD9  6132 	RSB				;  and return to the caller
                                     1FDA  6133 
                                     1FDA  6134 TMSCP$BAD_UNIT::
                            50   D4  1FDA  6135 	CLRL	R0			; Return an unsuccessful status
                            F9   11  1FDC  6136 	BRB	130$			; Restore registers and return.
                                     1FDE  6137 
                                     1FDE  6138 	.DISABLE	LOCAL_BLOCK
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 132
X-2A6A1                         - SEND END - Respond To The Request      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (47)

                                     1FDE  6141 	.SBTTL	-	SEND END - Respond To The Request
                                     1FDE  6142 
                                     1FDE  6143 ;+
                                     1FDE  6144 ; Functional Description:
                                     1FDE  6145 ;
                                     1FDE  6146 ; This routine is called (with several entry points) to respond to the 
                                     1FDE  6147 ; MSCP message packet received. It reuses the MSCP packet received to
                                     1FDE  6148 ; send a MSCP end message response.
                                     1FDE  6149 ;
                                     1FDE  6150 ; Inputs:
                                     1FDE  6151 ;
                                     1FDE  6152 ;	R0  =  status to be returned
                                     1FDE  6153 ;	R2  =  MSCP packet address
                                     1FDE  6154 ;	R3  =  HRB address 
                                     1FDE  6155 ;
                                     1FDE  6156 ; Outputs:
                                     1FDE  6157 ;
                                     1FDE  6158 ;	R3  =  HRB address
                                     1FDE  6159 ;	R4  =  altered
                                     1FDE  6160 ;	R5  =  CDRP address
                                     1FDE  6161 ;-
                                     1FDE  6162 
                                     1FDE  6163 ;
                                     1FDE  6164 ; Entry here, means that the message buffer is to be returned with status.
                                     1FDE  6165 ; 
                                     1FDE  6166 
                                     1FDE  6167 TMSCP$SEND_END::
                                     1FDE  6168 	.IF DEFINED DEBUG$PC_HISTORY
                                     1FDE  6169 	PUSHL	R0			; Save the MSCP command status.
                                     1FDE  6170 	MOVL	MSCP$L_CMD_REF(R2), R0	; Save the command reference number.
                                     1FDE  6171 	BSBW	TMSCP$PCHIST_R3R0	; Save this PC if we are keeping track
                                     1FDE  6172 	POPL	R0			; Get the MSCP command status.
                                     1FDE  6173 	BSBW	TMSCP$R0HIST		; Save this value.
                                     1FDE  6174 	.ENDC	   ;DEBUG$PC_HISTORY
                    0A A2   50   B0  1FDE  6175 	MOVW	R0,MSCP$W_STATUS(R2)	; Set the status
                    54   58 A3   D0  1FE2  6176 	MOVL	HRB$L_UQB(R3),R4	; Restore UQB
                            28   13  1FE6  6177 	BEQL	40$			; No UQB for TMSCP$VC_ERR routine
                            05   E1  1FE8  6178 	BBC	#UQB$V_ST_SEREX,-	; Serious exception condition exists?
                    04 00C8 C4       1FEA  6179 		UQB$W_ST_FLAGS(R4),10$	;
                            10   88  1FEE  6180 	BISB	#MSCP$M_EF_SEREX,-	; Set serious exception state flag
                         09 A2       1FF0  6181 		MSCP$B_FLAGS(R2)	;  in MSCP end packet
                                     1FF2  6182 
                                     1FF2  6183 10$:
                            01   E1  1FF2  6184 	BBC	#UQB$V_ST_DLS,-		; If the cached data lost flag
                    04 00C8 C4       1FF4  6185 		UQB$W_ST_FLAGS(R4),20$	;  is set in the UQB, we'd better
                            08   B0  1FF8  6186 	MOVW	#MSCP$K_ST_DATA,-	;  set cached data lost in
                         0A A2       1FFA  6187 		MSCP$W_STATUS(R2)	;  the end packet		
                                     1FFC  6188 
                                     1FFC  6189 20$:
                            03   E5  1FFC  6190 	BBCC	#UQB$V_ST_LEOT,-	; If the logical end of tape flag
                    04 00C8 C4       1FFE  6191 		UQB$W_ST_FLAGS(R4),30$	;  is set in the UQB, we'd better
                            13   B0  2002  6192 	MOVW	#MSCP$K_ST_LED,-	;  set logical end of tape in
                         0A A2       2004  6193 		MSCP$W_STATUS(R2)	;  the end packet		
                                     2006  6194 
                                     2006  6195 30$:
                            02   E1  2006  6196 	BBC	#UQB$V_ST_EOT,-		; If end of tape flag
                    04 00C8 C4       2008  6197 		UQB$W_ST_FLAGS(R4),40$	;  flag is set,
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 133
X-2A6A1                         - SEND END - Respond To The Request      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (47)

                            08   88  200C  6198 	BISB	#MSCP$M_EF_EOT,-	; then set it in the next
                         09 A2       200E  6199 		MSCP$B_FLAGS(R2)	;  available end packet
                                     2010  6200 
                                     2010  6201 40$:
                    51   08 A2   9A  2010  6202 	MOVZBL	MSCP$B_OPCODE(R2),R1	; Pick up opcode
                         80 8F   88  2014  6203 	BISB2	#MSCP$K_OP_END,-	; Reset the op-code to
                         08 A2       2017  6204 		MSCP$B_OPCODE(R2)	;  make an end packet
                51   2272'CF41   9A  2019  6205 	MOVZBL	TMSCP$END_PKT_LEN[R1],R1; Get the message length from the table
                                     201F  6206 
                                     201F  6207 ;
                                     201F  6208 ;		R0  =  Scratch
                                     201F  6209 ;		R1  =  TMSCP message length
                                     201F  6210 ;		R2  =  TMSCP message address
                                     201F  6211 ;		R3  =  HRB address
                                     201F  6212 ;		R4  =  Scratch
                                     201F  6213 ;		R5  =  Scratch
                                     201F  6214 ;
                                     201F  6215 
                                     201F  6216 TMSCP$SEND_PKT::
                                     201F  6217 	
                                     201F  6218 ; 
                                     201F  6219 ; Prepare the CDRP in the HRB, send off the end message to the port driver.
                                     201F  6220 ;
                                     201F  6221 
               06 E748 CF   02   E1  201F  6222 	BBC	# TMSCP$V_DBG_SEND_PKT, -	; Not debugging - branch.
                                     2025  6223 		TMSCP$L_DEBUG_FLAGS, 0$
                   00000000'GF   16  2025  6224 	JSB	G^ INI$BRK
                                     202B  6225 
                                     202B  6226 0$:
                    54   54 A3   D0  202B  6227 	MOVL	HRB$L_HQB(R3),R4	; Restore the HQB address
                    55   1C A3   D0  202F  6228 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Address of the IRP for end message
                    55   60 A5   DE  2033  6229 	MOVAL	IRP$L_FQFL(R5),R5	;  move down to the start of the CDRP
                                     2037  6230 
                                     2037  6231 ;
                                     2037  6232 ; Initialize the fields of the CDRP.
                                     2037  6233 ;
                                     2037  6234 
                 24 A5   28 A4   D0  2037  6235 	MOVL	HQB$L_CDT(R4), -	; CDT describing the link to the system for
                                     203C  6236 		CDRP$L_CDT(R5)		; which this end message is destined.
                    1C A5   52   D0  203C  6237 	MOVL	R2,CDRP$L_MSG_BUF(R5)	; Put the message buffer address into
                         18 A3   D4  2040  6238 	CLRL	HRB$L_MSGBUF(R3)	;  a CDRP for the SCS call and zero HRB
                    54   5C A3   D0  2043  6239 	MOVL	HRB$L_PDT(R3),R4	; Set the PDT address for the SCS calls
                    0C A3   51   D0  2047  6240 	MOVL	R1,HRB$L_RESPC(R3)	; Hide the length away
                            01   B0  204B  6241 	MOVW	#HRB$K_ST_MSG_WAIT,-	; Set the state for this request
                         14 A3       204D  6242 		HRB$W_STATE(R3)		;  before calling SCS service
                                     204F  6243 	RECYCL_MSG_BUF			; Recycle the message
                         48 B4   16  204F       		JSB	@PDT$L_RCLMSGBUF(R4)
                         18 50   E9  2052  6244 	BLBC	R0, 20$			; If LBC connection broke, skip host
                    18 A3   52   D0  2055  6245 	MOVL	R2,HRB$L_MSGBUF(R3)	; Save the address of the buffer again
                       8000 8F   A8  2059  6246 	BISW	#HRB$M_STATE_INVALID,-	; The state of this request is "current"
                         14 A3       205D  6247 		HRB$W_STATE(R3)		;  leave the old state for diagnosis
                    51   0C A3   D0  205F  6248 	MOVL	HRB$L_RESPC(R3),R1	; Restore the length of the end message
                                     2063  6249 	.IF DEFINED DEBUG$LOG
                                     2063  6250 
                                     2063  6251 	ASSUME TSRV$V_LOG_ENABLD  EQ  0
                                     2063  6252 
                                     2063  6253 	MOVL	G^SCS$GL_TMSCP,R0	; Get the TSRV address.
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 134
X-2A6A1                         - SEND END - Respond To The Request      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (47)

                                     2063  6254 	BLBC	TSRV$W_STATE(R0),10$	; Branch if logging is disabled.
                                     2063  6255 	BSBW	TMSCP$LOG_END_PKT	; Otherwise, log the end packet.
                                     2063  6256 
                                     2063  6257 10$:
                                     2063  6258 	.ENDC	; DEBUG$LOG
                                     2063  6259 
                         18 A3   D4  2063  6260 	CLRL	HRB$L_MSGBUF(R3)	; Message buffer belongs to SCS again
                            08   B0  2066  6261 	MOVW	#HRB$K_ST_SNDMS_WAIT,-	; Set the state for this request
                         14 A3       2068  6262 		HRB$W_STATE(R3)		;  before calling SCS service
                                     206A  6263 	SEND_CNT_MSG_BUF		; Send the message (call returns immed)
                         60 B4   16  206A       		JSB	@PDT$L_SNDCNTMSG(R4)
                                     206D  6264 
                                     206D  6265 20$:
                       8000 8F   A8  206D  6266 	BISW	#HRB$M_STATE_INVALID,-	; The state of this request is "current"
                         14 A3       2071  6267 		HRB$W_STATE(R3)		;  leave the old state for diagnosis
                            01   E0  2073  6268 	BBS	#HRB$V_ABORTWS,-	;
                         16 A3       2075  6269 		HRB$W_FLAGS(R3),-
                            1F       2077  6270 		TMSCP$CLEANUP_AND_START_NEXT
                            08   E1  2078  6271 	BBC	#HRB$V_WBC_IMMED,-	; If immediate completion specified for
                         16 A3       207A  6272 		HRB$W_FLAGS(R3),-	;  a write-back caching command, don't
                            1A       207C  6273 		TMSCP$CLEANUP_AND_START_NEXT	;  clean up yet!
                                     207D  6274 ;
                                     207D  6275 ; Deallocate the MSCP message buffer. (may start up another thread)
                                     207D  6276 ;
                                     207D  6277 
                                     207D  6278 30$:
                         18 A3   D5  207D  6279 	TSTL	HRB$L_MSGBUF(R3)	; Check for allocated message buffer
                            14   13  2080  6280 	BEQL	40$			; Continue, if none is allocated
                         18 A3   D0  2082  6281 	MOVL	HRB$L_MSGBUF(R3),- 	; Get the message buffer address
                         1C A5       2085  6282 		CDRP$L_MSG_BUF(R5)	;  from the HRB and put it in the CDRP
                         18 A3   D4  2087  6283 	CLRL	HRB$L_MSGBUF(R3)	;  and clear out the address in the HRB
                    50   54 A3   D0  208A  6284 	MOVL	HRB$L_HQB(R3),R0	; Get the address of the HQB
                         28 A0   D0  208E  6285 	MOVL	HQB$L_CDT(R0),-		;  so we can get the CDT address
                         24 A5       2091  6286 		CDRP$L_CDT(R5)		;  and put it in the CDRP for the call
                                     2093  6287 	DEALLOC_MSG_BUF			; Get rid of the message buffer
                         20 B4   16  2093       		JSB	@PDT$L_DEALLOMSG(R4)
                                     2096  6288 
                                     2096  6289 40$:
                                 05  2096  6290 	RSB				; Finish sending request to the drive
                                     2097  6291 
                                     2097  6292 TMSCP$CLEANUP_AND_START_NEXT::
                          FC48   31  2097  6293 	BRW	TMSCP$CLEANUP_HRB	; Deallocate all HRB held resources
                                     209A  6294 
                                     209A  6295 ;
                                     209A  6296 ; Entry here means that a request was made to the server requiring a valid
                                     209A  6297 ; unit, and no UQB was found for the unit specified.
                                     209A  6298 ;
                                     209A  6299 
                                     209A  6300 TMSCP$ERROR_NO_UNIT::
                                     209A  6301 	.IF DEFINED DEBUG$PC_HISTORY
                                     209A  6302 	BSBW	TMSCP$PCHIST_R3R0	; Save this PC if we are keeping track
                                     209A  6303 	.ENDC	   ;DEBUG$PC_HISTORY
                       50   03   D0  209A  6304 	MOVL	#MSCP$K_ST_OFFLN,R0	; Return an offline status with the
                          FF3E   31  209D  6305 	BRW	TMSCP$SEND_END		; device unknown subcode (0)
                                     20A0  6306 
                                     20A0  6307 ;
                                     20A0  6308 ; When an error is detected with a packet, the address of the field that
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 135
X-2A6A1                         - SEND END - Respond To The Request      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (47)

                                     20A0  6309 ; contains the error is shifted into the high byte of R0 and control is
                                     20A0  6310 ; passed here.
                                     20A0  6311 ;
                                     20A0  6312 
                                     20A0  6313 TMSCP$PACKET_ERROR::
                                     20A0  6314 	.IF DEFINED DEBUG$PC_HISTORY
                                     20A0  6315 	BSBW	TMSCP$PCHIST_R3R0	; Save this PC if we are keeping track
                                     20A0  6316 	.ENDC	   ;DEBUG$PC_HISTORY
                                 C9  20A0  6317 	BISL3	#<MSCP$K_ST_ICMD@16-	; The command sent was invalid
                                     20A1  6318 		!MSCP$K_OP_END>,-	; Identify this as an end message
      08 A2   50   00010080 8F       20A1  6319 		R0,MSCP$B_OPCODE(R2)	; Put all this info back in the packet
                       51   24   D0  20A9  6320 	MOVL	#MSCP$K_MXCMDLEN,R1	; Use the minimum size possible
                          FF70   31  20AC  6321 	BRW	TMSCP$SEND_PKT		;  and send out the end message
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 136
X-2A6A1                         - UNHOOK CDRP - Action routine to dequeu 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (48)

                                     20AF  6324 	.SBTTL	-	UNHOOK CDRP - Action routine to dequeue CDRP's
                                     20AF  6325 
                                     20AF  6326 ;+
                                     20AF  6327 ; Functional Description:
                                     20AF  6328 ;
                                     20AF  6329 ; This routine is called as an action routine for the SCS routines that
                                     20AF  6330 ; scan the various wait queues for CDRPs that have been stalled. This        
                                     20AF  6331 ; routine is invoked when a virtual circuit has broken and all the requests
                                     20AF  6332 ; pending for the failed host must be cleaned up.
                                     20AF  6333 ;
                                     20AF  6334 ; Inputs:
                                     20AF  6335 ;
                                     20AF  6336 ;	R1  =  HRB address (passed only from TMSCP$ABORT)
                                     20AF  6337 ;	R3  =  CDT address matched
                                     20AF  6338 ;	R4  =  PDT address 
                                     20AF  6339 ;	R5  =  Address of the CDRP found with the scan
                                     20AF  6340 ;
                                     20AF  6341 ; Outputs:
                                     20AF  6342 ;
                                     20AF  6343 ;	R1  =  HRB address of the CDRP found
                                     20AF  6344 ;		(the invalid bit in the state field is set)
                                     20AF  6345 ;-
                                     20AF  6346 
                                     20AF  6347 ;
                                     20AF  6348 ; Dequeue the CDRP, if it is the one that goes with the HRB we are looking
                                     20AF  6349 ; for, and we can prove that it is in a queue. 
                                     20AF  6350 ;
                                     20AF  6351 
                                     20AF  6352 TMSCP$ABORT_UNHOOK_CDRP::
                    51   B4 A5   D1  20AF  6353 	CMPL	CDRP$L_HRB(R5),R1	; See if this is the right CDRP
                            01   13  20B3  6354 	BEQL	TMSCP$UNHOOK_CDRP	;  if it is, go ahead and unhook
                                 05  20B5  6355 	RSB				;  otherwise, just return
                                     20B6  6356 
                                     20B6  6357 TMSCP$UNHOOK_CDRP::
                                     20B6  6358 	.IF DEFINED DEBUG$PC_HISTORY
                                     20B6  6359 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     20B6  6360 	.ENDC	   ;DEBUG$PC_HISTORY
                         04 A5   D5  20B6  6361 	TSTL	CDRP$L_FQBL(R5)		; Check for the presence of a pointer
                            09   13  20B9  6362 	BEQL	10$			; If the field is 0 don't dequeue
                                     20BB  6363 
                                     20BB  6364 	ASSUME	CDRP$L_FQFL EQ 0
                                     20BB  6365 
                    55   04 B5   D1  20BB  6366 	CMPL	@CDRP$L_FQBL(R5),R5	; If the field is nonzero,
                            03   12  20BF  6367 	BNEQ	10$			;  make sure it is in a queue
                                     20C1  6368 
                                     20C1  6369 	ASSUME	CDRP$L_FQFL EQ 0
                                     20C1  6370 
                       55   65   0F  20C1  6371 	REMQUE	CDRP$L_FQFL(R5), R5	; Remove the CDRP from its queue
                                     20C4  6372 
                                     20C4  6373 ;
                                     20C4  6374 ; Once the CDRP has been removed from the queue, set the invalid
                                     20C4  6375 ; bit in the state field, to indicate that the displayed state is 
                                     20C4  6376 ; an old one. On a later pass through all the pending requests 
                                     20C4  6377 ; for this host, requests in this state will be eligible for cleanup
                                     20C4  6378 ; with no further processing.
                                     20C4  6379 ;
                                     20C4  6380 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 137
X-2A6A1                         - UNHOOK CDRP - Action routine to dequeu 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (48)

                                     20C4  6381 10$:
                            52   DD  20C4  6382 	PUSHL	R2			; Save any registers used in cleanup
                    52   B4 A5   D0  20C6  6383 	MOVL	CDRP$L_HRB(R5),R2	; Get the HRB address
                                     20CA  6384 	.IF DEFINED DEBUG$PC_HISTORY
                                     20CA  6385 	PUSHL	R0
                                     20CA  6386 	MOVL	R2, R0			; Get the HRB address.
                                     20CA  6387 	BSBW	TMSCP$PCHIST_R0		; Save this PC if we are keeping track
                                     20CA  6388 	POPL	R0
                                     20CA  6389 	.ENDC	   ;DEBUG$PC_HISTORY
                            04   A8  20CA  6390 	BISW	#HRB$M_DEQUEUED,-	; Mark this request as unhooked,
                         16 A2       20CC  6391 		HRB$W_FLAGS(R2)		;  its resources can be deallocated
                            52 8ED0  20CE  6392 	POPL	R2			; Restore the registers used here
                                     20D1  6393 
                                 05  20D1  6394 	RSB				; Return to SCS
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 138
X-2A6A1                         - DEALLOCATE HQB - Remove an HQB if ther 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (49)

                                     20D2  6397 	.SBTTL	-	DEALLOCATE HQB - Remove an HQB if there are no requests 
                                     20D2  6398 
                                     20D2  6399 ;+
                                     20D2  6400 ; Functional Description:
                                     20D2  6401 ;
                                     20D2  6402 ; This routine is called as part of the virtual circuit error cleanup routine.
                                     20D2  6403 ; When TMSCP$VC_ERR has done its best to clean up all the outstanding requests for
                                     20D2  6404 ; this host, control is passed here to see if they have all been dealt with.
                                     20D2  6405 ; If there are none outstanding, the HQB is returned to pool. If there are 
                                     20D2  6406 ; still some requests that are held by the tape driver, this routine is
                                     20D2  6407 ; revisited when the request is returned to the server, and as each outstanding
                                     20D2  6408 ; request is aborted, this routine is called. Only when the last request
                                     20D2  6409 ; pending for this host is deleted will the HQB be deallocated, and the host
                                     20D2  6410 ; number used returned to the TSRV so it can be used again.
                                     20D2  6411 ;
                                     20D2  6412 ; Inputs:
                                     20D2  6413 ;
                                     20D2  6414 ;	R5  =  HQB address
                                     20D2  6415 ;
                                     20D2  6416 ; Outputs:
                                     20D2  6417 ;
                                     20D2  6418 ;	R0  =  0 (if there are still requests outstanding)
                                     20D2  6419 ;	       SS$_NORMAL (if the HQB was deleted)
                                     20D2  6420 ;	R5  =  Cleared
                                     20D2  6421 ;	
                                     20D2  6422 ;	All other registers preserved.
                                     20D2  6423 ;-
                                     20D2  6424 
                                     20D2  6425 TMSCP$DEALLOC_HQB::
                                     20D2  6426 	.IF DEFINED DEBUG$PC_HISTORY
                                     20D2  6427 	BSBW	TMSCP$PCHIST		; Save this PC if we are keeping track
                                     20D2  6428 	.ENDC	   ;DEBUG$PC_HISTORY
                                     20D2  6429 
                            1A   BB  20D2  6430 	PUSHR	#^M<R1,R3,R4>	; Save any registers we mess with
                                     20D4  6431 
                                     20D4  6432 ;
                                     20D4  6433 ; First, check to make sure that there are no requests still outstanding
                                     20D4  6434 ; for this host.
                                     20D4  6435 ;
                                     20D4  6436 
                            50   D4  20D4  6437 	CLRL	R0			; Assume there are more requests
                    53   20 A5   DE  20D6  6438 	MOVAL	HQB$L_HRB_FL(R5),R3	; Get the address of the request queue.
                       53   63   D1  20DA  6439 	CMPL	(R3),R3			; See if this is a null queue
                            15   12  20DD  6440 	BNEQ	20$			; If it's not, we aren't ready for this
                                     20DF  6441 
                                     20DF  6442 ; 
                                     20DF  6443 ; Now we know that this virtual circuit is no good anymore. It must have
                                     20DF  6444 ; failed in the first place to be marked bad in the HQB, and now all the 
                                     20DF  6445 ; pending requests have been cleaned up, remove this host queue block from 
                                     20DF  6446 ; the list, and return the host number to be used by another incoming 
                                     20DF  6447 ; connect request.
                                     20DF  6448 ; 
                                     20DF  6449 
                    54   32 A5   D0  20DF  6450 	MOVL	HQB$L_TSRV(R5),R4	; Get the server structure address
                                     20E3  6451 
                                     20E3  6452 10$:
                         5C A4   B7  20E3  6453 	DECW	TSRV$W_NUM_HOST(R4)	; Adjust the count of hosts being served
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 139
X-2A6A1                         - DEALLOCATE HQB - Remove an HQB if ther 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (49)

                                     20E6  6454 
                                     20E6  6455 	ASSUME	HQB$L_FLINK EQ 0
                                     20E6  6456 
                       50   65   0F  20E6  6457 	REMQUE	HQB$L_FLINK(R5), R0	; Dequeue the HQB from the list
                                     20E9  6458 	.IF DEFINED DEBUG$PC_HISTORY
                                     20E9  6459 	BSBW	TMSCP$R0HIST		; Save this value.
                                     20E9  6460 	.ENDC	   ;DEBUG$PC_HISTORY
                   00000000'GF   16  20E9  6461 	JSB	G^EXE$DEANONPAGED	;  and return the memory to pool
                            55   D4  20EF  6462 	CLRL	R5			; Clear out the old pointer
                       50   01   D0  20F1  6463 	MOVL	#SS$_NORMAL,R0		; Set success
                                     20F4  6464 
                                     20F4  6465 20$:
                            1A   BA  20F4  6466 	POPR	#^M<R1,R3,R4>		; Restore these registers
                                 05  20F6  6467 	RSB				;  and return
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 140
X-2A6A1                         Macros for Density Tables                27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (50)

                                     20F7  6470 	.SBTTL	Macros for Density Tables
                                     20F7  6471 
                                     20F7  6472 ;++
                                     20F7  6473 ;  Macros used to build the MSCP -- VMS density tables
                                     20F7  6474 ;
                                     20F7  6475 ; Functional Description:
                                     20F7  6476 ;
                                     20F7  6477 ;	The following macro (and its two sub-macros) create a table used in 
                                     20F7  6478 ;	converting VMS notions of density and speed to equivalent MSCP values 
                                     20F7  6479 ;	and vice. versa.  Each section of the table corresponds to an MSCP
                                     20F7  6480 ;	format group.  The entries in the two lists within each section
                                     20F7  6481 ;	correspond to the formats within the group.  Each section consists
                                     20F7  6482 ;	of a byte indicating the number of entries in each list followed by
                                     20F7  6483 ;	a list of byte value VMS density codes for given (subscripted) MSCP
                                     20F7  6484 ;	density bit positions, and a list of word numeric density values for
                                     20F7  6485 ;	given (subscripted) MSCP density bit positions.  Multiple invocations
                                     20F7  6486 ;	of this macro add additional sections to the table.  
                                     20F7  6487 ;	
                                     20F7  6488 ;	Label TU_VMSDENS points to the byte preceeding the list of VMS density
                                     20F7  6489 ;	codes in the first table section.  Label TU_ABSDENS points to the start
                                     20F7  6490 ;	of the list of numeric density values in the first table section.  The
                                     20F7  6491 ;	byte preceeding each list of VMS density codes is used to locate the
                                     20F7  6492 ;	next table section.
                                     20F7  6493 ;
                                     20F7  6494 ; Note:	Invocations of this macro must be ordered by increasing MSCP format
                                     20F7  6495 ;	group values.  The lists within each invocation must be ordered by 
                                     20F7  6496 ;	increasing MSCP density bit values.
                                     20F7  6497 ;
                                     20F7  6498 ;	For more information, see TMSCP ECO TMSCP16-43.
                                     20F7  6499 ;
                                     20F7  6500 ;--
                                     20F7  6501 
                           00000000  20F7  6502 TABLE_SECTIONS	= 0
                                     20F7  6503 
                                     20F7  6504 	.MACRO	DENSITY_TABLE, DF_MT, DF_DENS, DF_MSCP, LIST
                                     20F7  6505 TABLE_SECTIONS	= TABLE_SECTIONS + 1
                                     20F7  6506 	.IIF NDF, TMSCP$TU_VMSDENS, TMSCP$TU_VMSDENS::	; Start of table.
                                     20F7  6507 	. = .+1					; Reserve byte for table size.
                                     20F7  6508 TABLE$$$START = .
                                     20F7  6509 	.IRP	ITEM, <LIST>			; Build VMS density
                                     20F7  6510 	SET_VMSDENS ITEM			;  values table.
                                     20F7  6511 	.ENDR
                                     20F7  6512 	.BYTE	MT$K_'DF_MT'			; Set default VMS density.
                                     20F7  6513 TABLE$$$SIZE = . - TABLE$$$START		; Calculate section table size.
                                     20F7  6514 TABLE$$$END = .					; Save current pointer.
                                     20F7  6515 	. = TABLE$$$START - 1			; Set pointer to table start.
                                     20F7  6516 	.BYTE TABLE$$$SIZE			; Fill in table size.
                                     20F7  6517 	. = TABLE$$$END				; Restore pointer
                                     20F7  6518 
                                     20F7  6519 	.IIF NDF, TMSCP$TU_ABSDENS, TMSCP$TU_ABSDENS::
                                     20F7  6520 	.IRP	ITEM, <LIST>			; Build table of absolute
                                     20F7  6521 	SET_ABSDENS ITEM			;  density values.
                                     20F7  6522 	.ENDR
                                     20F7  6523 	.LONG	DF_DENS
                                     20F7  6524 
                                     20F7  6525 	.ENDM	DENSITY_TABLE
                                     20F7  6526 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 141
X-2A6A1                         Macros for Density Tables                27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (50)

                                     20F7  6527 	.MACRO	SET_VMSDENS, MT, DENS, MSCP
                                     20F7  6528 	.IF NB MT
                                     20F7  6529 	ASSUME	<. - TABLE$$$START> EQ MSCP$V_'MSCP'
                                     20F7  6530 	.BYTE	MT$K_'MT'
                                     20F7  6531 	.ENDC
                                     20F7  6532 	.IIF B, MT,	.BYTE 0
                                     20F7  6533 	.ENDM
                                     20F7  6534 
                                     20F7  6535 	.MACRO	SET_ABSDENS, MT, DENS, MSCP
                                     20F7  6536 	.IF NB MT
                                     20F7  6537 	.LONG	DENS
                                     20F7  6538 	.ENDC
                                     20F7  6539 	.IIF B, MT,	.LONG 0
                                     20F7  6540 	.ENDM
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 142
X-2A6A1                         Density and Speed Conversion Tables      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (51)

                                     20F7  6543 	.SBTTL	Density and Speed Conversion Tables
                                     20F7  6544 
                                     20F7  6545 ;++
                                     20F7  6546 ;
                                     20F7  6547 ; Density / Speed Conversion Tables
                                     20F7  6548 ;
                                     20F7  6549 ; NOTE: Multiple invocations of DENSITY_TABLE must be in increasing order of
                                     20F7  6550 ;	MSCP$K_TC_xxxx.  Entries within each DENSITY_TABLE must be ordered by
                                     20F7  6551 ;	increasing values of MSCP$V_TF_xxx, and no values of MSCP$V_TF_xxx can
                                     20F7  6552 ;	be omitted.  Failure to observe these rules will result in errors.
                                     20F7  6553 ;--
                                     20F7  6554 
                                     20F7  6555 	ASSUME	MSCP$K_TC_OLD@-8 EQ 0
                                     20F7  6556 
                                     20F7  6557 	DENSITY_TABLE -				; Old devices
                                     20F7  6558 		PE_1600,  1600, TF_PE, -	; Defaults
                                     20F7  6559 		< -
                                     20F7  6560 		< NRZI_800,  800, TF_800 >, -
                                     20F7  6561 		< PE_1600,  1600, TF_PE >, -
                                     20F7  6562 		< GCR_6250, 6250, TF_GCR >, -
                                     20F7  6563 		< BLK_833,   833, TF_BLK > -
                                     20F7  6564 		>
                                     20F7       	.IIF NDF, TMSCP$TU_VMSDENS, TMSCP$TU_VMSDENS::	; Start of table.
                           000020F8  20F7       	. = .+1					; Reserve byte for table size.
                                 03  20F8       	.BYTE	MT$K_NRZI_800
                                 04  20F9       	.BYTE	MT$K_PE_1600
                                 05  20FA       	.BYTE	MT$K_GCR_6250
                                 11  20FB       	.BYTE	MT$K_BLK_833
                                 04  20FC       	.BYTE	MT$K_PE_1600			; Set default VMS density.
                           000020F7  20FD       	. = TABLE$$$START - 1			; Set pointer to table start.
                                 05  20F7       	.BYTE TABLE$$$SIZE			; Fill in table size.
                           000020FD  20F8       	. = TABLE$$$END				; Restore pointer
                                     20FD       	.IIF NDF, TMSCP$TU_ABSDENS, TMSCP$TU_ABSDENS::
                           00000320  20FD       	.LONG	800
                           00000640  2101       	.LONG	1600
                           0000186A  2105       	.LONG	6250
                           00000341  2109       	.LONG	833
                           00000640  210D       	.LONG	1600
                                     2111  6565 
                                     2111  6566 	ASSUME	MSCP$K_TC_9TR@-8 EQ 1
                                     2111  6567 
                                     2111  6568 	DENSITY_TABLE -				; New 9-track devices
                                     2111  6569 		PE_1600,  1600, TF_PE, -	; Defaults
                                     2111  6570 		< -
                                     2111  6571 		< NRZI_800,  800, TF_800 >, -
                                     2111  6572 		< PE_1600,  1600, TF_PE  >, -
                                     2111  6573 		< GCR_6250, 6250, TF_GCR >, -
                                     2111  6574 		>
                           00002112  2111       	. = .+1					; Reserve byte for table size.
                                 03  2112       	.BYTE	MT$K_NRZI_800
                                 04  2113       	.BYTE	MT$K_PE_1600
                                 05  2114       	.BYTE	MT$K_GCR_6250
                                 04  2115       	.BYTE	MT$K_PE_1600			; Set default VMS density.
                           00002111  2116       	. = TABLE$$$START - 1			; Set pointer to table start.
                                 04  2111       	.BYTE TABLE$$$SIZE			; Fill in table size.
                           00002116  2112       	. = TABLE$$$END				; Restore pointer
                           00000320  2116       	.LONG	800
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 143
X-2A6A1                         Density and Speed Conversion Tables      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (51)

                           00000640  211A       	.LONG	1600
                           0000186A  211E       	.LONG	6250
                           00000640  2122       	.LONG	1600
                                     2126  6575 
                                     2126  6576 	ASSUME	MSCP$K_TC_CTP@-8 EQ 2
                                     2126  6577 
                                     2126  6578 	DENSITY_TABLE -				; Block mode devices
                                     2126  6579 		BLK_833,   833, TF_NOR, -	; Defaults
                                     2126  6580 		< -
                                     2126  6581 		< BLK_833,   833, TF_NOR >, -	; TK50 = 6666/8
                                     2126  6582 		< BLK_1250, 1250, TF_BHD > -	; TK70 = 10000/8
                                     2126  6583 		>
                           00002127  2126       	. = .+1					; Reserve byte for table size.
                                 11  2127       	.BYTE	MT$K_BLK_833
                                 12  2128       	.BYTE	MT$K_BLK_1250
                                 11  2129       	.BYTE	MT$K_BLK_833			; Set default VMS density.
                           00002126  212A       	. = TABLE$$$START - 1			; Set pointer to table start.
                                 03  2126       	.BYTE TABLE$$$SIZE			; Fill in table size.
                           0000212A  2127       	. = TABLE$$$END				; Restore pointer
                           00000341  212A       	.LONG	833
                           000004E2  212E       	.LONG	1250
                           00000341  2132       	.LONG	833
                                     2136  6584 
                                     2136  6585 	ASSUME	MSCP$K_TC_HPC@-8 EQ 3
                                     2136  6586 
                                     2136  6587 	DENSITY_TABLE -				; High performance cartridge
                                     2136  6588 		HPC_40K,   39872, TF_NOR, -	; Defaults
                                     2136  6589 		< -
                                     2136  6590 		< HPC_40K, 39872, TF_NOR> -	; HPC_40K = 39872 bytes/inch
                                     2136  6591 		< XPC_80K, 80000, TF_ENH> -	; XPC_80K
                                     2136  6592 		< HPC_COMP,70000, TF_NDC> -	; HPC_COMP = 2 to 30 times HPC_40K
                                     2136  6593 		< XPC_COMP,160000, TF_EDC> -	; XPC_COMP
                                     2136  6594 		>
                           00002137  2136       	. = .+1					; Reserve byte for table size.
                                 0C  2137       	.BYTE	MT$K_HPC_40K
                                 0E  2138       	.BYTE	MT$K_XPC_80K
                                 0D  2139       	.BYTE	MT$K_HPC_COMP
                                 0F  213A       	.BYTE	MT$K_XPC_COMP
                                 0C  213B       	.BYTE	MT$K_HPC_40K			; Set default VMS density.
                           00002136  213C       	. = TABLE$$$START - 1			; Set pointer to table start.
                                 05  2136       	.BYTE TABLE$$$SIZE			; Fill in table size.
                           0000213C  2137       	. = TABLE$$$END				; Restore pointer
                           00009BC0  213C       	.LONG	39872
                           00013880  2140       	.LONG	80000
                           00011170  2144       	.LONG	70000
                           00027100  2148       	.LONG	160000
                           00009BC0  214C       	.LONG	39872
                                     2150  6595 
                                     2150  6596 	ASSUME	MSCP$K_TC_WOD@-8 EQ 4
                                     2150  6597 
                                     2150  6598 	DENSITY_TABLE -				; Write-once optical disks
                                     2150  6599 		WOD_6250,   6250, TF_NOR, -	; Defaults
                                     2150  6600 		< -
                                     2150  6601 		< WOD_6250,   6250, TF_NOR > -	; RV20
                                     2150  6602 		>
                           00002151  2150       	. = .+1					; Reserve byte for table size.
                                 08  2151       	.BYTE	MT$K_WOD_6250
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 144
X-2A6A1                         Density and Speed Conversion Tables      27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (51)

                                 08  2152       	.BYTE	MT$K_WOD_6250			; Set default VMS density.
                           00002150  2153       	. = TABLE$$$START - 1			; Set pointer to table start.
                                 02  2150       	.BYTE TABLE$$$SIZE			; Fill in table size.
                           00002153  2151       	. = TABLE$$$END				; Restore pointer
                           0000186A  2153       	.LONG	6250
                           0000186A  2157       	.LONG	6250
                                     215B  6603 
                                     215B  6604 TMSCP$TU_ABSPEED::				; Speed in IPS.
                               0000  215B  6605 	.WORD	0				; Default speed.
                               0019  215D  6606 	.WORD	MT$K_SPEED_25			; 25  IPS
                               004B  215F  6607 	.WORD	MT$K_SPEED_75			; 75  IPS
                               007D  2161  6608 	.WORD	125				; 125 IPS
                               00FF  2163  6609 	.WORD	255				; Returned if not in table.
                               FFFF  2165  6610 	.WORD	-1				; End of table.
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 145
X-2A6A1                         Density Conversion Routines              27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (52)

                                     2167  6613 	.SBTTL	Density Conversion Routines
                                     2167  6614 	.SBTTL	.   TMSCP$VMSTOMSCP_DENS
                                     2167  6615 
                                     2167  6616 ;++
                                     2167  6617 ;
                                     2167  6618 ; TMSCP$VMSTOMSCP_DENS
                                     2167  6619 ;
                                     2167  6620 ; Convert a VMS density code to a MSCP density code.  For single density 
                                     2167  6621 ; devices, use the only density available.
                                     2167  6622 ;
                                     2167  6623 ; Inputs:
                                     2167  6624 ;
                                     2167  6625 ;	R0 	VMS density code 
                                     2167  6626 ;	R1	bits  0 -  7 = supported densities
                                     2167  6627 ;		bits  8 - 15 = MSCP Tape format flag
                                     2167  6628 ;		bits 16 - 31 = MBZ
                                     2167  6629 ;
                                     2167  6630 ; Outputs:
                                     2167  6631 ;
                                     2167  6632 ;	R0	Status
                                     2167  6633 ;		   LBS ==> VMS density lookup succeeded
                                     2167  6634 ;		   LBC ==> VMS density lookup failed or single density device, 
                                     2167  6635 ;			   default density or single device density used
                                     2167  6636 ;	R1	MSCP format / density code
                                     2167  6637 ;	All other registers are preserved.
                                     2167  6638 ;--
                                     2167  6639 
                                     2167  6640 TMSCP$VMSTOMSCP_DENS::
                            1C   BB  2167  6641 	PUSHR	#^M<R2,R3,R4>
             54   51   00FF 8F   AB  2169  6642 	BICW3	#^X0FF, R1, R4		; Save format.
                          003E   30  216F  6643 	BSBW	TMSCP$FIND_SECTION	; Locate table section for this format.
                            52   D7  2172  6644 	DECL	R2			; R2 = number of densities to search.
                                     2174  6645 					; (Minus one to skip default density).
                                     2174  6646 7$:
                  63   52   50   3A  2174  6647 	LOCC	R0, R2, (R3)		; Find VMS density in this table
                                     2178  6648 					;  section.
                            0C   12  2178  6649 	BNEQ	10$			; Branch if found.
                     50   6342   90  217A  6650 	MOVB	(R3)[R2], R0		; Get default VMS density.
                  63   52   50   3A  217E  6651 	LOCC	R0, R2, (R3)		; Find default density in the table.
                            50   D4  2182  6652 	CLRL	R0			; Set "default" density flag.
                            03   11  2184  6653 	BRB	20$			; Branch to convert to MSCP density.
                                     2186  6654 
                                     2186  6655 10$:
                       50   01   D0  2186  6656 	MOVL	#SS$_NORMAL, R0		; Indicate success.
                                     2189  6657 
                                     2189  6658 20$:
                       51   53   C2  2189  6659 	SUBL	R3, R1			; Get offset into table.
                  51   01   51   78  218C  6660 	ASHL	R1, #1, R1		; Develop MSCP density code.
                       51   54   A8  2190  6661 	BISW	R4, R1			; Combine with format.
                            1C   BA  2193  6662 	POPR	#^M<R2,R3,R4>
                                 05  2195  6663 	RSB
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 146
X-2A6A1                         .   TMSCP$MSCPTOVMS_DENS                 27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (53)

                                     2196  6666 	.SBTTL	.   TMSCP$MSCPTOVMS_DENS
                                     2196  6667 
                                     2196  6668 ;++
                                     2196  6669 ;
                                     2196  6670 ; TMSCP$MSCPTOVMS_DENS
                                     2196  6671 ;
                                     2196  6672 ; Convert a MSCP density code to a VMS density code.
                                     2196  6673 ;
                                     2196  6674 ; Inputs:
                                     2196  6675 ;
                                     2196  6676 ;	R1	bits  0 -  7 = MSCP density (Tape format bitflag)
                                     2196  6677 ;		bits  8 - 15 = MSCP Tape format flag for this device
                                     2196  6678 ;		bits 16 - 31 = MBZ
                                     2196  6679 ;
                                     2196  6680 ; Outputs:
                                     2196  6681 ;
                                     2196  6682 ;	R0	VMS density code
                                     2196  6683 ;	R1	destroyed
                                     2196  6684 ;	All other registers are preserved.
                                     2196  6685 ;--
                                     2196  6686 
                                     2196  6687 TMSCP$MSCPTOVMS_DENS::
                            0C   BB  2196  6688 	PUSHR	#^M<R2,R3>
                          0015   30  2198  6689 	BSBW	TMSCP$FIND_SECTION	; Locate table section for this format.
                            52   D7  219B  6690 	DECL	R2			; R2 = number of densities to search.
                                     219D  6691 					; (Minus one to skip default density).
              51   FFFFFF00 8F   CA  219D  6692 	BICL	#^CMSCP$M_TF_MASK, R1	; Isolate format bitflag.
             51   51   52   00   EA  21A4  6693 	FFS	#0, R2, R1, R1		; Get byte index into VMS
                     50   6341   9A  21A9  6694 	MOVZBL	(R3)[R1], R0		; density table, lookup value,
                            0C   BA  21AD  6695 	POPR	#^M<R2,R3>		; and return.
                                 05  21AF  6696 	RSB
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 147
X-2A6A1                         .   TMSCP$FIND_SECTION                   27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (54)

                                     21B0  6699 	.SBTTL	.   TMSCP$FIND_SECTION
                                     21B0  6700 
                                     21B0  6701 ;++
                                     21B0  6702 ; TMSCP$FIND_SECTION
                                     21B0  6703 ;
                                     21B0  6704 ; This routine uses the format flag value in bits 8 through 15 of R1 to
                                     21B0  6705 ; locate the correct density table section for a given format.
                                     21B0  6706 ;
                                     21B0  6707 ; Inputs:
                                     21B0  6708 ;
                                     21B0  6709 ;	R1	bits  0 -  7 = Don't care
                                     21B0  6710 ;		bits  8 - 15 = MSCP Tape format flag
                                     21B0  6711 ;		bits 16 - 31 = MBZ
                                     21B0  6712 ;
                                     21B0  6713 ; Outputs:
                                     21B0  6714 ;
                                     21B0  6715 ;	R2	Number of density entries in table section	
                                     21B0  6716 ;	R3	Address of table section
                                     21B0  6717 ;	All other registers are preserved.
                                     21B0  6718 ;--
                                     21B0  6719 
                                     21B0  6720 TMSCP$FIND_SECTION::
                            51   DD  21B0  6721 	PUSHL	R1
                  53   FF41 CF   9E  21B2  6722 	MOVAB	TMSCP$TU_VMSDENS, R3	; Get address of VMS densities.
                       52   83   9A  21B7  6723 	MOVZBL	(R3)+, R2		; Get number of densities for this format.
               51   51   F8 8F   78  21BA  6724 	ASHL	#-8, R1, R1		; Get tape format flag in R1.
                            13   13  21BF  6725 	BEQL	20$			; Branch if = MSCP$K_TC_OLD.
                       05   51   D1  21C1  6726 	CMPL	R1, # TABLE_SECTIONS	; Is the requested section in the table?
                            0E   1E  21C4  6727 	BGEQU	20$			; No, use VMS densities - branch.
                                     21C6  6728 
                                     21C6  6729 10$:
                     53   6342   9E  21C6  6730 	MOVAB	(R3)[R2], R3		; Point to next table section.
                     53   6342   DE  21CA  6731 	MOVAL	(R3)[R2], R3
                       52   83   9A  21CE  6732 	MOVZBL	(R3)+, R2		; Get number of densities for this format.
                         F2 51   F5  21D1  6733 	SOBGTR	R1, 10$			; Loop to we find the right section.
                                     21D4  6734 
                                     21D4  6735 20$:
                            51 8ED0  21D4  6736 	POPL	R1
                                 05  21D7  6737 	RSB
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 148
X-2A6A1                         Speed Conversion Routines                27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (55)

                                     21D8  6740 	.SBTTL	Speed Conversion Routines
                                     21D8  6741 	.SBTTL	.   TMSCP$SPEEDTOMSCP
                                     21D8  6742 
                                     21D8  6743 ;++
                                     21D8  6744 ;
                                     21D8  6745 ; TMSCP$SPEEDTOMSCP
                                     21D8  6746 ;
                                     21D8  6747 ; Convert IPS to MSCP speed value using formula:
                                     21D8  6748 ;
                                     21D8  6749 ;	MSCP_SPEED = ( IPS * BPI ) / 1000
                                     21D8  6750 ;
                                     21D8  6751 ; Inputs:
                                     21D8  6752 ;
                                     21D8  6753 ;	R0	IPS
                                     21D8  6754 ;	R1	bits  0 -  7 = MSCP density
                                     21D8  6755 ;		bits  8 - 15 = MSCP Tape format flag
                                     21D8  6756 ;		bits 16 - 31 = MBZ
                                     21D8  6757 ;
                                     21D8  6758 ; Outputs:
                                     21D8  6759 ;
                                     21D8  6760 ;	R0	MSCP speed value
                                     21D8  6761 ;	R1 is destroyed.
                                     21D8  6762 ;	All other registers are preserved.
                                     21D8  6763 ;--
                                     21D8  6764 
                                     21D8  6765 TMSCP$SPEEDTOMSCP::
                            0C   BB  21D8  6766 	PUSHR	#^M<R2,R3>
                          FFD3   30  21DA  6767 	BSBW	TMSCP$FIND_SECTION	; Locate table section for this format.
                     53   6342   9E  21DD  6768 	MOVAB	(R3)[R2], R3		; Point to absolute density values.
                            52   D7  21E1  6769 	DECL	R2			; R2 = number of densities to search.
                                     21E3  6770 					; (Minus one to skip default density).
              51   FFFFFF00 8F   CA  21E3  6771 	BICL	#^C MSCP$M_TF_MASK, R1	; Isolate format bitflag.
             51   51   52   00   EA  21EA  6772 	FFS	#0, R2, R1, R1		; Convert MSCP density to index.
                     51   6341   D0  21EF  6773 	MOVL	(R3)[R1], R1		; Get numerical BPI value.
                       50   51   C4  21F3  6774 	MULL	R1, R0			; Compute (IPS * BPI).
              50   000003E8 8F   C6  21F6  6775 	DIVL	#1000, R0		; Compute (IPS * BPI) / 1000.
                            0C   BA  21FD  6776 	POPR	#^M<R2,R3>
                                 05  21FF  6777 	RSB
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 149
X-2A6A1                         .   TMSCP$MSCPTOSPEED                    27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (56)

                                     2200  6780 	.SBTTL	.   TMSCP$MSCPTOSPEED
                                     2200  6781 
                                     2200  6782 ;++
                                     2200  6783 ;
                                     2200  6784 ; TMSCP$MSCPTOSPEED
                                     2200  6785 ;
                                     2200  6786 ; Convert MSCP speed value using formula:
                                     2200  6787 ;
                                     2200  6788 ;	IPS = ( MSCP_SPEED * 1000 ) / BPI
                                     2200  6789 ;
                                     2200  6790 ; Round IPS speed to nearest value in TU_ABSPEED which is less than or equal 
                                     2200  6791 ; to computed value.
                                     2200  6792 ;
                                     2200  6793 ; Inputs:
                                     2200  6794 ;
                                     2200  6795 ;	R0	MSCP speed value
                                     2200  6796 ;	R1	bits  0 -  7 = MSCP density
                                     2200  6797 ;		bits  8 - 15 = MSCP Tape format flag for this device
                                     2200  6798 ;		bits 16 - 31 = MBZ
                                     2200  6799 ;
                                     2200  6800 ; Outputs:
                                     2200  6801 ;
                                     2200  6802 ;	R0	IPS
                                     2200  6803 ;	R1 is modified.
                                     2200  6804 ;	All other registers are preserved.
                                     2200  6805 ;--
                                     2200  6806 
                                     2200  6807 TMSCP$MSCPTOSPEED::
                            0C   BB  2200  6808 	PUSHR	#^M<R2,R3>
                          FFAB   30  2202  6809 	BSBW	TMSCP$FIND_SECTION	; Locate table section for this format.
                     53   6342   9E  2205  6810 	MOVAB	(R3)[R2], R3		; Point to absolute density values.
                            52   D7  2209  6811 	DECL	R2			; R2 = number of densities to search.
                                     220B  6812 					; (Minus one to skip default density).
              51   FFFFFF00 8F   CA  220B  6813 	BICL	#^C MSCP$M_TF_MASK, R1	; Isolate format bitflag.
             51   51   52   00   EA  2212  6814 	FFS	#0, R2, R1, R1		; Convert MSCP density to index.
                     51   6341   D0  2217  6815 	MOVL	(R3)[R1], R1		; Get numerical BPI value.
              50   000003E8 8F   C4  221B  6816 	MULL	#1000, R0		; Compute (MSCP_SPEED * 1000).
                       50   51   C6  2222  6817 	DIVL	R1, R0			; Divide that by BPI.
                       50   05   C0  2225  6818 	ADDL	#5, R0			; Round up for search.
                  51   FF2F CF   9E  2228  6819 	MOVAB	TMSCP$TU_ABSPEED, R1	; Get speeds table base.
                                     222D  6820 
                                     222D  6821 10$:
                       50   81   B1  222D  6822 	CMPW	(R1)+, R0		; Find first speed > R0.
                            FB   1F  2230  6823 	BLSSU	10$			; Loop till bigger speed found.
                    50   FC A1   3C  2232  6824 	MOVZWL	-4(R1), R0		; Then, use the previous speed.
                            0C   BA  2236  6825 	POPR	#^M<R2,R3>
                                 05  2238  6826 	RSB
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 150
X-2A6A1                         Debugging Routines                       27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (57)

                                     2239  6829 	.SBTTL	Debugging Routines
                                     2239  6830 	.SBTTL	-	PC History recording
                                     2239  6831 	.IF DEFINED DEBUG$PC_HISTORY
                                     2239  6832 
                                     2239  6833 ;+
                                     2239  6834 ; Functional Description:
                                     2239  6835 ;
                                     2239  6836 ; This routine is used to maintain a running history of the Program
                                     2239  6837 ; Counter as the TMSCP server executes. This routine is called from 
                                     2239  6838 ; from various places throughout the server using a BSBW instruction.
                                     2239  6839 ; The return address of the caller is stored in the PC history table
                                     2239  6840 ; as the offset into the server. This allows us to save space by only
                                     2239  6841 ; using one word to save the address, and makes it easier to find the
                                     2239  6842 ; address within a listing of the server.
                                     2239  6843 ;
                                     2239  6844 ; Inputs:
                                     2239  6845 ;
                                     2239  6846 ;	8(SP)  =  Address to be logged (PCHIST* only)
                                     2239  6847 ;	R3     =  Value to be logged (PCHIST_R3, PCHIST_R3R0, and R3HIST only)
                                     2239  6848 ;	R0     =  Value to be logged (PCHIST_R0, PCHIST_R3R0, and R0HIST only)
                                     2239  6849 ;
                                     2239  6850 ; Outputs:
                                     2239  6851 ;
                                     2239  6852 ;	None
                                     2239  6853 ;
                                     2239  6854 ; Implicit Outputs:
                                     2239  6855 ;
                                     2239  6856 ;	Address is logged in the PC history table
                                     2239  6857 ;	TMSCP$PCHISTCUR is moved to point to the next available cell
                                     2239  6858 ;-
                                     2239  6859 
                                     2239  6860 	.MACRO	LOG_VALUE	value, ?buffer_not_full
                                     2239  6861 	MOVL	value,(R1)+		; Save the PC.
                                     2239  6862 	CMPL	R1, TMSCP$PCHISTEND	; Check for the end of the table
                                     2239  6863 	BLSSU	buffer_not_full			;  still plenty of room
                                     2239  6864 	MOVL	TMSCP$PCHISTBEG, R1	; Wrap around back to the start
                                     2239  6865 	INCL	TMSCP$PCHISTFUL		;  and bump the filled counter
                                     2239  6866 
                                     2239  6867 buffer_not_full:
                                     2239  6868 	.ENDM	LOG_VALUE
                                     2239  6869 
                                     2239  6870 TMSCP$PCHIST::
                                     2239  6871 	PUSHL	R1			; Save any registers used
                                     2239  6872 	MOVL	TMSCP$PCHISTCUR, R1	; Get the cell in the table
                                     2239  6873 	LOG_VALUE	4(SP)		; Save the PC.
                                     2239  6874 	MOVL	R1, TMSCP$PCHISTCUR	; Get the new table offset
                                     2239  6875 	POPL	R1			; Restore the registers
                                     2239  6876 	RSB				;  and return
                                     2239  6877 
                                     2239  6878 TMSCP$R0HIST::
                                     2239  6879 	PUSHL	R1			; Save any registers used
                                     2239  6880 	MOVL	TMSCP$PCHISTCUR, R1	; Get the cell in the table
                                     2239  6881 	LOG_VALUE	R0		; Save the value
                                     2239  6882 	MOVL	R1, TMSCP$PCHISTCUR	; Get the new table offset
                                     2239  6883 	POPL	R1			; Restore the registers
                                     2239  6884 	RSB				;  and return
                                     2239  6885 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 151
X-2A6A1                         - PC History recording                   27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (57)

                                     2239  6886 TMSCP$R3HIST::
                                     2239  6887 	PUSHL	R1			; Save any registers used
                                     2239  6888 	MOVL	TMSCP$PCHISTCUR, R1	; Get the cell in the table
                                     2239  6889 	LOG_VALUE	R3		; Save the value
                                     2239  6890 	MOVL	R1, TMSCP$PCHISTCUR	; Get the new table offset
                                     2239  6891 	POPL	R1			; Restore the registers
                                     2239  6892 	RSB				;  and return
                                     2239  6893 
                                     2239  6894 TMSCP$PCHIST_R0::
                                     2239  6895 	PUSHL	R1			; Save any registers used
                                     2239  6896 	MOVL	TMSCP$PCHISTCUR, R1	; Get the cell in the table
                                     2239  6897 	LOG_VALUE	4(SP)		; Save the PC.
                                     2239  6898 	LOG_VALUE	R0		; Save the value
                                     2239  6899 	MOVL	R1, TMSCP$PCHISTCUR	; Get the new table offset
                                     2239  6900 	POPL	R1			; Restore the registers
                                     2239  6901 	RSB				;  and return
                                     2239  6902 
                                     2239  6903 TMSCP$PCHIST_R3::
                                     2239  6904 	PUSHL	R1			; Save any registers used
                                     2239  6905 	MOVL	TMSCP$PCHISTCUR, R1	; Get the cell in the table
                                     2239  6906 	LOG_VALUE	4(SP)		; Save the PC.
                                     2239  6907 	LOG_VALUE	R3		; Save the value
                                     2239  6908 	MOVL	R1, TMSCP$PCHISTCUR	; Get the new table offset
                                     2239  6909 	POPL	R1			; Restore the registers
                                     2239  6910 	RSB				;  and return
                                     2239  6911 
                                     2239  6912 TMSCP$PCHIST_R3R0::
                                     2239  6913 	PUSHL	R1			; Save any registers used
                                     2239  6914 	MOVL	TMSCP$PCHISTCUR, R1	; Get the cell in the table
                                     2239  6915 	LOG_VALUE	4(SP)		; Save the PC.
                                     2239  6916 	LOG_VALUE	R3		; Save the value
                                     2239  6917 	LOG_VALUE	R0		; Save the value
                                     2239  6918 	MOVL	R1, TMSCP$PCHISTCUR	; Get the new table offset
                                     2239  6919 	POPL	R1			; Restore the registers
                                     2239  6920 	RSB				;  and return
                                     2239  6921 
                                     2239  6922 	.ENDC	   ;DEBUG$PC_HISTORY
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 152
X-2A6A1                         - Current Counter Sanity Test            27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (58)

                                     2239  6925 	.SBTTL	-	Current Counter Sanity Test
                                     2239  6926 	.IF DEFINED DEBUG$CURRENT_SANITY
                                     2239  6927 
                                     2239  6928 ;+
                                     2239  6929 ; Functional Description:
                                     2239  6930 ;
                                     2239  6931 ; This routine calculates the value that should be held for the first
                                     2239  6932 ; UQB in the Unit Queue Block linked list. Note that this routine is
                                     2239  6933 ; designed for the case where the first unit in the list is the one
                                     2239  6934 ; seeing the most activity.
                                     2239  6935 ;
                                     2239  6936 ; Inputs:
                                     2239  6937 ;
                                     2239  6938 ;	None
                                     2239  6939 ;
                                     2239  6940 ; Outputs:
                                     2239  6941 ;
                                     2239  6942 ;	None
                                     2239  6943 ;
                                     2239  6944 ; Implicit Outputs:
                                     2239  6945 ;
                                     2239  6946 ;	The list of Host Queue Blocks is traversed and a running count
                                     2239  6947 ; 	of currently outstanding requests from all known hosts is made.
                                     2239  6948 ; 	Then the list of Unit Queue Blocks is traversed and requests
                                     2239  6949 ; 	that are currently pending on a unit other than the target, or
                                     2239  6950 ; 	requests that are blocked are subtracted from the total above.
                                     2239  6951 ; 	If the value calculated proves to be different than that 
                                     2239  6952 ; 	maintained in the counter, the system is bug checked.
                                     2239  6953 ;-
                                     2239  6954 
                                     2239  6955 TMSCP$CHECK_CURRENT::
                                     2239  6956 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers to be used
                                     2239  6957 	CLRL	R0			; total requests - blocked
                                     2239  6958 	CLRL	R4			; sum of current counters
                                     2239  6959 	MOVL	G^SCS$GL_TMSCP,R5	; Get the TSRV address
                                     2239  6960 	MOVAL	TSRV$L_HQB_FL(R5),R1	; Get the HQB list head
                                     2239  6961 	MOVL	R1,R2			;  and save a copy away
                                     2239  6962 
                                     2239  6963 	ASSUME	HQB$L_FLINK EQ 0
                                     2239  6964 
                                     2239  6965 10$:
                                     2239  6966 	MOVL	HQB$L_FLINK(R2), R2	; Next HQB in the list
                                     2239  6967 	CMPL	R2,R1			; If this is the list head
                                     2239  6968 	BEQL	20$			;  then the list is traversed
                                     2239  6969 	ADDW	HQB$W_NUM_QUE(R2),R0	; Otherwise sum the count
                                     2239  6970 	BRB	10$			;  and loop until finished
                                     2239  6971 
                                     2239  6972 20$:
                                     2239  6973 	MOVAL	TSRV$L_UQB_FL(R5),R1	; Get the address of the UQB
                                     2239  6974 	MOVL	R1,R2			;  list head and perform the 
                                     2239  6975 
                                     2239  6976 	ASSUME	UQB$L_FLINK EQ 0
                                     2239  6977 
                                     2239  6978 30$:
                                     2239  6979 	MOVL	UQB$L_FLINK(R2), R2	;  same operation as above,
                                     2239  6980 	CMPL	R2,R1			;  looping through the list
                                     2239  6981 	BEQL	40$			;  this time decrementing the
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 153
X-2A6A1                         - Current Counter Sanity Test            27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (58)

                                     2239  6982 	SUBW	UQB$W_NUM_QUE(R2),R0	;  the total by the number of
                                     2239  6983 	ADDW	UQB$W_CURRENT(R2),R4	;  requests on the blocked queue,
                                     2239  6984 	BRB	30$			;  and summing the current counts
                                     2239  6985 
                                     2239  6986 40$:
                                     2239  6987 	CMPW	R4,R0			; Now compare the two counters,
                                     2239  6988 	BEQL	50$			;  the should be equal
                                     2239  6989 	BUG_CHECK MSCPSERV,FATAL	; If they are not lets get a dump
                                     2239  6990 
                                     2239  6991 50$:
                                     2239  6992 	POPR	#^M<R0,R1,R2,R3,R4,R5>	; Put the registers back
                                     2239  6993 	RSB				;  and return
                                     2239  6994 
                                     2239  6995 	.ENDC	   ;DEBUG$CURRENT_SANITY
                                     2239  6996 
                                     2239  6997 	.IF DEFINED DEBUG$LOG
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 154
X-2A6A1                         - Current Counter Sanity Test            27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (59)

                                     2239  6999 	.PAGE
                                     2239  7000 	.SBTTL	-	LOG_CMD_PKT - Log an MSCP command packet
                                     2239  7001 	.SBTTL	-	LOG_END_PKT - Log an MSCP end packet
                                     2239  7002 
                                     2239  7003 ;+
                                     2239  7004 ;
                                     2239  7005 ; Functional Description:
                                     2239  7006 ;
                                     2239  7007 ;	This following routines log an MSCP packet into the server's
                                     2239  7008 ;	ring buffer.  Separate entry points are provided for logging
                                     2239  7009 ;	a command packet (TMSCP$LOG_CMD_PKT), or an end packet or attention
                                     2239  7010 ;	message (TMSCP$LOG_END_PKT).
                                     2239  7011 ;
                                     2239  7012 ; Inputs: (TMSCP$LOG_CMD_PKT)
                                     2239  7013 ;
                                     2239  7014 ;	R1	Length of pkt to be logged
                                     2239  7015 ;	R2	Address of pkt to be logged
                                     2239  7016 ;	R3	HRB address
                                     2239  7017 ;	R4	CDT address
                                     2239  7018 ;
                                     2239  7019 ; Inputs: (TMSCP$LOG_END_PKT)
                                     2239  7020 ;
                                     2239  7021 ;	R1	Length of pkt to be logged
                                     2239  7022 ;	R2	Address of pkt to be logged
                                     2239  7023 ;	R3	HRB address
                                     2239  7024 ;
                                     2239  7025 ; Implicit inputs:
                                     2239  7026 ;
                                     2239  7027 ;	TSRV$L_NEXT_READ	Address of next packet to be read
                                     2239  7028 ;	TSRV$L_NEXT_WRITE	Address to write next packet
                                     2239  7029 ;	TSRV$L_LOG_BUF_START	Address of start of buffer
                                     2239  7030 ;	TSRV$L_LOG_BUF_END	Address of end of buffer
                                     2239  7031 ;	TSRV$W_INC_LOLIM	Low unit number to include
                                     2239  7032 ;	TSRV$W_INC_HILIM	High unit number to include
                                     2239  7033 ;	TSRV$W_EXC_LOLIM	Low unit number to exclude
                                     2239  7034 ;	TSRV$W_EXC_HILIM	High unit number to exclude
                                     2239  7035 ;
                                     2239  7036 ;	Status Bits in TSRV$W_STATE:
                                     2239  7037 ;
                                     2239  7038 ;	TSRV$V_PKT_LOGGED	Packet has been logged since last read
                                     2239  7039 ;	TSRV$V_PKT_LOST		One or more packets overwritten since
                                     2239  7040 ;				last read
                                     2239  7041 ;-
                                     2239  7042 
                                     2239  7043 LOG_PKT_SIZE	=	0
                                     2239  7044 
                                     2239  7045 	.ENABLE LSB
                                     2239  7046 
                                     2239  7047 TMSCP$LOG_CMD_PKT::
                                     2239  7048 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>		; Save R0-R5 due to MOVC.
                                     2239  7049 	BRB	10$				; Branch to common code.
                                     2239  7050 
                                     2239  7051 5$:
                                     2239  7052 	BRW	40$				; Not a selected unit, so
                                     2239  7053 						;  restore registers and exit.
                                     2239  7054 
                                     2239  7055 TMSCP$LOG_END_PKT::
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 155
X-2A6A1                         - Current Counter Sanity Test            27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (59)

                                     2239  7056 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>		; Save R0-R5 due to MOVC.
                                     2239  7057 	MOVL	HRB$L_HQB(R3), R3		; Get HQB address.
                                     2239  7058 	MOVL	HQB$L_CDT(R3), R4		; Get CDT address.
                                     2239  7059 
                                     2239  7060 10$:
                                     2239  7061 	MOVL	G^SCS$GL_TMSCP, R5		; Get TSRV address.
                                     2239  7062 	MOVAL	TSRV$W_INC_LOLIM(R5), R0	; Get address of range settings.
                                     2239  7063 	MOVW	MSCP$W_UNIT(R2), R3		; Get unit number.
                                     2239  7064 
                                     2239  7065 	CMPW	R3, (R0)+			; Within include range low end?
                                     2239  7066 	BLSSU	5$				; LSS means not included.
                                     2239  7067 
                                     2239  7068 	ASSUME	TSRV$W_INC_HILIM EQ 2+TSRV$W_INC_LOLIM
                                     2239  7069 
                                     2239  7070 	CMPW 	R3, (R0)+			; Within include range high end?
                                     2239  7071 	BGTRU	5$				; GTR means not included.
                                     2239  7072 
                                     2239  7073 	ASSUME	TSRV$W_EXC_LOLIM EQ 2+TSRV$W_INC_HILIM
                                     2239  7074 
                                     2239  7075 	CMPW 	R3, (R0)+			; Outside of exclude range?
                                     2239  7076 	BLSSU	15$				; LSS means NOT excluded.
                                     2239  7077 
                                     2239  7078 	ASSUME	TSRV$W_EXC_HILIM EQ 2+TSRV$W_EXC_LOLIM
                                     2239  7079 
                                     2239  7080 	CMPW	R3, (R0)+			; Within exclude range?
                                     2239  7081 	BLEQU	5$				; LEQ means excluded.
                                     2239  7082 
                                     2239  7083 15$:
                                     2239  7084 	MOVL	TSRV$L_NEXT_WRITE(R5), R0	; Get location to write pkt.
                                     2239  7085 	BBCS	#TSRV$V_PKT_LOGGED, -		; If bit was clear, buffer
                                     2239  7086 		TSRV$W_STATE(R5), 20$		;  is logically empty.
                                     2239  7087 	CMPL	R0, TSRV$L_NEXT_READ(R5)	; Check for full buffer.
                                     2239  7088 	BNEQ	20$				; Branch if buffer not full or
                                     2239  7089 						;  already clobbered.
                                     2239  7090 	BISW	#TSRV$M_PKT_LOST, -		; Else, we have wrapped around
                                     2239  7091 		TSRV$W_STATE(R5)		;  the buffer.
                                     2239  7092 
                                     2239  7093 ; Log header info to buffer
                                     2239  7094 
                                     2239  7095 20$:
                                     2239  7096 	READ_SYSTIME (R0)+			; Fill in the system time
                                     2239  7097 
                                     2239  7098 LOG_PKT_SIZE	=	LOG_PKT_SIZE + 8
                                     2239  7099 
                                     2239  7100 	MOVL	CDT$L_PB(R4), R3		; Get PB address.
                                     2239  7101 	MOVL	PB$L_SBLINK(R3), R3		; Get SB address.
                                     2239  7102 	MOVQ	SB$B_SYSTEMID(R3), (R0)+	; Fill in system id.
                                     2239  7103 
                                     2239  7104 LOG_PKT_SIZE	=	LOG_PKT_SIZE + 8
                                     2239  7105 
                                     2239  7106 	MOVW	R1, -2(R0)			; Fill in logged pkt length.
                                     2239  7107 	MOVQ	SB$T_NODENAME(R3), (R0)+	; Grab nodename, part 1.
                                     2239  7108 
                                     2239  7109 LOG_PKT_SIZE	=	LOG_PKT_SIZE + 8
                                     2239  7110 
                                     2239  7111 	MOVQ	SB$T_NODENAME+8(R3), (R0)+	; Grab nodename, part 2.
                                     2239  7112 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 156
X-2A6A1                         - Current Counter Sanity Test            27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (59)

                                     2239  7113 LOG_PKT_SIZE	=	LOG_PKT_SIZE + 8
                                     2239  7114 
                                     2239  7115 ; Actually log the packet now
                                     2239  7116 
                                     2239  7117 	MOVC5	R1,(R2),#0,#MSCP$K_LEN,(R0)	; Zero fill packet into buffer.
                                     2239  7118 
                                     2239  7119 LOG_PKT_SIZE	=	LOG_PKT_SIZE + MSCP$K_LEN
                                     2239  7120 
                                     2239  7121 ; now R3 = new address for next write
                                     2239  7122 
                                     2239  7123 	MOVL	G^SCS$GL_TMSCP, R5		; Restore TSRV address.
                                     2239  7124 	CMPL	R3, TSRV$L_LOG_BUF_END(R5)	; At end of ring buffer?
                                     2239  7125 	BLSSU	30$				; Branch if not.
                                     2239  7126 	MOVL	TSRV$L_LOG_BUF_START(R5), R3	; Else reset to beginning.
                                     2239  7127 
                                     2239  7128 30$:
                                     2239  7129 	MOVL	R3, TSRV$L_NEXT_WRITE(R5)	; Set next write address.
                                     2239  7130 
                                     2239  7131 40$:
                                     2239  7132 	POPR	#^M<R0,R1,R2,R3,R4,R5>		; Restore registers.
                                     2239  7133 	RSB
                                     2239  7134 
                                     2239  7135 	.DISABLE LSB
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 157
X-2A6A1                         - Current Counter Sanity Test            27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (60)

                                     2239  7137 	.PAGE
                                     2239  7138 	.SBTTL	Packet Logging Routines
                                     2239  7139 	.SBTTL	-	CREATE_LOG - Create log buffer
                                     2239  7140 
                                     2239  7141 ;+
                                     2239  7142 ;
                                     2239  7143 ; CREATE_LOG - Create and initialize log buffer
                                     2239  7144 ;
                                     2239  7145 ; Functional Description:
                                     2239  7146 ;
                                     2239  7147 ;	This routine allocates a ring buffer from non-paged pool
                                     2239  7148 ;	for logging MSCP packets and initializes TSRV field which
                                     2239  7149 ;	point to the buffer.
                                     2239  7150 ;
                                     2239  7151 ; Inputs:
                                     2239  7152 ;
                                     2239  7153 ;	R5	TSRV address
                                     2239  7154 ;
                                     2239  7155 ; Outputs:
                                     2239  7156 ;
                                     2239  7157 ;	R1, R2	Scratched
                                     2239  7158 ;	R0	Return status from EXE$ALONONPAGED
                                     2239  7159 ;
                                     2239  7160 ; Implicit Outputs:
                                     2239  7161 ;
                                     2239  7162 ;	TSRV$L_BUF_START	Address of start of buffer
                                     2239  7163 ;	TSRV$L_BUF_END		Address of end of buffer
                                     2239  7164 ;	TSRV$L_NEXT_READ	Address if next packet to read
                                     2239  7165 ;	TSRV$L_NEXT_WRITE	Address if next packet to write
                                     2239  7166 ;	TSRV$W_STATE		Indicates logging code is present
                                     2239  7167 ;				 and initialized
                                     2239  7168 ;	TSRV$W_INC_LOLIM	Low unit number to include
                                     2239  7169 ;	TSRV$W_INC_HILIM	High unit number to include
                                     2239  7170 ;	TSRV$W_EXC_LOLIM	Low unit number to exclude
                                     2239  7171 ;	TSRV$W_EXC_HILIM	High unit number to exclude
                                     2239  7172 ;
                                     2239  7173 ;-
                                     2239  7174 
                                     2239  7175 	$EQU	LOG_BUF_SIZE	1024*LOG_PKT_SIZE	; Bytes in history buffer.
                                     2239  7176 
                                     2239  7177 	ASSUME TSRV$W_INC_HILIM  EQ  TSRV$W_INC_LOLIM+2
                                     2239  7178 	ASSUME TSRV$W_EXC_LOLIM  EQ  TSRV$W_INC_HILIM+2
                                     2239  7179 	ASSUME TSRV$W_EXC_HILIM  EQ  TSRV$W_EXC_LOLIM+2
                                     2239  7180 
                                     2239  7181 TMSCP$CREATE_LOG::
                                     2239  7182 	ADDL3	#12, #LOG_BUF_SIZE, R1	; Get ring buffer size.
                                     2239  7183 	JSB	G^EXE$ALONONPAGED	; Attempt to allocate space.
                                     2239  7184 	BLBC	R0, 99$			; Branch if allocation failed.
                                     2239  7185 					; R2 = address / R1 = size.
                                     2239  7186 	CLRQ	(R2)+			; Clear FLINK and BLINK.
                                     2239  7187 	MOVW	R1, (R2)+		; Save size.
                                     2239  7188 	MOVZBW	#DYN$C_TSRV, (R2)+	; Set type and sub-type.
                                     2239  7189 
                                     2239  7190 	MOVL	R2,-			; Save address of start of ring buffer.
                                     2239  7191 		TSRV$L_LOG_BUF_START(R5);
                                     2239  7192 	ADDL3	#LOG_BUF_SIZE, R2,-	; Save address of end of ring buffer.
                                     2239  7193 		TSRV$L_LOG_BUF_END(R5)	;
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 158
X-2A6A1                         - Current Counter Sanity Test            27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (60)

                                     2239  7194 	MOVL	R2, TSRV$L_NEXT_READ(R5); Init read pointer.
                                     2239  7195 	MOVL	R2,- 			; Init write pointer.
                                     2239  7196 		TSRV$L_NEXT_WRITE(R5)
                                     2239  7197 
                                     2239  7198 	ASSUME	TSRV$W_INC_HILIM EQ 2+TSRV$W_INC_LOLIM
                                     2239  7199 
                                     2239  7200 	MOVL	#-1@16,-		; Set default include unit low/high
                                     2239  7201 		TSRV$W_INC_LOLIM(R5)	;  limits to include all units.
                                     2239  7202 
                                     2239  7203 	ASSUME	TSRV$W_EXC_HILIM EQ 2+TSRV$W_EXC_LOLIM
                                     2239  7204 
                                     2239  7205 	MOVZWL	#-1,-			; Set default exclude unit low/high
                                     2239  7206 		TSRV$W_EXC_LOLIM(R5)	;  limits to exclude no units.
                                     2239  7207 	MOVW	#TSRV$M_LOG_PRESENT,-	; Buffer present and accounted for, sir.
                                     2239  7208 		TSRV$W_STATE(R5)	;
                                     2239  7209 
                                     2239  7210 99$:
                                     2239  7211 	RSB
                                     2239  7212 
                                     2239  7213 	.ENDC	; DEBUG$LOG
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 159
X-2A6A1                         Read Only Length and Modifier Tables     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (61)

                                     2239  7216 	.SBTTL	Read Only Length and Modifier Tables
                                     2239  7217 
                                     2239  7218 	.ALIGN	LONG
                                     223C  7219 
                                     223C  7220 TMSCP$SERV_INFO::
                                     223C  7221 TMSCP$SERV_NAME::
20 20 20 45 50 41 54 24 50 43 53 4D  223C  7222 	.ASCII	/MSCP$TAPE       /
                        20 20 20 20  2248       
                                     224C  7223 
                                     224C  7224 ;
                                     224C  7225 
                                     224C  7226 TMSCP$COM_PKT_LEN::
            00 00 00 20 0C 10 10 00  224C  7227 	.BYTE	0*4,4*4,4*4,3*4,8*4,0*4,0*4,0
            00 00 00 00 0C 24 24 0C  2254  7228 	.BYTE	3*4,9*4,9*4,3*4,0*4,0*4,0*4,0
            00 0C 00 00 0C 0C 00 10  225C  7229 	.BYTE	4*4,0*4,3*4,3*4,0*4,0*4,3*4,0
            00 00 00 00 00 00 00 00  2264  7230 	.BYTE	0*4,0*4,0*4,0*4,0*4,0*4,0*4,0
                  14 0C 00 1C 1C 1C  226C  7231 	.BYTE	7*4,7*4,7*4,0*4,3*4,5*4
                                     2272  7232 
                                     2272  7233 ;
                                     2272  7234 
                                     2272  7235 TMSCP$END_PKT_LEN::
            00 00 00 20 2C 14 10 00  2272  7236 	.BYTE	0*4,4*4,5*4,11*4,8*4,0*4,0*4,0
            00 00 00 00 0C 2C 2C 0C  227A  7237 	.BYTE	3*4,11*4,11*4,3*4,0*4,0*4,0*4,0
            00 0C 00 00 20 0C 00 24  2282  7238 	.BYTE	9*4,0*4,3*4,8*4,0*4,0*4,3*4,0
            00 00 00 00 00 00 00 00  228A  7239 	.BYTE	0*4,0*4,0*4,0*4,0*4,0*4,0*4,0
                  20 20 00 24 24 24  2292  7240 	.BYTE	9*4,9*4,9*4,0*4,8*4,8*4
                                     2298  7241 
                                     2298  7242 ;
                                     2298  7243 
                                     2298  7244 TMSCP$MOD_TBL::
                               FFFF  2298  7245 	.WORD	^C0			;  0-unused
                               FFFF  229A  7246 	.WORD	^C0			;  1-ABORT
                               FFFF  229C  7247 	.WORD	^C0			;  2-GET COMMAND STATUS
                               FFFE  229E  7248 	.WORD	^C<-			;  3-GET UNIT STATUS
                                     22A0  7249 		MSCP$M_MD_NXUNT>	;    next unit
                               FFFF  22A0  7250 	.WORD	^C0			;  4-SET CONTROLLER CHARACTERISTICS
                               FFFF  22A2  7251 	.WORD	^C0			;  5-unused
                               FFFF  22A4  7252 	.WORD	^C0			;  6-unused
                               FFFF  22A6  7253 	.WORD	^C0			;  7-unused
                               CFCD  22A8  7254 	.WORD	^C<-			;  8-AVAILABLE
                                     22AA  7255 		MSCP$M_MD_ALLCD!-	;    all class drivers
                                     22AA  7256 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     22AA  7257 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     22AA  7258 		MSCP$M_MD_EXCAC!-	;    exclusive access
                                     22AA  7259 		MSCP$M_MD_UNLOD>	;    clear serious exception
                               CFDB  22AA  7260 	.WORD	^C<-			;  9-ONLINE
                                     22AC  7261 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     22AC  7262 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     22AC  7263 		MSCP$M_MD_STWRP!-	;    enable set write protect
                                     22AC  7264 		MSCP$M_MD_EXCAC>	;    exclusive access
                               CFDB  22AC  7265 	.WORD	^C<-			; 10-SET UNIT CHAR
                                     22AE  7266 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     22AE  7267 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     22AE  7268 		MSCP$M_MD_STWRP!-	;    enable set write protect
                                     22AE  7269 		MSCP$M_MD_EXCAC>	;    exclusive access
                               FFFF  22AE  7270 	.WORD	^C0			; 11-DETERMINE ACCESS PATH
                               FFFF  22B0  7271 	.WORD	^C0			; 12-unused
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 160
X-2A6A1                         Read Only Length and Modifier Tables     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (61)

                               FFFF  22B2  7272 	.WORD	^C0			; 13-unused
                               FFFF  22B4  7273 	.WORD	^C0			; 14-unused
                               FFFF  22B6  7274 	.WORD	^C0			; 15-unused
                               C4F7  22B8  7275 	.WORD	^C<-			; 16-ACCESS
                                     22BA  7276 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     22BA  7277 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     22BA  7278 		MSCP$M_MD_REVRS!-	;    reverse
                                     22BA  7279 		MSCP$M_MD_SCCHH!-	;    supress caching (high speed)
                                     22BA  7280 		MSCP$M_MD_SEREC!-	;    supress error recovery
                                     22BA  7281 		MSCP$M_MD_SECOR>	;    supress error correction
                               FFFF  22BA  7282 	.WORD	^C0			; 17-unused
                               CFBF  22BC  7283 	.WORD	^C<-			; 18-ERASE
                                     22BE  7284 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     22BE  7285 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     22BE  7286 		MSCP$M_MD_IMMED>	;    immediate completion
                               CFFF  22BE  7287 	.WORD	^C<-			; 19-FLUSH
                                     22C0  7288 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     22C0  7289 		MSCP$M_MD_CLSEX>	;    clear serious exception
                               FFFF  22C0  7290 	.WORD	^C0			; 20-unused
                               FFFF  22C2  7291 	.WORD	^C0			; 21-unused
                               CFBF  22C4  7292 	.WORD	^C<-			; 22-ERASE GAP
                                     22C6  7293 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     22C6  7294 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     22C6  7295 		MSCP$M_MD_IMMED>	;    immediate completion
                               FFFF  22C6  7296 	.WORD	^C0			; 23-unused
                               FFFF  22C8  7297 	.WORD	^C0			; 24-unused
                               FFFF  22CA  7298 	.WORD	^C0			; 25-unused
                               FFFF  22CC  7299 	.WORD	^C0			; 26-unesed
                               FFFF  22CE  7300 	.WORD	^C0			; 27-unused
                               FFFF  22D0  7301 	.WORD	^C0			; 28-unused
                               FFFF  22D2  7302 	.WORD	^C0			; 29-unused
                               FFFF  22D4  7303 	.WORD	^C0			; 30-unused
                               FFFF  22D6  7304 	.WORD	^C0			; 31-unused
                               C4F7  22D8  7305 	.WORD	^C<-			; 32-COMPARE HOST DATA
                                     22DA  7306 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     22DA  7307 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     22DA  7308 		MSCP$M_MD_REVRS!-	;    reverse
                                     22DA  7309 		MSCP$M_MD_SCCHH!-	;    supress caching (high speed)
                                     22DA  7310 		MSCP$M_MD_SECOR!-	;    supress error correction
                                     22DA  7311 		MSCP$M_MD_SEREC>	;    supress error recovery
                               84F7  22DA  7312 	.WORD	^C<-			; 33-READ
                                     22DC  7313 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     22DC  7314 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     22DC  7315 		MSCP$M_MD_COMP!-	;    compare
                                     22DC  7316 		MSCP$M_MD_REVRS!-	;    reverse
                                     22DC  7317 		MSCP$M_MD_SCCHH!-	;    supress caching (high speed)
                                     22DC  7318 		MSCP$M_MD_SECOR!-	;    supress error correction
                                     22DC  7319 		MSCP$M_MD_SEREC>	;    supress error recovery
                               8CAF  22DC  7320 	.WORD	^C<-			; 34-WRITE
                                     22DE  7321 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     22DE  7322 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     22DE  7323 		MSCP$M_MD_COMP!-	;    compare
                                     22DE  7324 		MSCP$M_MD_ENRWR!-	;    enable re-write error recovery
                                     22DE  7325 		MSCP$M_MD_IMMED!-	;    immediate completion
                                     22DE  7326 		MSCP$M_MD_SECOR!-	;    supress error correction
                                     22DE  7327 		MSCP$M_MD_SEREC>	;    supress error recovery
                               FFFF  22DE  7328 	.WORD	^C0			; 35-unused
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 161
X-2A6A1                         Read Only Length and Modifier Tables     27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (61)

                               CFBF  22E0  7329 	.WORD	^C<-			; 36-WRITE TAPE MARK
                                     22E2  7330 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     22E2  7331 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     22E2  7332 		MSCP$M_MD_IMMED>	;    immediate completion
                               C431  22E2  7333 	.WORD	^C<-			; 37-REPOSITION
                                     22E4  7334 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     22E4  7335 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     22E4  7336 		MSCP$M_MD_DLEOT!-	;    detect LEOT
                                     22E4  7337 		MSCP$M_MD_IMMED!-	;    immediate completion
                                     22E4  7338 		MSCP$M_MD_OBJCT!-	;    object count
                                     22E4  7339 		MSCP$M_MD_REVRS!-	;    reverse
                                     22E4  7340 		MSCP$M_MD_REWND!-	;    rewind
                                     22E4  7341 		MSCP$M_MD_SCCHH!-	;    supress caching (high speed)
                                     22E4  7342 		MSCP$M_MD_SECOR!-	;    supress error correction
                                     22E4  7343 		MSCP$M_MD_SEREC>	;    supress error recovery
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 162
X-2A6A1                         Patch Area                               27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (62)

                                     22E4  7346 	.SBTTL	Patch Area
                                     22E4  7347 
                                     22E4  7348 ;
                                     22E4  7349 ; Patch area
                                     22E4  7350 ;
                                     22E4  7351 
                           000022F0  22E4  7352 	. = <.+15>&-16
                                     22F0  7353 
                           00002370  22F0  7354 TMSCP$PATCH::	.BLKB		128
                                     2370  7355 
                           00002370  2370  7356 	. = <.+15>&-16
                                     2370  7357 
                                     2370  7358 TMSCP$END::
                                     2370  7359 	.END
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 163
Symbol table                                                             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (62)

$$$ADR                         = 000000C0                 DEV$V_SWL                      = 00000019                 
$$BASE                         = 00000008                 DEV$V_WBC                      = 0000000A                 
$$CHK                          = 00000000                 DPT$M_SMPMOD                   = 00000100                 
$$DISPL                        = 00000026                 DT$_TU78                       = 00000005                 
$$GENSW                        = 00000001                 DYN$C_CDRP                     = 00000039                 
$$HIGH                         = 00000025                 DYN$C_IRP                      = 0000000A                 
$$LEN                          = 00000000                 DYN$C_LC_MSCP                  = 00000008                 
$$LIMIT                        = 0000001D                 DYN$C_LOADCODE                 = 00000062                 
$$LOW                          = 00000008                 DYN$C_TSRV                     = 00000073                 
$$MNSW                         = 00000001                 DYN$C_TSRV_HQB                 = 00000002                 
$$MXSW                         = 00000001                 DYN$C_TSRV_HRB                 = 00000003                 
$$TMP                          = 00000000                 DYN$C_TSRV_TSRV                = 00000001                 
..SMP_FLAG..                   = 00000100                 DYN$C_TSRV_UQB                 = 00000004                 
BIT...                         = 00000003                 EXE$ALONONPAGED                  ********   X   00        
BUG$_MSCPSERV                    ********   X   00        EXE$DEANONPAGED                  ********   X   00        
CDDB$B_CNTRLMDL                = 00000026                 EXE$DEANONPGDSIZ                 ********   X   00        
CDDB$L_OLDCMDSTS               = 00000030                 EXE$GL_ABSTIM_TICS               ********   X   00        
CDDB$L_OLDRSPID                = 0000002C                 EXE$GL_ERASEPPT                  ********   X   00        
CDDB$M_DISABLED                = 00002000                 EXE$GQ_SYSTIME                   ********   X   02        
CDDB$M_NOCONN                  = 00000080                 EXE$INSIOQC                      ********   X   00        
CDDB$V_NOCONN                  = 00000007                 HARDWARE_REV                   = 00000001                 
CDDB$W_CNTRLFLGS               = 00000028                 HQB$B_STATE                    = 0000000D                 
CDDB$W_STATUS                  = 00000012                 HQB$B_SUBTYPE                  = 0000000B                 
CDRP$B_CD_TYPE                 = 0000000A                 HQB$B_TYPE                     = 0000000A                 
CDRP$B_FLCK                    = 0000000B                 HQB$K_LENGTH                   = 0000003E                 
CDRP$L_ABCNT                   = FFFFFFE0                 HQB$L_CDT                      = 00000028                 
CDRP$L_ASTPRM                  = FFFFFFB4                 HQB$L_FLINK                    = 00000000                 
CDRP$L_CDT                     = 00000024                 HQB$L_HRB_BL                   = 00000024                 
CDRP$L_FQBL                    = 00000004                 HQB$L_HRB_FL                   = 00000020                 
CDRP$L_FQFL                    = 00000000                 HQB$L_TSRV                     = 00000032                 
CDRP$L_HRB                     = FFFFFFB4                 HQB$M_V5CL                     = 00000002                 
CDRP$L_IOQFL                   = FFFFFFA0                 HQB$M_VC_FAILED                = 00000001                 
CDRP$L_LBOFF                   = 00000030                 HQB$Q_TIME                     = 00000014                 
CDRP$L_LBUFH_AD                = 0000002C                 HQB$V_DISCON_INIT              = 00000001                 
CDRP$L_MSG_BUF                 = 0000001C                 HQB$V_V5CL                     = 00000001                 
CDRP$L_RBOFF                   = 00000038                 HQB$V_VC_FAILED                = 00000000                 
CDRP$L_RBUFH_AD                = 00000034                 HQB$W_CNT_FLGS                 = 0000000E                 
CDRP$L_RSPID                   = 00000020                 HQB$W_FLAGS                    = 00000012                 
CDRP$L_RWCPTR                  = 00000028                 HQB$W_HTIMO                    = 00000010                 
CDRP$L_XCT_LEN                 = 0000003C                 HQB$W_MAX_QUE                  = 0000001E                 
CDRP$W_CDRPSIZE                = 00000008                 HQB$W_NUM_QUE                  = 0000001C                 
CDT$L_AUXSTRUC                 = 0000005C                 HQB$W_SIZE                     = 00000008                 
CDT$L_PDT                      = 00000010                 HRB$B_LBUFF                    = 00000020                 
CLU$GL_TAPE_ALLOCLS              ********   X   00        HRB$B_SUBTYPE                  = 0000000B                 
CNTRL_TIMEOUT_HSC              = 000000FF                 HRB$B_TYPE                     = 0000000A                 
CNTRL_TIMEOUT_TK50             = 00000078                 HRB$K_LENGTH                   = 00000084                 
DC$_TAPE                       = 00000002                 HRB$K_ST_DRV_WAIT              = 00000005                 
DDB$L_ALLOCLS                  = 0000003C                 HRB$K_ST_MAP_WAIT              = 00000006                 
DDB$T_NAME                     = 00000014                 HRB$K_ST_MSG_WAIT              = 00000001                 
DEV$M_CLU                      = 00000001                 HRB$K_ST_SEQ_WAIT              = 00000002                 
DEV$M_SRV                      = 00000080                 HRB$K_ST_SNDAT_WAIT            = 00000004                 
DEV$V_2P                       = 00000004                 HRB$K_ST_SNDMS_WAIT            = 00000008                 
DEV$V_AVL                      = 00000012                 HRB$L_BCNT                     = 00000046                 
DEV$V_CDP                      = 00000003                 HRB$L_BUFADR                   = 00000030                 
DEV$V_MNT                      = 00000013                 HRB$L_BUFLEN                   = 0000002C                 
DEV$V_MSCP                     = 00000005                 HRB$L_CMD_STS                  = 00000060                 
DEV$V_SRV                      = 00000007                 HRB$L_CURRENT_SKIP             = 00000068                 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 164
Symbol table                                                             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (62)

HRB$L_FLINK                    = 00000000                 IPL$_SCS                       = 00000008                 
HRB$L_HQB                      = 00000054                 IRP$B_CARCON                   = 0000003C                 
HRB$L_IRP_CDRP                 = 0000001C                 IRP$B_EFN                      = 00000022                 
HRB$L_MSGBUF                   = 00000018                 IRP$B_RMOD                     = 0000000B                 
HRB$L_OBCNT                    = 00000038                 IRP$B_TYPE                     = 0000000A                 
HRB$L_OBJECT_SKIP              = 00000064                 IRP$K_LENGTH                   = 000000A8                 
HRB$L_PDT                      = 0000005C                 IRP$L_ABCNT                    = 00000040                 
HRB$L_RECORD                   = 00000080                 IRP$L_ASTPRM                   = 00000014                 
HRB$L_RESPC                    = 0000000C                 IRP$L_BCNT                     = 00000032                 
HRB$L_SVAPTE                   = 00000040                 IRP$L_FQFL                     = 00000060                 
HRB$L_UQB                      = 00000058                 IRP$L_HRB                      = 00000014                 
HRB$L_WAIT_FL                  = 0000004C                 IRP$L_IOST1                    = 00000038                 
HRB$M_ABORT                    = 00000001                 IRP$L_IOST2                    = 0000003C                 
HRB$M_ABORTWS                  = 00000002                 IRP$L_MEDIA                    = 00000038                 
HRB$M_DEQUEUED                 = 00000004                 IRP$L_OBCNT                    = 00000044                 
HRB$M_MAP                      = 00000010                 IRP$L_PID                      = 0000000C                 
HRB$M_STATE_INVALID            = 00008000                 IRP$L_RSPID                    = 00000080                 
HRB$M_UNBLOCK                  = 00000020                 IRP$L_SEQNUM                   = 00000050                 
HRB$M_VCFAILED                 = 00000040                 IRP$L_SVAPTE                   = 0000002C                 
HRB$V_ABORT                    = 00000000                 IRP$L_UCB                      = 0000001C                 
HRB$V_ABORTWS                  = 00000001                 IRP$L_WIND                     = 00000018                 
HRB$V_DEQUEUED                 = 00000002                 IRP$M_PHYSIO                   = 00000100                 
HRB$V_MAP                      = 00000004                 IRP$M_SRVIO                    = 00004000                 
HRB$V_STATE_INVALID            = 0000000F                 IRP$W_BCNT                     = 00000032                 
HRB$V_UNBLOCK                  = 00000005                 IRP$W_BOFF                     = 00000030                 
HRB$V_VCFAILED                 = 00000006                 IRP$W_CHAN                     = 00000028                 
HRB$V_WBC_IMMED                = 00000008                 IRP$W_FUNC                     = 00000020                 
HRB$W_BOFF                     = 00000044                 IRP$W_SIZE                     = 00000008                 
HRB$W_FLAGS                    = 00000016                 IRP$W_STS                      = 0000002A                 
HRB$W_SIZE                     = 00000008                 MAX_HOSTS                      = 00000100                 
HRB$W_STATE                    = 00000014                 MAX_UNITS                      = 00000100                 
INI$BRK                          ********   X   00        MMG$GL_SPTBASE                   ********   X   00        
IO$M_CLSEREXCP                 = 00000200                 MSCP$B_BUFFER                  = 00000010                 
IO$M_DATACHECK                 = 00004000                 MSCP$B_CNT_ALCS                = 00000004                 
IO$M_INHRETRY                  = 00008000                 MSCP$B_CNT_HVR                 = 00000013                 
IO$M_MSCPMODIFS                = 00000100                 MSCP$B_CNT_SVR                 = 00000012                 
IO$M_NOWAIT                    = 00000080                 MSCP$B_FLAGS                   = 00000009                 
IO$M_REVERSE                   = 00000040                 MSCP$B_FREECAP                 = 00000026                 
IO$S_FCODE                     = 00000006                 MSCP$B_OPCODE                  = 00000008                 
IO$V_FCODE                     = 00000000                 MSCP$K_CL_CNTRL                = 00000001                 
IO$_AVAILABLE                  = 00000011                 MSCP$K_CM_EMULA                = 00000004                 
IO$_DSE                        = 00000015                 MSCP$K_LEN                     = 00000032                 
IO$_FLUSH                      = 0000002A                 MSCP$K_MIN_SIZ                 = 0000000C                 
IO$_PACKACK                    = 00000008                 MSCP$K_MXCMDLEN                = 00000024                 
IO$_READPBLK                   = 0000000C                 MSCP$K_OP_ABORT                = 00000001                 
IO$_REWIND                     = 00000024                 MSCP$K_OP_ACCES                = 00000010                 
IO$_SETMODE                    = 00000023                 MSCP$K_OP_AVAIL                = 00000008                 
IO$_SKIPFILE                   = 00000025                 MSCP$K_OP_AVATN                = 00000040                 
IO$_SKIPRECORD                 = 00000026                 MSCP$K_OP_COMP                 = 00000020                 
IO$_SPACEFILE                  = 00000002                 MSCP$K_OP_DTACP                = 0000000B                 
IO$_SPACERECORD                = 00000009                 MSCP$K_OP_END                  = 00000080                 
IO$_UNLOAD                     = 00000001                 MSCP$K_OP_ERASE                = 00000012                 
IO$_WRITECHECK                 = 0000000A                 MSCP$K_OP_ERGAP                = 00000016                 
IO$_WRITEMARK                  = 0000001C                 MSCP$K_OP_FLUSH                = 00000013                 
IO$_WRITEPBLK                  = 0000000B                 MSCP$K_OP_GTCMD                = 00000002                 
IPL$_HWCLK                     = 00000018                 MSCP$K_OP_GTUNT                = 00000003                 
IPL$_PERFMON                   = 0000000F                 MSCP$K_OP_ONLIN                = 00000009                 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 165
Symbol table                                                             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (62)

MSCP$K_OP_READ                 = 00000021                 MSCP$M_MD_CLSEX                = 00002000                 
MSCP$K_OP_REPOS                = 00000025                 MSCP$M_MD_COMP                 = 00004000                 
MSCP$K_OP_STCON                = 00000004                 MSCP$M_MD_DLEOT                = 00000080                 
MSCP$K_OP_STUNT                = 0000000A                 MSCP$M_MD_ENRWR                = 00000010                 
MSCP$K_OP_WRITE                = 00000022                 MSCP$M_MD_EXCAC                = 00000020                 
MSCP$K_OP_WRITM                = 00000024                 MSCP$M_MD_IMMED                = 00000040                 
MSCP$K_SC_ALONL                = 00000008                 MSCP$M_MD_NXUNT                = 00000001                 
MSCP$K_SC_DLATE                = 00000001                 MSCP$M_MD_OBJCT                = 00000004                 
MSCP$K_SC_DUPUN                = 00000004                 MSCP$M_MD_REVRS                = 00000008                 
MSCP$K_SC_EXUSE                = 00000010                 MSCP$M_MD_REWND                = 00000002                 
MSCP$K_SC_LGE                  = 00000000                 MSCP$M_MD_SCCHH                = 00000800                 
MSCP$K_SC_UNKNO                = 00000000                 MSCP$M_MD_SECOR                = 00000200                 
MSCP$K_SLUN_RSVP               = 00007FFF                 MSCP$M_MD_SEREC                = 00000100                 
MSCP$K_ST_ABRTD                = 00000002                 MSCP$M_MD_STWRP                = 00000004                 
MSCP$K_ST_AVLBL                = 00000004                 MSCP$M_MD_UNLOD                = 00000010                 
MSCP$K_ST_BOT                  = 0000000D                 MSCP$M_SC_NOVOL                = 00000020                 
MSCP$K_ST_CNTLR                = 0000000A                 MSCP$M_SC_RDONY                = 00001000                 
MSCP$K_ST_COMP                 = 00000007                 MSCP$M_SHADOW                  = 00008000                 
MSCP$K_ST_DATA                 = 00000008                 MSCP$M_SLUN                    = 00004000                 
MSCP$K_ST_DRIVE                = 0000000B                 MSCP$M_TF_MASK                 = 000000FF                 
MSCP$K_ST_HSTBF                = 00000009                 MSCP$M_UF_CMPRD                = 00000001                 
MSCP$K_ST_ICMD                 = 00000001                 MSCP$M_UF_CMPWR                = 00000002                 
MSCP$K_ST_LED                  = 00000013                 MSCP$M_UF_SCCHH                = 00000800                 
MSCP$K_ST_MFMTE                = 00000005                 MSCP$M_UF_VSMSU                = 00000020                 
MSCP$K_ST_OFFLN                = 00000003                 MSCP$M_UF_WBKNV                = 00000040                 
MSCP$K_ST_PLOST                = 00000011                 MSCP$M_UF_WRTPD                = 00000100                 
MSCP$K_ST_PRESE                = 00000012                 MSCP$M_UF_WRTPH                = 00002000                 
MSCP$K_ST_RDTRN                = 00000010                 MSCP$M_UF_WRTPS                = 00001000                 
MSCP$K_ST_SUCC                 = 00000000                 MSCP$Q_CNT_ID                  = 00000014                 
MSCP$K_ST_TAPEM                = 0000000E                 MSCP$Q_UNIT_ID                 = 00000014                 
MSCP$K_ST_WRTPR                = 00000006                 MSCP$V_CF_MLTHS                = 00000002                 
MSCP$K_TC_9TR                  = 00000100                 MSCP$V_MD_CDATL                = 0000000C                 
MSCP$K_TC_CTP                  = 00000200                 MSCP$V_MD_CLSEX                = 0000000D                 
MSCP$K_TC_HPC                  = 00000300                 MSCP$V_MD_COMP                 = 0000000E                 
MSCP$K_TC_OLD                  = 00000000                 MSCP$V_MD_DLEOT                = 00000007                 
MSCP$K_TC_WOD                  = 00000400                 MSCP$V_MD_IMMED                = 00000006                 
MSCP$L_BYTE_CNT                = 0000000C                 MSCP$V_MD_NXUNT                = 00000000                 
MSCP$L_CMD_REF                 = 00000000                 MSCP$V_MD_OBJCT                = 00000002                 
MSCP$L_CMD_STS                 = 00000010                 MSCP$V_MD_REVRS                = 00000003                 
MSCP$L_DEV_PARM                = 0000001C                 MSCP$V_MD_REWND                = 00000001                 
MSCP$L_MAXBCNT                 = 0000001C                 MSCP$V_MD_SEREC                = 00000008                 
MSCP$L_MAXWTREC                = 00000024                 MSCP$V_MD_STWRP                = 00000002                 
MSCP$L_MEDIA_ID                = 0000001C                 MSCP$V_MD_UNLOD                = 00000004                 
MSCP$L_OUT_REF                 = 0000000C                 MSCP$V_SLUN                    = 0000000E                 
MSCP$L_POSITION                = 0000001C                 MSCP$V_ST_SBCOD                = 00000005                 
MSCP$L_RCSKIPED                = 0000000C                 MSCP$V_TF_800                  = 00000000                 
MSCP$L_REC_CNT                 = 0000000C                 MSCP$V_TF_BHD                  = 00000001                 
MSCP$L_TAPEREC                 = 00000020                 MSCP$V_TF_BLK                  = 00000003                 
MSCP$L_TMGP_CNT                = 00000010                 MSCP$V_TF_EDC                  = 00000003                 
MSCP$L_TMSKIPED                = 00000010                 MSCP$V_TF_ENH                  = 00000001                 
MSCP$M_CF_MLTHS                = 00000004                 MSCP$V_TF_GCR                  = 00000002                 
MSCP$M_EF_DLS                  = 00000002                 MSCP$V_TF_NDC                  = 00000002                 
MSCP$M_EF_EOT                  = 00000008                 MSCP$V_TF_NOR                  = 00000000                 
MSCP$M_EF_PLS                  = 00000004                 MSCP$V_TF_PE                   = 00000001                 
MSCP$M_EF_SEREX                = 00000010                 MSCP$V_UF_SCCHH                = 0000000B                 
MSCP$M_MD_ALLCD                = 00000002                 MSCP$V_UF_WBKNV                = 00000006                 
MSCP$M_MD_CDATL                = 00001000                 MSCP$V_UF_WRTPD                = 00000008                 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 166
Symbol table                                                             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (62)

MSCP$V_UF_WRTPH                = 0000000D                 SCS$GB_SYSTEMID                  ********   X   00        
MSCP$W_CNT_FLGS                = 0000000E                 SCS$GL_CDL                       ********   X   00        
MSCP$W_CNT_TMO                 = 00000010                 SCS$GL_TMSCP                     ********   X   00        
MSCP$W_FORMAT                  = 00000020                 SCS$GL_TMSCP_MV                  ********   X   00        
MSCP$W_FORMENU                 = 00000024                 SCS$GQ_DIRECT                    ********   X   00        
MSCP$W_HST_TMO                 = 00000010                 SCS$LISTEN                       ********  G    02        
MSCP$W_MODIFIER                = 0000000A                 SCS$LKP_MSGWAIT                  ********   X   00        
MSCP$W_MULT_UNT                = 0000000C                 SCS$LKP_RDTCDRP                  ********   X   00        
MSCP$W_NOISEREC                = 00000028                 SCS$LKP_RDTWAIT                  ********   X   00        
MSCP$W_SPEED                   = 00000022                 SCS$T_DST_PROC                 = 00000004                 
MSCP$W_STATUS                  = 0000000A                 SERVER_TIMEOUT                 = 000000FF                 
MSCP$W_UNIT                    = 00000004                 SIZ...                         = 00000001                 
MSCP$W_UNT_FLGS                = 0000000E                 SLV$K_SDATA                    = 00000004                 
MSCP$W_VERSION                 = 0000000C                 SMP$ACQUIRE                      ********   X   02        
MT$K_BLK_1250                  = 00000012                 SMP$GL_FLAGS                     ********   X   02        
MT$K_BLK_833                   = 00000011                 SMP$RELEASE                      ********   X   02        
MT$K_GCR_6250                  = 00000005                 SMP$RESTORE                      ********   X   02        
MT$K_HPC_40K                   = 0000000C                 SMP$V_ENABLED                  = 00000000                 
MT$K_HPC_COMP                  = 0000000D                 SOFTWARE_REV                   = 00000006                 
MT$K_NRZI_800                  = 00000003                 SPL$C_HWCLK                    = 00000023                 
MT$K_PE_1600                   = 00000004                 SPL$C_PERFMON                  = 00000026                 
MT$K_SPEED_25                  = 00000019                 SPL$C_SCS                      = 00000034                 
MT$K_SPEED_75                  = 0000004B                 SS$_ABORT                      = 0000002C                 
MT$K_WOD_6250                  = 00000008                 SS$_BADPARAM                   = 00000014                 
MT$K_XPC_80K                   = 0000000E                 SS$_BUGCHECK                   = 000002A4                 
MT$K_XPC_COMP                  = 0000000F                 SS$_CTRLERR                    = 00000054                 
MT$S_DENSITY                   = 00000005                 SS$_DATACHECK                  = 0000005C                 
MT$S_SPEED                     = 00000008                 SS$_DATALATE                   = 00002274                 
MT$V_BOT                       = 00000010                 SS$_DATALOST                   = 000022E4                 
MT$V_DENSITY                   = 00000008                 SS$_DATAOVERUN                 = 00000838                 
MT$V_SPEED                     = 00000018                 SS$_DEVICEFULL                 = 00000850                 
MT2$M_RDC_DISABLE              = 00020000                 SS$_DEVNOTDISM                 = 000021B4                 
MT2$M_WBC_ENABLE               = 00010000                 SS$_DEVOFFLINE                 = 00000084                 
OVERLAY_AREA                   = 00000040                 SS$_DRVERR                     = 0000008C                 
PDT$L_ALLOCMSG                 = 00000014                 SS$_DUPUNIT                    = 000021C4                 
PDT$L_DEALLOMSG                = 00000020                 SS$_ENDOFFILE                  = 00000870                 
PDT$L_DEALRGMSG                = 00000024                 SS$_ENDOFTAPE                  = 00000878                 
PDT$L_MAP                      = 0000002C                 SS$_ENDOFVOLUME                = 000009A0                 
PDT$L_RCLMSGBUF                = 00000048                 SS$_FORMAT                     = 000000BC                 
PDT$L_REJECT                   = 0000004C                 SS$_ILLIOFUNC                  = 000000F4                 
PDT$L_REQDATA                  = 00000050                 SS$_INSFMEM                    = 00000124                 
PDT$L_SENDDATA                 = 00000054                 SS$_IVBUFLEN                   = 0000034C                 
PDT$L_SNDCNTMSG                = 00000060                 SS$_MEDOFL                     = 000001A4                 
PDT$L_UNMAP                    = 00000064                 SS$_NORMAL                     = 00000001                 
PMS$END_RQ                       ********   X   00        SS$_OPINCOMPL                  = 000002D4                 
PMS$GL_IOPFMPDB                  ********   X   00        SS$_PARITY                     = 000001F4                 
PMS$GL_IOPFMSEQ                  ********   X   00        SS$_SERIOUSEXCP                = 000021D4                 
PMS$START_RQ                     ********   X   00        SS$_TAPEPOSLOST                = 00000224                 
PR$_IPL                        = 00000012                 SS$_TIMEOUT                    = 0000022C                 
PRMSW                          = 00000001                 SS$_VOLINV                     = 00000254                 
PRT$C_ER                       = 00000007                 SS$_WRITLCK                    = 0000025C                 
PRT$C_EW                       = 00000005                 TABLE$$$END                    = 00002153 R     02        
SCS$ACCEPT                       ********  G    02        TABLE$$$SIZE                   = 00000002                 
SCS$ALLOC_RSPID                  ********   X   00        TABLE$$$START                  = 00002151 R     02        
SCS$B_CON_DAT                  = 00000024                 TABLE_SECTIONS                 = 00000005                 
SCS$DEALL_RSPID                  ********   X   00        TMSCP$ABORT                      00000E46 RG    02        
SCS$DISCONNECT                   ********   X   00        TMSCP$ABORT_READ                 000018DE RG    02        
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 167
Symbol table                                                             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (62)

TMSCP$ABORT_UNHOOK_CDRP          000020AF RG    02        TMSCP$MSG_IN                     00000D86 RG    02        
TMSCP$ABORT_WRITE                00001A8D RG    02        TMSCP$MV_SET_OFFLINE             00000AB5 RG    02        
TMSCP$ACCESS                     000014EF RG    02        TMSCP$M_DBG_MSG_IN             = 00000002                 
TMSCP$ADD                        0000084A RG    02        TMSCP$M_DBG_SEND_PKT           = 00000004                 
TMSCP$ALLOCATE                   00001A9F RG    02        TMSCP$M_DBG_START              = 00000001                 
TMSCP$ALLOCATE_HRB               00001C47 RG    02        TMSCP$NEW_DEVICE                 0000094B RG    02        
TMSCP$ANCILLARY_TABLE            00001F4C RG    02        TMSCP$NOMEM                      000009E5 RG    02        
TMSCP$ANCILLARY_TABLE_LEN      = 00000006                 TMSCP$NORMAL                     00000943 RG    02        
TMSCP$AVAILABLE                  00001258 RG    02        TMSCP$NOSERV                     00000943 RG    02        
TMSCP$BACK                       00001BC5 RG    02        TMSCP$NOTSHR                     000009DB RG    02        
TMSCP$BAD_FLAGS                  00000E2B RG    02        TMSCP$NO_MEM                     00000D79 RG    02        
TMSCP$BAD_LEN                    00000E1F RG    02        TMSCP$NO_ROOM                    00000BC5 RG    02        
TMSCP$BAD_MOD                    00000E24 RG    02        TMSCP$ONLINE                     000012FA RG    02        
TMSCP$BAD_OPC                    00000E18 RG    02        TMSCP$PACKET_ERROR               000020A0 RG    02        
TMSCP$BAD_UNIT                   00001FDA RG    02        TMSCP$PATCH                      000022F0 RG    02        
TMSCP$BEGIN                      00000000 RG    02        TMSCP$READ                       00001796 RG    02        
TMSCP$BLOCK_SEREX                00001AE6 RG    02        TMSCP$READ_TRANSFER              000017DE RG    02        
TMSCP$BLOCK_SEREX_LEN          = 0000000C                 TMSCP$RECORD_COMMON              00001462 RG    02        
TMSCP$CHECK_XFER_STATUS          00001DFD RG    02        TMSCP$RECOVERABLE_ERROR          00001F52 RG    02        
TMSCP$CLEANUP_AND_START_NEXT     00002097 RG    02        TMSCP$REJECT                     00000BCE RG    02        
TMSCP$CLEANUP_HRB                00001CE2 RG    02        TMSCP$REJECT_CONNECTION          00000BC5 RG    02        
TMSCP$COMMON_TRANSFER            00001B08 RG    02        TMSCP$REJECT_REQUEST             00000BC5 RG    02        
TMSCP$COMPARE_HOST_DATA          000014F6 RG    02        TMSCP$REPOSITION                 000015E9 RG    02        
TMSCP$COM_PKT_LEN                0000224C RG    02        TMSCP$RESTOR                     00000946 RG    02        
TMSCP$CREATE_UQB                 000009ED RG    02        TMSCP$SEND_END                   00001FDE RG    02        
TMSCP$C_DEBUG_FLAGS              ********W G    02        TMSCP$SEND_PKT                   0000201F RG    02        
TMSCP$DEALLOC_HQB                000020D2 RG    02        TMSCP$SEQUENTIAL                 0000116D RG    02        
TMSCP$DET_ACC_PATH               000014E9 RG    02        TMSCP$SEQ_ALT                    00001176 RG    02        
TMSCP$DO_WRT                     00001964 RG    02        TMSCP$SEQ_STALL                  00001D91 RG    02        
TMSCP$DRIVE_CHECK                00001AFE RG    02        TMSCP$SERV_INFO                  0000223C RG    02        
TMSCP$DRIVE_TRANSFER             00001AF2 RG    02        TMSCP$SERV_NAME                  0000223C RG    02        
TMSCP$END                        00002370 RG    02        TMSCP$SET_CLEAR_CDL              00001228 RG    02        
TMSCP$END_PKT_LEN                00002272 RG    02        TMSCP$SET_CLEAR_SEX              000011D3 RG    02        
TMSCP$ERASE                      000014FC RG    02        TMSCP$SET_CONTROLLER_CHAR        000010C8 RG    02        
TMSCP$ERASE_GAP                  000015E3 RG    02        TMSCP$SET_IMMED                  000011FE RG    02        
TMSCP$ERROR_NO_UNIT              0000209A RG    02        TMSCP$SET_SEX                    00001F46 RG    02        
TMSCP$ERR_DLS                    00001F1F RG    02        TMSCP$SET_UNIT_CHAR              000013A8 RG    02        
TMSCP$ERR_EOF                    00001F30 RG    02        TMSCP$SPEEDTOMSCP                000021D8 RG    02        
TMSCP$ERR_EOT                    00001EEA RG    02        TMSCP$START                      0000077D RG    02        
TMSCP$ERR_LEOT                   00001F15 RG    02        TMSCP$TU_ABSDENS                 000020FD RG    02        
TMSCP$ERR_OFFLINE                00001EC8 RG    02        TMSCP$TU_ABSPEED                 0000215B RG    02        
TMSCP$ERR_PLOST                  00001EFF RG    02        TMSCP$TU_VMSDENS                 000020F7 RG    02        
TMSCP$ERR_TBL                    00001E2C RG    02        TMSCP$UNBLOCK                    00001DB6 RG    02        
TMSCP$ERR_WRITLCK                00001EDD RG    02        TMSCP$UNHOOK_CDRP                000020B6 RG    02        
TMSCP$FIND_SECTION               000021B0 RG    02        TMSCP$VC_ERR                     00000BD6 RG    02        
TMSCP$FIND_UQB                   00001F6B RG    02        TMSCP$VC_ERR_ABORT               00000BD5 RG    02        
TMSCP$FLUSH                      00001765 RG    02        TMSCP$VMSTOMSCP_DENS             00002167 RG    02        
TMSCP$FULL                       000009D1 RG    02        TMSCP$V_DBG_MSG_IN             = 00000001                 
TMSCP$GET_COMMAND_STATUS         00000EFE RG    02        TMSCP$V_DBG_SEND_PKT           = 00000002                 
TMSCP$GET_UNIT_STATUS            00000F79 RG    02        TMSCP$V_DBG_START              = 00000000                 
TMSCP$IMMEDIATE                  00000E32 RG    02        TMSCP$WRITE                      00001951 RG    02        
TMSCP$INIT                       00000770 RG    02        TMSCP$WRITE_TAPE_MARK            000018F0 RG    02        
TMSCP$LISTEN                     00000B16 RG    02        TMSCP$WRITE_TRANSFER             000019A1 RG    02        
TMSCP$L_DEBUG_FLAGS              0000076C RG    02        TSRV$B_SUBTYPE                 = 0000000B                 
TMSCP$MOD_TBL                    00002298 RG    02        TSRV$B_TYPE                    = 0000000A                 
TMSCP$MSCPTOSPEED                00002200 RG    02        TSRV$K_AR_ADD                  = 00000002                 
TMSCP$MSCPTOVMS_DENS             00002196 RG    02        TSRV$K_AR_START                = 00000001                 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 168
Symbol table                                                             27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (62)

TSRV$K_LENGTH                  = 0000076C                 UQB$L_POSITION                 = 000000C4                 
TSRV$L_BLKCOUNT                = 00000568                 UQB$L_SERV_RSPID               = 000000A0                 
TSRV$L_HQB_BL                  = 00000064                 UQB$L_UCB                      = 00000024                 
TSRV$L_HQB_FL                  = 00000060                 UQB$M_ONLINE                   = 00000008                 
TSRV$L_OPCOUNT                 = 000004C4                 UQB$M_SEQ                      = 00000001                 
TSRV$L_UNITS                   = 000000C4                 UQB$M_ST_BOT                   = 00000001                 
TSRV$L_UQB_BL                  = 0000006C                 UQB$M_ST_DLS                   = 00000002                 
TSRV$L_UQB_FL                  = 00000068                 UQB$M_ST_EOT                   = 00000004                 
TSRV$L_VCFAIL_CNT              = 00000564                 UQB$M_ST_LEOT                  = 00000008                 
TSRV$Q_CTRL_ID                 = 00000044                 UQB$M_ST_SEREX                 = 00000020                 
TSRV$W_CFLAGS                  = 0000003E                 UQB$M_ST_WRTPH                 = 00000040                 
TSRV$W_NUM_HOST                = 0000005C                 UQB$Q_UNIT_ID                  = 00000018                 
TSRV$W_NUM_UNIT                = 0000005E                 UQB$S_C                        = 00000005                 
TSRV$W_SIZE                    = 00000008                 UQB$S_D0                       = 00000005                 
TSRV$W_VERSION                 = 0000003C                 UQB$S_D1                       = 00000005                 
UCB$B_DEVCLASS                 = 0000004C                 UQB$V_C                        = 00000000                 
UCB$B_DEVTYPE                  = 0000004D                 UQB$V_D0                       = 0000000A                 
UCB$B_ONLCNT                   = 000000C2                 UQB$V_D1                       = 00000005                 
UCB$L_2P_CDDB                  = 000000DC                 UQB$V_SEQ                      = 00000000                 
UCB$L_CDDB                     = 000000D8                 UQB$V_ST_DLS                   = 00000001                 
UCB$L_DDB                      = 0000002C                 UQB$V_ST_EOT                   = 00000002                 
UCB$L_DEVCHAR                  = 0000003C                 UQB$V_ST_LEOT                  = 00000003                 
UCB$L_DEVCHAR2                 = 00000040                 UQB$V_ST_PLS                   = 00000004                 
UCB$L_DEVDEPEND                = 00000050                 UQB$V_ST_SEREX                 = 00000005                 
UCB$L_DEVDEPND2                = 00000054                 UQB$W_CURRENT                  = 00000012                 
UCB$L_MAXBCNT                  = 000000C8                 UQB$W_DEVNAME                  = 0000001E                 
UCB$L_MEDIA_ID                 = 000000A0                 UQB$W_FLAGS                    = 0000000E                 
UCB$L_MSCPDEVPARAM             = 00000100                 UQB$W_MAX_IO                   = 000000BA                 
UCB$L_RECORD                   = 000000C4                 UQB$W_MAX_QUE                  = 0000002A                 
UCB$L_STS                      = 00000078                 UQB$W_MULT_UNIT                = 00000014                 
UCB$L_TU_MAXWRCNT              = 0000010C                 UQB$W_NUM_IO                   = 000000B8                 
UCB$V_MNTVERIP                 = 0000000E                 UQB$W_NUM_QUE                  = 00000028                 
UCB$V_ONLINE                   = 00000004                 UQB$W_QLEN                     = 0000005C                 
UCB$W_QLEN                     = 0000007E                 UQB$W_RECORD_SKIP              = 000000AE                 
UCB$W_RWAITCNT                 = 0000006A                 UQB$W_SIZE                     = 00000008                 
UCB$W_STS                      = 00000078                 UQB$W_SLUN                     = 0000005E                 
UCB$W_TU_FORMAT                = 00000110                 UQB$W_STATE                    = 0000000C                 
UCB$W_TU_FORMENU               = 00000054                 UQB$W_ST_FLAGS                 = 000000C8                 
UCB$W_TU_NOISE                 = 00000114                 UQB$W_TAPEM_SKIP               = 000000AC                 
UCB$W_TU_SPEED                 = 00000112                 UQB$W_UNIT                     = 0000001C                 
UCB$W_UNIT                     = 00000068                 UQB$W_UNIT_FLAGS               = 00000016                 
UCB$W_UNIT_FLAGS               = 000000FA                 VA$M_BYTE                      = 000001FF                 
UQB                            = 00000008                 VA$S_VPN                       = 00000015                 
UQB$B_SUBTYPE                  = 0000000B                 VA$V_VPN                       = 00000009                 
UQB$B_TYPE                     = 0000000A                 VERSION                        = 00000000                 
UQB$K_LENGTH                   = 000000CA                 WRITABLE_UNIT_FLAGS            = 00001863                 
UQB$K_ST_AVAILABLE             = 00000004                 
UQB$K_ST_OFFLINE               = 00000003                 
UQB$K_ST_ONLINE                = 00000002                 
UQB$L_ALLOCLS                  = 00000018                 
UQB$L_BLOCKED_BL               = 00000030                 
UQB$L_BLOCKED_FL               = 0000002C                 
UQB$L_CLASS_RSPID              = 000000A4                 
UQB$L_FLINK                    = 00000000                 
UQB$L_IOCNT                    = 00000058                 
UQB$L_OLD_CLSSTS               = 000000A8                 
UQB$L_ONLINE_HQB               = 00000070                 
TMSCP                           - TMSCP Server - Emulator                10-SEP-1992 13:57:44  VAX MACRO V5.4-3            Page 169
Psect synopsis                                                           27-AUG-1992 15:59:41  [MSCP.SRC]TMSCP.MAR;1            (62)


                                                +----------------+
                                                ! Psect synopsis !
                                                +----------------+

PSECT name                      Allocation          PSECT No.  Attributes     
----------                      ----------          ---------  ----------     
.  ABS  .                       00000000  (    0.)  00 (  0.)  NOPIC   USR   CON   ABS   LCL NOSHR NOEXE NORD  NOWRT NOVEC BYTE  
$ABS$                           00000000  (    0.)  01 (  1.)  NOPIC   USR   CON   ABS   LCL NOSHR   EXE   RD    WRT NOVEC BYTE  
$$$100_TMSCP_VECTOR_TABLE       00002370  ( 9072.)  02 (  2.)  NOPIC   USR   CON   REL   LCL NOSHR   EXE   RD    WRT NOVEC QUAD  

                                             +------------------------+
                                             ! Performance indicators !
                                             +------------------------+

Phase                    Page faults    CPU Time       Elapsed Time   
-----                    -----------    --------       ------------   
Initialization                  178     00:00:00.07    00:00:00.54
Command processing              975     00:00:00.32    00:00:00.74
Pass 1                         2143     00:00:13.88    00:00:16.08
Symbol table sort                 1     00:00:01.14    00:00:01.27
Pass 2                          362     00:00:03.61    00:00:06.58
Symbol table output               0     00:00:00.09    00:00:00.30
Psect synopsis output             2     00:00:00.00    00:00:00.00
Cross-reference output            0     00:00:00.00    00:00:00.00
Assembler run totals           3681     00:00:19.13    00:00:25.51

The working set limit was 4562 pages.
630660 bytes (1232 pages) of virtual memory were used to buffer the intermediate code.
There were 370 pages of symbol table space allocated to hold 6036 non-local and 277 local symbols.
7359 source lines were read in Pass 1, producing 38 object records in Pass 2.
100 pages of virtual memory were used to define 81 macros.

                                            +--------------------------+
                                            ! Macro library statistics !
                                            +--------------------------+

Macro library name                           Macros defined      
------------------                           --------------      
X5IJ_2S9_RESD$:[SYS.OBJ]LIB.MLB;1                      51        
X5IJ_2S9_RESD$:[SYSLIB]STARLET.MLB;3                   15        
TOTALS (all libraries)                                 66        

6588 GETS were required to define 66 macros.

There were no errors, warnings or information messages.

MACRO/LIS=LIS$:TMSCP/OBJ=OBJ$:TMSCP TMP$:TMSCP.MAR+EXECML$/LIB
