TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page   0
Table of contents

    (1)        2        Copyright and History
    (2)      260        Data Structure Definitions
    (3)      336        Data Structure Connection Diagrams.
    (5)      413        External References
    (6)      449        Select the TMSCP server timeout.
    (7)      471        Local Storage
    (8)      543        Define the Field Access Macros.
    (9)      757        Server Action Routines
    (10)     788        -	START  -  Initialization Routine
    (11)     929        -	ADD - Add a Tape Unit
    (12)    1143        -	NEW_DEVICE - Serve a new DSA device unit
    (13)    1384        -	MV_SET_OFFLINE - Mount Verification set a device to the "offline" state.
    (14)    1451        -	LISTEN - Listen for a Connect Request
    (15)    1591        -	Virtual Circuit Error Routine
    (16)    1944        Main Line Routine
    (17)    2115        IMMEDIATE class commands
    (18)    2159        -	ABORT					(- 1 -)
    (19)    2311        -	GET COMMAND STATUS			(- 2 -)
    (20)    2449        -	GET UNIT STATUS				(- 3 -)
    (21)    2667        -	SET CONTROLLER CHARACTERISTICS		(- 4 -)
    (22)    2759        SEQUENTIAL class commands
    (23)    2870        -	SET_CLEAR_SEX
    (24)    2912        -	SET_IMMED
    (25)    2954        -	SET_CLEAR_CDL
    (26)    2998        -	AVAILABLE				(- 8 -)
    (27)    3164        -	ONLINE					(- 9 -)
    (28)    3327        -	SET UNIT CHARACTERISTICS		(- 10 -)
    (29)    3552        -	DETERMINE ACCESS PATHS			(- 11 -)
    (30)    3590        -	ACCESS					(- 16 -)
    (31)    3624        -	COMPARE HOST DATA			(- 32 -)
    (32)    3662        -	ERASE					(- 18 -)
    (33)    3869        -	ERGAP
    (34)    3905        -	REPOSITION
    (35)    4244        -	FLUSH					(- 19 -)
    (36)    4319        -	READ					(- 33 -)
    (37)    4613        -	WRITE_TAPE_MARK
    (38)    4718        -	WRITE					(- 34 -)
    (39)    4995        Utility Routines
    (39)    4996        -	ALLOCATE - Allocate a local buffer for the request
    (40)    5067        -	SEND_IRP -  prepare and issue an I/O to a tape
    (40)    5068        -	DRIVE_TRANSFER -  prepare and issue read/write type I/O
    (40)    5069        -	DRIVE_CHECK -  prepare and issue ONLINE, AVAIL, SUC, and FLUSH
    (41)    5219        -	BACK  -  return from tape I/O and continue
    (42)    5327        -	ALLOCATE_HRB -  Host Request Block Allocation
    (43)    5459        -	CLEANUP_HRB -  Host Request Resource Deallocation
    (44)    5617        -	UNBLOCK - Restart Any Blocked Commands
    (44)    5618        -	SEQ_STALL - Synchronize Sequential Commands
    (45)    5779        -	CHECK_XFER_STATUS - Translate the class driver message to a MSCP message
    (46)    6114        -	FIND UQB - Find the UQB corresponding to this request
    (47)    6243        -	SEND END - Respond To The Request
    (48)    6426        -	UNHOOK CDRP - Action routine to dequeue CDRP's
    (49)    6501        -	DEALLOCATE HQB - Remove an HQB if there are no requests 
    (50)    6574        Macros for Density Tables
    (51)    6647        Density and Speed Conversion Tables
    (52)    6717        Density Conversion Routines
    (52)    6718        .   TMSCP$VMSTOMSCP_DENS
    (53)    6770        .   TMSCP$MSCPTOVMS_DENS
    (54)    6803        .   TMSCP$FIND_SECTION
    (55)    6844        Speed Conversion Routines
    (55)    6845        .   TMSCP$SPEEDTOMSCP
    (56)    6884        .   TMSCP$MSCPTOSPEED
    (57)    6933        Debugging Routines
    (57)    6934        -	PC History recording
    (58)    7029        -	Current Counter Sanity Test
    (61)    7342        Read Only Length and Modifier Tables
    (62)    7472        Patch Area
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page   1
X-17                                                                     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (1)

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

                                     0000    58 ;	X-17   MAS0003		Michael A. Stams		22-Nov-1992
                                     0000    59 ;		Change behavior of TMSCP$ALLOCATE to return SS$_INSFMEM 
                                     0000    60 ;		when SS$_INSFMEM is returned by EXE$ALONONPAGED.
                                     0000    61 ; 		
                                     0000    62 ;		Change TMSCP$DO_WRT and TMSCP$READ to send end
                                     0000    63 ;		message "Controller Error - Controller memory error"
                                     0000    64 ;		when the call to TMSCP$ALLOCATE fails to "get" memory.  
                                     0000    65 ;
                                     0000    66 ;		NOTE: The use of MSCP$L_BYTE_CNT and MSCP$L_TAPEREC are
                                     0000    67 ;		      not per spec, they are swapped. this is historical.
                                     0000    68 ;
                                     0000    69 ;	X-16	MAS0002		Michael A. Stams		 5-Nov-1992
                                     0000    70 ;		Clear HRB$L_WAIT_FL after REMQUE. This allows for VC_ERR to
                                     0000    71 ;		recover correctly when I/O is in progress.
                                     0000    72 ;
                                     0000    73 ;	X-15	MAS0001		Michael A. Stams		26-Oct-1992
                                     0000    74 ;		Modify TMSCP$ERR_EOF to update tape position in MSCP end
                                     0000    75 ;		message. We were returning state data.
                                     0000    76 ;
                                     0000    77 ;		Correct MSCP packet logging code (bring inline with 
                                     0000    78 ;		[MSCP]MSCP.MAR). We were logging "short" packets. 
                                     0000    79 ;
                                     0000    80 ;	X-14	MGB0001		Michael Beeler			31-Aug-1992
                                     0000    81 ;		Save/restore registers used by memory allocation/deallocation 
                                     0000    82 ;		routines.
                                     0000    83 ;
                                     0000    84 ;	X-13	JSSTS0036	John S. Simakauskas		11-July-1992
                                     0000    85 ;		In ABORT routine, add missing # to BBS HRB$V_STATE_INVALID.
                                     0000    86 ;	
                                     0000    87 ;	X-12	JSSTS0034	John S. Simakauskas		12-June-1992
                                     0000    88 ;		Add TMSCPSERv bugcheck. We were using MSCPSERV bugcheck code.
                                     0000    89 ;
                                     0000    90 ;	X-11	JSSTS0032	John S. Simakauskas		22-May-1992
                                     0000    91 ;		The value stored in the UQB UNIT FLAGS field was not 
                                     0000    92 ;		properly maintained and would return stale data. Update the 
                                     0000    93 ;		code to refresh this field when a packet containing
                                     0000    94 ;		the unit flags is returned to a client.
                                     0000    95 ;
                                     0000    96 ;	X-10	JSSTS0031	John S. Simakauskas		14-May-1992
                                     0000    97 ;		MSCP X-33	BP_MSCP	Brian Porter	04-MAY-1992
                                     0000    98 ;		Zero CDT address when removing CDRP's from queue
                                     0000    99 ;		structures in UNHOOK_CDRP.
                                     0000   100 ;		Zero flink and blink of CDRP after removal from queue.
                                     0000   101 ;
                                     0000   102 ;	X-9	JSSTS0030F	John S. Simakauskas		28-Apr-1992
                                     0000   103 ;		close fold
                                     0000   104 ;		X-2A6	JSSTS0030	John S.Simakauskas		7-Apr-1992
                                     0000   105 ;		Correct the UQB$W_NUM_QUE counter handling when aborting
                                     0000   106 ;		sequential commands. Previously it was possible for this
                                     0000   107 ;		counter to be decremented twice for a request.
                                     0000   108 ;
                                     0000   109 ;	X-8	BP4282		Brian Porter		04-FEB-1992
                                     0000   110 ;		Use an ADAWI to increment or decrement UCB$W_QLEN.
                                     0000   111 ;
                                     0000   112 ;	X-7	JSSTS0023F	John S. Simakauskas		23-Jan-1991
                                     0000   113 ;		Close fold -> BLADE
                                     0000   114 ;		disable logging
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page   3
X-17                            Copyright and History                    16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (1)

                                     0000   115 ;
                                     0000   116 ;	X-6 	JSSTS0021F	John S. Simakauskas		16-Jan-1991
                                     0000   117 ;		close fold
                                     0000   118 ;		Fix order of register restoration in UNBLOCK.
                                     0000   119 ;
                                     0000   120 ;	X-5 FOLD->BLADE
                                     0000   121 ;	X-5	JSSTS0016	John S. Simakauskas		25-Oct-1991
                                     0000   122 ;		Change VC failure handling in the UNBLOCK routine.
                                     0000   123 ;		There are situations, when using the NI, where VC failures 
                                     0000   124 ;		can cause the servING node to crash. This problem has not 
                                     0000   125 ;		been reproducable when using the CI.
                                     0000   126 ;
                                     0000   127 ;	X-4 FOLD->BLADE 
                                     0000   128 ;		JSSTS0014	John S. Simakauskas		03-Oct-1991
                                     0000   129 ;		Fix VC_ERR code to prevent BUG_CHECKing during
                                     0000   130 ;		an abort.
                                     0000   131 ;		Change CLEANUP_HRB to decrement UQB$NUM_QUE only if the
                                     0000   132 ;		UQB exists.
                                     0000   133 ;		Make TMSCP abort code more like MSCP code.
                                     0000   134 ;
                                     0000   135 ;	X-3	XVA		Joseph A. Dziedzic	26-Sep-1991
                                     0000   136 ;		Extended virtual addressing support.
                                     0000   137 ;
                                     0000   138 ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                                     0000   139 ;		make ident match new masd X-3
                                     0000   140 ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                                     0000   141 ;
                                     0000   142 ;	X-7a	JSSTS00xx	John S. Simakauskas		25-June-1991
                                     0000   143 ;		1.) Replace calls to TMSCP$SET_IMMED in the ERASE,
                                     0000   144 ;		    REPOSITION and WRITE_TAPE_MARK routines. Use the 
                                     0000   145 ;		    MD_IMMED value passed in packet in these routines.
                                     0000   146 ;		2.) Modify the TMSCP$SET_UNIT_CHAR routine such 
                                     0000   147 ;		    to use IO$_SETMODE in place of IO$_SETCHAR.
                                     0000   148 ;
                                     0000   149 ;	X-6	LPL0005		Lee Leahy			27 Aug 1990
                                     0000   150 ;		1.)  Fixed TMSCP$MSCPTOVMS_DENS to use default density
                                     0000   151 ;		     in table if a format is not specified.
                                     0000   152 ;		2.)  Fixed TMSCP$FIND_SECTION to verify that the requested section
                                     0000   153 ;		     is contained in the specified tables.
                                     0000   154 ;		3.)  Fixed TMSCP$SPEEDTOMSCP to use default density
                                     0000   155 ;		     in table if a format is not specified.
                                     0000   156 ;		4.)  Fixed TMSCP$MSCPTOSPEED to use default density
                                     0000   157 ;		     in table if a format is not specified.
                                     0000   158 ;		5.)  Zero the entire AVATN message to be sent in TMSCP$ADD.
                                     0000   159 ;		6.)  Properly set the tape density and speed in TMSCP$SET_UNIT_CHAR.
                                     0000   160 ;		7.)  Fixed GET_TAPE_FORMAT to support non-MSCP tapes.
                                     0000   161 ;		8.)  Fixed GET_TAPE_FORMENU to support non-MSCP tapes.
                                     0000   162 ;		9.)  Fixed GET_TAPE_SPEED to support non-MSCP tapes.
                                     0000   163 ;		10.) Fixed blown register in TMSCP$COMMON_TRANSFER that was 
                                     0000   164 ;		     corrupting the UCB$L_DEVDEPEND field of the UCB on the serving
                                     0000   165 ;		     system.  This was a royal pain to find!
                                     0000   166 ;
                                     0000   167 ;	X-5	LPL0004		Lee Leahy			23 Aug 1990
                                     0000   168 ;		1.)  Fixed PC logging in SEQ_STALL.
                                     0000   169 ;		2.)  Fix accvio crash caused when killing thread in 
                                     0000   170 ;		     TMSCP$COMMON_TRANSFER.
                                     0000   171 ;		3.)  Changed SS$_SERIOUSEXCP to MSCP$K_ST_PRESE in 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page   4
X-17                            Copyright and History                    16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (1)

                                     0000   172 ;		     TMSCP$COMMON_TRANSFER.
                                     0000   173 ;		4.)  Saved registers in TMSCP$CHECK_CACHE
                                     0000   174 ;		5.)  Moved queue empty check in FLUSH_CACHE.
                                     0000   175 ;		6.)  Get TMSCP message address from HRB in TMSCP$ERR_EOT.
                                     0000   176 ;		7.)  Get TMSCP message address from HRB in TMSCP$ERR_PLOST.
                                     0000   177 ;		8.)  Get TMSCP message address from HRB in TMSCP$ERR_DLS.
                                     0000   178 ;		9.)  Get IRP address in TMSCP$ERASE after call to 
                                     0000   179 ;		     TMSCP$CHECK_XFER_STATUS.
                                     0000   180 ;		10.) Log PCs in TMSCP$ERROR_NO_UNIT and TMSCP$PACKET_ERROR.
                                     0000   181 ;		11.) Set IRP$W_FUNC field before checking for internally
                                     0000   182 ;		     generated AVAILABLE request in TMSCP$AVAILABLE.
                                     0000   183 ;		12.) Increased controller timeout to prevent command timeouts.
                                     0000   184 ;		13.) No need to call TMSCP$SET_CLEAR_SEX twice in TMSCP$REPOSTION.
                                     0000   185 ;		14.) Always update the tape position in TMSCP$REPOSITION.
                                     0000   186 ;		15.) Use correct field names for return record and tape mark count
                                     0000   187 ;		     in TMSCP$REPOSTION.
                                     0000   188 ;		16.) Removed references to HRB$L_ABCNT.
                                     0000   189 ;		17.) Fix path when AVAILABLE message received and unit is not online
                                     0000   190 ;		     to any host.
                                     0000   191 ;		18.) Saved command number in PC trace.
                                     0000   192 ;		19.) Use MACRO to access FORMAT field in UCB.
                                     0000   193 ;		20.) Use MACRO to access SPEED field in UCB.
                                     0000   194 ;		21.) Removed additional calls to TMSCP$SEQ_STALL in TMSCP$REPLACE
                                     0000   195 ;		     to preserve sequentiallity!
                                     0000   196 ;		22.) Moved call to TMSCP$SEQ_STALL into TMSCP$SEQUENTIAL.  This
                                     0000   197 ;		     fixes several synchronization bugs related to accessing the
                                     0000   198 ;		     other data structures (HQB, UCB, and UQB) within the processing
                                     0000   199 ;		     routines.
                                     0000   200 ;		23.) Properly enable write back caching and disable read caching on
                                     0000   201 ;		     a per unit basis in TMSCP$SET_UNIT_CHARACTERISTICS.
                                     0000   202 ;		24.) Removed the TMSCP server write back cache since this no 
                                     0000   203 ;		     feedback is available for end of tape and this cache can not
                                     0000   204 ;		     be shutdown prior to end of tape.  This form of caching is
                                     0000   205 ;		     broken!
                                     0000   206 ;		25.) Compare the same flags in TMSCP$ONLINE.
                                     0000   207 ;		26.) Use MACRO to access MAXWRCNT field in UCB.
                                     0000   208 ;		27.) Use MACRO to access NOISE field in UCB.
                                     0000   209 ;		28.) Converted tape speed from the MSCP to the VMS format in 
                                     0000   210 ;		     TMSCP$SET_UNIT_CHAR.
                                     0000   211 ;		29.) Converted tape format from the MSCP to the VMS format in
                                     0000   212 ;		     TMSCP$SET_UNIT_CHAR.
                                     0000   213 ;		30.) Copied the MSCP to VMS and VMS to MSCP conversion routines
                                     0000   214 ;		     from TUDRIVER.
                                     0000   215 ;		31.) Fixed TMSCP$SEQ_STALL and TMSCP$UNBLOCK to correctly stall 
                                     0000   216 ;		     additional sequential commands.
                                     0000   217 ;		32.) Moved call to TMSCP$UNBLOCK into TMSCP$CLEANUP_HRB.
                                     0000   218 ;		33.) Enable MSCP modifiers in TMSCP$SET_CLEAR_CDL.
                                     0000   219 ;		34.) Logging more of the IRP in the PC history buffer.
                                     0000   220 ;		35.) TMSCP$ONLINE now calls TMSCP$SET_UNIT_CHAR to properly set the
                                     0000   221 ;		     unit characteristics for TMSCP and non-TMSCP tapes.
                                     0000   222 ;		36.) Set buffer length in TMSCP$SET_UNIT_CHAR.
                                     0000   223 ;
                                     0000   224 ;	X-4	LPL0003		Lee Leahy			 4 Jul 1990
                                     0000   225 ;		1.)  Fixed initialization of TSRV structure.
                                     0000   226 ;		2.)  Use actual PCs in the history buffer.
                                     0000   227 ;		3.)  Only initialize the PC history buffer once.
                                     0000   228 ;		4.)  Log a few more PCs in the history buffer.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page   5
X-17                            Copyright and History                    16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (1)

                                     0000   229 ;		5.)  Moved the calls to SET_CLEAR_SEX and SET_CLEAR_CDL
                                     0000   230 ;		     in TMSCP$READ_TRANSFER.
                                     0000   231 ;		6.)  Moved the calls to SET_CLEAR_SEX, SET_CLEAR_CDL, and
                                     0000   232 ;		     SET_IMMED in TMSCP$WRITE_TRANSFER.
                                     0000   233 ;		7.)  Changed names from TMSCP. to TMSCP$ since SDA does not
                                     0000   234 ;		     allow periods (.) in symbol names.
                                     0000   235 ;		8.)  Fixed initialization of UQB address in TMSCP$SET_IMMED.
                                     0000   236 ;
                                     0000   237 ;	X-3	LPL0002		Lee Leahy			 2 Jul 1990
                                     0000   238 ;		1.)  Changed access to TSRV structure in TMSCP$ERASE.
                                     0000   239 ;		2.)  Fixed build bug.  Duplicate HARDWARE_REV symbol in 
                                     0000   240 ;		     object library.
                                     0000   241 ;
                                     0000   242 ;	X-2	LPL0001		Lee Leahy			 7 Jun 1990
                                     0000   243 ;		1.)  Added debug flags.
                                     0000   244 ;		2.)  Fixed bad branch in TMSCP$ERR_PLOST at 5$.  
                                     0000   245 ;		             BBSS #UQB$M_ST_PLS -> $V.
                                     0000   246 ;		3.)  Fixed bad branch in TMSCP$GET_UNIT_STATUS at 160$.  
                                     0000   247 ;		             BBC #MSCP$M_UF_WRTPD -> $V.
                                     0000   248 ;		4.)  Fixed bad branch in TMSCP$ERR_EOF.
                                     0000   249 ;		             BBC #MT$M_BOT -> $V.
                                     0000   250 ;		5.)  Fixed blown register in TMSCP$SET_CLEAR_SEX.  UQB uses R5 not 
                                     0000   251 ;		     R3.
                                     0000   252 ;		6.)  Make symbols global for symbol table generation.
                                     0000   253 ;		7.)  Added data structure connection diagrams.
                                     0000   254 ;
                                     0000   255 ;	X-1	CJB0001		Cheryl J. Bulmer		09-March-1990
                                     0000   256 ;		Initial checkin.
                                     0000   257 ;-
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page   6
X-17                            Data Structure Definitions               16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (2)

                                     0000   260 	.SBTTL	Data Structure Definitions
                                     0000   261 
                                     0000   262 	.DISABLE	GLOBAL
                                     0000   263 
                                     0000   264 ;
                                     0000   265 ; INCLUDE FILES:
                                     0000   266 ;
                                     0000   267 
                                     0000   268 ;;	.NOCROSS
                                     0000   269 	$CDDBDEF		; Class Driver Data Block
                                     0000   270 	$CDRPDEF		; Class Driver Request Packet
                                     0000   271 	$CDTDEF			; Connection Descriptor Table
                                     0000   272 	$DCDEF			; Device Adapter, Type and Class Codes
                                     0000   273 	$DDBDEF			; Driver Data Block
                                     0000   274 	$DDTDEF			; Driver Dispatch Table
                                     0000   275 	$DEVDEF			; Device Characteristics
                                     0000   276 	$TSRVDEF		; MSCP Server structure definition
                                     0000   277 	$DYNDEF			; Data Structure type definitions
                                     0000   278 	$HQBDEF			; Host Queue Block structure definition
                                     0000   279 	$HRBDEF			; Host Request Block structure definition
                                     0000   280 	$IODEF			; I/O function code definitions
                                     0000   281 	$IPLDEF			; Interupt level definitions
                                     0000   282 	$IRPDEF			; I/O Request Packet structure definition
                                     0000   283 	$MSCPDEF		; Tape Mass Storage Control Protocol packet
                                     0000   284 	$MTDEF			; Define MAGTAPE STATUS bits
                                     0000   285 	$MT2DEF			; Define MAGTAPE extended characteristics
                                     0000   286 	$PBDEF			; Path Block offsets
                                     0000   287 	$PDTDEF			; Port Descriptor Table
                                     0000   288 	$PRDEF			; Processor Register
                                     0000   289 	$SBDEF			; System Block offsets
                                     0000   290 	$SCSDEF			; System Communications Services
                                     0000   291 	$SDIRDEF		; SCS Directory defs
                                     0000   292 	$SLVDEF			; System Loadable Vector
                                     0000   293 	$SRVBUFDEF		; Internal buffer area definition
                                     0000   294 	$SPLCODDEF		; Define spinlock indicies
                                     0000   295 	$SSDEF			; System Service message definitions
                                     0000   296 	$UCBDEF			; Unit Control Block structure definition
                                     0000   297 	$UQBDEF			; Unit Queue Block structure definition
                                     0000   298 	$VADEF			; Virtual Address Field Definitions
                                     0000   299 	$VAXDEF			; VAX model definitions
                                     0000   300 	$VCBDEF			; Volume Control Block Definitions
                                     0000   301 
                                     0000   302 
                                     0000   303 ;
                                     0000   304 ; Debugging switches
                                     0000   305 ;
                                     0000   306 ;		DEBUG$PC_HISTORY	= 0	; Assemble PC history code
                                     0000   307 ;		DEBUG$CURRENT_SANITY	= 0	; Assemble the current counter checks
                                     0000   308 ;		DEBUG$REJECT_TRACKING	= 0	; Monitor the reason for rejects
                                     0000   309 ;		DEBUG$LOG		= 0	; Enable logging of packets
                                     0000   310 ;
                                     0000   311 
                                     0000   312 ;
                                     0000   313 ; MACROS:
                                     0000   314 ;
                                     0000   315 
                                     0000   316 	.MACRO	ACTION,SYSERR,TMSCPERR,ROUTINE
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page   7
X-17                            Data Structure Definitions               16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (2)

                                     0000   317 	 .WORD	SYSERR
                                     0000   318 	 .WORD	TMSCPERR
                                     0000   319 	 .IF B ROUTINE
                                     0000   320 	  .WORD	0
                                     0000   321 	 .IFF
                                     0000   322 	  .WORD	ROUTINE-.
                                     0000   323 	 .ENDC
                                     0000   324 	.ENDM		
                                     0000   325 
                                     0000   326 ; A longword is needed in the CDRP so that when it is returned to the server
                                     0000   327 ; the corresponding HRB can be determined.  Since the server is doing its
                                     0000   328 ; own internal I/O, we can use the ASTPRM field for the HRB address.
                                     0000   329 ;
                           FFFFFFB4  0000   330 	CDRP$L_HRB = CDRP$L_ASTPRM
                           00000014  0000   331 	IRP$L_HRB  = IRP$L_ASTPRM
                                     0000   332 
                                     0000   333 	.DEFAULT DISPLACEMENT WORD		; Make relative offsets a word.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page   8
X-17                            Data Structure Connection Diagrams.      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (3)

                                     0000   336 	.SBTTL	Data Structure Connection Diagrams.
                                     0000   337 
                                     0000   338 
                                     0000   339 ;	HRB  =  Host Request Block
                                     0000   340 ;	HQB  =  Host Queue Block
                                     0000   341 ;	UQB  =  Unit Queue Block
                                     0000   342 ;
                                     0000   343 ;			Host request linkage.
                                     0000   344 ;
                                     0000   345 ;	+-------------------+
                                     0000   346 ;	!        HRB        !
                                     0000   347 ;	!                   !
                                     0000   348 ;	!            msgbuf !--------------------------------->+------------------+
                                     0000   349 ;	!                   !                                  !   MSCP message   !
                                     0000   350 ;	!          irp_cdrp !------>+-------------------+      !                  !
                                     0000   351 ;	!                   !       !        IRP        !      +------------------+
                                     0000   352 ;	+-------------------+       !                   !
                                     0000   353 ;	                            !              fqfl !------>+------------------+
                                     0000   354 ;	                            !                   !       !       CDRP       !
                                     0000   355 ;	                            +-------------------+       !                  !
                                     0000   356 ;	                                                        +------------------+
                                     0000   357 ;
                                     0000   358 ;			MSCP message processing.
                                     0000   359 ;	
                                     0000   360 ;	+-------------------+
                                     0000   361 ;	!        HQB        !
                                     0000   362 ;	!               cdt !---------------------------------->+------------------+
                                     0000   363 ;	!                   !                                   !        CDT       !
                                     0000   364 ;	!            hrb_fl !------>+-------------------+       !                  !
                                     0000   365 ;	!            hrb_bl !<------!        HRB        !       !                  !
                                     0000   366 ;	!                   !       !                   !       +------------------+
                                     0000   367 ;	!                   !<------! hqb               !
                                     0000   368 ;	!      f/blink      !       !      f/blink      !
                                     0000   369 ;	+-------------------+       +-------------------+
                                     0000   370 ;	        |   ^                       |   ^
                                     0000   371 ;	         ...                         ...
                                     0000   372 ;	        |   |                       |   |
                                     0000   373 ;	        V   |                       V   |
                                     0000   374 ;	+-------------------+       +-------------------+
                                     0000   375 ;	!      f/blink      !       !      f/blink      !
                                     0000   376 ;	!                   !       !                   !
                                     0000   377 ;	!        HQB        !       !        HRB        !
                                     0000   378 ;	+-------------------+       +-------------------+
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page   9
X-17                            Data Structure Connection Diagrams.      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (4)

                                     0000   381 
                                     0000   382 ;		Sequential command synchronization.
                                     0000   383 ;
                                     0000   384 ;	+-------------------+
                                     0000   385 ;	!        UQB        !
                                     0000   386 ;	!                   !
                                     0000   387 ;	!        blocked_fl !------>+-------------------+
                                     0000   388 ;	!        blocked_bl !<------!        HRB        !
                                     0000   389 ;	!                   !       !                   !
                                     0000   390 ;	!                   !<------! uqb               !
                                     0000   391 ;	!      f/blink      !       !     wait_fl/bl    !
                                     0000   392 ;	+-------------------+       +-------------------+
                                     0000   393 ;	        |   ^                       |   ^
                                     0000   394 ;	         ...                         ...
                                     0000   395 ;	        |   |                       |   |
                                     0000   396 ;	        V   |                       V   |
                                     0000   397 ;	+-------------------+       +-------------------+
                                     0000   398 ;	!      f/blink      !       !     wait_fl/bl    !
                                     0000   399 ;	!                   !       !                   !
                                     0000   400 ;	!        UQB        !       !        HRB        !
                                     0000   401 ;	+-------------------+       +-------------------+
                                     0000   402 ;
                                     0000   403 ;	Note: The flag UQB$V_SEQ indicates that a sequential 
                                     0000   404 ;	command is currently being processed.  When additional
                                     0000   405 ;	sequential commands are received, they are placed on
                                     0000   406 ;	the BLOCKED queue.  As each sequential command completes, 
                                     0000   407 ;	the next sequential command is started until no more
                                     0000   408 ;	sequential commands remain.  At this time, the flag
                                     0000   409 ;	UQB$V_SEQ is cleared.  Each sequential command is noted
                                     0000   410 ;	by the flag HRB$V_UNBLOCK.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  10
X-17                            External References                      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (5)

                                     0000   413 	.SBTTL	External References
                                     0000   414 
                                     0000   415 	.EXTERNAL	BUG$_TMSCPSERV
                                     0000   416 
                                     0000   417 	.EXTERNAL	CLU$GL_TAPE_ALLOCLS
                                     0000   418 
                                     0000   419 	.EXTERNAL	EXE$ALONONPAGED
                                     0000   420 	.EXTERNAL	EXE$DEANONPAGED
                                     0000   421 	.EXTERNAL	EXE$DEANONPGDSIZ
                                     0000   422 	.EXTERNAL	EXE$GL_ABSTIM_TICS
                                     0000   423 	.EXTERNAL	EXE$GL_ERASEPPT
                                     0000   424 	.EXTERNAL	EXE$INSIOQC
                                     0000   425 
                                     0000   426 	.EXTERNAL	INI$BRK
                                     0000   427 
                                     0000   428 	.EXTERNAL	MMG$GL_SPTBASE
                                     0000   429 
                                     0000   430 	.EXTERNAL	PMS$END_RQ
                                     0000   431 	.EXTERNAL	PMS$GL_IOPFMPDB
                                     0000   432 	.EXTERNAL	PMS$GL_IOPFMSEQ
                                     0000   433 	.EXTERNAL	PMS$START_RQ
                                     0000   434 
                                     0000   435 	.EXTERNAL	SCS$ALLOC_RSPID
                                     0000   436 	.EXTERNAL	SCS$DEALL_RSPID
                                     0000   437 	.EXTERNAL	SCS$DISCONNECT
                                     0000   438 	.EXTERNAL	SCS$LKP_MSGWAIT
                                     0000   439 	.EXTERNAL	SCS$LKP_RDTCDRP
                                     0000   440 	.EXTERNAL	SCS$LKP_RDTWAIT
                                     0000   441 
                                     0000   442 	.EXTERNAL	SCS$GB_SYSTEMID
                                     0000   443 	.EXTERNAL	SCS$GL_CDL
                                     0000   444 	.EXTERNAL	SCS$GL_TMSCP
                                     0000   445 	.EXTERNAL	SCS$GL_TMSCP_MV
                                     0000   446 	.EXTERNAL	SCS$GQ_DIRECT
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  11
X-17                            Select the TMSCP server timeout.         16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (6)

                                     0000   449 	.SBTTL	Select the TMSCP server timeout.
                                     0000   450 
                                     0000   451 	.MACRO	NEW_TIMEOUT	controller, timeout
                                     0000   452 	.IF	EQUAL	timeout
                                     0000   453 CNTRL_TIMEOUT_'controller	=	255
                                     0000   454 	.IFF
                                     0000   455 CNTRL_TIMEOUT_'controller	=	timeout
                                     0000   456 	.ENDC
                                     0000   457 	.IF	GREATER	CNTRL_TIMEOUT_'controller-SERVER_TIMEOUT
                                     0000   458 SERVER_TIMEOUT	=	CNTRL_TIMEOUT_'controller
                                     0000   459 	.ENDC
                                     0000   460 	.ENDM	NEW_TIMEOUT
                                     0000   461 
                                     0000   462 
                                     0000   463 
                                     0000   464 
                           0000001E  0000   465 SERVER_TIMEOUT	=	30		; Set default timeout value.
                                     0000   466 
                                     0000   467 	NEW_TIMEOUT	TK50	<^X 0078>
                                     0000   468 	NEW_TIMEOUT	HSC	<^X 00FF>
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  12
X-17                            Local Storage                            16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (7)

                                     0000   471 	.SBTTL	Local Storage
                                 00000000   472 	.PSECT	$$$100_TMSCP_VECTOR_TABLE,QUAD
                                     0000   473 
                                     0000   474 	.SHOW MEB
                                     0000   475 
                                     0000   476 TMSCP$BEGIN::
                                     0000   477 
                                     0000   478 ;
                                     0000   479 ;		The following data structures are used for loading the
                                     0000   480 ;		TMSCP server.  After that they are over written with the
                                     0000   481 ;		TSRV data structure.
                                     0000   482 ;
                                     0000   483 
                           00000001  0000   484 	PRMSW	=  1
                                     0000   485 
                                     0000   486 	SLVTAB	END	= TMSCP$END,-
                                     0000   487 		INITRTN	= TMSCP$INIT,-
                                     0000   488 ;		SUBTYP	= DYN$C_LC_TMSCP,-
                                     0000   489 		SUBTYP	= DYN$C_LC_MSCP,-
                                     0000   490 		FACILITY= <TMSCP_SERVER>
                                     0000       	.SAVE	LOCAL_BLOCK
                                 00000000       	.RESTORE
                                     0000       30000$:
                           000023D0' 0000       	.LONG	TMSCP$END-30000$
                           00000770' 0004       	.LONG	TMSCP$INIT-30000$
                               23D0' 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   491 
                                     0024   492 	LOADVEC	TYPE	  = SLV$K_SDATA,-
                                     0024   493 		ENTRY	  = SCS$GL_TMSCP,-
                                     0024   494 		SEC_LABEL = TMSCP$BEGIN
                                 04  0024       	   .BYTE SLV$K_SDATA
                           00000000' 0025       	   .ADDRESS SCS$GL_TMSCP
                           FFFFFFD7  0029       	   .LONG   <TMSCP$BEGIN-.>
                                     002D   495 
         FFFFFFFF FFFFFFFF FFFFFFFF  002D   496 	.LONG	-1,-1,-1
                                     0039   497 
                                     0039   498 	.ALIGN	QUAD
                                     0040   499 
                                     0040   500 ;
                                     0040   501 ; Allocate space for the TSRV data structure.
                                     0040   502 ;
                                     0040   503 
                           00000040  0040   504 OVERLAY_AREA	=	. - TMSCP$BEGIN
                                     0040   505 
                           0000076C  0040   506 	.BLKB	TSRV$K_LENGTH - OVERLAY_AREA
                                     076C   507 
                                     076C   508 ;
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  13
X-17                            Local Storage                            16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (7)

                                     076C   509 ; Definition of constants
                                     076C   510 ;
                           00000100  076C   511 	MAX_UNITS   =   256
                           00000100  076C   512 	MAX_HOSTS   =   256
                           00000000  076C   513 	VERSION	    =	0
                                     076C   514 
                                     076C   515 
                                     076C   516 	.IF DEFINED DEBUG$PC_HISTORY
                                     076C   517 ;
                                     076C   518 ; Space is allocated here for PC history storage
                                     076C   519 ;
                                     076C   520 
                                     076C   521 	$EQU	PCHIST_ENTRIES	1024		; Number of entries in the history
                                     076C   522 
                                     076C   523 TMSCP$PCHISTBEG::	.LONG	0		; Address of the start of the table
                                     076C   524 TMSCP$PCHISTCUR::	.LONG	0		; Pointer to next available slot
                                     076C   525 TMSCP$PCHISTEND::	.LONG	0		; Address of the end of the table
                                     076C   526 TMSCP$PCHISTFUL::	.LONG	0		; Table full counter
                                     076C   527 TMSCP$PCHISTBUF::	.BLKL	PCHIST_ENTRIES	; Table for storing server offsets
                                     076C   528 TMSCP$PCTBLEND::
                                     076C   529 
                                     076C   530 	.ENDC	   ;DEBUG$PC_HISTORY
                                     076C   531 
                                     076C   532 	$VIELD	TMSCP, 0, < -
                                     076C   533 		< DBG_START, , M >, -		; Breakpoint in TMSCP$START.
                                     076C   534 		< DBG_MSG_IN, , M >, -		; Breakpoint in TMSCP$MSG_IN.
                                     076C   535 		< DBG_SEND_PKT, , M > -		; Breakpoint in TMSCP$SEND_PKT.
                                     076C   536 		>
                                     076C   537 
                                     076C   538 	.WEAK	TMSCP$C_DEBUG_FLAGS
                                     076C   539 
                           00000000' 076C   540 TMSCP$L_DEBUG_FLAGS::	.LONG	0 \ TMSCP$C_DEBUG_FLAGS
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  14
X-17                            Define the Field Access Macros.          16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (8)

                                     0770   543 	.SBTTL	Define the Field Access Macros.
                                     0770   544 
                                     0770   545 	.MACRO	GET_TAPE_FORMAT	ucb, ?not_mscp, ?tape_format_set
                                     0770   546 
                                     0770   547 ;
                                     0770   548 ;		Return the MSCP tape format when possible.
                                     0770   549 ;
                                     0770   550 
                                     0770   551 	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                                     0770   552 		UCB$L_DEVCHAR2('ucb'), not_mscp	; Not MSCP tape - branch.
                                     0770   553 	MOVW	UCB$W_TU_FORMAT('ucb'), -	; Steal tape format from UCB.
                                     0770   554 		MSCP$W_FORMAT(R2)
                                     0770   555 	BRB	tape_format_set
                                     0770   556 
                                     0770   557 ;
                                     0770   558 ;		Get the VMS tape format value.
                                     0770   559 ;
                                     0770   560 
                                     0770   561 not_mscp:
                                     0770   562 	MOVQ	R0, -(SP)
                                     0770   563 	EXTZV	# MT$V_DENSITY, -		; Extract VMS density from the UCB.
                                     0770   564 		# MT$S_DENSITY, -
                                     0770   565 		UCB$L_DEVDEPEND('ucb'), R0
                                     0770   566 
                                     0770   567 ;
                                     0770   568 ;		Convert the VMS tape format into the MSCP equivalent.
                                     0770   569 ;
                                     0770   570 
                                     0770   571 	CLRL	R1				; Use default VMS density table.
                                     0770   572 	BSBW	TMSCP$VMSTOMSCP_DENS		; Convert tape density value.
                                     0770   573 
                                     0770   574 ;
                                     0770   575 ;		Return the MSCP tape format.
                                     0770   576 ;
                                     0770   577 
                                     0770   578 	MOVW	R1, MSCP$W_FORMAT(R2)		; Return the tape format.
                                     0770   579 	MOVQ	(SP)+, R0
                                     0770   580 
                                     0770   581 tape_format_set:
                                     0770   582 	.ENDM	GET_TAPE_FORMAT
                                     0770   583 
                                     0770   584 
                                     0770   585 
                                     0770   586 
                                     0770   587 	.MACRO	GET_TAPE_FORMENU	ucb, ?not_mscp, ?tape_formenu_set
                                     0770   588 
                                     0770   589 ;
                                     0770   590 ;		Return the MSCP tape formenu when possible.
                                     0770   591 ;
                                     0770   592 
                                     0770   593 	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                                     0770   594 		UCB$L_DEVCHAR2('ucb'), not_mscp	; Not MSCP tape - branch.
                                     0770   595 	MOVW	UCB$W_TU_FORMENU('ucb'), -	; Steal tape formenu from UCB.
                                     0770   596 		MSCP$W_FORMENU(R2)
                                     0770   597 	BRB	tape_formenu_set
                                     0770   598 
                                     0770   599 ;
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  15
X-17                            Define the Field Access Macros.          16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (8)

                                     0770   600 ;		Get the VMS tape formenu value.
                                     0770   601 ;
                                     0770   602 
                                     0770   603 not_mscp:
                                     0770   604 	MOVQ	R0, -(SP)
                                     0770   605 	EXTZV	# MT$V_DENSITY, -		; Extract VMS density from the UCB.
                                     0770   606 		# MT$S_DENSITY, -
                                     0770   607 		UCB$L_DEVDEPEND('ucb'), R0
                                     0770   608 
                                     0770   609 ;
                                     0770   610 ;		Convert the VMS tape density into the MSCP equivalent.
                                     0770   611 ;
                                     0770   612 
                                     0770   613 	CLRL	R1				; Use default VMS density table.
                                     0770   614 	BSBW	TMSCP$VMSTOMSCP_DENS		; Convert tape density value.
                                     0770   615 
                                     0770   616 ;
                                     0770   617 ;		Return the MSCP tape formenu.
                                     0770   618 ;
                                     0770   619 
                                     0770   620 	MOVB	R1, MSCP$W_FORMENU(R2)		; Return the current tape format.
                                     0770   621 	MOVB	R1, 1+MSCP$W_FORMENU(R2)	; Return the supported densities.
                                     0770   622 	MOVQ	(SP)+, R0
                                     0770   623 
                                     0770   624 tape_formenu_set:
                                     0770   625 	.ENDM	GET_TAPE_FORMENU
                                     0770   626 
                                     0770   627 
                                     0770   628 
                                     0770   629 
                                     0770   630 	.MACRO	GET_TAPE_MAXWRCNT	ucb, tmp, ?not_mscp, ?tape_maxwrcnt_set
                                     0770   631 
                                     0770   632 ;
                                     0770   633 ;		Return the MSCP tape maxwrcnt when possible.
                                     0770   634 ;
                                     0770   635 
                                     0770   636 	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                                     0770   637 		UCB$L_DEVCHAR2('ucb'), not_mscp	; Not MSCP tape - branch.
                                     0770   638 	MOVL	UCB$L_TU_MAXWRCNT('ucb'), -	; Steal tape maxwrcnt from UCB.
                                     0770   639 		MSCP$L_MAXWTREC(R2)
                                     0770   640 	BRB	tape_maxwrcnt_set
                                     0770   641 
                                     0770   642 ;
                                     0770   643 ;		Get the VMS tape maxwrcnt value.
                                     0770   644 ;
                                     0770   645 
                                     0770   646 not_mscp:
                                     0770   647 	MOVZWL	#^XFFFF, tmp			; Supply the default tape maxwrcnt.
                                     0770   648 
                                     0770   649 ;
                                     0770   650 ;		Convert the VMS tape maxwrcnt into the MSCP equivalent.
                                     0770   651 ;
                                     0770   652 
                                     0770   653 ;
                                     0770   654 ;		Return the MSCP tape maxwrcnt.
                                     0770   655 ;
                                     0770   656 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  16
X-17                            Define the Field Access Macros.          16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (8)

                                     0770   657 	MOVL	tmp, MSCP$L_MAXWTREC(R2)	; Return the tape maxwrcnt.
                                     0770   658 
                                     0770   659 tape_maxwrcnt_set:
                                     0770   660 	.ENDM	GET_TAPE_MAXWRCNT
                                     0770   661 
                                     0770   662 
                                     0770   663 
                                     0770   664 	.MACRO	GET_TAPE_NOISE	ucb, tmp, ?not_mscp, ?tape_noise_set
                                     0770   665 
                                     0770   666 ;
                                     0770   667 ;		Return the MSCP tape noise when possible.
                                     0770   668 ;
                                     0770   669 
                                     0770   670 	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                                     0770   671 		UCB$L_DEVCHAR2('ucb'), not_mscp	; Not MSCP tape - branch.
                                     0770   672 	MOVW	UCB$W_TU_NOISE('ucb'), -	; Steal tape noise from UCB.
                                     0770   673 		MSCP$W_NOISEREC(R2)
                                     0770   674 	BRB	tape_noise_set
                                     0770   675 
                                     0770   676 ;
                                     0770   677 ;		Get the VMS tape noise value.
                                     0770   678 ;
                                     0770   679 
                                     0770   680 not_mscp:
                                     0770   681 	CLRL	tmp				; Supply the default tape noise.
                                     0770   682 
                                     0770   683 ;
                                     0770   684 ;		Convert the VMS tape noise into the MSCP equivalent.
                                     0770   685 ;
                                     0770   686 
                                     0770   687 ;
                                     0770   688 ;		Return the MSCP tape noise.
                                     0770   689 ;
                                     0770   690 
                                     0770   691 	MOVW	tmp, MSCP$W_NOISEREC(R2)	; Return the tape noise.
                                     0770   692 
                                     0770   693 tape_noise_set:
                                     0770   694 	.ENDM	GET_TAPE_NOISE
                                     0770   695 
                                     0770   696 
                                     0770   697 
                                     0770   698 	.MACRO	GET_TAPE_SPEED	ucb, mscp_format, ?not_mscp, ?tape_speed_set
                                     0770   699 
                                     0770   700 ;
                                     0770   701 ;		Return the MSCP tape speed when possible.
                                     0770   702 ;
                                     0770   703 
                                     0770   704 	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                                     0770   705 		UCB$L_DEVCHAR2('ucb'), not_mscp	; Not MSCP tape - branch.
                                     0770   706 	MOVW	UCB$W_TU_SPEED('ucb'), -	; Steal tape speed from UCB.
                                     0770   707 		MSCP$W_SPEED(R2)		; (Kilobytes per second)
                                     0770   708 	BRB	tape_speed_set
                                     0770   709 
                                     0770   710 not_mscp:
                                     0770   711 	MOVQ	R0, -(SP)
                                     0770   712 	.IF	BLANK	mscp_format
                                     0770   713 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  17
X-17                            Define the Field Access Macros.          16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (8)

                                     0770   714 ;
                                     0770   715 ;		Get the VMS tape density value.
                                     0770   716 ;
                                     0770   717 
                                     0770   718 	EXTZV	# MT$V_DENSITY, -		; Extract VMS density from the UCB.
                                     0770   719 		# MT$S_DENSITY, -
                                     0770   720 		UCB$L_DEVDEPEND('ucb'), R0
                                     0770   721 
                                     0770   722 ;
                                     0770   723 ;		Convert the VMS tape density into the MSCP equivalent.
                                     0770   724 ;
                                     0770   725 
                                     0770   726 	CLRL	R1				; Use default VMS density table.
                                     0770   727 	BSBW	TMSCP$VMSTOMSCP_DENS		; Convert tape density value.
                                     0770   728 	.IFF
                                     0770   729 	MOVZWL	mscp_format, R1			; Get the MSCP tape format.
                                     0770   730 	.ENDC
                                     0770   731 
                                     0770   732 ;
                                     0770   733 ;		Get the VMS tape speed value.
                                     0770   734 ;
                                     0770   735 
                                     0770   736 	EXTZV	# MT$V_SPEED, -			; Extract VMS tape speed from UCB
                                     0770   737 		# MT$S_SPEED, -			; and return as the tape speed.
                                     0770   738 		UCB$L_DEVDEPEND('ucb'), R0
                                     0770   739 
                                     0770   740 ;
                                     0770   741 ;		Convert the VMS tape speed into the MSCP equivalent.
                                     0770   742 ;
                                     0770   743 
                                     0770   744 	BSBW	TMSCP$SPEEDTOMSCP		; Convert speed value.
                                     0770   745 
                                     0770   746 ;
                                     0770   747 ;		Return the MSCP tape speed.
                                     0770   748 ;
                                     0770   749 
                                     0770   750 	MOVW	R0, MSCP$W_SPEED(R2)		; Return the tape speed.
                                     0770   751 	MOVQ	(SP)+, R0
                                     0770   752 
                                     0770   753 tape_speed_set:
                                     0770   754 	.ENDM	GET_TAPE_SPEED
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  18
X-17                            Server Action Routines                   16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1             (9)

                                     0770   757 	.SBTTL	Server Action Routines
                                     0770   758 
                                     0770   759 ;+
                                     0770   760 ; These routines are called to carry out actions that must be done 
                                     0770   761 ; from high IPL code that resides in non-paged pool.
                                     0770   762 ;
                                     0770   763 ; Inputs:
                                     0770   764 ;
                                     0770   765 ;	AP -->	#arguments
                                     0770   766 ;		action code
                                     0770   767 ;		parameter(s)
                                     0770   768 ;
                                     0770   769 ; Outputs:
                                     0770   770 ;
                                     0770   771 ;	R0 = status code
                                     0770   772 ;-
                                     0770   773 
                                     0770   774 TMSCP$INIT::
                                     0770   775 
                                     0770   776 	ASSUME	TSRV$K_AR_ADD EQ 1+TSRV$K_AR_START
                                     0770   777 
                                     0770   778 	CASE	4(AP), -
                                     0770   779 		LIMIT=#TSRV$K_AR_START, -
                                     0770   780 		TYPE=B, -
                                     0770   781 		<TMSCP$START,-		; Startup
                                     0770   782 		 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   783 
                       50   14   3C  0779   784 	MOVZWL	#SS$_BADPARAM, R0	; Command out of range
                                 05  077C   785 	RSB				; Leave
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  19
X-17                            - START  -  Initialization Routine       16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (10)

                                     077D   788 	.SBTTL	-	START  -  Initialization Routine
                                     077D   789 
                                     077D   790 ;+
                                     077D   791 ; Functional Description:
                                     077D   792 ; 
                                     077D   793 ; Evaluate all values specified in the SYSGEN command used to 
                                     077D   794 ; invoke the server. Examine the values for validity,  and store them 
                                     077D   795 ; away in the TSRV for future use. Initiate a connection to the port 
                                     077D   796 ; driver, and establish ourselves as a listener.
                                     077D   797 ;
                                     077D   798 ; This routine is called from the stand-alone configure process (STACONFIG) 
                                     077D   799 ; at IPL 0. All registers used in this routine are preserved except for R0.
                                     077D   800 ;
                                     077D   801 ; Inputs:
                                     077D   802 ;
                                     077D   803 ;	None
                                     077D   804 ;
                                     077D   805 ; Outputs:
                                     077D   806 ;
                                     077D   807 ;	R0  =	status code
                                     077D   808 ;-
                                     077D   809 
                                     077D   810 TMSCP$START::
                 06 EB AF   00   E1  077D   811 	BBC	# TMSCP$V_DBG_START, -	; Not debugging - branch.
                                     0782   812 		TMSCP$L_DEBUG_FLAGS, 0$
                   00000000'GF   16  0782   813 	JSB	G^INI$BRK
                                     0788   814 
                                     0788   815 0$:
                                     0788   816 
                                     0788   817 	.IF DEFINED DEBUG$PC_HISTORY
                                     0788   818 ;
                                     0788   819 ; Do any initialization needed for tracing a history of the PC as
                                     0788   820 ; the server code is executed.
                                     0788   821 ;
                                     0788   822 	TSTL	TMSCP$PCHISTBEG			; PC history buffer initialized?
                                     0788   823 	BNEQ	1$				; Yes - branch.
                                     0788   824 	MOVAL	TMSCP$PCHISTBUF,TMSCP$PCHISTBEG	; Initialize the table address
                                     0788   825 	MOVAL	TMSCP$PCHISTBUF,TMSCP$PCHISTCUR	; Start current at the table start
                                     0788   826 	MOVAL	TMSCP$PCTBLEND, TMSCP$PCHISTEND	; Address of the end of the table
                                     0788   827 	CLRL	TMSCP$PCHISTFUL			; Clear the counter to start
                                     0788   828 
                                     0788   829 1$:
                                     0788   830 	BSBW	TMSCP$PCHIST			; Log the initialization.
                                     0788   831 	.ENDC  ;DEBUG$PC_HISTORY
                                     0788   832 
                            26   BB  0788   833 	PUSHR	#^M<R1,R2,R5>		; Save the registers to be used
              55   00000000'GF   D0  078A   834 	MOVL	G^SCS$GL_TMSCP,R5	; Get the address of the TSRV structure
                            3F   BB  0791   835 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                  00   6E   00   2C  0793   836 	MOVC5	#0,(SP),#0,-		; Initialize entire structure in
               08 A5   0764 8F       0797   837 		#TSRV$K_LENGTH-TSRV$W_SIZE, -	;  in one fell swoop. 
                                     079C   838 		TSRV$W_SIZE(R5)		; Don't initialize first 2 longwords
                            3F   BA  079C   839 	POPR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                                     079E   840 
                                     079E   841 ; 
                                     079E   842 ; Initialize size, type, and subtype.
                                     079E   843 ;
                       076C 8F   B0  079E   844 	MOVW	#TSRV$K_LENGTH,-	; Save the length of the structure
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  20
X-17                            - START  -  Initialization Routine       16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (10)

                         08 A5       07A2   845 		TSRV$W_SIZE(R5)		;  in the size field
                         73 8F   90  07A4   846 	MOVB	#DYN$C_TSRV,-		; This structure belongs
                         0A A5       07A7   847 		TSRV$B_TYPE(R5)		;  to the tape server.
                            01   90  07A9   848 	MOVB	#DYN$C_TSRV_TSRV,-	; The substructure is
                         0B A5       07AB   849 		TSRV$B_SUBTYPE(R5)	;  a TSRV.
                                     07AD   850 
                                     07AD   851 ;
                                     07AD   852 ; Initialize the list heads in the TSRV.
                                     07AD   853 ;
                         60 A5   DE  07AD   854 	MOVAL	TSRV$L_HQB_FL(R5),-	; Initialize the forward and
                         60 A5       07B0   855 		TSRV$L_HQB_FL(R5)	;  backward pointers to point to
                         60 A5   DE  07B2   856 	MOVAL	TSRV$L_HQB_FL(R5),-	;  the HQB forward link
                         64 A5       07B5   857 		TSRV$L_HQB_BL(R5)	; 
                         68 A5   DE  07B7   858 	MOVAL	TSRV$L_UQB_FL(R5),-	; Initialize the forward and
                         68 A5       07BA   859 		TSRV$L_UQB_FL(R5)	;  backward pointers to point to
                         68 A5   DE  07BC   860 	MOVAL	TSRV$L_UQB_FL(R5),-	;  the HQB forward link
                         6C A5       07BF   861 		TSRV$L_UQB_BL(R5)	; 
                                     07C1   862 
                                     07C1   863 ;
                                     07C1   864 ; The TMSCP version is set to zero. Host class drivers must supply a 
                                     07C1   865 ; TMSCP version number when setting the controller characteristics. If
                                     07C1   866 ; a version of TMSCP is ever introduced that is incompatable with the 
                                     07C1   867 ; current version this number will be changed.
                                     07C1   868 ;  Set the multi-host controller flag. This notifies the class drivers
                                     07C1   869 ; on the remote systems to use the allocation class passed in the 
                                     07C1   870 ; attention message instead of using their local value.
                                     07C1   871 ;                                         
                            00   B0  07C1   872 	MOVW	#VERSION,-		; Set the server version number 
                         3C A5       07C3   873 		TSRV$W_VERSION(R5)	;  to return in Set Unit Char
                            04   B0  07C5   874 	MOVW	#MSCP$M_CF_MLTHS,-	; Identify ourself as a
                         3E A5       07C7   875 		TSRV$W_CFLAGS(R5)	;  multi host controller
                                     07C9   876 
                                     07C9   877 ;
                                     07C9   878 ; Uniquely identify this controller among all devices accessable via T/MSCP.
                                     07C9   879 ;
                   00000000'GF   7D  07C9   880 	MOVQ	G^SCS$GB_SYSTEMID,-	; Construct the controller ID using
                         44 A5       07CF   881 		TSRV$Q_CTRL_ID(R5)	;  the system ID for the first three
                            04   90  07D1   882 	MOVB	#MSCP$K_CM_EMULA,-	;  words, then use an emulator for
                         4A A5       07D3   883 		TSRV$Q_CTRL_ID+6(R5)	;  the controller model, and 
                            01   90  07D5   884 	MOVB	#MSCP$K_CL_CNTRL,-	;  define the device class as an
                         4B A5       07D7   885 		TSRV$Q_CTRL_ID+7(R5)	;  MSCP controller.
                       0ABF'CF   DE  07D9   886 	MOVAL	TMSCP$MV_SET_OFFLINE,-	; Set address of TMSCP$MV_SET_OFFLINE 
                   00000000'GF       07DD   887 		G^SCS$GL_TMSCP_MV	;  into cell for mount verification
                                     07E2   888 ;
                                     07E2   889 ; Establish a link with PORT_DRIVER
                                     07E2   890 ;
                                     07E2   891 	LOCK	LOCKNAME=SCS,-		; Lock SCS access
                                     07E2   892 		PRESERVE=NO, -		; Don't preserve R0
                                     07E2   893 		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                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  21
X-17                            - START  -  Initialization Routine       16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (10)

                                     07F7       30006$:
                       12   08   DA  07F7       		MTPR	S^#IPL$_SCS,S^#PR$_IPL
                                     07FA       30007$:
                                     07FA   894 	LISTEN	MSGADR=W^TMSCP$LISTEN,-	; Forwarding address
                                     07FA   895 		ERRADR=W^20$,-		; If an error occurs during the listen
                                     07FA   896 		LPRNAM=W^TMSCP$SERV_NAME,-
                                     07FA   897 		PRINFO=W^TMSCP$SERV_INFO
                         13'AF   9F  07FA       		PUSHAB	B^30011$
                       229C'CF   9F  07FD       		PUSHAB	W^TMSCP$SERV_INFO
                       229C'CF   9F  0801       		PUSHAB	W^TMSCP$SERV_NAME
                       082C'CF   9F  0805       		PUSHAB	W^20$
                       0B20'CF   9F  0809       		PUSHAB	W^TMSCP$LISTEN
                   00000000'GF   17  080D       		JMP	G^SCS$LISTEN
                                     0813       30011$:
                                     0813   898 	UNLOCK	LOCKNAME=SCS,-		; Release SCS access
                                     0813   899 		PRESERVE=NO,-		; Don't preserve R0,
                                     0813   900 		NEWIPL=(SP)+,-		;  lower the IPL and
                                     0813   901 		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   902 	MOVL	#SS$_NORMAL,R0		; Set success
                                     0829   903 	.IF DEFINED DEBUG$LOG
                                     0829   904 	BSBW	TMSCP$CREATE_LOG	; Allocate T/MSCP packet logging buffer.
                                     0829   905 	.ENDC	; DEBUG$LOG
                                     0829   906 
                                     0829   907 10$:
                            26   BA  0829   908 	POPR	#^M<R1,R2,R5>		; Restore the registers 
                                 05  082B   909 	RSB				; Return to caller
                                     082C   910 
                                     082C   911 ;
                                     082C   912 ; If an error occurs during the listen macro, control will be passed here.
                                     082C   913 ; the connection is simply disconnected (no reason given) and control is
                                     082C   914 ; returned to caller.
                                     082C   915 ;
                                     082C   916 
                                     082C   917 20$:
                                     082C   918 	.IF	DEFINED DEBUG$PC_HISTORY
                                     082C   919 	BSBW	TMSCP$PCHIST		; Log the PC for debugging.
                                     082C   920 	.ENDC  ;DEBUG$PC_HISTORY
                                     082C   921 	DISCONNECT #1			; Do a disconnect
                       50   01   D0  082C       		MOVL	#1, R0
                   00000000'GF   16  082F       		JSB	G^SCS$DISCONNECT
                                     0835   922 	UNLOCK	LOCKNAME=SCS,-		; Release SCS access
                                     0835   923 		PRESERVE=NO,-		; Don't preserve R0,
                                     0835   924 		NEWIPL=(SP)+,-		;  lower the IPL and
                                     0835   925 		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   926 	BRB	10$
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  22
X-17                            - ADD - Add a Tape Unit                  16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (11)

                                     084A   929 	.SBTTL	-	ADD - Add a Tape Unit
                                     084A   930 
                                     084A   931 ;+
                                     084A   932 ; Functional Description:
                                     084A   933 ;
                                     084A   934 ; This routine is called from ADDUNIT when a SET DEV/SERVED command is 
                                     084A   935 ; executed. This routine is called, and executes while holding the 
                                     084A   936 ; SPL$C_SCS spinlock. An MSCP attention message is sent out to all 
                                     084A   937 ; known hosts to notify them of the availability of this tape.
                                     084A   938 ;
                                     084A   939 ;
                                     084A   940 ; Inputs:
                                     084A   941 ;
                                     084A   942 ;	AP -->	argument count
                                     084A   943 ;		action code (ADD)
                           00000008  084A   944 		UQB = 8	    		; UQB address
                                     084A   945 ;
                                     084A   946 ; Outputs:
                                     084A   947 ;
                                     084A   948 ;	R0  =  status code to be returned to the caller
                                     084A   949 ;	R3  =  Host Request Buffer address
                                     084A   950 ;-
                                     084A   951 
                                     084A   952 
                                     084A   953 TMSCP$ADD::
                                     084A   954 	.IF DEFINED DEBUG$PC_HISTORY
                                     084A   955 	BSBW	TMSCP$PCHIST		; Save this PC if we are keeping track
                                     084A   956 	.ENDC	   ;DEBUG$PC_HISTORY
                                     084A   957 
                                     084A   958 ;
                                     084A   959 ; If this routine is stalled and has to wait for resources while trying
                                     084A   960 ; to allocate a message buffer, we want to return to the caller to resume
                                     084A   961 ; working on something else. 
                                     084A   962 ; 
                            36   BB  084A   963 	PUSHR	#^M<R1,R2,R4,R5>	; Save all the registers before starting
                            03   10  084C   964 	BSBB	10$			; Treat this whole routine as a big
                            36   BA  084E   965 	POPR	#^M<R1,R2,R4,R5>	;  subroutine so that if this thread
                                 05  0850   966 	RSB				;  stalls the registers can be restored
                                     0851   967 
                                     0851   968 ;
                                     0851   969 ; Send out an attention message to every host we know, anouncing
                                     0851   970 ; the discovery of a new tape.
                                     0851   971 ;
                                     0851   972 
                                     0851   973 10$:
              55   00000000'GF   D0  0851   974 	MOVL	G^SCS$GL_TMSCP,R5	; Pick up the TSRV address
                       50   01   3C  0858   975 	MOVZWL	# SS$_NORMAL, R0	; No hosts found status.
                    51   60 A5   D0  085B   976 	MOVL	TSRV$L_HQB_FL(R5),R1	; Get the address of the first HQB
                       52   51   D0  085F   977 	MOVL	R1,R2			; and save it for checking.
                                     0862   978 
                                     0862   979 	ASSUME	HQB$L_FLINK EQ 0
                                     0862   980 
                                     0862   981 13$:
                       52   61   D1  0862   982 	CMPL	HQB$L_FLINK(R1),R2	; Check for an empty queue
                            01   12  0865   983 	BNEQ	19$			; Queue not empty, continue
                                     0867   984 
                                     0867   985 15$:
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  23
X-17                            - ADD - Add a Tape Unit                  16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (11)

                                 05  0867   986 	RSB				; No good hosts, return
                                     0868   987 
                                     0868   988 19$:
                         28 A1   D5  0868   989 	TSTL	HQB$L_CDT(R1)		; Check the HQB for a good CDT address
                            05   12  086B   990 	BNEQ	20$			;  Good CDT.
                       51   61   D0  086D   991 	MOVL	HQB$L_FLINK(R1),R1	;  No CDT... move on to the next host
                            F0   11  0870   992 	BRB	13$			;  and try again
                                     0872   993 
                                     0872   994 20$:
                          1418   30  0872   995 	BSBW	TMSCP$ALLOCATE_HRB	; Allocate and set up an HRB
                                     0875   996 					; IRP included automatically
                         EF 50   E9  0875   997 	BLBC	R0,15$			; Return to the caller with the error
                    54   08 AC   D0  0878   998 	MOVL	UQB(AP),R4		; Get the UQB address
                    58 A3   54   D0  087C   999 	MOVL	R4,HRB$L_UQB(R3)	; Save this address
                         12 A4   B6  0880  1000 	INCW	UQB$W_CURRENT(R4)	; Another request active on this unit
                                     0883  1001 
                                     0883  1002 ;
                                     0883  1003 ; The attention message will actually be sent to all hosts that are linked
                                     0883  1004 ; into the HQB queue in the TSRV. 
                                     0883  1005 ;
                                     0883  1006 
                                     0883  1007 30$:
                    54 A3   51   D0  0883  1008 	MOVL	R1,HRB$L_HQB(R3)	; Store the address of the HRB.
                    24 B1   63   0E  0887  1009 	INSQUE	HRB$L_FLINK(R3), -	; Insert the HRB into tail of queue.
                                     088B  1010 		@HQB$L_HRB_BL(R1)
                         1C A1   B6  088B  1011 	INCW	HQB$W_NUM_QUE(R1)	; Bump host queue reference count
                         1C A1   B1  088E  1012 	CMPW	HQB$W_NUM_QUE(R1),-	; Is this number <= max?
                         1E A1       0891  1013 		HQB$W_MAX_QUE(R1)	; 
                            05   1B  0893  1014 	BLEQU	40$			; Yes, skip
                         1C A1   B0  0895  1015 	MOVW	HQB$W_NUM_QUE(R1),-	; No, set new max
                         1E A1       0898  1016 		HQB$W_MAX_QUE(R1)	;
                                     089A  1017 
                                     089A  1018 40$:
                    55   1C A3   D0  089A  1019 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Put the IRP address in R5
                    55   60 A5   DE  089E  1020 	MOVAL	IRP$L_FQFL(R5),R5	; Move down to the CDRP portion
                    54   28 A1   D0  08A2  1021 	MOVL	HQB$L_CDT(R1),R4	; Get the address of the CDT
                                     08A6  1022 ;
                                     08A6  1023 ; Initialize the CDRP
                                     08A6  1024 ;
                    24 A5   54   D0  08A6  1025 	MOVL	R4,CDRP$L_CDT(R5)	; Get the address of the CDT 
                    54   10 A4   D0  08AA  1026 	MOVL	CDT$L_PDT(R4),R4	; Prepare the PDT address for SCS
                    5C A3   54   D0  08AE  1027 	MOVL	R4,HRB$L_PDT(R3)	;  and also store it away for future use
                                     08B2  1028 
                                     08B2  1029 ;
                                     08B2  1030 ; Allocate and send out the attention message. Set the state, in case
                                     08B2  1031 ; the connection to the host is lost, and we need to clean up. This module
                                     08B2  1032 ; is called like a subroutine to allow us an opportunity to clean up the
                                     08B2  1033 ; registers that were pushed on the stack in the event of failure.
                                     08B2  1034 ;
                            01   B0  08B2  1035 	MOVW	#HRB$K_ST_MSG_WAIT,-	; Set the state of the request to
                         14 A3       08B4  1036 		HRB$W_STATE(R3)		;  reflect possible stall 
                                     08B6  1037 	ALLOC_MSG_BUF			; Allocate a message buffer
                         14 B4   16  08B6       		JSB	@PDT$L_ALLOCMSG(R4)
                            3F   BB  08B9  1038 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                                     08BB  1039 
                                     08BB  1040 	ASSUME	MSCP$K_MXCMDLEN LE MSCP$K_LEN
                                     08BB  1041 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  24
X-17                            - ADD - Add a Tape Unit                  16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (11)

                  00   6E   00   2C  08BB  1042 	MOVC5	#0,(SP),#0,-		; Initialize entire structure in
                       62   32       08BF  1043 		#MSCP$K_LEN,(R2)	;  in one fell swoop. 
                            3F   BA  08C1  1044 	POPR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                       8000 8F   A8  08C3  1045 	BISW	#HRB$M_STATE_INVALID,-	; The state of this request is "current"
                         14 A3       08C7  1046 		HRB$W_STATE(R3)		;  leave the old state for diagnosis
                         55 50   E9  08C9  1047 	BLBC	R0, 60$			; If LBC connection is broken, skip host
                                     08CC  1048 
                                     08CC  1049 ;
                                     08CC  1050 ; The address of the allocated message buffer is returned in R2.
                                     08CC  1051 ; Initialize the proper fields to turn the message buffer into an
                                     08CC  1052 ; attention message.
                                     08CC  1053 ;
                    18 A3   52   D0  08CC  1054 	MOVL	R2,HRB$L_MSGBUF(R3)	; Save the message buffer address
                         40 8F   90  08D0  1055 	MOVB	#MSCP$K_OP_AVATN,-	; Set the attn msg op-code
                         08 A2       08D3  1056 		MSCP$B_OPCODE(R2)	;  
                    54   58 A3   D0  08D5  1057 	MOVL	HRB$L_UQB(R3),R4	; Get the address of the UQB
                         5E A4   B0  08D9  1058 	MOVW	UQB$W_SLUN(R4),-	; Get the unit number
                         04 A2       08DC  1059 		MSCP$W_UNIT(R2)
                         18 A4   7D  08DE  1060 	MOVQ	UQB$Q_UNIT_ID(R4),-	; Copy unit identifier
                         14 A2       08E1  1061 		MSCP$Q_UNIT_ID(R2)	; 
                                     08E3  1062 ;;;
                                     08E3  1063 ;
                                     08E3  1064 ; The contents of the UQB copy of the unit flags could be stale. To
                                     08E3  1065 ; assure the correct bits are passed back, update the UQB UNIT FLAGS
                                     08E3  1066 ; before copying it into the mscp packet.
                                     08E3  1067 ;
                    51   24 A4   D0  08E3  1068 	MOVL	UQB$L_UCB(R4),R1	; Get the UCB address
                       00FA C1   B0  08E7  1069 	MOVW	UCB$W_UNIT_FLAGS(R1),-	; Get the device unit_flags
                         16 A4       08EB  1070 		UQB$W_UNIT_FLAGS(R4)
                                     08ED  1071 ;;;
                         16 A4   B0  08ED  1072 	MOVW	UQB$W_UNIT_FLAGS(R4),-	; Get the unit_flags
                         0E A2       08F0  1073 		MSCP$W_UNT_FLGS(R2)	; 
                    51   24 A4   D0  08F2  1074 	MOVL	UQB$L_UCB(R4),R1	; Get the UCB address
                       00A0 C1   D0  08F6  1075 	MOVL	UCB$L_MEDIA_ID(R1),-	;  then copy the media identifier
                         1C A2       08FA  1076 		MSCP$L_MEDIA_ID(R2)	;  from the UCB into the msg packet
                                     08FC  1077 
                                     08FC  1078 ;
                                     08FC  1079 ; Get the CDRP fields and the registers properly set up to send out the 
                                     08FC  1080 ; attention message to all interested hosts.
                                     08FC  1081 ;
                    55   1C A3   D0  08FC  1082 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the address of IRP for this 
                    55   60 A5   DE  0900  1083 	MOVAL	IRP$L_FQFL(R5),R5	;  request and position at the CDRP
                         28 A5   D4  0904  1084 	CLRL	CDRP$L_RWCPTR(R5)	; 
                         20 A5   D4  0907  1085 	CLRL	CDRP$L_RSPID(R5)	; Clear since no response is expected
                    54   5C A3   D0  090A  1086 	MOVL	HRB$L_PDT(R3),R4	; Pick up the PDT address for SCS
                       51   32   D0  090E  1087 	MOVL	#MSCP$K_LEN,R1		; Size of the message to be sent
                         18 A3   D4  0911  1088 	CLRL	HRB$L_MSGBUF(R3)	; The message buffer is no longer ours
                                     0914  1089 
                                     0914  1090 	.IF DEFINED DEBUG$LOG
                                     0914  1091 
                                     0914  1092 	ASSUME TSRV$V_LOG_ENABLD  EQ  0
                                     0914  1093 
                                     0914  1094 	MOVL	G^SCS$GL_TMSCP,R0	; Get the TSRV address.
                                     0914  1095 	BLBC	TSRV$W_STATE(R0),50$	; Branch if logging is disabled.
                                     0914  1096 	BSBW	TMSCP$LOG_END_PKT	; Otherwise, log the attention message.
                                     0914  1097 
                                     0914  1098 50$:
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  25
X-17                            - ADD - Add a Tape Unit                  16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (11)

                                     0914  1099 	.ENDC	; DEBUG$LOG
                                     0914  1100 
                            08   B0  0914  1101 	MOVW	#HRB$K_ST_SNDMS_WAIT,-	; Set the state for this request
                         14 A3       0916  1102 		HRB$W_STATE(R3)		;  before calling the SCS service
                                     0918  1103 	SEND_CNT_MSG_BUF		; Send it out
                         60 B4   16  0918       		JSB	@PDT$L_SNDCNTMSG(R4)
                       8000 8F   A8  091B  1104 	BISW	#HRB$M_STATE_INVALID,-	; The state of this request is "current"
                         14 A3       091F  1105 		HRB$W_STATE(R3)		;  leave the old state for diagnosis
                                     0921  1106 
                                     0921  1107 ;
                                     0921  1108 ; Remove the HRB from the queue and loop to send the same attention 
                                     0921  1109 ; message to the next host. Continue sending out these messages until 
                                     0921  1110 ; all the hosts have been notified.
                                     0921  1111 ;
                                     0921  1112 
                                     0921  1113 	ASSUME	HRB$L_FLINK EQ 0
                                     0921  1114 
                                     0921  1115 60$:
                       53   63   0F  0921  1116 	REMQUE	HRB$L_FLINK(R3), R3	; Take the HRB out of the queue
                    55   54 A3   D0  0924  1117 	MOVL	HRB$L_HQB(R3),R5	; Restore the HQB address
                         1C A5   B7  0928  1118 	DECW	HQB$W_NUM_QUE(R5)	; Take care of the reference count
                            63   D4  092B  1119 	CLRL	HRB$L_FLINK(R3)		; Show this HRB as unhooked
                                     092D  1120 
                                     092D  1121 70$:
                       51   65   D0  092D  1122 	MOVL	HQB$L_FLINK(R5),R1	; Get the addr of the next HQB
                    55   32 A5   D0  0930  1123 	MOVL	HQB$L_TSRV(R5),R5	; Get the address of the TSRV structure
                    50   60 A5   DE  0934  1124 	MOVAL	TSRV$L_HQB_FL(R5),R0	; If the next HQB address does not 
                       51   50   D1  0938  1125 	CMPL	R0,R1			;  not match the queue header
                            0D   13  093B  1126 	BEQL	90$			;  then we have another host to notify
                         28 A1   D5  093D  1127 	TSTL	HQB$L_CDT(R1)		; Before sending out the message, check
                            05   12  0940  1128 	BNEQ	85$			;  for a valid CDT. If none, this host.
                       55   51   D0  0942  1129 	MOVL	R1,R5			;  Get the next one off the queue.
                            E6   11  0945  1130 	BRB	70$			;
                                     0947  1131 
                                     0947  1132 85$:
                          FF39   31  0947  1133 	BRW	30$			; This one is good, send the message
                                     094A  1134 
                                     094A  1135 ;
                                     094A  1136 ;		Final status is set by CLEANUP_HRB which places SS$_NORMAL in R0.
                                     094A  1137 ;
                                     094A  1138 
                                     094A  1139 90$:
                          13DB   31  094A  1140 	BRW	TMSCP$CLEANUP_HRB	; We are finished with this request.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  26
X-17                            - NEW_DEVICE - Serve a new DSA device un 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (12)

                                     094D  1143 	.SBTTL	-	NEW_DEVICE - Serve a new DSA device unit
                                     094D  1144 
                                     094D  1145 ;+
                                     094D  1146 ; Functional Description:
                                     094D  1147 ;
                                     094D  1148 ; This is an entry point provided for the tape class driver to call 
                                     094D  1149 ; directly with the address of a newly discovered UCB. This avoids the
                                     094D  1150 ; time delay that used to occur when the tape had to be discovered by
                                     094D  1151 ; the configure process. This change was originally conceived to solve
                                     094D  1152 ; a problem with mounting shadow set virtual units cluster wide, but
                                     094D  1153 ; has found universal benefit, and so now is used for all newly found
                                     094D  1154 ; DSA (tape class driver) devices.
                                     094D  1155 ;
                                     094D  1156 ;
                                     094D  1157 ; Inputs:
                                     094D  1158 ;
                                     094D  1159 ;	R5  =  UCB address of device to be served
                                     094D  1160 ;
                                     094D  1161 ; Outputs:
                                     094D  1162 ;
                                     094D  1163 ;	R0  =  status code to be returned to the caller
                                     094D  1164 ;		SS$_NORMAL 	- Unit Available attention messages have been sent
                                     094D  1165 ;		SS$_DEVACTIVE	- This device is already being served
                                     094D  1166 ;		SS$_DEVICEFULL	- There are already MAX_UNITS being served
                                     094D  1167 ;		SS$_DEVNOTDISM	- This device is not mounted for cluster access
                                     094D  1168 ;		SS$_INSFMEM	- Not enough memory to allocate HQB
                                     094D  1169 ;
                                     094D  1170 ;	R5  =  UCB address of device to be served
                                     094D  1171 ;-
                                     094D  1172 
                                     094D  1173 ; 
                                     094D  1174 ; This is a list of the premature end codes. 
                                     094D  1175 ;
                                     094D  1176 
                                     094D  1177 TMSCP$NOSERV::	
                                     094D  1178 TMSCP$NORMAL::
                       50   01   D0  094D  1179 	MOVL	#SS$_NORMAL,R0		; They already have what they want
                                     0950  1180 
                                     0950  1181 TMSCP$RESTOR::
                       101E 8F   BA  0950  1182 	POPR	#^M<R1,R2,R3,R4,AP>	; Restore all the registers used 
                                 05  0954  1183 	RSB				;  and return to the caller
                                     0955  1184 
                                     0955  1185 TMSCP$NEW_DEVICE::
                                     0955  1186 	.IF	DEFINED DEBUG$PC_HISTORY
                                     0955  1187 	BSBW	TMSCP$PCHIST		; Log the PC for debugging.
                                     0955  1188 	.ENDC  ;DEBUG$PC_HISTORY
                       101E 8F   BB  0955  1189 	PUSHR	#^M<R1,R2,R3,R4,AP>	; Save all the registers before starting
                                     0959  1190 
                                     0959  1191 ;
                                     0959  1192 ; If auto-serving is not turned on, we know this device should not be served. 
                                     0959  1193 ; Control can be returned to caller with no further action. Otherwise, the 
                                     0959  1194 ; device  information needs to be checked to make sure it complies with the 
                                     0959  1195 ; serving guidelines.
                                     0959  1196 ;
                                     0959  1197 
                    4C A5   02   91  0959  1198 	CMPB	#DC$_TAPE, -		; Make sure this device is a tape
                                     095D  1199 		UCB$B_DEVCLASS(R5)	;  before we go any farther
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  27
X-17                            - NEW_DEVICE - Serve a new DSA device un 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (12)

                            EE   12  095D  1200 	BNEQ	TMSCP$NORMAL		; Not a tape, get out now!
                    54   2C A5   D0  095F  1201 	MOVL	UCB$L_DDB(R5),R4	; Get the DDB address
                   00000000'GF   D1  0963  1202 	CMPL	G^CLU$GL_TAPE_ALLOCLS,-	; Compare allocation class of host
                         3C A4       0969  1203 		DDB$L_ALLOCLS(R4)	;  with allocation class of device
                            E0   12  096B  1204 	BNEQ	TMSCP$NOSERV		; Must be the same (for now at least)
                            07   E0  096D  1205 	BBS	#DEV$V_SRV,-		; If the device is already
                         40 A5       096F  1206 		UCB$L_DEVCHAR2(R5),-	;  served,
                            DB       0971  1207 		TMSCP$NOSERV		;  don't serve it again
                                     0972  1208 
                                     0972  1209 ;
                                     0972  1210 ; Now we are dealing with a valid device for serving. Check for a local 
                                     0972  1211 ; connection that the allocation class is properly set.
                                     0972  1212 ; 
                            05   E1  0972  1213 	BBC	#DEV$V_MSCP,-		; If not a MSCP tape, this device is
                      34 40 A5       0974  1214 		UCB$L_DEVCHAR2(R5),10$	;  ok to serve due to non-zero serve_all
                            03   E0  0977  1215 	BBS	#DEV$V_CDP,-		; If the class driver created this UCB
                         40 A5       0979  1216 		UCB$L_DEVCHAR2(R5),-	;  for temporary use, this is not a real
                            D1       097B  1217 		TMSCP$NOSERV		;  device and should not be served.
                  50   00D8 C5   D0  097C  1218 	MOVL	UCB$L_CDDB(R5),R0	; Get a pointer to the CDDB
                            CA   13  0981  1219 	BEQL	TMSCP$NOSERV		; If this is a "temp" UCB don't serve
                   00000000'GF   D5  0983  1220 	TSTL	G^CLU$GL_TAPE_ALLOCLS	; If the allocation class of this
                            08   12  0989  1221 	BNEQ	7$			;  node is zero,
                                     098B  1222 
                                     098B  1223 5$:
                            02   E1  098B  1224 	BBC	#MSCP$V_CF_MLTHS,-	; or the controller for this device
                      03 28 A0       098D  1225 		CDDB$W_CNTRLFLGS(R0),7$	;  is an HSC, don't serve it.
                                     0990  1226 
                                     0990  1227 6$:
                          FFBA   31  0990  1228 	BRW	TMSCP$NOSERV		; Provide a place to reach exit
                                     0993  1229 
                                     0993  1230 7$:
                            04   91  0993  1231 	CMPB	#MSCP$K_CM_EMULA,-	; Otherwise,
                         26 A0       0995  1232 		CDDB$B_CNTRLMDL(R0)	; If this is not a served path
                            12   12  0997  1233 	BNEQ	10$			; Serve the device       
                                     0999  1234 
                            04   E1  0999  1235 	BBC	#DEV$V_2P,-		; Check to make sure this is a 
                      F2 40 A5       099B  1236 		UCB$L_DEVCHAR2(R5),6$	;  dual path device
                  50   00DC C5   D0  099E  1237 	MOVL	UCB$L_2P_CDDB(R5),R0	; Get a pointer to the CDDB
                            EB   13  09A3  1238 	BEQL	6$			; Give up if there is no alternate
                            04   91  09A5  1239 	CMPB	#MSCP$K_CM_EMULA,-	; Check to see if the alternate path
                         26 A0       09A7  1240 		CDDB$B_CNTRLMDL(R0)	;  is to a server also
                            E5   13  09A9  1241 	BEQL	6$			; This is a server path too give up 
                                     09AB  1242 
                                     09AB  1243 10$:
              54   00000000'GF   D0  09AB  1244 	MOVL	G^SCS$GL_TMSCP,R4	;  and the address of the TSRV 
                            53   D4  09B2  1245 	CLRL	R3			; Init this reg for table index later
                    50   5E A4   3C  09B4  1246 	MOVZWL	TSRV$W_NUM_UNIT(R4),R0	; Get the number of units
              00000100 8F   50   D1  09B8  1247 	CMPL	R0,#MAX_UNITS		;  and see if we are over the max
                            1A   14  09BF  1248 	BGTR	TMSCP$FULL		;  if we are, return an error
                                     09C1  1249 
                            13   E1  09C1  1250 	BBC	#DEV$V_MNT,-		; If the tape is not mounted yet,
                      02 3C A5       09C3  1251 		UCB$L_DEVCHAR(R5),20$	;  we can begin serving it
                            1D   11  09C6  1252 	BRB	TMSCP$NOTSHR		; Can't serve an allocated device.
                                     09C8  1253 
                                     09C8  1254 ;
                                     09C8  1255 ; Search through the UQB queue to make sure that a UQB for this unit does 
                                     09C8  1256 ; not already exist. If none is found, memory is allocated, the UQB is 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  28
X-17                            - NEW_DEVICE - Serve a new DSA device un 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (12)

                                     09C8  1257 ; filled in, and linked into the UQB list in proper order by ascending 
                                     09C8  1258 ; unit number.
                                     09C8  1259 ;
                                     09C8  1260 
                                     09C8  1261 20$:
                51   00C4 C443   D0  09C8  1262 	MOVL	TSRV$L_UNITS(R4)[R3],R1	; Get UQB address from the table
                            27   13  09CE  1263 	BEQL	TMSCP$CREATE_UQB	; If this is the end, create one
                            53   D6  09D0  1264 	INCL	R3			; Add one to the index
                    55   24 A1   D1  09D2  1265 	CMPL	UQB$L_UCB(R1),R5	; See if the UCB for this unit matches
                            F0   12  09D6  1266 	BNEQ	20$			; No match, keep looking
                          FF72   31  09D8  1267 	BRW	TMSCP$NORMAL		; They already have what they want
                                     09DB  1268 
                                     09DB  1269 TMSCP$FULL::
              50   00000850 8F   D0  09DB  1270 	MOVL	#SS$_DEVICEFULL,R0	; There are already MSX_UNITS
                          FF6B   31  09E2  1271 	BRW	TMSCP$RESTOR		;  being served
                                     09E5  1272 
                                     09E5  1273 TMSCP$NOTSHR::
              50   000021B4 8F   D0  09E5  1274 	MOVL	#SS$_DEVNOTDISM,R0	; This device is not mounted for 
                          FF61   31  09EC  1275 	BRW	TMSCP$RESTOR		;  cluster wide access
                                     09EF  1276 
                                     09EF  1277 TMSCP$NOMEM::
                  50   0124 8F   3C  09EF  1278 	MOVZWL	#SS$_INSFMEM,R0		; Not enough memory to allocate
                          FF59   31  09F4  1279 	BRW	TMSCP$RESTOR		;  a decent UQB
                                     09F7  1280 
                                     09F7  1281 ;
                                     09F7  1282 ; There is no UQB for a device with this unit number.
                                     09F7  1283 ;
                                     09F7  1284 
                                     09F7  1285 TMSCP$CREATE_UQB::
                                     09F7  1286 	.IF	DEFINED DEBUG$PC_HISTORY
                                     09F7  1287 	BSBW	TMSCP$PCHIST		; Log the PC for debugging.
                                     09F7  1288 	.ENDC  ;DEBUG$PC_HISTORY
                  51   00CA 8F   3C  09F7  1289 	MOVZWL	#UQB$K_LENGTH,R1	; Set size of the UQB structure
                   00000000'GF   16  09FC  1290 	JSB	G^EXE$ALONONPAGED	; Grab some pool
                         EA 50   E9  0A02  1291 	BLBC	R0,TMSCP$NOMEM		; If there was insf memory for alloc
                                     0A05  1292 
                            3F   BB  0A05  1293 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                  00   6E   00   2C  0A07  1294 	MOVC5	#0,(SP),#0,-		; Initialize entire structure in
                  62   00CA 8F       0A0B  1295 		#UQB$K_LENGTH,(R2)	;  in one fell swoop. 
                            3F   BA  0A0F  1296 	POPR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                                     0A11  1297 ;
                                     0A11  1298 ; Make the allocated memory look like a UQB. R2 points to the allocated region
                                     0A11  1299 ;
                                 C8  0A11  1300 	BISL	#<DEV$M_CLU!-		; Set the 'Avail Cluster wide' bit
                                     0A12  1301 		DEV$M_SRV>,-		;  and 'MSCP SERVER' bits
           40 A5   00000081 8F       0A12  1302 		UCB$L_DEVCHAR2(R5)
                    08 A2   51   B0  0A19  1303 	MOVW	R1,UQB$W_SIZE(R2)	; Set the size
                    24 A2   55   D0  0A1D  1304 	MOVL	R5,UQB$L_UCB(R2)	; Save away the UCB address
                         73 8F   90  0A21  1305 	MOVB	#DYN$C_TSRV,-		; This is the tape based server
                         0A A2       0A24  1306 		UQB$B_TYPE(R2)		;  data structure
                            04   90  0A26  1307 	MOVB	#DYN$C_TSRV_UQB,-	; More specifically, it is a 
                         0B A2       0A28  1308 		UQB$B_SUBTYPE(R2)	;  Unit Queue Block structure
                            04   B0  0A2A  1309 	MOVW	#UQB$K_ST_AVAILABLE,-	; Set the initial state of this
                         0C A2       0A2C  1310 		UQB$W_STATE(R2)		;  unit to available
                         68 A5   B0  0A2E  1311 	MOVW	UCB$W_UNIT(R5),-	; Get the "real" unit number
                         1C A2       0A31  1312 		UQB$W_UNIT(R2)		;  (the one off the plug)
                                     0A33  1313 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  29
X-17                            - NEW_DEVICE - Serve a new DSA device un 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (12)

                    50   2C A5   D0  0A33  1314 	MOVL	UCB$L_DDB(R5),R0	; Get the device data block
                         3C A0   D0  0A37  1315 	MOVL	DDB$L_ALLOCLS(R0),-	; Move the allocation class into
                         18 A2       0A3A  1316 		UQB$L_ALLOCLS(R2)	;  the unit ID field
                         5E A4   B0  0A3C  1317 	MOVW	TSRV$W_NUM_UNIT(R4),-	; Then assign the local unit
                         5E A2       0A3F  1318 		UQB$W_SLUN(R2)		;  number (unit table index)
                       4000 8F   A8  0A41  1319 	BISW	#MSCP$M_SLUN,-		; Set the bit in the unit number
                         5E A2       0A45  1320 		UQB$W_SLUN(R2)		;  indicating a server local unit
                         5E A4   B6  0A47  1321 	INCW	TSRV$W_NUM_UNIT(R4)	; Ratchet the number of known units
                    51   15 A0   9A  0A4A  1322 	MOVZBL	DDB$T_NAME+1(R0),R1	; Put the first letter in a reg
                    51   40 8F   82  0A4E  1323 	SUBB2	#^X40,R1		;  and normalize it 
                            51   F0  0A52  1324 	INSV	R1,-			; Add to those the first letter of 
                                     0A54  1325 		#UQB$V_D0,-		;  the device name
                       05   0A       0A54  1326 		#UQB$S_D0,-		; 
                         1E A2       0A56  1327 		UQB$W_DEVNAME(R2)	; 
                    51   16 A0   9A  0A58  1328 	MOVZBL	DDB$T_NAME+2(R0),R1	; Put the second character in a reg
                    51   40 8F   82  0A5C  1329 	SUBB2	#^X40,R1		;  and normalize it
                            51   F0  0A60  1330 	INSV	R1,-			; Get the second letter
                                     0A62  1331 		#UQB$V_D1,-		;  of the device name
                       05   05       0A62  1332 		#UQB$S_D1,-		;  and save that also
                         1E A2       0A64  1333 		UQB$W_DEVNAME(R2)	; 
                    51   17 A0   9A  0A66  1334 	MOVZBL	DDB$T_NAME+3(R0),R1	; Put the controller letter in a reg
                    51   40 8F   82  0A6A  1335  	SUBB2	#^X40,R1		;  and normalize that before saving
                            51   F0  0A6E  1336 	INSV	R1,-			; Retrieve the controller letter
                                     0A70  1337 		#UQB$V_C,-		;  and save that away as the
                       05   00       0A70  1338        		#UQB$S_C,-		;  last of the device name
                         1E A2       0A72  1339 		UQB$W_DEVNAME(R2)	;  to be saved
                                     0A74  1340 
                                     0A74  1341 ;
                                     0A74  1342 ; For the unique multi unit code, use the server local unit number as the 
                                     0A74  1343 ; spindle specifier in the high byte, and set the low byte (access path) 
                                     0A74  1344 ; to zero.
                                     0A74  1345 ;
                    50   5E A2   3C  0A74  1346 	MOVZWL	UQB$W_SLUN(R2),R0	; Get the "local" unit number
              50   0000C000 8F   CA  0A78  1347 	BICL	#<MSCP$M_SHADOW!-	; Clear out the shadow bit
                                     0A7F  1348 		MSCP$M_SLUN>,R0		;  and the SLUN bit before range checking
                00C4 C440   52   D0  0A7F  1349 	MOVL	R2,TSRV$L_UNITS(R4)[R0]	; Save the UQB address in the table
                  50   50   08   78  0A85  1350 	ASHL	#8,R0,R0		; Shift it into the high byte
                    14 A2   50   B0  0A89  1351 	MOVW	R0,UQB$W_MULT_UNIT(R2)	; Save it away in the UQB
                       00FA C5   B0  0A8D  1352 	MOVW	UCB$W_UNIT_FLAGS(R5),-	; Use the unit flags from the UCB 
                         16 A2       0A91  1353 		UQB$W_UNIT_FLAGS(R2)	;  just as they are in the UQB
                            19   E1  0A93  1354 	BBC	#DEV$V_SWL,-		; Check the device characteristics
                      06 3C A5       0A95  1355 		UCB$L_DEVCHAR(R5),60$	;  for software writelock
                       2000 8F   A8  0A98  1356 	BISW	#MSCP$M_UF_WRTPH,-	; If it is, set the hw flag 
                         16 A2       0A9C  1357 		UQB$W_UNIT_FLAGS(R2)	;  so we don't issue writes to it
                                     0A9E  1358 
                                     0A9E  1359 ;
                                     0A9E  1360 ; Set the queue header counters and list heads to their initial values.
                                     0A9E  1361 ;
                                     0A9E  1362 
                                     0A9E  1363 60$:
                         2C A2   DE  0A9E  1364 	MOVAL	UQB$L_BLOCKED_FL(R2),-	; Initialize the forward and 
                         2C A2       0AA1  1365 		UQB$L_BLOCKED_FL(R2)	; 
                         2C A2   DE  0AA3  1366 	MOVAL	UQB$L_BLOCKED_FL(R2),-	;  backward pointers to point to
                         30 A2       0AA6  1367 		UQB$L_BLOCKED_BL(R2)	;  the forward link of the blocked que
                    6C B4   62   0E  0AA8  1368 	INSQUE	UQB$L_FLINK(R2), -	; Insert the UQB into the queue
                                     0AAC  1369 		@TSRV$L_UQB_BL(R4)
                                     0AAC  1370 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  30
X-17                            - NEW_DEVICE - Serve a new DSA device un 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (12)

                                     0AAC  1371 ;
                                     0AAC  1372 ; Go off to MSCP to ADD a tape unit. When the ADDUNIT routine is eliminated,
                                     0AAC  1373 ; change this call format to use a simple JSB and leave the stack alone. 
                                     0AAC  1374 ;
                            52   DD  0AAC  1375 	PUSHL	R2			; Copy UQB pointer
                            02   DD  0AAE  1376 	PUSHL	#TSRV$K_AR_ADD		; Opcode for MSCP action routines
                            02   DD  0AB0  1377 	PUSHL	#2			; Only 2 parameters
                       5C   5E   D0  0AB2  1378 	MOVL	SP,AP			; Set address of parameter area
                       FD91 CF   16  0AB5  1379 	JSB	TMSCP$ADD		; Go to the routine
                       5E   0C   C0  0AB9  1380 	ADDL	#12,SP			; Clean up the stack before returning
                          FE8E   31  0ABC  1381 	BRW	TMSCP$NORMAL		; Return a successful status
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  31
X-17                            - MV_SET_OFFLINE - Mount Verification se 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (13)

                                     0ABF  1384 	.SBTTL	-	MV_SET_OFFLINE - Mount Verification set a device to the "offline" state.
                                     0ABF  1385 
                                     0ABF  1386 ;+
                                     0ABF  1387 ; Functional Description:
                                     0ABF  1388 ;
                                     0ABF  1389 ; This routine is JSB'd to from a mount verification thread. 
                                     0ABF  1390 ; The UCB of a particular tape is passed to this routine in
                                     0ABF  1391 ; R5. The corresponding UQB for this device is found, the
                                     0ABF  1392 ; field UQB$L_ONLINE_HQB is cleared, and the state is changed to
                                     0ABF  1393 ; "AVAILABLE".
                                     0ABF  1394 ;
                                     0ABF  1395 ;
                                     0ABF  1396 ; Inputs:
                                     0ABF  1397 ;
                                     0ABF  1398 ;	R5  =  UCB address
                                     0ABF  1399 ;
                                     0ABF  1400 ; Outputs:
                                     0ABF  1401 ;
                                     0ABF  1402 ;	None - all registers preserved
                                     0ABF  1403 ;-
                                     0ABF  1404 
                                     0ABF  1405 TMSCP$MV_SET_OFFLINE::
                            17   BB  0ABF  1406 	PUSHR	#^M<R0,R1,R2,R4>	; Save all the registers before starting
                                     0AC1  1407 	LOCK	LOCKNAME=SCS,-		; Lock SCS access
                                     0AC1  1408 		PRESERVE=NO,-		;  no need to preserve R0
                                     0AC1  1409 		SAVIPL=-(SP)		;  save the current IPL
                       7E   12   DB  0AC1       	 MFPR	S^#PR$_IPL,-(SP)
                0B 00000000'GF   E9  0AC4       	BLBC	G^SMP$GL_FLAGS,30026$
                       50   34   9A  0ACB       	 MOVZBL	S^#SPL$C_SCS,R0
                   00000000'GF   16  0ACE       	 JSB	G^SMP$ACQUIRE
                            03   11  0AD4       	BRB	30027$
                                     0AD6       30026$:
                       12   08   DA  0AD6       		MTPR	S^#IPL$_SCS,S^#PR$_IPL
                                     0AD9       30027$:
                                     0AD9  1410 	.IF	DEFINED DEBUG$PC_HISTORY
                                     0AD9  1411 	BSBW	TMSCP$PCHIST		; Log the PC for debugging.
                                     0AD9  1412 	.ENDC  ;DEBUG$PC_HISTORY
              51   00000000'GF   D0  0AD9  1413 	MOVL	G^SCS$GL_TMSCP,R1	; Get the address of the server
                    54   68 A1   DE  0AE0  1414 	MOVAL	TSRV$L_UQB_FL(R1),R4	; Get the queue list head address
                       52   54   D0  0AE4  1415 	MOVL	R4,R2			;  and save it to verify the whole
                                     0AE7  1416 
                                     0AE7  1417 	ASSUME	UQB$L_FLINK EQ 0
                                     0AE7  1418 
                                     0AE7  1419 10$:
                       54   64   D0  0AE7  1420 	MOVL	UQB$L_FLINK(R4),R4	;  queue has been searched
                       52   54   D1  0AEA  1421 	CMPL	R4,R2			; End of UQB list?
                            1B   13  0AED  1422 	BEQL	60$			; If eql yes
                    55   24 A4   D1  0AEF  1423 	CMPL	UQB$L_UCB(R4),R5	; Is this the UQB for this unit?
                            F2   12  0AF3  1424 	BNEQ	10$			; If neq no
                                     0AF5  1425 
                                     0AF5  1426 ;
                                     0AF5  1427 ; A UQB was found that corresponds to the UCB address passed.
                                     0AF5  1428 ; The HQB field that represented the host that held 
                                     0AF5  1429 ; the tape online is cleared. The UCB online count is sanity tested.
                                     0AF5  1430 ;
                                     0AF5  1431 
                            04   B0  0AF5  1432 	MOVW	#UQB$K_ST_AVAILABLE,-	; Now set the state of this device to
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  32
X-17                            - MV_SET_OFFLINE - Mount Verification se 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (13)

                         0C A4       0AF7  1433 		UQB$W_STATE(R4)		;   offline.
                         70 A4   D4  0AF9  1434 	CLRL	UQB$L_ONLINE_HQB(R4)	; Not online to any host now.
                       00C2 C5   97  0AFC  1435 	DECB	UCB$B_ONLCNT(R5)	;  and note the change in online count
                       00C2 C5   95  0B00  1436 	TSTB	UCB$B_ONLCNT(R5)	; Online count should be zero
                            04   13  0B04  1437 	BEQL	60$			;
                                     0B06  1438 
                                     0B06  1439 	BUG_CHECK TMSCPSERV, FATAL	; Online count was not "1" when we entered
                               FEFF  0B06       		.WORD	^XFEFF
                               0004' 0B08       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_TMSCPSERV!4
                                     0B0A  1440 					;  this routine.
                                     0B0A  1441 
                                     0B0A  1442 60$:
                                     0B0A  1443 	UNLOCK	LOCKNAME=SCS,-		; Release SCS access
                                     0B0A  1444 		PRESERVE=NO,-		;  don't preserve R0
                                     0B0A  1445 		NEWIPL=(SP)+,-		;  return to former IPL
                                     0B0A  1446 		CONDITION=RESTORE	;  restore spinlock to previous state
                09 00000000'GF   E9  0B0A       	BLBC	G^SMP$GL_FLAGS,30033$
                       50   34   9A  0B11       	 MOVZBL	S^#SPL$C_SCS,R0
                   00000000'GF   16  0B14       	 JSB	G^SMP$RESTORE
                                     0B1A       30033$:
                       12   8E   DA  0B1A       	 MTPR	(SP)+,S^#PR$_IPL
                            17   BA  0B1D  1447 	POPR	#^M<R0,R1,R2,R4>	; Restore all the registers 
                                 05  0B1F  1448 	RSB				; And resume mount verification
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  33
X-17                            - LISTEN - Listen for a Connect Request  16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (14)

                                     0B20  1451 	.SBTTL	-	LISTEN - Listen for a Connect Request
                                     0B20  1452 
                                     0B20  1453 ;+
                                     0B20  1454 ; Functional Description:
                                     0B20  1455 ;
                                     0B20  1456 ; When another cluster member wants to connect with the server, control
                                     0B20  1457 ; is passed here as a fork process initiated by the port driver at IPL$_SCS.
                                     0B20  1458 ; Upon a successful acceptance, this routine allocates a host queue block 
                                     0B20  1459 ; and is then prepared to receive MSCP request packets from that host.
                                     0B20  1460 ;
                                     0B20  1461 ; The connection application itself is not treated as a true request. No 
                                     0B20  1462 ; HRB is created for it, and no context is saved. It is either accepted or 
                                     0B20  1463 ; rejected in this routine.
                                     0B20  1464 ;
                                     0B20  1465 ; Inputs:                                 
                                     0B20  1466 ;	R0  =  Scratch
                                     0B20  1467 ;	R1  =  Scratch
                                     0B20  1468 ;	R2  =  Connect message packet address
                                     0B20  1469 ;	R3  =  CDT
                                     0B20  1470 ;	R4  =  PDT
                                     0B20  1471 ;	R5  =  Scratch
                                     0B20  1472 ;
                                     0B20  1473 ; Outputs:
                                     0B20  1474 ;	None (the connection is either accepted or rejected)
                                     0B20  1475 ;
                                     0B20  1476 ; All registers are preserved.
                                     0B20  1477 ;-
                                     0B20  1478 
                                     0B20  1479 TMSCP$LISTEN::
                                     0B20  1480 	.IF DEFINED DEBUG$PC_HISTORY
                                     0B20  1481 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0B20  1482 	.ENDC	   ;DEBUG$PC_HISTORY
                                     0B20  1483 
                                     0B20  1484 ;
                                     0B20  1485 ; Allocate an HQB for this host.
                                     0B20  1486 ;
                                     0B20  1487 
                                     0B20  1488 10$:
                            52   DD  0B20  1489 	PUSHL	R2			; Save the connect message address
                       51   3E   3C  0B22  1490 	MOVZWL	#HQB$K_LENGTH,R1	; Get the size of the host queue block
                   00000000'GF   16  0B25  1491 	JSB	G^EXE$ALONONPAGED	;  and allocate that much memory
                       55   52   D0  0B2B  1492 	MOVL	R2,R5			; Get the HQB address in R5
                            52 8ED0  0B2E  1493 	POPL	R2			; Pop the saved connect message address
                         03 50   E8  0B31  1494 	BLBS	R0,15$			; Continue if successful
                                     0B34  1495 	.IF DEFINED DEBUG$REJECT_TRACKING
                                     0B34  1496 	MOVL	G^ SCS$GL_TMSCP, R1	; Get TSRV address.
                                     0B34  1497 	MOVL	R0,TSRV$L_REPLC_CNT+8(R1); Save away the error code
                                     0B34  1498 	INCL	TSRV$L_REPLC_CNT+12(R1)	; Save away a record of the reject
                                     0B34  1499 	.ENDC	   ;DEBUG$REJECT_TRACKING
                          00A1   31  0B34  1500 	BRW	TMSCP$REJECT		; Reject this connection.
                                     0B37  1501 
                                     0B37  1502 ;
                                     0B37  1503 ; Fill in as many fields as possible to initialize the HQB for use.
                                     0B37  1504 ;
                                     0B37  1505 
                                     0B37  1506 15$:
                            3F   BB  0B37  1507 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  34
X-17                            - LISTEN - Listen for a Connect Request  16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (14)

                  00   6E   00   2C  0B39  1508 	MOVC5	#0,(SP),#0,-		; Initialize entire structure in
                       65   3E       0B3D  1509 		#HQB$K_LENGTH,(R5)	;  in one fell swoop. 
                            3F   BA  0B3F  1510 	POPR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                    08 A5   51   B0  0B41  1511 	MOVW	R1,HQB$W_SIZE(R5)	; Set length of the data structure
                         73 8F   90  0B45  1512 	MOVB	#DYN$C_TSRV,-		; The structure type
                         0A A5       0B48  1513 		HQB$B_TYPE(R5)		;  is tape server
                            02   90  0B4A  1514 	MOVB	#DYN$C_TSRV_HQB,-	; The structure subtype
                         0B A5       0B4C  1515 		HQB$B_SUBTYPE(R5)	;  is Host Queue Block
                                     0B4E  1516 
                    50   20 A2   D0  0B4E  1517 	MOVL	<SCS$B_CON_DAT-SCS$T_DST_PROC>(R2),R0	; Get the address of
                                     0B52  1518 					;  the data field
                            09   13  0B52  1519 	BEQL	25$			; Can't talk to V4.x class drivers - branch.
              322E3556 8F   50   D1  0B54  1520 	CMPL	R0,#^A/V5.2/		; Does remote class driver support tape
                            03   13  0B5B  1521 	BEQL	30$			; servers?  Yes - branch.
                                     0B5D  1522 
                                     0B5D  1523 25$:					; If not, we can't communicate.
                          006F   31  0B5D  1524 	BRW	TMSCP$REJECT_REQUEST	; Kill this request.
                                     0B60  1525 
                                     0B60  1526 30$:
                            02   A8  0B60  1527 	BISW	#HQB$M_V5CL,-		; Tape servers supported, use SLUNS (V5).
                         12 A5       0B62  1528 		HQB$W_FLAGS(R5)		;  flag (let's save a flag in $HQBDEF.)
                         20 A5   DE  0B64  1529 	MOVAL	HQB$L_HRB_FL(R5),-	; Initialize the list head for the
                         20 A5       0B67  1530 		HQB$L_HRB_FL(R5)	;  Host Request Blocks that are
                         20 A5   DE  0B69  1531 	MOVAL	HQB$L_HRB_FL(R5),-	;  currently being processed on 
                         24 A5       0B6C  1532 		HQB$L_HRB_BL(R5)	;  behalf of this host
                    28 A5   53   D0  0B6E  1533 	MOVL	R3,HQB$L_CDT(R5)	; Save away the CDT address
              51   00000000'GF   D0  0B72  1534 	MOVL	G^SCS$GL_TMSCP,R1	; Get the TSRV address
                    32 A5   51   D0  0B79  1535 	MOVL	R1,HQB$L_TSRV(R5)	;  and store it away in the HQB
                                     0B7D  1536 
                         5C A1   B1  0B7D  1537 	CMPW	TSRV$W_NUM_HOST(R1),-	; Max number of hosts being served?
                       0100 8F       0B80  1538 		#MAX_HOSTS		;
                            4A   18  0B83  1539 	BGEQ	TMSCP$NO_ROOM		;  beyond the end of the table
                    10 A5   3C   B0  0B85  1540 	MOVW	#60,HQB$W_HTIMO(R5)	; Default host access timeout 
                                     0B89  1541 
                                     0B89  1542 ;
                                     0B89  1543 ; ACCEPT the connection request, and link in the HQB.
                                     0B89  1544 ;		R3  =  CDT address
                                     0B89  1545 ;		R4  =  PDT address
                                     0B89  1546 ;		R5  =  HQB address
                                     0B89  1547 ;
                                     0B89  1548 
                                     0B89  1549 	ASSUME	HQB$L_FLINK EQ 0
                                     0B89  1550 
                                     0B89  1551 	ACCEPT	MSGADR=TMSCP$MSG_IN,-	; Message input address
                                     0B89  1552 		ERRADR=TMSCP$VC_ERR,-	; Virtual circuit error address
                                     0B89  1553 		INITCR=#30,-		; Initial credit extended
                                     0B89  1554 		MINSCR=#1,-		; Minimum send credit
                                     0B89  1555 		CONDAT=TSRV$W_VERSION(R1),- ; CONNECT/ACCEPT data
                                     0B89  1556 		AUXSTR=HQB$L_FLINK(R5)	; HQB address
                         B6'AF   9F  0B89       		PUSHAB	B^30037$
                            04   DD  0B8C       	PUSHL	 #4
                            00   DD  0B8E       		PUSHL	#0
                            00   DD  0B90       		PUSHL	#0
                            65   9F  0B92       		PUSHAB	HQB$L_FLINK(R5)
                         3C A1   9F  0B94       		PUSHAB	TSRV$W_VERSION(R1)
                       7E   00   9B  0B97       		MOVZBW	#0,-(SP)
                       7E   00   B0  0B9A       		MOVW	#0,-(SP)
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  35
X-17                            - LISTEN - Listen for a Connect Request  16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (14)

                       7E   01   B0  0B9D       		MOVW	#1,-(SP)
                       7E   1E   B0  0BA0       		MOVW	#30,-(SP)
                       0BE0'CF   9F  0BA3       		PUSHAB	TMSCP$VC_ERR
                            00   DD  0BA7       		PUSHL	#0
                       0D93'CF   9F  0BA9       		PUSHAB	TMSCP$MSG_IN
                       7E   0C   D0  0BAD       		MOVL	#12,-(SP)
                   00000000'GF   17  0BB0       		JMP	G^SCS$ACCEPT
                                     0BB6       30037$:
                         06 50   E8  0BB6  1557 	BLBS	R0,40$			; If acceptance was unsuccessful,
                    53   28 A5   D0  0BB9  1558 	MOVL	HQB$L_CDT(R5),R3	;  restore the CDT address and 
                                     0BBD  1559 	.IF DEFINED DEBUG$REJECT_TRACKING
                                     0BBD  1560 	MOVL	G^ SCS$GL_TMSCP, R1	; Get TSRV address.
                                     0BBD  1561 	MOVL	R0,TSRV$L_REPLC_CNT+16(R1); Save away the error code
                                     0BBD  1562 	INCL	TSRV$L_REPLC_CNT+20(R1)	;  and keep a count	
                                     0BBD  1563 	.ENDC	   ;DEBUG$REJECT_TRACKING
                            10   11  0BBD  1564 	BRB	TMSCP$REJECT_CONNECTION	; Reject this request.
                                     0BBF  1565 
                                     0BBF  1566 40$:
                    51   32 A5   D0  0BBF  1567 	MOVL	HQB$L_TSRV(R5),R1	; Restore the TSRV address 
                            65   0E  0BC3  1568 	INSQUE	HQB$L_FLINK(R5),-	; Link this HQB into the list of
                         64 B1       0BC5  1569 		@TSRV$L_HQB_BL(R1)	;  all hosts being served
                         5C A1   B6  0BC7  1570 	INCW	TSRV$W_NUM_HOST(R1)	; Add one to the host count
                    28 A5   53   D0  0BCA  1571 	MOVL	R3,HQB$L_CDT(R5)	; Keep the CDT address
                                 05  0BCE  1572 	RSB
                                     0BCF  1573 
                                     0BCF  1574 TMSCP$NO_ROOM::
                                     0BCF  1575 TMSCP$REJECT_REQUEST::
                                     0BCF  1576 	.IF DEFINED DEBUG$REJECT_TRACKING
                                     0BCF  1577 	MOVL	G^ SCS$GL_TMSCP, R1	; Get TSRV address.
                                     0BCF  1578 	MOVL	R0,TSRV$L_REPLC_CNT+24(R1); Save away the bit number
                                     0BCF  1579 	INCL	TSRV$L_REPLC_CNT+28(R1)	;  and keep a count	
                                     0BCF  1580 	.ENDC	   ;DEBUG$REJECT_TRACKING
                                     0BCF  1581 
                                     0BCF  1582 TMSCP$REJECT_CONNECTION::
                       50   55   D0  0BCF  1583 	MOVL	R5,R0			; Address of the structure to deallocate
                   00000000'GF   16  0BD2  1584 	JSB	G^EXE$DEANONPAGED	; Free the memory allocated to the HQB
                                     0BD8  1585 
                                     0BD8  1586 TMSCP$REJECT::
                                     0BD8  1587 	REJECT	#1			; Reject the connect application
                       50   01   D0  0BD8       		MOVL	#1, R0
                         4C B4   16  0BDB       		JSB	@PDT$L_REJECT(R4)
                                 05  0BDE  1588 	RSB				;  and return to the caller
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  36
X-17                            - Virtual Circuit Error Routine          16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (15)

                                     0BDF  1591 	.SBTTL	-	Virtual Circuit Error Routine
                                     0BDF  1592 
                                     0BDF  1593 ;+
                                     0BDF  1594 ; Functional Description:
                                     0BDF  1595 ;
                                     0BDF  1596 ; This routine handles a virtual circuit failure, cleaning up all the 
                                     0BDF  1597 ; requests that were outstanding for the host whose connection failed,
                                     0BDF  1598 ; and then removing the HQB for the failed host from the T/MSCP server
                                     0BDF  1599 ; data structures. 
                                     0BDF  1600 ;
                                     0BDF  1601 ; This routine is set up as the virtual circuit error handling routine
                                     0BDF  1602 ; when the connect is issued. Control is passed here in fork context when
                                     0BDF  1603 ; a link failure is detected, or a disconnect is issued.
                                     0BDF  1604 ;
                                     0BDF  1605 ; Inputs:
                                     0BDF  1606 ;
                                     0BDF  1607 ;	R0  =  Scratch
                                     0BDF  1608 ;	R1  =  Scratch
                                     0BDF  1609 ;	R2  =  Scratch
                                     0BDF  1610 ;	R3  =  CDT address
                                     0BDF  1611 ;	R4  =  PDT address
                                     0BDF  1612 ;	R5  =  Scratch
                                     0BDF  1613 ;
                                     0BDF  1614 ; Outputs:
                                     0BDF  1615 ;	
                                     0BDF  1616 ;	None
                                     0BDF  1617 ;
                                     0BDF  1618 ;-
                                     0BDF  1619 
                                     0BDF  1620 TMSCP$VC_ERR_ABORT::
                                 05  0BDF  1621 	RSB				; Out of line return to caller this
                                     0BE0  1622 					;  connection is already being terminated
                                     0BE0  1623 
                                     0BE0  1624 TMSCP$VC_ERR::
                                     0BE0  1625 	.IF DEFINED DEBUG$PC_HISTORY
                                     0BE0  1626 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0BE0  1627 	.ENDC	   ;DEBUG$PC_HISTORY
                    55   5C A3   D0  0BE0  1628 	MOVL	CDT$L_AUXSTRUC(R3),R5	; Pick up the HQB address
                            01   E2  0BE4  1629 	BBSS	#HQB$V_DISCON_INIT,-	; If this system is VERY low on NPP
                         0D A5       0BE6  1630 		HQB$B_STATE(R5),-	;  this routine could be called from
                            F6       0BE8  1631 		TMSCP$VC_ERR_ABORT	;  within the server (see TMSCP$MSG_IN)
                    51   32 A5   D0  0BE9  1632 	MOVL	HQB$L_TSRV(R5),R1	; Get the address of the server struct
                       0564 C1   D6  0BED  1633 	INCL	TSRV$L_VCFAIL_CNT(R1)	; Keep a count of the link disconnects
                                     0BF1  1634 
                                     0BF1  1635 ;
                                     0BF1  1636 ; Retrieve all CDRPs that are active on this CDT.
                                     0BF1  1637 ;
                            20   BB  0BF1  1638 	PUSHR	#^M<R5>			; Save the registers from destruction
                                     0BF3  1639 	SCAN_RSPID_WAIT-		; Scan message buffer and send credit wait
                                     0BF3  1640 		action = TMSCP$UNHOOK_CDRP  ;  queues for CDRP with given CDT in R3.
                  50   2112'CF   9E  0BF3       		MOVAB	TMSCP$UNHOOK_CDRP, R0
                   00000000'GF   16  0BF8       		JSB	G^SCS$LKP_RDTWAIT
                                     0BFE  1641 	.IF DEFINED DEBUG$PC_HISTORY
                                     0BFE  1642 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0BFE  1643 	.ENDC	   ;DEBUG$PC_HISTORY
                                     0BFE  1644 	SCAN_RDT-			; Scan RDT for CDRP.
                                     0BFE  1645 		action = TMSCP$UNHOOK_CDRP
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  37
X-17                            - Virtual Circuit Error Routine          16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (15)

                  50   2112'CF   9E  0BFE       		MOVAB	TMSCP$UNHOOK_CDRP, R0
                   00000000'GF   16  0C03       		JSB	G^SCS$LKP_RDTCDRP
                                     0C09  1646 	.IF DEFINED DEBUG$PC_HISTORY
                                     0C09  1647 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0C09  1648 	.ENDC	   ;DEBUG$PC_HISTORY
                                     0C09  1649 	SCAN_MSGBUF_WAIT- 		; Scan RSPID wait queue for CDRP.
                                     0C09  1650 		action = TMSCP$UNHOOK_CDRP
                  50   2112'CF   9E  0C09       		MOVAB	TMSCP$UNHOOK_CDRP, R0
                   00000000'GF   16  0C0E       		JSB	G^SCS$LKP_MSGWAIT
                                     0C14  1651 	.IF DEFINED DEBUG$PC_HISTORY
                                     0C14  1652 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0C14  1653 	.ENDC	   ;DEBUG$PC_HISTORY
                            20   BA  0C14  1654 	POPR	#^M<R5>			; Restore the saved registers
                                     0C16  1655 
                                     0C16  1656 ;
                                     0C16  1657 ; Go through the list of host request blocks and dequeue all the outstanding
                                     0C16  1658 ; requests that are not in progress. If the request involves a transfer that 
                                     0C16  1659 ; is in progress, the HRB is marked "abort", and is dequeued when the transfer
                                     0C16  1660 ; completes.
                                     0C16  1661 ; 
                                     0C16  1662 ; States: 
                                     0C16  1663 ;	
                                     0C16  1664 ;	HRB$K_ST_MSG_WAIT is set in 1) ADD when a message buffer is allocated
                                     0C16  1665 ;			  to use as the buffer to notify all hosts of a new
                                     0C16  1666 ;			  unit and 2) in TMSCP$SEND_END when a command packet is
                                     0C16  1667 ;			  recycled to be an end packet.
                                     0C16  1668 ;
                                     0C16  1669 ;	HRB$K_ST_SEQ_WAIT is set in BLOCKED when a sequential command is put on
                                     0C16  1670 ;			  the blocked queue.
                                     0C16  1671 ;	
                                     0C16  1672 ;	HRB$K_ST_SNDAT_WAIT is set in 1) READ when sending data to host buffer
                                     0C16  1673 ;			    and 2) in WRITE when receiving data from the host.
                                     0C16  1674 ;
                                     0C16  1675 ;	HRB$K_ST_DRV_WAIT is set in SEND_IRP, the routine which queues an
                                     0C16  1676 ;			  IRP to the local driver.
                                     0C16  1677 ;
                                     0C16  1678 ;	HRB$K_ST_MAP_WAIT is set in 1) READ when mapping a buffer for a read request
                                     0C16  1679 ;			  and 2) in WRITE when mapping a buffer for a write request
                                     0C16  1680 ;
                                     0C16  1681 ;
                    51   20 A5   DE  0C16  1682 	MOVAL	HQB$L_HRB_FL(R5),R1	; Get the address of the HRB list head
                       52   51   D0  0C1A  1683 	MOVL	R1,R2			;  and move it to a new register
                                     0C1D  1684 
                                     0C1D  1685 	ASSUME	HRB$L_FLINK EQ 0
                                     0C1D  1686 
                                     0C1D  1687 30$:
                       51   61   D0  0C1D  1688 	MOVL	HRB$L_FLINK(R1),R1	; Get the address of the next HRB
                       52   51   D1  0C20  1689 	CMPL	R1,R2			; If we are back at the list head,
                            59   13  0C23  1690 	BEQL	70$			;  the queue had been traversed
                            01   A8  0C25  1691 	BISW	#HRB$M_ABORT,-		; Set the abort bit to signify that
                         16 A1       0C27  1692 		HRB$W_FLAGS(R1)		;  this transaction has been visited
                                     0C29  1693 	DISPATCH HRB$W_STATE(R1),-	; Dispatch based on request state
                                     0C29  1694 		type=W,-		;  which is a word field
                                     0C29  1695 		prefix=HRB$K_ST_,<-	; 
                                     0C29  1696 		<MSG_WAIT,   60$>,-	; Leave this request with the abort flag set
                                     0C29  1697 		<SEQ_WAIT,   60$>,-	; Command on the blocked queue can be punted now.
                                     0C29  1698 		<SNDAT_WAIT, 60$>,-	; Sending or receiving data
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  38
X-17                            - Virtual Circuit Error Routine          16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (15)

                                     0C29  1699 		<DRV_WAIT,   60$>,-	; Wait til the drivers done for this one
                                     0C29  1700 		<MAP_WAIT,   50$>,-	; The only way to get this is to yank it
                                     0C29  1701 		>			; Should not fail with requests in SNDMS state
               05   01   14 A1   AF  0C29       	CASEW	HRB$W_STATE(R1),#$$BASE,#$$LIMIT
                                     0C2E       30038$:
                               0030' 0C2E       	.SIGNED_WORD	60$-30038$
                               0030' 0C30       	.SIGNED_WORD	60$-30038$
                               000C  0C32       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               0030' 0C34       	.SIGNED_WORD	60$-30038$
                               0030' 0C36       	.SIGNED_WORD	60$-30038$
                               0010' 0C38       	.SIGNED_WORD	50$-30038$
                                     0C3A  1702                                                
                                     0C3A  1703      	BUG_CHECK TMSCPSERV,FATAL	; ERROR
                               FEFF  0C3A       		.WORD	^XFEFF
                               0004' 0C3C       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_TMSCPSERV!4
                                     0C3E  1704 
                                     0C3E  1705 ;
                                     0C3E  1706 ; Now all the request specific processing is done, do some common processing
                                     0C3E  1707 ; here, setting the flags and status bits.
                                     0C3E  1708 ;
                                     0C3E  1709 
                                     0C3E  1710 50$:
                                     0C3E  1711 	.IF DEFINED DEBUG$PC_HISTORY
                                     0C3E  1712 	MOVL	R1, R0			; Get HRB address.
                                     0C3E  1713 	BSBW	TMSCP$PCHIST_R3R0	; Save this PC if we are keeping track
                                     0C3E  1714 	.ENDC	   ;DEBUG$PC_HISTORY
                    50   1C A1   D0  0C3E  1715 	MOVL	HRB$L_IRP_CDRP(R1),R0	; Get the address of the IRP-CDRP
                    50   60 A0   DE  0C42  1716 	MOVAL	IRP$L_FQFL(R0),R0	;  and move down to the CDRP portion
                         04 A0   D5  0C46  1717 	TSTL	CDRP$L_FQBL(R0)		; Check for the presence of a pointer
                            D2   13  0C49  1718 	BEQL	30$			; If the field is 0 don't dequeue
                                     0C4B  1719 
                                     0C4B  1720 	ASSUME	CDRP$L_FQFL EQ 0
                                     0C4B  1721 
                    50   04 B0   D1  0C4B  1722 	CMPL	@CDRP$L_FQBL(R0),R0	; If the field is nonzero,
                            CC   12  0C4F  1723 	BNEQ	30$			;  make sure it is in a queue
                                     0C51  1724 
                                     0C51  1725 	ASSUME	CDRP$L_FQFL EQ 0
                                     0C51  1726 
                       50   60   0F  0C51  1727 	REMQUE	CDRP$L_FQFL(R0), R0	; Remove the CDRP from its queue
                                     0C54  1728 
                            06   B1  0C54  1729 	CMPW	#HRB$K_ST_MAP_WAIT,-	; Are we in a map wait
                         14 A1       0C56  1730 		 HRB$W_STATE(R1)	;  state ?
                            04   12  0C58  1731 	BNEQ	60$			; BR if No
                            20   A8  0C5A  1732 	BISW	#HRB$M_UNBLOCK,-	; Unblock this request after
                         16 A1       0C5C  1733 		 HRB$W_FLAGS(R1)	;  cleanup
                                     0C5E  1734 	
                                     0C5E  1735 
                                     0C5E  1736 60$:
                                     0C5E  1737 	.IF DEFINED DEBUG$PC_HISTORY
                                     0C5E  1738 	MOVL	R1, R0			; Get HRB address.
                                     0C5E  1739 	BSBW	TMSCP$PCHIST_R3R0	; Save this PC if we are keeping track
                                     0C5E  1740 	.ENDC	   ;DEBUG$PC_HISTORY
                         4C A1   D5  0C5E  1741 	TSTL	HRB$L_WAIT_FL(R1)	; Are we on the blocked queue? 
                            BA   13  0C61  1742 	BEQL	30$			; SNDDAT state during READ means 
                                     0C63  1743 					; we've already dequeued this request
                    50   4C A1   0F  0C63  1744 	REMQUE	HRB$L_WAIT_FL(R1),R0	; Remove from UQB sequential wait queue.
                         4C A1   D4  0C67  1745         CLRL	HRB$L_WAIT_FL(R1)       ; Zero to indicate removal.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  39
X-17                            - Virtual Circuit Error Routine          16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (15)

                    50   58 A1   D0  0C6A  1746 	MOVL	HRB$L_UQB(R1),R0	; Get the address of the UQB
                         28 A0   B7  0C6E  1747 	DECW	UQB$W_NUM_QUE(R0)	; Decrement the number on the queue
                       8000 8F   A8  0C71  1748 	BISW	#HRB$M_STATE_INVALID,-	; The state of the request as indicated
                         14 A1       0C75  1749 		HRB$W_STATE(R1)		;  is no longer valid, change it
                            04   A8  0C77  1750 	BISW	#HRB$M_DEQUEUED,-	; Mark this request as unhooked... 
                         16 A1       0C79  1751 		HRB$W_FLAGS(R1)		;  its resources can be deallocated
                          FF9F   31  0C7B  1752 	BRW	30$			; Check for more HRBs to process
                                     0C7E  1753 
                                     0C7E  1754 ;
                                     0C7E  1755 ; All requests for this host have been removed from the resource wait queues,
                                     0C7E  1756 ; we are almost ready to disconnect. There is one resource that must be dealt
                                     0C7E  1757 ; with before we issue the disconnect though, and that is the message buffer.
                                     0C7E  1758 ; Since we have to use the CDT to deallocate message buffers, they must all be 
                                     0C7E  1759 ; deallocated before the disconnect is issued.
                                     0C7E  1760 ;
                                     0C7E  1761 ; The current sanity subroutine cannot be called from any point from here to
                                     0C7E  1762 ; the end of this routine. If there were commands outstanding for the client
                                     0C7E  1763 ; node that just failed, the algorithm used to verify that the current counter
                                     0C7E  1764 ; is correct cannot be used. This is because the request in question has been
                                     0C7E  1765 ; removed from the wait queue (and the UQB num_que counter adjusted), but it
                                     0C7E  1766 ; has not been cleaned up (and the current counter adjusted). These counters
                                     0C7E  1767 ; are resynchronized at the end of this routine.
                                     0C7E  1768 ;
                                     0C7E  1769 
                                     0C7E  1770 70$:
                    51   20 A5   DE  0C7E  1771 	MOVAL	HQB$L_HRB_FL(R5),R1	; Get the address of the HRB list head
                       52   51   D0  0C82  1772 	MOVL	R1,R2			;  and move it to a new register
                    53   28 A5   D0  0C85  1773 	MOVL	HQB$L_CDT(R5),R3	; Get the CDT address for disc @90$
                                     0C89  1774 
                                     0C89  1775 	ASSUME	HRB$L_FLINK EQ 0
                                     0C89  1776 
                                     0C89  1777 80$:
                       51   61   D0  0C89  1778 	MOVL	HRB$L_FLINK(R1),R1	; Get the address of the next HRB
                       52   51   D1  0C8C  1779 	CMPL	R1,R2			; If we are back at the list head,
                            25   13  0C8F  1780 	BEQL	90$			;  the queue had been traversed
                                     0C91  1781 
                                     0C91  1782 ;
                                     0C91  1783 ; Deallocate any MSCP message buffer that is found. This may start up another
                                     0C91  1784 ; thread, but it won't be one associated with this CDT since we have unhooked 
                                     0C91  1785 ; all the requests pertaining to the connection that has failed before getting
                                     0C91  1786 ; to this point.
                                     0C91  1787 ;
                         18 A1   D5  0C91  1788 	TSTL	HRB$L_MSGBUF(R1)	; Check for allocated message buffer
                            F3   13  0C94  1789 	BEQL	80$			; Continue, if none is allocated
                            2E   BB  0C96  1790 	PUSHR	#^M<R1,R2,R3,R5>	; Save the registers from destruction
                    55   1C A1   D0  0C98  1791 	MOVL	HRB$L_IRP_CDRP(R1),R5	; Get the address of the IRP-CDRP
                    55   60 A5   DE  0C9C  1792 	MOVAL	IRP$L_FQFL(R5),R5	;  and move down to the CDRP portion
                    52   18 A1   D0  0CA0  1793 	MOVL	HRB$L_MSGBUF(R1),R2	; Get the message buffer address
                         18 A1   D4  0CA4  1794 	CLRL	HRB$L_MSGBUF(R1)	;  and clear out the address in the HRB
                    50   54 A1   D0  0CA7  1795 	MOVL	HRB$L_HQB(R1),R0	; Get the address of the HQB
                    53   28 A0   D0  0CAB  1796 	MOVL	HQB$L_CDT(R0),R3	;  so we can get the CDT address
                                     0CAF  1797 	DEALLOC_MSG_BUF_REG		; Get rid of the message buffer
                         24 B4   16  0CAF       		JSB	@PDT$L_DEALRGMSG(R4)
                            2E   BA  0CB2  1798 	POPR	#^M<R1,R2,R3,R5>	; Restore the registers
                            D3   11  0CB4  1799 	BRB	80$			; Move on to the next request
                                     0CB6  1800 
                                     0CB6  1801 ;
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  40
X-17                            - Virtual Circuit Error Routine          16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (15)

                                     0CB6  1802 ; In order to assure that none of the pending requests for this host are
                                     0CB6  1803 ; started up after the invocation of this routine, no resources held by
                                     0CB6  1804 ; pending requests are deallocated until the disconnect is issued. At that 
                                     0CB6  1805 ; time, resources allocated for all requests (except ones held by the tape 
                                     0CB6  1806 ; driver) can be deallocated.
                                     0CB6  1807 ;
                                     0CB6  1808 
                                     0CB6  1809 90$:
                                     0CB6  1810 	DISCONNECT			; The disconnect can be issued now, but
                   00000000'GF   16  0CB6       		JSB	G^SCS$DISCONNECT
                         28 A5   D4  0CBC  1811 	CLRL	HQB$L_CDT(R5)		;  the CDT should not be used anymore!
                                     0CBF  1812 
                                     0CBF  1813 ;
                                     0CBF  1814 ; Now that the disconnect has been issued and the CDT has been returned, start
                                     0CBF  1815 ; any requests that had been blocked, and then continue cleaning up the 
                                     0CBF  1816 ; requests that were left aborted, making sure the units reflect the 
                                     0CBF  1817 ; change in state for the host that just went away.
                                     0CBF  1818 ;
                    54   32 A5   D0  0CBF  1819 	MOVL	HQB$L_TSRV(R5),R4	; Get the address of the server struct
                    52   68 A4   DE  0CC3  1820 	MOVAL	TSRV$L_UQB_FL(R4),R2	; Loop through the UQBs making
                       54   52   D0  0CC7  1821 	MOVL	R2,R4			;  any units available that have this
                                     0CCA  1822 
                                     0CCA  1823 	ASSUME	UQB$L_FLINK EQ 0
                                     0CCA  1824 
                                     0CCA  1825 100$:
                       54   64   D0  0CCA  1826 	MOVL	UQB$L_FLINK(R4),R4	;  host's online bit set.
                       52   54   D1  0CCD  1827 	CMPL	R4,R2			; Check for the end of the queue
                            66   13  0CD0  1828 	BEQL	140$			; If they are the same...All done!
                    70 A4   55   D1  0CD2  1829 	CMPL	R5,UQB$L_ONLINE_HQB(R4)	; Online to the host represented by
                                     0CD6  1830 					;  the HQB in R5?
                            F2   12  0CD6  1831 	BNEQ	100$			; If not, check next unit.
                                     0CD8  1832 ;
                                     0CD8  1833 ; A unit was found that still thinks the host is out there. An HRB needs to 
                                     0CD8  1834 ; be allocated and the available processing done for this host. Since we
                                     0CD8  1835 ; no longer have a CDT, we will call the sequential command subroutine at
                                     0CD8  1836 ; its alternate entry point and get along the best we can without actually
                                     0CD8  1837 ; allocating a message buffer of our own.
                                     0CD8  1838 ;
                          0FB2   30  0CD8  1839 	BSBW	TMSCP$ALLOCATE_HRB	; Returns the HRB address in R3
                         48 50   E9  0CDB  1840 	BLBC	R0,120$			; Out of memory? BIG trouble
                       8000 8F   A8  0CDE  1841 	BISW	#HRB$M_STATE_INVALID,-	; Start off with the state
                         14 A3       0CE2  1842 		HRB$W_STATE(R3)		;  of this request as current
                       0040 8F   A8  0CE4  1843 	BISW	#HRB$M_VCFAILED,-	; Set the bit indicating that this is
                         16 A3       0CE8  1844 		HRB$W_FLAGS(R3)		;  not really a request from the host
                    58 A3   54   D0  0CEA  1845 	MOVL	R4,HRB$L_UQB(R3)	; Save the Unit Queue Block address
                    54 A3   55   D0  0CEE  1846 	MOVL	R5,HRB$L_HQB(R3)	; Save the Host Queue Block address
                            63   0E  0CF2  1847 	INSQUE	HRB$L_FLINK(R3),-	; Link this HRB to the host that is
                         24 B5       0CF4  1848 		@HQB$L_HRB_BL(R5)	;  failing to clean it up later
                         1C A5   B6  0CF6  1849 	INCW	HQB$W_NUM_QUE(R5)	; Up the counter of queue elements
                         1C A5   B1  0CF9  1850 	CMPW	HQB$W_NUM_QUE(R5),-	; Check to see if the new value is
                         1E A5       0CFC  1851 		HQB$W_MAX_QUE(R5)	;  higher than any previous value
                            05   15  0CFE  1852 	BLEQ	110$			;  if its not, conitnue on
                         1C A5   B0  0D00  1853 	MOVW	HQB$W_NUM_QUE(R5),-	; If it is, make the current value
                         1E A5       0D03  1854 		HQB$W_MAX_QUE(R5)	;  a new high water mark
                                     0D05  1855 
                                     0D05  1856 110$:
                         12 A4   B6  0D05  1857 	INCW	UQB$W_CURRENT(R4)	; Keep the HRB counter current
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  41
X-17                            - Virtual Circuit Error Routine          16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (15)

                                     0D08  1858 	.IF DEFINED DEBUG$PC_HISTORY
                                     0D08  1859 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0D08  1860 	.ENDC	   ;DEBUG$PC_HISTORY
                            34   BB  0D08  1861 	PUSHR	#^M<R2,R4,R5>		; Save the termination criteria
                            52   D4  0D0A  1862 	CLRL	R2			; There is no MSCP packet availale
                       51   08   D0  0D0C  1863 	MOVL	#MSCP$K_OP_AVAIL,R1	; Set an opcode value
              54   00000000'GF   D0  0D0F  1864 	MOVL	G^SCS$GL_TMSCP,R4	; Get the address of the server struct
                       04C4 C4   D6  0D16  1865 	INCL	TSRV$L_OPCOUNT(R4)	;  then set the count of total operations
                     04C4 C441   D6  0D1A  1866 	INCL	TSRV$L_OPCOUNT(R4)[R1]	;  and the count of avails straight
                          046E   30  0D1F  1867 	BSBW	TMSCP$SEQ_ALT		; Call the seq command alt entry
                            34   BA  0D22  1868 	POPR	#^M<R2,R4,R5>		; Restore the saved ending criteria
                            A4   11  0D24  1869 	BRB	100$			; Continue checking...
                                     0D26  1870 
                                     0D26  1871 ;
                                     0D26  1872 ; As an emergency measure, if there is insufficient memory to allocate a
                                     0D26  1873 ; HRB, the online bits in the UQB for this host are cleared anyway, so that
                                     0D26  1874 ; when the host establishes a new connection, it will not hang.
                                     0D26  1875 ;
                                     0D26  1876 
                                     0D26  1877 120$:
                         70 A4   D4  0D26  1878 	CLRL	UQB$L_ONLINE_HQB(R4)	; No longer online to this host
                    50   24 A4   D0  0D29  1879 	MOVL	UQB$L_UCB(R4),R0	; Get the UCB address
                            08   AA  0D2D  1880 	BICW	#UQB$M_ONLINE,-		; Clear online bit in state field
                         0E A4       0D2F  1881 		UQB$W_FLAGS(R4)		;
                                     0D31  1882 
                                     0D31  1883 130$:
                       00C2 C0   97  0D31  1884 	DECB	UCB$B_ONLCNT(R0)	; Decrement the online count
                          FF92   31  0D35  1885 	BRW	100$			; And continue with next unit...
                                     0D38  1886 ;
                                     0D38  1887 ; Now all the units that the failed host was holding online have been freed. 
                                     0D38  1888 ; The next items to be taken care of are the requests that were pending when
                                     0D38  1889 ; the virtual circuit to the host failed. First, try to deallocate the HQB.
                                     0D38  1890 ; If there are no requests pending for this host, the HQB will be deallocated
                                     0D38  1891 ; and we are finished. If there are HRBs that still have to be cleaned up,
                                     0D38  1892 ; the deallocate attempt will return a failed status, indicating that more
                                     0D38  1893 ; cleanup is necessary.
                                     0D38  1894 ;
                                     0D38  1895 
                                     0D38  1896 140$:
                            54   D4  0D38  1897 	CLRL	R4			; No UQB addr if no cmds active
                    52   20 A5   DE  0D3A  1898 	MOVAL	HQB$L_HRB_FL(R5),R2	; Save away the queue header address
                       53   52   D0  0D3E  1899 	MOVL	R2,R3			; Get set up for the first element
                                     0D41  1900 
                                     0D41  1901 150$:
                                     0D41  1902 	.IF DEFINED DEBUG$PC_HISTORY
                                     0D41  1903 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0D41  1904 	.ENDC	   ;DEBUG$PC_HISTORY
                                     0D41  1905 
                                     0D41  1906 	ASSUME	HRB$L_FLINK EQ 0
                                     0D41  1907 
                       53   63   D0  0D41  1908 	MOVL	HRB$L_FLINK(R3),R3	; Get the address of the next HRB 
                       52   53   D1  0D44  1909 	CMPL	R3,R2			; If it is the same as the header, 
                            32   13  0D47  1910 	BEQL	160$			;  we are finished checking the queue 
                    54   58 A3   D0  0D49  1911 	MOVL	HRB$L_UQB(R3),R4	; Get the addr of UQB from last command 
                            06   E0  0D4D  1912 	BBS	#HRB$V_VCFAILED,-	; If this request is the result of the 
                      EF 16 A3       0D4F  1913 		HRB$W_FLAGS(R3),150$	;  VC failure let it finish normally 
                            05   B1  0D52  1914 	CMPW	#HRB$K_ST_DRV_WAIT,-	; If we are waiting for the tape 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  42
X-17                            - Virtual Circuit Error Routine          16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (15)

                         14 A3       0D54  1915 		HRB$W_STATE(R3)		;  then continue waiting... 
                            E9   13  0D56  1916 	BEQL	150$			;  continue traversing the queue... 
                            02   E0  0D58  1917 	BBS	#HRB$V_DEQUEUED,-	; If the request has been dequeued
                      14 16 A3       0D5A  1918 		HRB$W_FLAGS(R3),155$	;    cleanup
                            06   B1  0D5D  1919 	CMPW	#HRB$K_ST_MAP_WAIT,-	; If we are waiting for the mapping 
                         14 A3       0D5F  1920 		HRB$W_STATE(R3)		;  then continue waiting... 
                            DE   13  0D61  1921 	BEQL	150$			;  continue traversing the queue... 
                            04   B1  0D63  1922 	CMPW	#HRB$K_ST_SNDAT_WAIT,-	; If we are waiting for data transfer 
                         14 A3       0D65  1923 		HRB$W_STATE(R3)		;   to complete 
                            19   13  0D67  1924 	BEQL	170$			;  we are hopelessly lost 
                            05   E0  0D69  1925 	BBS	#HRB$V_UNBLOCK,-	; If this bit is set we need to call 
                      03 16 A3       0D6B  1926 		HRB$W_FLAGS(R3),155$	;  the UNBLOCK routine after cleanup 
                         58 A3   D4  0D6E  1927 	CLRL	HRB$L_UQB(R3)		;  Otherwise we can defuse it  
                                     0D71  1928  
                                     0D71  1929 155$: 
                            55   DD  0D71  1930 	PUSHL	R5			; Save the HQB address
                          0FB2   30  0D73  1931 	BSBW	TMSCP$CLEANUP_HRB	; Deallocate the HRB and its resources
                            55 8ED0  0D76  1932 	POPL	R5			; Restore the saved HQB
                            BD   11  0D79  1933 	BRB	140$			;  Continue through the list
                                     0D7B  1934 
                                     0D7B  1935 160$:
                            01   88  0D7B  1936 	BISB2	#HQB$M_VC_FAILED,-	; Set this bit in the status field
                         0D A5       0D7D  1937 		HQB$B_STATE(R5)		;  indicating that the HQB can now be
                          13B1   31  0D7F  1938 	BRW	TMSCP$DEALLOC_HQB	;  deleted, and then try
                                     0D82  1939 
                                     0D82  1940 170$:
                                     0D82  1941 	BUG_CHECK TMSCPSERV,FATAL	; ERROR
                               FEFF  0D82       		.WORD	^XFEFF
                               0004' 0D84       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_TMSCPSERV!4
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  43
X-17                            Main Line Routine                        16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (16)

                                     0D86  1944 	.SBTTL	Main Line Routine
                                     0D86  1945 
                                     0D86  1946 ;+
                                     0D86  1947 ; Functional Description:
                                     0D86  1948 ;
                                     0D86  1949 ; MSCP requests are received from remote hosts in this routine. The packet 
                                     0D86  1950 ; is inspected for validity and if its good, an HRP is made up to represent
                                     0D86  1951 ; this request. The request is then dispatched to the proper handling
                                     0D86  1952 ; routine to be processed further.
                                     0D86  1953 ;
                                     0D86  1954 ; Inputs:
                                     0D86  1955 ;
                                     0D86  1956 ;	R0  =  Scratch
                                     0D86  1957 ;	R1  =  Length of MSCP packet
                                     0D86  1958 ;	R2  =  MSCP packet address
                                     0D86  1959 ;	R3  =  CDT address
                                     0D86  1960 ;	R4  =  PDT address
                                     0D86  1961 ;	R5  =  Scratch
                                     0D86  1962 ;
                                     0D86  1963 ; Oututs:
                                     0D86  1964 ;
                                     0D86  1965 ;	R0  =  When an error is encountered R0 is packed with an op-code
                                     0D86  1966 ;		an error code and the offset of the bad field within the
                                     0D86  1967 ;		MSCP packet.
                                     0D86  1968 ;	R3  =  HRB address
                                     0D86  1969 ;-
                                     0D86  1970  
                                     0D86  1971 ;
                                     0D86  1972 ; Out of line error routines are placed before this module so they can be 
                                     0D86  1973 ; reached with condition code branch instructions to optimize the main path.
                                     0D86  1974 ;
                                     0D86  1975 ; There was insufficient memory on the server system to allocate the required
                                     0D86  1976 ; data structures to accept this request. In this case we will deallocate the
                                     0D86  1977 ; MSCP packet we have, and take down the virtual circuit. 
                                     0D86  1978 ;
                                     0D86  1979 
                                     0D86  1980 TMSCP$NO_MEM::
                       53   54   D0  0D86  1981 	MOVL	R4,R3			; Put the CDT address back
                    54   10 A3   D0  0D89  1982 	MOVL	CDT$L_PDT(R3),R4	;  and then restore the PDT address
                                     0D8D  1983 	DEALLOC_MSG_BUF_REG		; Deallocate the message buffer
                         24 B4   16  0D8D       		JSB	@PDT$L_DEALRGMSG(R4)
                          FE4D   31  0D90  1984 	BRW	TMSCP$VC_ERR		; Break and clean up virtual curcuit
                                     0D93  1985 
                                     0D93  1986 ;
                                     0D93  1987 ; First, make sure we have a valid MSCP command packet. Check to make sure
                                     0D93  1988 ; the incoming packet is the proper length, and that it does not have any 
                                     0D93  1989 ; modifiers set that the server does not support.
                                     0D93  1990 ;
                                     0D93  1991 
                                     0D93  1992 TMSCP$MSG_IN::
                                     0D93  1993 	.IF	DEFINED DEBUG$PC_HISTORY
                                     0D93  1994 	MOVL	MSCP$L_CMD_REF(R2), R0	; Save command reference number in PC trace.
                                     0D93  1995 	BSBW	TMSCP$PCHIST_R3R0	; Log the PC for debugging.
                                     0D93  1996 	.ENDC  ;DEBUG$PC_HISTORY
               06 F9D4 CF   01   E1  0D93  1997 	BBC	# TMSCP$V_DBG_MSG_IN, -	; Not debugging - branch.
                                     0D99  1998 		TMSCP$L_DEBUG_FLAGS, 0$
                   00000000'GF   16  0D99  1999 	JSB	G^ INI$BRK
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  44
X-17                            Main Line Routine                        16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (16)

                                     0D9F  2000 
                                     0D9F  2001 0$:
              55   00000000'GF   D0  0D9F  2002 	MOVL	G^SCS$GL_TMSCP,R5	; Get the server data structure
                       04C4 C5   D6  0DA6  2003 	INCL	TSRV$L_OPCOUNT(R5)	;  and count each request received
                                     0DAA  2004 
                                     0DAA  2005 ;
                                     0DAA  2006 ; Allocate an HRB and an IRP to represent this request, and save the addresses
                                     0DAA  2007 ; that are important for this request.
                                     0DAA  2008 ;
                       54   53   D0  0DAA  2009 	MOVL	R3,R4			; Move the CDT address to a safe place
                          0EDD   30  0DAD  2010 	BSBW	TMSCP$ALLOCATE_HRB	; Create a Host Request Buffer
                         D3 50   E9  0DB0  2011 	BLBC	R0,TMSCP$NO_MEM		; Insufficient memory, shutdown the link
                       8000 8F   A8  0DB3  2012 	BISW	#HRB$M_STATE_INVALID,-	; Change the state of this request 
                         14 A3       0DB7  2013 		HRB$W_STATE(R3)		;  to "current"
                         10 A4   D0  0DB9  2014 	MOVL	CDT$L_PDT(R4),-		; Get the address of the PDT
                         5C A3       0DBC  2015 		HRB$L_PDT(R3)		;  save it to make requests faster
                         5C A4   D0  0DBE  2016 	MOVL	CDT$L_AUXSTRUC(R4),-	; Get the HQB address passed by SCS
                         54 A3       0DC1  2017 		HRB$L_HQB(R3)		; Save it for later reference
                    18 A3   52   D0  0DC3  2018 	MOVL	R2,HRB$L_MSGBUF(R3)	; Save the address of the MSCP packet
                                     0DC7  2019 
                                     0DC7  2020 ;
                                     0DC7  2021 ; Now continue processing this request.
                                     0DC7  2022 ;
                       0C   51   B1  0DC7  2023 	CMPW	R1, #MSCP$K_MIN_SIZ	; Packet big enough?
                            60   19  0DCA  2024 	BLSS	TMSCP$BAD_LEN		; Too small...
                    50   08 A2   9A  0DCC  2025 	MOVZBL	MSCP$B_OPCODE(R2),R0	; Get the op-code from the packet
                            53   13  0DD0  2026 	BEQL	TMSCP$BAD_OPC		; It cannot be zero
                                     0DD2  2027 ;	ASSUME	TMSCP_MAX_OPCODE EQ MSCP$K_OP_REPOS
                       25   50   D1  0DD2  2028 	CMPL	R0,#MSCP$K_OP_REPOS	; The server only supports up to write
                            4E   14  0DD5  2029 	BGTR	TMSCP$BAD_OPC		;  table size limitation
                55   22AC'CF40   9A  0DD7  2030 	MOVZBL	TMSCP$COM_PKT_LEN[R0],R5	; Get the expected length
                            46   13  0DDD  2031 	BEQL	TMSCP$BAD_OPC		; If it is zero, then unsupported opcode
                                     0DDF  2032 ;
                                     0DDF  2033 ; This next test assumes all tape controllers return the
                                     0DDF  2034 ; command length value specified by the T/MSCP spec.
                                     0DDF  2035 ; This assumption may not be valid.
                                     0DDF  2036 ;
                       55   51   B1  0DDF  2037 	CMPW	R1,R5			; Is command packet correct length?
                            48   19  0DE2  2038 	BLSS	TMSCP$BAD_LEN
             0A A2   22F8'CF40   B3  0DE4  2039 	BITW	TMSCP$MOD_TBL[R0],-	; Compare modifiers we don't allow,
                                     0DEB  2040 		MSCP$W_MODIFIER(R2)	;  to the ones that are set
                            44   12  0DEB  2041 	BNEQ	TMSCP$BAD_MOD		; Bad modifiers used with this op-code
                         09 A2   95  0DED  2042 	TSTB	MSCP$B_FLAGS(R2)	; The flags field is reserved on 
                            46   12  0DF0  2043 	BNEQ	TMSCP$BAD_FLAGS		;  incoming packets and should be clear
                                     0DF2  2044 
                                     0DF2  2045        	.IF DEFINED DEBUG$LOG
                                     0DF2  2046 
                                     0DF2  2047 	ASSUME TSRV$V_LOG_ENABLD  EQ  0
                                     0DF2  2048 
                                     0DF2  2049 	MOVL	G^SCS$GL_TMSCP,R5	; Get the server data structure
                                     0DF2  2050 	BLBC	TSRV$W_STATE(R5),10$	; Branch if logging is disabled.
                                     0DF2  2051 	BSBW	TMSCP$LOG_CMD_PKT	; Otherwise, log the command packet.
                                     0DF2  2052 	.ENDC	; DEBUG$LOG
                                     0DF2  2053 
                                     0DF2  2054 10$:
                    55   54 A3   D0  0DF2  2055 	MOVL	HRB$L_HQB(R3),R5	; Get the Host Queue Block adress
                            63   0E  0DF6  2056 	INSQUE	HRB$L_FLINK(R3),-	; Link this HRB to the host 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  45
X-17                            Main Line Routine                        16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (16)

                         24 B5       0DF8  2057 		@HQB$L_HRB_BL(R5)	;  it came from
                         1C A5   B6  0DFA  2058 	INCW	HQB$W_NUM_QUE(R5)	; Up the counter of queue elements
                         1C A5   B1  0DFD  2059 	CMPW	HQB$W_NUM_QUE(R5),-	; Check to see if the new value is
                         1E A5       0E00  2060 		HQB$W_MAX_QUE(R5)	;  higher than any previous value.
                            05   15  0E02  2061 	BLEQ	20$			; If it's not, continue on.
                         1C A5   B0  0E04  2062 	MOVW	HQB$W_NUM_QUE(R5),-	; If it is, make the current value
                         1E A5       0E07  2063 		HQB$W_MAX_QUE(R5)	;  a new high water mark.
                                     0E09  2064 
                                     0E09  2065 20$:
                    51   32 A5   D0  0E09  2066 	MOVL	HQB$L_TSRV(R5),R1	; Server structure address for stats
                     04C4 C140   D6  0E0D  2067 	INCL	TSRV$L_OPCOUNT(R1)[R0]	; Receipt of a valid operation code
               50   50   FD 8F   78  0E12  2068 	ASHL	#-3,R0,R0		; Pick up class field.
                                     0E17  2069 ;
                                     0E17  2070 ; The TMSCP spec does not neatly divide up the 3 opcode classes of
                                     0E17  2071 ; IMMEDIATE, SEQUENTIAL(IMMEDIATE COMPLETION), and SEQUENTIAL 
                                     0E17  2072 ; Therefore, this case statement will take advantage of the only 
                                     0E17  2073 ; clear division, between IMMEDIATE and the rest of the world. 
                                     0E17  2074 ;
                                     0E17  2075 ;	R0  =  Opcode class, scratch
                                     0E17  2076 ;	R1  =  Scratch
                                     0E17  2077 ;	R2  =  MSCP packet address
                                     0E17  2078 ;	R3  =  HRB address
                                     0E17  2079 ;	R4  =  Scratch
                                     0E17  2080 ;	R5  =  Scratch
                                     0E17  2081 ;
                                     0E17  2082 
                                     0E17  2083 	CASE	R0, < -			; Dispatch on opcode.
                                     0E17  2084 		 TMSCP$IMMEDIATE, -	; Immediate.
                                     0E17  2085 		 TMSCP$SEQUENTIAL, -	; Sequential commands.
                                     0E17  2086 		 TMSCP$SEQUENTIAL, -	; Sequential commands.
                                     0E17  2087 		 TMSCP$BAD_OPC, -	; Maintenance commands.		
                                     0E17  2088 		 TMSCP$SEQUENTIAL >	; Sequential commands.
                  04'  00   50   AF  0E17       	CASEW	R0,#0,S^#<<30040$-30039$>/2>-1
                                     0E1B       30039$:
                               0024' 0E1B       	.SIGNED_WORD	TMSCP$IMMEDIATE-30039$
                               036C' 0E1D       	.SIGNED_WORD	TMSCP$SEQUENTIAL-30039$
                               036C' 0E1F       	.SIGNED_WORD	TMSCP$SEQUENTIAL-30039$
                               000A' 0E21       	.SIGNED_WORD	TMSCP$BAD_OPC-30039$
                               036C' 0E23       	.SIGNED_WORD	TMSCP$SEQUENTIAL-30039$
                                     0E25       30040$:
                                     0E25  2089 
                                     0E25  2090 	
                                     0E25  2091 ;
                                     0E25  2092 ; When a packet with illegal modifiers, or an improper length is received,
                                     0E25  2093 ; the bad opcode or other information is placed in the high byte of R0 and
                                     0E25  2094 ; control is passed on to here. The packet received is altered and sent back
                                     0E25  2095 ; with the error information.
                                     0E25  2096 ;
                                     0E25  2097 
                                     0E25  2098 TMSCP$BAD_OPC::
                  50   08   18   9C  0E25  2099 	ROTL	#24,#MSCP$B_OPCODE,R0	; The op-code passed in the MSCP packet
                          12D0   31  0E29  2100 	BRW	TMSCP$PACKET_ERROR	;  was out of bounds or not supported
                                     0E2C  2101 
                                     0E2C  2102 TMSCP$BAD_LEN::
                            50   D4  0E2C  2103 	CLRL	R0			; Since there is no length field to 
                          12CB   31  0E2E  2104 	BRW	TMSCP$PACKET_ERROR	;  point to, just clear R0
                                     0E31  2105 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  46
X-17                            Main Line Routine                        16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (16)

                                     0E31  2106 TMSCP$BAD_MOD::
                  50   0A   18   9C  0E31  2107 	ROTL	#24,#MSCP$W_MODIFIER,R0	; Prepare for a modifier error return
                          12C4   31  0E35  2108 	BRW	TMSCP$PACKET_ERROR	;  point to, just clear R0
                                     0E38  2109 
                                     0E38  2110 TMSCP$BAD_FLAGS::
                  50   09   18   9C  0E38  2111 	ROTL	#24,#MSCP$B_FLAGS,R0	; The incoming packet did not have the 
                          12BD   31  0E3C  2112 	BRW	TMSCP$PACKET_ERROR	;  flags field cleared
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  47
X-17                            IMMEDIATE class commands                 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (17)

                                     0E3F  2115 	.SBTTL	IMMEDIATE class commands
                                     0E3F  2116 
                                     0E3F  2117 ;+
                                     0E3F  2118 ; Functional Description:
                                     0E3F  2119 ;
                                     0E3F  2120 ; Immediate commands require very little time to complete and do not 
                                     0E3F  2121 ; cause any unit context switches. Servers process immediate commands 
                                     0E3F  2122 ; without waiting for any other commands to complete. The server guarantees
                                     0E3F  2123 ; the completion of all outstanding immediate commands plus an additional
                                     0E3F  2124 ; GET COMMAND STATUS within the controller timeout interval.
                                     0E3F  2125 ;
                                     0E3F  2126 ; Inputs:
                                     0E3F  2127 ;
                                     0E3F  2128 ;	R0  =  Scratch
                                     0E3F  2129 ;	R1  =  Scratch
                                     0E3F  2130 ;	R2  =  MSCP packet address
                                     0E3F  2131 ;	R3  =  HRB address
                                     0E3F  2132 ;	R4  =  Scratch
                                     0E3F  2133 ;	R5  =  Scratch
                                     0E3F  2134 ;
                                     0E3F  2135 ; Outputs:
                                     0E3F  2136 ;
                                     0E3F  2137 ;	R2  =  MSCP packet address
                                     0E3F  2138 ;	R3  =  HRB address
                                     0E3F  2139 ;-
                                     0E3F  2140 
                                     0E3F  2141 TMSCP$IMMEDIATE::
                                     0E3F  2142 	.IF DEFINED DEBUG$PC_HISTORY
                                     0E3F  2143 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0E3F  2144 	.ENDC	   ;DEBUG$PC_HISTORY
                                     0E3F  2145 	DISPATCH MSCP$B_OPCODE(R2),-	; Dispatch on command subtype
                                     0E3F  2146 		type=B,-		; Data type we are dispatching on
                                     0E3F  2147 		prefix=MSCP$K_OP_,<-			; 
                                     0E3F  2148 		<ABORT,	TMSCP$ABORT>, -			; Abort command
                                     0E3F  2149 		<GTCMD, TMSCP$GET_COMMAND_STATUS>, -	; Get Command Status
                                     0E3F  2150 		<GTUNT, TMSCP$GET_UNIT_STATUS>, -	; Get Unit Status
                                     0E3F  2151 		<STCON, TMSCP$SET_CONTROLLER_CHAR>, -	; Set Controller 
                                     0E3F  2152 		>					;    Characteristics
               03   01   08 A2   8F  0E3F       	CASEB	MSCP$B_OPCODE(R2),#$$BASE,#$$LIMIT
                                     0E44       30041$:
                               000F' 0E44       	.SIGNED_WORD	TMSCP$ABORT-30041$
                               00CA' 0E46       	.SIGNED_WORD	TMSCP$GET_COMMAND_STATUS-30041$
                               0145' 0E48       	.SIGNED_WORD	TMSCP$GET_UNIT_STATUS-30041$
                               029E' 0E4A       	.SIGNED_WORD	TMSCP$SET_CONTROLLER_CHAR-30041$
                                     0E4C  2153 
                  50   08   18   9C  0E4C  2154 	ROTL	#24,#MSCP$B_OPCODE,R0	; Identify the bad field
                          12A9   31  0E50  2155 	BRW	TMSCP$PACKET_ERROR	; Return an end msg with error status
                                     0E53  2156 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  48
X-17                            - ABORT     (- 1 -)                      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (18)

                                     0E53  2159 	.SBTTL	-	ABORT					(- 1 -)
                                     0E53  2160 
                                     0E53  2161 ;+
                                     0E53  2162 ; Functional Description:
                                     0E53  2163 ;
                                     0E53  2164 ; The abort command causes a specified command to be aborted at the earliest
                                     0E53  2165 ; time possible for the server. If the specified request is found and cannot
                                     0E53  2166 ; be aborted immediately because it is outside the servers jurisdiction, a
                                     0E53  2167 ; successful end message is returned and the request is aborted when the 
                                     0E53  2168 ; server regains control of the IRP_CDRP data structure.
                                     0E53  2169 ;
                                     0E53  2170 ;Inputs:
                                     0E53  2171 ;
                                     0E53  2172 ;	R0  =  Scratch
                                     0E53  2173 ;	R1  =  Scratch
                                     0E53  2174 ;	R2  =  MSCP packet address
                                     0E53  2175 ;	R3  =  HRB address
                                     0E53  2176 ;	R4  =  Scratch
                                     0E53  2177 ;	R5  =  Scratch
                                     0E53  2178 ;
                                     0E53  2179 ; Outputs:
                                     0E53  2180 ;
                                     0E53  2181 ;	R0  =  Status to return in the MSCP end message
                                     0E53  2182 ;	R2  =  MSCP packet address
                                     0E53  2183 ;	R3  =  HRB address
                                     0E53  2184 ;-
                                     0E53  2185 
                                     0E53  2186 TMSCP$ABORT::
                                     0E53  2187 	.IF DEFINED DEBUG$PC_HISTORY
                                     0E53  2188 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0E53  2189 	.ENDC	   ;DEBUG$PC_HISTORY
                    55   54 A3   D0  0E53  2190 	MOVL	HRB$L_HQB(R3),R5	; Get the host queue block
                    51   20 A5   DE  0E57  2191 	MOVAL	HQB$L_HRB_FL(R5),R1	;  and get the HRB queue list head
                       55   51   D0  0E5B  2192 	MOVL	R1,R5			; Prepare to start through the list
                                     0E5E  2193 
                                     0E5E  2194 	ASSUME	HRB$L_FLINK EQ 0
                                     0E5E  2195 
                                     0E5E  2196 10$:
                       51   61   D0  0E5E  2197 	MOVL	HRB$L_FLINK(R1),R1	; Move on to the next request in line
                       55   51   D1  0E61  2198 	CMPL	R1,R5			; If the new value is not the list head
                            06   12  0E64  2199 	BNEQ	12$			;  check to see if it's the one we want
                       50   00   D0  0E66  2200 	MOVL	#MSCP$K_ST_SUCC,R0	; If we are back at the queue header and 
                          11CE   31  0E69  2201 	BRW	TMSCP$SEND_END		;  still not successful, it doesn't matter
                                     0E6C  2202 
                                     0E6C  2203 12$:
                    54   18 A1   D0  0E6C  2204 	MOVL	HRB$L_MSGBUF(R1),R4	; Get the packet address for the request
                            EC   13  0E70  2205 	BEQL	10$			; Request with no msgbuf cannot be aborted
                         0C A2   D1  0E72  2206 	CMPL	MSCP$L_OUT_REF(R2),-	; Compare the outstanding reference number
                            64       0E75  2207 		MSCP$L_CMD_REF(R4)	;  to the command reference number
                            E6   12  0E76  2208 	BNEQ	10$			; This is not the one... keep looking
                         04 A2   B1  0E78  2209 	CMPW	MSCP$W_UNIT(R2),-	; Compare the unit number passed
                         04 A4       0E7B  2210 		MSCP$W_UNIT(R4)		;  to the request we found
                            DF   12  0E7D  2211 	BNEQ	10$			; If they are not the same keep looking
                                     0E7F  2212 
                                     0E7F  2213 ;
                                     0E7F  2214 ; The request was found, now process it depending on its state
                                     0E7F  2215 ;
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  49
X-17                            - ABORT     (- 1 -)                      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (18)

                            08   BB  0E7F  2216 	PUSHR	#^M<R3>			; Save the abort command HRB address
                    54   5C A1   D0  0E81  2217 	MOVL	HRB$L_PDT(R1),R4	; Set up the registers here for the 
                    55   54 A1   D0  0E85  2218 	MOVL	HRB$L_HQB(R1),R5	;  calls to the SCAN SCS routines
                    53   28 A5   D0  0E89  2219 	MOVL	HQB$L_CDT(R5),R3	;  this way they ser set up only once
                            02   A8  0E8D  2220 	BISW	#HRB$M_ABORTWS,-	; Mark the request we just found
                         16 A1       0E8F  2221 		HRB$W_FLAGS(R1)		;  as "aborted"
                                     0E91  2222 	DISPATCH HRB$W_STATE(R1),-	; Dispatch based on request state
                                     0E91  2223 		type=W,-		;  which is a word field           
                                     0E91  2224 		prefix=HRB$K_ST_,<-	; 
                                     0E91  2225 		<MSG_WAIT,   30$>,-	; This one will just have to finish
                                     0E91  2226 		<SEQ_WAIT,   30$>,-	; These requests can be yanked immediately
                                     0E91  2227 		<SNDAT_WAIT, 20$>,-	; Sending or receiving data
                                     0E91  2228 		<DRV_WAIT,   70$>,-	; Wait til the drivers done for this one
                                     0E91  2229 		<MAP_WAIT,   70$>,-	; The only way to get this is to yank it
                                     0E91  2230 		>			; Cannot receive an abort for a command
               05   01   14 A1   AF  0E91       	CASEW	HRB$W_STATE(R1),#$$BASE,#$$LIMIT
                                     0E96       30042$:
                               002D' 0E96       	.SIGNED_WORD	30$-30042$
                               002D' 0E98       	.SIGNED_WORD	30$-30042$
                               000C  0E9A       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               0010' 0E9C       	.SIGNED_WORD	20$-30042$
                               006C' 0E9E       	.SIGNED_WORD	70$-30042$
                               006C' 0EA0       	.SIGNED_WORD	70$-30042$
                                     0EA2  2231 					;  in SNDMS_WAIT state (only ATN msgs)
                                     0EA2  2232 
                                     0EA2  2233 	BUG_CHECK	TMSCPSERV,FATAL	; Trap any strange behavior here!
                               FEFF  0EA2       		.WORD	^XFEFF
                               0004' 0EA4       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_TMSCPSERV!4
                                     0EA6  2234 
                                     0EA6  2235 ;
                                     0EA6  2236 ; Commands that have already started sending or receiving data, or messages
                                     0EA6  2237 ; could actually be in one of three states. They could be waiting for RSPIDs,
                                     0EA6  2238 ; waiting for message buffers, or they could actually be involved in the 
                                     0EA6  2239 ; transfer of data. If they are in one of the first two states, the CDRP
                                     0EA6  2240 ; can be pulled off the queue and the request terminated. If, however, the
                                     0EA6  2241 ; CDRP is not waiting for a SCS resource, the best we can do is flag the 
                                     0EA6  2242 ; request, and abort the command when the transfer completes.
                                     0EA6  2243 ;
                                     0EA6  2244 
                                     0EA6  2245 20$:
                                     0EA6  2246 	SCAN_RSPID_WAIT-		; Find the CDRPs in this queue for this
                                     0EA6  2247 		action =TMSCP$ABORT_UNHOOK_CDRP ; CDT and if HRB matches, dequeue it
                  50   210B'CF   9E  0EA6       		MOVAB	TMSCP$ABORT_UNHOOK_CDRP, R0
                   00000000'GF   16  0EAB       		JSB	G^SCS$LKP_RDTWAIT
                                     0EB1  2248 	SCAN_MSGBUF_WAIT- 		; If request is waiting for msgbuf
                                     0EB1  2249 		action =TMSCP$ABORT_UNHOOK_CDRP ;  this scan will find it
                  50   210B'CF   9E  0EB1       		MOVAB	TMSCP$ABORT_UNHOOK_CDRP, R0
                   00000000'GF   16  0EB6       		JSB	G^SCS$LKP_MSGWAIT
                            02   E0  0EBC  2250 	BBS	#HRB$V_DEQUEUED,-	; If the request has been dequeued,
                      1A 16 A1       0EBE  2251 		HRB$W_FLAGS(R1),60$	;  the CDRP was found in UNHOOK
                            3F   11  0EC1  2252 	BRB	70$			; Continue with the common code
                                     0EC3  2253 
                                     0EC3  2254 ;
                                     0EC3  2255 ; This command is found on the blocked queue awaiting the completion
                                     0EC3  2256 ; of a sequential command. It can be removed from the queue and the 
                                     0EC3  2257 ; count of queue elements decremented.
                                     0EC3  2258 ;
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  50
X-17                            - ABORT     (- 1 -)                      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (18)

                                     0EC3  2259 
                                     0EC3  2260 30$:
                         4C A1   D5  0EC3  2261 	TSTL	HRB$L_WAIT_FL(R1)	; Are we still on the blocked queue?
                            13   13  0EC6  2262 	BEQL	60$			; EQL implies not.
                    50   4C A1   0F  0EC8  2263 	REMQUE	HRB$L_WAIT_FL(R1),R0	; Remove the request from the queue
                         4C A1   D4  0ECC  2264         CLRL	HRB$L_WAIT_FL(R1)       ; Zero to indicate removal.
                    50   58 A1   D0  0ECF  2265 	MOVL	HRB$L_UQB(R1),R0	; Get the address of the UQB
                                     0ED3  2266 
                                     0ED3  2267 ;
                                     0ED3  2268 ; If for some reason we land here with the state INVALID (Abort requst while
                                     0ED3  2269 ; a sequetial request is stalled while MAPping or transfering data,
                                     0ED3  2270 ; we don't want to decrement the counter.
                                     0ED3  2271 ;
                 03 14 A1   0F   E0  0ED3  2272 	BBS	#HRB$V_STATE_INVALID, -	; don't decrement the counter
                                     0ED8  2273 		HRB$W_STATE(R1), -	;  here - do it in UNBLOCK   
                                     0ED8  2274 		60$
                         28 A0   B7  0ED8  2275 	DECW	UQB$W_NUM_QUE(R0)	;  so we can update the counter 
                                     0EDB  2276 
                                     0EDB  2277 ;                                                                        
                                     0EDB  2278 ; Now all the request specific processing is done, do some common processing 
                                     0EDB  2279 ; here, setting the flags and status bits. Then send off the end message for 
                                     0EDB  2280 ; the aborted command.  
                                     0EDB  2281 ; 
                                     0EDB  2282  
                                     0EDB  2283 60$: 
                       8000 8F   A8  0EDB  2284 	BISW	#HRB$M_STATE_INVALID,-	; The state of the request as indicated
                         14 A1       0EDF  2285 		HRB$W_STATE(R1)		;  is no longer valid, change it
                            04   A8  0EE1  2286 	BISW	#HRB$M_DEQUEUED,-	; Mark this request as unhooked... 
                         16 A1       0EE3  2287 		HRB$W_FLAGS(R1)		;  its resounces can be deallocated
                         58 A1   D4  0EE5  2288 	CLRL	HRB$L_UQB(R1)		; Defuse UCB$W_CURRENT update by UNBLOCK
                       50   02   D0  0EE8  2289 	MOVL	#MSCP$K_ST_ABRTD,R0	; Return a status of aborted
                    55   1C A1   D0  0EEB  2290 	MOVL	HRB$L_IRP_CDRP(R1),R5	; Get the address of the IRP
                    55   60 A5   DE  0EEF  2291 	MOVAL	IRP$L_FQFL(R5),R5	;  so we can get the CDRP address
                    52   18 A1   D0  0EF3  2292 	MOVL	HRB$L_MSGBUF(R1),R2	; Get the associated MSCP packet addr
                         E0 A5   D0  0EF7  2293 	MOVL	CDRP$L_ABCNT(R5),-	; Load up the accumulated byte count
                         0C A2       0EFA  2294 		MSCP$L_BYTE_CNT(R2)	;  to show how far we got
                       53   51   D0  0EFC  2295 	MOVL	R1,R3			; Prepare to return the aborted msg
                          1138   30  0EFF  2296 	BSBW	TMSCP$SEND_END		;  and then send the packet out
                                     0F02  2297 
                                     0F02  2298 ;
                                     0F02  2299 ; Now that the target request has been finished off (or it has been 
                                     0F02  2300 ; determined that it cannot be finished off at this time), the end 
                                     0F02  2301 ; message for the abort command itself can be sent out.
                                     0F02  2302 ;
                                     0F02  2303 
                                     0F02  2304 70$:
                            08   BA  0F02  2305 	POPR	#^M<R3>			; Restore the original HRB address
                       50   00   D0  0F04  2306 	MOVL	#MSCP$K_ST_SUCC,R0	; Set the status to success
                    52   18 A3   D0  0F07  2307 	MOVL	HRB$L_MSGBUF(R3),R2	;  restore the message buffer addr
                          112C   31  0F0B  2308 	BRW	TMSCP$SEND_END		;  and send out the ABORT end message
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  51
X-17                            - GET COMMAND STATUS   (- 2 -)           16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (19)

                                     0F0E  2311 	.SBTTL	-	GET COMMAND STATUS			(- 2 -)
                                     0F0E  2312 
                                     0F0E  2313 ;+
                                     0F0E  2314 ; Functional Description:
                                     0F0E  2315 ;
                                     0F0E  2316 ; The GET COMMAND STATUS command is used to monitor the progress of
                                     0F0E  2317 ; a command towards completion. The command status of a TMSCP server's
                                     0F0E  2318 ; oldest outstanding command is guaranteed to decrease within the
                                     0F0E  2319 ; controller timeout interval. The GET COMMAND STATUS command always
                                     0F0E  2320 ; succeeds. If the command being referenced is not known, then the server
                                     0F0E  2321 ; returns a zero as the command status.
                                     0F0E  2322 ;
                                     0F0E  2323 ; When the HRB is allocated, a -1 is placed in the command status field. As
                                     0F0E  2324 ; any information is requested or sent from one of the other cluster members, 
                                     0F0E  2325 ; or one of the tapes attached to this processor, the command status value
                                     0F0E  2326 ; is decremented.
                                     0F0E  2327 ;
                                     0F0E  2328 ; For all devices, the the Host Queue Block for the remote host is
                                     0F0E  2329 ; grabbed. The list of HRBs is scanned looking for a match between the RSPID
                                     0F0E  2330 ; and the unit number to the command, to those in the requesting packet. If
                                     0F0E  2331 ; a match is not made, then a zero is returned.
                                     0F0E  2332 ;
                                     0F0E  2333 ; If the unit is a non-TMSCP device, the status in that HRB is returned.
                                     0F0E  2334 ; If the unit is a TMSCP device, the server maintains progress counters that 
                                     0F0E  2335 ; mirror the criteria in the TMSCP class driver's timeout mechanism. If this is
                                     0F0E  2336 ; the first time a GCS is being done on this command, return the status from
                                     0F0E  2337 ; the HRB status counter, which should be -2 or less, and initialize the UQB
                                     0F0E  2338 ; counters. If it is not the first time a GCS was done, if the oldest 
                                     0F0E  2339 ; outstanding command in the local controller has made progress, decrement
                                     0F0E  2340 ; UQB counter and return this value in the MSCP packet.
                                     0F0E  2341 ;
                                     0F0E  2342 ; The flag HRB$V_DRIVER is set any time that a thread forks to the local driver.
                                     0F0E  2343 ; Upon return, this bit is cleared. HRB$L_CMD_STS is decremented in this
                                     0F0E  2344 ; routine as well as strategic locations throughout the server to ensure that
                                     0F0E  2345 ; progress is being reflected.
                                     0F0E  2346 ;
                                     0F0E  2347 ; Inputs:
                                     0F0E  2348 ;
                                     0F0E  2349 ;	R0  =  Scratch
                                     0F0E  2350 ;	R1  =  Scratch
                                     0F0E  2351 ;	R2  =  MSCP packet address
                                     0F0E  2352 ;	R3  =  HRB address
                                     0F0E  2353 ;	R4  =  Scratch
                                     0F0E  2354 ;	R5  =  Scratch
                                     0F0E  2355 ;
                                     0F0E  2356 ; Outputs:
                                     0F0E  2357 ;
                                     0F0E  2358 ;	R0  =  MSCP status to return in the end message
                                     0F0E  2359 ;	R2  =  MSCP packet address
                                     0F0E  2360 ;	R3  =  HRB address
                                     0F0E  2361 ;-
                                     0F0E  2362 
                                     0F0E  2363 TMSCP$GET_COMMAND_STATUS::
                                     0F0E  2364 	.IF DEFINED DEBUG$PC_HISTORY
                                     0F0E  2365 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0F0E  2366 	.ENDC	   ;DEBUG$PC_HISTORY
                                     0F0E  2367 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  52
X-17                            - GET COMMAND STATUS   (- 2 -)           16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (19)

                    54   54 A3   D0  0F0E  2368 	MOVL	HRB$L_HQB(R3),R4	; R4 <= HQB
                    50   20 A4   DE  0F12  2369 	MOVAL	HQB$L_HRB_FL(R4),R0	; R0 <= HRB queue list head
                       55   50   D0  0F16  2370 	MOVL	R0,R5			; Prepare to start through the list
                                     0F19  2371 
                                     0F19  2372 	ASSUME	HRB$L_FLINK EQ 0
                                     0F19  2373 
                                     0F19  2374 10$:
                       55   65   D0  0F19  2375 	MOVL	HRB$L_FLINK(R5),R5	; Move on to the next request in line
                       50   55   D1  0F1C  2376 	CMPL	R5,R0			; If it is not the the list head
                            05   12  0F1F  2377 	BNEQ	20$			;  continue checking...
                         10 A2   D4  0F21  2378 	CLRL	MSCP$L_CMD_STS(R2)	; If the command was not found,
                            5D   11  0F24  2379 	BRB	150$			;  return a command status of zero
                                     0F26  2380 
                                     0F26  2381 20$:
                    54   18 A5   D0  0F26  2382 	MOVL	HRB$L_MSGBUF(R5),R4	; Get the packet address for the request
                         0C A2   D1  0F2A  2383 	CMPL	MSCP$L_OUT_REF(R2),-	; Compare outstanding reference number
                            64       0F2D  2384 		MSCP$L_CMD_REF(R4)	;  to the command reference number
                            E9   12  0F2E  2385 	BNEQ	10$			; This is not the one... keep looking
                         04 A2   B1  0F30  2386 	CMPW	MSCP$W_UNIT(R2),-	; Compare the unit number passed
                         04 A4       0F33  2387 		MSCP$W_UNIT(R4)		;  to the request we found
                            E2   12  0F35  2388 	BNEQ	10$			; If they are not the same keep looking
                            05   B1  0F37  2389 	CMPW	#HRB$K_ST_DRV_WAIT,-	; If we are waiting for driver to
                         14 A3       0F39  2390 		HRB$W_STATE(R3)		;  return control to us, then we check
                            41   12  0F3B  2391 	BNEQ	140$			;  for progress within the driver by
                                     0F3D  2392 					;  falling through.
                    54   58 A5   D0  0F3D  2393 	MOVL	HRB$L_UQB(R5),R4	; R4 <= UQB
                    51   24 A4   D0  0F41  2394 	MOVL	UQB$L_UCB(R4),R1	; R1 <= UCB
                            05   E1  0F45  2395 	BBC	#DEV$V_MSCP,-		; Fall through if an MSCP device, to
                      31 40 A1       0F47  2396 		UCB$L_DEVCHAR2(R1),130$	;  check if progress if being made in
                                     0F4A  2397 					;  the class driver.
                                     0F4A  2398 					; For now, if it is a non-MSCP class
                                     0F4A  2399 					;  driver, always indicate progress
                                     0F4A  2400 					;  so that lengthy commands such as
                                     0F4A  2401 					;  REPOSITION and ERASE will have time
                                     0F4A  2402 					;  to complete.
                  51   00D8 C1   D0  0F4A  2403 	MOVL	UCB$L_CDDB(R1),R1	; R1 <= CDDB
                                     0F4F  2404 
                                     0F4F  2405 ;	R1 <= CDDB
                                     0F4F  2406 ;	R2 <= MSCP packet address.
                                     0F4F  2407 ;	R4 <= UQB
                                     0F4F  2408 ;	R5 <= HRB containing the I/O request we are doing the GCS on.
                                     0F4F  2409 ;
                                     0F4F  2410 
                         0C A2   D1  0F4F  2411 	CMPL	MSCP$L_OUT_REF(R2),-	; Is this the first time we did a GCS
                       00A0 C4       0F52  2412 		UQB$L_SERV_RSPID(R4)	;  for this packet?
                            12   12  0F55  2413 	BNEQ	110$			; Yes, initialize all counters.
                         2C A1   D1  0F57  2414 	CMPL	CDDB$L_OLDRSPID(R1),-	; Is the class driver's oldest message
                       00A4 C4       0F5A  2415 		UQB$L_CLASS_RSPID(R4)	;  the same as the last time the server
                                     0F5D  2416 					;  was called to do a GCS?
                            10   12  0F5D  2417 	BNEQ	115$			; If the server and class RSPIDs match,
                         30 A1   D1  0F5F  2418 	CMPL	CDDB$L_OLDCMDSTS(R1),-	; is the command status still the same
                       00A8 C4       0F62  2419 		UQB$L_OLD_CLSSTS(R4)	; since the last GCS?
                            0E   12  0F65  2420 	BNEQ	120$			; If not, decrement counter to
                                     0F67  2421 					;  indicate progress.
                            15   11  0F67  2422 	BRB	140$			;  else, no progress is being made in
                                     0F69  2423 					;  the local class driver.
                                     0F69  2424 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  53
X-17                            - GET COMMAND STATUS   (- 2 -)           16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (19)

                                     0F69  2425 110$:
                         0C A2   D0  0F69  2426 	MOVL	MSCP$L_OUT_REF(R2),-	; Save RSPID of command we are currently
                       00A0 C4       0F6C  2427 		UQB$L_SERV_RSPID(R4)	;  doing a GCS for.
                                     0F6F  2428 
                                     0F6F  2429 115$:
                         2C A1   D0  0F6F  2430 	MOVL	CDDB$L_OLDRSPID(R1),-	; Save RSPID of oldest command that the
                       00A4 C4       0F72  2431 		UQB$L_CLASS_RSPID(R4)	;  local class driver has queued.
                                     0F75  2432 
                                     0F75  2433 120$:
                         30 A1   D0  0F75  2434 	MOVL	CDDB$L_OLDCMDSTS(R1),-	; is the command status still the same
                       00A8 C4       0F78  2435 		UQB$L_OLD_CLSSTS(R4)	; since the last GCS?
                                     0F7B  2436 
                                     0F7B  2437 130$:
                         60 A5   D7  0F7B  2438 	DECL	HRB$L_CMD_STS(R5)	; Indicate that progress is being made.
                                     0F7E  2439 
                                     0F7E  2440 140$:
                         60 A5   D0  0F7E  2441 	MOVL	HRB$L_CMD_STS(R5),-	; Get the status from the target rqst
                         10 A2       0F81  2442 		MSCP$L_CMD_STS(R2)	;  and put it in the requesting packet
                                     0F83  2443 
                                     0F83  2444 150$:
                       50   00   D0  0F83  2445 	MOVL	#MSCP$K_ST_SUCC,R0	; Zero means the command was successful
                          10B1   31  0F86  2446 	BRW	TMSCP$SEND_END		; Return an end packet with status
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  54
X-17                            - GET UNIT STATUS    (- 3 -)             16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (20)

                                     0F89  2449 	.SBTTL	-	GET UNIT STATUS				(- 3 -)
                                     0F89  2450 
                                     0F89  2451 ;+
                                     0F89  2452 ; Functional Description:
                                     0F89  2453 ;
                                     0F89  2454 ; The GET UNIT STATUS command returns the current state of a unit plus
                                     0F89  2455 ; certain unit characteristics.  In particular, this command is used to
                                     0F89  2456 ; obtain host settable characteristics and those fixed unit characteristics
                                     0F89  2457 ; that are not normally needed by the class driver. 
                                     0F89  2458 ;
                                     0F89  2459 ; Inputs:
                                     0F89  2460 ;
                                     0F89  2461 ;	R0  =  Scratch
                                     0F89  2462 ;	R1  =  Scratch
                                     0F89  2463 ;	R2  =  MSCP packet address
                                     0F89  2464 ;	R3  =  HRB address
                                     0F89  2465 ;	R4  =  Scratch
                                     0F89  2466 ;	R5  =  Scratch
                                     0F89  2467 ;
                                     0F89  2468 ; Outputs:
                                     0F89  2469 ;
                                     0F89  2470 ;	R0  =  Completion status
                                     0F89  2471 ;	R2  =  MSCP packet address
                                     0F89  2472 ;	R3  =  HRB address
                                     0F89  2473 ;-
                                     0F89  2474 
                                     0F89  2475 TMSCP$GET_UNIT_STATUS::
                                     0F89  2476 	.IF DEFINED DEBUG$PC_HISTORY
                                     0F89  2477 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     0F89  2478 	.ENDC	   ;DEBUG$PC_HISTORY
                    50   54 A3   D0  0F89  2479 	MOVL	HRB$L_HQB(R3),R0	; Get the address of the HQB to
                            01   E1  0F8D  2480 	BBC	#HQB$V_V5CL,-		; If this request is from an old class
                      17 12 A0       0F8F  2481 		HQB$W_FLAGS(R0),5$	; driver, we're in trouble.
                                     0F92  2482 
                                     0F92  2483 ;
                                     0F92  2484 ; The unit number has bit 14 set to indicate that the unit no. is a Server Local
                                     0F92  2485 ; Unit Number (SLUN).  After the bit is cleared, the unit number that remains
                                     0F92  2486 ; is used as an index into the unit table to locate the address of the Unit 
                                     0F92  2487 ; Queue Block (UQB) for this tape.  If the next unit specifier was set
                                     0F92  2488 ; and the table location for the specified unit number is zero, the remaining
                                     0F92  2489 ; locations are examined until a nonzero value is found or the end of the 
                                     0F92  2490 ; table is reached.  The only occasions when SLUN should not be set is if
                                     0F92  2491 ; the unit is 0 (NOP sent by class driver to prohibit timeout) or if the
                                     0F92  2492 ; unit is 1 (used at the very start of unit polling to find the first unit).
                                     0F92  2493 ;
                                     0F92  2494 
                    55   32 A0   D0  0F92  2495 	MOVL	HQB$L_TSRV(R0),R5	;  get the server structure address
                    50   04 A2   3C  0F96  2496 	MOVZWL	MSCP$W_UNIT(R2),R0	; Pick up the unit number passed
                            2E   13  0F9A  2497 	BEQL	40$			; If unit 0, return harmless offline
                            00   E1  0F9C  2498 	BBC	#MSCP$V_MD_NXUNT,-	; If the next unit modifier is clear
                         0A A2       0F9E  2499 		MSCP$W_MODIFIER(R2),-	;  branch to process the specified unit
                            2F       0FA0  2500 		80$			;  with common code
                                     0FA1  2501 
                                     0FA1  2502 ;
                                     0FA1  2503 ; The next unit modifier requests that the controller return the status of the
                                     0FA1  2504 ; next unit (in order of ascending unit numbers) that the controller knows to
                                     0FA1  2505 ; exist and whose unit number is greater than or equal to the unit number 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  55
X-17                            - GET UNIT STATUS    (- 3 -)             16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (20)

                                     0FA1  2506 ; specified in the command.
                                     0FA1  2507 ;
                                     0FA1  2508 
                    0A 50   0E   E4  0FA1  2509 	BBSC	#MSCP$V_SLUN,R0,20$	; Branch if SLUN set, clear it for index
                            50   D7  0FA5  2510 	DECL	R0			; Is this the start of unit polling?
                            06   13  0FA7  2511 	BEQL	20$			; Branch if unit was = 1, start lookup
                                     0FA9  2512 
                                     0FA9  2513 5$:
                                     0FA9  2514 	BUG_CHECK TMSCPSERV, FATAL	; Wrong class driver 
                               FEFF  0FA9       		.WORD	^XFEFF
                               0004' 0FAB       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_TMSCPSERV!4
                                     0FAD  2515 
                                     0FAD  2516 10$:
                            50   D6  0FAD  2517 	INCL	R0			; Bump to next "unit" in table
                                     0FAF  2518 
                                     0FAF  2519 20$:
                  50   0100 8F   B1  0FAF  2520 	CMPW	#MAX_UNITS,R0		; Make sure "unit" specified is in table
                            11   1B  0FB4  2521 	BLEQU	30$			; If not, end polling with unit 0
                54   00C4 C540   D0  0FB6  2522 	MOVL	TSRV$L_UNITS(R5)[R0],R4	; Find the UQB address in the table
                            EF   13  0FBC  2523 	BEQL	10$			; Try next unit if there isn't one here
                    58 A3   54   D0  0FBE  2524 	MOVL	R4,HRB$L_UQB(R3)	; Save away the UQB address we found,
                         12 A4   D6  0FC2  2525 	INCL	UQB$W_CURRENT(R4)	;  increment the current count for unit,
                            0F   11  0FC5  2526 	BRB	90$			;  and continue in the common code
                                     0FC7  2527 
                                     0FC7  2528 ;
                                     0FC7  2529 ; If there are no units that are both known to the controller and whose
                                     0FC7  2530 ; unit numbers are greater than or equal to the unit number specified in
                                     0FC7  2531 ; the command message, then zero is returned in the "unit number" field
                                     0FC7  2532 ; of the end message.  Since in SLUN versions there is no true unit "0",
                                     0FC7  2533 ; the rest of the status is set harmlessly to OFFLN via TMSCP$ERROR_NO_UNIT.
                                     0FC7  2534 ;
                                     0FC7  2535 
                                     0FC7  2536 30$:
                         04 A2   B4  0FC7  2537 	CLRW	MSCP$W_UNIT(R2)		; Give special code (Unit 0)
                                     0FCA  2538 
                                     0FCA  2539 40$:
                       50   03   D0  0FCA  2540 	MOVL	#MSCP$K_ST_OFFLN,R0	; Return a status of offline
                          106A   31  0FCD  2541 	BRW	TMSCP$SEND_END		; Let the client find another path
                                     0FD0  2542 
                                     0FD0  2543 ;
                                     0FD0  2544 ; The request is for a specific unit
                                     0FD0  2545 ;
                                     0FD0  2546 
                                     0FD0  2547 80$:
                          0FF4   30  0FD0  2548 	BSBW	TMSCP$FIND_UQB		; Find the UQB for this request
                         F4 50   E9  0FD3  2549 	BLBC	R0,40$			; Branch if no such unit found.
                                     0FD6  2550 
                                     0FD6  2551 ;
                                     0FD6  2552 ; A UQB address was found and has been placed in the HRB.
                                     0FD6  2553 ;
                                     0FD6  2554 
                                     0FD6  2555 90$:
                    54   58 A3   D0  0FD6  2556 	MOVL	HRB$L_UQB(R3),R4	; Get the address of the UQB
                         5E A4   B0  0FDA  2557 	MOVW	UQB$W_SLUN(R4),-	; Assume we are using the new driver
                         04 A2       0FDD  2558 		MSCP$W_UNIT(R2)		; Unit whose status we are returning
                    50   24 A4   D0  0FDF  2559 	MOVL	UQB$L_UCB(R4),R0	; Get the UCB address for this unit
                       00A0 C0   D0  0FE3  2560 	MOVL	UCB$L_MEDIA_ID(R0),-	; Get the media identifier out of the
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  56
X-17                            - GET UNIT STATUS    (- 3 -)             16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (20)

                         1C A2       0FE7  2561 		MSCP$L_MEDIA_ID(R2)	;  UCB just in case it changes!
                         26 A2   94  0FE9  2562 	CLRB	MSCP$B_FREECAP(R2)	; Unknown amount of free capacity.
                                     0FEC  2563 ;	CLRL	MSCP$B_FMTR_SRV(R2)	; MSCP$B_FMTR_SVR <= 0
                                     0FEC  2564 					; MSCP$B_FMTR_HVR <= 0
                                     0FEC  2565 					; MSCP$B_UNIT_SVR <= 0
                                     0FEC  2566 					; MSCP$B_UNIT_HVR <= 0
                                     0FEC  2567 
                                     0FEC  2568 ;
                                     0FEC  2569 ;		The following fields are documented in Tables C-1 and C-2
                                     0FEC  2570 ;		in the TMSCP specification.
                                     0FEC  2571 ;
                                     0FEC  2572 
                                     0FEC  2573 	GET_TAPE_FORMENU	R0	; Supported tape formats.
                    40 A0   05   E1  0FEC       	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                            07       0FF0       		UCB$L_DEVCHAR2(R0), 30043$	; Not MSCP tape - branch.
                 24 A2   54 A0   B0  0FF1       	MOVW	UCB$W_TU_FORMENU(R0), -	; Steal tape formenu from UCB.
                            19   11  0FF6       	BRB	30044$
                                     0FF8       30043$:
                       7E   50   7D  0FF8       	MOVQ	R0, -(SP)
                       05   08   EF  0FFB       	EXTZV	# MT$V_DENSITY, -		; Extract VMS density from the UCB.
                         50 A0       0FFE       		# MT$S_DENSITY, -
                            50       1000       		UCB$L_DEVDEPEND(R0), R0
                            51   D4  1001       	CLRL	R1				; Use default VMS density table.
                          11C2   30  1003       	BSBW	TMSCP$VMSTOMSCP_DENS		; Convert tape density value.
                    24 A2   51   90  1006       	MOVB	R1, MSCP$W_FORMENU(R2)		; Return the current tape format.
                    25 A2   51   90  100A       	MOVB	R1, 1+MSCP$W_FORMENU(R2)	; Return the supported densities.
                       50   8E   7D  100E       	MOVQ	(SP)+, R0
                                     1011       30044$:
                                     1011  2574 	GET_TAPE_FORMAT		R0	; Current tape format.
                    40 A0   05   E1  1011       	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                            08       1015       		UCB$L_DEVCHAR2(R0), 30045$	; Not MSCP tape - branch.
               20 A2   0124 C0   B0  1016       	MOVW	UCB$W_TU_FORMAT(R0), -	; Steal tape format from UCB.
                            15   11  101C       	BRB	30046$
                                     101E       30045$:
                       7E   50   7D  101E       	MOVQ	R0, -(SP)
                       05   08   EF  1021       	EXTZV	# MT$V_DENSITY, -		; Extract VMS density from the UCB.
                         50 A0       1024       		# MT$S_DENSITY, -
                            50       1026       		UCB$L_DEVDEPEND(R0), R0
                            51   D4  1027       	CLRL	R1				; Use default VMS density table.
                          119C   30  1029       	BSBW	TMSCP$VMSTOMSCP_DENS		; Convert tape density value.
                    20 A2   51   B0  102C       	MOVW	R1, MSCP$W_FORMAT(R2)		; Return the tape format.
                       50   8E   7D  1030       	MOVQ	(SP)+, R0
                                     1033       30046$:
                                     1033  2575 	GET_TAPE_SPEED		R0, -	; Data rate in kilobytes per second.
                                     1033  2576 				MSCP$W_FORMAT(R2)
                    40 A0   05   E1  1033       	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                            08       1037       		UCB$L_DEVCHAR2(R0), 30047$	; Not MSCP tape - branch.
               22 A2   0126 C0   B0  1038       	MOVW	UCB$W_TU_SPEED(R0), -	; Steal tape speed from UCB.
                            17   11  103E       	BRB	30048$
                                     1040       30047$:
                       7E   50   7D  1040       	MOVQ	R0, -(SP)
                    51   20 A2   3C  1043       	MOVZWL	MSCP$W_FORMAT(R2), R1			; Get the MSCP tape format.
                       08   18   EF  1047       	EXTZV	# MT$V_SPEED, -			; Extract VMS tape speed from R0
                         50 A0       104A       		# MT$S_SPEED, -			; and return as the tape speed.
                            50       104C       		UCB$L_DEVDEPEND(R0), R0
                          11E9   30  104D       	BSBW	TMSCP$SPEEDTOMSCP		; Convert speed value.
                    22 A2   50   B0  1050       	MOVW	R0, MSCP$W_SPEED(R2)		; Return the tape speed.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  57
X-17                            - GET UNIT STATUS    (- 3 -)             16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (20)

                       50   8E   7D  1054       	MOVQ	(SP)+, R0
                                     1057       30048$:
                                     1057  2577 
                                     1057  2578 ;
                                     1057  2579 ; If this is an MSCP device and it is in mount verification or no connection
                                     1057  2580 ; return a status of offline.
                                     1057  2581 ;
                                     1057  2582 
                            0E   E0  1057  2583 	BBS	#UCB$V_MNTVERIP,-	; If the volume is in local mount
                      1B 78 A0       1059  2584 		UCB$W_STS(R0),125$	;  verification then offline
                            05   E1  105C  2585 	BBC	#DEV$V_MSCP,-		; If this is a MSCP device,
                      1E 40 A0       105E  2586 		UCB$L_DEVCHAR2(R0),140$	;  and there are already requests
                  51   00D8 C0   D0  1061  2587 	MOVL	UCB$L_CDDB(R0),R1	; Follow the link to its CDDB
                            07   E0  1066  2588 	BBS	#CDDB$V_NOCONN,-	; If there is no connection to the
                      06 12 A1       1068  2589 		CDDB$W_STATUS(R1),120$	;  device, set it offline
                            04   91  106B  2590 	CMPB	#MSCP$K_CM_EMULA,-	; Check to see if the controller
                         26 A1       106D  2591 		CDDB$B_CNTRLMDL(R1)	;  model is an emulator (server)
                            0E   12  106F  2592 	BNEQ	140$			; If it is, leave it offline
                                     1071  2593 
                                     1071  2594 120$:
                       50   03   D0  1071  2595 	MOVL	#MSCP$K_ST_OFFLN,R0	;  Return a status of offline and let
                          0FC3   31  1074  2596 	BRW	TMSCP$SEND_END		;  the client find another path
                                     1077  2597 
                                     1077  2598 125$:
                       50   03   D0  1077  2599 	MOVL	#MSCP$K_ST_OFFLN,R0	; Return a status of offline, but
                       50   20   A8  107A  2600 	BISW	#MSCP$M_SC_NOVOL,R0	;  reflect doubt about the volume
                            47   11  107D  2601 	BRB	170$			;  UCB will be built on client node
                                     107F  2602 ;
                                     107F  2603 ; Everything is alright with this unit. The MSCP end message
                                     107F  2604 ; is now filled in and returned to the client node.
                                     107F  2605 ;
                                     107F  2606 	ASSUME	UQB$K_ST_AVAILABLE  EQ  MSCP$K_ST_AVLBL
                                     107F  2607 	ASSUME	UQB$K_ST_OFFLINE  EQ  MSCP$K_ST_OFFLN
                                     107F  2608 
                                     107F  2609 140$:
                    50   0C A4   3C  107F  2610 	MOVZWL	UQB$W_STATE(R4),R0	; Get the state for offline or avail
                       04   50   B1  1083  2611 	CMPW	R0, #UQB$K_ST_AVAILABLE	; State of the device available?
                            3E   13  1086  2612 	BEQL	170$			; If eql yes, return it
                         0C A4   B1  1088  2613 	CMPW	UQB$W_STATE(R4),-	; If the state of the device
                            02       108B  2614 		#UQB$K_ST_ONLINE	;  is online, skip on down
                            21   13  108C  2615 	BEQL	160$			; The status in R0 will be fine
                                     108E  2616 
                                     108E  2617 ;
                                     108E  2618 ; The status of this device as stored in the UQB indicates that some sort of
                                     108E  2619 ; error has been encountered that has caused this device to go offline. The
                                     108E  2620 ; server must now determine if the device is still offline, or may now be
                                     108E  2621 ; made available to client nodes.
                                     108E  2622 ;
                    51   24 A4   D0  108E  2623 	MOVL	UQB$L_UCB(R4),R1	; Get the address of the UCB
                            04   E1  1092  2624 	BBC	#UCB$V_ONLINE,-		; If the device is not UCB online
                      2F 78 A1       1094  2625 		UCB$W_STS(R1),170$	;  leave the device offline for now
                            05   E1  1097  2626 	BBC	#DEV$V_MSCP,-		; Don't try any of the remaining tests
                      2A 40 A1       1099  2627 		UCB$L_DEVCHAR2(R1),170$	;  unless this is a class driver!
                  51   00D8 C1   D0  109C  2628 	MOVL	UCB$L_CDDB(R1),R1	;  and follow the link to its CDDB
                            04   91  10A1  2629 	CMPB	#MSCP$K_CM_EMULA,-	; Check to see if the controller
                         26 A1       10A3  2630 		CDDB$B_CNTRLMDL(R1)	;  model is an emulator (server)
                            1F   13  10A5  2631 	BEQL	170$			; If it is, leave it offline
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  58
X-17                            - GET UNIT STATUS    (- 3 -)             16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (20)

                                 B3  10A7  2632 	BITW	#<CDDB$M_NOCONN! -	; If there is no connection or
                                     10A8  2633 		CDDB$M_DISABLED>,-	; the controller is disabled
               12 A1   2080 8F       10A8  2634 		CDDB$W_STATUS(R1)	;  then leave it offline
                            17   12  10AD  2635 	BNEQ	170$			; If neq offline
                                     10AF  2636 
                                     10AF  2637 160$:
                       50   04   D0  10AF  2638 	MOVL	#UQB$K_ST_AVAILABLE,R0	; Assume the device is available
                         70 A4   D1  10B2  2639 	CMPL	UQB$L_ONLINE_HQB(R4),-	; Does the host who requested this GUS
                         54 A3       10B5  2640 		HRB$L_HQB(R3)		;  have this unit online?
                            0D   12  10B7  2641 	BNEQ	170$			; If not, return status in R0 (offline)
                       50   00   3C  10B9  2642 	MOVZWL	#MSCP$K_ST_SUCC,R0	; Return a status of success
                            08   E1  10BC  2643 	BBC	#MSCP$V_UF_WRTPD,-	; If Data Safety Write Protect 
                      05 16 A4       10BE  2644 		UQB$W_UNIT_FLAGS(R4),170$;  due to some condition in the unit,
                  50   1000 8F   A8  10C1  2645 	BISW	#MSCP$M_SC_RDONY,R0	;  then set Read Only subcode in R0.
                                     10C6  2646 
                                     10C6  2647 170$:
                                     10C6  2648 ;;;
                                     10C6  2649 ;
                                     10C6  2650 ; The contents of the UQB copy of the unit flags could be stale. To
                                     10C6  2651 ; assure the correct bits are passed back, update the UQB UNIT FLAGS
                                     10C6  2652 ; before copying it into the mscp packet.
                                     10C6  2653 ;
                    51   24 A4   D0  10C6  2654 	MOVL	UQB$L_UCB(R4),R1	; Get the UCB address
                       00FA C1   B0  10CA  2655 	MOVW	UCB$W_UNIT_FLAGS(R1),-	; Get the device unit_flags
                         16 A4       10CE  2656 		UQB$W_UNIT_FLAGS(R4)
                                     10D0  2657 ;;;
                         16 A4   B0  10D0  2658 	MOVW	UQB$W_UNIT_FLAGS(R4),-	; Put the set unit flags in the
                         0E A2       10D3  2659 		MSCP$W_UNT_FLGS(R2)	;  end packet to return
                 0C A2   14 A4   D0  10D5  2660 	MOVL	UQB$W_MULT_UNIT(R4), -	;  the tape class driver, so stop here.
                                     10DA  2661 		MSCP$W_MULT_UNT(R2)	; Copy mult_unit & unit_flags
                 14 A2   18 A4   7D  10DA  2662 	MOVQ	UQB$Q_UNIT_ID(R4), -	;  
                                     10DF  2663 		MSCP$Q_UNIT_ID(R2)	; Copy unit identifier
                          0F58   31  10DF  2664 	BRW	TMSCP$SEND_END
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  59
X-17                            - SET CONTROLLER CHARACTERISTICS  (- 4 - 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (21)

                                     10E2  2667 	.SBTTL	-	SET CONTROLLER CHARACTERISTICS		(- 4 -)
                                     10E2  2668 
                                     10E2  2669 ;+
                                     10E2  2670 ; Functional Description:
                                     10E2  2671 ;
                                     10E2  2672 ; This command is the mechanism whereby certain host settable controller
                                     10E2  2673 ; characteristics are determined. The information sent to the server by 
                                     10E2  2674 ; the host includes; controller flags, the host timeout interval, the
                                     10E2  2675 ; current time and date on the host system, and controller dependant
                                     10E2  2676 ; tuning parameters. In the end message, the server returns the following
                                     10E2  2677 ; information as it is currently set; the controller flags, the controller
                                     10E2  2678 ; timeout interval, the controller hardware and software revision numbers,
                                     10E2  2679 ; and a unique MSCP device identifier.
                                     10E2  2680 ;
                                     10E2  2681 ; Inputs:
                                     10E2  2682 ;
                                     10E2  2683 ;	R0  =  Scratch
                                     10E2  2684 ;	R1  =  Scratch
                                     10E2  2685 ;	R2  =  MSCP packet address
                                     10E2  2686 ;	R3  =  HRB address
                                     10E2  2687 ;	R4  =  Scratch
                                     10E2  2688 ;	R5  =  Scratch
                                     10E2  2689 ;
                                     10E2  2690 ; Outputs:
                                     10E2  2691 ;
                                     10E2  2692 ;	R0  =  Completion status
                                     10E2  2693 ;	R2  =  MSCP packet address
                                     10E2  2694 ;	R3  =  HRB address
                                     10E2  2695 ;-
                                     10E2  2696 
                                     10E2  2697 TMSCP$SET_CONTROLLER_CHAR::
                                     10E2  2698 	.IF DEFINED DEBUG$PC_HISTORY
                                     10E2  2699 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     10E2  2700 	.ENDC	   ;DEBUG$PC_HISTORY
                    54   54 A3   D0  10E2  2701 	MOVL	HRB$L_HQB(R3),R4	; Get the HQB address so we can
                    55   32 A4   D0  10E6  2702 	MOVL	HQB$L_TSRV(R4),R5	;  get the address of the server struct
                         0C A2   B1  10EA  2703 	CMPW	MSCP$W_VERSION(R2),-	; This is a check to assure the
                         3C A5       10ED  2704 		TSRV$W_VERSION(R5)	;  compatability of versions of MSCP
                            07   13  10EF  2705 	BEQL	10$			; We are speaking the same language
                  50   0C   18   9C  10F1  2706 	ROTL	#24,#MSCP$W_VERSION,R0	; A change has been made to MSCP to
                          1004   31  10F5  2707 	BRW	TMSCP$PACKET_ERROR	;  make it no longer downward compat
                                     10F8  2708 
                                     10F8  2709 10$:
                         0E A2   B0  10F8  2710 	MOVW	MSCP$W_CNT_FLGS(R2),-	; Copy the controller flag values
                         0E A4       10FB  2711 		HQB$W_CNT_FLGS(R4)	;  to the server structure
                                     10FD  2712 	READ_SYSTIME -			; Get the time this command was
                                     10FD  2713 		HQB$Q_TIME(R4)		;  issued on the remote machine
                       7E   12   DB  10FD       	 MFPR	S^#PR$_IPL,-(SP)
                10 00000000'GF   E9  1100       	BLBC	G^SMP$GL_FLAGS,30051$
                            50   DD  1107       	 PUSHL	R0
                       50   23   9A  1109       	 MOVZBL	S^#SPL$C_HWCLK,R0
                   00000000'GF   16  110C       	 JSB	G^SMP$ACQUIRE
                            50 8ED0  1112       	 POPL	R0
                            03   11  1115       	BRB	30052$
                                     1117       30051$:
                       12   18   DA  1117       		MTPR	S^#IPL$_HWCLK,S^#PR$_IPL
                                     111A       30052$:
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  60
X-17                            - SET CONTROLLER CHARACTERISTICS  (- 4 - 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (21)

           14 A4   00000000'GF   7D  111A       	  MOVQ	G^EXE$GQ_SYSTIME,HQB$Q_TIME(R4)
                0E 00000000'GF   E9  1122       	BLBC	G^SMP$GL_FLAGS,30058$
                            50   DD  1129       	 PUSHL	R0
                       50   23   9A  112B       	 MOVZBL	S^#SPL$C_HWCLK,R0
                   00000000'GF   16  112E       	 JSB	G^SMP$RELEASE
                            50 8ED0  1134       	 POPL	R0
                                     1137       30058$:
                       12   8E   DA  1137       	 MTPR	(SP)+,S^#PR$_IPL
                         10 A2   B0  113A  2714 	MOVW	MSCP$W_HST_TMO(R2),-	; Copy the host access timeout
                         10 A4       113D  2715 		HQB$W_HTIMO(R4)		;  interval to the HQB
                            18   13  113F  2716 	BEQL	30$			; Disables host access timeouts
               00FF 8F   10 A4   B1  1141  2717 	CMPW	HQB$W_HTIMO(R4),#255	; "Treat all values greater than 255
                            06   15  1147  2718 	BLEQ	20$			;  as if 255 had been specified"
               10 A4   00FF 8F   B0  1149  2719 	MOVW	#255,HQB$W_HTIMO(R4)	; 			- the spec
                                     114F  2720 
                                     114F  2721 20$:
                    0A   10 A4   B1  114F  2722 	CMPW	HQB$W_HTIMO(R4),#10	; "Treat all values between 1 and 9
                            04   18  1153  2723 	BGEQ	30$			;  as if 10 had been specified"
                    10 A4   0A   B0  1155  2724 	MOVW	#10,HQB$W_HTIMO(R4)	; 			- the spec
                                     1159  2725 
                                     1159  2726 30$:
                                     1159  2727 
                                     1159  2728 ;
                                     1159  2729 ; Return controller information to host
                                     1159  2730 ;
                                     1159  2731 
                   00000000'GF   90  1159  2732 	MOVB	G^CLU$GL_TAPE_ALLOCLS,-	; Transfer the allocation class
                         04 A2       115F  2733 		MSCP$B_CNT_ALCS(R2)	; 
                         3C A5   B0  1161  2734 	MOVW	TSRV$W_VERSION(R5),-	; Return all the current settings of
                         0C A2       1164  2735 		MSCP$W_VERSION(R2)	;  the server software version number,
                         3E A5   B0  1166  2736 	MOVW	TSRV$W_CFLAGS(R5),-	; 
                         0E A2       1169  2737 		MSCP$W_CNT_FLGS(R2)	;  the server controller flag settings,
                       01FF 8F   B0  116B  2738 	MOVW	#<SERVER_TIMEOUT*2>+1,-	;  and the controller timeout value
                         10 A2       116F  2739 		MSCP$W_CNT_TMO(R2)
                         44 A5   7D  1171  2740 	MOVQ	TSRV$Q_CTRL_ID(R5),-	; Also, uniquely identify this MSCP
                         14 A2       1174  2741 		MSCP$Q_CNT_ID(R2)	;  device to the host
                         1C A2   D4  1176  2742 	CLRL	MSCP$L_MAXBCNT(R2)	; Class driver will use 64K as max.
                                     1179  2743 
                                     1179  2744 	ASSUME	SOFTWARE_REV  GT  0	; Software and hardware revisions
                                     1179  2745 	ASSUME	SOFTWARE_REV  LE  255	;  are byte fields. The following
                                     1179  2746 	ASSUME	HARDWARE_REV  GT  0	;  two MOVB instructions are not a MOVW
                                     1179  2747 	ASSUME	HARDWARE_REV  LE  255	;  for easier patching, if necessary.
                                     1179  2748 
                    12 A2   11   90  1179  2749 	MOVB	#SOFTWARE_REV, -	; Set software version number in
                                     117D  2750 		MSCP$B_CNT_SVR(R2)	;  end message.
                    13 A2   01   90  117D  2751 	MOVB	#HARDWARE_REV, -	; Set hardware version number in
                                     1181  2752 		MSCP$B_CNT_HVR(R2)	;  end message as well.
                                     1181  2753 
                       50   00   D0  1181  2754 	MOVL	#MSCP$K_ST_SUCC,R0	; Set success
                                     1184  2755 ;	CLRL	HRB$L_UQB(R3)		;  make sure the unblock won't work
                          0EB3   31  1184  2756 	BRW	TMSCP$SEND_END		;  and send off the end packet
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  61
X-17                            SEQUENTIAL class commands                16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (22)

                                     1187  2759 	.SBTTL	SEQUENTIAL class commands
                                     1187  2760 
                                     1187  2761 ;+
                                     1187  2762 ; Functional Description:
                                     1187  2763 ;
                                     1187  2764 ; All TMSCP command that are not immediate are sequential. This section 
                                     1187  2765 ; of code sets up for sequential command processing.  Steps are 
                                     1187  2766 ; taken in this routine to asure sequentiality. When a sequential command is 
                                     1187  2767 ; in progress, no other commands received may begin execution until the 
                                     1187  2768 ; completion of the sequential command. These commands are queued up on
                                     1187  2769 ; the UQB$L_BLOCKED queue and retrieved in a FIFO manner.
                                     1187  2770 ;
                                     1187  2771 ; There are two types of SEQUENTIAL commands, SEQUENTIAL and SEQUENTIAL 
                                     1187  2772 ; IMMEDIATE. SEQUENTIAL IMMEDIATE commands can be used so that lengthy
                                     1187  2773 ; non-data transfer operations complete asynchronously. These commands
                                     1187  2774 ; are ERASE, REPOSITION (rewind) and AVAILABLE. When the server receives
                                     1187  2775 ; one of these commands, it sets the immediate completion modifier in
                                     1187  2776 ; the function code and sends the request off to the local driver. Upon
                                     1187  2777 ; receipt of the completed I/O, the server sends the end message back to
                                     1187  2778 ; the requesting host. So in this case, immediate completion is accomplished
                                     1187  2779 ; by the actual controller, not the emulator.
                                     1187  2780 ;
                                     1187  2781 ; SEQUENTIAL IMMEDIATE commands can also be executed as "write-back" caching
                                     1187  2782 ; enabled "write" type commands. In this case, the TMSCP server emulator will
                                     1187  2783 ; return the end message to the remote host as soon as the data for the write
                                     1187  2784 ; data operation is completely buffered by the TMSCP server in a local buffer
                                     1187  2785 ; These commands are WRITE, WRITE TAPE MARK, and ERASE GAP.
                                     1187  2786 ; 
                                     1187  2787 ; Inputs:
                                     1187  2788 ;
                                     1187  2789 ;	R0  =  Scratch
                                     1187  2790 ;	R1  =  Scratch
                                     1187  2791 ;	R2  =  MSCP packet address
                                     1187  2792 ;	R3  =  HRB address
                                     1187  2793 ;	R4  =  Scratch
                                     1187  2794 ;	R5  =  Scratch
                                     1187  2795 ;
                                     1187  2796 ; Outputs:
                                     1187  2797 ;
                                     1187  2798 ;	R2  =  MSCP packet address
                                     1187  2799 ;	R3  =  HRB address
                                     1187  2800 ;	R4  =  UQB address
                                     1187  2801 ;-
                                     1187  2802 
                                     1187  2803 TMSCP$SEQUENTIAL::
                                     1187  2804 	.IF DEFINED DEBUG$PC_HISTORY
                                     1187  2805 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1187  2806 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1187  2807 
                                     1187  2808 10$:
                          0E3D   30  1187  2809 	BSBW	TMSCP$FIND_UQB		; Find the UQB that corresponds to 
                         03 50   E8  118A  2810 	BLBS	R0,TMSCP$SEQ_ALT	;  this request and put addr in HRB
                          0F66   31  118D  2811 	BRW	TMSCP$ERROR_NO_UNIT	; Return an error (see TMSCP$SEND_END)
                                     1190  2812 
                                     1190  2813 ;
                                     1190  2814 ; This alternate entry point into the processing of a sequential command is
                                     1190  2815 ; used during the cleanup of a virtual circuit error. Control is passed here
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  62
X-17                            SEQUENTIAL class commands                16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (22)

                                     1190  2816 ; with  the HRB address, and the UQB address, but there is no MSCP packet
                                     1190  2817 ; to be used.
                                     1190  2818 ;
                                     1190  2819 
                                     1190  2820 TMSCP$SEQ_ALT::
                    54   58 A3   D0  1190  2821 	MOVL	HRB$L_UQB(R3),R4	; Get the address of the UQB
                                     1194  2822 
                                     1194  2823 ;
                                     1194  2824 ;		Serialize all the sequential commands.
                                     1194  2825 ;
                                     1194  2826 
                          0C4C   30  1194  2827 	BSBW	TMSCP$SEQ_STALL		; Serialize all the sequential commands.
                                     1197  2828 
                                     1197  2829 ;
                                     1197  2830 ;		R0  =  Scratch
                                     1197  2831 ;		R1  =  Scratch
                                     1197  2832 ;		R2  =  Scratch
                                     1197  2833 ;		R3  =  HRB address
                                     1197  2834 ;		R4  =  UQB address, scratch
                                     1197  2835 ;		R5  =  Scratch
                                     1197  2836 ;
                                     1197  2837 
                    52   18 A3   D0  1197  2838 	MOVL	HRB$L_MSGBUF(R3),R2	; Get the address of the message buffer
                            06   13  119B  2839 	BEQL	30$			; Cleanup after VC failure - branch.
                    51   08 A2   9A  119D  2840 	MOVZBL	MSCP$B_OPCODE(R2),R1	; Put the op code into a safe reg
                            03   11  11A1  2841 	BRB	40$			;  and skip around
                                     11A3  2842 
                                     11A3  2843 30$:
                       51   08   D0  11A3  2844 	MOVL	#MSCP$K_OP_AVAIL,R1	; Cleanup always uses the same code
                                     11A6  2845 
                                     11A6  2846 40$:
                                     11A6  2847 	DISPATCH R1,-			; Dispatch on command opcode
                                     11A6  2848 		type=B,-		;  which is a byte field 
                                     11A6  2849 		prefix=MSCP$K_OP_,< -	;  and the beginning looks like this
                                     11A6  2850 		<AVAIL,	TMSCP$AVAILABLE>, -	; available, ALWAYS immediate 
                                     11A6  2851 		-				;   completion!
                                     11A6  2852 		<ONLIN,	TMSCP$ONLINE>, -	; online opcode 9
                                     11A6  2853 		<STUNT,	TMSCP$SET_UNIT_CHAR>, -	; set unit characteristics opcode 10
                                     11A6  2854 		<DTACP,	TMSCP$DET_ACC_PATH>, -	; determine access path opcode 11
                                     11A6  2855 		<ACCES, TMSCP$ACCESS>, -	; access
                                     11A6  2856 		<ERASE, TMSCP$ERASE>, -		; erase from current position to PEOT
                                     11A6  2857 		<FLUSH, TMSCP$FLUSH>, -		; flush write-back cache
                                     11A6  2858 		<ERGAP, TMSCP$ERASE_GAP>, -	; fill with specified block pattern
                                     11A6  2859 		<COMP,  TMSCP$COMPARE_HOST_DATA>, - ; compare data with host buffer
                                     11A6  2860 		<READ,  TMSCP$READ>, -		; read from tape
                                     11A6  2861 		<WRITE, TMSCP$WRITE>, -		; write to tape
                                     11A6  2862 		<WRITM, TMSCP$WRITE_TAPE_MARK>,-; write tape mark
                                     11A6  2863 		<REPOS, TMSCP$REPOSITION>, -	; reposition
                                     11A6  2864 		>
                  1D   08   51   8F  11A6       	CASEB	R1,#$$BASE,#$$LIMIT
                                     11AA       30062$:
                               00C8' 11AA       	.SIGNED_WORD	TMSCP$AVAILABLE-30062$
                               016A' 11AC       	.SIGNED_WORD	TMSCP$ONLINE-30062$
                               0218' 11AE       	.SIGNED_WORD	TMSCP$SET_UNIT_CHAR-30062$
                               035F' 11B0       	.SIGNED_WORD	TMSCP$DET_ACC_PATH-30062$
                               003C  11B2       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11B4       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  63
X-17                            SEQUENTIAL class commands                16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (22)

                               003C  11B6       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11B8       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               0365' 11BA       	.SIGNED_WORD	TMSCP$ACCESS-30062$
                               003C  11BC       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               0372' 11BE       	.SIGNED_WORD	TMSCP$ERASE-30062$
                               05DB' 11C0       	.SIGNED_WORD	TMSCP$FLUSH-30062$
                               003C  11C2       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11C4       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               0459' 11C6       	.SIGNED_WORD	TMSCP$ERASE_GAP-30062$
                               003C  11C8       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11CA       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11CC       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11CE       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11D0       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11D2       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11D4       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11D6       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               003C  11D8       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               036C' 11DA       	.SIGNED_WORD	TMSCP$COMPARE_HOST_DATA-30062$
                               060C' 11DC       	.SIGNED_WORD	TMSCP$READ-30062$
                               07D8' 11DE       	.SIGNED_WORD	TMSCP$WRITE-30062$
                               003C  11E0       	.IIF	EQ  $$GENSW,	.WORD	2*<$$LIMIT+1>
                               0777' 11E2       	.SIGNED_WORD	TMSCP$WRITE_TAPE_MARK-30062$
                               045F' 11E4       	.SIGNED_WORD	TMSCP$REPOSITION-30062$
                                     11E6  2865 
                  50   08   18   9C  11E6  2866 	ROTL	#24,#MSCP$B_OPCODE,R0	; Identify the bad field
                          0F0F   31  11EA  2867 	BRW	TMSCP$PACKET_ERROR	; Return an end msg with error status
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  64
X-17                            - SET_CLEAR_SEX                          16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (23)

                                     11ED  2870 	.SBTTL	-	SET_CLEAR_SEX
                                     11ED  2871 
                                     11ED  2872 ;+
                                     11ED  2873 ; This routine sets clear serious exception if the remote host requested it
                                     11ED  2874 ; and this device supports it.
                                     11ED  2875 ;-
                                     11ED  2876 ; Inputs:
                                     11ED  2877 ;
                                     11ED  2878 ;	R3  =  HRB address
                                     11ED  2879 ;
                                     11ED  2880 ; Outputs:
                                     11ED  2881 ;
                                     11ED  2882 ;	All registers preserved.
                                     11ED  2883 ;
                                     11ED  2884 ;	IO$M_CLSEREXCP set in IRP if appropriate
                                     11ED  2885 ;-
                                     11ED  2886 
                                     11ED  2887 TMSCP$SET_CLEAR_SEX::
                                     11ED  2888 	.IF DEFINED DEBUG$PC_HISTORY
                                     11ED  2889 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     11ED  2890 	.ENDC	   ;DEBUG$PC_HISTORY
                            24   BB  11ED  2891 	PUSHR	#^M<R2,R5>
                    52   18 A3   D0  11EF  2892 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore MSCP buffer address.
                    55   58 A3   D0  11F3  2893 	MOVL	HRB$L_UQB(R3),R5	; Restore UQB so that
                            0D   E1  11F7  2894 	BBC	#MSCP$V_MD_CLSEX,-	; Clear serious exception enabled?
                      19 0A A2       11F9  2895 		MSCP$W_MODIFIER(R2),999$;
                            05   E5  11FC  2896 	BBCC	#UQB$V_ST_SEREX,-	; Clear the serious exception
                    00 00C8 C5       11FE  2897 		UQB$W_ST_FLAGS(R5),10$	;
                                     1202  2898 
                                     1202  2899 10$:
                    55   24 A5   D0  1202  2900 	MOVL	UQB$L_UCB(R5),R5	;  that we can get the UCB
                            05   E1  1206  2901 	BBC	#DEV$V_MSCP,-		; If we are not dealing with a MSCP type
                      0A 40 A5       1208  2902 		UCB$L_DEVCHAR2(R5),999$	;  device, then we can't  enable it
                    55   1C A3   D0  120B  2903 	MOVL	HRB$L_IRP_CDRP(R3),R5	;
                       0200 8F   A8  120F  2904 	BISW	#IO$M_CLSEREXCP,-	;
                         20 A5       1213  2905 		IRP$W_FUNC(R5)
                                     1215  2906 
                                     1215  2907 999$:
                            24   BA  1215  2908 	POPR	#^M<R2,R5>
                                 05  1217  2909 	RSB
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  65
X-17                            - SET_IMMED                              16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (24)

                                     1218  2912 	.SBTTL	-	SET_IMMED
                                     1218  2913 
                                     1218  2914 ;+
                                     1218  2915 ; This routine sets the immediate completion modifier if the device
                                     1218  2916 ; supports it. It always sets the HRB immediate completion modifier
                                     1218  2917 ; so that caching can at least be supported at the server level
                                     1218  2918 ;-
                                     1218  2919 ; Inputs:
                                     1218  2920 ;
                                     1218  2921 ;	R3  =  HRB address
                                     1218  2922 ;
                                     1218  2923 ; Outputs:
                                     1218  2924 ;
                                     1218  2925 ;	All registers preserved.
                                     1218  2926 ;
                                     1218  2927 ;	IO$M_CLSEREXCP set in IRP if appropriate
                                     1218  2928 ;-
                                     1218  2929 
                                     1218  2930 TMSCP$SET_IMMED::
                                     1218  2931 	.IF DEFINED DEBUG$PC_HISTORY
                                     1218  2932 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1218  2933 	.ENDC	   ;DEBUG$PC_HISTORY
                            24   BB  1218  2934 	PUSHR	#^M<R2,R5>
                    52   18 A3   D0  121A  2935 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore MSCP buffer address.
                    55   58 A3   D0  121E  2936 	MOVL	HRB$L_UQB(R3),R5	; Restore the UQB address
                            06   E0  1222  2937       	BBS	#MSCP$V_MD_IMMED,-	; Immediate completion specified?
                      05 0A A2       1224  2938 		MSCP$W_MODIFIER(R2),10$	; If so, set flag in HRB.
                            06   E1  1227  2939       	BBC	#MSCP$V_UF_WBKNV,-	; Write back caching enabled on
                      13 16 A5       1229  2940 		UQB$W_UNIT_FLAGS(R5),999$; a per unit basis?
                                     122C  2941 
                                     122C  2942 10$:
                    55   24 A5   D0  122C  2943 	MOVL	UQB$L_UCB(R5),R5	;  that we can get the UCB
                            0A   E1  1230  2944 	BBC	#DEV$V_WBC,-		; If we are not dealing with a caching
                      0A 40 A5       1232  2945 		UCB$L_DEVCHAR2(R5),999$	;  controller, then we can't  enable it
                    55   1C A3   D0  1235  2946 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Restore CDRP/IRP address
                       0080 8F   A8  1239  2947 	BISW	#IO$M_NOWAIT,-		; Set nowait in the function itself
                         20 A5       123D  2948 		IRP$W_FUNC(R5)
                                     123F  2949 999$:
                            24   BA  123F  2950 	POPR	#^M<R2,R5>
                                 05  1241  2951 	RSB
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  66
X-17                            - SET_CLEAR_CDL                          16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (25)

                                     1242  2954 	.SBTTL	-	SET_CLEAR_CDL
                                     1242  2955 
                                     1242  2956 ;+
                                     1242  2957 ; This routine clears the cached data lost condition in the server if
                                     1242  2958 ; clear cached data lost was specified in the MSCP packet. It also
                                     1242  2959 ; sends the clear cached data modifier in the IRP to the local unit,
                                     1242  2960 ; if the unit is an MSCP device.
                                     1242  2961 ;-
                                     1242  2962 ; Inputs:
                                     1242  2963 ;
                                     1242  2964 ;	R3  =  HRB address
                                     1242  2965 ;
                                     1242  2966 ; Outputs:
                                     1242  2967 ;
                                     1242  2968 ;	All registers preserved.
                                     1242  2969 ;
                                     1242  2970 ;	MSCP$M_MD_CDATL set in IRP$L_MEDIA+6 if appropriate.
                                     1242  2971 ;-
                                     1242  2972 
                                     1242  2973 TMSCP$SET_CLEAR_CDL::
                                     1242  2974 	.IF DEFINED DEBUG$PC_HISTORY
                                     1242  2975 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1242  2976 	.ENDC	   ;DEBUG$PC_HISTORY
                            24   BB  1242  2977 	PUSHR	#^M<R2,R5>
                    52   18 A3   D0  1244  2978 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore MSCP buffer address.
                            0C   E1  1248  2979 	BBC	#MSCP$V_MD_CDATL,-	; Clear cached data lost set?
                      22 0A A2       124A  2980 		MSCP$W_MODIFIER(R2),999$; 
                    55   58 A3   D0  124D  2981 	MOVL	HRB$L_UQB(R3),R5	; Restore the UQB address
                            02   AA  1251  2982 	BICW	#UQB$M_ST_DLS,-		; If clear cached data lost set
                       00C8 C5       1253  2983 		UQB$W_ST_FLAGS(R5)	;  then clear the state in the UQB
                    55   24 A5   D0  1256  2984 	MOVL	UQB$L_UCB(R5),R5	; Restore the UCB
                            0A   E1  125A  2985 	BBC	#DEV$V_WBC,-		; If we are not dealing with a caching
                      10 40 A5       125C  2986 		UCB$L_DEVCHAR2(R5),999$	;  controller, then we can't  enable it
                    55   1C A3   D0  125F  2987 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Restore CDRP/IRP address
                       0040 8F   A8  1263  2988 	BISW	#MSCP$M_UF_WBKNV,-	; Clear cached data lost set in IRP
                         3E A5       1267  2989 		IRP$L_MEDIA+6(R5)
               20 A5   0100 8F   A8  1269  2990 	BISW	#IO$M_MSCPMODIFS, -	; Enable MSCP modifiers.
                                     126F  2991 		IRP$W_FUNC(R5)
                                     126F  2992 
                                     126F  2993 999$:
                            24   BA  126F  2994 	POPR	#^M<R2,R5>
                                 05  1271  2995 	RSB
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  67
X-17                            - AVAILABLE    (- 8 -)                   16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (26)

                                     1272  2998 	.SBTTL	-	AVAILABLE				(- 8 -)
                                     1272  2999 
                                     1272  3000 ;+
                                     1272  3001 ; Functional Description:
                                     1272  3002 ;
                                     1272  3003 ; All outstanding host commands are completed after which the tape unit
                                     1272  3004 ; is placed in the "Unit Available" state relative to the host. The tape
                                     1272  3005 ; is rewound to BOT.  For TMSCP tapes, the Available command is always treated 
                                     1272  3006 ; as an immediate command, regardless of the Immediate Completion
                                     1272  3007 ; modifier being set or clear. IO$V_NOWAIT is set in the function code,
                                     1272  3008 ; and as soon as the I/O completes in the local driver, the end
                                     1272  3009 ; message is returned to the requesting host.
                                     1272  3010 ; 
                                     1272  3011 ;
                                     1272  3012 ; Inputs:
                                     1272  3013 ;
                                     1272  3014 ;	R0  =  Scratch
                                     1272  3015 ;	R1  =  Scratch
                                     1272  3016 ;	R2  =  MSCP packet address
                                     1272  3017 ;	R3  =  HRB address
                                     1272  3018 ;	R4  =  UQB address, scratch
                                     1272  3019 ;	R5  =  Scratch
                                     1272  3020 ;
                                     1272  3021 ; Outputs:
                                     1272  3022 ;
                                     1272  3023 ;	R0  =  Completion status
                                     1272  3024 ;	R2  =  MSCP packet address
                                     1272  3025 ;	R3  =  HRB address
                                     1272  3026 ;-
                                     1272  3027 
                                     1272  3028 TMSCP$AVAILABLE::
                                     1272  3029 	.IF DEFINED DEBUG$PC_HISTORY
                                     1272  3030 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1272  3031 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1272  3032 
                                     1272  3033 ;
                                     1272  3034 ; Make sure the unit this request is for is ONLINE to the requesting host.
                                     1272  3035 ;
                                     1272  3036 
                         70 A4   D1  1272  3037 	CMPL	UQB$L_ONLINE_HQB(R4),-	; Is this unit online
                         54 A3       1275  3038 		HRB$L_HQB(R3)		;  to the requesting host?
                            0E   13  1277  3039 	BEQL	3$			; If not, get out.
                       50   00   D0  1279  3040 	MOVL	#MSCP$K_ST_SUCC,R0	; Set success status
                         70 A4   D5  127C  3041 	TSTL	UQB$L_ONLINE_HQB(R4)	; Is unit online to another host?
                            03   13  127F  3042 	BEQL	2$			; No, unit is available - branch.
                       50   03   D0  1281  3043 	MOVL	#MSCP$K_ST_OFFLN,R0	; Set unit offline.
                                     1284  3044 
                                     1284  3045 2$:
                          007D   31  1284  3046 	BRW	87$			; Branch assist.
                                     1287  3047 
                                     1287  3048 3$:
                         70 A4   D4  1287  3049 	CLRL	UQB$L_ONLINE_HQB(R4)	; We're no longer ONLINE.
                    55   24 A4   D0  128A  3050 	MOVL	UQB$L_UCB(R4),R5	; 
                       00C2 C5   97  128E  3051 	DECB	UCB$B_ONLCNT(R5)	; Drop the count
                            04   13  1292  3052 	BEQL	7$			; Should be at zero.
                                     1294  3053 
                                     1294  3054 	BUG_CHECK TMSCPSERV,FATAL	; Online count zapped.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  68
X-17                            - AVAILABLE    (- 8 -)                   16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (26)

                               FEFF  1294       		.WORD	^XFEFF
                               0004' 1296       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_TMSCPSERV!4
                                     1298  3055 ;
                                     1298  3056 ; Change the state of this unit to available.
                                     1298  3057 ;
                                     1298  3058 
                                     1298  3059 7$:
                            04   B0  1298  3060 	MOVW	#UQB$K_ST_AVAILABLE,-	; Change the state of this unit
                         0C A4       129A  3061 		UQB$W_STATE(R4)		;  to "available" for client hosts
                       54   55   D0  129C  3062 	MOVL	R5,R4			; Save the UCB address for TMSCP$DRIVE_CHECK
                    55   1C A3   D0  129F  3063 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the IRP address for the I/O
                    1C A5   54   D0  12A3  3064 	MOVL	R4,IRP$L_UCB(R5)	; Save the UCB address in the IRP
                                     12A7  3065 
                                     12A7  3066 ;
                                     12A7  3067 ; The class driver can issue three possible modifiers for the AVAILABLE
                                     12A7  3068 ; command: MSCP$M_MD_CLSEX, MSCP$M_MD_UNLOD, MSCP$M_MD_CDATL. Two other
                                     12A7  3069 ; modifiers are allowed by the spec but are not currently used: 
                                     12A7  3070 ; MSCP$M_MD_EXCAC and MSCP$M_MD_ALLCD.
                                     12A7  3071 ;
                                     12A7  3072 ; The server recognizes MSCP$M_MD_CLSEX and MSCP$M_MD_UNLOD. It cannot
                                     12A7  3073 ; issue any I/O function modifier for clearing cached data.
                                     12A7  3074 ;
                                     12A7  3075 
                    20 A5   11   B0  12A7  3076 	MOVW	#IO$_AVAILABLE, -	; Assume it is an AVAILABLE function.
                                     12AB  3077 		IRP$W_FUNC(R5)		; 
                            52   D5  12AB  3078 	TSTL	R2			; If this was an internally generated
                            1A   13  12AD  3079 	BEQL	60$			;  available, don't unload the drive
                            04   E1  12AF  3080 	BBC	#MSCP$V_MD_UNLOD,-	; If UNLOAD modifier set,
                      04 0A A2       12B1  3081 		MSCP$W_MODIFIER(R2),10$	;  set function
                    20 A5   01   B0  12B4  3082 	MOVW	#IO$_UNLOAD, -		;  to UNLOAD
                                     12B8  3083 		IRP$W_FUNC(R5)		;  
                                     12B8  3084 
                                     12B8  3085 10$:
                          FF32   30  12B8  3086 	BSBW	TMSCP$SET_CLEAR_SEX
                            05   E1  12BB  3087 	BBC	#DEV$V_MSCP,-		; If this is a TMSCP device, set
                      09 40 A4       12BD  3088 		UCB$L_DEVCHAR2(R4),60$	;  immediate completion modifier, else
                       0080 8F   A8  12C0  3089 	BISW	#IO$M_NOWAIT,-		;  leave clear until non-class tape
                         20 A5       12C4  3090 		IRP$W_FUNC(R5)		;  drivers support this.
                          FF79   30  12C6  3091 	BSBW	TMSCP$SET_CLEAR_CDL
                                     12C9  3092 
                                     12C9  3093 60$:
                    14 A5   53   D0  12C9  3094 	MOVL	R3,IRP$L_HRB(R5)	; Save HRB in IRP.
                    54   58 A3   D0  12CD  3095 	MOVL	HRB$L_UQB(R3),R4	; Restore UQB for seq synch.
                                     12D1  3096 
                                     12D1  3097 ;
                                     12D1  3098 ;	R0  =  Scratch
                                     12D1  3099 ;	R1  =  Scratch
                                     12D1  3100 ;	R2  =  Scratch
                                     12D1  3101 ;	R3  =  HRB address
                                     12D1  3102 ;	R4  =  UQB address
                                     12D1  3103 ;	R5  =  Scratch
                                     12D1  3104 ;
                                     12D1  3105 
                          086D   30  12D1  3106 	BSBW	TMSCP$DRIVE_CHECK	; Send the packet to the tape
                                     12D4  3107 
                                     12D4  3108 ;
                                     12D4  3109 ; Control returns here from entry point TMSCP$BACK. 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  69
X-17                            - AVAILABLE    (- 8 -)                   16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (26)

                                     12D4  3110 ;
                                     12D4  3111 ;	R0  =  I/O status block, scratch
                                     12D4  3112 ;	R1  =  Scratch
                                     12D4  3113 ;	R2  =  Scratch
                                     12D4  3114 ;	R3  =  HRB address
                                     12D4  3115 ;	R4  =  UQB address
                                     12D4  3116 ;	R5  =  IRP address
                                     12D4  3117 ; 
                                     12D4  3118 ; The host-settable unit flags are cleared.
                                     12D4  3119 ;
                    52   54 A3   D0  12D4  3120 	MOVL	HRB$L_HQB(R3),R2	; Restore HQB
                       00C4 C4   D4  12D8  3121 	CLRL	UQB$L_POSITION(R4)	; We are back to the top.
                                     12DC  3122 
                                     12DC  3123 	ASSUME	UQB$W_MAX_IO EQ 2+UQB$W_NUM_IO
                                     12DC  3124 
                       00B8 C4   D4  12DC  3125 	CLRL	UQB$W_NUM_IO(R4)	; Zero out outstanding IOs, max IOs
                  00C8 C4   01   B0  12E0  3126 	MOVW	# UQB$M_ST_BOT, -	; Clear all status flags except BOT.
                                     12E5  3127 		UQB$W_ST_FLAGS(R4)
                                 AA  12E5  3128 	BICW	#<MSCP$M_UF_WRTPS!-	; Clear out the hardware write protect
                                     12E6  3129 		MSCP$M_UF_VSMSU!-	;  and variable speed suppression mode
                                     12E6  3130 		MSCP$M_UF_WBKNV!-	;  and write back caching enabled
                                     12E6  3131 		MSCP$M_UF_WRTPD!-	;  and data safety write protect
                                     12E6  3132     		MSCP$M_UF_WRTPH>,-	;  and software write protect
               16 A4   3160 8F       12E6  3133 		UQB$W_UNIT_FLAGS(R4)	;  flags
                                     12EB  3134 
                                     12EB  3135 80$:
                    52   18 A3   D0  12EB  3136 	MOVL	HRB$L_MSGBUF(R3),R2	; Make sure the packet address is there
                            1A   13  12EF  3137 	BEQL	90$			; This must be a call from TMSCP$VC_ERR
                    55   1C A3   D0  12F1  3138 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Restore CDRP/IRP
                    50   38 A5   D0  12F5  3139 	MOVL	IRP$L_IOST1(R5),R0	; Restore the IOSB
                         05 50   E9  12F9  3140 	BLBC	R0,85$			; If the I/O was successful, cont..
                       50   00   D0  12FC  3141 	MOVL	#MSCP$K_ST_SUCC,R0	; Set success status
                            03   11  12FF  3142 	BRB	87$			;  and send the end packet
                                     1301  3143 
                                     1301  3144 85$:
                          0B4B   30  1301  3145 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.	
                                     1304  3146 
                                     1304  3147 87$:
                    52   18 A3   D0  1304  3148 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore end packet
                          0D2F   31  1308  3149 	BRW	TMSCP$SEND_END		; Return the status back to the client
                                     130B  3150 
                                     130B  3151 ;
                                     130B  3152 ; A zero for a message buffer address in the HRB is an indication that this 
                                     130B  3153 ; routine was called as part of the cleanup effort after a VC error. Since
                                     130B  3154 ; there is no longer a circuit over which to send out an end message, just 
                                     130B  3155 ; cleanup the request without returning any status.
                                     130B  3156 ;
                                     130B  3157 
                                     130B  3158 90$:
                       0040 8F   AA  130B  3159 	BICW	#HRB$M_VCFAILED,-	; Clear this flag when we return so
                         16 A3       130F  3160 		HRB$W_FLAGS(R3)		;  the HRB will be cleaned up
                          0A14   31  1311  3161 	BRW	TMSCP$CLEANUP_HRB	; Free resources used by this request.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  70
X-17                            - ONLINE     (- 9 -)                     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (27)

                                     1314  3164 	.SBTTL	-	ONLINE					(- 9 -)
                                     1314  3165 
                                     1314  3166 ;+
                                     1314  3167 ; Functional Description:
                                     1314  3168 ;
                                     1314  3169 ; The ONLINE command is used to bring a tape unit into the "Unit-Online" state,
                                     1314  3170 ; set host settable unit characteristics, and obtain those unit characteristics
                                     1314  3171 ; that are essential for proper class driver operation.
                                     1314  3172 ;
                                     1314  3173 ; Inputs:
                                     1314  3174 ;
                                     1314  3175 ;	R0  =  Scratch
                                     1314  3176 ;	R1  =  Scratch
                                     1314  3177 ;	R2  =  MSCP packet address
                                     1314  3178 ;	R3  =  HRB address
                                     1314  3179 ;	R4  =  UQB address, scratch
                                     1314  3180 ;	R5  =  Scratch
                                     1314  3181 ;
                                     1314  3182 ; Outputs:
                                     1314  3183 ;
                                     1314  3184 ;	R0  =  Completion status
                                     1314  3185 ;	R2  =  MSCP packet address
                                     1314  3186 ;	R3  =  HRB address
                                     1314  3187 ;- 
                                     1314  3188 
                                     1314  3189 TMSCP$ONLINE::
                                     1314  3190 	.IF DEFINED DEBUG$PC_HISTORY
                                     1314  3191 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1314  3192 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1314  3193 
                                     1314  3194 ;
                                     1314  3195 ; If the unit is already online to this host, then the same unit
                                     1314  3196 ; flags must be specified.
                                     1314  3197 ;
                                     1314  3198 
                                     1314  3199 WRITABLE_UNIT_FLAGS =	MSCP$M_UF_CMPRD ! -	;  compare reads 
                                     1314  3200 			MSCP$M_UF_CMPWR ! -	;  compare writes
                                     1314  3201 			MSCP$M_UF_VSMSU ! -	;  variable speed mode suppression
                                     1314  3202 			MSCP$M_UF_SCCHH ! -	;  supress high speed caching
                                     1314  3203 			MSCP$M_UF_WBKNV ! -	;  write back caching enabled
                           00001863  1314  3204 			MSCP$M_UF_WRTPS		;  software write protect
                                     1314  3205 
                         70 A4   D5  1314  3206 	TSTL	UQB$L_ONLINE_HQB(R4) 	; Pointer to online host	
                            21   13  1317  3207 	BEQL	5$			; If not online to anyone, ok - branch.
                         54 A3   D1  1319  3208 	CMPL	HRB$L_HQB(R3),-		; Were we already online to
                         70 A4       131C  3209 		UQB$L_ONLINE_HQB(R4) 	;  the remote host
                            1A   12  131E  3210 	BNEQ	5$			; Different host - branch.
          50   0E A2   E79C 8F   AB  1320  3211 	BICW3	#^C WRITABLE_UNIT_FLAGS, -	; Verify that the same unit flags 
                                     1327  3212 		MSCP$W_UNT_FLGS(R2), R0		; were specified.
          51   16 A4   E79C 8F   AB  1327  3213 	BICW3	#^C WRITABLE_UNIT_FLAGS, -
                                     132E  3214 		UQB$W_UNIT_FLAGS(R4), R1
                       51   50   B1  132E  3215 	CMPW	R0, R1			; Compare the MSCP flags to the UQB flags
                            07   13  1331  3216 	BEQL	5$			; Same unit flags specified - branch.
                  50   0E   18   9C  1333  3217 	ROTL	#24,#MSCP$W_UNT_FLGS,R0	; Identify the bad field
                          0DC2   31  1337  3218 	BRW	TMSCP$PACKET_ERROR	; Return an end msg with error status
                                     133A  3219 
                                     133A  3220 5$:
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  71
X-17                            - ONLINE     (- 9 -)                     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (27)

                    54   24 A4   D0  133A  3221 	MOVL	UQB$L_UCB(R4),R4	; Get UCB address from UQB
                            05   E1  133E  3222 	BBC	#DEV$V_MSCP,-		; If this is a MSCP device,
                      2F 40 A4       1340  3223 		UCB$L_DEVCHAR2(R4),30$	;  and there are already requests
                         6A A4   B5  1343  3224 	TSTW	UCB$W_RWAITCNT(R4)	;  waiting, this might be a trap!
                            06   13  1346  3225 	BEQL	20$			;  Instead of falling in,
                                     1348  3226 
                                     1348  3227 10$:
                       50   03   D0  1348  3228 	MOVL	#MSCP$K_ST_OFFLN,R0	;  Return a status of offline and let
                          0CEC   31  134B  3229 	BRW	TMSCP$SEND_END		;  the client find another path
                                     134E  3230 
                                     134E  3231 ;
                                     134E  3232 ; A PACKACK is sent to the local class driver to determine if the device is 
                                     134E  3233 ; reachable. If a success is returned, the device is accessible. Any error
                                     134E  3234 ; returns causes a status of offline to return.
                                     134E  3235 ;
                                     134E  3236 
                                     134E  3237 20$:
                    55   1C A3   D0  134E  3238 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Make sure we have the IRP address
                    1C A5   54   D0  1352  3239 	MOVL	R4,IRP$L_UCB(R5)	; Save the UCB address
                    14 A5   53   D0  1356  3240 	MOVL	R3,IRP$L_HRB(R5)	; Save the HRB address
                            08   B0  135A  3241 	MOVW	#IO$_PACKACK,-		; Set up the function code,
                         20 A5       135C  3242 		IRP$W_FUNC(R5)		;  to do the mount verification
                          FE8C   30  135E  3243 	BSBW	TMSCP$SET_CLEAR_SEX	; Set clear serious exception
                          FEDE   30  1361  3244 	BSBW	TMSCP$SET_CLEAR_CDL	; Set clear cached data lost
                    54   58 A3   D0  1364  3245 	MOVL	HRB$L_UQB(R3),R4	; Restore UQB for seq. synch.
                                     1368  3246 
                                     1368  3247 ;
                                     1368  3248 ;	R0  =  Scratch
                                     1368  3249 ;	R1  =  Scratch
                                     1368  3250 ;	R2  =  Scratch
                                     1368  3251 ;	R3  =  HRB address
                                     1368  3252 ;	R4  =  UQB address
                                     1368  3253 ;	R5  =  Scratch
                                     1368  3254 ;
                                     1368  3255 
                          07D6   30  1368  3256 	BSBW	TMSCP$DRIVE_CHECK	; Call a subroutine to do the I/O
                                     136B  3257 
                                     136B  3258 ;
                                     136B  3259 ; Control returns here from entry point TMSCP$BACK. 
                                     136B  3260 ;
                                     136B  3261 ;	R0  =  I/O status block, scratch
                                     136B  3262 ;	R1  =  Scratch
                                     136B  3263 ;	R2  =  Scratch
                                     136B  3264 ;	R3  =  HRB address
                                     136B  3265 ;	R4  =  UQB address
                                     136B  3266 ;	R5  =  IRP address
                                     136B  3267 ;
                                     136B  3268 
                    52   18 A3   D0  136B  3269 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                         1A 50   E8  136F  3270 	BLBS	R0,80$			; If the I/O was successful cont...
                                     1372  3271 
                                     1372  3272 30$:
                    54   58 A3   D0  1372  3273 	MOVL	HRB$L_UQB(R3),R4	; Get the UQB so that 
                    54   24 A4   D0  1376  3274 	MOVL	UQB$L_UCB(R4),R4	;  we can restore the UCB
                            04   E1  137A  3275 	BBC	#UCB$V_ONLINE,-		; If device is online locally
                      08 78 A4       137C  3276 		UCB$L_STS(R4), 40$	;  then the device cannot be shared
                  50   0203 8F   3C  137F  3277 	MOVZWL	#<MSCP$K_SC_EXUSE@ -	; Return offline with exclusive use
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  72
X-17                            - ONLINE     (- 9 -)                     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (27)

                                     1384  3278 		MSCP$V_ST_SBCOD! -	;
                                     1384  3279 		MSCP$K_ST_OFFLN>,R0	;
                          0CB3   31  1384  3280 	BRW	TMSCP$SEND_END		;  set the MSCP status and return
                                     1387  3281 
                                     1387  3282 40$:
                            12   E0  1387  3283 	BBS	#DEV$V_AVL,-		; If the device is offline, set status and
                      BC 3C A4       1389  3284 		UCB$L_DEVCHAR(R4), 10$	;  return MSCP end packet.
                                     138C  3285 
                                     138C  3286 ;
                                     138C  3287 ; Either a PACKACK to a TMSCP tape was successful or for non-TMSCP tapes, the
                                     138C  3288 ; unit was found to be available, which means the tape is accessible. Make sure
                                     138C  3289 ; all the status codes are set properly to reflect an "online" status and
                                     138C  3290 ; then return the device characteristics in the online end message.
                                     138C  3291 ; 
                                     138C  3292 
                                     138C  3293 80$:
                    52   18 A3   D0  138C  3294 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                    54   58 A3   D0  1390  3295 	MOVL	HRB$L_UQB(R3),R4	; Restore the UQB address
                            02   B0  1394  3296 	MOVW	#UQB$K_ST_ONLINE,-	; Update the state field
                         0C A4       1396  3297 		UQB$W_STATE(R4)		;  in the UQB
                       50   00   D0  1398  3298 	MOVL	#MSCP$K_ST_SUCC,R0	; Assume a successful status
                         70 A4   D5  139B  3299 	TSTL	UQB$L_ONLINE_HQB(R4) 	; Pointer to online host	
                            0B   13  139E  3300 	BEQL	90$			; If not online to anyone, ok
                         54 A3   D1  13A0  3301 	CMPL	HRB$L_HQB(R3),-		; Were we already online to
                         70 A4       13A3  3302 		UQB$L_ONLINE_HQB(R4) 	;  the remote host
                            13   13  13A5  3303 	BEQL	100$
                                     13A7  3304 
                                     13A7  3305 ;
                                     13A7  3306 ; Remove this check before shipping.
                                     13A7  3307 ;
                                     13A7  3308 
                                     13A7  3309 	BUG_CHECK TMSCPSERV,FATAL	; The assign system service should
                               FEFF  13A7       		.WORD	^XFEFF
                               0004' 13A9       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_TMSCPSERV!4
                                     13AB  3310 					;  have guaranteed that we would
                                     13AB  3311 					;  not have gotten this far.
                                     13AB  3312 
                                     13AB  3313 90$:
                    51   24 A4   D0  13AB  3314 	MOVL	UQB$L_UCB(R4),R1	; Get the address of the UCB
                         54 A3   D0  13AF  3315 	MOVL	HRB$L_HQB(R3),-		; Get the HQB address
                         70 A4       13B2  3316 		UQB$L_ONLINE_HQB(R4) 	; Pointer to online host	
                       00C2 C1   96  13B4  3317 	INCB	UCB$B_ONLCNT(R1)	; Bump the online counter
                            08   11  13B8  3318 	BRB	TMSCP$SET_UNIT_CHAR	; Update the device characteristics.
                                     13BA  3319 	
                                     13BA  3320 100$:
                  50   0100 8F   3C  13BA  3321 	MOVZWL	#<MSCP$K_SC_ALONL@ -	; Set the subcode indicating the unit
                                     13BF  3322 		MSCP$V_ST_SBCOD! -	;  was "already online"
                                     13BF  3323 		MSCP$K_ST_SUCC>,R0	;  and a status code of success
                          00BA   31  13BF  3324 	BRW	TMSCP$RECORD_COMMON	;  and finish off the request
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  73
X-17                            - SET UNIT CHARACTERISTICS  (- 10 -)     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (28)

                                     13C2  3327 	.SBTTL	-	SET UNIT CHARACTERISTICS		(- 10 -)
                                     13C2  3328 
                                     13C2  3329 ;+
                                     13C2  3330 ; Functional Description:
                                     13C2  3331 ;
                                     13C2  3332 ; This command is used to control host settable unit characteristics and obtain
                                     13C2  3333 ; those characteristics that are necessary for proper class driver operation.
                                     13C2  3334 ;
                                     13C2  3335 ; Inputs:
                                     13C2  3336 ; 
                                     13C2  3337 ;	R0  =  Scratch
                                     13C2  3338 ;	R1  =  Scratch
                                     13C2  3339 ;	R2  =  MSCP packet address
                                     13C2  3340 ;	R3  =  HRB address
                                     13C2  3341 ;	R4  =  UQB address, scratch
                                     13C2  3342 ;	R5  =  Scratch
                                     13C2  3343 ;
                                     13C2  3344 ; Outputs:
                                     13C2  3345 ;
                                     13C2  3346 ;	R0  =  Completion status
                                     13C2  3347 ;	R2  =  MSCP packet address
                                     13C2  3348 ;	R3  =  HRB address
                                     13C2  3349 ;-
                                     13C2  3350 
                                     13C2  3351 TMSCP$SET_UNIT_CHAR::
                                     13C2  3352 	.IF DEFINED DEBUG$PC_HISTORY
                                     13C2  3353 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     13C2  3354 	.ENDC	   ;DEBUG$PC_HISTORY
                                     13C2  3355 
                                     13C2  3356 ;
                                     13C2  3357 ; Is unit online to the requestor?
                                     13C2  3358 ;
                                     13C2  3359 	
                         70 A4   D1  13C2  3360 	CMPL	UQB$L_ONLINE_HQB(R4),-	; Is the host that has this unit
                         54 A3       13C5  3361 		HRB$L_HQB(R3)		;  online the same as the requesting host?
                            06   13  13C7  3362 	BEQL	10$			; If online, continue...
                       50   03   D0  13C9  3363 	MOVL	#MSCP$K_ST_OFFLN,R0	; Otherwise this is an invalid command
                          0C6B   31  13CC  3364 	BRW	TMSCP$SEND_END
                                     13CF  3365 
                                     13CF  3366 ;
                                     13CF  3367 ; Unit ONLINE to this host - Check to see if write protect enabled.
                                     13CF  3368 ;
                                     13CF  3369 
                                     13CF  3370 10$:
                            02   E0  13CF  3371 	BBS 	#MSCP$V_MD_STWRP,-	; Check "enable set write protect"
                      06 0A A2       13D1  3372 		MSCP$W_MODIFIER(R2),15$	;  if it's set continue...
                       1000 8F   AA  13D4  3373 	BICW	#MSCP$M_UF_WRTPS,-	; If the set write protection bit
                         0E A2       13D8  3374 		MSCP$W_UNT_FLGS(R2)	;  was set, write protect is host settable
                                     13DA  3375 ;
                                     13DA  3376 ; Check all user specified device characteristics stored in 
                                     13DA  3377 ; MSCP$W_UNT_FLGS. Set them in the CDRP$L_MEDIA field.
                                     13DA  3378 ;
                                     13DA  3379 
                                     13DA  3380 15$:
                    51   24 A4   D0  13DA  3381 	MOVL	UQB$L_UCB(R4),R1	; Get the UCB address
                    55   1C A3   D0  13DE  3382 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the IRP address.
                                     13E2  3383 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  74
X-17                            - SET UNIT CHARACTERISTICS  (- 10 -)     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (28)

                                     13E2  3384 	ASSUME	UCB$L_DEVDEPND2 EQ 4+UCB$L_DEVDEPEND
                                     13E2  3385 
                    32 A5   08   B0  13E2  3386 	MOVW	# 8, IRP$W_BCNT(R5)	; Set the characteristics length.
                            05   E1  13E6  3387 	BBC	#DEV$V_MSCP,-		; Not a TMSCP type device - branch.
                      04 40 A1       13E8  3388 		UCB$L_DEVCHAR2(R1), 17$
                    32 A5   0C   B0  13EB  3389 	MOVW	# 12, IRP$W_BCNT(R5)	; Specify extended device characteristics.
                                     13EF  3390 
                                     13EF  3391 17$:
               16 A4   0840 8F   AA  13EF  3392 	BICW	# MSCP$M_UF_WBKNV ! -	; Disable write-back cache for this unit.
                                     13F5  3393 		  MSCP$M_UF_SCCHH, -	; Enable read-ahead caching for this unit.
                                     13F5  3394 		UQB$W_UNIT_FLAGS(R4)
                            06   E1  13F5  3395 	BBC	#MSCP$V_UF_WBKNV,-	; Write-back caching should be 
                      0E 0E A2       13F7  3396 		MSCP$W_UNT_FLGS(R2),20$ ;  disabled - branch.
                       0040 8F   A8  13FA  3397 	BISW	#MSCP$M_UF_WBKNV,-	; Write-back caching enabled for this unit.
                         16 A4       13FE  3398 		UQB$W_UNIT_FLAGS(R4)
                   00010000 8F   C8  1400  3399 	BISL	#MT2$M_WBC_ENABLE,-	; Request write-back caching.
                         40 A5       1406  3400 		IRP$L_MEDIA+8(R5)
                                     1408  3401 
                                     1408  3402 ;
                                     1408  3403 ;		Kludge alert:  The buffer size, device class and device type
                                     1408  3404 ;		are passed using one of the reserved fields in the TMSCP message.
                                     1408  3405 ;		The location of this field must match the location used by the 
                                     1408  3406 ;		TUDRIVER in the routine SETMODE_BEGIN_IVCMD.
                                     1408  3407 ;
                                     1408  3408 
                                     1408  3409 20$:
                         10 A2   D0  1408  3410 	MOVL	MSCP$W_UNT_FLGS+2(R2),-	; Restore buffer size, class and type
                         38 A5       140B  3411 		IRP$L_MEDIA(R5)		;
                            0B   E1  140D  3412 	BBC	#MSCP$V_UF_SCCHH,-	; Read-ahead caching should be enabled for
                         0E A2       140F  3413 		MSCP$W_UNT_FLGS(R2),-	;  this unit - branch.
                            0E       1411  3414 		30$
                       0800 8F   A8  1412  3415 	BISW	#MSCP$M_UF_SCCHH,-	; Disable read-ahead caching for this unit.
                         16 A4       1416  3416 		UQB$W_UNIT_FLAGS(R4)
                   00020000 8F   C8  1418  3417 	BISL	#MT2$M_RDC_DISABLE,-	; Request read-ahead caching be disabled.
                         40 A5       141E  3418 		IRP$L_MEDIA+8(R5)
                                     1420  3419 
                                     1420  3420 30$:
                         1C A2   D0  1420  3421 	MOVL	MSCP$L_DEV_PARM(R2),-	; Set up device dependent
                       0100 C1       1423  3422 		UCB$L_MSCPDEVPARAM(R1)	;  in the local UCB
                                     1426  3423 
                                     1426  3424 ;
                                     1426  3425 ;		Convert the MSCP tape FORMAT to the VMS tape format.
                                     1426  3426 ;
                                     1426  3427 
                       7E   50   7D  1426  3428 	MOVQ	R0, -(SP)		; Save the required registers.
                    51   20 A2   3C  1429  3429 	MOVZWL	MSCP$W_FORMAT(R2), R1	; Get the MSCP format value.
                          0DC7   30  142D  3430 	BSBW	TMSCP$MSCPTOVMS_DENS	; Convert to the VMS density value.
          3C A5   05   08   50   F0  1430  3431 	INSV	R0, # MT$V_DENSITY, -	; Set the VMS tape density.
                                     1436  3432 		# MT$S_DENSITY, -
                                     1436  3433 		IRP$L_MEDIA+4(R5)
                                     1436  3434 	.IF DEFINED DEBUG$PC_HISTORY
                                     1436  3435 	BSBW	TMSCP$R0HIST		; Save the density value.
                                     1436  3436 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1436  3437 
                                     1436  3438 
                                     1436  3439 ;
                                     1436  3440 ;		Convert the MSCP tape SPEED to the VMS tape speed.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  75
X-17                            - SET UNIT CHARACTERISTICS  (- 10 -)     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (28)

                                     1436  3441 ;
                                     1436  3442 
                    51   20 A2   3C  1436  3443 	MOVZWL	MSCP$W_FORMAT(R2), R1	; Get the MSCP format value.
                    50   22 A2   3C  143A  3444 	MOVZWL	MSCP$W_SPEED(R2), R0	; Get the MSCP speed value.
                          0E20   30  143E  3445 	BSBW	TMSCP$MSCPTOSPEED	; Convert to the VMS speed value.
          3C A5   08   18   50   F0  1441  3446 	INSV	R0, # MT$V_SPEED, -	; Set the VMS tape speed.
                                     1447  3447 		# MT$S_SPEED, -
                                     1447  3448 		IRP$L_MEDIA+4(R5)
                                     1447  3449 	.IF DEFINED DEBUG$PC_HISTORY
                                     1447  3450 	BSBW	TMSCP$R0HIST		; Save the speed value.
                                     1447  3451 	.ENDC	   ;DEBUG$PC_HISTORY
                       50   8E   7D  1447  3452 	MOVQ	(SP)+, R0		; Restore the registers.
                                     144A  3453 
                                     144A  3454 ;
                                     144A  3455 ; Issue an IO$_SETMODE to the local driver.
                                     144A  3456 ;
                                     144A  3457 
                    18 A3   52   D0  144A  3458 	MOVL	R2,HRB$L_MSGBUF(R3)	; Restore packet address
                    1C A5   51   D0  144E  3459 	MOVL	R1,IRP$L_UCB(R5)	; Save the UCB address
                            23   B0  1452  3460 	MOVW	#IO$_SETMODE,-		; Set up the function code,
                         20 A5       1454  3461 		IRP$W_FUNC(R5)		;  to do the mount verification
                          FD94   30  1456  3462 	BSBW	TMSCP$SET_CLEAR_SEX	; Set clear serious exception
                          FDE6   30  1459  3463 	BSBW	TMSCP$SET_CLEAR_CDL	; Set clear cached data lost
                    14 A5   53   D0  145C  3464 	MOVL	R3,IRP$L_HRB(R5)	; Save HRB for I/O completion
                                     1460  3465 
                                     1460  3466 ;
                                     1460  3467 ;	R0  =  Scratch
                                     1460  3468 ;	R1  =  Scratch
                                     1460  3469 ;	R2  =  Scratch
                                     1460  3470 ;	R3  =  HRB address
                                     1460  3471 ;	R4  =  UQB address
                                     1460  3472 ;	R5  =  Scratch
                                     1460  3473 ;
                                     1460  3474 
                          06DE   30  1460  3475 	BSBW	TMSCP$DRIVE_CHECK	; Call a subroutine to do the I/O
                                     1463  3476 
                                     1463  3477 ;
                                     1463  3478 ; Control returns here from entry point TMSCP$BACK. 
                                     1463  3479 ;
                                     1463  3480 ;	R0  =  I/O status block, scratch
                                     1463  3481 ;	R1  =  Scratch
                                     1463  3482 ;	R2  =  Scratch
                                     1463  3483 ;	R3  =  HRB address
                                     1463  3484 ;	R4  =  UQB address
                                     1463  3485 ;	R5  =  IRP address
                                     1463  3486 ;
                                     1463  3487 
                         03 50   E8  1463  3488 	BLBS	R0,40$			; If the transfer was successful, cont...
                          09E6   30  1466  3489 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.
                                     1469  3490 
                                     1469  3491 40$:
                    55   1C A3   D0  1469  3492 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Restore IRP address
                    52   18 A3   D0  146D  3493 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore packet address
                    54   58 A3   D0  1471  3494 	MOVL	HRB$L_UQB(R3),R4	; Get the UQB to as to
                    51   24 A4   D0  1475  3495 	MOVL	UQB$L_UCB(R4),R1	;  get the UCB
                       50   00   D0  1479  3496 	MOVL	#MSCP$K_ST_SUCC,R0	; Return success status.
                                     147C  3497 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  76
X-17                            - SET UNIT CHARACTERISTICS  (- 10 -)     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (28)

                                     147C  3498 ;
                                     147C  3499 ; The IO$_SETMODE will cause the local driver to update several fields in
                                     147C  3500 ; the UCB. These fields will be returned to the remote host in the MSCP
                                     147C  3501 ; end packet.
                                     147C  3502 ;
                                     147C  3503 ;	R0  =  MSCP status value
                                     147C  3504 ;	R1  =  UCB address
                                     147C  3505 ;	R2  =  MSCP packet
                                     147C  3506 ;	R3  =  HRB address
                                     147C  3507 ;	R4  =  UQB address
                                     147C  3508 ;	R5  =  Scratch
                                     147C  3509 ;
                                     147C  3510 
                                     147C  3511 TMSCP$RECORD_COMMON::
                                     147C  3512 	.IF	DEFINED DEBUG$PC_HISTORY
                                     147C  3513 	BSBW	TMSCP$PCHIST_R3		; Log the PC for debugging.
                                     147C  3514 	.ENDC  ;DEBUG$PC_HISTORY
                                     147C  3515 
                                     147C  3516 ;
                                     147C  3517 ;		Update the fields kept on the local host.
                                     147C  3518 ;
                                     147C  3519 
                         18 A4   7D  147C  3520 	MOVQ	UQB$Q_UNIT_ID(R4),-	;  returning a unit identifier
                         14 A2       147F  3521 		MSCP$Q_UNIT_ID(R2)	;  in the end packet also.
                                     1481  3522 ;;;
                                     1481  3523 ;
                                     1481  3524 ; The contents of the UQB copy of the unit flags could be stale. To
                                     1481  3525 ; assure the correct bits are passed back, update the UQB UNIT FLAGS
                                     1481  3526 ; before copying it into the mscp packet.
                                     1481  3527 ;
                       00FA C1   B0  1481  3528 	MOVW	UCB$W_UNIT_FLAGS(R1),-	; Get the device unit_flags
                         16 A4       1485  3529 		UQB$W_UNIT_FLAGS(R4)
                                     1487  3530 ;;;
                         16 A4   B0  1487  3531 	MOVW	UQB$W_UNIT_FLAGS(R4),-	; Put the set unit flags in the
                         0E A2       148A  3532 		MSCP$W_UNT_FLGS(R2)	;  end packet to return
                         14 A4   B0  148C  3533 	MOVW	UQB$W_MULT_UNIT(R4),-	;  Update the multi-unit flags
                         0C A2       148F  3534 		MSCP$W_MULT_UNT(R2)	;  in the end packet.
                                     1491  3535 
                                     1491  3536 ;
                                     1491  3537 ;		Get the fields from the local UCB.
                                     1491  3538 ;
                                     1491  3539 
                       00A0 C1   D0  1491  3540 	MOVL	UCB$L_MEDIA_ID(R1),-	; Get the media identifier from
                         1C A2       1495  3541 		MSCP$L_MEDIA_ID(R2)	;  the unit control block
                                     1497  3542 
                                     1497  3543 	GET_TAPE_FORMAT		R1
                    40 A1   05   E1  1497       	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                            08       149B       		UCB$L_DEVCHAR2(R1), 30063$	; Not MSCP tape - branch.
               20 A2   0124 C1   B0  149C       	MOVW	UCB$W_TU_FORMAT(R1), -	; Steal tape format from UCB.
                            15   11  14A2       	BRB	30064$
                                     14A4       30063$:
                       7E   50   7D  14A4       	MOVQ	R0, -(SP)
                       05   08   EF  14A7       	EXTZV	# MT$V_DENSITY, -		; Extract VMS density from the UCB.
                         50 A1       14AA       		# MT$S_DENSITY, -
                            50       14AC       		UCB$L_DEVDEPEND(R1), R0
                            51   D4  14AD       	CLRL	R1				; Use default VMS density table.
                          0D16   30  14AF       	BSBW	TMSCP$VMSTOMSCP_DENS		; Convert tape density value.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  77
X-17                            - SET UNIT CHARACTERISTICS  (- 10 -)     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (28)

                    20 A2   51   B0  14B2       	MOVW	R1, MSCP$W_FORMAT(R2)		; Return the tape format.
                       50   8E   7D  14B6       	MOVQ	(SP)+, R0
                                     14B9       30064$:
                                     14B9  3544 	GET_TAPE_MAXWRCNT	R1, R5	; Maximum write record size.
                    40 A1   05   E1  14B9       	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                            08       14BD       		UCB$L_DEVCHAR2(R1), 30065$	; Not MSCP tape - branch.
               24 A2   0120 C1   D0  14BE       	MOVL	UCB$L_TU_MAXWRCNT(R1), -	; Steal tape maxwrcnt from UCB.
                            09   11  14C4       	BRB	30066$
                                     14C6       30065$:
                  55   FFFF 8F   3C  14C6       	MOVZWL	#^XFFFF, R5			; Supply the default tape maxwrcnt.
                    24 A2   55   D0  14CB       	MOVL	R5, MSCP$L_MAXWTREC(R2)	; Return the tape maxwrcnt.
                                     14CF       30066$:
                                     14CF  3545 	GET_TAPE_NOISE		R1, R5	; Size of noise records.
                    40 A1   05   E1  14CF       	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                            08       14D3       		UCB$L_DEVCHAR2(R1), 30067$	; Not MSCP tape - branch.
               28 A2   0128 C1   B0  14D4       	MOVW	UCB$W_TU_NOISE(R1), -	; Steal tape noise from UCB.
                            06   11  14DA       	BRB	30068$
                                     14DC       30067$:
                            55   D4  14DC       	CLRL	R5				; Supply the default tape noise.
                    28 A2   55   B0  14DE       	MOVW	R5, MSCP$W_NOISEREC(R2)	; Return the tape noise.
                                     14E2       30068$:
                                     14E2  3546 	GET_TAPE_SPEED		R1, -
                                     14E2  3547 				MSCP$W_FORMAT(R2)
                    40 A1   05   E1  14E2       	BBC	# DEV$V_MSCP, -			; Check for a MSCP tape device.
                            08       14E6       		UCB$L_DEVCHAR2(R1), 30069$	; Not MSCP tape - branch.
               22 A2   0126 C1   B0  14E7       	MOVW	UCB$W_TU_SPEED(R1), -	; Steal tape speed from UCB.
                            17   11  14ED       	BRB	30070$
                                     14EF       30069$:
                       7E   50   7D  14EF       	MOVQ	R0, -(SP)
                    51   20 A2   3C  14F2       	MOVZWL	MSCP$W_FORMAT(R2), R1			; Get the MSCP tape format.
                       08   18   EF  14F6       	EXTZV	# MT$V_SPEED, -			; Extract VMS tape speed from R1
                         50 A1       14F9       		# MT$S_SPEED, -			; and return as the tape speed.
                            50       14FB       		UCB$L_DEVDEPEND(R1), R0
                          0D3A   30  14FC       	BSBW	TMSCP$SPEEDTOMSCP		; Convert speed value.
                    22 A2   50   B0  14FF       	MOVW	R0, MSCP$W_SPEED(R2)		; Return the tape speed.
                       50   8E   7D  1503       	MOVQ	(SP)+, R0
                                     1506       30070$:
                                     1506  3548 
                          0B31   31  1506  3549 	BRW	TMSCP$SEND_END		; Send it all back as an end message
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  78
X-17                            - DETERMINE ACCESS PATHS   (- 11 -)      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (29)

                                     1509  3552 	.SBTTL	-	DETERMINE ACCESS PATHS			(- 11 -)
                                     1509  3553 
                                     1509  3554 ;+
                                     1509  3555 ; Functional Description:
                                     1509  3556 ;
                                     1509  3557 ; The DETERMINE ACCESS PATHS command is used by class drivers to determine
                                     1509  3558 ; the topology of multi-access drive configurations. When sent to a unit
                                     1509  3559 ; that is "Unit-Online", it causes that unit and any other units that share
                                     1509  3560 ; the same access path to identify themselves to any other controllers to 
                                     1509  3561 ; which they are connected. For the Host Based TMSCP Server, this command
                                     1509  3562 ; is treated as a no-op that always returns success, since units cannot be 
                                     1509  3563 ; connected to more than one controller (Host Based MSCP Server).
                                     1509  3564 ;
                                     1509  3565 ; Inputs:
                                     1509  3566 ; 
                                     1509  3567 ;	R0  =  Scratch
                                     1509  3568 ;	R1  =  Scratch
                                     1509  3569 ;	R2  =  MSCP packet address
                                     1509  3570 ;	R3  =  HRB address
                                     1509  3571 ;	R4  =  UQB address, scratch
                                     1509  3572 ;	R5  =  Scratch
                                     1509  3573 ;
                                     1509  3574 ; Outputs:
                                     1509  3575 ;
                                     1509  3576 ;	R0  =  Completion status
                                     1509  3577 ;	R2  =  MSCP packet address
                                     1509  3578 ;	R3  =  HRB address
                                     1509  3579 ;	R4  =  UQB address
                                     1509  3580 ;-
                                     1509  3581 
                                     1509  3582 TMSCP$DET_ACC_PATH::
                                     1509  3583 	.IF DEFINED DEBUG$PC_HISTORY
                                     1509  3584 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1509  3585 	.ENDC	   ;DEBUG$PC_HISTORY
                       50   00   D0  1509  3586 	MOVL	#MSCP$K_ST_SUCC,R0	; Set a successful status code
                          0B2B   31  150C  3587 	BRW	TMSCP$SEND_END		;  and return the end packet
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  79
X-17                            - ACCESS     (- 16 -)                    16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (30)

                                     150F  3590 	.SBTTL	-	ACCESS					(- 16 -)
                                     150F  3591 
                                     150F  3592 ;+
                                     150F  3593 ; Functional Description:
                                     150F  3594 ;
                                     150F  3595 ; Data is read from the unit, checked for errors, and discarded. The
                                     150F  3596 ; purpose of this command is to verify that the designated data can be
                                     150F  3597 ; accessed (read) without error. 
                                     150F  3598 ;
                                     150F  3599 ; Inputs:
                                     150F  3600 ;
                                     150F  3601 ;	R0  =  Scratch
                                     150F  3602 ;	R1  =  Scratch
                                     150F  3603 ;	R2  =  MSCP packet address
                                     150F  3604 ;	R3  =  HRB address
                                     150F  3605 ;	R4  =  UQB address, scratch
                                     150F  3606 ;	R5  =  Scratch
                                     150F  3607 ;
                                     150F  3608 ; Outputs:
                                     150F  3609 ;
                                     150F  3610 ;	R0  =  The high byte contains the offset (within the MSCP packet)
                                     150F  3611 ;		of the field in which the error was found.
                                     150F  3612 ;	R2  =  MSCP packet address
                                     150F  3613 ;	R3  =  HRB address
                                     150F  3614 ;-
                                     150F  3615 
                                     150F  3616 TMSCP$ACCESS::
                                     150F  3617 	.IF DEFINED DEBUG$PC_HISTORY
                                     150F  3618 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     150F  3619 	.ENDC	   ;DEBUG$PC_HISTORY
                  50   08   18   9C  150F  3620 	ROTL	#24,#MSCP$B_OPCODE,R0	; This command is not supported 
                          0BE6   31  1513  3621 	BRW	TMSCP$PACKET_ERROR	;  by the host based tape server
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  80
X-17                            - COMPARE HOST DATA   (- 32 -)           16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (31)

                                     1516  3624 	.SBTTL	-	COMPARE HOST DATA			(- 32 -)
                                     1516  3625 
                                     1516  3626 ;+
                                     1516  3627 ; Functional Description:
                                     1516  3628 ;
                                     1516  3629 ; Data is read from the requesting cluster member and compared to the data
                                     1516  3630 ; on the specified tape. A compare error is reported unless the data is 
                                     1516  3631 ; identical. Note that the occurance of any other error, except a forced
                                     1516  3632 ; error, at the same point as the compare error overrrides the compare 
                                     1516  3633 ; error.
                                     1516  3634 ; 
                                     1516  3635 ; This command provides a write function. The write routine can be used if
                                     1516  3636 ; we just skip over the check for writelock and use a different function code.
                                     1516  3637 ;
                                     1516  3638 ; Inputs:
                                     1516  3639 ;
                                     1516  3640 ;	R0  =  Scratch
                                     1516  3641 ;	R1  =  Scratch
                                     1516  3642 ;	R2  =  MSCP packet address
                                     1516  3643 ;	R3  =  HRB address
                                     1516  3644 ;	R4  =  UQB address, scratch
                                     1516  3645 ;	R5  =  Scratch
                                     1516  3646 ;
                                     1516  3647 ; Outputs:
                                     1516  3648 ;
                                     1516  3649 ;	R0  =  I/O function code
                                     1516  3650 ;	R2  =  MSCP packet address
                                     1516  3651 ;	R3  =  HRB address
                                     1516  3652 ;-
                                     1516  3653 
                                     1516  3654 TMSCP$COMPARE_HOST_DATA::
                                     1516  3655 	.IF DEFINED DEBUG$PC_HISTORY
                                     1516  3656 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1516  3657 	.ENDC	   ;DEBUG$PC_HISTORY
                       50   0A   3C  1516  3658 	MOVZWL	#IO$_WRITECHECK,R0	; Set the function code to write check
                          0479   31  1519  3659 	BRW	TMSCP$DO_WRT		;  and go do it
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  81
X-17                            - ERASE     (- 18 -)                     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (32)

                                     151C  3662 	.SBTTL	-	ERASE					(- 18 -)
                                     151C  3663 
                                     151C  3664 ;+
                                     151C  3665 ; Functional Description:
                                     151C  3666 ;
                                     151C  3667 ; If the tape is a TMSCP type device, no buffer is mapped, and the request is 
                                     151C  3668 ; sent on to the driver. If however, the tape does not support the erase
                                     151C  3669 ; command, the request is treated very much like a write command referencing
                                     151C  3670 ; a buffer of zeroes out to the end of the tape. The tape is then rewound to
                                     151C  3671 ; BOT.
                                     151C  3672 ;
                                     151C  3673 ; If the device is not MSCP device, WRITEs of (maximum controller byte count)
                                     151C  3674 ; are issued to the local driver until SS$_ENDOFTAPE is reached. Since non-TMSCP
                                     151C  3675 ; drivers can not issue immediate completion WRITE commands, we have to wait
                                     151C  3676 ; for every I/O to return, even if the user specified IO$M_NOWAIT. However, during
                                     151C  3677 ; the IO$_REWIND, all drivers can take advantage of the immediate completion 
                                     151C  3678 ; modifier.
                                     151C  3679 ;
                                     151C  3680 ; Inputs:
                                     151C  3681 ;
                                     151C  3682 ;	R0  =  Scratch
                                     151C  3683 ;	R1  =  Scratch
                                     151C  3684 ;	R2  =  MSCP packet address
                                     151C  3685 ;	R3  =  HRB address
                                     151C  3686 ;	R4  =  UQB address, scratch
                                     151C  3687 ;	R5  =  Scratch
                                     151C  3688 ;
                                     151C  3689 ; Outputs:
                                     151C  3690 ;
                                     151C  3691 ;	R0  =  The high byte contains the offset (within the MSCP packet)
                                     151C  3692 ;		of the field in which the error was found.
                                     151C  3693 ;	R2  =  MSCP packet address
                                     151C  3694 ;	R3  =  HRB address
                                     151C  3695 ;-
                                     151C  3696 
                                     151C  3697 TMSCP$ERASE::
                                     151C  3698 	.IF DEFINED DEBUG$PC_HISTORY
                                     151C  3699 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     151C  3700 	.ENDC	   ;DEBUG$PC_HISTORY
                                 B3  151C  3701 	BITW	#<MSCP$M_UF_WRTPS!-	; If this unit is not software or
                                     151D  3702 		MSCP$M_UF_WRTPD!-	;  data safety write protected or
                                     151D  3703 		MSCP$M_UF_WRTPH>,-	;  hardware write protected,
               16 A4   3100 8F       151D  3704 		UQB$W_UNIT_FLAGS(R4)	;  then
                            0B   13  1522  3705 	BEQL	10$			;  go ahead and allow the write
                            20   A8  1524  3706 	BISW	#UQB$M_ST_SEREX,-	; Set serious exception
                       00C8 C4       1526  3707 		UQB$W_ST_FLAGS(R4)
                       50   06   D0  1529  3708 	MOVL	#MSCP$K_ST_WRTPR,R0	; Otherwise, set an error status
                          0B0B   31  152C  3709 	BRW	TMSCP$SEND_END		;  and return an end message
                                     152F  3710 
                                     152F  3711 10$:
              55   00000000'GF   D0  152F  3712 	MOVL	G^SCS$GL_TMSCP, R5	; Get TSRV structure address.
                         0C A2   D0  1536  3713 	MOVL	MSCP$L_BYTE_CNT(R2),-	; Get the byte count passed
                         38 A3       1539  3714 		HRB$L_OBCNT(R3)		;  and save it as the original byte cnt
                            0A   12  153B  3715 	BNEQ	30$			; If its nonzero then go through with it
                       0568 C5   D6  153D  3716 	INCL	TSRV$L_BLKCOUNT(R5)	; Count the zero block transfer
                       50   00   D0  1541  3717 	MOVL	#MSCP$K_ST_SUCC,R0	; Set a successful status to return
                          0AF3   31  1544  3718 	BRW	TMSCP$SEND_END		;  and we are finished!
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  82
X-17                            - ERASE     (- 18 -)                     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (32)

                                     1547  3719 
                                     1547  3720 ;
                                     1547  3721 ; Set up the IRP for a transfer, regardless of whether or not the
                                     1547  3722 ; device is a TMSCP device or not.
                                     1547  3723 ;
                                     1547  3724 
                                     1547  3725 30$:
                    55   1C A3   D0  1547  3726 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the address of the IRP
                    51   24 A4   D0  154B  3727 	MOVL	UQB$L_UCB(R4),R1	; Get the UCB address for this unit.
                    1C A5   51   D0  154F  3728 	MOVL	R1,IRP$L_UCB(R5)	; Save away the UCB address in the IRP
                         44 A3   B0  1553  3729 	MOVW	HRB$W_BOFF(R3),-	;  the byte offset within the page,
                         30 A5       1556  3730 		IRP$W_BOFF(R5)		;  of the start of the buffer
                    14 A5   53   D0  1558  3731 	MOVL	R3,IRP$L_HRB(R5)	; Set the HRB address for IO completion
                       00C8 C1   D0  155C  3732 	MOVL	UCB$L_MAXBCNT(R1),-	; Limit the size of this
                         46 A3       1560  3733 		HRB$L_BCNT(R3)		;  transfer to the device limit
                            05   E1  1562  3734 	BBC	#DEV$V_MSCP,-		; If we are not dealing with a MSCP type
                      18 40 A1       1564  3735 		UCB$L_DEVCHAR2(R1),40$	;  device, then we may have more work to do
                         4D A1   91  1567  3736 	CMPB	UCB$B_DEVTYPE(R1),-	; The TU78 can support IO$_DSE
                            05       156A  3737 		#DT$_TU78		;  as well.
                            12   13  156B  3738 	BEQL	40$			; 
                       50   15   D0  156D  3739 	MOVL	#IO$_DSE,R0		; Put the function code in a register
                                     1570  3740 ;
                                     1570  3741 ; Use the IMMEDIATE COMPLETION opcode modifier bit passed in the packet.
                                     1570  3742 ;
                            06   E1  1570  3743 	BBC	#MSCP$V_MD_IMMED,-	; Immediate completion specified?
                      05 0A A2       1572  3744 		MSCP$W_MODIFIER(R2),35$	; If not, don't change op code.
                       0080 8F   A8  1575  3745 	BISW	#IO$M_NOWAIT,-		; Set nowait in the function itself
                            50       1579  3746 		R0			;   (to return immediately)
                                     157A  3747 35$:
                         40 A3   D4  157A  3748 	CLRL	HRB$L_SVAPTE(R3)	; No SVAPTE is necessary if supported
                            0B   11  157D  3749 	BRB	50$			; Perform the I/O
                                     157F  3750 
                                     157F  3751 ;
                                     157F  3752 ; Since the erase command is using the pseudo page table and not actually
                                     157F  3753 ; allocating and mapping memory for its transfers, we will not check the
                                     157F  3754 ; byte count of the transfer.
                                     157F  3755 ; 
                                     157F  3756 
                                     157F  3757 40$:
                       50   0B   D0  157F  3758 	MOVL	#IO$_WRITEPBLK,R0	; Set the function code...
                   00000000'GF   D0  1582  3759 	MOVL	G^EXE$GL_ERASEPPT,-	; Save the system PPT in which all the 
                         40 A3       1588  3760 		HRB$L_SVAPTE(R3)	;  PTEs point to the same system EPB
                                     158A  3761 ;
                                     158A  3762 ; The IRP packet is ready to send to the tape. R0 contains the function code.
                                     158A  3763 ;
                                     158A  3764 
                                     158A  3765 50$:
                         46 A3   D0  158A  3766 	MOVL	HRB$L_BCNT(R3),-	; Save the byte count to be used for
                         32 A5       158D  3767 		IRP$L_BCNT(R5)		;  this (portion of the) transfer.
                         40 A3   D0  158F  3768 	MOVL	HRB$L_SVAPTE(R3),-	; Move the local buffer
                         2C A5       1592  3769 		IRP$L_SVAPTE(R5)	;  virtual page table entry,
                    52   18 A3   D0  1594  3770 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                    14 A5   53   D0  1598  3771 	MOVL	R3,IRP$L_HRB(R5)	; Save the HRB address
                    20 A5   50   B0  159C  3772 	MOVW	R0,IRP$W_FUNC(R5)	; Set the completed code in the IRP
                          FC4A   30  15A0  3773 	BSBW	TMSCP$SET_CLEAR_SEX	; Set clear serious exception
                          FC9C   30  15A3  3774 	BSBW	TMSCP$SET_CLEAR_CDL	; Set clear cached data lost
                                     15A6  3775 ;
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  83
X-17                            - ERASE     (- 18 -)                     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (32)

                                     15A6  3776 ; Send this request to the tape. If the request is aborted while on the
                                     15A6  3777 ; tape queue, it is cleaned up when control is returned to TMSCP$BACK, and 
                                     15A6  3778 ; never heard from again.
                                     15A6  3779 ;
                                     15A6  3780 
                                     15A6  3781 70$:
                                     15A6  3782 
                                     15A6  3783 ;
                                     15A6  3784 ;	R0  =  Scratch
                                     15A6  3785 ;	R1  =  Scratch
                                     15A6  3786 ;	R2  =  Scratch
                                     15A6  3787 ;	R3  =  HRB address
                                     15A6  3788 ;	R4  =  UQB address
                                     15A6  3789 ;	R5  =  Scratch
                                     15A6  3790 ;
                                     15A6  3791 
                          058C   30  15A6  3792 	BSBW	TMSCP$DRIVE_TRANSFER	; Give the request to the tape
                                     15A9  3793 
                                     15A9  3794 ;
                                     15A9  3795 ; Control returns here from entry point TMSCP$BACK. 
                                     15A9  3796 ;
                                     15A9  3797 ;	R0  =  I/O status block, scratch
                                     15A9  3798 ;	R1  =  Scratch
                                     15A9  3799 ;	R2  =  Scratch
                                     15A9  3800 ;	R3  =  HRB address
                                     15A9  3801 ;	R4  =  UQB address
                                     15A9  3802 ;	R5  =  IRP address
                                     15A9  3803 ;
                                     15A9  3804 
                         60 A3   D7  15A9  3805 	DECL	HRB$L_CMD_STS(R3)	; Report progress on this request
                    55   1C A3   D0  15AC  3806 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the address of the IRP back
                    51   20 A5   B0  15B0  3807 	MOVW	IRP$W_FUNC(R5),R1	; If this was a device which didn't
                  51   0080 8F   AA  15B4  3808 	BICW	#IO$M_NOWAIT,R1		;  support IO$_DSE, then we may have
                       15   51   B1  15B9  3809 	CMPW	R1,#IO$_DSE		;  to do more writes of zeroes.
                            3B   13  15BC  3810 	BEQL	200$
                  50   0878 8F   B1  15BE  3811 	CMPW	#SS$_ENDOFTAPE,R0       ; If we reached EOT, we can start
                            11   13  15C3  3812 	BEQL	100$			;  the rewind.
                         07 50   E8  15C5  3813 	BLBS	R0,80$			; If the transfer was successful, cont...
                          0884   30  15C8  3814 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.
                    55   1C A3   D0  15CB  3815 	MOVL	HRB$L_IRP_CDRP(R3), R5	; Get the IRP address
                                     15CF  3816 
                                     15CF  3817 80$:
                         46 A3   D0  15CF  3818 	MOVL	HRB$L_BCNT(R3),-	; Use the maximum controller supported byte
                         32 A5       15D2  3819 		IRP$L_BCNT(R5)		;  count
                            D0   11  15D4  3820 	BRB	70$			; Send the next chunk of zeros
                                     15D6  3821 
                                     15D6  3822 100$:
                            24   B0  15D6  3823 	MOVW	#IO$_REWIND,-		;  before checking anything
                         20 A5       15D8  3824 		IRP$W_FUNC(R5)		;  else.
                    14 A5   53   D0  15DA  3825 	MOVL	R3,IRP$L_HRB(R5)	; Save HRB address
                          FC0C   30  15DE  3826 	BSBW	TMSCP$SET_CLEAR_SEX
                                     15E1  3827 ;
                                     15E1  3828 ; Use the IMMEDIATE COMPLETION opcode modifier bit passed in the packet.
                                     15E1  3829 ;
                    52   18 A3   D0  15E1  3830 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore MSCP buffer address.
                            06   E1  15E5  3831 	BBC	#MSCP$V_MD_IMMED,-	; Immediate completion specified?
                      06 0A A2       15E7  3832 		MSCP$W_MODIFIER(R2),110$ ; If not, don't change op code.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  84
X-17                            - ERASE     (- 18 -)                     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (32)

                       0080 8F   A8  15EA  3833 	BISW	#IO$M_NOWAIT,-		; Set nowait in the function itself
                         20 A5       15EE  3834 		IRP$W_FUNC(R5)		;    (to returm imediately)
                                     15F0  3835 110$:                                        
                                     15F0  3836 
                                     15F0  3837 ;
                                     15F0  3838 ;	R0  =  Scratch
                                     15F0  3839 ;	R1  =  Scratch
                                     15F0  3840 ;	R2  =  MSCP address
                                     15F0  3841 ;	R3  =  HRB address
                                     15F0  3842 ;	R4  =  UQB address
                                     15F0  3843 ;	R5  =  Scratch
                                     15F0  3844 ;
                                     15F0  3845 
                          0542   30  15F0  3846 	BSBW	TMSCP$DRIVE_TRANSFER	; Call a subroutine to do the I/O
                                     15F3  3847 
                                     15F3  3848 ;
                                     15F3  3849 ; Control returns here from entry point TMSCP$BACK. 
                                     15F3  3850 ;
                                     15F3  3851 ;	R0  =  I/O status block, scratch
                                     15F3  3852 ;	R1  =  Scratch
                                     15F3  3853 ;	R2  =  Scratch
                                     15F3  3854 ;	R3  =  HRB address
                                     15F3  3855 ;	R4  =  UQB address
                                     15F3  3856 ;	R5  =  IRP address
                                     15F3  3857 ;
                                     15F3  3858 
                         03 50   E8  15F3  3859 	BLBS	R0,200$			; If the transfer was successful, cont...
                          0856   30  15F6  3860 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.
                                     15F9  3861 
                                     15F9  3862 
                                     15F9  3863 200$:
                    52   18 A3   D0  15F9  3864 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                       50   00   D0  15FD  3865 	MOVL	#MSCP$K_ST_SUCC,R0	; Set the completion code to success
                          0A37   31  1600  3866 	BRW	TMSCP$SEND_END		;  and return a response to the request
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  85
X-17                            - ERGAP                                  16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (33)

                                     1603  3869 	.SBTTL	-	ERGAP
                                     1603  3870 
                                     1603  3871 ;+
                                     1603  3872 ;Functional Description:
                                     1603  3873 ;
                                     1603  3874 ; The Write Inter-Record Gap command records a format dependent record gap, at
                                     1603  3875 ; the current tape position. It is used for bypassing tape defects when write 
                                     1603  3876 ; error recovery is host controlled. Since only TMSCP tapes support this function,
                                     1603  3877 ; and there is no way to simulate this function in other drivers, this function
                                     1603  3878 ; cannot be supported.
                                     1603  3879 ;
                                     1603  3880 ; Inputs:
                                     1603  3881 ;
                                     1603  3882 ;	R0  =  Scratch
                                     1603  3883 ;	R1  =  Scratch
                                     1603  3884 ;	R2  =  MSCP packet address
                                     1603  3885 ;	R3  =  HRB address
                                     1603  3886 ;	R4  =  UQB address, scratch
                                     1603  3887 ;	R5  =  Scratch
                                     1603  3888 ;
                                     1603  3889 ; Outputs:
                                     1603  3890 ;
                                     1603  3891 ;	R0  =  MSCP completion status
                                     1603  3892 ;	R2  =  MSCP packet address
                                     1603  3893 ;	R3  =  HRB address
                                     1603  3894 ;-
                                     1603  3895 
                                     1603  3896 
                                     1603  3897 TMSCP$ERASE_GAP::
                                     1603  3898 	.IF DEFINED DEBUG$PC_HISTORY
                                     1603  3899 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1603  3900 	.ENDC	   ;DEBUG$PC_HISTORY
                       50   01   D0  1603  3901 	MOVL	#MSCP$K_ST_ICMD, R0	; This command is not supported.
                          0A31   31  1606  3902 	BRW	TMSCP$SEND_END
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  86
X-17                            - REPOSITION                             16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (34)

                                     1609  3905 	.SBTTL	-	REPOSITION
                                     1609  3906 
                                     1609  3907 ;+
                                     1609  3908 ;Functional Description:
                                     1609  3909 ;
                                     1609  3910 ; The REPOSITION command is used to position the tape from one location to 
                                     1609  3911 ; another. There are four subcommands defined within the realms of
                                     1609  3912 ; the REPOSITION command. IO$_REWIND is implemented if MSCP$M_MD_REWND 
                                     1609  3913 ; modifier is set. If the Object Count command modifier MSCP$M_MD_OBJCT
                                     1609  3914 ; is set and the field MSCP$L_POSITION is non-zero, then a pseudo
                                     1609  3915 ; Skip Tape Object is performed by using IO$_SKIPRECORDs. The Skip Tape
                                     1609  3916 ; Object is requested by the class driver in routine BRING_UNIT_ONLINE.
                                     1609  3917 ; After we have brought a unit back ONLINE after a connection failure,
                                     1609  3918 ; we reposition back to where the tape was positioned at the time
                                     1609  3919 ; of the failure by skipping the correct number of objects.
                                     1609  3920 ;
                                     1609  3921 ; If the object Count command modifier is clear and the field MSCP$L_REC_CNT
                                     1609  3922 ; is non-zero, then an IO$_SKIPRECORD is issued for that number of
                                     1609  3923 ; records. If the Object Count command modifier is clear and the
                                     1609  3924 ; field MSCP$L_TMGP_CNT is non-zero, then an IO$_SKIPFILE is
                                     1609  3925 ; issued.
                                     1609  3926 ;
                                     1609  3927 ; Table D-1 in the TMSCP spec shows all the possible combinations
                                     1609  3928 ; of modifiers and field values for the REPOSITION command, and
                                     1609  3929 ; the correct controller actions for each. Fortunately, the class
                                     1609  3930 ; driver uses a subset of these actions, and only those actions
                                     1609  3931 ; are implemented here.
                                     1609  3932 ;
                                     1609  3933 ; Inputs:
                                     1609  3934 ;
                                     1609  3935 ;	R0  =  Scratch
                                     1609  3936 ;	R1  =  Scratch
                                     1609  3937 ;	R2  =  MSCP packet address
                                     1609  3938 ;	R3  =  HRB address
                                     1609  3939 ;	R4  =  UQB address, scratch
                                     1609  3940 ;	R5  =  Scratch
                                     1609  3941 ;
                                     1609  3942 ; Outputs:
                                     1609  3943 ;
                                     1609  3944 ;	R0  =  Status
                                     1609  3945 ;	R2  =  MSCP packet address
                                     1609  3946 ;	R3  =  HRB address
                                     1609  3947 ;-
                                     1609  3948 
                                     1609  3949 TMSCP$REPOSITION::
                                     1609  3950 	.IF DEFINED DEBUG$PC_HISTORY
                                     1609  3951 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1609  3952 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1609  3953 ;
                                     1609  3954 ; Is unit online to the requestor?
                                     1609  3955 ;
                                     1609  3956 	
                         70 A4   D1  1609  3957 	CMPL	UQB$L_ONLINE_HQB(R4),-	; Is the host that has this unit
                         54 A3       160C  3958 		HRB$L_HQB(R3)		;  online the same as the requesting host?
                            06   13  160E  3959 	BEQL	10$			; If online, continue...
                       50   03   D0  1610  3960 	MOVL	#MSCP$K_ST_OFFLN,R0	; Otherwise this is an invalid command
                          0A24   31  1613  3961 	BRW	TMSCP$SEND_END
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  87
X-17                            - REPOSITION                             16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (34)

                                     1616  3962 
                                     1616  3963 10$:
                    55   1C A3   D0  1616  3964 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the IRP address.
                                     161A  3965 ;
                                     161A  3966 ; First, check for the Rewind modifier bit set. If set, no matter what other
                                     161A  3967 ; modifier is set, an IO$_REWIND is always issued first.
                                     161A  3968 ;
                            01   E0  161A  3969 	BBS	#MSCP$V_MD_REWND,-	; If REWIND modifier set,
                      03 0A A2       161C  3970 		MSCP$W_MODIFIER(R2),15$	;  issue an IO$_REWIND 
                          00C0   31  161F  3971 	BRW	80$			; Branch assist.
                                     1622  3972 
                                     1622  3973 15$:
                            24   B0  1622  3974 	MOVW	#IO$_REWIND,-		;  Set rewind function in IRP.
                         20 A5       1624  3975 		IRP$W_FUNC(R5)
                          FBC4   30  1626  3976 	BSBW	TMSCP$SET_CLEAR_SEX
                                     1629  3977 ;
                                     1629  3978 ; Use the IMMEDIATE COMPLETION opcode modifier bit passed in the packet.
                                     1629  3979 ;
                            06   E1  1629  3980 	BBC	#MSCP$V_MD_IMMED,-	; Immediate completion specified?
                      06 0A A2       162B  3981 		MSCP$W_MODIFIER(R2),20$ ; If not, don't change op code.
                       0080 8F   A8  162E  3982 	BISW	#IO$M_NOWAIT,-		; Set nowait in the function itself
                         20 A5       1632  3983 		IRP$W_FUNC(R5)		;    (to returm imediately)
                                     1634  3984 20$:
                    14 A5   53   D0  1634  3985 	MOVL	R3,IRP$L_HRB(R5)	; Save HRB for I/O completion
                         24 A4   D0  1638  3986 	MOVL	UQB$L_UCB(R4),-		; Save UCB for I/O completion
                         1C A5       163B  3987 		IRP$L_UCB(R5)
                                     163D  3988 
                                     163D  3989 ;
                                     163D  3990 ;	R0  =  Scratch
                                     163D  3991 ;	R1  =  Scratch
                                     163D  3992 ;	R2  =  Scratch
                                     163D  3993 ;	R3  =  HRB address
                                     163D  3994 ;	R4  =  UQB address
                                     163D  3995 ;	R5  =  Scratch
                                     163D  3996 ;
                                     163D  3997 
                          04F5   30  163D  3998 	BSBW	TMSCP$DRIVE_TRANSFER	; Call a subroutine to do the I/O
                                     1640  3999 
                                     1640  4000 ;
                                     1640  4001 ; Control returns here from entry point TMSCP$BACK. 
                                     1640  4002 ;
                                     1640  4003 ;	R0  =  I/O status block, scratch
                                     1640  4004 ;	R1  =  Scratch
                                     1640  4005 ;	R2  =  Scratch
                                     1640  4006 ;	R3  =  HRB address
                                     1640  4007 ;	R4  =  UQB address
                                     1640  4008 ;	R5  =  IRP address
                                     1640  4009 ;
                                     1640  4010 ; The IO$_REWIND will cause the local driver to begin the first operation
                                     1640  4011 ; of this REPOSITION command. Possible further I/Os to the drive are
                                     1640  4012 ; investigated.
                                     1640  4013 ;
                                     1640  4014 
                         64 A3   D4  1640  4015 	CLRL	HRB$L_OBJECT_SKIP(R3)	; Initiate object counter
                    54   58 A3   D0  1643  4016 	MOVL	HRB$L_UQB(R3),R4	; Get the host queue block address
                    52   18 A3   D0  1647  4017 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore packet address
                    55   1C A3   D0  164B  4018 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Restore IRP-CDRP pair.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  88
X-17                            - REPOSITION                             16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (34)

                         05 50   E8  164F  4019 	BLBS	R0,30$			; If the transfer was successful, cont...
                          07FA   30  1652  4020 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.
                            0D   11  1655  4021 	BRB	32$
                                     1657  4022 
                                     1657  4023 30$:
                       50   00   D0  1657  4024 	MOVL	#MSCP$K_ST_SUCC,R0	; This command has completed successfuly
                            01   A8  165A  4025 	BISW	#UQB$M_ST_BOT,-		; If rewind was successful,
                       00C8 C4       165C  4026 		UQB$W_ST_FLAGS(R4)	;  we must be at BOT
                            04   AA  165F  4027 	BICW	#UQB$M_ST_EOT,-		; If rewind was successful,
                       00C8 C4       1661  4028 		UQB$W_ST_FLAGS(R4)	;  we can clear the EOT flag.
                                     1664  4029 
                                     1664  4030 32$:
                       00AC C4   B4  1664  4031 	CLRW	UQB$W_TAPEM_SKIP(R4) 	; Initialize tape mark counter
                       00AE C4   B4  1668  4032 	CLRW	UQB$W_RECORD_SKIP(R4)	;  as well as record counter.
                            02   E0  166C  4033 	BBS	#MSCP$V_MD_OBJCT,-	; If Skip Object specified, begin
                      03 0A A2       166E  4034 		MSCP$W_MODIFIER(R2),35$	;  issuing IO$_SKIPRECORD to simulate.
                          010A   31  1671  4035 	BRW	1000$			;  else we are done.
                                     1674  4036 ;
                                     1674  4037 ; None of the tape drivers support skipping objects, only tape marks or records.
                                     1674  4038 ; The class driver issues this command during the routine to bring an available
                                     1674  4039 ; unit online after a connection failure. The command is a REPOSITION rewind
                                     1674  4040 ; followed by a repositioning back to UCB$L_RECORD, which was the object count
                                     1674  4041 ; of the drive before the connection was lost.
                                     1674  4042 ;
                                     1674  4043 ; Issue an IO$_SKIPRECORD specifying the number of objects to skip as the number
                                     1674  4044 ; of records to skip. Either this many records will be skipped or a tape mark
                                     1674  4045 ; will be encountered. If a tape mark is encountered before the reposition is
                                     1674  4046 ; satisfied, subtract the object count by the number of records already skipped
                                     1674  4047 ; plus the tape mark, from the original count and reissue the IO$_SKIPRECORD
                                     1674  4048 ; with this new count.
                                     1674  4049 ;
                                     1674  4050 
                                     1674  4051 35$:
                         0C A2   D0  1674  4052 	MOVL	MSCP$L_REC_CNT(R2),-	; Initialize the number of objects 
                         64 A3       1677  4053 		HRB$L_OBJECT_SKIP(R3)	;   to skip
                                     1679  4054 
                                     1679  4055 40$:
                         64 A3   3C  1679  4056  	MOVZWL	HRB$L_OBJECT_SKIP(R3),- ; Skip records until tape mark hit
                         38 A5       167C  4057 		IRP$L_MEDIA(R5)		;  or object count satisfied
                            26   B0  167E  4058 	MOVW	#IO$_SKIPRECORD,-	; Issue an IO$_SKIPRECORD for the
                         20 A5       1680  4059 		IRP$W_FUNC(R5)		;  number of objects to skip.
                          FB68   30  1682  4060 	BSBW	TMSCP$SET_CLEAR_SEX	; Set clear serious exception.
                                     1685  4061 
                                     1685  4062 50$:
                         30 A5   B4  1685  4063 	CLRW	IRP$W_BOFF(R5)		; No bytes to offset to.
                         2C A5   D4  1688  4064 	CLRL	IRP$L_SVAPTE(R5)	; No buffer.
                         32 A5   D4  168B  4065 	CLRL	IRP$L_BCNT(R5)		; No bytes to transfer.
                    14 A5   53   D0  168E  4066 	MOVL	R3,IRP$L_HRB(R5)	; Save HRB for I/O completion
                         24 A4   D0  1692  4067 	MOVL	UQB$L_UCB(R4),-		; Save UCB for I/O completion
                         1C A5       1695  4068 		IRP$L_UCB(R5)
                                     1697  4069 
                                     1697  4070 ;
                                     1697  4071 ;	R0  =  Scratch
                                     1697  4072 ;	R1  =  Scratch
                                     1697  4073 ;	R2  =  Scratch
                                     1697  4074 ;	R3  =  HRB address
                                     1697  4075 ;	R4  =  UQB address
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  89
X-17                            - REPOSITION                             16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (34)

                                     1697  4076 ;	R5  =  Scratch
                                     1697  4077 ;
                                     1697  4078 
                          049B   30  1697  4079 	BSBW	TMSCP$DRIVE_TRANSFER	; Call a subroutine to do the I/O
                                     169A  4080 
                                     169A  4081 ;
                                     169A  4082 ; Control returns here from entry point TMSCP$BACK. 
                                     169A  4083 ;
                                     169A  4084 ;	R0  =  I/O status block, scratch
                                     169A  4085 ;	R1  =  Scratch
                                     169A  4086 ;	R2  =  Scratch
                                     169A  4087 ;	R3  =  HRB address
                                     169A  4088 ;	R4  =  UQB address
                                     169A  4089 ;	R5  =  IRP address
                                     169A  4090 ;
                                     169A  4091 
                    52   18 A3   D0  169A  4092 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore packet address
                  0870 8F   50   B1  169E  4093 	CMPW	R0,#SS$_ENDOFFILE	; Tape mark encountered?
                            0A   12  16A3  4094 	BNEQ	60$			; If so then add a tape mark
                       00AC C4   B6  16A5  4095 	INCW	UQB$W_TAPEM_SKIP(R4) 	; to the total number of tape marks
                       00AE C4   B7  16A9  4096 	DECW	UQB$W_RECORD_SKIP(R4)   ; and compensate now for the tape mark
                                     16AD  4097 					;  that is included in the count field
                                     16AD  4098 					;  of the IOSB.
                            09   11  16AD  4099 	BRB	70$			; 
                                     16AF  4100 
                                     16AF  4101 60$:
                         06 50   E8  16AF  4102 	BLBS	R0,70$			; If the transfer was successful, cont...
                          079A   30  16B2  4103 	BSBW	TMSCP$CHECK_XFER_STATUS
                          00C6   31  16B5  4104 	BRW	1000$
                                     16B8  4105 
                                     16B8  4106 70$:
               50   50   F0 8F   78  16B8  4107 	ASHL	#-16,R0,R0		; # of records skipped in low word.
                  00AE C4   50   A0  16BD  4108 	ADDW2	R0,UQB$W_RECORD_SKIP(R4); Add records skipped (and tapem) to total.
                    55   1C A3   D0  16C2  4109 	MOVL	HRB$L_IRP_CDRP(R3), R5	; Get the IRP address.
                    68 A3   50   A2  16C6  4110 	SUBW	R0,HRB$L_CURRENT_SKIP(R3); Determine number of remaining objects left.
                            AD   12  16CA  4111 	BNEQ	40$			; Continue until all objects skipped
                                     16CC  4112 ;
                                     16CC  4113 ; Fill in appropriate MSCP fields.
                                     16CC  4114 ;
                       00AC C4   D0  16CC  4115 	MOVL	UQB$W_TAPEM_SKIP(R4),- 	; Update number of tape
                         10 A2       16D0  4116 		MSCP$L_TMGP_CNT(R2)	;  marks skipped.
                       00AE C4   D0  16D2  4117 	MOVL	UQB$W_RECORD_SKIP(R4),-	; Update number of records
                         0C A2       16D6  4118 		MSCP$L_REC_CNT(R2)	;  skipped.
                    54   24 A4   D0  16D8  4119 	MOVL	UQB$L_UCB(R4),R4	;  get the UCB
                       50   00   D0  16DC  4120 	MOVL	#MSCP$K_ST_SUCC,R0	; This command has completed successfuly
                          009C   31  16DF  4121 	BRW	1000$			
                                     16E2  4122 
                                     16E2  4123 ;
                                     16E2  4124 ; Process IO$_SKIPRECORD or IO$_SPACERECORD
                                     16E2  4125 ;
                                     16E2  4126 ;	R0  =  Scratch
                                     16E2  4127 ;	R1  =  Scratch
                                     16E2  4128 ;	R2  =  MSCP message address
                                     16E2  4129 ;	R3  =  HRB address
                                     16E2  4130 ;	R4  =  UQB address, scratch
                                     16E2  4131 ;	R5  =  IRP address, scratch
                                     16E2  4132 ;
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  90
X-17                            - REPOSITION                             16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (34)

                                     16E2  4133 
                                     16E2  4134 80$:
                         0C A2   D0  16E2  4135 	MOVL	MSCP$L_REC_CNT(R2),-	; Set up number of records to skip and
                         38 A5       16E5  4136 		IRP$L_MEDIA(R5)		;  if non-zero, this is a Skip Record command
                            0F   13  16E7  4137 	BEQL	100$			;  else it is a Skip File or Seq Nop command
                                     16E9  4138 
                            26   B0  16E9  4139 	MOVW	#IO$_SKIPRECORD,-	; Issue the logical command IO$_SKIPRECORD for the
                         20 A5       16EB  4140 		IRP$W_FUNC(R5)		;  number of objects to skip
                            07   E1  16ED  4141 	BBC	#MSCP$V_MD_DLEOT,-	; If LEOT detection is not enabled, this
                      04 0A A2       16EF  4142 		MSCP$W_MODIFIER(R2), 90$;  is a physical command
                            09   B0  16F2  4143 	MOVW	#IO$_SPACERECORD,-	; Issue an IO$_SPACERECORD for the
                         20 A5       16F4  4144 		IRP$W_FUNC(R5)		;  number of objects to skip
                                     16F6  4145 
                                     16F6  4146 90$:
                            12   11  16F6  4147 	BRB	200$			;  and issue the I/O
                                     16F8  4148 ;
                                     16F8  4149 ; Process IO$_SKIPFILE and IO$_SPACEFILE.
                                     16F8  4150 ;
                                     16F8  4151 
                                     16F8  4152 100$:
                         10 A2   D0  16F8  4153 	MOVL	MSCP$L_TMGP_CNT(R2),-	; Set up number of files 
                         38 A5       16FB  4154 		IRP$L_MEDIA(R5)		;  to skip and 
                            25   B0  16FD  4155 	MOVW	#IO$_SKIPFILE,-		;  issue an IO$_SKIPFILES.
                         20 A5       16FF  4156 		IRP$W_FUNC(R5)		;  
                            07   E1  1701  4157 	BBC	#MSCP$V_MD_DLEOT,-	; If LEOT detection is not enabled, this
                         0A A2       1703  4158 		MSCP$W_MODIFIER(R2),-	;  is a physical command
                            04       1705  4159 		200$
                            02   B0  1706  4160 	MOVW	#IO$_SPACEFILE,-	;   so issue an IO$_SPACEFILE
                         20 A5       1708  4161 		IRP$W_FUNC(R5)		;   instead
                                     170A  4162 
                                     170A  4163 200$:
                          FAE0   30  170A  4164 	BSBW	TMSCP$SET_CLEAR_SEX
                            03   E1  170D  4165 	BBC	#MSCP$V_MD_REVRS,-	; If the reverse modifier is set, then
                      05 0A A2       170F  4166 		MSCP$W_MODIFIER(R2),220$ ;  the original I/O had a negative record count.
                         38 A5   AE  1712  4167 	MNEGW	IRP$L_MEDIA(R5),-	; Negate the request                    
                         38 A5       1715  4168 		IRP$L_MEDIA(R5)		;  so the a Skip Record reverse is performed.
                                     1717  4169 
                                     1717  4170 220$:
                    14 A5   53   D0  1717  4171 	MOVL	R3,IRP$L_HRB(R5)	; Save HRB for I/O completion
                         24 A4   D0  171B  4172 	MOVL	UQB$L_UCB(R4),-		; Save UCB for I/O completion
                         1C A5       171E  4173 		IRP$L_UCB(R5)
                                     1720  4174 
                                     1720  4175 ;
                                     1720  4176 ;	R0  =  Scratch
                                     1720  4177 ;	R1  =  Scratch
                                     1720  4178 ;	R2  =  Scratch
                                     1720  4179 ;	R3  =  HRB address
                                     1720  4180 ;	R4  =  UQB address
                                     1720  4181 ;	R5  =  Scratch
                                     1720  4182 ;
                                     1720  4183 
                          0412   30  1720  4184 	BSBW	TMSCP$DRIVE_TRANSFER	; Call a subroutine to do the I/O
                                     1723  4185 
                                     1723  4186 ;
                                     1723  4187 ; Control returns here from entry point TMSCP$BACK. 
                                     1723  4188 ;
                                     1723  4189 ;	R0  =  I/O status block, scratch
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  91
X-17                            - REPOSITION                             16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (34)

                                     1723  4190 ;	R1  =  Scratch
                                     1723  4191 ;	R2  =  Scratch
                                     1723  4192 ;	R3  =  HRB address
                                     1723  4193 ;	R4  =  UQB address
                                     1723  4194 ;	R5  =  IRP address
                                     1723  4195 ;
                                     1723  4196 
                    55   1C A3   D0  1723  4197 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Restore IRP address
                    52   18 A3   D0  1727  4198 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore packet address
                    54   58 A3   D0  172B  4199 	MOVL	HRB$L_UQB(R3),R4	; Get the UQB to as to
                    54   24 A4   D0  172F  4200 	MOVL	UQB$L_UCB(R4),R4	;  get the UCB
               51   50   F0 8F   78  1733  4201 	ASHL	#-16,R0,R1		; Calculate record or file skipped count.
                         0C A2   D5  1738  4202 	TSTL	MSCP$L_REC_CNT(R2)	; Was this an IO$_SKIPRECORD or IO$_SPACERECORD?
                            09   13  173B  4203 	BEQL	400$			; If so, then
                    0C A2   51   3C  173D  4204 	MOVZWL	R1,MSCP$L_RCSKIPED(R2)	;  update number of records skipped
                         10 A2   D4  1741  4205 	CLRL	MSCP$L_TMSKIPED(R2)
                            07   11  1744  4206 	BRB	450$
                                     1746  4207 
                                     1746  4208 400$:
                    10 A2   51   3C  1746  4209 	MOVZWL	R1,MSCP$L_TMSKIPED(R2)	;  else update number of files skipped
                         0C A2   D4  174A  4210 	CLRL	MSCP$L_RCSKIPED(R2)
                                     174D  4211 
                                     174D  4212 450$:
                       00C4 C4   D0  174D  4213 	MOVL	UCB$L_RECORD(R4),-	; Update position of tape
                         1C A2       1751  4214 		MSCP$L_POSITION(R2)
                            05   E1  1753  4215 	BBC	#DEV$V_MSCP,-		; If we are not dealing with an MSCP
                      06 40 A4       1755  4216 		UCB$L_DEVCHAR2(R4),500$	;  device, then we can get the record
                       0080 C3   D0  1758  4217 	MOVL	HRB$L_RECORD(R3),-	;  count out of the HRB since the 
                         1C A2       175C  4218 		MSCP$L_POSITION(R2)	;  class driver set it for us.
                                     175E  4219 
                                     175E  4220 500$:
                         05 50   E8  175E  4221 	BLBS	R0,600$			; If the transfer was successful, cont...
                          06EB   30  1761  4222 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.
                            18   11  1764  4223 	BRB	1000$
                                     1766  4224 
                                     1766  4225 600$:
                       50   00   D0  1766  4226 	MOVL	#MSCP$K_ST_SUCC,R0	; This command has completed successfuly
                            10   E1  1769  4227 	BBC	#MT$V_BOT,-
                      10 50 A4       176B  4228 		UCB$L_DEVDEPEND(R4),1000$
                    54   58 A3   D0  176E  4229 	MOVL	HRB$L_UQB(R3), R4	; Get unit queue block address.
                       50   0D   D0  1772  4230 	MOVL	#MSCP$K_ST_BOT,R0
                            04   AA  1775  4231 	BICW	#UQB$M_ST_EOT,-		; Clear the end of tape flag
                       00C8 C4       1777  4232 		UQB$W_ST_FLAGS(R4)	;
                            10   A8  177A  4233 	BISW	#MSCP$M_EF_SEREX,-	; Set the serious exception flag
                         09 A2       177C  4234 		MSCP$B_FLAGS(R2)	
                                     177E  4235 	.IF DEFINED DEBUG$CURRENT_SANITY
                                     177E  4236 	BSBW	TMSCP$CHECK_CURRENT	; Sanity check the current counters
                                     177E  4237 	.ENDC	   ;DEBUG$CURRENT_SANITY
                                     177E  4238 
                                     177E  4239 1000$:
                    52   18 A3   D0  177E  4240 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore packet address
                          08B5   31  1782  4241 	BRW	TMSCP$SEND_END		; Send an end packet with R0 status
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  92
X-17                            - FLUSH     (- 19 -)                     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (35)

                                     1785  4244 	.SBTTL	-	FLUSH					(- 19 -)
                                     1785  4245 
                                     1785  4246 ;+
                                     1785  4247 ; Functional Description:
                                     1785  4248 ;
                                     1785  4249 ; All controllers that do not support caching must treat this command as
                                     1785  4250 ; a no-op that always succeeds. This command is included in the minimal
                                     1785  4251 ; tape MSCP subset soley for compatability with controllers that do support
                                     1785  4252 ; caching.
                                     1785  4253 ;
                                     1785  4254 ; Inputs:
                                     1785  4255 ;
                                     1785  4256 ;	R0  =  Scratch
                                     1785  4257 ;	R1  =  Scratch
                                     1785  4258 ;	R2  =  MSCP packet address
                                     1785  4259 ;	R3  =  HRB address
                                     1785  4260 ;	R4  =  UQB address, scratch
                                     1785  4261 ;	R5  =  Scratch
                                     1785  4262 ;
                                     1785  4263 ; Outputs:
                                     1785  4264 ;
                                     1785  4265 ;	R0  =  Success
                                     1785  4266 ;	R2  =  MSCP packet address
                                     1785  4267 ;	R3  =  HRB address
                                     1785  4268 ;-
                                     1785  4269 
                                     1785  4270 TMSCP$FLUSH::
                                     1785  4271 	.IF DEFINED DEBUG$PC_HISTORY
                                     1785  4272 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1785  4273 	.ENDC	   ;DEBUG$PC_HISTORY
                    55   1C A3   D0  1785  4274 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Make sure we have the IRP address
                 1C A5   24 A4   D0  1789  4275 	MOVL	UQB$L_UCB(R4), -	; Save the UCB address
                                     178E  4276 		IRP$L_UCB(R5)
                    14 A5   53   D0  178E  4277 	MOVL	R3,IRP$L_HRB(R5)	; Save the HRB address
                            2A   B0  1792  4278 	MOVW	#IO$_FLUSH,-		; Set up the function code,
                         20 A5       1794  4279 		IRP$W_FUNC(R5)		;  to do the mount verification
                          FA54   30  1796  4280 	BSBW	TMSCP$SET_CLEAR_SEX	; Set clear serious exception
                          FAA6   30  1799  4281 	BSBW	TMSCP$SET_CLEAR_CDL	; Set clear cached data lost
                                     179C  4282 
                                     179C  4283 ;
                                     179C  4284 ;	R0  =  Scratch
                                     179C  4285 ;	R1  =  Scratch
                                     179C  4286 ;	R2  =  Scratch
                                     179C  4287 ;	R3  =  HRB address
                                     179C  4288 ;	R4  =  UQB address
                                     179C  4289 ;	R5  =  Scratch
                                     179C  4290 ;
                                     179C  4291 
                    51   24 A4   D0  179C  4292 	MOVL	UQB$L_UCB(R4),R1	; R1 <= UCB
                            0A   E1  17A0  4293 	BBC	#DEV$V_WBC,-		; Flush hardware cache if possible
                      0B 40 A1       17A2  4294 		UCB$L_DEVCHAR2(R1),10$	;  
                          0399   30  17A5  4295 	BSBW	TMSCP$DRIVE_CHECK	; Call a subroutine to do the I/O
                                     17A8  4296 
                                     17A8  4297 ;
                                     17A8  4298 ; Control returns here from entry point TMSCP$BACK. 
                                     17A8  4299 ;
                                     17A8  4300 ;	R0  =  I/O status block, scratch
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  93
X-17                            - FLUSH     (- 19 -)                     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (35)

                                     17A8  4301 ;	R1  =  Scratch
                                     17A8  4302 ;	R2  =  Scratch
                                     17A8  4303 ;	R3  =  HRB address
                                     17A8  4304 ;	R4  =  UQB address
                                     17A8  4305 ;	R5  =  IRP address
                                     17A8  4306 ; 
                                     17A8  4307 		
                         05 50   E8  17A8  4308 	BLBS	R0,10$			; On success, continue
                          06A1   30  17AB  4309 	BSBW	TMSCP$CHECK_XFER_STATUS	; Check the error code
                            03   11  17AE  4310 	BRB	20$			;  and send the end packet	
                                     17B0  4311 
                                     17B0  4312 10$:
                       50   00   3C  17B0  4313 	MOVZWL	#MSCP$K_ST_SUCC,R0	; Return an illegal command
                                     17B3  4314 
                                     17B3  4315 20$:
                          0884   31  17B3  4316 	BRW	TMSCP$SEND_END		; Send an end packet with R0 status
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  94
X-17                            - READ     (- 33 -)                      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (36)

                                     17B6  4319 	.SBTTL	-	READ					(- 33 -)
                                     17B6  4320 
                                     17B6  4321 ;+
                                     17B6  4322 ; Functional Description:
                                     17B6  4323 ;
                                     17B6  4324 ; This routine is called to process a MSCP read packet. It is called from the
                                     17B6  4325 ; non-sequential buffer class command routine. When processing of this 
                                     17B6  4326 ; command is complete, control is returned to the main line routine.
                                     17B6  4327 ;
                                     17B6  4328 ; Inputs:
                                     17B6  4329 ;
                                     17B6  4330 ;	R0  =  Scratch
                                     17B6  4331 ;	R1  =  Scratch
                                     17B6  4332 ;	R2  =  MSCP packet address
                                     17B6  4333 ;	R3  =  HRB address
                                     17B6  4334 ;	R4  =  UQB address, scratch
                                     17B6  4335 ;	R5  =  Scratch
                                     17B6  4336 ;
                                     17B6  4337 ; Outputs:
                                     17B6  4338 ;
                                     17B6  4339 ;	R0  =  Read completion status
                                     17B6  4340 ;	R2  =  MSCP packet address
                                     17B6  4341 ;	R3  =  HRB address
                                     17B6  4342 ;-
                                     17B6  4343 
                                     17B6  4344 TMSCP$READ::
                                     17B6  4345 	.IF DEFINED DEBUG$PC_HISTORY
                                     17B6  4346 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     17B6  4347 	.ENDC	   ;DEBUG$PC_HISTORY
                                     17B6  4348 
                                     17B6  4349 ;
                                     17B6  4350 ; Allocate and load mapping resources to map the transfer buffer area
                                     17B6  4351 ; in the requesting system.
                                     17B6  4352 ;
                                     17B6  4353 
                         0C A2   B5  17B6  4354 	TSTW	MSCP$L_BYTE_CNT(R2)	; Zero request size?
                            06   12  17B9  4355 	BNEQ	10$
                       50   00   3C  17BB  4356 	MOVZWL	#MSCP$K_ST_SUCC,R0	; Set success
                          0879   31  17BE  4357 	BRW	TMSCP$SEND_END		; and return.
                                     17C1  4358 
                                     17C1  4359 10$:
                          031D   30  17C1  4360 	BSBW	TMSCP$ALLOCATE		; Find some local memory for the xfer
                         0E 50   E8  17C4  4361 	BLBS	R0,12$                  ; if successful continue on
                  50   012A 8F   3C  17C7  4362         MOVZWL	#<MSCP$K_SC_MEMER@ -    ; otherwise set Controller error
                                     17CC  4363 		MSCP$V_ST_SBCOD! -      ; with subcode of memory error
                                     17CC  4364 		MSCP$K_ST_CNTLR>,R0	; 
                         20 A2   D4  17CC  4365         CLRL	MSCP$L_TAPEREC(R2)	; clear to indicate transfer failure
                         0C A2   D4  17CF  4366         CLRL	MSCP$L_BYTE_CNT(R2)
                          0865   31  17D2  4367 	BRW	TMSCP$SEND_END		; and return an end message
                                     17D5  4368 12$:
                                     17D5  4369 ;
                                     17D5  4370 ; Now prepare the CDRP for mapping the local buffer just allocated
                                     17D5  4371 ; for use by SCS.
                                     17D5  4372 ;
                                     17D5  4373 ;	R0  =  Scratch
                                     17D5  4374 ;	R1  =  Scratch
                                     17D5  4375 ;	R2  =  MSCP packet address
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  95
X-17                            - READ     (- 33 -)                      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (36)

                                     17D5  4376 ;	R3  =  HRB address
                                     17D5  4377 ;	R4  =  UQB address, scratch
                                     17D5  4378 ;	R5  =  Scratch
                                     17D5  4379 ;
                                     17D5  4380 
                    55   1C A3   D0  17D5  4381 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the IRP base address
                    55   60 A5   DE  17D9  4382 	MOVAL	IRP$L_FQFL(R5),R5	; Move down to the CDRP portion
                         20 A3   DE  17DD  4383 	MOVAL	HRB$B_LBUFF(R3),-	; Define the local buffer handle as
                         2C A5       17E0  4384 		CDRP$L_LBUFH_AD(R5)	;  the address of LBUFF
                    54   54 A3   D0  17E2  4385 	MOVL	HRB$L_HQB(R3),R4	; Get the HQB temporarily
                         28 A4   D0  17E6  4386 	MOVL	HQB$L_CDT(R4),-		;  so we can put a fresh CDT address
                         24 A5       17E9  4387 		CDRP$L_CDT(R5)		;  in the CDRP
                    54   5C A3   D0  17EB  4388 	MOVL	HRB$L_PDT(R3),R4	; Pick up the PDT address
                            06   B0  17EF  4389 	MOVW	#HRB$K_ST_MAP_WAIT,-	; Set the state of this request to 
                         14 A3       17F1  4390 		HRB$W_STATE(R3)		;  mapping a buffer
                                     17F3  4391 
                                     17F3  4392 ;		Verify that the HRB fields are in the same order as the IRP fields.
                                     17F3  4393 ;		This is  a requirement of the MAP function.
                                     17F3  4394 
                                     17F3  4395 	ASSUME	<HRB$W_BOFF-HRB$L_SVAPTE> EQ <IRP$W_BOFF-IRP$L_SVAPTE>
                                     17F3  4396 	ASSUME	<HRB$L_BCNT-HRB$L_SVAPTE> EQ <IRP$L_BCNT-IRP$L_SVAPTE>
                                     17F3  4397 
                                     17F3  4398 ;		Verify that the correct base address is used.
                                     17F3  4399 
                                     17F3  4400 	ASSUME	HRB$W_BOFF GT HRB$L_SVAPTE
                                     17F3  4401 	ASSUME	HRB$L_BCNT GT HRB$L_SVAPTE
                                     17F3  4402 
                    51   40 A3   DE  17F3  4403 	MOVAL	HRB$L_SVAPTE(R3),R1	; Address of the three longword buffer
                            52   D4  17F7  4404 	CLRL	R2			; Access mode of transfer is kernel
                                     17F9  4405 	MAP				; Map the buffer
                         2C B4   16  17F9       		JSB	@PDT$L_MAP(R4)
                       8000 8F   A8  17FC  4406 	BISW	#HRB$M_STATE_INVALID,-	; The state of this request is "current"
                         14 A3       1800  4407 		HRB$W_STATE(R3)		;  leave the old state for diagnosis
                                     1802  4408 
                                     1802  4409 ;
                                     1802  4410 ; Since the processing of this request can be stalled while waiting for
                                     1802  4411 ; the local buffer to be mapped, we need to check to see if the request
                                     1802  4412 ; has been canceled before going on.
                                     1802  4413 ;
                            10   A8  1802  4414 	BISW	#HRB$M_MAP,-		; Indicate that we have allocated 
                         16 A3       1804  4415 		HRB$W_FLAGS(R3)		;  mapping resources for this request
                                 B3  1806  4416 	BITW	#<HRB$M_ABORT!-		; Check to see if this request has been
                                     1807  4417 		HRB$M_ABORTWS>,-	;  aborted either by ^Y or by the 
                    16 A3   03       1807  4418 		HRB$W_FLAGS(R3)		;  loss of connection to the client
                            03   13  180A  4419 	BEQL	TMSCP$READ_TRANSFER	; Request was not aborted, continue...
                          0100   31  180C  4420 	BRW	TMSCP$ABORT_READ	; Otherwise cleanup this request
                                     180F  4421 
                                     180F  4422 ;
                                     180F  4423 ; Prepare the IRP for the transfer from tape
                                     180F  4424 ;
                                     180F  4425 
                                     180F  4426 TMSCP$READ_TRANSFER::
                    55   1C A3   D0  180F  4427 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the address of the IRP
                    54   58 A3   D0  1813  4428 	MOVL	HRB$L_UQB(R3),R4	; Get the UQB address
                         24 A4   D0  1817  4429 	MOVL	UQB$L_UCB(R4),-		;  so we can pull out the UCB address
                         1C A5       181A  4430 		IRP$L_UCB(R5)		;  and save it away in the IRP
                         40 A3   D0  181C  4431 	MOVL	HRB$L_SVAPTE(R3),-	; Move the local buffer
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  96
X-17                            - READ     (- 33 -)                      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (36)

                         2C A5       181F  4432 		IRP$L_SVAPTE(R5)	;  virtual page table entry,
                         44 A3   B0  1821  4433 	MOVW	HRB$W_BOFF(R3),-	;  the byte offset within the page,
                         30 A5       1824  4434 		IRP$W_BOFF(R5)		;  of the start of the buffer
                         46 A3   D0  1826  4435 	MOVL	HRB$L_BCNT(R3),-	;  and the byte count to be used for
                         32 A5       1829  4436 		IRP$L_BCNT(R5)		;  this (portion of the) transfer.
                                     182B  4437 	.IF	DEFINED DEBUG$PC_HISTORY
                                     182B  4438 	MOVL	IRP$L_BCNT(R5), R0	; Get the transfer count.
                                     182B  4439 	BSBW	TMSCP$PCHIST_R3R0	; Log the PC for debugging.
                                     182B  4440 	.ENDC  ;DEBUG$PC_HISTORY
                                     182B  4441 ;
                                     182B  4442 ; Check for any supported modifiers in the MSCP request. If they are set
                                     182B  4443 ; there, then we should set them in the IRP we send out also.
                                     182B  4444 ;
                       50   0C   3C  182B  4445 	MOVZWL	#IO$_READPBLK,R0	; Pass I/O function code to be used
                    52   18 A3   D0  182E  4446 	MOVL	HRB$L_MSGBUF(R3),R2	; Get back the MSCP packet address
                            0E   E1  1832  4447 	BBC	#MSCP$V_MD_COMP,-	; If the compare modifier was set in
                      05 0A A2       1834  4448 		MSCP$W_MODIFIER(R2),3$	;  the MSCP packet,
                  50   4000 8F   A8  1837  4449 	BISW	#IO$M_DATACHECK,R0	;  then set it in the IRP also
                                     183C  4450 
                                     183C  4451 3$:
                            08   E1  183C  4452 	BBC	#MSCP$V_MD_SEREC,-	; If the  modifier was set in
                      05 0A A2       183E  4453 		MSCP$W_MODIFIER(R2),4$	;  the MSCP packet,
                  50   8000 8F   A8  1841  4454 	BISW	#IO$M_INHRETRY,R0	;  then set it in the IRP also
                                     1846  4455 
                                     1846  4456 4$:
                            03   E1  1846  4457 	BBC	#MSCP$V_MD_REVRS,-	; If the reverse modifier was set
                      05 0A A2       1848  4458 		MSCP$W_MODIFIER(R2),5$	;  in the MSCP packet
                  50   0040 8F   A8  184B  4459 	BISW	#IO$M_REVERSE,R0	;  then set it in the IRP also
                                     1850  4460 
                                     1850  4461 5$:
                    20 A5   50   B0  1850  4462 	MOVW	R0,IRP$W_FUNC(R5)	; Fill in the function code
                          F996   30  1854  4463 	BSBW	TMSCP$SET_CLEAR_SEX	; Set clear serious exception
                          F9E8   30  1857  4464 	BSBW	TMSCP$SET_CLEAR_CDL	; Set clear cached data lost
                    14 A5   53   D0  185A  4465 	MOVL	R3,IRP$L_HRB(R5)	; Save the HRB address
                                     185E  4466 	.IF	DEFINED DEBUG$PC_HISTORY
                                     185E  4467 	MOVZWL	IRP$W_FUNC(R5), R0	; Get the function value.
                                     185E  4468 	BSBW	TMSCP$R0HIST		; Log the value for debugging.
                                     185E  4469 	.ENDC  ;DEBUG$PC_HISTORY
                                     185E  4470 
                                     185E  4471 ;
                                     185E  4472 ; The IRP is queue to the local driver. If the command is aborted during
                                     185E  4473 ; this thread, the request is finished off in subroutine TMSCP$BACK and 
                                     185E  4474 ; resources are deallocated.
                                     185E  4475 ;
                                     185E  4476 ;
                                     185E  4477 ;	R0  =  Scratch
                                     185E  4478 ;	R1  =  Scratch
                                     185E  4479 ;	R2  =  Scratch
                                     185E  4480 ;	R3  =  HRB address
                                     185E  4481 ;	R4  =  UQB address
                                     185E  4482 ;	R5  =  Scratch
                                     185E  4483 ;
                                     185E  4484 
                          02D4   30  185E  4485 	BSBW	TMSCP$DRIVE_TRANSFER	; Execute a tape transfer
                                     1861  4486 
                                     1861  4487 ;
                                     1861  4488 ; Control returns here from entry point TMSCP$BACK. 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  97
X-17                            - READ     (- 33 -)                      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (36)

                                     1861  4489 ;
                                     1861  4490 ;	R0  =  I/O status block, scratch
                                     1861  4491 ;	R1  =  Scratch
                                     1861  4492 ;	R2  =  Scratch
                                     1861  4493 ;	R3  =  HRB address
                                     1861  4494 ;	R4  =  UQB address
                                     1861  4495 ;	R5  =  IRP address
                                     1861  4496 ;
                                     1861  4497 
                         06 50   E8  1861  4498 	BLBS	R0,10$			; If the transfer was successful, cont...
                          05E8   30  1864  4499 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.
                          00A2   31  1867  4500 	BRW	40$
                                     186A  4501 ;
                                     186A  4502 ; Send the data to the host buffer
                                     186A  4503 ;
                                     186A  4504 
                                     186A  4505 10$:
                    55   1C A3   D0  186A  4506 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Restore IRP address
                         32 A5   D0  186E  4507 	MOVL	IRP$L_BCNT(R5),-	; Get the number of bytes transferred
                         46 A3       1871  4508 		HRB$L_BCNT(R3)		;  and save it away in the request block
                    55   60 A5   DE  1873  4509 	MOVAL	IRP$L_FQFL(R5),R5	; Move from the IRP to the CDRP address
                    51   58 A3   D0  1877  4510 	MOVL	HRB$L_UQB(R3),R1	; Get the UQB
                    51   24 A1   D0  187B  4511 	MOVL	UQB$L_UCB(R1),R1	;  and then the UCB.
                    52   18 A3   D0  187F  4512 	MOVL	HRB$L_MSGBUF(R3),R2	; Get the MSCP packet address back
                            10   E1  1883  4513 	BBC	#MT$V_BOT,-
                      07 50 A1       1885  4514 		UCB$L_DEVDEPEND(R1),20$
                       50   0D   D0  1888  4515 	MOVL	#MSCP$K_ST_BOT,R0
                            10   A8  188B  4516 	BISW	#MSCP$M_EF_SEREX,-
                         09 A2       188D  4517 		MSCP$B_FLAGS(R2)	
                                     188F  4518 
                                     188F  4519 ;
                                     188F  4520 ; Initialize a CDRP that SCS can use to send the retrieved data to the 
                                     188F  4521 ; requesting system.
                                     188F  4522 ;
                                     188F  4523 
                                     188F  4524 20$:
                    51   54 A3   D0  188F  4525 	MOVL	HRB$L_HQB(R3),R1	; Get the HQB address 
                         28 A1   D0  1893  4526 	MOVL	HQB$L_CDT(R1),-		; Get the address of the CDT 
                         24 A5       1896  4527 		CDRP$L_CDT(R5)		;  and place it in the CDRP for the call
                         46 A3   D0  1898  4528 	MOVL	HRB$L_BCNT(R3),-	; Use the number of bytes retrieved
                         3C A5       189B  4529 		CDRP$L_XCT_LEN(R5)	;  as the number to send to host
                         10 A2   DE  189D  4530 	MOVAL	MSCP$B_BUFFER(R2),-	; Get the remote buffer handle
                         34 A5       18A0  4531 		CDRP$L_RBUFH_AD(R5)	;  and save it for the call
                         38 A5   D4  18A2  4532 	CLRL	CDRP$L_RBOFF(R5)	; Set the remote buffer offset.
                         20 A3   DE  18A5  4533 	MOVAL	HRB$B_LBUFF(R3),-	; Define the local buffer handle as
                         2C A5       18A8  4534 		CDRP$L_LBUFH_AD(R5)	;  the address of LBUFF
                         30 A5   D4  18AA  4535 	CLRL	CDRP$L_LBOFF(R5)	;  in the remote and local buffers
                    54   5C A3   D0  18AD  4536 	MOVL	HRB$L_PDT(R3),R4	; Get the PDT address for the SCS call
                            04   B0  18B1  4537 	MOVW	#HRB$K_ST_SNDAT_WAIT,-	; Set the state of this request to
                         14 A3       18B3  4538 		HRB$W_STATE(R3)		;  SCS block transfer
                                     18B5  4539 	SEND_DATA			; Send to remote host's buffer.
                   00000000'GF   16  18B5       		JSB	G^SCS$ALLOC_RSPID
                         14 B4   16  18BB       		JSB	@PDT$L_ALLOCMSG(R4)
                         03 50   E9  18BE       		BLBC	R0,30071$
                         54 B4   16  18C1       		JSB	@PDT$L_SENDDATA(R4)
                                     18C4       	30071$:
                                     18C4  4540 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  98
X-17                            - READ     (- 33 -)                      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (36)

                                     18C4  4541 ;
                                     18C4  4542 ; This thread is suspended until the block transfer completes. At that time,
                                     18C4  4543 ; control is returned here with the following registers:
                                     18C4  4544 ;
                                     18C4  4545 ;		R0  =  status
                                     18C4  4546 ; 		R3  =  Host Request Buffer address
                                     18C4  4547 ;		R4  =  PDT address
                                     18C4  4548 ;		R5  =  CDRP address
                                     18C4  4549 ;
                                     18C4  4550 	.IF DEFINED DEBUG$PC_HISTORY
                                     18C4  4551 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     18C4  4552 	.ENDC	   ;DEBUG$PC_HISTORY
                       8000 8F   A8  18C4  4553 	BISW	#HRB$M_STATE_INVALID,-	; The state of this request is "current"
                         14 A3       18C8  4554 		HRB$W_STATE(R3)		;  leave the old state for diagnosis
                         42 50   E9  18CA  4555 	BLBC	R0,TMSCP$ABORT_READ	; If the send was not successful 
                                 B3  18CD  4556 	BITW	#<HRB$M_ABORT!-		;  or if this request has been aborted,
                                     18CE  4557 		HRB$M_ABORTWS>,-	;  or canceled,
                    16 A3   03       18CE  4558 		HRB$W_FLAGS(R3)		;  just clean everything up
                            3C   12  18D1  4559 	BNEQ	TMSCP$ABORT_READ
                                     18D3  4560 ;
                                     18D3  4561 ; Update the byte count transferred, and send the end packet.
                                     18D3  4562 ;
                                     18D3  4563 
                                     18D3  4564 30$:
                    52   18 A3   D0  18D3  4565 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                    51   1C A3   D0  18D7  4566 	MOVL	HRB$L_IRP_CDRP(R3),R1	; Get the address of the IRP
                 20 A2   3A A1   3C  18DB  4567 	MOVZWL	2+IRP$L_IOST1(R1), -	; Get number of bytes actually 
                                     18E0  4568 		MSCP$L_TAPEREC(R2)	;  transferred.
                    51   58 A3   D0  18E0  4569 	MOVL	HRB$L_UQB(R3),R1	; Get the UQB
                    51   24 A1   D0  18E4  4570 	MOVL	UQB$L_UCB(R1),R1	;  and then the UCB.
                       00C4 C1   D0  18E8  4571 	MOVL	UCB$L_RECORD(R1),-	; Retrieve the position information
                         1C A2       18EC  4572 		MSCP$L_POSITION(R2)	;  to send back in the end packet.
                            05   E1  18EE  4573 	BBC	#DEV$V_MSCP,-		; If we are not dealing with an MSCP
                      06 40 A1       18F0  4574 		UCB$L_DEVCHAR2(R1),35$	;  device, then we can get the record
                       0080 C3   D0  18F3  4575 	MOVL	HRB$L_RECORD(R3),-	;  count out of the HRB since the 
                         1C A2       18F7  4576 		MSCP$L_POSITION(R2)	;  class driver set it for us.
                                     18F9  4577 
                                     18F9  4578 35$:
                    51   1C A3   D0  18F9  4579 	MOVL	HRB$L_IRP_CDRP(R3),R1	; Get the address of the IRP
                    50   38 A1   3C  18FD  4580 	MOVZWL	IRP$L_IOST1(R1),R0	; Get transfer completion status.
                         05 50   E8  1901  4581 	BLBS	R0,37$			; If status is success, continue
                          0548   30  1904  4582 	BSBW	TMSCP$CHECK_XFER_STATUS	; Check the error code
                            03   11  1907  4583 	BRB	40$			;  and send back end packet
                                     1909  4584 
                                     1909  4585 37$:
                       50   00   D0  1909  4586 	MOVL	#MSCP$K_ST_SUCC,R0	; This command has completed successfuly
                                     190C  4587 	.IF DEFINED DEBUG$CURRENT_SANITY
                                     190C  4588 	BSBW	TMSCP$CHECK_CURRENT	; Sanity check the current counters
                                     190C  4589 	.ENDC	   ;DEBUG$CURRENT_SANITY
                                     190C  4590 
                                     190C  4591 40$:
                          072B   31  190C  4592 	BRW	TMSCP$SEND_END		; Send an end packet with R0 status
                                     190F  4593 
                                     190F  4594 ;
                                     190F  4595 ; If the send data was unsuccessful, just free the allocated resources, and
                                     190F  4596 ; this request is finished off.
                                     190F  4597 ; 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page  99
X-17                            - READ     (- 33 -)                      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (36)

                                     190F  4598 
                                     190F  4599 TMSCP$ABORT_READ::
                                     190F  4600 	.IF DEFINED DEBUG$PC_HISTORY
                                     190F  4601 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     190F  4602 	.ENDC	   ;DEBUG$PC_HISTORY
                            00   E0  190F  4603 	BBS	#HRB$V_ABORT,-		; If this request was aborted due to a
                      0A 16 A3       1911  4604 		HRB$W_FLAGS(R3),10$	;  disconnect, no end msg is necessary
                    52   18 A3   D0  1914  4605 	MOVL	HRB$L_MSGBUF(R3),R2	; Get the message buffer address 
                       50   02   D0  1918  4606 	MOVL	#MSCP$K_ST_ABRTD,R0	; Set the status to aborted
                          071C   31  191B  4607 	BRW	TMSCP$SEND_END		;  and send out an end message
                                     191E  4608 
                                     191E  4609 10$:
                          0407   31  191E  4610 	BRW	TMSCP$CLEANUP_HRB	; Deallocate the resources used.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 100
X-17                            - WRITE_TAPE_MARK                        16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (37)

                                     1921  4613 	.SBTTL	-	WRITE_TAPE_MARK
                                     1921  4614 
                                     1921  4615 ;+
                                     1921  4616 ;
                                     1921  4617 ; Write an extended interrecord gap followed by a tape mark.
                                     1921  4618 ;	
                                     1921  4619 ; If the immediate completion modifier was set, send the end packet back 
                                     1921  4620 ; immediately, returning success.
                                     1921  4621 ;
                                     1921  4622 ; Inputs:
                                     1921  4623 ;
                                     1921  4624 ;	R0  =  Scratch
                                     1921  4625 ;	R1  =  Scratch
                                     1921  4626 ;	R2  =  MSCP packet address
                                     1921  4627 ;	R3  =  HRB address
                                     1921  4628 ;	R4  =  UQB address, scratch
                                     1921  4629 ;	R5  =  Scratch
                                     1921  4630 ;
                                     1921  4631 ; Outputs:
                                     1921  4632 ;
                                     1921  4633 ;	R0  =  Write completion status
                                     1921  4634 ;	R2  =  MSCP packet address
                                     1921  4635 ;	R3  =  HRB address
                                     1921  4636 ;-
                                     1921  4637 
                                     1921  4638 TMSCP$WRITE_TAPE_MARK::
                                     1921  4639 	.IF DEFINED DEBUG$PC_HISTORY
                                     1921  4640 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1921  4641 	.ENDC	   ;DEBUG$PC_HISTORY
                    55   1C A3   D0  1921  4642 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Set up IRP-CDRP pair.
                            1C   B0  1925  4643 	MOVW	#IO$_WRITEMARK,-	;  before checking anything
                         20 A5       1927  4644 		IRP$W_FUNC(R5)		;  else.
                          F8C1   30  1929  4645 	BSBW	TMSCP$SET_CLEAR_SEX	; Set clear serious exception
                                     192C  4646 ;
                                     192C  4647 ; Use the IMMEDIATE COMPLETION opcode modifier bit passed in the packet.
                                     192C  4648 ;
                            06   E1  192C  4649 	BBC	#MSCP$V_MD_IMMED,-	; Immediate completion specified?
                      06 0A A2       192E  4650 		MSCP$W_MODIFIER(R2),10$ ; If not, don't change op code.
                       0080 8F   A8  1931  4651 	BISW	#IO$M_NOWAIT,-		; Set nowait in the function itself
                         20 A5       1935  4652 		IRP$W_FUNC(R5)		;    (to returm imediately)
                                     1937  4653 10$:
                          F908   30  1937  4654 	BSBW	TMSCP$SET_CLEAR_CDL	; Set clear cached data lost
                                     193A  4655 
                                     193A  4656 ;
                                     193A  4657 ; The IRP is queue to the local driver. If the command is aborted during
                                     193A  4658 ; this thread, the request is finished off in subroutine TMSCP$BACK and 
                                     193A  4659 ; resources are deallocated.
                                     193A  4660 ;
                                     193A  4661 
                         24 A4   D0  193A  4662 	MOVL	UQB$L_UCB(R4),-		;  Save the UCB address in IRP.
                         1C A5       193D  4663 		IRP$L_UCB(R5)
                    14 A5   53   D0  193F  4664 	MOVL	R3,IRP$L_HRB(R5)	; Save HRB for I/O completion
                                     1943  4665 
                                     1943  4666 ;
                                     1943  4667 ;	R0  =  Scratch
                                     1943  4668 ;	R1  =  Scratch
                                     1943  4669 ;	R2  =  Scratch
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 101
X-17                            - WRITE_TAPE_MARK                        16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (37)

                                     1943  4670 ;	R3  =  HRB address
                                     1943  4671 ;	R4  =  UQB address
                                     1943  4672 ;	R5  =  Scratch
                                     1943  4673 ;
                                     1943  4674 
                          01EF   30  1943  4675 	BSBW	TMSCP$DRIVE_TRANSFER	; Do the tape transfer
                                     1946  4676 
                                     1946  4677 ;
                                     1946  4678 ; Control returns here from entry point TMSCP$BACK. 
                                     1946  4679 ;
                                     1946  4680 ;	R0  =  I/O status block, scratch
                                     1946  4681 ;	R1  =  Scratch
                                     1946  4682 ;	R2  =  Scratch
                                     1946  4683 ;	R3  =  HRB address
                                     1946  4684 ;	R4  =  UQB address
                                     1946  4685 ;	R5  =  IRP address
                                     1946  4686 ;
                                     1946  4687 
                         05 50   E8  1946  4688 	BLBS	R0,25$			; If the transfer was successful, cont...
                          0503   30  1949  4689 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.
                            03   11  194C  4690 	BRB	30$			;
                                     194E  4691 
                                     194E  4692 25$:
                       50   00   3C  194E  4693 	MOVZWL	#MSCP$K_ST_SUCC,R0	; Set success for return
                                     1951  4694 ;
                                     1951  4695 ; Final clean up for transfer commands.  Set status, release resources.
                                     1951  4696 ;
                                     1951  4697 
                                     1951  4698 30$:
                    55   1C A3   D0  1951  4699 	MOVL	HRB$L_IRP_CDRP(R3), R5	; Get the IRP address
                    54   58 A3   D0  1955  4700 	MOVL	HRB$L_UQB(R3),R4	; Restore UQB address
                    51   24 A4   D0  1959  4701 	MOVL	UQB$L_UCB(R4),R1	; Restore UCB address
                       00C4 C1   D0  195D  4702 	MOVL	UCB$L_RECORD(R1),-	; Initialize the MCSP position
                       00C4 C4       1961  4703 		UQB$L_POSITION(R4)	;  with the UCB record count
                            05   E1  1964  4704 	BBC	#DEV$V_MSCP,-		; If we are not dealing with an MSCP
                      07 40 A1       1966  4705 		UCB$L_DEVCHAR2(R1),50$	;  device, then we can get the record
                       0080 C3   D0  1969  4706 	MOVL	HRB$L_RECORD(R3),-	;  count out of the HRB since the 
                       00C4 C4       196D  4707 		UQB$L_POSITION(R4)	;  class driver set it for us.
                                     1970  4708 
                                     1970  4709 50$:
                    52   18 A3   D0  1970  4710 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                 20 A2   3A A5   3C  1974  4711 	MOVZWL	2+IRP$L_IOST1(R5), -	; Save the byte count 
                                     1979  4712 		MSCP$L_TAPEREC(R2)	;  to be returned in the end packet
                       00C4 C4   D0  1979  4713 	MOVL	UQB$L_POSITION(R4),-	; Retrieve the position information
                         1C A2       197D  4714 		MSCP$L_POSITION(R2)	;  to send back in the end packet.
                          06B8   31  197F  4715 	BRW	TMSCP$SEND_END		; Send an end packet with R0 status
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 102
X-17                            - WRITE     (- 34 -)                     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (38)

                                     1982  4718 	.SBTTL	-	WRITE					(- 34 -)
                                     1982  4719 
                                     1982  4720 ;+
                                     1982  4721 ; Functional Description:
                                     1982  4722 ;
                                     1982  4723 ; This routine is called to process an MSCP write request. The information 
                                     1982  4724 ; the cluster member wishes to place on the tape is transferred to the local
                                     1982  4725 ; serving processor (subject to availability of resources on that processor),
                                     1982  4726 ; and from there is written on to tape.
                                     1982  4727 ;
                                     1982  4728 ; If the immediate completion modifier was set, send the end packet back as
                                     1982  4729 ; soon as the remote host's data is buffered locally. In this case, the
                                     1982  4730 ; end packet always returns success.
                                     1982  4731 ;
                                     1982  4732 ; Inputs:
                                     1982  4733 ;
                                     1982  4734 ;	R0  =  Scratch
                                     1982  4735 ;	R1  =  Scratch
                                     1982  4736 ;	R2  =  MSCP packet address
                                     1982  4737 ;	R3  =  HRB address
                                     1982  4738 ;	R4  =  UQB address, scratch
                                     1982  4739 ;	R5  =  Scratch
                                     1982  4740 ;
                                     1982  4741 ; Outputs:
                                     1982  4742 ;
                                     1982  4743 ;	R0  =  Write completion status
                                     1982  4744 ;	R2  =  MSCP packet address
                                     1982  4745 ;	R3  =  HRB address
                                     1982  4746 ;-
                                     1982  4747 
                                     1982  4748 TMSCP$WRITE::
                                     1982  4749 	.IF DEFINED DEBUG$PC_HISTORY
                                     1982  4750 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1982  4751 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1982  4752 
                                     1982  4753 ;
                                     1982  4754 ; Before doing anything make sure that the unit is not write locked.
                                     1982  4755 ;
                                 B3  1982  4756 	BITW	#<MSCP$M_UF_WRTPS!-	; If this unit is not hardware
                                     1983  4757 		MSCP$M_UF_WRTPD!-	;  data safety write protected or
                                     1983  4758 		MSCP$M_UF_WRTPH>,-	;  or software write protected,
               16 A4   3100 8F       1983  4759 		UQB$W_UNIT_FLAGS(R4)	;  then
                            0B   13  1988  4760 	BEQL	TMSCP$DO_WRT		;  go ahead and allow the write
                            20   A8  198A  4761 	BISW	#UQB$M_ST_SEREX,-	; Set serious exception
                       00C8 C4       198C  4762 		UQB$W_ST_FLAGS(R4)
                       50   06   D0  198F  4763 	MOVL	#MSCP$K_ST_WRTPR,R0	; Otherwise, set an error status
                          06A5   31  1992  4764 	BRW	TMSCP$SEND_END		; ... and return an end message
                                     1995  4765 
                                     1995  4766 TMSCP$DO_WRT::
                                     1995  4767 
                                     1995  4768 ;
                                     1995  4769 ; Allocate a local buffer area to use during the transfer, and map 
                                     1995  4770 ; that area for use by SCS routines.
                                     1995  4771 ;
                                     1995  4772 
                          0149   30  1995  4773 	BSBW	TMSCP$ALLOCATE		; Find some local memory for the xfer
                         0E 50   E8  1998  4774 	BLBS	R0,12$                  ; if successful continue on
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 103
X-17                            - WRITE     (- 34 -)                     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (38)

                  50   012A 8F   3C  199B  4775         MOVZWL	#<MSCP$K_SC_MEMER@ -    ; otherwise set Controller error
                                     19A0  4776 		MSCP$V_ST_SBCOD! -      ; with subcode of memory error
                                     19A0  4777 		MSCP$K_ST_CNTLR>,R0	; 
                         20 A2   D4  19A0  4778         CLRL	MSCP$L_TAPEREC(R2)	; clear to indicate transfer failure
                         0C A2   D4  19A3  4779         CLRL	MSCP$L_BYTE_CNT(R2)
                          0691   31  19A6  4780 	BRW	TMSCP$SEND_END		; and return an end message
                                     19A9  4781 12$:
                                     19A9  4782 ;
                                     19A9  4783 ; Now prepare the CDRP for mapping the local buffer just allocated
                                     19A9  4784 ; for use by SCS.
                                     19A9  4785 ;
                    55   1C A3   D0  19A9  4786 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the IRP base address
                    55   60 A5   DE  19AD  4787 	MOVAL	IRP$L_FQFL(R5),R5	; Move down to the CDRP portion
                         20 A3   DE  19B1  4788 	MOVAL	HRB$B_LBUFF(R3),-	; Define the local buffer handle as
                         2C A5       19B4  4789 		CDRP$L_LBUFH_AD(R5)	;  the address of LBUFF
                    54   54 A3   D0  19B6  4790 	MOVL	HRB$L_HQB(R3),R4	; Get the HQB temporarily
                         28 A4   D0  19BA  4791 	MOVL	HQB$L_CDT(R4),-		;  so we can put a fresh CDT address
                         24 A5       19BD  4792 		CDRP$L_CDT(R5)		;  in the CDRP
                    54   5C A3   D0  19BF  4793 	MOVL	HRB$L_PDT(R3),R4	; Pick up the PDT address
                            06   B0  19C3  4794 	MOVW	#HRB$K_ST_MAP_WAIT,-	; Set the state of this request to 
                         14 A3       19C5  4795 		HRB$W_STATE(R3)		;  mapping a buffer
                                     19C7  4796 
                                     19C7  4797 ;		Verify that the HRB fields are in the same order as the IRP fields.
                                     19C7  4798 ;		This is  a requirement of the MAP function.
                                     19C7  4799 
                                     19C7  4800 	ASSUME	<HRB$W_BOFF-HRB$L_SVAPTE> EQ <IRP$W_BOFF-IRP$L_SVAPTE>
                                     19C7  4801 	ASSUME	<HRB$L_BCNT-HRB$L_SVAPTE> EQ <IRP$L_BCNT-IRP$L_SVAPTE>
                                     19C7  4802 
                                     19C7  4803 ;		Verify that the correct base address is used.
                                     19C7  4804 
                                     19C7  4805 	ASSUME	HRB$W_BOFF GT HRB$L_SVAPTE
                                     19C7  4806 	ASSUME	HRB$L_BCNT GT HRB$L_SVAPTE
                                     19C7  4807 
                    51   40 A3   DE  19C7  4808 	MOVAL	HRB$L_SVAPTE(R3),R1	; Address of the three longword buffer
                            52   D4  19CB  4809 	CLRL	R2			; Access mode of transfer is kernel
                                     19CD  4810 	MAP				; Map the buffer
                         2C B4   16  19CD       		JSB	@PDT$L_MAP(R4)
                       8000 8F   A8  19D0  4811 	BISW	#HRB$M_STATE_INVALID,-	; The state of this request is "current"
                         14 A3       19D4  4812 		HRB$W_STATE(R3)		;  leave the old state for diagnosis
                                     19D6  4813 
                                     19D6  4814 ;
                                     19D6  4815 ; Since the processing of this request can be stalled while waiting for
                                     19D6  4816 ; the local buffer to be mapped, we need to check to see if the request
                                     19D6  4817 ; has been canceled before going on.
                                     19D6  4818 ;
                            10   A8  19D6  4819 	BISW	#HRB$M_MAP,-		; Indicate that we have allocated 
                         16 A3       19D8  4820 		HRB$W_FLAGS(R3)		;  mapping resources for this request
                                 B3  19DA  4821 	BITW	#<HRB$M_ABORT!-		; If this command has not been aborted
                                     19DB  4822 		HRB$M_ABORTWS>,-	;  or canceled,
                    16 A3   03       19DB  4823 		HRB$W_FLAGS(R3)		;  then continue on...
                            03   13  19DE  4824 	BEQL	TMSCP$WRITE_TRANSFER
                          00EC   31  19E0  4825 	BRW	TMSCP$ABORT_WRITE	;  otherwise abort this request here
                                     19E3  4826 
                                     19E3  4827 TMSCP$WRITE_TRANSFER::
                    55   1C A3   D0  19E3  4828 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the address of the IRP
                    55   60 A5   DE  19E7  4829 	MOVAL	IRP$L_FQFL(R5),R5	; Move from the IRP to the CDRP address
                                     19EB  4830 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 104
X-17                            - WRITE     (- 34 -)                     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (38)

                                     19EB  4831 ;
                                     19EB  4832 ; Initialize a CDRP that SCS can use to send the retrieved data to the 
                                     19EB  4833 ; requesting system.
                                     19EB  4834 ;
                    51   54 A3   D0  19EB  4835 	MOVL	HRB$L_HQB(R3),R1	; Get the HQB address 
                         28 A1   D0  19EF  4836 	MOVL	HQB$L_CDT(R1),-		; Get the address of the CDT 
                         24 A5       19F2  4837 		CDRP$L_CDT(R5)		;  and place it in the CDRP for the call
                         46 A3   D0  19F4  4838 	MOVL	HRB$L_BCNT(R3),-	; Use the number of bytes retrieved
                         3C A5       19F7  4839 		CDRP$L_XCT_LEN(R5)	;  as the number to send to host
                    52   18 A3   D0  19F9  4840 	MOVL	HRB$L_MSGBUF(R3),R2	; Get the MSCP packet address back
                         10 A2   DE  19FD  4841 	MOVAL	MSCP$B_BUFFER(R2),-	; Get the remote buffer handle
                         34 A5       1A00  4842 		CDRP$L_RBUFH_AD(R5)	;  and save it for the call
                         38 A5   D4  1A02  4843 	CLRL	CDRP$L_RBOFF(R5)	; Set the remote buffer offset.
                         20 A3   DE  1A05  4844 	MOVAL	HRB$B_LBUFF(R3),-	; Define the local buffer handle as
                         2C A5       1A08  4845 		CDRP$L_LBUFH_AD(R5)	;  the address of LBUFF
                         30 A5   D4  1A0A  4846 	CLRL	CDRP$L_LBOFF(R5)	;  in the remote and local buffers
                    54   5C A3   D0  1A0D  4847 	MOVL	HRB$L_PDT(R3),R4	; Get the PDT address for the SCS call
                            04   B0  1A11  4848 	MOVW	#HRB$K_ST_SNDAT_WAIT,-	; Reflect in the state, that we are
                         14 A3       1A13  4849 		HRB$W_STATE(R3)		;  awaiting data arrival from the host
                                     1A15  4850 	REQUEST_DATA			; Get the data from host
                   00000000'GF   16  1A15       		JSB	G^SCS$ALLOC_RSPID
                         14 B4   16  1A1B       		JSB	@PDT$L_ALLOCMSG(R4)
                         03 50   E9  1A1E       		BLBC	R0,30072$
                         50 B4   16  1A21       		JSB	@PDT$L_REQDATA(R4)
                                     1A24       	30072$:
                                     1A24  4851 
                                     1A24  4852 ;
                                     1A24  4853 ; This thread is suspended until the block transfer completes. At that time,
                                     1A24  4854 ; control is returned here with the following registers:
                                     1A24  4855 ;
                                     1A24  4856 ;		R0  =  Status
                                     1A24  4857 ;		R3  =  HRB address
                                     1A24  4858 ;		R4  =  PDT address
                                     1A24  4859 ;		R5  =  CDRP address
                                     1A24  4860 ;
                       8000 8F   A8  1A24  4861 	BISW	#HRB$M_STATE_INVALID,-	; Set the invalid bit showing this
                         14 A3       1A28  4862 		HRB$W_STATE(R3)		;  as a stale state
                         03 50   E8  1A2A  4863 	BLBS	R0,5$			; Everything looks good so far
                          009F   31  1A2D  4864 	BRW	TMSCP$ABORT_WRITE	; If the request failed, abort the cmd
                                     1A30  4865 
                                     1A30  4866 5$:
                                 B3  1A30  4867 	BITW	#<HRB$M_ABORT!-		; Check to make sure this request 
                                     1A31  4868 		HRB$M_ABORTWS>,-	;  has not been aborted while receiving
                    16 A3   03       1A31  4869 		HRB$W_FLAGS(R3)		;  data from the client system
                            03   13  1A34  4870 	BEQL	9$			; If it has not been aborted, continue..
                          0096   31  1A36  4871 	BRW	TMSCP$ABORT_WRITE	;  otherwise, do the proper cleanup
                                     1A39  4872 
                                     1A39  4873 ;
                                     1A39  4874 ; Prepare the IRP for a tape transfer, so the data can be transferred to
                                     1A39  4875 ; the tape.
                                     1A39  4876 ;
                                     1A39  4877 
                                     1A39  4878 9$:
                         60 A3   D7  1A39  4879 	DECL	HRB$L_CMD_STS(R3)	; Report progress on this request
                    55   1C A3   D0  1A3C  4880 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the address of the IRP
                    54   58 A3   D0  1A40  4881 	MOVL	HRB$L_UQB(R3),R4	; Get the UQB address
                         24 A4   D0  1A44  4882 	MOVL	UQB$L_UCB(R4),-		;  so we can pull out the UCB address
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 105
X-17                            - WRITE     (- 34 -)                     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (38)

                         1C A5       1A47  4883 		IRP$L_UCB(R5)		;  and save it away in the IRP
                         18 A5   D4  1A49  4884 	CLRL	IRP$L_WIND(R5)		; No window control blocks in the server
                         22 A5   94  1A4C  4885 	CLRB	IRP$B_EFN(R5)		; Clear out the event flag number
                         28 A5   B4  1A4F  4886 	CLRW	IRP$W_CHAN(R5)		; Clear the process I/O channel number
                         2A A5   B4  1A52  4887 	CLRW	IRP$W_STS(R5)		; Start out with a clear status field
                         40 A3   D0  1A55  4888 	MOVL	HRB$L_SVAPTE(R3),-	; Move the local buffer
                         2C A5       1A58  4889 		IRP$L_SVAPTE(R5)	;  virtual page table entry,
                         44 A3   B0  1A5A  4890 	MOVW	HRB$W_BOFF(R3),-	;  the byte offset within the page,
                         30 A5       1A5D  4891 		IRP$W_BOFF(R5)		;  of the start of the buffer
                         46 A3   D0  1A5F  4892 	MOVL	HRB$L_BCNT(R3),-	;  and the byte count to be used for
                         32 A5       1A62  4893 		IRP$L_BCNT(R5)		;  this (portion of the) transfer.
                    14 A5   53   D0  1A64  4894 	MOVL	R3,IRP$L_HRB(R5)	; Set the HRB address for IO completion
                                     1A68  4895 
                                     1A68  4896 ;
                                     1A68  4897 ; Check for any supported modifiers in the MSCP request. If they are set
                                     1A68  4898 ; there, then we should set them in the IRP we send out also.
                                     1A68  4899 ;
                       50   0B   B0  1A68  4900 	MOVW	#IO$_WRITEPBLK,R0	; Set the function code
                    52   18 A3   D0  1A6B  4901 	MOVL	HRB$L_MSGBUF(R3),R2	; Get back the MSCP packet address
                            0E   E1  1A6F  4902 	BBC	#MSCP$V_MD_COMP,-	; If the compare modifier was set in
                      05 0A A2       1A71  4903 		MSCP$W_MODIFIER(R2),10$	;  the MSCP packet,
                  50   4000 8F   A8  1A74  4904 	BISW	#IO$M_DATACHECK,R0	;  then set it in the IRP also
                                     1A79  4905 
                                     1A79  4906 10$:
                            08   E1  1A79  4907 	BBC	#MSCP$V_MD_SEREC,-	; If the  modifier was set in
                      05 0A A2       1A7B  4908 		MSCP$W_MODIFIER(R2),12$	;  the MSCP packet,
                  50   8000 8F   A8  1A7E  4909 	BISW	#IO$M_INHRETRY,R0	;  then set it in the IRP also
                                     1A83  4910 
                                     1A83  4911 12$:
                    20 A5   50   B0  1A83  4912 	MOVW	R0,IRP$W_FUNC(R5)	; Fill in the function code
                          F763   30  1A87  4913 	BSBW	TMSCP$SET_CLEAR_SEX
                          F78B   30  1A8A  4914 	BSBW	TMSCP$SET_IMMED		; Set immediate completion
                          F7B2   30  1A8D  4915 	BSBW	TMSCP$SET_CLEAR_CDL	; Set clear cached data lost
                                     1A90  4916 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1A90  4917 	MOVL	IRP$L_BCNT(R5), R0	; Get the transfer length.
                                     1A90  4918 	BSBW	TMSCP$PCHIST_R3R0	; Log the value for debugging.
                                     1A90  4919 	.ENDC  ;DEBUG$PC_HISTORY
                                     1A90  4920 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1A90  4921 	MOVZWL	IRP$W_FUNC(R5), R0	; Get the function value.
                                     1A90  4922 	BSBW	TMSCP$R0HIST		; Log the value for debugging.
                                     1A90  4923 	.ENDC  ;DEBUG$PC_HISTORY
                                     1A90  4924 
                                     1A90  4925 ;
                                     1A90  4926 ; The IRP is queue to the local driver. If the command is aborted during
                                     1A90  4927 ; this thread, the request is finished off in subroutine TMSCP$BACK and 
                                     1A90  4928 ; resources are deallocated.
                                     1A90  4929 ;
                                     1A90  4930 ;	R0  =  Scratch
                                     1A90  4931 ;	R1  =  Scratch
                                     1A90  4932 ;	R2  =  Scratch
                                     1A90  4933 ;	R3  =  HRB address
                                     1A90  4934 ;	R4  =  UQB address
                                     1A90  4935 ;	R5  =  Scratch
                                     1A90  4936 ;
                                     1A90  4937 
                          00A2   30  1A90  4938 	BSBW	TMSCP$DRIVE_TRANSFER	; Do the tape transfer
                                     1A93  4939 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 106
X-17                            - WRITE     (- 34 -)                     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (38)

                                     1A93  4940 ;
                                     1A93  4941 ; Control returns here from entry point TMSCP$BACK. 
                                     1A93  4942 ;
                                     1A93  4943 ;	R0  =  I/O status block, scratch
                                     1A93  4944 ;	R1  =  Scratch
                                     1A93  4945 ;	R2  =  Scratch
                                     1A93  4946 ;	R3  =  HRB address
                                     1A93  4947 ;	R4  =  UQB address
                                     1A93  4948 ;	R5  =  IRP address
                                     1A93  4949 ;
                                     1A93  4950 
                         05 50   E8  1A93  4951 	BLBS	R0,26$			; If the transfer was successful, cont...
                          03B6   30  1A96  4952 	BSBW	TMSCP$CHECK_XFER_STATUS	;  otherwise, return proper status.
                            03   11  1A99  4953 	BRB	30$			;
                                     1A9B  4954 
                                     1A9B  4955 26$:
                       50   00   3C  1A9B  4956 	MOVZWL	#MSCP$K_ST_SUCC,R0	; Set success for return
                                     1A9E  4957 
                                     1A9E  4958 ;
                                     1A9E  4959 ; Final clean up for transfer commands.  Set status, release resources.
                                     1A9E  4960 ;
                                     1A9E  4961 
                                     1A9E  4962 30$:
                    54   58 A3   D0  1A9E  4963 	MOVL	HRB$L_UQB(R3),R4	; Restore UQB address
                    51   24 A4   D0  1AA2  4964 	MOVL	UQB$L_UCB(R4),R1	; Restore UCB address
                       00C4 C1   D0  1AA6  4965 	MOVL	UCB$L_RECORD(R1),-	; Initialize the MCSP position
                       00C4 C4       1AAA  4966 		UQB$L_POSITION(R4)	;  with the UCB record count
                            05   E1  1AAD  4967 	BBC	#DEV$V_MSCP,-		; If we are not dealing with an MSCP
                      07 40 A1       1AAF  4968 		UCB$L_DEVCHAR2(R1),50$	;  device, then we can get the record
                       0080 C3   D0  1AB2  4969 	MOVL	HRB$L_RECORD(R3),-	;  count out of the HRB since the 
                       00C4 C4       1AB6  4970 		UQB$L_POSITION(R4)	;  class driver set it for us.
                                     1AB9  4971 
                                     1AB9  4972 50$:
                    52   18 A3   D0  1AB9  4973 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                    51   1C A3   D0  1ABD  4974 	MOVL	HRB$L_IRP_CDRP(R3),R1	; Get the address of the IRP
                 20 A2   3A A1   3C  1AC1  4975 	MOVZWL	2+IRP$L_IOST1(R1), -	; Save the byte count
                                     1AC6  4976 		MSCP$L_TAPEREC(R2)	;  to be returned in the end packet
                       00C4 C4   D0  1AC6  4977 	MOVL	UQB$L_POSITION(R4),-	; Retrieve the position information
                         1C A2       1ACA  4978 		MSCP$L_POSITION(R2)	;  to send back in the end packet.
                          056B   31  1ACC  4979 	BRW	TMSCP$SEND_END		; Send an end packet with R0 status
                                     1ACF  4980 
                                     1ACF  4981 TMSCP$ABORT_WRITE::
                                     1ACF  4982 	.IF DEFINED DEBUG$PC_HISTORY
                                     1ACF  4983 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1ACF  4984 	.ENDC	   ;DEBUG$PC_HISTORY
                            00   E0  1ACF  4985 	BBS	#HRB$V_ABORT,-		; If this request was aborted due to a
                      0A 16 A3       1AD1  4986 		HRB$W_FLAGS(R3),10$	;  disconnect, no end msg is necessary
                    52   18 A3   D0  1AD4  4987 	MOVL	HRB$L_MSGBUF(R3),R2	; Get the message buffer address 
                       50   02   D0  1AD8  4988 	MOVL	#MSCP$K_ST_ABRTD,R0	; Set the status to aborted
                          055C   31  1ADB  4989 	BRW	TMSCP$SEND_END		;  and send out an end message
                                     1ADE  4990 
                                     1ADE  4991 10$:
                          0247   31  1ADE  4992 	BRW	TMSCP$CLEANUP_HRB	; Deallocate the resources used.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 107
X-17                            Utility Routines                         16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (39)

                                     1AE1  4995 	.SBTTL	Utility Routines
                                     1AE1  4996 	.SBTTL	-	ALLOCATE - Allocate a local buffer for the request
                                     1AE1  4997 
                                     1AE1  4998 ;+
                                     1AE1  4999 ; Functional Description:
                                     1AE1  5000 ;
                                     1AE1  5001 ; This routine allocates a buffer on the serving node based on the 
                                     1AE1  5002 ; transfer size described in the MSCP request received. 
                                     1AE1  5003 ;
                                     1AE1  5004 ; Inputs:
                                     1AE1  5005 ;
                                     1AE1  5006 ;	R0  =  Scratch
                                     1AE1  5007 ;	R1  =  Scratch (SS$_NORMAL or SS$_INSFMEM)
                                     1AE1  5008 ;	R2  =  MSCP packet address
                                     1AE1  5009 ;	R3  =  HRB address
                                     1AE1  5010 ;	R4  =  UQB address, scratch
                                     1AE1  5011 ;	R5  =  Scratch
                                     1AE1  5012 ;
                                     1AE1  5013 ; Output:
                                     1AE1  5014 ;       R0  =  Status
                                     1AE1  5015 ;	R2  =  MSCP packet address
                                     1AE1  5016 ;	R3  =  HRB address
                                     1AE1  5017 ;
                                     1AE1  5018 ; Side Effects:
                                     1AE1  5019 ;
                                     1AE1  5020 ;	HRB$L_BCNT	filled in with the byte count from the MSCP packet.
                                     1AE1  5021 ;	HRB$L_OBCNT	filled in with the byte count from the MSCP packet
                                     1AE1  5022 ;	HRB$L_BUFLEN	is filled in with the length of the allocated buffer
                                     1AE1  5023 ;	HRB$L_BUFADR	is filled in with the address of the allocated buffer
                                     1AE1  5024 ;	HRB$L_SVAPTE	address of virtual page table entry for the buffer
                                     1AE1  5025 ;	HRB$W_BOFF	byte offset into the page table of start of buffer
                                     1AE1  5026 ;-
                                     1AE1  5027 
                                     1AE1  5028 	.ENABLE	LSB
                                     1AE1  5029 
                                     1AE1  5030 TMSCP$ALLOCATE::
                                     1AE1  5031 	.IF DEFINED DEBUG$PC_HISTORY
                                     1AE1  5032 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1AE1  5033 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1AE1  5034 
                                     1AE1  5035 ;
                                     1AE1  5036 ; Set up the count fields in the HRB to their initial values. 
                                     1AE1  5037 ;
                                     1AE1  5038 
                         0C A2   D0  1AE1  5039 	MOVL	MSCP$L_BYTE_CNT(R2),-	; Initialize byte count
                         38 A3       1AE4  5040 		HRB$L_OBCNT(R3)		;
                    51   38 A3   D0  1AE6  5041 	MOVL	HRB$L_OBCNT(R3),R1	; Set number of bytes to be transferred
                    18 A3   52   D0  1AEA  5042 	MOVL	R2,HRB$L_MSGBUF(R3)	; Save message buffer address.
                   00000000'GF   16  1AEE  5043 	JSB	G^EXE$ALONONPAGED       ; request some nonpaged ocean
                         05 50   E8  1AF4  5044 	BLBS	R0,250$			; Continue if successful
                    52   18 A3   D0  1AF7  5045 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                                 05  1AFB  5046         RSB                             ; 
                                     1AFC  5047                                         ; return to caller with bad status
                                     1AFC  5048 250$:
                    2C A3   51   D0  1AFC  5049 	MOVL	R1,HRB$L_BUFLEN(R3)	; Save away the length and the
                    30 A3   52   D0  1B00  5050 	MOVL	R2,HRB$L_BUFADR(R3)	;  address of the buffer allocated
                         38 A3   D0  1B04  5051 	MOVL	HRB$L_OBCNT(R3),-	; Byte count is original request
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 108
X-17                            - ALLOCATE - Allocate a local buffer for 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (39)

                         46 A3       1B07  5052 		HRB$L_BCNT(R3)		;  size from the packet.
          44 A3   52   FE00 8F   AB  1B09  5053 	BICW3	#^C<VA$M_BYTE>,R2,-	; Determine the offset into the page
                                     1B10  5054 		HRB$W_BOFF(R3)		;  and store that value away
                       16   09   EF  1B10  5055 	EXTZV	#VA$V_SVPN,#VA$S_SVPN,-	; Then find the virtual page number
                       52   52       1B13  5056 		R2, R2			;  to use as the destination.
              50   00000000'GF   D0  1B15  5057 	MOVL	G^MMG$GL_SPTBASE,R0	; Get the address of the sys page table.
                  40 A3   6042   DE  1B1C  5058 	MOVAL	(R0)[R2],-		; Then get the address of the page
                                     1B21  5059 		HRB$L_SVAPTE(R3)	;  table entry into the HRB.
                    52   18 A3   D0  1B21  5060 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore the MSCP packet address
                       50   01   D0  1B25  5061         MOVL	#SS$_NORMAL,R0
                                 05  1B28  5062 	RSB
                                     1B29  5063 
                                     1B29  5064 	.DISABLE LSB
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 109
X-17                            - SEND_IRP -  prepare and issue an I/O t 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (40)

                                     1B29  5067 	.SBTTL  -	SEND_IRP -  prepare and issue an I/O to a tape
                                     1B29  5068 	.SBTTL  -	DRIVE_TRANSFER -  prepare and issue read/write type I/O
                                     1B29  5069 	.SBTTL  -	DRIVE_CHECK -  prepare and issue ONLINE, AVAIL, SUC, and FLUSH
                                     1B29  5070 
                                     1B29  5071 ;+
                                     1B29  5072 ; Functional Description:
                                     1B29  5073 ;
                                     1B29  5074 ; This routine can be called at two entry points. Entry DRIVE_TRANSFER is
                                     1B29  5075 ; used for read/write type of commands. The tape drive is checked for being 
                                     1B29  5076 ; unit online to the requesting host. Performance monitoring is activated 
                                     1B29  5077 ; if enabled, and the I/O is then queued to the driver. We then RSB back to
                                     1B29  5078 ; the caller's caller (most likely the port driver.) This thread suspends
                                     1B29  5079 ; until I/O post calls us and resumes at subroutine TMSCP$BACK.
                                     1B29  5080 ;
                                     1B29  5081 ; Inputs:
                                     1B29  5082 ;
                                     1B29  5083 ;	R3  =  HRB address
                                     1B29  5084 ;
                                     1B29  5085 ; The second entry point, DRIVE_CHECK prepares an IRP for a tape I/O without 
                                     1B29  5086 ; checking drive status. This routine is called by the ONLINE, AVAILABLE, and 
                                     1B29  5087 ; SET UNIT CHAR code paths. The return to TMSCP$BACK is still the same.
                                     1B29  5088 ;
                                     1B29  5089 ; Inputs:
                                     1B29  5090 ;
                                     1B29  5091 ;	R3  =  HRB address
                                     1B29  5092 ;
                                     1B29  5093 ; Outputs:
                                     1B29  5094 ;
                                     1B29  5095 ;	None (See Outputs from routine TMSCP$BACK)
                                     1B29  5096 ;
                                     1B29  5097 ; Side Effects:
                                     1B29  5098 ;
                                     1B29  5099 ;	The IRP associated with the HRB is queued to be sent to the tape.
                                     1B29  5100 ;-
                                     1B29  5101 
                                     1B29  5102 TMSCP$BLOCK_SEREX::
                                 11  1B29  5103 	.BYTE	IO$_AVAILABLE
                                 01  1B2A  5104 	.BYTE	IO$_UNLOAD
                                 15  1B2B  5105 	.BYTE	IO$_DSE
                                 2A  1B2C  5106 	.BYTE	IO$_FLUSH
                                 0C  1B2D  5107 	.BYTE	IO$_READPBLK
                                 25  1B2E  5108 	.BYTE	IO$_SKIPFILE
                                 26  1B2F  5109 	.BYTE	IO$_SKIPRECORD
                                 02  1B30  5110 	.BYTE	IO$_SPACEFILE
                                 09  1B31  5111 	.BYTE	IO$_SPACERECORD
                                 0B  1B32  5112 	.BYTE	IO$_WRITEPBLK
                                 1C  1B33  5113 	.BYTE	IO$_WRITEMARK
                                 0A  1B34  5114 	.BYTE	IO$_WRITECHECK
                                     1B35  5115 
                           0000000C  1B35  5116 TMSCP$BLOCK_SEREX_LEN	=	. - TMSCP$BLOCK_SEREX
                                     1B35  5117 
                                     1B35  5118 TMSCP$DRIVE_TRANSFER::
                                     1B35  5119 	.IF DEFINED DEBUG$PC_HISTORY
                                     1B35  5120 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1B35  5121 	.ENDC	   ;DEBUG$PC_HISTORY
                    55   1C A3   D0  1B35  5122 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the IRP address 
                       4000 8F   A8  1B39  5123 	BISW	#IRP$M_SRVIO,-		; Set server I/O for all transfer
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 110
X-17                            - DRIVE_CHECK -  prepare and issue ONLIN 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (40)

                         2A A5       1B3D  5124 		 IRP$W_STS(R5)		;  commands.
                            0A   11  1B3F  5125 	BRB	TMSCP$COMMON_TRANSFER	; Set up fields for I/O post.
                                     1B41  5126 
                                     1B41  5127 TMSCP$DRIVE_CHECK::
                                     1B41  5128 	.IF DEFINED DEBUG$PC_HISTORY
                                     1B41  5129 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1B41  5130 	.ENDC	   ;DEBUG$PC_HISTORY
                    55   1C A3   D0  1B41  5131 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the IRP address 
                       4100 8F   A8  1B45  5132 	BISW	#<IRP$M_SRVIO!IRP$M_PHYSIO>,- ; Set physical I/O and server I/O
                         2A A5       1B49  5133 		IRP$W_STS(R5)		;  for ONLINE, AVAILABLE, and SUC
                                     1B4B  5134 
                                     1B4B  5135 TMSCP$COMMON_TRANSFER::
                                     1B4B  5136 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1B4B  5137 	PUSHL	R0
                                     1B4B  5138 	MOVZWL	IRP$W_FUNC(R5), R0	; Get the function value.
                                     1B4B  5139 	BSBW	TMSCP$R0HIST		; Log the value for debugging.
                                     1B4B  5140 	MOVL	IRP$L_MEDIA(R5), R0	; Log the MEDIA values.
                                     1B4B  5141 	BSBW	TMSCP$R0HIST
                                     1B4B  5142 	MOVL	4+IRP$L_MEDIA(R5), R0
                                     1B4B  5143 	BSBW	TMSCP$R0HIST
                                     1B4B  5144 	MOVL	8+IRP$L_MEDIA(R5), R0
                                     1B4B  5145 	BSBW	TMSCP$R0HIST
                                     1B4B  5146 	POPL	R0
                                     1B4B  5147 	.ENDC  ;DEBUG$PC_HISTORY
                    54   58 A3   D0  1B4B  5148 	MOVL	HRB$L_UQB(R3),R4	; Set up the UQB address in order to
                            0D   E1  1B4F  5149 	BBC	#MSCP$V_MD_CLSEX,-	; Is the clear serious exception modifier
                      07 3E A5       1B51  5150 		IRP$L_MEDIA+6(R5),10$	;  set?
                            20   AA  1B54  5151 	BICW	#UQB$M_ST_SEREX,-	; If so, clear serious exception.
                       00C8 C4       1B56  5152 		UQB$W_ST_FLAGS(R4)
                            27   11  1B59  5153 	BRB	15$			;	
                                     1B5B  5154 
                                     1B5B  5155 10$:
                            05   E1  1B5B  5156 	BBC	#UQB$V_ST_SEREX,-	; Is the serious exception bit set?
                    21 00C8 C4       1B5D  5157 		UQB$W_ST_FLAGS(R4),15$
                            00   EF  1B61  5158 	EXTZV	#IO$V_FCODE,-		; Extract the function code
                            06       1B63  5159 		#IO$S_FCODE,-		;  
                    52   20 A5       1B64  5160 		IRP$W_FUNC(R5),R2	;
                            03   BB  1B67  5161 	PUSHR	#^M<R0,R1>		; Preserve registers destroyed by LOCC
                       0C   52   3A  1B69  5162 	LOCC	R2,#TMSCP$BLOCK_SEREX_LEN,-	; Is this a command which gets
                         BB AF       1B6C  5163 		TMSCP$BLOCK_SEREX	;  blocked by serious exception?
                            03   BA  1B6E  5164 	POPR	#^M<R0,R1>		; Preserve registers destroyed by LOCC
                            10   13  1B70  5165 	BEQL	15$			; EQL <= not a blocked command
                    52   18 A3   D0  1B72  5166 	MOVL	HRB$L_MSGBUF(R3),R2	; MSCP packet address from the HRB
                            09   13  1B76  5167 	BEQL	12$			; Caching command; already sent end_packt
                       5E   04   C0  1B78  5168 	ADDL	# 4, SP			; Kill this thread by discarding return addr
                       50   12   D0  1B7B  5169 	MOVL	#MSCP$K_ST_PRESE,R0	; Return serious exception and don't
                          04B9   30  1B7E  5170 	BSBW	TMSCP$SEND_END		;  even bother sending it to the drive
                                     1B81  5171 
                                     1B81  5172 12$:
                                 05  1B81  5173 	RSB				; Return to lower IPL
                                     1B82  5174 
                                     1B82  5175 15$:
                         0C A3 8ED0  1B82  5176 	POPL	HRB$L_RESPC(R3)		; Where to return after IOPOST
                    14 A5   53   D0  1B86  5177 	MOVL	R3,IRP$L_ASTPRM(R5)	; Store HRB in IRP for class driver use
               0C A5   1C08'CF   9E  1B8A  5178 	MOVAB	W^TMSCP$BACK, -		; Address to which IOPOST returns IRP
                                     1B90  5179 		IRP$L_PID(R5)
                         58 A4   D6  1B90  5180 	INCL	UQB$L_IOCNT(R4)		;  record the queue and total I/O
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 111
X-17                            - DRIVE_CHECK -  prepare and issue ONLIN 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (40)

                         5C A4   B6  1B93  5181 	INCW	UQB$W_QLEN(R4)		;  contribution the server initiates
                       53   55   D0  1B96  5182 	MOVL	R5,R3			; Set up R3 with IRP for EXE$INSIOQC
                    55   24 A4   D0  1B99  5183 	MOVL	UQB$L_UCB(R4),R5	; Set up the UCB address for EXE$INSIOQC
                   00000000'GF   D5  1B9D  5184 	TSTL	G^PMS$GL_IOPFMPDB	; I/O performance monitoring enabled?
                            08   13  1BA3  5185 	BEQL	20$			; If not, don't monitor
                   00000000'GF   16  1BA5  5186 	JSB	G^PMS$START_RQ		; Gather Start I/O Request statistics
                            39   11  1BAB  5187 	BRB	30$			;  and start the I/O
                                     1BAD  5188 
                                     1BAD  5189 20$:
                                     1BAD  5190 	LOCK	LOCKNAME=PERFMON,-	; Lock PERFMON access
                                     1BAD  5191 		PRESERVE=NO,-		;  don't preserve R0
                                     1BAD  5192 		SAVIPL=-(SP)		;  save the current IPL
                       7E   12   DB  1BAD       	 MFPR	S^#PR$_IPL,-(SP)
                0B 00000000'GF   E9  1BB0       	BLBC	G^SMP$GL_FLAGS,30075$
                       50   26   9A  1BB7       	 MOVZBL	S^#SPL$C_PERFMON,R0
                   00000000'GF   16  1BBA       	 JSB	G^SMP$ACQUIRE
                            03   11  1BC0       	BRB	30076$
                                     1BC2       30075$:
                       12   0F   DA  1BC2       		MTPR	S^#IPL$_PERFMON,S^#PR$_IPL
                                     1BC5       30076$:
                   00000000'GF   D0  1BC5  5193 	MOVL	G^PMS$GL_IOPFMSEQ,-	; Insert the I/O sequence number
                         50 A3       1BCB  5194 		IRP$L_SEQNUM(R3)	;  into the IRP
                   00000000'GF   D6  1BCD  5195 	INCL	G^PMS$GL_IOPFMSEQ	; And bump the global counter
                                     1BD3  5196 	UNLOCK	LOCKNAME=PERFMON,-	; Release PERFMON access
                                     1BD3  5197 		PRESERVE=NO,-		;  don't preserve R0
                                     1BD3  5198 		NEWIPL=(SP)+		;  restore the saved IPL
                09 00000000'GF   E9  1BD3       	BLBC	G^SMP$GL_FLAGS,30082$
                       50   26   9A  1BDA       	 MOVZBL	S^#SPL$C_PERFMON,R0
                   00000000'GF   16  1BDD       	 JSB	G^SMP$RELEASE
                                     1BE3       30082$:
                       12   8E   DA  1BE3       	 MTPR	(SP)+,S^#PR$_IPL
                                     1BE6  5199 
                                     1BE6  5200 30$:
                    51   14 A3   D0  1BE6  5201 	MOVL	IRP$L_HRB(R3),R1	; Restore HRB address
                            05   B0  1BEA  5202 	MOVW	#HRB$K_ST_DRV_WAIT,-	; Set the state of this request
                         14 A1       1BEC  5203 		HRB$W_STATE(R1)		;  as queued to the driver
                       00B8 C4   B6  1BEE  5204 	INCW	UQB$W_NUM_IO(R4)	; Incrememt current IOs to the drive
                       00BA C4   B1  1BF2  5205 	CMPW	UQB$W_MAX_IO(R4),-	; Did we exceed the maximum current
                       00B8 C4       1BF6  5206 		UQB$W_NUM_IO(R4)	;  counter?
                            07   18  1BF9  5207 	BGEQ	40$			; No, go issue the IO
                       00B8 C4   B0  1BFB  5208 	MOVW	UQB$W_NUM_IO(R4),-	; Update maximum drive IO counter
                       00BA C4       1BFF  5209 		UQB$W_MAX_IO(R4)	;  
                                     1C02  5210 
                                     1C02  5211 40$:
                   00000000'GF   17  1C02  5212 	JMP	G^EXE$INSIOQC		; Queue the IRP to the driver
                                     1C08  5213 ;
                                     1C08  5214 ; This routine now RSBs back to the caller's caller. This thread is
                                     1C08  5215 ; suspended and will resume when IOPOST calls us at entry TMSCP$BACK.
                                     1C08  5216 ;
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 112
X-17                            - BACK  -  return from tape I/O and cont 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (41)

                                     1C08  5219 	.SBTTL	-	BACK  -  return from tape I/O and continue
                                     1C08  5220 
                                     1C08  5221 ;+
                                     1C08  5222 ; Functional Description:
                                     1C08  5223 ;
                                     1C08  5224 ; On returning from performing an I/O, the state of the HRB is checked 
                                     1C08  5225 ; to see if the request has been aborted while we were out to tape. If it 
                                     1C08  5226 ; was, the allocated resources are deallocated and the request finished off 
                                     1C08  5227 ; without returning to the caller.
                                     1C08  5228 ;
                                     1C08  5229 ; Inputs:
                                     1C08  5230 ;
                                     1C08  5231 ;	R0  =  Scratch
                                     1C08  5232 ;	R1  =  Scratch
                                     1C08  5233 ;	R2  =  Scratch
                                     1C08  5234 ;	R3  =  Scratch
                                     1C08  5235 ;	R4  =  Scratch
                                     1C08  5236 ;	R5  =  IRP address returned from IOPOST
                                     1C08  5237 ;
                                     1C08  5238 ; Outputs:
                                     1C08  5239 ;
                                     1C08  5240 ;	R0  =  The first longword of the IOSB
                                     1C08  5241 ;	R2  =  preserved
                                     1C08  5242 ;	R3  =  HRB address
                                     1C08  5243 ;
                                     1C08  5244 ; Side Effects:
                                     1C08  5245 ;
                                     1C08  5246 ;	Control is resumed at the address stored in the resume PC 
                                     1C08  5247 ;	field of the Host Request Block.
                                     1C08  5248 ;-                               
                                     1C08  5249 
                                     1C08  5250 TMSCP$BACK::
                                     1C08  5251 	LOCK	LOCKNAME=SCS,-		; Lock SCS access
                                     1C08  5252 		PRESERVE=NO,-		;  don't preserve R0
                                     1C08  5253 		SAVIPL=-(SP)		;  save the current IPL
                       7E   12   DB  1C08       	 MFPR	S^#PR$_IPL,-(SP)
                0B 00000000'GF   E9  1C0B       	BLBC	G^SMP$GL_FLAGS,30088$
                       50   34   9A  1C12       	 MOVZBL	S^#SPL$C_SCS,R0
                   00000000'GF   16  1C15       	 JSB	G^SMP$ACQUIRE
                            03   11  1C1B       	BRB	30089$
                                     1C1D       30088$:
                       12   08   DA  1C1D       		MTPR	S^#IPL$_SCS,S^#PR$_IPL
                                     1C20       30089$:
                    53   14 A5   D0  1C20  5254 	MOVL	IRP$L_HRB(R5),R3	; Restore the HRB address
                                     1C24  5255 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1C24  5256 	BSBW	TMSCP$PCHIST_R3		; Log the PC for debugging.
                                     1C24  5257 	.ENDC  ;DEBUG$PC_HISTORY
                       8000 8F   A8  1C24  5258 	BISW	#HRB$M_STATE_INVALID,-	; The state of this request is "current"
                         14 A3       1C28  5259 		HRB$W_STATE(R3)		;  leave the old state for diagnosis
                       4100 8F   AA  1C2A  5260 	BICW	#<IRP$M_PHYSIO!IRP$M_SRVIO>,- ; Clear physical I/O and server I/O flags
                         2A A5       1C2E  5261 		IRP$W_STS(R5)		;  only needed for ONLINE and AVAILABLE (physio)
                   00000000'GF   D5  1C30  5262 	TSTL	G^PMS$GL_IOPFMPDB	; I/O performance monitoring is 
                            06   13  1C36  5263 	BEQL	10$			;  not enabled, skip
                   00000000'GF   16  1C38  5264 	JSB	G^PMS$END_RQ		; Gather End I/O Request statistics
                                     1C3E  5265 
                                     1C3E  5266 10$:
                    54   58 A3   D0  1C3E  5267 	MOVL	HRB$L_UQB(R3),R4	; Restore UQB address
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 113
X-17                            - BACK  -  return from tape I/O and cont 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (41)

                       00B8 C4   B7  1C42  5268 	DECW	UQB$W_NUM_IO(R4)	; Decrement counter for IOs to the drive.
                    51   1C A5   D0  1C46  5269 	MOVL	IRP$L_UCB(R5),R1	; Pick up UCB pointer
               7E A1   FFFF 8F   58  1C4A  5270 	ADAWI	#-1,UCB$W_QLEN(R1)	; Drop queue length counter
               5C A4   FFFF 8F   58  1C50  5271 	ADAWI	#-1,UQB$W_QLEN(R4)	; Drop the local queue length counter
                                 B3  1C56  5272 	BITW	#<HRB$M_ABORT!-		; Check to see if we lost the connection
                                     1C57  5273 		HRB$M_ABORTWS>,-	;  or if this request was canceled,
                    16 A3   03       1C57  5274 		HRB$W_FLAGS(R3)		;  since this I/O was sent to tape
                            13   13  1C5A  5275 	BEQL	30$
                                     1C5C  5276 
                                     1C5C  5277 ;
                                     1C5C  5278 ; If this command has been canceled by a ^Y, it is aborted with status (an
                                     1C5C  5279 ; end message is returned). However, if this command has been aborted for any
                                     1C5C  5280 ; other reason there is no one to send and end message to. In this case, start 
                                     1C5C  5281 ; the next entry on the blocked queue if there is one, and deallocate any 
                                     1C5C  5282 ; resources held by this request.
                                     1C5C  5283 ;
                                     1C5C  5284 
                    52   18 A3   D0  1C5C  5285 	MOVL	HRB$L_MSGBUF(R3),R2	; Get the message buffer address 
                            08   13  1C60  5286 	BEQL	20$			;  if none, don't return status
                       50   02   D0  1C62  5287 	MOVL	#MSCP$K_ST_ABRTD,R0	;  otherwise return an aborted status
                          03D2   30  1C65  5288 	BSBW	TMSCP$SEND_END		;  in an end message before returning
                            0F   11  1C68  5289 	BRB	40$			;  back to a lower IPL
                                     1C6A  5290 
                                     1C6A  5291 20$:
                          00BB   30  1C6A  5292 	BSBW	TMSCP$CLEANUP_HRB	; Clean up this request
                            0A   11  1C6D  5293 	BRB	40$			; Return back to a lower IPL
                                     1C6F  5294 
                                     1C6F  5295 30$:
                         60 A3   D7  1C6F  5296 	DECL	HRB$L_CMD_STS(R3)	; Report progress on this request
                    50   38 A5   D0  1C72  5297 	MOVL	IRP$L_IOST1(R5),R0	; Return the I/O status block in R0
                                     1C76  5298 
                                     1C76  5299 ;
                                     1C76  5300 ;	R0  =  I/O status block, scratch
                                     1C76  5301 ;	R1  =  Scratch
                                     1C76  5302 ;	R2  =  Scratch
                                     1C76  5303 ;	R3  =  HRB address
                                     1C76  5304 ;	R4  =  UQB address
                                     1C76  5305 ;	R5  =  IRP address
                                     1C76  5306 ;
                                     1C76  5307 
                                     1C76  5308 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1C76  5309 	PUSHAB	35$			; Set the return address.
                                     1C76  5310 	PUSHL	HRB$L_RESPC(R3)		; Resume previous thread.
                                     1C76  5311 	BRW	TMSCP$PCHIST_R3R0	; Log the PC for debugging.
                                     1C76  5312 
                                     1C76  5313 35$:
                                     1C76  5314 	BSBW	TMSCP$PCHIST		; Log the PC for debugging.
                                     1C76  5315 	.IFF
                         0C B3   16  1C76  5316 	JSB	@HRB$L_RESPC(R3)	; Resume where we left off
                                     1C79  5317 	.ENDC  ;DEBUG$PC_HISTORY
                                     1C79  5318 
                                     1C79  5319 40$:
                                     1C79  5320 	UNLOCK	LOCKNAME=SCS,-		; Release SCS access
                                     1C79  5321 		PRESERVE=NO,-		;  don't preserve R0
                                     1C79  5322 		NEWIPL=(SP)+,-		;  restore the saved IPL
                                     1C79  5323 		CONDITION=RESTORE	;  conditionally release spinlock
                09 00000000'GF   E9  1C79       	BLBC	G^SMP$GL_FLAGS,30095$
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 114
X-17                            - BACK  -  return from tape I/O and cont 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (41)

                       50   34   9A  1C80       	 MOVZBL	S^#SPL$C_SCS,R0
                   00000000'GF   16  1C83       	 JSB	G^SMP$RESTORE
                                     1C89       30095$:
                       12   8E   DA  1C89       	 MTPR	(SP)+,S^#PR$_IPL
                                 05  1C8C  5324 	RSB				;  and return
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 115
X-17                            - ALLOCATE_HRB -  Host Request Block All 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (42)

                                     1C8D  5327 	.SBTTL	-	ALLOCATE_HRB -  Host Request Block Allocation
                                     1C8D  5328 
                                     1C8D  5329 ;+
                                     1C8D  5330 ; Functional Description:
                                     1C8D  5331 ;
                                     1C8D  5332 ; This module allocates enough memory for a Host Request Buffer, and
                                     1C8D  5333 ; fills in the preliminary fields. The Connection Decsriptor Table and 
                                     1C8D  5334 ; the Port Descriptor Table addresses are juggled around in this module 
                                     1C8D  5335 ; too. When control is passed to the server at TMSCP$MSG_IN, the CDT is in
                                     1C8D  5336 ; register 3 and the PDT is in register 4. Since R3 has been designated 
                                     1C8D  5337 ; as the HRB address, and the PDT is stored away in the HRB, control is
                                     1C8D  5338 ; returned to the caller with the CDT address in R4.
                                     1C8D  5339 ;
                                     1C8D  5340 ; Inputs:
                                     1C8D  5341 ;
                                     1C8D  5342 ;	None
                                     1C8D  5343 ;
                                     1C8D  5344 ; Outputs:
                                     1C8D  5345 ;
                                     1C8D  5346 ;	R0  =  completion status code
                                     1C8D  5347 ;		SS$_INSFMEM - not enough memory to allocate the HRB
                                     1C8D  5348 ;		SS$_NORMAL  - HRB and IRP were allocated and linked together
                                     1C8D  5349 ;	R3  =  HRB address
                                     1C8D  5350 ;
                                     1C8D  5351 ;	R1,R2,R4,R5  -  preserved
                                     1C8D  5352 ;-
                                     1C8D  5353 
                                     1C8D  5354 TMSCP$ALLOCATE_HRB::
                                     1C8D  5355 	.IF DEFINED DEBUG$PC_HISTORY
                                     1C8D  5356 	BSBW	TMSCP$PCHIST		; Save this PC if we are keeping track
                                     1C8D  5357 	.ENDC	   ;DEBUG$PC_HISTORY
                            36   BB  1C8D  5358 	PUSHR	#^M<R1,R2,R4,R5>	; Save the registers to be used
                    51   84 8F   9A  1C8F  5359 	MOVZBL	#HRB$K_LENGTH,R1	; Length of the requested buffer
                   00000000'GF   16  1C93  5360 	JSB	G^EXE$ALONONPAGED	; Get the memory
                         03 50   E8  1C99  5361 	BLBS	R0, 10$			; HRB allocated - branch.
                          0082   31  1C9C  5362 	BRW	40$			; Unsuccessful return an error
                                     1C9F  5363 
                                     1C9F  5364 10$:
                       53   52   D0  1C9F  5365 	MOVL	R2,R3			; Save the address of the request buffer
                                     1CA2  5366 	.IF DEFINED DEBUG$PC_HISTORY
                                     1CA2  5367 	BSBW	TMSCP$R3HIST		; Save this HRB address.
                                     1CA2  5368 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1CA2  5369 
                                     1CA2  5370 ;
                                     1CA2  5371 ; Initialize known fields in the newly allocated HRB.
                                     1CA2  5372 ;
                                     1CA2  5373 
                            3F   BB  1CA2  5374 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                  00   6E   00   2C  1CA4  5375 	MOVC5	#0,(SP),#0,-		; Initialize entire structure in
                  63   0084 8F       1CA8  5376 		#HRB$K_LENGTH,(R3)		;  in one fell swoop. 
                            3F   BA  1CAC  5377 	POPR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers destroyed by MOVC5
                    08 A3   51   B0  1CAE  5378 	MOVW	R1,HRB$W_SIZE(R3)	; Fill in the size field
                                     1CB2  5379 
                                     1CB2  5380 	ASSUME	HRB$B_SUBTYPE EQ 1+HRB$B_TYPE
                                     1CB2  5381 
               0A A3   0373 8F   B0  1CB2  5382 	MOVW	#<DYN$C_TSRV_HRB@8>! -	; Set data structure subtype and type.
                                     1CB8  5383 		DYN$C_TSRV, -
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 116
X-17                            - ALLOCATE_HRB -  Host Request Block All 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (42)

                                     1CB8  5384 		HRB$B_TYPE(R3)
                    60 A3   02   CE  1CB8  5385 	MNEGL	#2,HRB$L_CMD_STS(R3)	; Initialize the status field 
                                     1CBC  5386 
                                     1CBC  5387 ;
                                     1CBC  5388 ; Allocate and link the IRP into the HRB.
                                     1CBC  5389 ;
                                     1CBC  5390 
                    51   A8 8F   9A  1CBC  5391 	MOVZBL	#IRP$K_LENGTH,R1	; Size of buffer to be allocated
                   00000000'GF   16  1CC0  5392 	JSB	G^EXE$ALONONPAGED	; Get enough memory for an IRP-CDRP
                         4F 50   E9  1CC6  5393 	BLBC	R0, 30$			; Return an error if unsuccessful
                                     1CC9  5394 
                                     1CC9  5395 ;
                                     1CC9  5396 ; Fill in any of the IRP that we can at this point.
                                     1CC9  5397 ;
                    1C A3   52   D0  1CC9  5398 	MOVL	R2,HRB$L_IRP_CDRP(R3)	; Save away the IRP address
                            0A   90  1CCD  5399 	MOVB	# DYN$C_IRP,-		; Fill in the type
                         0A A2       1CCF  5400 		IRP$B_TYPE(R2)		; 
                         0B A2   94  1CD1  5401 	CLRB	IRP$B_RMOD(R2)		; Clear the access mode of the request
                    08 A2   51   B0  1CD4  5402 	MOVW	R1, IRP$W_SIZE(R2)	; Fill in the size
                         18 A2   D4  1CD8  5403 	CLRL	IRP$L_WIND(R2)		; No window control blocks in the server
                         22 A2   94  1CDB  5404 	CLRB	IRP$B_EFN(R2)		; Clear out the event flag number
                                     1CDE  5405 
                                     1CDE  5406 	ASSUME	IRP$W_STS	EQ  2+IRP$W_CHAN
                                     1CDE  5407 
                         28 A2   D4  1CDE  5408 	CLRL	IRP$W_CHAN(R2)		; Clear channel and status.
                       0080 C2   D4  1CE1  5409 	CLRL	IRP$L_RSPID(R2)		; Signify no response ID allocated
                         30 A2   B4  1CE5  5410 	CLRW	IRP$W_BOFF(R2)		; No bytes to offset to.
                         2C A2   D4  1CE8  5411 	CLRL	IRP$L_SVAPTE(R2)	; No buffer.
                         32 A2   D4  1CEB  5412 	CLRL	IRP$L_BCNT(R2)		; No bytes to transfer.
                         20 A2   B4  1CEE  5413 	CLRW	IRP$W_FUNC(R2)		; No function yet.
                    14 A2   53   D0  1CF1  5414 	MOVL	R3,IRP$L_HRB(R2)	; Set the HRB address for IO completion
                                     1CF5  5415 
                                     1CF5  5416 	ASSUME	IRP$L_IOST1	EQ    IRP$L_MEDIA
                                     1CF5  5417 	ASSUME	IRP$L_IOST2	EQ  4+IRP$L_IOST1
                                     1CF5  5418 	ASSUME	IRP$B_CARCON	EQ  4+IRP$L_MEDIA
                                     1CF5  5419 
                         38 A2   7C  1CF5  5420 	CLRQ	IRP$L_MEDIA(R2)		; Initialize the I/O parameters.
                                     1CF8  5421 
                                     1CF8  5422 	ASSUME	IRP$L_ABCNT	EQ  8+IRP$L_MEDIA
                                     1CF8  5423 	ASSUME	IRP$L_OBCNT	EQ  4+IRP$L_ABCNT
                                     1CF8  5424 
                         40 A2   7C  1CF8  5425 	CLRQ	IRP$L_ABCNT(R2)
                                     1CFB  5426 
                                     1CFB  5427 ;
                                     1CFB  5428 ; Initialize a few of the CDRP fields.
                                     1CFB  5429 ;
                                     1CFB  5430 
                    52   60 A2   DE  1CFB  5431 	MOVAL	IRP$L_FQFL(R2),R2	; Move down to the CDRP portion
                            62   7C  1CFF  5432 	CLRQ	CDRP$L_FQFL(R2)		; Show that we are not on any queue
                    0A A2   39   90  1D01  5433 	MOVB	#DYN$C_CDRP, -		; Fill in the CDRP type field
                                     1D05  5434 		CDRP$B_CD_TYPE(R2)	; 
                       FFA0 8F   B0  1D05  5435 	MOVW	#CDRP$L_IOQFL,-		; Negative offset to start of IRP
                         08 A2       1D09  5436 		CDRP$W_CDRPSIZE(R2)	;  on the front of this CDRP
                            34   90  1D0B  5437 	MOVB	#SPL$C_SCS,-		; Load the type of spinlock held
                         0B A2       1D0D  5438 		CDRP$B_FLCK(R2)		;  for the server
                         28 A2   D4  1D0F  5439 	CLRL	CDRP$L_RWCPTR(R2)	; 
                       50   01   D0  1D12  5440 	MOVL	#SS$_NORMAL,R0		; Set success status
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 117
X-17                            - ALLOCATE_HRB -  Host Request Block All 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (42)

                                     1D15  5441 
                                     1D15  5442 ;
                                     1D15  5443 ; Restore the registers to their original state and return.
                                     1D15  5444 ;
                                     1D15  5445 
                                     1D15  5446 20$:
                            36   BA  1D15  5447 	POPR	#^M<R1,R2,R4,R5>	; Put everything back
                                 05  1D17  5448 	RSB				;  and return to the caller
                                     1D18  5449 
                                     1D18  5450 30$:
                       50   53   D0  1D18  5451 	MOVL	R3,R0			; Address of structure to deallocate
                   00000000'GF   16  1D1B  5452 	JSB	G^EXE$DEANONPAGED	; Return the HRB to nonpaged pool
                                     1D21  5453 
                                     1D21  5454 40$:
                  50   0124 8F   3C  1D21  5455 	MOVZWL	#SS$_INSFMEM,R0		; Set an error code
                            ED   11  1D26  5456 	BRB	20$
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 118
X-17                            - CLEANUP_HRB -  Host Request Resource D 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (43)

                                     1D28  5459 	.SBTTL	-	CLEANUP_HRB -  Host Request Resource Deallocation
                                     1D28  5460 
                                     1D28  5461 ;+
                                     1D28  5462 ; Functional Description:
                                     1D28  5463 ;
                                     1D28  5464 ; This routine runs down through a HRB checking for resources that are 
                                     1D28  5465 ; allocated for this request. As it finds them it deallocates the resources
                                     1D28  5466 ; and cleanes up all the pointers used to link them all together.
                                     1D28  5467 ;
                                     1D28  5468 ; Inputs:
                                     1D28  5469 ;
                                     1D28  5470 ;	R3  =  HRB address
                                     1D28  5471 ;
                                     1D28  5472 ; Outputs:
                                     1D28  5473 ;
                                     1D28  5474 ;	R0  =  status code
                                     1D28  5475 ;	R4  =  UQB address
                                     1D28  5476 ;-
                                     1D28  5477 
                                     1D28  5478 TMSCP$CLEANUP_HRB::
                                     1D28  5479 	.IF DEFINED DEBUG$PC_HISTORY
                                     1D28  5480 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1D28  5481 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1D28  5482 
                                     1D28  5483 ;
                                     1D28  5484 ; Start the next sequential command. 
                                     1D28  5485 ; 
                                     1D28  5486  
                 09 16 A3   05   E1  1D28  5487 	BBC	#HRB$V_UNBLOCK, -	; If this is not a sequential command 
                                     1D2D  5488 		HRB$W_FLAGS(R3), 5$	; then kill this thread - branch. 
                    54   58 A3   D0  1D2D  5489 	MOVL	HRB$L_UQB(R3), R4	; Get the Unit Queue Block address. 
                            03   13  1D31  5490 	BEQL	5$			; VC_ERR processing - branch. 
                          00D2   30  1D33  5491 	BSBW	TMSCP$UNBLOCK		; Start the next sequential command. 
                                     1D36  5492  
                                     1D36  5493 5$: 
                                     1D36  5494  
                                     1D36  5495 ; 
                                     1D36  5496 ; Dequeue this request from the blocked queue, if it's still hooked. 
                                     1D36  5497 ; Commands that were aborted during the MAP_WAIT state, or the SNDAT_WAIT 
                                     1D36  5498 ; can still be on the blocked for sequential completion queue. 
                                     1D36  5499 ; 
                                     1D36  5500  
                         4C A3   D5  1D36  5501 	TSTL	HRB$L_WAIT_FL(R3)	; Are we still on the blocked queue? 
                            0D   13  1D39  5502 	BEQL	7$			; EQL implies not. 
                    54   4C A3   0F  1D3B  5503 	REMQUE	HRB$L_WAIT_FL(R3),R4	; Remove the request from the queue 
                    55   58 A3   D0  1D3F  5504 	MOVL	HRB$L_UQB(R3),R5	; Get the address of the UQB 
                            03   13  1D43  5505 	BEQL	7$			;  we can't decrement what doesn't exist
                         28 A5   B7  1D45  5506 	DECW	UQB$W_NUM_QUE(R5)	;  so we can update the counter 
                                     1D48  5507 
                                     1D48  5508 ;
                                     1D48  5509 ; Set up the standard inputs for SCS calls; PDT in R4 and CDRP in R5
                                     1D48  5510 ;
                                     1D48  5511 
                                     1D48  5512 7$:
                    55   1C A3   D0  1D48  5513 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Get the address of the IRP
                    55   60 A5   DE  1D4C  5514 	MOVAL	IRP$L_FQFL(R5),R5	; CDRP starting offset
                    54   5C A3   D0  1D50  5515 	MOVL	HRB$L_PDT(R3),R4	; Set up the PDT address for SCS calls
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 119
X-17                            - CLEANUP_HRB -  Host Request Resource D 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (43)

                                     1D54  5516 
                                     1D54  5517 ;
                                     1D54  5518 ; Release any mapping resources held.
                                     1D54  5519 ;
                            04   E5  1D54  5520 	BBCC	#HRB$V_MAP,-		; Check to see if this request has
                      08 16 A3       1D56  5521 		HRB$W_FLAGS(R3),10$	;  any mapping resources allocated
                         20 A3   DE  1D59  5522 	MOVAL	HRB$B_LBUFF(R3),-	; Get the local buffer descriptor addres
                         2C A5       1D5C  5523 		CDRP$L_LBUFH_AD(R5)	;  from the HRB and put it in the CDRP
                                     1D5E  5524 	UNMAP				; If it does, release them
                         64 B4   16  1D5E       		JSB	@PDT$L_UNMAP(R4)
                                     1D61  5525 
                                     1D61  5526 ;
                                     1D61  5527 ; Release a RSPID if one is held.
                                     1D61  5528 ;
                                     1D61  5529 
                                     1D61  5530 10$:
                         20 A5   D5  1D61  5531 	TSTL	CDRP$L_RSPID(R5)	; Check the response ID field
                            06   13  1D64  5532 	BEQL	20$			; If it is zero none is held
                                     1D66  5533 	DEALLOC_RSPID			; Return the response ID to SCS
                   00000000'GF   16  1D66       		JSB	G^SCS$DEALL_RSPID
                                     1D6C  5534 
                                     1D6C  5535 ;
                                     1D6C  5536 ; Deallocate the MSCP message buffer. (may start up another thread)
                                     1D6C  5537 ;
                                     1D6C  5538 
                                     1D6C  5539 20$:
                         18 A3   D5  1D6C  5540 	TSTL	HRB$L_MSGBUF(R3)	; Check for allocated message buffer
                            14   13  1D6F  5541 	BEQL	30$			; Continue, if none is allocated
                         18 A3   D0  1D71  5542 	MOVL	HRB$L_MSGBUF(R3),- 	; Get the message buffer address
                         1C A5       1D74  5543 		CDRP$L_MSG_BUF(R5)	;  from the HRB and put it in the CDRP
                         18 A3   D4  1D76  5544 	CLRL	HRB$L_MSGBUF(R3)	;  and clear out the address in the HRB
                    50   54 A3   D0  1D79  5545 	MOVL	HRB$L_HQB(R3),R0	; Get the address of the HQB
                         28 A0   D0  1D7D  5546 	MOVL	HQB$L_CDT(R0),-		;  so we can get the CDT address
                         24 A5       1D80  5547 		CDRP$L_CDT(R5)		;  and put it in the CDRP for the call
                                     1D82  5548 	DEALLOC_MSG_BUF			; Get rid of the message buffer
                         20 B4   16  1D82       		JSB	@PDT$L_DEALLOMSG(R4)
                                     1D85  5549 
                                     1D85  5550 ;
                                     1D85  5551 ; Deallocate any local buffer, and check for any requests that may be
                                     1D85  5552 ; waiting for buffer space.
                                     1D85  5553 ;
                                     1D85  5554 
                                     1D85  5555 30$:
                    54   58 A3   D0  1D85  5556 	MOVL	HRB$L_UQB(R3),R4	; Restore UQB address
                            17   13  1D89  5557 	BEQL	35$			; Command without unit from VC_ERR - branch.
                         30 A3   D5  1D8B  5558 	TSTL	HRB$L_BUFADR(R3)	; Check for any local buffers
                            12   13  1D8E  5559 	BEQL	35$			; No transfer buffer allocated to req
                    50   30 A3   D0  1D90  5560 	MOVL	HRB$L_BUFADR(R3),R0	; Address of block to be deallocated
                    51   2C A3   D0  1D94  5561 	MOVL	HRB$L_BUFLEN(R3),R1	; Size of block to be deallocated
                            04   BB  1D98  5562 	PUSHR	#^M<R2>			; Save the registers to be used
                   00000000'GF   16  1D9A  5563 	JSB	G^EXE$DEANONPGDSIZ	; Return the local buffer to pool
                            04   BA  1DA0  5564 	POPR	#^M<R2>			; Restore the registers to be used
                                     1DA2  5565 ;
                                     1DA2  5566 ; Deallocate any IRP that was allocated.
                                     1DA2  5567 ;
                                     1DA2  5568 
                                     1DA2  5569 35$:
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 120
X-17                            - CLEANUP_HRB -  Host Request Resource D 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (43)

                         30 A3   D4  1DA2  5570 	CLRL	HRB$L_BUFADR(R3)	; Clear out the buffer address
                    50   1C A3   D0  1DA5  5571 	MOVL	HRB$L_IRP_CDRP(R3),R0	; Get the address of the IRP
                            0D   13  1DA9  5572 	BEQL	40$			; None was allocated, continue...
                            04   BB  1DAB  5573 	PUSHR	#^M<R2>			; Save the registers to be used
                   00000000'GF   16  1DAD  5574 	JSB	G^EXE$DEANONPAGED	; Free the memory
                            04   BA  1DB3  5575 	POPR	#^M<R2>			; Restore the registers to be used
                         1C A3   D4  1DB5  5576 	CLRL	HRB$L_IRP_CDRP(R3)	;  and clear out the buffer pointer
                                     1DB8  5577 
                                     1DB8  5578 ;
                                     1DB8  5579 ; Unhook host request block from the list of requests pending for this host.
                                     1DB8  5580 ;
                                     1DB8  5581 
                                     1DB8  5582 40$:
                    55   54 A3   D0  1DB8  5583 	MOVL	HRB$L_HQB(R3),R5	; R5 -> HQB structure
                            63   D5  1DBC  5584 	TSTL	HRB$L_FLINK(R3)		; If this HRB is already unhooked
                            08   13  1DBE  5585 	BEQL	55$			;  (from add) skip the remque
                                     1DC0  5586 
                                     1DC0  5587 	ASSUME	HRB$L_FLINK EQ 0
                                     1DC0  5588 
                       53   63   0F  1DC0  5589 	REMQUE	HRB$L_FLINK(R3),R3	; Remove entry but keep address handy
                            63   D4  1DC3  5590 	CLRL	HRB$L_FLINK(R3)		; Show the entry removed from the queue
                         1C A5   B7  1DC5  5591 	DECW	HQB$W_NUM_QUE(R5)	; Decrement pending for this host
                                     1DC8  5592 
                                     1DC8  5593 ;
                                     1DC8  5594 ; Deallocate the HRB, we don't need it any more.
                                     1DC8  5595 ;
                                     1DC8  5596 
                                     1DC8  5597 55$:
                       50   53   D0  1DC8  5598 	MOVL	R3,R0			; Address to deallocate as well
                            04   BB  1DCB  5599 	PUSHR	#^M<R2>			; Save the registers to be used
                   00000000'GF   16  1DCD  5600 	JSB	G^EXE$DEANONPAGED	; Deallocate the HRB
                            04   BA  1DD3  5601 	POPR	#^M<R2>			; Restore the registers to be used
                       50   01   D0  1DD5  5602 	MOVL	#SS$_NORMAL,R0		; Return a successful status
                            53   D4  1DD8  5603 	CLRL	R3			; Clear out the old pointer
                                     1DDA  5604 
                                     1DDA  5605 ;
                                     1DDA  5606 ; Check to see if this is the last request pending for this host. If it is,
                                     1DDA  5607 ; we can send out the disconnect and delete the HQB for this host.
                                     1DDA  5608 ;
                            00   E1  1DDA  5609 	BBC	#HQB$V_VC_FAILED,-	; If the circuit has NOT failed,
                      03 0D A5       1DDC  5610 		HQB$B_STATE(R5),100$	;  just continue on...
                          0351   30  1DDF  5611 	BSBW	TMSCP$DEALLOC_HQB	; Otherwise send out the disconnect
                                     1DE2  5612 
                                     1DE2  5613 100$:
                                 05  1DE2  5614 	RSB				; Return to the caller
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 121
X-17                            - UNBLOCK - Restart Any Blocked Commands 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (44)

                                     1DE3  5617 	.SBTTL	-	UNBLOCK - Restart Any Blocked Commands
                                     1DE3  5618 	.SBTTL	-	SEQ_STALL - Synchronize Sequential Commands
                                     1DE3  5619 	.ENABLE LSB
                                     1DE3  5620 
                                     1DE3  5621 ;+
                                     1DE3  5622 ; Functional Description:
                                     1DE3  5623 ;
                                     1DE3  5624 ; At the SEQ_STALL entry point, a TMSCP sequential command has been received
                                     1DE3  5625 ; and must be synchronized with the other sequential commands for this unit
                                     1DE3  5626 ; before it can be processed.  This routine increments the queued request
                                     1DE3  5627 ; count and sets the sequential command processing flag (UQB$V_SEQ).
                                     1DE3  5628 ;
                                     1DE3  5629 ; The UNBLOCK entry point, releases the next TMSCP sequential command for
                                     1DE3  5630 ; processing.  This routine decrements the queued request count and clears
                                     1DE3  5631 ; the sequential command processing flag (UQB$V_SEQ) when all the commands
                                     1DE3  5632 ; have completed.
                                     1DE3  5633 ;
                                     1DE3  5634 ; Inputs:
                                     1DE3  5635 ;
                                     1DE3  5636 ;	R3  =  HRB address
                                     1DE3  5637 ;	R4  =  UQB address
                                     1DE3  5638 ;
                                     1DE3  5639 ; Outputs:
                                     1DE3  5640 ;
                                     1DE3  5641 ;	R3  =  HRB address
                                     1DE3  5642 ;	R4  =  UQB address
                                     1DE3  5643 ;	SEQ_STALL returns to caller's caller.
                                     1DE3  5644 ;
                                     1DE3  5645 ; Restored thread outputs:
                                     1DE3  5646 ;
                                     1DE3  5647 ;	R0  =  Scratch
                                     1DE3  5648 ;	R1  =  Scratch
                                     1DE3  5649 ;	R2  =  Scratch
                                     1DE3  5650 ;	R3  =  HRB address
                                     1DE3  5651 ;	R4  =  UQB address, scratch
                                     1DE3  5652 ;	R5  =  Scratch
                                     1DE3  5653 ;-
                                     1DE3  5654 
                                     1DE3  5655 TMSCP$SEQ_STALL::
                                     1DE3  5656 	.IF DEFINED DEBUG$PC_HISTORY
                                     1DE3  5657 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     1DE3  5658 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1DE3  5659 	.IF DEFINED DEBUG$CURRENT_SANITY
                                     1DE3  5660 	BSBW	TMSCP$CHECK_CURRENT	; Sanity check the current counters
                                     1DE3  5661 	.ENDC	   ;DEBUG$CURRENT_SANITY
                                     1DE3  5662 
                                     1DE3  5663 ;
                                     1DE3  5664 ;		Mark this request as a sequential command and prepare it
                                     1DE3  5665 ;		for delayed processing.
                                     1DE3  5666 ;
                                     1DE3  5667 
                    16 A3   20   A8  1DE3  5668 	BISW	# HRB$M_UNBLOCK, -	; This command must call TMSCP$UNBLOCK
                                     1DE7  5669 		HRB$W_FLAGS(R3)		; upon command completion.
                            02   B0  1DE7  5670 	MOVW	#HRB$K_ST_SEQ_WAIT,-	; We are now ready for transfer and
                         14 A3       1DE9  5671 		HRB$W_STATE(R3)		;  only stalled be sequentiality.
                         0C A3 8ED0  1DEB  5672 	POPL	HRB$L_RESPC(R3)		; Save the resume address
                                     1DEF  5673 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 122
X-17                            - SEQ_STALL - Synchronize Sequential Com 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (44)

                                     1DEF  5674 ;
                                     1DEF  5675 ;		Place this command in the BLOCKED queue and leave it there
                                     1DEF  5676 ;		until all prior sequential commands have completed.
                                     1DEF  5677 ;
                                     1DEF  5678 
                         28 A4   B6  1DEF  5679 	INCW	UQB$W_NUM_QUE(R4)	; Bump number of packets queued to unit
                         28 A4   B1  1DF2  5680 	CMPW	UQB$W_NUM_QUE(R4),-	; If this number is not a new high
                         2A A4       1DF5  5681 		UQB$W_MAX_QUE(R4)	;  for this unit,
                            05   1B  1DF7  5682 	BLEQU	10$			;  then continue processing
                         28 A4   B0  1DF9  5683 	MOVW	UQB$W_NUM_QUE(R4),-	; If it is a new max, save the new high
                         2A A4       1DFC  5684 		UQB$W_MAX_QUE(R4)	;  for the show MSCP command
                                     1DFE  5685 
                                     1DFE  5686 10$:
                 30 B4   4C A3   0E  1DFE  5687 	INSQUE	HRB$L_WAIT_FL(R3), -	; Insert this packet on the 
                                     1E03  5688 		@UQB$L_BLOCKED_BL(R4)	;  blocked queue for execution later
                                     1E03  5689 
                                     1E03  5690 ;
                                     1E03  5691 ;		Start the first sequential command.
                                     1E03  5692 ;
                                     1E03  5693 
                 35 0E A4   00   E2  1E03  5694 	BBSS	# UQB$V_SEQ, -		; Flag sequential command processing and
                                     1E08  5695 		UQB$W_FLAGS(R4), 130$	; delay this thread if not first - branch.
                                     1E08  5696 
                                     1E08  5697 ;
                                     1E08  5698 ;		Resume execution of the next command on the BLOCKED queue.
                                     1E08  5699 ;
                                     1E08  5700 
                                     1E08  5701 TMSCP$UNBLOCK::
                                     1E08  5702 	.IF DEFINED DEBUG$PC_HISTORY
                                     1E08  5703 	BSBW	TMSCP$PCHIST		; Save this PC if we are keeping track
                                     1E08  5704 	.ENDC	   ;DEBUG$PC_HISTORY
                                     1E08  5705 	.IF DEFINED DEBUG$CURRENT_SANITY
                                     1E08  5706 	BSBW	TMSCP$CHECK_CURRENT	; Sanity check the current counters
                                     1E08  5707 	.ENDC	   ;DEBUG$CURRENT_SANITY
                            54   D5  1E08  5708 	TSTL	R4			; Make sure we have a valid address
                            31   13  1E0A  5709 	BEQL	130$			;  if not, just return
                                     1E0C  5710 
                                     1E0C  5711 ;
                                     1E0C  5712 ; Check to see if there are any requests on the blocked queue. If the queue
                                     1E0C  5713 ; is populated, remove the next request off the queue
                                     1E0C  5714 ;
                                     1E0C  5715 
                            3F   BB  1E0C  5716 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>	; Save any registers used
                    53   2C B4   0F  1E0E  5717 	REMQUE	@UQB$L_BLOCKED_FL(R4),R3; Dequeue first request
                            2A   1D  1E12  5718 	BVS	140$			; If the queue was empty, kill this 
                                     1E14  5719 					;  request.
              53   0000004C 8F   C2  1E14  5720 	SUBL	#HRB$L_WAIT_FL,R3	; Point to the start of the HRB
                         4C A3   D4  1E1B  5721 	CLRL	HRB$L_WAIT_FL(R3)	; Clear the queue link.
                                     1E1E  5722 ;
                                     1E1E  5723 ; If the sequential command is waiting to be started, we can do that now and
                                     1E1E  5724 ; update the queue count.
                                     1E1E  5725 ;
                                     1E1E  5726 
                            02   B1  1E1E  5727 	CMPW	#HRB$K_ST_SEQ_WAIT,-	; Is this sequential command ready
                         14 A3       1E20  5728 		HRB$W_STATE(R3)		;  for transfer?
                            0B   13  1E22  5729 	BEQL	20$			; ready for transfer, continue
                                     1E24  5730 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 123
X-17                            - SEQ_STALL - Synchronize Sequential Com 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (44)

                                     1E24  5731 ; If it is not a sequential command, bail out
                                     1E24  5732 ; The sequential command cannot be stopped at this point.
                                     1E24  5733 
               14 A3   8002 8F   B1  1E24  5734 	CMPW	#<HRB$K_ST_SEQ_WAIT! -	   ; Sequential command in progress?
                                     1E2A  5735 		HRB$M_STATE_INVALID>, -
                                     1E2A  5736 		HRB$W_STATE(R3)		   
                            0C   13  1E2A  5737 	BEQL	25$                       ; Yes, continue processing.
                          001C   31  1E2C  5738 	BRW	150$			  ;  No, bail out
                                     1E2F  5739 20$:
                                     1E2F  5740 ;
                                     1E2F  5741 ; The sequential command has been popped off the blocked queue. Update the 
                                     1E2F  5742 ; state and counter to reflect this.
                                     1E2F  5743 ;
                         28 A4   B7  1E2F  5744 	DECW	UQB$W_NUM_QUE(R4)	; Decrement queue counter.
                       8000 8F   A8  1E32  5745 	BISW	#HRB$M_STATE_INVALID,-	; Set the state to invalid
                         14 A3       1E36  5746 		HRB$W_STATE(R3)		;
                                     1E38  5747 25$:
                                     1E38  5748 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1E38  5749 	PUSHAB	115$			; Set the return address.
                                     1E38  5750 	PUSHL	HRB$L_RESPC(R3)		; Restart the blocked request.
                                     1E38  5751 	BRW	TMSCP$PCHIST_R3		; Log the PC for debugging.
                                     1E38  5752 
                                     1E38  5753 115$:
                                     1E38  5754 	BSBW	TMSCP$PCHIST		; Log the PC for debugging.
                                     1E38  5755 	.IFF
                         0C B3   16  1E38  5756 	JSB	@HRB$L_RESPC(R3)	; Resume where we left off
                                     1E3B  5757 	.ENDC  ;DEBUG$PC_HISTORY
                                     1E3B  5758 
                                     1E3B  5759 120$:
                            3F   BA  1E3B  5760         POPR	#^M<R0,R1,R2,R3,R4,R5>  ; restore
                                     1E3D  5761 130$:
                                 05  1E3D  5762 	RSB
                                     1E3E  5763 
                                     1E3E  5764 140$:
                    0E A4   01   AA  1E3E  5765 	BICW	# UQB$M_SEQ, -		; All sequential processing has completed.
                                     1E42  5766 		UQB$W_FLAGS(R4)
                         28 A4   B5  1E42  5767 	TSTW	UQB$W_NUM_QUE(R4)	; Any requests in queue?
                            F4   13  1E45  5768 	BEQL	120$			; No, kill this thread - branch.
                                     1E47  5769 	BUG_CHECK TMSCPSERV,FATAL	; REMQUE indicates no requests in the queue,
                               FEFF  1E47       		.WORD	^XFEFF
                               0004' 1E49       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_TMSCPSERV!4
                                     1E4B  5770 					; yet the count is non-zero, this is a bug.
                                     1E4B  5771 
                                     1E4B  5772 150$:
                                     1E4B  5773 	BUG_CHECK TMSCPSERV,FATAL	; Only HRBs in the SEQ_WAIT state
                               FEFF  1E4B       		.WORD	^XFEFF
                               0004' 1E4D       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_TMSCPSERV!4
                                     1E4F  5774 					; should be in the BLOCKED queue.
                                     1E4F  5775 
                                     1E4F  5776 	.DISABLE LSB
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 124
X-17                            - CHECK_XFER_STATUS - Translate the clas 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (45)

                                     1E4F  5779 	.SBTTL	-	CHECK_XFER_STATUS - Translate the class driver message to a MSCP message
                                     1E4F  5780 
                                     1E4F  5781 ;+
                                     1E4F  5782 ; Functional Description:
                                     1E4F  5783 ;
                                     1E4F  5784 ; This routine is called to translate the error from a system service 
                                     1E4F  5785 ; error message to the proper MSCP error code to return to the client 
                                     1E4F  5786 ; processor.
                                     1E4F  5787 ;
                                     1E4F  5788 ; Inputs:
                                     1E4F  5789 ;
                                     1E4F  5790 ;	R0  =  system service error code 
                                     1E4F  5791 ;	R1  =  Scratch
                                     1E4F  5792 ;	R2  =  Scratch
                                     1E4F  5793 ;	R3  =  HRB address
                                     1E4F  5794 ;	R4  =  Scratch
                                     1E4F  5795 ;	R5  =  Scratch
                                     1E4F  5796 ;
                                     1E4F  5797 ; Outputs:
                                     1E4F  5798 ;	R0  =  TMSCP error code.
                                     1E4F  5799 ;	R2  =  MSCP packet address.
                                     1E4F  5800 ;	R3  =  HRB address
                                     1E4F  5801 ;	R4  =  UQB address
                                     1E4F  5802 ;
                                     1E4F  5803 ;	R1, R5  Destroyed.
                                     1E4F  5804 ;
                                     1E4F  5805 ;-
                                     1E4F  5806 
                                     1E4F  5807 TMSCP$CHECK_XFER_STATUS::
                                     1E4F  5808 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1E4F  5809 	BSBW	TMSCP$PCHIST_R3R0	; Log the PC for debugging.
                                     1E4F  5810 	.ENDC  ;DEBUG$PC_HISTORY
                    54   58 A3   D0  1E4F  5811 	MOVL	HRB$L_UQB(R3),R4	; Get the UQB address
                  52   1E7E'CF   3E  1E53  5812 	MOVAW	TMSCP$ERR_TBL,R2	; Get the address of the error table
                                     1E58  5813 
                                     1E58  5814 10$:
                       51   82   3C  1E58  5815 	MOVZWL	(R2)+,R1		; Take the VMS error code out
                            0A   13  1E5B  5816 	BEQL	20$			; Check for the end of the table
                       50   51   B1  1E5D  5817 	CMPW	R1,R0			; Compare the VMS error with that passed
                            05   13  1E60  5818 	BEQL	20$			; They matched! do the translation
                       52   04   C0  1E62  5819 	ADDL	#4,R2			; Step to next entry
                            F1   11  1E65  5820 	BRB	10$			;  and start it all over again
                                     1E67  5821 
                                     1E67  5822 20$:
                       50   82   3C  1E67  5823 	MOVZWL	(R2)+,R0		; Pick up the corresponding MSCP error
                       51   62   32  1E6A  5824 	CVTWL	(R2),R1			; Get possible routine
                            03   13  1E6D  5825 	BEQL	30$			; None
                                     1E6F  5826 	.IF	DEFINED DEBUG$PC_HISTORY
                                     1E6F  5827 	PUSHAB	25$			; Set the return address.
                                     1E6F  5828 	PUSHAB	(R1)[R2]		; Get the routine to invoke.
                                     1E6F  5829 	BRW	TMSCP$PCHIST		; Log the PC for debugging.
                                     1E6F  5830 
                                     1E6F  5831 25$:
                                     1E6F  5832 	BSBW	TMSCP$PCHIST		; Log the PC for debugging.
                                     1E6F  5833 	.IFF
                          6142   16  1E6F  5834 	JSB	(R1)[R2]		; Invoke the routine
                                     1E72  5835 	.ENDC  ;DEBUG$PC_HISTORY
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 125
X-17                            - CHECK_XFER_STATUS - Translate the clas 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (45)

                                     1E72  5836 ;
                                     1E72  5837 ; Do some final cleaning up
                                     1E72  5838 ;
                                     1E72  5839 ;		R0  =  TMSCP error code
                                     1E72  5840 ;		R1  =  Scratch
                                     1E72  5841 ;		R2  =  MSCP packet address
                                     1E72  5842 ;		R3  =  HRB address
                                     1E72  5843 ;		R4  =  UQB address
                                     1E72  5844 ;		R5  =  Scratch
                                     1E72  5845 ;
                                     1E72  5846 
                                     1E72  5847 30$:
                    52   18 A3   D0  1E72  5848 	MOVL	HRB$L_MSGBUF(R3),R2	; MSCP packet address from the HRB
                            05   13  1E76  5849 	BEQL	35$
                            8E   D5  1E78  5850 	TSTL	(SP)+			; Return to caller's caller.
                          01BD   31  1E7A  5851 	BRW	TMSCP$SEND_END		; Send an end packet with R0 status
                                     1E7D  5852 
                                     1E7D  5853 35$:
                                 05  1E7D  5854 	RSB
                                     1E7E  5855 
                                     1E7E  5856 	.NOSHOW	MEB
                                     1E7E  5857 
                                     1E7E  5858 TMSCP$ERR_TBL::
                                     1E7E  5859 	ACTION	SS$_ABORT,	MSCP$K_ST_ABRTD
                                     1E84  5860 	ACTION	SS$_BUGCHECK,	MSCP$K_ST_ICMD
                                     1E8A  5861 	ACTION	SS$_CTRLERR,	MSCP$K_ST_CNTLR,	TMSCP$SET_SEX
                                     1E90  5862 	ACTION	SS$_DATACHECK,	MSCP$K_ST_COMP,		TMSCP$SET_SEX
                                     1E96  5863 	ACTION	SS$_DATALATE,	<MSCP$K_SC_DLATE@MSCP$V_ST_SBCOD!MSCP$K_ST_CNTLR>
                                     1E9C  5864 	ACTION	SS$_DATALOST,	MSCP$K_ST_DATA,		TMSCP$ERR_DLS
                                     1EA2  5865 	ACTION	SS$_DATAOVERUN,	MSCP$K_ST_RDTRN,	TMSCP$SET_SEX
                                     1EA8  5866 	ACTION	SS$_DEVOFFLINE,	MSCP$K_ST_OFFLN,	TMSCP$ERR_OFFLINE
                                     1EAE  5867 	ACTION	SS$_DRVERR,	MSCP$K_ST_DRIVE,	TMSCP$SET_SEX
                                     1EB4  5868 	ACTION	SS$_DUPUNIT,	<MSCP$K_SC_DUPUN@MSCP$V_ST_SBCOD!MSCP$K_ST_OFFLN>
                                     1EBA  5869 	ACTION	SS$_ENDOFFILE,	MSCP$K_ST_TAPEM,	TMSCP$ERR_EOF
                                     1EC0  5870 	ACTION	SS$_ENDOFTAPE,	MSCP$K_ST_SUCC,		TMSCP$ERR_EOT
                                     1EC6  5871 	ACTION	SS$_ENDOFVOLUME,MSCP$K_ST_LED,		TMSCP$ERR_LEOT
                                     1ECC  5872 	ACTION	SS$_FORMAT,	MSCP$K_ST_MFMTE
                                     1ED2  5873 	ACTION	SS$_ILLIOFUNC,	MSCP$K_ST_ICMD,		TMSCP$SET_SEX
                                     1ED8  5874 	ACTION	SS$_IVBUFLEN,	MSCP$K_ST_HSTBF,	TMSCP$SET_SEX
                                     1EDE  5875 	ACTION	SS$_MEDOFL,	MSCP$K_ST_OFFLN,	TMSCP$ERR_OFFLINE
                                     1EE4  5876 	ACTION	SS$_OPINCOMPL,	MSCP$K_ST_DATA
                                     1EEA  5877 	ACTION	SS$_PARITY,	<MSCP$K_SC_LGE@MSCP$V_ST_SBCOD!MSCP$K_ST_DATA>
                                     1EF0  5878 	ACTION	SS$_SERIOUSEXCP,MSCP$K_ST_PRESE
                                     1EF6  5879 	ACTION	SS$_TAPEPOSLOST	MSCP$K_ST_PLOST,	TMSCP$ERR_PLOST
                                     1EFC  5880 	ACTION	SS$_TIMEOUT,	<MSCP$K_SC_UNKNO@MSCP$V_ST_SBCOD!MSCP$K_ST_OFFLN>,TMSCP$ERR_OFFLINE
                                     1F02  5881 	ACTION	SS$_VOLINV,	MSCP$K_ST_OFFLN,	TMSCP$ERR_OFFLINE
                                     1F08  5882 	ACTION	SS$_WRITLCK,	MSCP$K_ST_WRTPR,	TMSCP$ERR_WRITLCK
                                     1F0E  5883 	ACTION	0,MSCP$K_ST_DRIVE	; PATCH SPACE
                                     1F14  5884 	ACTION	0,MSCP$K_ST_DRIVE	; End of table - default error
                                     1F1A  5885 
                                     1F1A  5886 	.SHOW	MEB
                                     1F1A  5887 
                                     1F1A  5888 ;
                                     1F1A  5889 ;		R0  =  TMSCP error code
                                     1F1A  5890 ;		R1  =  Scratch
                                     1F1A  5891 ;		R2  =  Scratch
                                     1F1A  5892 ;		R3  =  HRB address
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 126
X-17                            - CHECK_XFER_STATUS - Translate the clas 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (45)

                                     1F1A  5893 ;		R4  =  UQB address
                                     1F1A  5894 ;		R5  =  Scratch
                                     1F1A  5895 ;
                                     1F1A  5896 
                                     1F1A  5897 TMSCP$ERR_OFFLINE::
                    55   24 A4   D0  1F1A  5898 	MOVL	UQB$L_UCB(R4),R5	;  and follow that to the UCB address
                         70 A4   D5  1F1E  5899 	TSTL	UQB$L_ONLINE_HQB(R4)
                            07   13  1F21  5900 	BEQL	60$			;
                         70 A4   D4  1F23  5901 	CLRL	UQB$L_ONLINE_HQB(R4)
                                     1F26  5902 
                                     1F26  5903 40$:
                       00C2 C5   97  1F26  5904 	DECB	UCB$B_ONLCNT(R5)	;  and note the change in online count
                                     1F2A  5905 
                                     1F2A  5906 ;
                                     1F2A  5907 ; All the bits for this unit have been cleared. Now the status of this 
                                     1F2A  5908 ; device is changed in the UQB to "offline". This status may be changed
                                     1F2A  5909 ; to "available" by the GUS command, and then eventually to "online" 
                                     1F2A  5910 ; after the successful completion of an online command.
                                     1F2A  5911 ;
                                     1F2A  5912 
                                     1F2A  5913 60$:
                            03   B0  1F2A  5914 	MOVW	#UQB$K_ST_OFFLINE,-	; Now set the state of this device to
                         0C A4       1F2C  5915 		UQB$W_STATE(R4)		;   reflect the sum of individual states
                                 05  1F2E  5916 	RSB				;  and return with the device offline
                                     1F2F  5917 
                                     1F2F  5918 
                                     1F2F  5919 ;
                                     1F2F  5920 ;		R0  =  TMSCP error code
                                     1F2F  5921 ;		R1  =  Scratch
                                     1F2F  5922 ;		R2  =  Scratch
                                     1F2F  5923 ;		R3  =  HRB address
                                     1F2F  5924 ;		R4  =  UQB address
                                     1F2F  5925 ;		R5  =  Scratch
                                     1F2F  5926 ;
                                     1F2F  5927 
                                     1F2F  5928 TMSCP$ERR_WRITLCK::
                            0D   E2  1F2F  5929 	BBSS	#MSCP$V_UF_WRTPH,-	; Set the write protect bit in
                      07 16 A4       1F31  5930 		UQB$W_UNIT_FLAGS(R4),10$;  the unit flag field
                       0040 8F   A8  1F34  5931 	BISW	#UQB$M_ST_WRTPH,-
                       00C8 C4       1F38  5932 		UQB$W_ST_FLAGS(R4)
                                     1F3B  5933 
                                     1F3B  5934 10$:
                                 05  1F3B  5935 	RSB
                                     1F3C  5936 
                                     1F3C  5937 ;
                                     1F3C  5938 ;	End of tape encountered
                                     1F3C  5939 ;
                                     1F3C  5940 ;		R0  =  TMSCP error code
                                     1F3C  5941 ;		R1  =  Scratch
                                     1F3C  5942 ;		R2  =  Scratch
                                     1F3C  5943 ;		R3  =  HRB address
                                     1F3C  5944 ;		R4  =  UQB address
                                     1F3C  5945 ;		R5  =  Scratch
                                     1F3C  5946 ;
                                     1F3C  5947 
                                     1F3C  5948 TMSCP$ERR_EOT::
                            02   E2  1F3C  5949 	BBSS	#UQB$V_ST_EOT,-		; Reflect it in the UQB
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 127
X-17                            - CHECK_XFER_STATUS - Translate the clas 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (45)

                    0D 00C8 C4       1F3E  5950 		UQB$W_ST_FLAGS(R4),5$	;	
                          005D   30  1F42  5951 	BSBW	TMSCP$SET_SEX
                    52   18 A3   D0  1F45  5952 	MOVL	HRB$L_MSGBUF(R3), R2	; No end packet means it is a
                            04   13  1F49  5953 	BEQL	5$			;  caching type command
                            08   A8  1F4B  5954 	BISW	#MSCP$M_EF_EOT,-	; Set end of tape flag in MSCP
                         09 A2       1F4D  5955 		MSCP$B_FLAGS(R2)	;   packet
                                     1F4F  5956 
                                     1F4F  5957 5$:
                            5D   11  1F4F  5958 	BRB	TMSCP$RECOVERABLE_ERROR
                                     1F51  5959 
                                     1F51  5960 ;
                                     1F51  5961 ;	Position of tape lost
                                     1F51  5962 ;
                                     1F51  5963 ;		R0  =  TMSCP error code
                                     1F51  5964 ;		R1  =  Scratch
                                     1F51  5965 ;		R2  =  Scratch
                                     1F51  5966 ;		R3  =  HRB address
                                     1F51  5967 ;		R4  =  UQB address
                                     1F51  5968 ;		R5  =  Scratch
                                     1F51  5969 ;
                                     1F51  5970 
                                     1F51  5971 TMSCP$ERR_PLOST::
                    52   18 A3   D0  1F51  5972 	MOVL	HRB$L_MSGBUF(R3), R2	; No end packet means it is a
                            04   13  1F55  5973 	BEQL	5$			;  caching type command
                            04   88  1F57  5974 	BISB	#MSCP$M_EF_PLS,-	; Set end of tape flag in MSCP
                         09 A2       1F59  5975 		MSCP$B_FLAGS(R2)	;   packet
                                     1F5B  5976 
                                     1F5B  5977 5$:
                            04   E2  1F5B  5978 	BBSS	#UQB$V_ST_PLS,-		; Reflect it in the UQB
                    01 00C8 C4       1F5D  5979 		UQB$W_ST_FLAGS(R4),10$	;
                                 05  1F61  5980 	RSB
                                     1F62  5981 
                                     1F62  5982 10$:
                          003D   30  1F62  5983 	BSBW	TMSCP$SET_SEX
                            47   11  1F65  5984 	BRB	TMSCP$RECOVERABLE_ERROR
                                     1F67  5985 
                                     1F67  5986 ;
                                     1F67  5987 ;	Logical end of tape encountered
                                     1F67  5988 ;
                                     1F67  5989 ;		R0  =  TMSCP error code
                                     1F67  5990 ;		R1  =  Scratch
                                     1F67  5991 ;		R2  =  Scratch
                                     1F67  5992 ;		R3  =  HRB address
                                     1F67  5993 ;		R4  =  UQB address
                                     1F67  5994 ;		R5  =  Scratch
                                     1F67  5995 ;
                                     1F67  5996 
                                     1F67  5997 TMSCP$ERR_LEOT::
                            08   A8  1F67  5998 	BISW	#UQB$M_ST_LEOT,-	; Reflect it in the UQB
                       00C8 C4       1F69  5999 		UQB$W_ST_FLAGS(R4)
                          0033   30  1F6C  6000 	BSBW	TMSCP$SET_SEX
                            3D   11  1F6F  6001 	BRB	TMSCP$RECOVERABLE_ERROR
                                     1F71  6002 
                                     1F71  6003 ;
                                     1F71  6004 ;	Cached data lost
                                     1F71  6005 ;
                                     1F71  6006 ;		R0  =  TMSCP error code
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 128
X-17                            - CHECK_XFER_STATUS - Translate the clas 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (45)

                                     1F71  6007 ;		R1  =  Scratch
                                     1F71  6008 ;		R2  =  Scratch
                                     1F71  6009 ;		R3  =  HRB address
                                     1F71  6010 ;		R4  =  UQB address
                                     1F71  6011 ;		R5  =  Scratch
                                     1F71  6012 ;
                                     1F71  6013 		
                                     1F71  6014 TMSCP$ERR_DLS::
                    52   18 A3   D0  1F71  6015 	MOVL	HRB$L_MSGBUF(R3), R2	; No end packet means it is a
                            04   13  1F75  6016 	BEQL	5$			;  caching type command
                            02   88  1F77  6017 	BISB	#MSCP$M_EF_DLS,-	; Set end of tape flag in MSCP
                         09 A2       1F79  6018 		MSCP$B_FLAGS(R2)	;   packet
                                     1F7B  6019 
                                     1F7B  6020 5$:
                            02   A8  1F7B  6021 	BISW	#UQB$M_ST_DLS,-		; Reflect it in the UQB
                       00C8 C4       1F7D  6022 		UQB$W_ST_FLAGS(R4)	
                            20   11  1F80  6023 	BRB	TMSCP$SET_SEX
                                     1F82  6024 
                                     1F82  6025 ;
                                     1F82  6026 ;	A Serious Exception condition was encountered...set the serious
                                     1F82  6027 ;	exception state flag in the end packet.
                                     1F82  6028 ;
                                     1F82  6029 
                                     1F82  6030 ;
                                     1F82  6031 ; End of file can not only mean we encountered a tape mark in the
                                     1F82  6032 ; forward direction, but that we hit on in reverse, and possibly
                                     1F82  6033 ; at BOT.
                                     1F82  6034 ;
                                     1F82  6035 ;		R0  =  TMSCP error code
                                     1F82  6036 ;		R1  =  Scratch
                                     1F82  6037 ;		R2  =  Scratch
                                     1F82  6038 ;		R3  =  HRB address
                                     1F82  6039 ;		R4  =  UQB address
                                     1F82  6040 ;		R5  =  Scratch
                                     1F82  6041 ;
                                     1F82  6042 
                                     1F82  6043 TMSCP$ERR_EOF::
                          001D   30  1F82  6044 	BSBW	TMSCP$SET_SEX
                    55   24 A4   D0  1F85  6045 	MOVL	UQB$L_UCB(R4),R5	; Restore UCB
                    52   18 A3   D0  1F89  6046         MOVL	HRB$L_MSGBUF(R3),R2
                       00C4 C5   D0  1F8D  6047         MOVL    UCB$L_RECORD(R5),-      ; update position
                         1C A2       1F91  6048 		MSCP$L_POSITION(R2)     ; 
                            10   E1  1F93  6049 	BBC	#MT$V_BOT,-		; Are we at BOT?
                      09 50 A5       1F95  6050 		UCB$L_DEVDEPEND(R5),10$	;
                       50   0D   3C  1F98  6051 	MOVZWL	#MSCP$K_ST_BOT,R0	; Then return MSCP status as such
                            02   E5  1F9B  6052 	BBCC	#UQB$V_ST_EOT,-		;
                    00 00C8 C4       1F9D  6053 		UQB$W_ST_FLAGS(R4),10$	;
                                     1FA1  6054 
                                     1FA1  6055 10$:
                                 05  1FA1  6056 	RSB
                                     1FA2  6057 	
                                     1FA2  6058 ;
                                     1FA2  6059 ;		R0  =  TMSCP error code
                                     1FA2  6060 ;		R1  =  Scratch
                                     1FA2  6061 ;		R2  =  Scratch
                                     1FA2  6062 ;		R3  =  HRB address
                                     1FA2  6063 ;		R4  =  UQB address
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 129
X-17                            - CHECK_XFER_STATUS - Translate the clas 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (45)

                                     1FA2  6064 ;		R5  =  Scratch
                                     1FA2  6065 ;
                                     1FA2  6066 
                                     1FA2  6067 TMSCP$SET_SEX::
                            20   A8  1FA2  6068 	BISW	#UQB$M_ST_SEREX,-	; Reflect it in the UQB
                       00C8 C4       1FA4  6069 		UQB$W_ST_FLAGS(R4)
                                     1FA7  6070 ;	BBC	#UQB$V_FLUSH,-		; If the cache is being flushed and
                                     1FA7  6071 ;		UQB$W_FLAGS(R4),10$	;  we have gotten a serious error,
                                     1FA7  6072 ;	BISW	#UQB$M_ST_DLS,-		;  set the cached data lost bit
                                     1FA7  6073 ;		UQB$W_ST_FLAGS(R4)	;  in the UQB
                                     1FA7  6074 
                                     1FA7  6075 10$:
                                 05  1FA7  6076 	RSB
                                     1FA8  6077 
                                     1FA8  6078 TMSCP$ANCILLARY_TABLE::
                                 12  1FA8  6079 	.BYTE	MSCP$K_OP_ERASE
                                 16  1FA9  6080 	.BYTE	MSCP$K_OP_ERGAP
                                 21  1FAA  6081 	.BYTE	MSCP$K_OP_READ
                                 25  1FAB  6082 	.BYTE	MSCP$K_OP_REPOS
                                 22  1FAC  6083 	.BYTE	MSCP$K_OP_WRITE
                                 24  1FAD  6084 	.BYTE	MSCP$K_OP_WRITM
                           00000006  1FAE  6085 TMSCP$ANCILLARY_TABLE_LEN	=	. - TMSCP$ANCILLARY_TABLE
                                     1FAE  6086 
                                     1FAE  6087 ;
                                     1FAE  6088 ;		R0  =  TMSCP error code
                                     1FAE  6089 ;		R1  =  Scratch
                                     1FAE  6090 ;		R2  =  Scratch
                                     1FAE  6091 ;		R3  =  HRB address
                                     1FAE  6092 ;		R4  =  UQB address
                                     1FAE  6093 ;		R5  =  Scratch
                                     1FAE  6094 ;
                                     1FAE  6095 
                                     1FAE  6096 TMSCP$RECOVERABLE_ERROR::
                    52   18 A3   D0  1FAE  6097 	MOVL	HRB$L_MSGBUF(R3),R2	; Restore MSCP packet address
                            0F   13  1FB2  6098 	BEQL	10$			; Immediate command - branch.
                    51   08 A2   9A  1FB4  6099 	MOVZBL	MSCP$B_OPCODE(R2),R1	; Restore opcode
                            03   BB  1FB8  6100 	PUSHR	#^M<R0,R1>		; Save registers destroyed by LOCC
                       06   51   3A  1FBA  6101 	LOCC	R1,#TMSCP$ANCILLARY_TABLE_LEN,-; Is this a "move" command?
                         E9 AF       1FBD  6102 		TMSCP$ANCILLARY_TABLE
                            03   BA  1FBF  6103 	POPR	#^M<R0,R1>
                            03   13  1FC1  6104 	BEQL	20$			; EQL <= not a "move" command
                                     1FC3  6105 
                                     1FC3  6106 10$:
                            51 8ED0  1FC3  6107 	POPL	R1			; Remove caller's address and
                                     1FC6  6108 					;   return to caller of CHECK_XFER_STATUS.
                                     1FC6  6109 
                                     1FC6  6110 20$:
                                 05  1FC6  6111 	RSB
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 130
X-17                            - FIND UQB - Find the UQB corresponding  16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (46)

                                     1FC7  6114 	.SBTTL	-	FIND UQB - Find the UQB corresponding to this request
                                     1FC7  6115 
                                     1FC7  6116 ;+
                                     1FC7  6117 ; Functional Description:
                                     1FC7  6118 ;
                                     1FC7  6119 ; This routine is called when a MSCP command packet is being processed that
                                     1FC7  6120 ; references a specific unit. This routine searches the list of units known to
                                     1FC7  6121 ; the server and returns the UQB with the unit number corresponding to the one
                                     1FC7  6122 ; specified in the MSCP packet. If the proper UQB cannot be found we die trying.
                                     1FC7  6123 ; An illegal command end packet is returned to the host and the request is
                                     1FC7  6124 ; finished off. Control is not passed back to the caller unless we are 
                                     1FC7  6125 ; successful.
                                     1FC7  6126 ; 
                                     1FC7  6127 ; Inputs:
                                     1FC7  6128 ;
                                     1FC7  6129 ;	R2  =  MSCP packet address
                                     1FC7  6130 ;	R3  =  HRB address 
                                     1FC7  6131 ;
                                     1FC7  6132 ; Outputs:
                                     1FC7  6133 ;
                                     1FC7  6134 ;	R0  =  returned status
                                     1FC7  6135 ;		0 => UQB for the unit was not found
                                     1FC7  6136 ; 		SS$_NORMAL => the UQB was located
                                     1FC7  6137 ;	R2  =  MSCP packet address
                                     1FC7  6138 ;	R3  =  HRB address  (the UQB address is placed in the proper offset)
                                     1FC7  6139 ;
                                     1FC7  6140 ; All registers used in this subroutine are returned to their original state
                                     1FC7  6141 ; on return to the caller.
                                     1FC7  6142 ;-
                                     1FC7  6143 
                                     1FC7  6144 	.ENABLE	LOCAL_BLOCK
                                     1FC7  6145 
                                     1FC7  6146 TMSCP$FIND_UQB::
                            32   BB  1FC7  6147 	PUSHR	#^M<R1,R4,R5>		; Save any registers we plan on using
                    55   54 A3   D0  1FC9  6148 	MOVL	HRB$L_HQB(R3),R5	; Get the address of the HQB 
                            01   E1  1FCD  6149 	BBC	#HQB$V_V5CL,-		; If this is a request from the old
                      53 12 A5       1FCF  6150 		HQB$W_FLAGS(R5),100$	;  class driver, use the old code
                                     1FD2  6151 
                                     1FD2  6152 ;
                                     1FD2  6153 ; The request just received was sent from a client system running a version
                                     1FD2  6154 ; of the tape class driver that is V5.0 or later. This means that the unit 
                                     1FD2  6155 ; number is of the new format. Bit 14 of the unit number, which indicates the
                                     1FD2  6156 ; unit number is a Server Local Unit Number (SLUN) is cleared, and the unit 
                                     1FD2  6157 ; number becomes the index into the unit table where the address of the UQB
                                     1FD2  6158 ; for this unit can be found.
                                     1FD2  6159 ;                                                                   
                    55   32 A5   D0  1FD2  6160 	MOVL	HQB$L_TSRV(R5),R5	; Get the server structure address
                       7FFF 8F   B1  1FD6  6161 	CMPW	#MSCP$K_SLUN_RSVP,-	; Is this the magic SLUN unit number
                         04 A2       1FDA  6162 		MSCP$W_UNIT(R2)		;  that requests a search is needed?
                            1E   13  1FDC  6163  	BEQL	20$			; Branch if yes and search for UQB
                                     1FDE  6164 
                                     1FDE  6165 10$:
                    50   04 A2   3C  1FDE  6166 	MOVZWL	MSCP$W_UNIT(R2),R0	; Put the unit number in a register
                    12 50   0E   E5  1FE2  6167 	BBCC	#MSCP$V_SLUN,R0,15$	; Check SLUN bit and clear index
                  50   0100 8F   B1  1FE6  6168 	CMPW	#MAX_UNITS,R0		; Past end of table?
                            08   1B  1FEB  6169 	BLEQU	13$			; Unit out of range - branch.
                54   00C4 C540   D0  1FED  6170 	MOVL	TSRV$L_UNITS(R5)[R0],R4	; Find the UQB address in the table
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 131
X-17                            - FIND UQB - Find the UQB corresponding  16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (46)

                            34   12  1FF3  6171 	BNEQ	120$			; Continue if there is one
                                     1FF5  6172 
                                     1FF5  6173 13$:
                          003E   31  1FF5  6174 	BRW	TMSCP$BAD_UNIT		; Else indicate no such unit
                                     1FF8  6175 
                                     1FF8  6176 15$:
                                     1FF8  6177 	BUG_CHECK TMSCPSERV, FATAL	; No SLUN bit set from V5+ class driver
                               FEFF  1FF8       		.WORD	^XFEFF
                               0004' 1FFA       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_TMSCPSERV!4
                                     1FFC  6178 
                                     1FFC  6179 ;
                                     1FFC  6180 ; The magic unit number means that this is the first get unit status command 
                                     1FFC  6181 ; received from a v5.0 class driver after a new connection has formed. The
                                     1FFC  6182 ; class driver is asking for the server local unit number that corresponds 
                                     1FFC  6183 ; to the unit with the unit identifier that is passed in the two longwords 
                                     1FFC  6184 ; beyond the end of the "normal" get unit status command. The server searches
                                     1FFC  6185 ; the list of known units for a match of the unit identifier, and returns the
                                     1FFC  6186 ; server local unit number as the unit number in the MSCP end message.
                                     1FFC  6187 ;                                                                
                                     1FFC  6188 
                                     1FFC  6189 20$:
                  51   00C4 C5   DE  1FFC  6190  	MOVAL	TSRV$L_UNITS(R5),R1	;  determine the start of the unit table
              50   00000100 8F   D0  2001  6191 	MOVL	#MAX_UNITS,R0		; Number of elements in the unit table
                                     2008  6192 
                                     2008  6193 30$:
                       54   81   D0  2008  6194 	MOVL	(R1)+,R4		; Get the address of the next table entry
                            0C   13  200B  6195 	BEQL	35$			;  skip it if zero
                            0F   BB  200D  6196 	PUSHR	#^M<R0,R1,R2,R3>	; Save the registers
                    14 A2   08   29  200F  6197 	CMPC3	#8,MSCP$Q_UNIT_ID(R2),-	;  and compare the unit-id passed 
                         18 A4       2013  6198 		UQB$Q_UNIT_ID(R4)	;  to the id in the UQB
                            0F   BA  2015  6199 	POPR	#^M<R0,R1,R2,R3>	;  and restore them back
                            05   13  2017  6200 	BEQL	40$			; If it is a match exit the loop
                                     2019  6201 
                                     2019  6202 35$:
                         EC 50   F5  2019  6203 	SOBGTR	R0,30$			; Otherwise search to the end of table
                            18   11  201C  6204 	BRB	TMSCP$BAD_UNIT		; If still not found return an error
                                     201E  6205 
                                     201E  6206 40$:
                         5E A4   B0  201E  6207 	MOVW	UQB$W_SLUN(R4),-	; Return the local unit number in the
                         04 A2       2021  6208 		MSCP$W_UNIT(R2)		;  end message to the client
                            B9   11  2023  6209 	BRB	10$			; Return to the main path
                                     2025  6210 
                                     2025  6211 ;
                                     2025  6212 ; This request was received from a pre-V5.0 class driver. Since ONLY V5 
                                     2025  6213 ; connections are established, this is a BUG!
                                     2025  6214 ;
                                     2025  6215 
                                     2025  6216 100$:
                                     2025  6217 	BUG_CHECK TMSCPSERV, FATAL	; Wrong class driver 
                               FEFF  2025       		.WORD	^XFEFF
                               0004' 2027       		.IIF IDN <FATAL>,<FATAL> , .WORD	BUG$_TMSCPSERV!4
                                     2029  6218 
                                     2029  6219 ;
                                     2029  6220 ; The proper UQB for this request was found. Place its address in the Host
                                     2029  6221 ; Request Block and return to the caller.
                                     2029  6222 ;
                                     2029  6223 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 132
X-17                            - FIND UQB - Find the UQB corresponding  16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (46)

                                     2029  6224 120$:
                    58 A3   54   D0  2029  6225 	MOVL	R4,HRB$L_UQB(R3)	; Otherwise save the UQB address
                         12 A4   B6  202D  6226 	INCW	UQB$W_CURRENT(R4)	; One more active request on this unit
                                     2030  6227 	.IF DEFINED DEBUG$CURRENT_SANITY
                                     2030  6228 	BSBW	TMSCP$CHECK_CURRENT	; Sanity check the current counters
                                     2030  6229 	.ENDC	   ;DEBUG$CURRENT_SANITY
                       50   01   D0  2030  6230 	MOVL	#SS$_NORMAL,R0		; Set a normal return status
                                     2033  6231 
                                     2033  6232 130$:
                            32   BA  2033  6233 	POPR	#^M<R1,R4,R5>		; Restore the registers we used
                                 05  2035  6234 	RSB				;  and return to the caller
                                     2036  6235 
                                     2036  6236 TMSCP$BAD_UNIT::
                            50   D4  2036  6237 	CLRL	R0			; Return an unsuccessful status
                            F9   11  2038  6238 	BRB	130$			; Restore registers and return.
                                     203A  6239 
                                     203A  6240 	.DISABLE	LOCAL_BLOCK
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 133
X-17                            - SEND END - Respond To The Request      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (47)

                                     203A  6243 	.SBTTL	-	SEND END - Respond To The Request
                                     203A  6244 
                                     203A  6245 ;+
                                     203A  6246 ; Functional Description:
                                     203A  6247 ;
                                     203A  6248 ; This routine is called (with several entry points) to respond to the 
                                     203A  6249 ; MSCP message packet received. It reuses the MSCP packet received to
                                     203A  6250 ; send a MSCP end message response.
                                     203A  6251 ;
                                     203A  6252 ; Inputs:
                                     203A  6253 ;
                                     203A  6254 ;	R0  =  status to be returned
                                     203A  6255 ;	R2  =  MSCP packet address
                                     203A  6256 ;	R3  =  HRB address 
                                     203A  6257 ;
                                     203A  6258 ; Outputs:
                                     203A  6259 ;
                                     203A  6260 ;	R3  =  HRB address
                                     203A  6261 ;	R4  =  altered
                                     203A  6262 ;	R5  =  CDRP address
                                     203A  6263 ;-
                                     203A  6264 
                                     203A  6265 ;
                                     203A  6266 ; Entry here, means that the message buffer is to be returned with status.
                                     203A  6267 ; 
                                     203A  6268 
                                     203A  6269 TMSCP$SEND_END::
                                     203A  6270 	.IF DEFINED DEBUG$PC_HISTORY
                                     203A  6271 	PUSHL	R0			; Save the MSCP command status.
                                     203A  6272 	MOVL	MSCP$L_CMD_REF(R2), R0	; Save the command reference number.
                                     203A  6273 	BSBW	TMSCP$PCHIST_R3R0	; Save this PC if we are keeping track
                                     203A  6274 	POPL	R0			; Get the MSCP command status.
                                     203A  6275 	BSBW	TMSCP$R0HIST		; Save this value.
                                     203A  6276 	.ENDC	   ;DEBUG$PC_HISTORY
                    0A A2   50   B0  203A  6277 	MOVW	R0,MSCP$W_STATUS(R2)	; Set the status
                    54   58 A3   D0  203E  6278 	MOVL	HRB$L_UQB(R3),R4	; Restore UQB
                            28   13  2042  6279 	BEQL	40$			; No UQB for TMSCP$VC_ERR routine
                            05   E1  2044  6280 	BBC	#UQB$V_ST_SEREX,-	; Serious exception condition exists?
                    04 00C8 C4       2046  6281 		UQB$W_ST_FLAGS(R4),10$	;
                            10   88  204A  6282 	BISB	#MSCP$M_EF_SEREX,-	; Set serious exception state flag
                         09 A2       204C  6283 		MSCP$B_FLAGS(R2)	;  in MSCP end packet
                                     204E  6284 
                                     204E  6285 10$:
                            01   E1  204E  6286 	BBC	#UQB$V_ST_DLS,-		; If the cached data lost flag
                    04 00C8 C4       2050  6287 		UQB$W_ST_FLAGS(R4),20$	;  is set in the UQB, we'd better
                            08   B0  2054  6288 	MOVW	#MSCP$K_ST_DATA,-	;  set cached data lost in
                         0A A2       2056  6289 		MSCP$W_STATUS(R2)	;  the end packet		
                                     2058  6290 
                                     2058  6291 20$:
                            03   E5  2058  6292 	BBCC	#UQB$V_ST_LEOT,-	; If the logical end of tape flag
                    04 00C8 C4       205A  6293 		UQB$W_ST_FLAGS(R4),30$	;  is set in the UQB, we'd better
                            13   B0  205E  6294 	MOVW	#MSCP$K_ST_LED,-	;  set logical end of tape in
                         0A A2       2060  6295 		MSCP$W_STATUS(R2)	;  the end packet		
                                     2062  6296 
                                     2062  6297 30$:
                            02   E1  2062  6298 	BBC	#UQB$V_ST_EOT,-		; If end of tape flag
                    04 00C8 C4       2064  6299 		UQB$W_ST_FLAGS(R4),40$	;  flag is set,
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 134
X-17                            - SEND END - Respond To The Request      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (47)

                            08   88  2068  6300 	BISB	#MSCP$M_EF_EOT,-	; then set it in the next
                         09 A2       206A  6301 		MSCP$B_FLAGS(R2)	;  available end packet
                                     206C  6302 
                                     206C  6303 40$:
                    51   08 A2   9A  206C  6304 	MOVZBL	MSCP$B_OPCODE(R2),R1	; Pick up opcode
                         80 8F   88  2070  6305 	BISB2	#MSCP$K_OP_END,-	; Reset the op-code to
                         08 A2       2073  6306 		MSCP$B_OPCODE(R2)	;  make an end packet
                51   22D2'CF41   9A  2075  6307 	MOVZBL	TMSCP$END_PKT_LEN[R1],R1; Get the message length from the table
                                     207B  6308 
                                     207B  6309 ;
                                     207B  6310 ;		R0  =  Scratch
                                     207B  6311 ;		R1  =  TMSCP message length
                                     207B  6312 ;		R2  =  TMSCP message address
                                     207B  6313 ;		R3  =  HRB address
                                     207B  6314 ;		R4  =  Scratch
                                     207B  6315 ;		R5  =  Scratch
                                     207B  6316 ;
                                     207B  6317 
                                     207B  6318 TMSCP$SEND_PKT::
                                     207B  6319 	
                                     207B  6320 ; 
                                     207B  6321 ; Prepare the CDRP in the HRB, send off the end message to the port driver.
                                     207B  6322 ;
                                     207B  6323 
               06 E6EC CF   02   E1  207B  6324 	BBC	# TMSCP$V_DBG_SEND_PKT, -	; Not debugging - branch.
                                     2081  6325 		TMSCP$L_DEBUG_FLAGS, 0$
                   00000000'GF   16  2081  6326 	JSB	G^ INI$BRK
                                     2087  6327 
                                     2087  6328 0$:
                    54   54 A3   D0  2087  6329 	MOVL	HRB$L_HQB(R3),R4	; Restore the HQB address
                    55   1C A3   D0  208B  6330 	MOVL	HRB$L_IRP_CDRP(R3),R5	; Address of the IRP for end message
                    55   60 A5   DE  208F  6331 	MOVAL	IRP$L_FQFL(R5),R5	;  move down to the start of the CDRP
                                     2093  6332 
                                     2093  6333 ;
                                     2093  6334 ; Initialize the fields of the CDRP.
                                     2093  6335 ;
                                     2093  6336 
                 24 A5   28 A4   D0  2093  6337 	MOVL	HQB$L_CDT(R4), -	; CDT describing the link to the system for
                                     2098  6338 		CDRP$L_CDT(R5)		; which this end message is destined.
                    1C A5   52   D0  2098  6339 	MOVL	R2,CDRP$L_MSG_BUF(R5)	; Put the message buffer address into
                         18 A3   D4  209C  6340 	CLRL	HRB$L_MSGBUF(R3)	;  a CDRP for the SCS call and zero HRB
                    54   5C A3   D0  209F  6341 	MOVL	HRB$L_PDT(R3),R4	; Set the PDT address for the SCS calls
                    0C A3   51   D0  20A3  6342 	MOVL	R1,HRB$L_RESPC(R3)	; Hide the length away
                            01   B0  20A7  6343 	MOVW	#HRB$K_ST_MSG_WAIT,-	; Set the state for this request
                         14 A3       20A9  6344 		HRB$W_STATE(R3)		;  before calling SCS service
                                     20AB  6345 	RECYCL_MSG_BUF			; Recycle the message
                         48 B4   16  20AB       		JSB	@PDT$L_RCLMSGBUF(R4)
                         18 50   E9  20AE  6346 	BLBC	R0, 20$			; If LBC connection broke, skip host
                    18 A3   52   D0  20B1  6347 	MOVL	R2,HRB$L_MSGBUF(R3)	; Save the address of the buffer again
                       8000 8F   A8  20B5  6348 	BISW	#HRB$M_STATE_INVALID,-	; The state of this request is "current"
                         14 A3       20B9  6349 		HRB$W_STATE(R3)		;  leave the old state for diagnosis
                    51   0C A3   D0  20BB  6350 	MOVL	HRB$L_RESPC(R3),R1	; Restore the length of the end message
                                     20BF  6351 	.IF DEFINED DEBUG$LOG
                                     20BF  6352 
                                     20BF  6353 	ASSUME TSRV$V_LOG_ENABLD  EQ  0
                                     20BF  6354 
                                     20BF  6355 	MOVL	G^SCS$GL_TMSCP,R0	; Get the TSRV address.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 135
X-17                            - SEND END - Respond To The Request      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (47)

                                     20BF  6356 	BLBC	TSRV$W_STATE(R0),10$	; Branch if logging is disabled.
                                     20BF  6357 	BSBW	TMSCP$LOG_END_PKT	; Otherwise, log the end packet.
                                     20BF  6358 
                                     20BF  6359 10$:
                                     20BF  6360 	.ENDC	; DEBUG$LOG
                                     20BF  6361 
                         18 A3   D4  20BF  6362 	CLRL	HRB$L_MSGBUF(R3)	; Message buffer belongs to SCS again
                            08   B0  20C2  6363 	MOVW	#HRB$K_ST_SNDMS_WAIT,-	; Set the state for this request
                         14 A3       20C4  6364 		HRB$W_STATE(R3)		;  before calling SCS service
                                     20C6  6365 	SEND_CNT_MSG_BUF		; Send the message (call returns immed)
                         60 B4   16  20C6       		JSB	@PDT$L_SNDCNTMSG(R4)
                                     20C9  6366 
                                     20C9  6367 20$:
                       8000 8F   A8  20C9  6368 	BISW	#HRB$M_STATE_INVALID,-	; The state of this request is "current"
                         14 A3       20CD  6369 		HRB$W_STATE(R3)		;  leave the old state for diagnosis
                            01   E0  20CF  6370 	BBS	#HRB$V_ABORTWS,-	;
                         16 A3       20D1  6371 		HRB$W_FLAGS(R3),-
                            1F       20D3  6372 		TMSCP$CLEANUP_AND_START_NEXT
                            08   E1  20D4  6373 	BBC	#HRB$V_WBC_IMMED,-	; If immediate completion specified for
                         16 A3       20D6  6374 		HRB$W_FLAGS(R3),-	;  a write-back caching command, don't
                            1A       20D8  6375 		TMSCP$CLEANUP_AND_START_NEXT	;  clean up yet!
                                     20D9  6376 ;
                                     20D9  6377 ; Deallocate the MSCP message buffer. (may start up another thread)
                                     20D9  6378 ;
                                     20D9  6379 
                                     20D9  6380 30$:
                         18 A3   D5  20D9  6381 	TSTL	HRB$L_MSGBUF(R3)	; Check for allocated message buffer
                            14   13  20DC  6382 	BEQL	40$			; Continue, if none is allocated
                         18 A3   D0  20DE  6383 	MOVL	HRB$L_MSGBUF(R3),- 	; Get the message buffer address
                         1C A5       20E1  6384 		CDRP$L_MSG_BUF(R5)	;  from the HRB and put it in the CDRP
                         18 A3   D4  20E3  6385 	CLRL	HRB$L_MSGBUF(R3)	;  and clear out the address in the HRB
                    50   54 A3   D0  20E6  6386 	MOVL	HRB$L_HQB(R3),R0	; Get the address of the HQB
                         28 A0   D0  20EA  6387 	MOVL	HQB$L_CDT(R0),-		;  so we can get the CDT address
                         24 A5       20ED  6388 		CDRP$L_CDT(R5)		;  and put it in the CDRP for the call
                                     20EF  6389 	DEALLOC_MSG_BUF			; Get rid of the message buffer
                         20 B4   16  20EF       		JSB	@PDT$L_DEALLOMSG(R4)
                                     20F2  6390 
                                     20F2  6391 40$:
                                 05  20F2  6392 	RSB				; Finish sending request to the drive
                                     20F3  6393 
                                     20F3  6394 TMSCP$CLEANUP_AND_START_NEXT::
                          FC32   31  20F3  6395 	BRW	TMSCP$CLEANUP_HRB	; Deallocate all HRB held resources
                                     20F6  6396 
                                     20F6  6397 ;
                                     20F6  6398 ; Entry here means that a request was made to the server requiring a valid
                                     20F6  6399 ; unit, and no UQB was found for the unit specified.
                                     20F6  6400 ;
                                     20F6  6401 
                                     20F6  6402 TMSCP$ERROR_NO_UNIT::
                                     20F6  6403 	.IF DEFINED DEBUG$PC_HISTORY
                                     20F6  6404 	BSBW	TMSCP$PCHIST_R3R0	; Save this PC if we are keeping track
                                     20F6  6405 	.ENDC	   ;DEBUG$PC_HISTORY
                       50   03   D0  20F6  6406 	MOVL	#MSCP$K_ST_OFFLN,R0	; Return an offline status with the
                          FF3E   31  20F9  6407 	BRW	TMSCP$SEND_END		; device unknown subcode (0)
                                     20FC  6408 
                                     20FC  6409 ;
                                     20FC  6410 ; When an error is detected with a packet, the address of the field that
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 136
X-17                            - SEND END - Respond To The Request      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (47)

                                     20FC  6411 ; contains the error is shifted into the high byte of R0 and control is
                                     20FC  6412 ; passed here.
                                     20FC  6413 ;
                                     20FC  6414 
                                     20FC  6415 TMSCP$PACKET_ERROR::
                                     20FC  6416 	.IF DEFINED DEBUG$PC_HISTORY
                                     20FC  6417 	BSBW	TMSCP$PCHIST_R3R0	; Save this PC if we are keeping track
                                     20FC  6418 	.ENDC	   ;DEBUG$PC_HISTORY
                                 C9  20FC  6419 	BISL3	#<MSCP$K_ST_ICMD@16-	; The command sent was invalid
                                     20FD  6420 		!MSCP$K_OP_END>,-	; Identify this as an end message
      08 A2   50   00010080 8F       20FD  6421 		R0,MSCP$B_OPCODE(R2)	; Put all this info back in the packet
                       51   24   D0  2105  6422 	MOVL	#MSCP$K_MXCMDLEN,R1	; Use the minimum size possible
                          FF70   31  2108  6423 	BRW	TMSCP$SEND_PKT		;  and send out the end message
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 137
X-17                            - UNHOOK CDRP - Action routine to dequeu 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (48)

                                     210B  6426 	.SBTTL	-	UNHOOK CDRP - Action routine to dequeue CDRP's
                                     210B  6427 
                                     210B  6428 ;+
                                     210B  6429 ; Functional Description:
                                     210B  6430 ;
                                     210B  6431 ; This routine is called as an action routine for the SCS routines that
                                     210B  6432 ; scan the various wait queues for CDRPs that have been stalled. This        
                                     210B  6433 ; routine is invoked when a virtual circuit has broken and all the requests
                                     210B  6434 ; pending for the failed host must be cleaned up.
                                     210B  6435 ;
                                     210B  6436 ; Inputs:
                                     210B  6437 ;
                                     210B  6438 ;	R1  =  HRB address (passed only from TMSCP$ABORT)
                                     210B  6439 ;	R3  =  CDT address matched
                                     210B  6440 ;	R4  =  PDT address 
                                     210B  6441 ;	R5  =  Address of the CDRP found with the scan
                                     210B  6442 ;
                                     210B  6443 ; Outputs:
                                     210B  6444 ;
                                     210B  6445 ;	R1  =  HRB address of the CDRP found
                                     210B  6446 ;		(the invalid bit in the state field is set)
                                     210B  6447 ;-
                                     210B  6448 
                                     210B  6449 ;
                                     210B  6450 ; Dequeue the CDRP, if it is the one that goes with the HRB we are looking
                                     210B  6451 ; for, and we can prove that it is in a queue. 
                                     210B  6452 ;
                                     210B  6453 
                                     210B  6454 TMSCP$ABORT_UNHOOK_CDRP::
                    51   B4 A5   D1  210B  6455 	CMPL	CDRP$L_HRB(R5),R1	; See if this is the right CDRP
                            01   13  210F  6456 	BEQL	TMSCP$UNHOOK_CDRP	;  if it is, go ahead and unhook
                                 05  2111  6457 	RSB				;  otherwise, just return
                                     2112  6458 
                                     2112  6459 TMSCP$UNHOOK_CDRP::
                                     2112  6460 	.IF DEFINED DEBUG$PC_HISTORY
                                     2112  6461 	BSBW	TMSCP$PCHIST_R3		; Save this PC if we are keeping track
                                     2112  6462 	.ENDC	   ;DEBUG$PC_HISTORY
                         24 A5   D4  2112  6463    	CLRL	CDRP$L_CDT(R5)		; Zero CDT address, it is no longer valid
                         04 A5   D5  2115  6464 	TSTL	CDRP$L_FQBL(R5)		; Check for the presence of a pointer
                            0B   13  2118  6465 	BEQL	10$			; If the field is 0 don't dequeue
                                     211A  6466 
                                     211A  6467 	ASSUME	CDRP$L_FQFL EQ 0
                                     211A  6468 
                    55   04 B5   D1  211A  6469 	CMPL	@CDRP$L_FQBL(R5),R5	; If the field is nonzero,
                            05   12  211E  6470 	BNEQ	10$			;  make sure it is in a queue
                                     2120  6471 
                                     2120  6472 	ASSUME	CDRP$L_FQFL EQ 0
                                     2120  6473 
                       55   65   0F  2120  6474 	REMQUE	CDRP$L_FQFL(R5), R5	; Remove the CDRP from its queue
                                     2123  6475 
                            65   7C  2123  6476 	CLRQ	CDRP$L_FQFL(R5)		; Zero links
                                     2125  6477 ;
                                     2125  6478 ; Once the CDRP has been removed from the queue, set the invalid
                                     2125  6479 ; bit in the state field, to indicate that the displayed state is 
                                     2125  6480 ; an old one. On a later pass through all the pending requests 
                                     2125  6481 ; for this host, requests in this state will be eligible for cleanup
                                     2125  6482 ; with no further processing.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 138
X-17                            - UNHOOK CDRP - Action routine to dequeu 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (48)

                                     2125  6483 ;
                                     2125  6484 
                                     2125  6485 10$:
                            52   DD  2125  6486 	PUSHL	R2			; Save any registers used in cleanup
                    52   B4 A5   D0  2127  6487 	MOVL	CDRP$L_HRB(R5),R2	; Get the HRB address
                                     212B  6488 	.IF DEFINED DEBUG$PC_HISTORY
                                     212B  6489 	PUSHL	R0
                                     212B  6490 	MOVL	R2, R0			; Get the HRB address.
                                     212B  6491 	BSBW	TMSCP$PCHIST_R0		; Save this PC if we are keeping track
                                     212B  6492 	POPL	R0
                                     212B  6493 	.ENDC	   ;DEBUG$PC_HISTORY
                            04   A8  212B  6494 	BISW	#HRB$M_DEQUEUED,-	; Mark this request as unhooked,
                         16 A2       212D  6495 		HRB$W_FLAGS(R2)		;  its resources can be deallocated
                            52 8ED0  212F  6496 	POPL	R2			; Restore the registers used here
                                     2132  6497 
                                 05  2132  6498 	RSB				; Return to SCS
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 139
X-17                            - DEALLOCATE HQB - Remove an HQB if ther 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (49)

                                     2133  6501 	.SBTTL	-	DEALLOCATE HQB - Remove an HQB if there are no requests 
                                     2133  6502 
                                     2133  6503 ;+
                                     2133  6504 ; Functional Description:
                                     2133  6505 ;
                                     2133  6506 ; This routine is called as part of the virtual circuit error cleanup routine.
                                     2133  6507 ; When TMSCP$VC_ERR has done its best to clean up all the outstanding requests for
                                     2133  6508 ; this host, control is passed here to see if they have all been dealt with.
                                     2133  6509 ; If there are none outstanding, the HQB is returned to pool. If there are 
                                     2133  6510 ; still some requests that are held by the tape driver, this routine is
                                     2133  6511 ; revisited when the request is returned to the server, and as each outstanding
                                     2133  6512 ; request is aborted, this routine is called. Only when the last request
                                     2133  6513 ; pending for this host is deleted will the HQB be deallocated, and the host
                                     2133  6514 ; number used returned to the TSRV so it can be used again.
                                     2133  6515 ;
                                     2133  6516 ; Inputs:
                                     2133  6517 ;
                                     2133  6518 ;	R5  =  HQB address
                                     2133  6519 ;
                                     2133  6520 ; Outputs:
                                     2133  6521 ;
                                     2133  6522 ;	R0  =  0 (if there are still requests outstanding)
                                     2133  6523 ;	       SS$_NORMAL (if the HQB was deleted)
                                     2133  6524 ;	R5  =  Cleared
                                     2133  6525 ;	
                                     2133  6526 ;	All other registers preserved.
                                     2133  6527 ;-
                                     2133  6528 
                                     2133  6529 TMSCP$DEALLOC_HQB::
                                     2133  6530 	.IF DEFINED DEBUG$PC_HISTORY
                                     2133  6531 	BSBW	TMSCP$PCHIST		; Save this PC if we are keeping track
                                     2133  6532 	.ENDC	   ;DEBUG$PC_HISTORY
                                     2133  6533 
                            1E   BB  2133  6534 	PUSHR	#^M<R1,R2,R3,R4>	; Save any registers we mess with
                                     2135  6535 
                                     2135  6536 ;
                                     2135  6537 ; First, check to make sure that there are no requests still outstanding
                                     2135  6538 ; for this host.
                                     2135  6539 ;
                                     2135  6540 
                            50   D4  2135  6541 	CLRL	R0			; Assume there are more requests
                    53   20 A5   DE  2137  6542 	MOVAL	HQB$L_HRB_FL(R5),R3	; Get the address of the request queue.
                       53   63   D1  213B  6543 	CMPL	(R3),R3			; See if this is a null queue
                            15   12  213E  6544 	BNEQ	20$			; If it's not, we aren't ready for this
                                     2140  6545 
                                     2140  6546 ; 
                                     2140  6547 ; Now we know that this virtual circuit is no good anymore. It must have
                                     2140  6548 ; failed in the first place to be marked bad in the HQB, and now all the 
                                     2140  6549 ; pending requests have been cleaned up, remove this host queue block from 
                                     2140  6550 ; the list, and return the host number to be used by another incoming 
                                     2140  6551 ; connect request.
                                     2140  6552 ; 
                                     2140  6553 
                    54   32 A5   D0  2140  6554 	MOVL	HQB$L_TSRV(R5),R4	; Get the server structure address
                                     2144  6555 
                                     2144  6556 10$:
                         5C A4   B7  2144  6557 	DECW	TSRV$W_NUM_HOST(R4)	; Adjust the count of hosts being served
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 140
X-17                            - DEALLOCATE HQB - Remove an HQB if ther 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (49)

                                     2147  6558 
                                     2147  6559 	ASSUME	HQB$L_FLINK EQ 0
                                     2147  6560 
                       50   65   0F  2147  6561 	REMQUE	HQB$L_FLINK(R5), R0	; Dequeue the HQB from the list
                                     214A  6562 	.IF DEFINED DEBUG$PC_HISTORY
                                     214A  6563 	BSBW	TMSCP$R0HIST		; Save this value.
                                     214A  6564 	.ENDC	   ;DEBUG$PC_HISTORY
                   00000000'GF   16  214A  6565 	JSB	G^EXE$DEANONPAGED	;  and return the memory to pool
                            55   D4  2150  6566 	CLRL	R5			; Clear out the old pointer
                       50   01   D0  2152  6567 	MOVL	#SS$_NORMAL,R0		; Set success
                                     2155  6568 
                                     2155  6569 20$:
                            1E   BA  2155  6570 	POPR	#^M<R1,R2,R3,R4>	; Restore these registers
                                 05  2157  6571 	RSB				;  and return
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 141
X-17                            Macros for Density Tables                16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (50)

                                     2158  6574 	.SBTTL	Macros for Density Tables
                                     2158  6575 
                                     2158  6576 ;++
                                     2158  6577 ;  Macros used to build the MSCP -- VMS density tables
                                     2158  6578 ;
                                     2158  6579 ; Functional Description:
                                     2158  6580 ;
                                     2158  6581 ;	The following macro (and its two sub-macros) create a table used in 
                                     2158  6582 ;	converting VMS notions of density and speed to equivalent MSCP values 
                                     2158  6583 ;	and vice. versa.  Each section of the table corresponds to an MSCP
                                     2158  6584 ;	format group.  The entries in the two lists within each section
                                     2158  6585 ;	correspond to the formats within the group.  Each section consists
                                     2158  6586 ;	of a byte indicating the number of entries in each list followed by
                                     2158  6587 ;	a list of byte value VMS density codes for given (subscripted) MSCP
                                     2158  6588 ;	density bit positions, and a list of word numeric density values for
                                     2158  6589 ;	given (subscripted) MSCP density bit positions.  Multiple invocations
                                     2158  6590 ;	of this macro add additional sections to the table.  
                                     2158  6591 ;	
                                     2158  6592 ;	Label TU_VMSDENS points to the byte preceeding the list of VMS density
                                     2158  6593 ;	codes in the first table section.  Label TU_ABSDENS points to the start
                                     2158  6594 ;	of the list of numeric density values in the first table section.  The
                                     2158  6595 ;	byte preceeding each list of VMS density codes is used to locate the
                                     2158  6596 ;	next table section.
                                     2158  6597 ;
                                     2158  6598 ; Note:	Invocations of this macro must be ordered by increasing MSCP format
                                     2158  6599 ;	group values.  The lists within each invocation must be ordered by 
                                     2158  6600 ;	increasing MSCP density bit values.
                                     2158  6601 ;
                                     2158  6602 ;	For more information, see TMSCP ECO TMSCP16-43.
                                     2158  6603 ;
                                     2158  6604 ;--
                                     2158  6605 
                           00000000  2158  6606 TABLE_SECTIONS	= 0
                                     2158  6607 
                                     2158  6608 	.MACRO	DENSITY_TABLE, DF_MT, DF_DENS, DF_MSCP, LIST
                                     2158  6609 TABLE_SECTIONS	= TABLE_SECTIONS + 1
                                     2158  6610 	.IIF NDF, TMSCP$TU_VMSDENS, TMSCP$TU_VMSDENS::	; Start of table.
                                     2158  6611 	. = .+1					; Reserve byte for table size.
                                     2158  6612 TABLE$$$START = .
                                     2158  6613 	.IRP	ITEM, <LIST>			; Build VMS density
                                     2158  6614 	SET_VMSDENS ITEM			;  values table.
                                     2158  6615 	.ENDR
                                     2158  6616 	.BYTE	MT$K_'DF_MT'			; Set default VMS density.
                                     2158  6617 TABLE$$$SIZE = . - TABLE$$$START		; Calculate section table size.
                                     2158  6618 TABLE$$$END = .					; Save current pointer.
                                     2158  6619 	. = TABLE$$$START - 1			; Set pointer to table start.
                                     2158  6620 	.BYTE TABLE$$$SIZE			; Fill in table size.
                                     2158  6621 	. = TABLE$$$END				; Restore pointer
                                     2158  6622 
                                     2158  6623 	.IIF NDF, TMSCP$TU_ABSDENS, TMSCP$TU_ABSDENS::
                                     2158  6624 	.IRP	ITEM, <LIST>			; Build table of absolute
                                     2158  6625 	SET_ABSDENS ITEM			;  density values.
                                     2158  6626 	.ENDR
                                     2158  6627 	.LONG	DF_DENS
                                     2158  6628 
                                     2158  6629 	.ENDM	DENSITY_TABLE
                                     2158  6630 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 142
X-17                            Macros for Density Tables                16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (50)

                                     2158  6631 	.MACRO	SET_VMSDENS, MT, DENS, MSCP
                                     2158  6632 	.IF NB MT
                                     2158  6633 	ASSUME	<. - TABLE$$$START> EQ MSCP$V_'MSCP'
                                     2158  6634 	.BYTE	MT$K_'MT'
                                     2158  6635 	.ENDC
                                     2158  6636 	.IIF B, MT,	.BYTE 0
                                     2158  6637 	.ENDM
                                     2158  6638 
                                     2158  6639 	.MACRO	SET_ABSDENS, MT, DENS, MSCP
                                     2158  6640 	.IF NB MT
                                     2158  6641 	.LONG	DENS
                                     2158  6642 	.ENDC
                                     2158  6643 	.IIF B, MT,	.LONG 0
                                     2158  6644 	.ENDM
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 143
X-17                            Density and Speed Conversion Tables      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (51)

                                     2158  6647 	.SBTTL	Density and Speed Conversion Tables
                                     2158  6648 
                                     2158  6649 ;++
                                     2158  6650 ;
                                     2158  6651 ; Density / Speed Conversion Tables
                                     2158  6652 ;
                                     2158  6653 ; NOTE: Multiple invocations of DENSITY_TABLE must be in increasing order of
                                     2158  6654 ;	MSCP$K_TC_xxxx.  Entries within each DENSITY_TABLE must be ordered by
                                     2158  6655 ;	increasing values of MSCP$V_TF_xxx, and no values of MSCP$V_TF_xxx can
                                     2158  6656 ;	be omitted.  Failure to observe these rules will result in errors.
                                     2158  6657 ;--
                                     2158  6658 
                                     2158  6659 	ASSUME	MSCP$K_TC_OLD@-8 EQ 0
                                     2158  6660 
                                     2158  6661 	DENSITY_TABLE -				; Old devices
                                     2158  6662 		PE_1600,  1600, TF_PE, -	; Defaults
                                     2158  6663 		< -
                                     2158  6664 		< NRZI_800,  800, TF_800 >, -
                                     2158  6665 		< PE_1600,  1600, TF_PE >, -
                                     2158  6666 		< GCR_6250, 6250, TF_GCR >, -
                                     2158  6667 		< BLK_833,   833, TF_BLK > -
                                     2158  6668 		>
                                     2158       	.IIF NDF, TMSCP$TU_VMSDENS, TMSCP$TU_VMSDENS::	; Start of table.
                           00002159  2158       	. = .+1					; Reserve byte for table size.
                                 03  2159       	.BYTE	MT$K_NRZI_800
                                 04  215A       	.BYTE	MT$K_PE_1600
                                 05  215B       	.BYTE	MT$K_GCR_6250
                                 11  215C       	.BYTE	MT$K_BLK_833
                                 04  215D       	.BYTE	MT$K_PE_1600			; Set default VMS density.
                           00002158  215E       	. = TABLE$$$START - 1			; Set pointer to table start.
                                 05  2158       	.BYTE TABLE$$$SIZE			; Fill in table size.
                           0000215E  2159       	. = TABLE$$$END				; Restore pointer
                                     215E       	.IIF NDF, TMSCP$TU_ABSDENS, TMSCP$TU_ABSDENS::
                           00000320  215E       	.LONG	800
                           00000640  2162       	.LONG	1600
                           0000186A  2166       	.LONG	6250
                           00000341  216A       	.LONG	833
                           00000640  216E       	.LONG	1600
                                     2172  6669 
                                     2172  6670 	ASSUME	MSCP$K_TC_9TR@-8 EQ 1
                                     2172  6671 
                                     2172  6672 	DENSITY_TABLE -				; New 9-track devices
                                     2172  6673 		PE_1600,  1600, TF_PE, -	; Defaults
                                     2172  6674 		< -
                                     2172  6675 		< NRZI_800,  800, TF_800 >, -
                                     2172  6676 		< PE_1600,  1600, TF_PE  >, -
                                     2172  6677 		< GCR_6250, 6250, TF_GCR >, -
                                     2172  6678 		>
                           00002173  2172       	. = .+1					; Reserve byte for table size.
                                 03  2173       	.BYTE	MT$K_NRZI_800
                                 04  2174       	.BYTE	MT$K_PE_1600
                                 05  2175       	.BYTE	MT$K_GCR_6250
                                 04  2176       	.BYTE	MT$K_PE_1600			; Set default VMS density.
                           00002172  2177       	. = TABLE$$$START - 1			; Set pointer to table start.
                                 04  2172       	.BYTE TABLE$$$SIZE			; Fill in table size.
                           00002177  2173       	. = TABLE$$$END				; Restore pointer
                           00000320  2177       	.LONG	800
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 144
X-17                            Density and Speed Conversion Tables      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (51)

                           00000640  217B       	.LONG	1600
                           0000186A  217F       	.LONG	6250
                           00000640  2183       	.LONG	1600
                                     2187  6679 
                                     2187  6680 	ASSUME	MSCP$K_TC_CTP@-8 EQ 2
                                     2187  6681 
                                     2187  6682 	DENSITY_TABLE -				; Block mode devices
                                     2187  6683 		BLK_833,   833, TF_NOR, -	; Defaults
                                     2187  6684 		< -
                                     2187  6685 		< BLK_833,   833, TF_NOR >, -	; TK50 = 6666/8
                                     2187  6686 		< BLK_1250, 1250, TF_BHD > -	; TK70 = 10000/8
                                     2187  6687 		>
                           00002188  2187       	. = .+1					; Reserve byte for table size.
                                 11  2188       	.BYTE	MT$K_BLK_833
                                 12  2189       	.BYTE	MT$K_BLK_1250
                                 11  218A       	.BYTE	MT$K_BLK_833			; Set default VMS density.
                           00002187  218B       	. = TABLE$$$START - 1			; Set pointer to table start.
                                 03  2187       	.BYTE TABLE$$$SIZE			; Fill in table size.
                           0000218B  2188       	. = TABLE$$$END				; Restore pointer
                           00000341  218B       	.LONG	833
                           000004E2  218F       	.LONG	1250
                           00000341  2193       	.LONG	833
                                     2197  6688 
                                     2197  6689 	ASSUME	MSCP$K_TC_HPC@-8 EQ 3
                                     2197  6690 
                                     2197  6691 	DENSITY_TABLE -				; High performance cartridge
                                     2197  6692 		HPC_40K,   39872, TF_NOR, -	; Defaults
                                     2197  6693 		< -
                                     2197  6694 		< HPC_40K, 39872, TF_NOR> -	; HPC_40K = 39872 bytes/inch
                                     2197  6695 		< XPC_80K, 80000, TF_ENH> -	; XPC_80K
                                     2197  6696 		< HPC_COMP,70000, TF_NDC> -	; HPC_COMP = 2 to 30 times HPC_40K
                                     2197  6697 		< XPC_COMP,160000, TF_EDC> -	; XPC_COMP
                                     2197  6698 		>
                           00002198  2197       	. = .+1					; Reserve byte for table size.
                                 0C  2198       	.BYTE	MT$K_HPC_40K
                                 0E  2199       	.BYTE	MT$K_XPC_80K
                                 0D  219A       	.BYTE	MT$K_HPC_COMP
                                 0F  219B       	.BYTE	MT$K_XPC_COMP
                                 0C  219C       	.BYTE	MT$K_HPC_40K			; Set default VMS density.
                           00002197  219D       	. = TABLE$$$START - 1			; Set pointer to table start.
                                 05  2197       	.BYTE TABLE$$$SIZE			; Fill in table size.
                           0000219D  2198       	. = TABLE$$$END				; Restore pointer
                           00009BC0  219D       	.LONG	39872
                           00013880  21A1       	.LONG	80000
                           00011170  21A5       	.LONG	70000
                           00027100  21A9       	.LONG	160000
                           00009BC0  21AD       	.LONG	39872
                                     21B1  6699 
                                     21B1  6700 	ASSUME	MSCP$K_TC_WOD@-8 EQ 4
                                     21B1  6701 
                                     21B1  6702 	DENSITY_TABLE -				; Write-once optical disks
                                     21B1  6703 		WOD_6250,   6250, TF_NOR, -	; Defaults
                                     21B1  6704 		< -
                                     21B1  6705 		< WOD_6250,   6250, TF_NOR > -	; RV20
                                     21B1  6706 		>
                           000021B2  21B1       	. = .+1					; Reserve byte for table size.
                                 08  21B2       	.BYTE	MT$K_WOD_6250
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 145
X-17                            Density and Speed Conversion Tables      16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (51)

                                 08  21B3       	.BYTE	MT$K_WOD_6250			; Set default VMS density.
                           000021B1  21B4       	. = TABLE$$$START - 1			; Set pointer to table start.
                                 02  21B1       	.BYTE TABLE$$$SIZE			; Fill in table size.
                           000021B4  21B2       	. = TABLE$$$END				; Restore pointer
                           0000186A  21B4       	.LONG	6250
                           0000186A  21B8       	.LONG	6250
                                     21BC  6707 
                                     21BC  6708 TMSCP$TU_ABSPEED::				; Speed in IPS.
                               0000  21BC  6709 	.WORD	0				; Default speed.
                               0019  21BE  6710 	.WORD	MT$K_SPEED_25			; 25  IPS
                               004B  21C0  6711 	.WORD	MT$K_SPEED_75			; 75  IPS
                               007D  21C2  6712 	.WORD	125				; 125 IPS
                               00FF  21C4  6713 	.WORD	255				; Returned if not in table.
                               FFFF  21C6  6714 	.WORD	-1				; End of table.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 146
X-17                            Density Conversion Routines              16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (52)

                                     21C8  6717 	.SBTTL	Density Conversion Routines
                                     21C8  6718 	.SBTTL	.   TMSCP$VMSTOMSCP_DENS
                                     21C8  6719 
                                     21C8  6720 ;++
                                     21C8  6721 ;
                                     21C8  6722 ; TMSCP$VMSTOMSCP_DENS
                                     21C8  6723 ;
                                     21C8  6724 ; Convert a VMS density code to a MSCP density code.  For single density 
                                     21C8  6725 ; devices, use the only density available.
                                     21C8  6726 ;
                                     21C8  6727 ; Inputs:
                                     21C8  6728 ;
                                     21C8  6729 ;	R0 	VMS density code 
                                     21C8  6730 ;	R1	bits  0 -  7 = supported densities
                                     21C8  6731 ;		bits  8 - 15 = MSCP Tape format flag
                                     21C8  6732 ;		bits 16 - 31 = MBZ
                                     21C8  6733 ;
                                     21C8  6734 ; Outputs:
                                     21C8  6735 ;
                                     21C8  6736 ;	R0	Status
                                     21C8  6737 ;		   LBS ==> VMS density lookup succeeded
                                     21C8  6738 ;		   LBC ==> VMS density lookup failed or single density device, 
                                     21C8  6739 ;			   default density or single device density used
                                     21C8  6740 ;	R1	MSCP format / density code
                                     21C8  6741 ;	All other registers are preserved.
                                     21C8  6742 ;--
                                     21C8  6743 
                                     21C8  6744 TMSCP$VMSTOMSCP_DENS::
                            1C   BB  21C8  6745 	PUSHR	#^M<R2,R3,R4>
             54   51   00FF 8F   AB  21CA  6746 	BICW3	#^X0FF, R1, R4		; Save format.
                          003E   30  21D0  6747 	BSBW	TMSCP$FIND_SECTION	; Locate table section for this format.
                            52   D7  21D3  6748 	DECL	R2			; R2 = number of densities to search.
                                     21D5  6749 					; (Minus one to skip default density).
                                     21D5  6750 7$:
                  63   52   50   3A  21D5  6751 	LOCC	R0, R2, (R3)		; Find VMS density in this table
                                     21D9  6752 					;  section.
                            0C   12  21D9  6753 	BNEQ	10$			; Branch if found.
                     50   6342   90  21DB  6754 	MOVB	(R3)[R2], R0		; Get default VMS density.
                  63   52   50   3A  21DF  6755 	LOCC	R0, R2, (R3)		; Find default density in the table.
                            50   D4  21E3  6756 	CLRL	R0			; Set "default" density flag.
                            03   11  21E5  6757 	BRB	20$			; Branch to convert to MSCP density.
                                     21E7  6758 
                                     21E7  6759 10$:
                       50   01   D0  21E7  6760 	MOVL	#SS$_NORMAL, R0		; Indicate success.
                                     21EA  6761 
                                     21EA  6762 20$:
                       51   53   C2  21EA  6763 	SUBL	R3, R1			; Get offset into table.
                  51   01   51   78  21ED  6764 	ASHL	R1, #1, R1		; Develop MSCP density code.
                       51   54   A8  21F1  6765 	BISW	R4, R1			; Combine with format.
                            1C   BA  21F4  6766 	POPR	#^M<R2,R3,R4>
                                 05  21F6  6767 	RSB
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 147
X-17                            .   TMSCP$MSCPTOVMS_DENS                 16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (53)

                                     21F7  6770 	.SBTTL	.   TMSCP$MSCPTOVMS_DENS
                                     21F7  6771 
                                     21F7  6772 ;++
                                     21F7  6773 ;
                                     21F7  6774 ; TMSCP$MSCPTOVMS_DENS
                                     21F7  6775 ;
                                     21F7  6776 ; Convert a MSCP density code to a VMS density code.
                                     21F7  6777 ;
                                     21F7  6778 ; Inputs:
                                     21F7  6779 ;
                                     21F7  6780 ;	R1	bits  0 -  7 = MSCP density (Tape format bitflag)
                                     21F7  6781 ;		bits  8 - 15 = MSCP Tape format flag for this device
                                     21F7  6782 ;		bits 16 - 31 = MBZ
                                     21F7  6783 ;
                                     21F7  6784 ; Outputs:
                                     21F7  6785 ;
                                     21F7  6786 ;	R0	VMS density code
                                     21F7  6787 ;	R1	destroyed
                                     21F7  6788 ;	All other registers are preserved.
                                     21F7  6789 ;--
                                     21F7  6790 
                                     21F7  6791 TMSCP$MSCPTOVMS_DENS::
                            0C   BB  21F7  6792 	PUSHR	#^M<R2,R3>
                          0015   30  21F9  6793 	BSBW	TMSCP$FIND_SECTION	; Locate table section for this format.
                            52   D7  21FC  6794 	DECL	R2			; R2 = number of densities to search.
                                     21FE  6795 					; (Minus one to skip default density).
              51   FFFFFF00 8F   CA  21FE  6796 	BICL	#^CMSCP$M_TF_MASK, R1	; Isolate format bitflag.
             51   51   52   00   EA  2205  6797 	FFS	#0, R2, R1, R1		; Get byte index into VMS
                     50   6341   9A  220A  6798 	MOVZBL	(R3)[R1], R0		; density table, lookup value,
                            0C   BA  220E  6799 	POPR	#^M<R2,R3>		; and return.
                                 05  2210  6800 	RSB
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 148
X-17                            .   TMSCP$FIND_SECTION                   16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (54)

                                     2211  6803 	.SBTTL	.   TMSCP$FIND_SECTION
                                     2211  6804 
                                     2211  6805 ;++
                                     2211  6806 ; TMSCP$FIND_SECTION
                                     2211  6807 ;
                                     2211  6808 ; This routine uses the format flag value in bits 8 through 15 of R1 to
                                     2211  6809 ; locate the correct density table section for a given format.
                                     2211  6810 ;
                                     2211  6811 ; Inputs:
                                     2211  6812 ;
                                     2211  6813 ;	R1	bits  0 -  7 = Don't care
                                     2211  6814 ;		bits  8 - 15 = MSCP Tape format flag
                                     2211  6815 ;		bits 16 - 31 = MBZ
                                     2211  6816 ;
                                     2211  6817 ; Outputs:
                                     2211  6818 ;
                                     2211  6819 ;	R2	Number of density entries in table section	
                                     2211  6820 ;	R3	Address of table section
                                     2211  6821 ;	All other registers are preserved.
                                     2211  6822 ;--
                                     2211  6823 
                                     2211  6824 TMSCP$FIND_SECTION::
                            51   DD  2211  6825 	PUSHL	R1
                  53   FF41 CF   9E  2213  6826 	MOVAB	TMSCP$TU_VMSDENS, R3	; Get address of VMS densities.
                       52   83   9A  2218  6827 	MOVZBL	(R3)+, R2		; Get number of densities for this format.
               51   51   F8 8F   78  221B  6828 	ASHL	#-8, R1, R1		; Get tape format flag in R1.
                            13   13  2220  6829 	BEQL	20$			; Branch if = MSCP$K_TC_OLD.
                       05   51   D1  2222  6830 	CMPL	R1, # TABLE_SECTIONS	; Is the requested section in the table?
                            0E   1E  2225  6831 	BGEQU	20$			; No, use VMS densities - branch.
                                     2227  6832 
                                     2227  6833 10$:
                     53   6342   9E  2227  6834 	MOVAB	(R3)[R2], R3		; Point to next table section.
                     53   6342   DE  222B  6835 	MOVAL	(R3)[R2], R3
                       52   83   9A  222F  6836 	MOVZBL	(R3)+, R2		; Get number of densities for this format.
                         F2 51   F5  2232  6837 	SOBGTR	R1, 10$			; Loop to we find the right section.
                                     2235  6838 
                                     2235  6839 20$:
                            51 8ED0  2235  6840 	POPL	R1
                                 05  2238  6841 	RSB
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 149
X-17                            Speed Conversion Routines                16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (55)

                                     2239  6844 	.SBTTL	Speed Conversion Routines
                                     2239  6845 	.SBTTL	.   TMSCP$SPEEDTOMSCP
                                     2239  6846 
                                     2239  6847 ;++
                                     2239  6848 ;
                                     2239  6849 ; TMSCP$SPEEDTOMSCP
                                     2239  6850 ;
                                     2239  6851 ; Convert IPS to MSCP speed value using formula:
                                     2239  6852 ;
                                     2239  6853 ;	MSCP_SPEED = ( IPS * BPI ) / 1000
                                     2239  6854 ;
                                     2239  6855 ; Inputs:
                                     2239  6856 ;
                                     2239  6857 ;	R0	IPS
                                     2239  6858 ;	R1	bits  0 -  7 = MSCP density
                                     2239  6859 ;		bits  8 - 15 = MSCP Tape format flag
                                     2239  6860 ;		bits 16 - 31 = MBZ
                                     2239  6861 ;
                                     2239  6862 ; Outputs:
                                     2239  6863 ;
                                     2239  6864 ;	R0	MSCP speed value
                                     2239  6865 ;	R1 is destroyed.
                                     2239  6866 ;	All other registers are preserved.
                                     2239  6867 ;--
                                     2239  6868 
                                     2239  6869 TMSCP$SPEEDTOMSCP::
                            0C   BB  2239  6870 	PUSHR	#^M<R2,R3>
                          FFD3   30  223B  6871 	BSBW	TMSCP$FIND_SECTION	; Locate table section for this format.
                     53   6342   9E  223E  6872 	MOVAB	(R3)[R2], R3		; Point to absolute density values.
                            52   D7  2242  6873 	DECL	R2			; R2 = number of densities to search.
                                     2244  6874 					; (Minus one to skip default density).
              51   FFFFFF00 8F   CA  2244  6875 	BICL	#^C MSCP$M_TF_MASK, R1	; Isolate format bitflag.
             51   51   52   00   EA  224B  6876 	FFS	#0, R2, R1, R1		; Convert MSCP density to index.
                     51   6341   D0  2250  6877 	MOVL	(R3)[R1], R1		; Get numerical BPI value.
                       50   51   C4  2254  6878 	MULL	R1, R0			; Compute (IPS * BPI).
              50   000003E8 8F   C6  2257  6879 	DIVL	#1000, R0		; Compute (IPS * BPI) / 1000.
                            0C   BA  225E  6880 	POPR	#^M<R2,R3>
                                 05  2260  6881 	RSB
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 150
X-17                            .   TMSCP$MSCPTOSPEED                    16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (56)

                                     2261  6884 	.SBTTL	.   TMSCP$MSCPTOSPEED
                                     2261  6885 
                                     2261  6886 ;++
                                     2261  6887 ;
                                     2261  6888 ; TMSCP$MSCPTOSPEED
                                     2261  6889 ;
                                     2261  6890 ; Convert MSCP speed value using formula:
                                     2261  6891 ;
                                     2261  6892 ;	IPS = ( MSCP_SPEED * 1000 ) / BPI
                                     2261  6893 ;
                                     2261  6894 ; Round IPS speed to nearest value in TU_ABSPEED which is less than or equal 
                                     2261  6895 ; to computed value.
                                     2261  6896 ;
                                     2261  6897 ; Inputs:
                                     2261  6898 ;
                                     2261  6899 ;	R0	MSCP speed value
                                     2261  6900 ;	R1	bits  0 -  7 = MSCP density
                                     2261  6901 ;		bits  8 - 15 = MSCP Tape format flag for this device
                                     2261  6902 ;		bits 16 - 31 = MBZ
                                     2261  6903 ;
                                     2261  6904 ; Outputs:
                                     2261  6905 ;
                                     2261  6906 ;	R0	IPS
                                     2261  6907 ;	R1 is modified.
                                     2261  6908 ;	All other registers are preserved.
                                     2261  6909 ;--
                                     2261  6910 
                                     2261  6911 TMSCP$MSCPTOSPEED::
                            0C   BB  2261  6912 	PUSHR	#^M<R2,R3>
                          FFAB   30  2263  6913 	BSBW	TMSCP$FIND_SECTION	; Locate table section for this format.
                     53   6342   9E  2266  6914 	MOVAB	(R3)[R2], R3		; Point to absolute density values.
                            52   D7  226A  6915 	DECL	R2			; R2 = number of densities to search.
                                     226C  6916 					; (Minus one to skip default density).
              51   FFFFFF00 8F   CA  226C  6917 	BICL	#^C MSCP$M_TF_MASK, R1	; Isolate format bitflag.
             51   51   52   00   EA  2273  6918 	FFS	#0, R2, R1, R1		; Convert MSCP density to index.
                     51   6341   D0  2278  6919 	MOVL	(R3)[R1], R1		; Get numerical BPI value.
              50   000003E8 8F   C4  227C  6920 	MULL	#1000, R0		; Compute (MSCP_SPEED * 1000).
                       50   51   C6  2283  6921 	DIVL	R1, R0			; Divide that by BPI.
                       50   05   C0  2286  6922 	ADDL	#5, R0			; Round up for search.
                  51   FF2F CF   9E  2289  6923 	MOVAB	TMSCP$TU_ABSPEED, R1	; Get speeds table base.
                                     228E  6924 
                                     228E  6925 10$:
                       50   81   B1  228E  6926 	CMPW	(R1)+, R0		; Find first speed > R0.
                            FB   1F  2291  6927 	BLSSU	10$			; Loop till bigger speed found.
                    50   FC A1   3C  2293  6928 	MOVZWL	-4(R1), R0		; Then, use the previous speed.
                            0C   BA  2297  6929 	POPR	#^M<R2,R3>
                                 05  2299  6930 	RSB
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 151
X-17                            Debugging Routines                       16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (57)

                                     229A  6933 	.SBTTL	Debugging Routines
                                     229A  6934 	.SBTTL	-	PC History recording
                                     229A  6935 	.IF DEFINED DEBUG$PC_HISTORY
                                     229A  6936 
                                     229A  6937 ;+
                                     229A  6938 ; Functional Description:
                                     229A  6939 ;
                                     229A  6940 ; This routine is used to maintain a running history of the Program
                                     229A  6941 ; Counter as the TMSCP server executes. This routine is called from 
                                     229A  6942 ; from various places throughout the server using a BSBW instruction.
                                     229A  6943 ; The return address of the caller is stored in the PC history table
                                     229A  6944 ; as the offset into the server. This allows us to save space by only
                                     229A  6945 ; using one word to save the address, and makes it easier to find the
                                     229A  6946 ; address within a listing of the server.
                                     229A  6947 ;
                                     229A  6948 ; Inputs:
                                     229A  6949 ;
                                     229A  6950 ;	8(SP)  =  Address to be logged (PCHIST* only)
                                     229A  6951 ;	R3     =  Value to be logged (PCHIST_R3, PCHIST_R3R0, and R3HIST only)
                                     229A  6952 ;	R0     =  Value to be logged (PCHIST_R0, PCHIST_R3R0, and R0HIST only)
                                     229A  6953 ;
                                     229A  6954 ; Outputs:
                                     229A  6955 ;
                                     229A  6956 ;	None
                                     229A  6957 ;
                                     229A  6958 ; Implicit Outputs:
                                     229A  6959 ;
                                     229A  6960 ;	Address is logged in the PC history table
                                     229A  6961 ;	TMSCP$PCHISTCUR is moved to point to the next available cell
                                     229A  6962 ;-
                                     229A  6963 
                                     229A  6964 	.MACRO	LOG_VALUE	value, ?buffer_not_full
                                     229A  6965 	MOVL	value,(R1)+		; Save the PC.
                                     229A  6966 	CMPL	R1, TMSCP$PCHISTEND	; Check for the end of the table
                                     229A  6967 	BLSSU	buffer_not_full			;  still plenty of room
                                     229A  6968 	MOVL	TMSCP$PCHISTBEG, R1	; Wrap around back to the start
                                     229A  6969 	INCL	TMSCP$PCHISTFUL		;  and bump the filled counter
                                     229A  6970 
                                     229A  6971 buffer_not_full:
                                     229A  6972 	.ENDM	LOG_VALUE
                                     229A  6973 
                                     229A  6974 TMSCP$PCHIST::
                                     229A  6975 	PUSHL	R1			; Save any registers used
                                     229A  6976 	MOVL	TMSCP$PCHISTCUR, R1	; Get the cell in the table
                                     229A  6977 	LOG_VALUE	4(SP)		; Save the PC.
                                     229A  6978 	MOVL	R1, TMSCP$PCHISTCUR	; Get the new table offset
                                     229A  6979 	POPL	R1			; Restore the registers
                                     229A  6980 	RSB				;  and return
                                     229A  6981 
                                     229A  6982 TMSCP$R0HIST::
                                     229A  6983 	PUSHL	R1			; Save any registers used
                                     229A  6984 	MOVL	TMSCP$PCHISTCUR, R1	; Get the cell in the table
                                     229A  6985 	LOG_VALUE	R0		; Save the value
                                     229A  6986 	MOVL	R1, TMSCP$PCHISTCUR	; Get the new table offset
                                     229A  6987 	POPL	R1			; Restore the registers
                                     229A  6988 	RSB				;  and return
                                     229A  6989 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 152
X-17                            - PC History recording                   16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (57)

                                     229A  6990 TMSCP$R3HIST::
                                     229A  6991 	PUSHL	R1			; Save any registers used
                                     229A  6992 	MOVL	TMSCP$PCHISTCUR, R1	; Get the cell in the table
                                     229A  6993 	LOG_VALUE	R3		; Save the value
                                     229A  6994 	MOVL	R1, TMSCP$PCHISTCUR	; Get the new table offset
                                     229A  6995 	POPL	R1			; Restore the registers
                                     229A  6996 	RSB				;  and return
                                     229A  6997 
                                     229A  6998 TMSCP$PCHIST_R0::
                                     229A  6999 	PUSHL	R1			; Save any registers used
                                     229A  7000 	MOVL	TMSCP$PCHISTCUR, R1	; Get the cell in the table
                                     229A  7001 	LOG_VALUE	4(SP)		; Save the PC.
                                     229A  7002 	LOG_VALUE	R0		; Save the value
                                     229A  7003 	MOVL	R1, TMSCP$PCHISTCUR	; Get the new table offset
                                     229A  7004 	POPL	R1			; Restore the registers
                                     229A  7005 	RSB				;  and return
                                     229A  7006 
                                     229A  7007 TMSCP$PCHIST_R3::
                                     229A  7008 	PUSHL	R1			; Save any registers used
                                     229A  7009 	MOVL	TMSCP$PCHISTCUR, R1	; Get the cell in the table
                                     229A  7010 	LOG_VALUE	4(SP)		; Save the PC.
                                     229A  7011 	LOG_VALUE	R3		; Save the value
                                     229A  7012 	MOVL	R1, TMSCP$PCHISTCUR	; Get the new table offset
                                     229A  7013 	POPL	R1			; Restore the registers
                                     229A  7014 	RSB				;  and return
                                     229A  7015 
                                     229A  7016 TMSCP$PCHIST_R3R0::
                                     229A  7017 	PUSHL	R1			; Save any registers used
                                     229A  7018 	MOVL	TMSCP$PCHISTCUR, R1	; Get the cell in the table
                                     229A  7019 	LOG_VALUE	4(SP)		; Save the PC.
                                     229A  7020 	LOG_VALUE	R3		; Save the value
                                     229A  7021 	LOG_VALUE	R0		; Save the value
                                     229A  7022 	MOVL	R1, TMSCP$PCHISTCUR	; Get the new table offset
                                     229A  7023 	POPL	R1			; Restore the registers
                                     229A  7024 	RSB				;  and return
                                     229A  7025 
                                     229A  7026 	.ENDC	   ;DEBUG$PC_HISTORY
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 153
X-17                            - Current Counter Sanity Test            16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (58)

                                     229A  7029 	.SBTTL	-	Current Counter Sanity Test
                                     229A  7030 	.IF DEFINED DEBUG$CURRENT_SANITY
                                     229A  7031 
                                     229A  7032 ;+
                                     229A  7033 ; Functional Description:
                                     229A  7034 ;
                                     229A  7035 ; This routine calculates the value that should be held for the first
                                     229A  7036 ; UQB in the Unit Queue Block linked list. Note that this routine is
                                     229A  7037 ; designed for the case where the first unit in the list is the one
                                     229A  7038 ; seeing the most activity.
                                     229A  7039 ;
                                     229A  7040 ; Inputs:
                                     229A  7041 ;
                                     229A  7042 ;	None
                                     229A  7043 ;
                                     229A  7044 ; Outputs:
                                     229A  7045 ;
                                     229A  7046 ;	None
                                     229A  7047 ;
                                     229A  7048 ; Implicit Outputs:
                                     229A  7049 ;
                                     229A  7050 ;	The list of Host Queue Blocks is traversed and a running count
                                     229A  7051 ; 	of currently outstanding requests from all known hosts is made.
                                     229A  7052 ; 	Then the list of Unit Queue Blocks is traversed and requests
                                     229A  7053 ; 	that are currently pending on a unit other than the target, or
                                     229A  7054 ; 	requests that are blocked are subtracted from the total above.
                                     229A  7055 ; 	If the value calculated proves to be different than that 
                                     229A  7056 ; 	maintained in the counter, the system is bug checked.
                                     229A  7057 ;-
                                     229A  7058 
                                     229A  7059 TMSCP$CHECK_CURRENT::
                                     229A  7060 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>	; Save registers to be used
                                     229A  7061 	CLRL	R0			; total requests - blocked
                                     229A  7062 	CLRL	R4			; sum of current counters
                                     229A  7063 	MOVL	G^SCS$GL_TMSCP,R5	; Get the TSRV address
                                     229A  7064 	MOVAL	TSRV$L_HQB_FL(R5),R1	; Get the HQB list head
                                     229A  7065 	MOVL	R1,R2			;  and save a copy away
                                     229A  7066 
                                     229A  7067 	ASSUME	HQB$L_FLINK EQ 0
                                     229A  7068 
                                     229A  7069 10$:
                                     229A  7070 	MOVL	HQB$L_FLINK(R2), R2	; Next HQB in the list
                                     229A  7071 	CMPL	R2,R1			; If this is the list head
                                     229A  7072 	BEQL	20$			;  then the list is traversed
                                     229A  7073 	ADDW	HQB$W_NUM_QUE(R2),R0	; Otherwise sum the count
                                     229A  7074 	BRB	10$			;  and loop until finished
                                     229A  7075 
                                     229A  7076 20$:
                                     229A  7077 	MOVAL	TSRV$L_UQB_FL(R5),R1	; Get the address of the UQB
                                     229A  7078 	MOVL	R1,R2			;  list head and perform the 
                                     229A  7079 
                                     229A  7080 	ASSUME	UQB$L_FLINK EQ 0
                                     229A  7081 
                                     229A  7082 30$:
                                     229A  7083 	MOVL	UQB$L_FLINK(R2), R2	;  same operation as above,
                                     229A  7084 	CMPL	R2,R1			;  looping through the list
                                     229A  7085 	BEQL	40$			;  this time decrementing the
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 154
X-17                            - Current Counter Sanity Test            16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (58)

                                     229A  7086 	SUBW	UQB$W_NUM_QUE(R2),R0	;  the total by the number of
                                     229A  7087 	ADDW	UQB$W_CURRENT(R2),R4	;  requests on the blocked queue,
                                     229A  7088 	BRB	30$			;  and summing the current counts
                                     229A  7089 
                                     229A  7090 40$:
                                     229A  7091 	CMPW	R4,R0			; Now compare the two counters,
                                     229A  7092 	BEQL	50$			;  the should be equal
                                     229A  7093 	BUG_CHECK TMSCPSERV,FATAL	; If they are not lets get a dump
                                     229A  7094 
                                     229A  7095 50$:
                                     229A  7096 	POPR	#^M<R0,R1,R2,R3,R4,R5>	; Put the registers back
                                     229A  7097 	RSB				;  and return
                                     229A  7098 
                                     229A  7099 	.ENDC	   ;DEBUG$CURRENT_SANITY
                                     229A  7100 
                                     229A  7101 	.IF DEFINED DEBUG$LOG
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 155
X-17                            - Current Counter Sanity Test            16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (59)

                                     229A  7103 	.PAGE
                                     229A  7104 	.SBTTL	-	LOG_CMD_PKT - Log an MSCP command packet
                                     229A  7105 	.SBTTL	-	LOG_END_PKT - Log an MSCP end packet
                                     229A  7106 
                                     229A  7107 ;+
                                     229A  7108 ;
                                     229A  7109 ; Functional Description:
                                     229A  7110 ;
                                     229A  7111 ;	This following routines log an MSCP packet into the server's
                                     229A  7112 ;	ring buffer.  Separate entry points are provided for logging
                                     229A  7113 ;	a command packet (TMSCP$LOG_CMD_PKT), or an end packet or attention
                                     229A  7114 ;	message (TMSCP$LOG_END_PKT).
                                     229A  7115 ;
                                     229A  7116 ; Inputs: (TMSCP$LOG_CMD_PKT)
                                     229A  7117 ;
                                     229A  7118 ;	R1	Length of pkt to be logged
                                     229A  7119 ;	R2	Address of pkt to be logged
                                     229A  7120 ;	R3	HRB address
                                     229A  7121 ;	R4	CDT address
                                     229A  7122 ;
                                     229A  7123 ; Inputs: (TMSCP$LOG_END_PKT)
                                     229A  7124 ;
                                     229A  7125 ;	R1	Length of pkt to be logged
                                     229A  7126 ;	R2	Address of pkt to be logged
                                     229A  7127 ;	R3	HRB address
                                     229A  7128 ;
                                     229A  7129 ; Implicit inputs:
                                     229A  7130 ;
                                     229A  7131 ;	TSRV$L_NEXT_READ	Address of next packet to be read
                                     229A  7132 ;	TSRV$L_NEXT_WRITE	Address to write next packet
                                     229A  7133 ;	TSRV$L_LOG_BUF_START	Address of start of buffer
                                     229A  7134 ;	TSRV$L_LOG_BUF_END	Address of end of buffer
                                     229A  7135 ;	TSRV$W_INC_LOLIM	Low unit number to include
                                     229A  7136 ;	TSRV$W_INC_HILIM	High unit number to include
                                     229A  7137 ;	TSRV$W_EXC_LOLIM	Low unit number to exclude
                                     229A  7138 ;	TSRV$W_EXC_HILIM	High unit number to exclude
                                     229A  7139 ;
                                     229A  7140 ;	Status Bits in TSRV$W_STATE:
                                     229A  7141 ;
                                     229A  7142 ;	TSRV$V_PKT_LOGGED	Packet has been logged since last read
                                     229A  7143 ;	TSRV$V_PKT_LOST		One or more packets overwritten since
                                     229A  7144 ;				last read
                                     229A  7145 ;-
                                     229A  7146 
                                     229A  7147 LOG_PKT_SIZE	=	0
                                     229A  7148 
                                     229A  7149 	.ENABLE LSB
                                     229A  7150 
                                     229A  7151 TMSCP$LOG_CMD_PKT::
                                     229A  7152 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>		; Save R0-R5 due to MOVC.
                                     229A  7153         PUSHL   #PKT$C_MSCP_CMD                 ; Push packet type.
                                     229A  7154         MNEGL   #1, -(SP)                       ; Signal no IRP.
                                     229A  7155 	BRB	10$				; Branch to common code.
                                     229A  7156 
                                     229A  7157 5$:
                                     229A  7158         ADDL    #8, SP                          ; Pop IRP and type.
                                     229A  7159         POPR    #^M<R0,R1,R2,R3,R4,R5>          ; Not a selectedunit, so
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 156
X-17                            - Current Counter Sanity Test            16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (59)

                                     229A  7160         RSB                                     ;  restore registers and exit.
                                     229A  7161 
                                     229A  7162 
                                     229A  7163 TMSCP$LOG_END_PKT::
                                     229A  7164 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>		; Save R0-R5 due to MOVC.
                                     229A  7165         PUSHL   #PKT$C_MSCP_END                 ; Push Packet type.
                                     229A  7166         MNEGL   #1, -(SP)                       ; Signal no IRP.
                                     229A  7167 	MOVL	HRB$L_HQB(R3), R3		; Get HQB address.
                                     229A  7168 	MOVL	HQB$L_CDT(R3), R4		; Get CDT address.
                                     229A  7169 
                                     229A  7170 10$:
                                     229A  7171 	MOVL	G^SCS$GL_TMSCP, R5		; Get TSRV address.
                                     229A  7172 	MOVAL	TSRV$W_INC_LOLIM(R5), R0	; Get address of range settings.
                                     229A  7173 	MOVW	MSCP$W_UNIT(R2), R3		; Get unit number.
                                     229A  7174 
                                     229A  7175 	CMPW	R3, (R0)+			; Within include range low end?
                                     229A  7176 	BLSSU	5$				; LSS means not included.
                                     229A  7177 
                                     229A  7178 	ASSUME	TSRV$W_INC_HILIM EQ 2+TSRV$W_INC_LOLIM
                                     229A  7179 
                                     229A  7180 	CMPW 	R3, (R0)+			; Within include range high end?
                                     229A  7181 	BGTRU	5$				; GTR means not included.
                                     229A  7182 
                                     229A  7183 	ASSUME	TSRV$W_EXC_LOLIM EQ 2+TSRV$W_INC_HILIM
                                     229A  7184 
                                     229A  7185 	CMPW 	R3, (R0)+			; Outside of exclude range?
                                     229A  7186 	BLSSU	15$				; LSS means NOT excluded.
                                     229A  7187 
                                     229A  7188 	ASSUME	TSRV$W_EXC_HILIM EQ 2+TSRV$W_EXC_LOLIM
                                     229A  7189 
                                     229A  7190 	CMPW	R3, (R0)+			; Within exclude range?
                                     229A  7191 	BLEQU	5$				; LEQ means excluded.
                                     229A  7192 
                                     229A  7193 15$:
                                     229A  7194 	MOVL	TSRV$L_NEXT_WRITE(R5), R0	; Get location to write pkt.
                                     229A  7195 	BBCS	#TSRV$V_PKT_LOGGED, -		; If bit was clear, buffer
                                     229A  7196 		TSRV$W_STATE(R5), 20$		;  is logically empty.
                                     229A  7197 	CMPL	R0, TSRV$L_NEXT_READ(R5)	; Check for full buffer.
                                     229A  7198 	BNEQ	20$				; Branch if buffer not full or
                                     229A  7199 						;  already clobbered.
                                     229A  7200 	BISW	#TSRV$M_PKT_LOST, -		; Else, we have wrapped around
                                     229A  7201 		TSRV$W_STATE(R5)		;  the buffer.
                                     229A  7202 
                                     229A  7203 ; Log header info to buffer
                                     229A  7204 
                                     229A  7205 20$:
                                     229A  7206 	READ_SYSTIME (R0)+			; Fill in the system time
                                     229A  7207 
                                     229A  7208 LOG_PKT_SIZE	=	LOG_PKT_SIZE + 8
                                     229A  7209 
                                     229A  7210 	MOVL	CDT$L_PB(R4), R3		; Get PB address.
                                     229A  7211 	MOVL	PB$L_SBLINK(R3), R3		; Get SB address.
                                     229A  7212 	MOVQ	SB$B_SYSTEMID(R3), (R0)+	; Fill in system id.
                                     229A  7213 
                                     229A  7214 LOG_PKT_SIZE	=	LOG_PKT_SIZE + 8
                                     229A  7215 
                                     229A  7216 	MOVW	R1, -2(R0)			; Fill in logged pkt length.
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 157
X-17                            - Current Counter Sanity Test            16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (59)

                                     229A  7217 	MOVQ	SB$T_NODENAME(R3), (R0)+	; Grab nodename, part 1.
                                     229A  7218 
                                     229A  7219 LOG_PKT_SIZE	=	LOG_PKT_SIZE + 8
                                     229A  7220 
                                     229A  7221 	MOVQ	SB$T_NODENAME+8(R3), (R0)+	; Grab nodename, part 2.
                                     229A  7222 
                                     229A  7223 LOG_PKT_SIZE	=	LOG_PKT_SIZE + 8
                                     229A  7224 
                                     229A  7225         ASSUME PKT$L_IRP_ADDR EQ PKT$T_NODENAME+16
                                     229A  7226 25$:    POPL    (R0)+                           ; "IRP address" for formatter.
                                     229A  7227         ASSUME PKT$B_TYPE EQ PKT$L_IRP_ADDR+4
                                     229A  7228         POPL    (R0)+
                                     229A  7229         ASSUME PKT$W_UNIT EQ PKT$B_TYPE+2
                                     229A  7230 
                                     229A  7231 LOG_PKT_SIZE	=	LOG_PKT_SIZE + 8
                                     229A  7232 
                                     229A  7233         MOVW    MSCP$W_UNIT(R2), -2(R0)         ; Get unit number.
                                     229A  7234 
                                     229A  7235 
                                     229A  7236 ; Actually log the packet now
                                     229A  7237 
                                     229A  7238 	MOVC5	R1,(R2),#0,#PKT$C_DATA_LEN,(R0)	; Zero fill packet into buffer.
                                     229A  7239 
                                     229A  7240 LOG_PKT_SIZE	=	LOG_PKT_SIZE + pkt$c_data_len
                                     229A  7241 
                                     229A  7242 ; now R3 = new address for next write
                                     229A  7243 
                                     229A  7244 	MOVL	G^SCS$GL_TMSCP, R5		; Restore TSRV address.
                                     229A  7245 	CMPL	R3, TSRV$L_LOG_BUF_END(R5)	; At end of ring buffer?
                                     229A  7246 	BLSSU	30$				; Branch if not.
                                     229A  7247 	MOVL	TSRV$L_LOG_BUF_START(R5), R3	; Else reset to beginning.
                                     229A  7248 
                                     229A  7249 30$:
                                     229A  7250 	MOVL	R3, TSRV$L_NEXT_WRITE(R5)	; Set next write address.
                                     229A  7251 	POPR	#^M<R0,R1,R2,R3,R4,R5>		; Restore registers.
                                     229A  7252         RSB
                                     229A  7253 
                                     229A  7254 40$:    CLRQ    (R0)+                           ; Set up *** nodename in
                                     229A  7255         MOVW    R1, -2(R0)                      ;  absence of connection
                                     229A  7256         MOVL    #^X2A2A2A03, (R0)+              ;  data and clear pkt
                                     229A  7257         CLRQ    (R0)+                           ;  fields.
                                     229A  7258         CLRL    (R0)+
                                     229A  7259         BRB     25$                             ; Back to common processing.
                                     229A  7260 
                                     229A  7261 	.DISABLE LSB
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 158
X-17                            - Current Counter Sanity Test            16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (60)

                                     229A  7263 	.PAGE
                                     229A  7264 	.SBTTL	Packet Logging Routines
                                     229A  7265 	.SBTTL	-	CREATE_LOG - Create log buffer
                                     229A  7266 
                                     229A  7267 ;+
                                     229A  7268 ;
                                     229A  7269 ; CREATE_LOG - Create and initialize log buffer
                                     229A  7270 ;
                                     229A  7271 ; Functional Description:
                                     229A  7272 ;
                                     229A  7273 ;	This routine allocates a ring buffer from non-paged pool
                                     229A  7274 ;	for logging MSCP packets and initializes TSRV field which
                                     229A  7275 ;	point to the buffer.
                                     229A  7276 ;
                                     229A  7277 ; Inputs:
                                     229A  7278 ;
                                     229A  7279 ;	R5	TSRV address
                                     229A  7280 ;
                                     229A  7281 ; Outputs:
                                     229A  7282 ;
                                     229A  7283 ;	R1, R2	Scratched
                                     229A  7284 ;	R0	Return status from EXE$ALONONPAGED
                                     229A  7285 ;
                                     229A  7286 ; Implicit Outputs:
                                     229A  7287 ;
                                     229A  7288 ;	TSRV$L_BUF_START	Address of start of buffer
                                     229A  7289 ;	TSRV$L_BUF_END		Address of end of buffer
                                     229A  7290 ;	TSRV$L_NEXT_READ	Address if next packet to read
                                     229A  7291 ;	TSRV$L_NEXT_WRITE	Address if next packet to write
                                     229A  7292 ;	TSRV$W_STATE		Indicates logging code is present
                                     229A  7293 ;				 and initialized
                                     229A  7294 ;	TSRV$W_INC_LOLIM	Low unit number to include
                                     229A  7295 ;	TSRV$W_INC_HILIM	High unit number to include
                                     229A  7296 ;	TSRV$W_EXC_LOLIM	Low unit number to exclude
                                     229A  7297 ;	TSRV$W_EXC_HILIM	High unit number to exclude
                                     229A  7298 ;
                                     229A  7299 ;-
                                     229A  7300 
                                     229A  7301 	$EQU	LOG_BUF_SIZE	1024*LOG_PKT_SIZE	; Bytes in history buffer.
                                     229A  7302 
                                     229A  7303 	ASSUME TSRV$W_INC_HILIM  EQ  TSRV$W_INC_LOLIM+2
                                     229A  7304 	ASSUME TSRV$W_EXC_LOLIM  EQ  TSRV$W_INC_HILIM+2
                                     229A  7305 	ASSUME TSRV$W_EXC_HILIM  EQ  TSRV$W_EXC_LOLIM+2
                                     229A  7306 
                                     229A  7307 TMSCP$CREATE_LOG::
                                     229A  7308 	ADDL3	#12, #LOG_BUF_SIZE, R1	; Get ring buffer size.
                                     229A  7309 	JSB	G^EXE$ALONONPAGED	; Attempt to allocate space.
                                     229A  7310 	BLBC	R0, 99$			; Branch if allocation failed.
                                     229A  7311 					; R2 = address / R1 = size.
                                     229A  7312 	CLRQ	(R2)+			; Clear FLINK and BLINK.
                                     229A  7313 	MOVW	R1, (R2)+		; Save size.
                                     229A  7314 	MOVZBW	#DYN$C_TSRV, (R2)+	; Set type and sub-type.
                                     229A  7315 
                                     229A  7316 	MOVL	R2,-			; Save address of start of ring buffer.
                                     229A  7317 		TSRV$L_LOG_BUF_START(R5);
                                     229A  7318 	ADDL3	#LOG_BUF_SIZE, R2,-	; Save address of end of ring buffer.
                                     229A  7319 		TSRV$L_LOG_BUF_END(R5)	;
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 159
X-17                            - Current Counter Sanity Test            16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (60)

                                     229A  7320 	MOVL	R2, TSRV$L_NEXT_READ(R5); Init read pointer.
                                     229A  7321 	MOVL	R2,- 			; Init write pointer.
                                     229A  7322 		TSRV$L_NEXT_WRITE(R5)
                                     229A  7323 
                                     229A  7324 	ASSUME	TSRV$W_INC_HILIM EQ 2+TSRV$W_INC_LOLIM
                                     229A  7325 
                                     229A  7326 	MOVL	#-1@16,-		; Set default include unit low/high
                                     229A  7327 		TSRV$W_INC_LOLIM(R5)	;  limits to include all units.
                                     229A  7328 
                                     229A  7329 	ASSUME	TSRV$W_EXC_HILIM EQ 2+TSRV$W_EXC_LOLIM
                                     229A  7330 
                                     229A  7331 	MOVZWL	#-1,-			; Set default exclude unit low/high
                                     229A  7332 		TSRV$W_EXC_LOLIM(R5)	;  limits to exclude no units.
                                     229A  7333 	MOVW	#TSRV$M_LOG_PRESENT,-	; Buffer present and accounted for, sir.
                                     229A  7334 		TSRV$W_STATE(R5)	;
                                     229A  7335 
                                     229A  7336 99$:
                                     229A  7337 	RSB
                                     229A  7338 
                                     229A  7339 	.ENDC	; DEBUG$LOG
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 160
X-17                            Read Only Length and Modifier Tables     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (61)

                                     229A  7342 	.SBTTL	Read Only Length and Modifier Tables
                                     229A  7343 
                                     229A  7344 	.ALIGN	LONG
                                     229C  7345 
                                     229C  7346 TMSCP$SERV_INFO::
                                     229C  7347 TMSCP$SERV_NAME::
20 20 20 45 50 41 54 24 50 43 53 4D  229C  7348 	.ASCII	/MSCP$TAPE       /
                        20 20 20 20  22A8       
                                     22AC  7349 
                                     22AC  7350 ;
                                     22AC  7351 
                                     22AC  7352 TMSCP$COM_PKT_LEN::
            00 00 00 20 0C 10 10 00  22AC  7353 	.BYTE	0*4,4*4,4*4,3*4,8*4,0*4,0*4,0
            00 00 00 00 0C 24 24 0C  22B4  7354 	.BYTE	3*4,9*4,9*4,3*4,0*4,0*4,0*4,0
            00 0C 00 00 0C 0C 00 10  22BC  7355 	.BYTE	4*4,0*4,3*4,3*4,0*4,0*4,3*4,0
            00 00 00 00 00 00 00 00  22C4  7356 	.BYTE	0*4,0*4,0*4,0*4,0*4,0*4,0*4,0
                  14 0C 00 1C 1C 1C  22CC  7357 	.BYTE	7*4,7*4,7*4,0*4,3*4,5*4
                                     22D2  7358 
                                     22D2  7359 ;
                                     22D2  7360 
                                     22D2  7361 TMSCP$END_PKT_LEN::
            00 00 00 20 2C 14 10 00  22D2  7362 	.BYTE	0*4,4*4,5*4,11*4,8*4,0*4,0*4,0
            00 00 00 00 0C 2C 2C 0C  22DA  7363 	.BYTE	3*4,11*4,11*4,3*4,0*4,0*4,0*4,0
            00 0C 00 00 20 0C 00 24  22E2  7364 	.BYTE	9*4,0*4,3*4,8*4,0*4,0*4,3*4,0
            00 00 00 00 00 00 00 00  22EA  7365 	.BYTE	0*4,0*4,0*4,0*4,0*4,0*4,0*4,0
                  20 20 00 24 24 24  22F2  7366 	.BYTE	9*4,9*4,9*4,0*4,8*4,8*4
                                     22F8  7367 
                                     22F8  7368 ;
                                     22F8  7369 
                                     22F8  7370 TMSCP$MOD_TBL::
                               FFFF  22F8  7371 	.WORD	^C0			;  0-unused
                               FFFF  22FA  7372 	.WORD	^C0			;  1-ABORT
                               FFFF  22FC  7373 	.WORD	^C0			;  2-GET COMMAND STATUS
                               FFFE  22FE  7374 	.WORD	^C<-			;  3-GET UNIT STATUS
                                     2300  7375 		MSCP$M_MD_NXUNT>	;    next unit
                               FFFF  2300  7376 	.WORD	^C0			;  4-SET CONTROLLER CHARACTERISTICS
                               FFFF  2302  7377 	.WORD	^C0			;  5-unused
                               FFFF  2304  7378 	.WORD	^C0			;  6-unused
                               FFFF  2306  7379 	.WORD	^C0			;  7-unused
                               CFCD  2308  7380 	.WORD	^C<-			;  8-AVAILABLE
                                     230A  7381 		MSCP$M_MD_ALLCD!-	;    all class drivers
                                     230A  7382 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     230A  7383 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     230A  7384 		MSCP$M_MD_EXCAC!-	;    exclusive access
                                     230A  7385 		MSCP$M_MD_UNLOD>	;    clear serious exception
                               CFDB  230A  7386 	.WORD	^C<-			;  9-ONLINE
                                     230C  7387 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     230C  7388 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     230C  7389 		MSCP$M_MD_STWRP!-	;    enable set write protect
                                     230C  7390 		MSCP$M_MD_EXCAC>	;    exclusive access
                               CFDB  230C  7391 	.WORD	^C<-			; 10-SET UNIT CHAR
                                     230E  7392 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     230E  7393 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     230E  7394 		MSCP$M_MD_STWRP!-	;    enable set write protect
                                     230E  7395 		MSCP$M_MD_EXCAC>	;    exclusive access
                               FFFF  230E  7396 	.WORD	^C0			; 11-DETERMINE ACCESS PATH
                               FFFF  2310  7397 	.WORD	^C0			; 12-unused
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 161
X-17                            Read Only Length and Modifier Tables     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (61)

                               FFFF  2312  7398 	.WORD	^C0			; 13-unused
                               FFFF  2314  7399 	.WORD	^C0			; 14-unused
                               FFFF  2316  7400 	.WORD	^C0			; 15-unused
                               C4F7  2318  7401 	.WORD	^C<-			; 16-ACCESS
                                     231A  7402 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     231A  7403 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     231A  7404 		MSCP$M_MD_REVRS!-	;    reverse
                                     231A  7405 		MSCP$M_MD_SCCHH!-	;    supress caching (high speed)
                                     231A  7406 		MSCP$M_MD_SEREC!-	;    supress error recovery
                                     231A  7407 		MSCP$M_MD_SECOR>	;    supress error correction
                               FFFF  231A  7408 	.WORD	^C0			; 17-unused
                               CFBF  231C  7409 	.WORD	^C<-			; 18-ERASE
                                     231E  7410 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     231E  7411 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     231E  7412 		MSCP$M_MD_IMMED>	;    immediate completion
                               CFFF  231E  7413 	.WORD	^C<-			; 19-FLUSH
                                     2320  7414 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     2320  7415 		MSCP$M_MD_CLSEX>	;    clear serious exception
                               FFFF  2320  7416 	.WORD	^C0			; 20-unused
                               FFFF  2322  7417 	.WORD	^C0			; 21-unused
                               CFBF  2324  7418 	.WORD	^C<-			; 22-ERASE GAP
                                     2326  7419 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     2326  7420 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     2326  7421 		MSCP$M_MD_IMMED>	;    immediate completion
                               FFFF  2326  7422 	.WORD	^C0			; 23-unused
                               FFFF  2328  7423 	.WORD	^C0			; 24-unused
                               FFFF  232A  7424 	.WORD	^C0			; 25-unused
                               FFFF  232C  7425 	.WORD	^C0			; 26-unesed
                               FFFF  232E  7426 	.WORD	^C0			; 27-unused
                               FFFF  2330  7427 	.WORD	^C0			; 28-unused
                               FFFF  2332  7428 	.WORD	^C0			; 29-unused
                               FFFF  2334  7429 	.WORD	^C0			; 30-unused
                               FFFF  2336  7430 	.WORD	^C0			; 31-unused
                               C4F7  2338  7431 	.WORD	^C<-			; 32-COMPARE HOST DATA
                                     233A  7432 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     233A  7433 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     233A  7434 		MSCP$M_MD_REVRS!-	;    reverse
                                     233A  7435 		MSCP$M_MD_SCCHH!-	;    supress caching (high speed)
                                     233A  7436 		MSCP$M_MD_SECOR!-	;    supress error correction
                                     233A  7437 		MSCP$M_MD_SEREC>	;    supress error recovery
                               84F7  233A  7438 	.WORD	^C<-			; 33-READ
                                     233C  7439 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     233C  7440 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     233C  7441 		MSCP$M_MD_COMP!-	;    compare
                                     233C  7442 		MSCP$M_MD_REVRS!-	;    reverse
                                     233C  7443 		MSCP$M_MD_SCCHH!-	;    supress caching (high speed)
                                     233C  7444 		MSCP$M_MD_SECOR!-	;    supress error correction
                                     233C  7445 		MSCP$M_MD_SEREC>	;    supress error recovery
                               8CAF  233C  7446 	.WORD	^C<-			; 34-WRITE
                                     233E  7447 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     233E  7448 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     233E  7449 		MSCP$M_MD_COMP!-	;    compare
                                     233E  7450 		MSCP$M_MD_ENRWR!-	;    enable re-write error recovery
                                     233E  7451 		MSCP$M_MD_IMMED!-	;    immediate completion
                                     233E  7452 		MSCP$M_MD_SECOR!-	;    supress error correction
                                     233E  7453 		MSCP$M_MD_SEREC>	;    supress error recovery
                               FFFF  233E  7454 	.WORD	^C0			; 35-unused
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 162
X-17                            Read Only Length and Modifier Tables     16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (61)

                               CFBF  2340  7455 	.WORD	^C<-			; 36-WRITE TAPE MARK
                                     2342  7456 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     2342  7457 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     2342  7458 		MSCP$M_MD_IMMED>	;    immediate completion
                               C431  2342  7459 	.WORD	^C<-			; 37-REPOSITION
                                     2344  7460 		MSCP$M_MD_CDATL!-	;    clear cached data lost
                                     2344  7461 		MSCP$M_MD_CLSEX!-	;    clear serious exception
                                     2344  7462 		MSCP$M_MD_DLEOT!-	;    detect LEOT
                                     2344  7463 		MSCP$M_MD_IMMED!-	;    immediate completion
                                     2344  7464 		MSCP$M_MD_OBJCT!-	;    object count
                                     2344  7465 		MSCP$M_MD_REVRS!-	;    reverse
                                     2344  7466 		MSCP$M_MD_REWND!-	;    rewind
                                     2344  7467 		MSCP$M_MD_SCCHH!-	;    supress caching (high speed)
                                     2344  7468 		MSCP$M_MD_SECOR!-	;    supress error correction
                                     2344  7469 		MSCP$M_MD_SEREC>	;    supress error recovery
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 163
X-17                            Patch Area                               16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (62)

                                     2344  7472 	.SBTTL	Patch Area
                                     2344  7473 
                                     2344  7474 ;
                                     2344  7475 ; Patch area
                                     2344  7476 ;
                                     2344  7477 
                           00002350  2344  7478 	. = <.+15>&-16
                                     2350  7479 
                           000023D0  2350  7480 TMSCP$PATCH::	.BLKB		128
                                     23D0  7481 
                           000023D0  23D0  7482 	. = <.+15>&-16
                                     23D0  7483 
                                     23D0  7484 TMSCP$END::
                                     23D0  7485 	.END
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 164
Symbol table                                                             16-DEC-1992 11:07:07  [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$_TMSCPSERV                   ********   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                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 165
Symbol table                                                             16-DEC-1992 11:07:07  [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                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 166
Symbol table                                                             16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (62)

MSCP$K_OP_READ                 = 00000021                 MSCP$M_MD_CDATL                = 00001000                 
MSCP$K_OP_REPOS                = 00000025                 MSCP$M_MD_CLSEX                = 00002000                 
MSCP$K_OP_STCON                = 00000004                 MSCP$M_MD_COMP                 = 00004000                 
MSCP$K_OP_STUNT                = 0000000A                 MSCP$M_MD_DLEOT                = 00000080                 
MSCP$K_OP_WRITE                = 00000022                 MSCP$M_MD_ENRWR                = 00000010                 
MSCP$K_OP_WRITM                = 00000024                 MSCP$M_MD_EXCAC                = 00000020                 
MSCP$K_SC_ALONL                = 00000008                 MSCP$M_MD_IMMED                = 00000040                 
MSCP$K_SC_DLATE                = 00000001                 MSCP$M_MD_NXUNT                = 00000001                 
MSCP$K_SC_DUPUN                = 00000004                 MSCP$M_MD_OBJCT                = 00000004                 
MSCP$K_SC_EXUSE                = 00000010                 MSCP$M_MD_REVRS                = 00000008                 
MSCP$K_SC_LGE                  = 00000000                 MSCP$M_MD_REWND                = 00000002                 
MSCP$K_SC_MEMER                = 00000009                 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                 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 167
Symbol table                                                             16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (62)

MSCP$V_UF_WRTPD                = 00000008                 SCS$DISCONNECT                   ********   X   00        
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                   = 00000011                 
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                    = 000021B4 R     02        
SCS$ACCEPT                       ********  G    02        TABLE$$$SIZE                   = 00000002                 
SCS$ALLOC_RSPID                  ********   X   00        TABLE$$$START                  = 000021B2 R     02        
SCS$B_CON_DAT                  = 00000024                 TABLE_SECTIONS                 = 00000005                 
SCS$DEALL_RSPID                  ********   X   00        TMSCP$ABORT                      00000E53 RG    02        
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 168
Symbol table                                                             16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (62)

TMSCP$ABORT_READ                 0000190F RG    02        TMSCP$MSCPTOVMS_DENS             000021F7 RG    02        
TMSCP$ABORT_UNHOOK_CDRP          0000210B RG    02        TMSCP$MSG_IN                     00000D93 RG    02        
TMSCP$ABORT_WRITE                00001ACF RG    02        TMSCP$MV_SET_OFFLINE             00000ABF RG    02        
TMSCP$ACCESS                     0000150F RG    02        TMSCP$M_DBG_MSG_IN             = 00000002                 
TMSCP$ADD                        0000084A RG    02        TMSCP$M_DBG_SEND_PKT           = 00000004                 
TMSCP$ALLOCATE                   00001AE1 RG    02        TMSCP$M_DBG_START              = 00000001                 
TMSCP$ALLOCATE_HRB               00001C8D RG    02        TMSCP$NEW_DEVICE                 00000955 RG    02        
TMSCP$ANCILLARY_TABLE            00001FA8 RG    02        TMSCP$NOMEM                      000009EF RG    02        
TMSCP$ANCILLARY_TABLE_LEN      = 00000006                 TMSCP$NORMAL                     0000094D RG    02        
TMSCP$AVAILABLE                  00001272 RG    02        TMSCP$NOSERV                     0000094D RG    02        
TMSCP$BACK                       00001C08 RG    02        TMSCP$NOTSHR                     000009E5 RG    02        
TMSCP$BAD_FLAGS                  00000E38 RG    02        TMSCP$NO_MEM                     00000D86 RG    02        
TMSCP$BAD_LEN                    00000E2C RG    02        TMSCP$NO_ROOM                    00000BCF RG    02        
TMSCP$BAD_MOD                    00000E31 RG    02        TMSCP$ONLINE                     00001314 RG    02        
TMSCP$BAD_OPC                    00000E25 RG    02        TMSCP$PACKET_ERROR               000020FC RG    02        
TMSCP$BAD_UNIT                   00002036 RG    02        TMSCP$PATCH                      00002350 RG    02        
TMSCP$BEGIN                      00000000 RG    02        TMSCP$READ                       000017B6 RG    02        
TMSCP$BLOCK_SEREX                00001B29 RG    02        TMSCP$READ_TRANSFER              0000180F RG    02        
TMSCP$BLOCK_SEREX_LEN          = 0000000C                 TMSCP$RECORD_COMMON              0000147C RG    02        
TMSCP$CHECK_XFER_STATUS          00001E4F RG    02        TMSCP$RECOVERABLE_ERROR          00001FAE RG    02        
TMSCP$CLEANUP_AND_START_NEXT     000020F3 RG    02        TMSCP$REJECT                     00000BD8 RG    02        
TMSCP$CLEANUP_HRB                00001D28 RG    02        TMSCP$REJECT_CONNECTION          00000BCF RG    02        
TMSCP$COMMON_TRANSFER            00001B4B RG    02        TMSCP$REJECT_REQUEST             00000BCF RG    02        
TMSCP$COMPARE_HOST_DATA          00001516 RG    02        TMSCP$REPOSITION                 00001609 RG    02        
TMSCP$COM_PKT_LEN                000022AC RG    02        TMSCP$RESTOR                     00000950 RG    02        
TMSCP$CREATE_UQB                 000009F7 RG    02        TMSCP$SEND_END                   0000203A RG    02        
TMSCP$C_DEBUG_FLAGS              ********W G    02        TMSCP$SEND_PKT                   0000207B RG    02        
TMSCP$DEALLOC_HQB                00002133 RG    02        TMSCP$SEQUENTIAL                 00001187 RG    02        
TMSCP$DET_ACC_PATH               00001509 RG    02        TMSCP$SEQ_ALT                    00001190 RG    02        
TMSCP$DO_WRT                     00001995 RG    02        TMSCP$SEQ_STALL                  00001DE3 RG    02        
TMSCP$DRIVE_CHECK                00001B41 RG    02        TMSCP$SERV_INFO                  0000229C RG    02        
TMSCP$DRIVE_TRANSFER             00001B35 RG    02        TMSCP$SERV_NAME                  0000229C RG    02        
TMSCP$END                        000023D0 RG    02        TMSCP$SET_CLEAR_CDL              00001242 RG    02        
TMSCP$END_PKT_LEN                000022D2 RG    02        TMSCP$SET_CLEAR_SEX              000011ED RG    02        
TMSCP$ERASE                      0000151C RG    02        TMSCP$SET_CONTROLLER_CHAR        000010E2 RG    02        
TMSCP$ERASE_GAP                  00001603 RG    02        TMSCP$SET_IMMED                  00001218 RG    02        
TMSCP$ERROR_NO_UNIT              000020F6 RG    02        TMSCP$SET_SEX                    00001FA2 RG    02        
TMSCP$ERR_DLS                    00001F71 RG    02        TMSCP$SET_UNIT_CHAR              000013C2 RG    02        
TMSCP$ERR_EOF                    00001F82 RG    02        TMSCP$SPEEDTOMSCP                00002239 RG    02        
TMSCP$ERR_EOT                    00001F3C RG    02        TMSCP$START                      0000077D RG    02        
TMSCP$ERR_LEOT                   00001F67 RG    02        TMSCP$TU_ABSDENS                 0000215E RG    02        
TMSCP$ERR_OFFLINE                00001F1A RG    02        TMSCP$TU_ABSPEED                 000021BC RG    02        
TMSCP$ERR_PLOST                  00001F51 RG    02        TMSCP$TU_VMSDENS                 00002158 RG    02        
TMSCP$ERR_TBL                    00001E7E RG    02        TMSCP$UNBLOCK                    00001E08 RG    02        
TMSCP$ERR_WRITLCK                00001F2F RG    02        TMSCP$UNHOOK_CDRP                00002112 RG    02        
TMSCP$FIND_SECTION               00002211 RG    02        TMSCP$VC_ERR                     00000BE0 RG    02        
TMSCP$FIND_UQB                   00001FC7 RG    02        TMSCP$VC_ERR_ABORT               00000BDF RG    02        
TMSCP$FLUSH                      00001785 RG    02        TMSCP$VMSTOMSCP_DENS             000021C8 RG    02        
TMSCP$FULL                       000009DB RG    02        TMSCP$V_DBG_MSG_IN             = 00000001                 
TMSCP$GET_COMMAND_STATUS         00000F0E RG    02        TMSCP$V_DBG_SEND_PKT           = 00000002                 
TMSCP$GET_UNIT_STATUS            00000F89 RG    02        TMSCP$V_DBG_START              = 00000000                 
TMSCP$IMMEDIATE                  00000E3F RG    02        TMSCP$WRITE                      00001982 RG    02        
TMSCP$INIT                       00000770 RG    02        TMSCP$WRITE_TAPE_MARK            00001921 RG    02        
TMSCP$LISTEN                     00000B20 RG    02        TMSCP$WRITE_TRANSFER             000019E3 RG    02        
TMSCP$L_DEBUG_FLAGS              0000076C RG    02        TSRV$B_SUBTYPE                 = 0000000B                 
TMSCP$MOD_TBL                    000022F8 RG    02        TSRV$B_TYPE                    = 0000000A                 
TMSCP$MSCPTOSPEED                00002261 RG    02        TSRV$K_AR_ADD                  = 00000002                 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 169
Symbol table                                                             16-DEC-1992 11:07:07  [MSCP.SRC]TMSCP.MAR;1            (62)

TSRV$K_AR_START                = 00000001                 UQB$L_ONLINE_HQB               = 00000070                 
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              = 00000120                 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                = 00000124                 UQB$W_STATE                    = 0000000C                 
UCB$W_TU_FORMENU               = 00000054                 UQB$W_ST_FLAGS                 = 000000C8                 
UCB$W_TU_NOISE                 = 00000128                 UQB$W_TAPEM_SKIP               = 000000AC                 
UCB$W_TU_SPEED                 = 00000126                 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_SVPN                      = 00000016                 
UQB$B_SUBTYPE                  = 0000000B                 VA$V_SVPN                      = 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                 
TMSCP                           - TMSCP Server - Emulator                28-APR-1993 22:39:25  VAX MACRO V5.4-3            Page 170
Psect synopsis                                                           16-DEC-1992 11:07:07  [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       000023D0  ( 9168.)  02 (  2.)  NOPIC   USR   CON   REL   LCL NOSHR   EXE   RD    WRT NOVEC QUAD  

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

Phase                    Page faults    CPU Time       Elapsed Time   
-----                    -----------    --------       ------------   
Initialization                   27     00:00:00.03    00:00:01.39
Command processing              848     00:00:00.08    00:00:07.95
Pass 1                         2177     00:00:04.08    00:00:33.67
Symbol table sort                 1     00:00:00.49    00:00:00.49
Pass 2                           16     00:00:01.19    00:00:22.21
Symbol table output               0     00:00:00.01    00:00:01.58
Psect synopsis output             0     00:00:00.00    00:00:00.00
Cross-reference output            0     00:00:00.00    00:00:00.00
Assembler run totals           3073     00:00:05.88    00:01:07.29

The working set limit was 6144 pages.
647967 bytes (1266 pages) of virtual memory were used to buffer the intermediate code.
There were 390 pages of symbol table space allocated to hold 6393 non-local and 279 local symbols.
7485 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      
------------------                           --------------      
_$254$DUA2119:[SYS.OBJ]LIB.MLB;1                       51        
_$254$DUA2119:[SYSLIB]STARLET.MLB;2                    15        
TOTALS (all libraries)                                 66        

6948 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
