SWTAP	X0015 - SWITCH TAPE UNI	MACRO M1110  21-AUG-78 20:57  PAGE 3





      1	000000					$BEGIN	SWTAP,0015,<SWITCH TAPE UNIT>

						.TITLE	SWTAP	X0015 - SWITCH TAPE UNIT

						.IDENT	"X0015"

      2

      3					;

      4					; COPYRIGHT (C) 1976 BY DIGITAL EQUIPMENT CORPORATION,

      5					; MAYNARD, MASSACHUSETTS

      6					;

      7					; THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY ON A

      8					; SINGLE  COMPUTER  SYSTEM AND MAY BE COPIED ONLY WITH THE IN-

      9					; CLUSION OF THE ABOVE COPYRIGHT NOTICE.   THIS  SOFTWARE,  OR

     10					; ANY  OTHER  COPIES THEREOF, MAY NOT BE PROVIDED OR OTHERWISE

     11					; MADE AVAILABLE TO ANY OTHER PERSON EXCEPT FOR  USE  ON  SUCH

     12					; SYSTEM  AND TO ONE WHO AGREES TO THESE LICENSE TERMS.  TITLE

     13					; TO AND OWNERSHIP OF THE SOFTWARE SHALL AT ALL  TIMES  REMAIN

     14					; IN DIGITAL.

     15					;

     16					; THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITH-

     17					; OUT  NOTICE  AND  SHOULD NOT BE CONSTRUED AS A COMMITMENT BY

     18					; DIGITAL EQUIPMENT CORPORATION.

     19					;

     20					; DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY  FOR

     21					; THE USE OR RELIABILITY OF ITS SOFTWARE ON EQUIPMENT WHICH IS

     22					; NOT SUPPLIED BY DIGITAL.

     23					;

     24					; ANDREW C. GOLDSTEIN  18-AUG-76  21:14

     25					; GEORGE RITTENBURG 14-APR-77 MODIFIED FOR VFY/CMP DISK TO/FROM TAPE

     26

     27

     28						.MCALL	ALUN$S

SWTAP	X0015 - SWITCH TAPE UNI	MACRO M1110  21-AUG-78 20:57  PAGE 4





     30					;+

     31					;

     32					; *** - $SWITI	SWITCH TO NEXT INPUT TAPE

     33					;

     34					; THIS ROUTINE VERIFIES THE TRAILER LABEL SET ON THE CURRENT INPUT

     35					; TAPE AND REWINDS IT AND SETS IT OFF-LINE. IT THEN FINDS THE NEXT

     36					; AVAILABLE TAPE UNIT IN THE INPUT VOLUME TABLE, READIES IT FOR

     37					; INPUT, AND VERIFIES THE HEADER LABEL SET.

     38					;

     39					; INPUTS:

     40					;

     41					;	R0 = BUFFER CONTROL BLOCK WITH EOF

     42					;	INPUT LUN ASSIGNED TO TAPE UNIT

     43					;	$INDEV POINTING AT CURRENT ENTRY IN TABLE

     44					;	VOLUME LABEL IN $IVBF

     45					;	FILE LABELS IN $IF1BF AND $IF2BF

     46					;

     47					; OUTPUTS:

     48					;

     49					;	INPUT UNIT ASSIGNED TO NEW TAPE UNIT

     50					;	$OUDEV POINTING AT NEW DEVICE TABLE ENTRY

     51					;	UPDATED VOLUME LABEL IN $IVBF

     52					;	UPDATED FILE LABELS IN $IF1BF AND $IF2BF

     53					;	OLD TAPE COMPLETED AND REWINDING

     54					;	NEW TAPE SET UP

     55					;	ALL REGISTERS PRESERVED

     56					;

     57					;-

     58

     59	000000				$SWITI::

     60	000000					$CALL $SAVAL			; SAVE ALL REGISTERS

     61	000004					BEGIN RLAB

     62	000004					  LET B.STAT(R0) := #0		; DISCARD BUFFER WITH EOF

     63	000010					  LET R4 := B.LINK(R0)		; GET NEXT BCB IN WAIT LIST

     64	000014					  PUSH R4			; AND SAVE IT

     65	000016					  PUSH R0			; SAVE FIRST BCB FOR LATER USE

     66	000020					  IF R4 NE #0			; IF WE WERE READING AHEAD

     67	000024					    $CALL $WAITI <,,,,R4>	; IT SHOULD GET FIRST TRAILER

     68	000030					    ON.ERROR THEN ERROR ER.ILB

     69	000034					    IF B.LINK(R4) NE #0

     70	000042					      FATAL <EXCESSIVE READ AHEAD FOUND>

     71	000044					    END

     72	000044					    LET R5 := R4 + #B.SIZ

     73	000052					    LET R1 := 2(R4)		; BYTE COUNT READ

     74	000056					    IF RESULT IS NE LEAVE RLAB	; IF NOT DUMMY READ

     75	000060					  END

     76	000060					  $CALL $RDWAT <,#80.,,,(SP)>	; READ TRAILER INTO BUFFER

     77	000072					  ON.ERROR THEN ERROR ER.ILB

     78	000076					END RLAB

     79	000076					IF R1 NE #80. OR (R5) NE #"EO THEN ERROR ER.IFM

     80	000114					IF 2(R5) EQ #"F1		; IF END OF FILE SET

     81					;WE SHOULD ONLY GET HERE AT EOF ON TAPE I.P.DURING COPY OR VFY

     82					;AND WHEN EOF OCCURS  ON O.P. DURING VFY PASS

     83	000124					  IF #KY.VER SET.IN $OFLAG     ;IF VFY REQUESTED

     84	000134						IF #KY.VFY OFF.IN $FLAG1 ;AND NOT YET EXCUTED

     85	000144							LET B.STAT(R4) := #0 ;RELEASE BUFFER

     86	000150							JUMPTOTO POSIT

SWTAP	X0015 - SWITCH TAPE UNI	MACRO M1110  21-AUG-78 20:57  PAGE 4-1





     87	000154						END

     88	000154					  END

     89	000154					IF #KY.NIP SET.IN $FLAG1 AND $RELNO EQ #1  ; IF CURR.TAPE

     90						; IS O.P. AND NOT FIRST REEL

     91	000174						GOTO SKUNL		; SKIP REWIND UNLOAD

     92	000176					ELSE

     93	000200					  	IF #KY.NIP OFF.IN $FLAG1 AND $RELNI EQ #1  ;IF CURR.TAPE

     94						; IS I.P. AND NOT FIRST REEL

     95	000220						   GOTO SKUNL		; SKIP REWIND UNLOAD

     96	000222						END

     97	000222					END

     98	000222					 $CALL $RWNDU <,#INLUN,,,R4>

     99	000232				SKUNL:

    100	000232					  LET (R4) :B= #IE.EOF		; SET EOF STATUS

    101	000236	022626 				  CMP (SP)+,(SP)+		;CLEAN STACK

    102	000240					  RETURN

    103	000242					END

    104					;WE CAN GET HERE AT EOV ON I.P. TAPE DURING COPY PASS OR

    105					; AT EOV ON EITHER I.P. OR O.P. DURING VFY PASS

    106	000242					IF 2(R5) NE #"V1 THEN ERROR ER.IFM

    107	000254					LET B.STAT(R4) := #0		; RELEASE THE BUFFER

    108

    109	000260					$CALL $RDWAT <,#80.,,,(SP)>	; READ EOV2

    110	000272					ON.ERROR THEN ERRP ER.ILB

    111	000276					IF R1 NE #80. OR (R5) NE #"EO OR 2(R5) NE #"V2 THEN ERRP ER.IFM

    112	000324					LET $IFLAG := $IFLAG OFF.BY #KY.EOT  ;CLEAR EOT COND.

    113	000332					LET B.STAT(R4) := #0  ;RELEASE BUFFER

    114	000336					IF #KY.VER SET.IN $OFLAG

    115	000346						IF #KY.VFY OFF.IN $FLAG1

    116	000356						   LET $FLAG1 := $FLAG1 OFF.BY #KY.BSP  ;CAN NOT BACKSPACE BEYOND EOT

    117	000364						  JUMPTO POSIT		;TO POSITION I.P. TAPE FOR VERIFY

    118	000370						  END

    119	000370					END

    120					;WE CAN GET HERE AT EOV I.P. DURING COPY PASS OR

    121					; AT EOV EITHER I.P. OR O.P. DURING VFY PASS

    122	000370					$CALL $RWNDU  <,#INLUN,,,R4>

    123					;

    124					; NOW FIND, READY, AND INITIALIZE THE NEXT INPUT TAPE

    125					;

    126	000400					IF #KY.NIP SET.IN $FLAG1 AND #KY.VER SET.IN $OFLAG		;IF TAPE O.P. VFY

    127	000420						$CALL $SWCHO	;TO WRITE INITIAL PART OF TAPE

    128	000424						JUMPTO CONTCP	;TO CONTINUE COPYING

    129	000430					END

    130	000430					IF #KY.NIP SET.IN $FLAG1

    131	000440					   LET $RELNO := $RELNO + #1	; BUMP O.P. REEL NO.

    132	000444					   LET $OUDEV := $OUDEV + #V.SIZ  ; BUMP TO NEXT DEVICE O.P.

    133	000452					   LET R0 := $OUDEV - #$OVTAB

    134	000462					   $CALL $DIV  <R0,#V.SIZ>

    135	000472					   IF R0 HIS $OVNUM

    136	000500						LET $OUDEV := #$OVTAB

    137	000506				    	   END

    138	000506					   LET R0 := $OUDEV

    139	000512					 ELSE

    140	000514					    LET $RELNI := $RELNI + #1		; BUMP I.P. REEL NO.

    141	000520					    LET $INDEV := $INDEV + #V.SIZ	; BUMP TO NEXT INPUT DEVICE

    142	000526					    LET R0 := $INDEV - #$IVTAB	; SEE IF WE WERE USING THE LAST

    143	000536					    $CALL $DIV <R0,#V.SIZ>		; ENTRY IN THE DEVICE TABLE

SWTAP	X0015 - SWITCH TAPE UNI	MACRO M1110  21-AUG-78 20:57  PAGE 4-2





    144	000546					    IF R0 HIS $IVNUM

    145	000554					    LET $INDEV := #$IVTAB		; YES - WRAP TO THE FIRST

    146	000562					    END

    147	000562					    LET R0 := $INDEV

    148	000566				        END

    149	000566					ALUN$S #INLUN,(R0),2(R0)	; ASSIGN THE LUN TO IT

    150					;

    151					; PREPARE THE IMAGES OF THE EXPECTED HEADER LABEL SET

    152					;

    153	000606					IF #KY.NIP SET.IN $FLAG1

    154	000616					   LET R0 := #$OVBF+9.

    155	000622					ELSE

    156	000624				   	   LET R0 := #$IVBF+9.		; POINT TO END OF VOLUME NAME

    157	000630					END

    158	000630	105210 				INCB (R0)			; BUMP SEQUENCE NUMBER IN NAME

    159	000632					IFB (R0) HIS #'9

    160	000640					  LET (R0) :B= #'0		; HANDLE THE CARRY

    161	000644	105240 				  INCB -(R0)

    162	000646					END

    163	000646					IF #KY.NIP SET.IN $FLAG1

    164	000656					   LET $OVBF+10. :B= #40

    165	000664					   LET R0 := #$OF1BF+31.

    166	000670					ELSE

    167	000672				   	   LET #$IVBF+10. :B= #40		; CLEAR MIXED DENSITY FLAG

    168	000700					   LET R0 := #$IF1BF+31.		; POINT TO FILE SECTION NUMBER

    169	000704					END

    170	000704					THRU R1 := #4			; INCREMENT BY 1 (IN ASCII)

    171	000710	105240 				  INCB -(R0)			; BUMP DIGIT

    172	000712					  IFB (R0) LOS #'9 LEAVE LOOP

    173	000720					  LET (R0) :B= #'0		; WRAP TO 0 ON CARRY

    174	000724					END LOOP

    175					;

    176					; NOW LOOP UNTIL THE RIGHT TAPE REEL IS MOUNTED

    177					;

    178	000730				REPEET:

    179	000730					    $CALL $INRDY		; AND WAIT UNTIL IT IS READY

    180	000734					    LET R4 := 2(SP)		;RESET R4

    181	000740					    IF R0 NE #0			; TAPE MUST BE AT BOT

    182	000744					      ERRP ER.BOT		; OUTPUT MESSAGE

    183	000746					      JUMPTO RERPET		; AND WAIT TO BE FIXED

    184	000752					    END

    185	000752					IF #KY.NIP SET.IN $FLAG1	; IF TAPE O.P.

    186	000762					   LET R5 := $OFLAG

    187	000766					ELSE

    188	000770					  LET R5 := $IFLAG

    189	000774					END

    190	000774					IF #KY.160 SET.IN R5	; NOW SET THE CORRECT DENSITY

    191	001002					      $CALL $STI16		; 1600 BPI

    192	001006					ELSE

    193	001010					      $CALL $STI08		; OR 800 BPI

    194	001014					END

    195					;WE ARE NOW READY TO CHECK FRONT OF I.P. TAPE FOR COPY ONLY OPERATION OR

    196					; TO COPY FROM/TO I.P. OR O.P. TAPE FOLLOWING VERIFY OPERATION

    197					;

    198	001014					   $CALL SPACTP

    199	001020					   ON.ERROR THEN GOTO RERPET

    200	001024					IF #KY.VER SET.IN $OFLAG  ;IF VERIFY PASS JUST COMPLETED

SWTAP	X0015 - SWITCH TAPE UNI	MACRO M1110  21-AUG-78 20:57  PAGE 4-3





    201	001034					CONTCP:

    202	001034						IF #KY.NIP SET.IN $FLAG1	; IF CURR. TAPE IS O.P.

    203	001044						   LET R0 := $INDEV	;RE-ASGN LUN TO I.P.

    204	001050						   ALUN$S #INLUN,(R0),2(R0)

    205	001070						END

    206	001070						LET $FLAG1 := $FLAG1 OFF.BY #37777	; RESET $FLAG1

    207	001076						LET R0 := #$HOLD

    208	001102						LET $VBN := $TVBN

    209	001110						LET $VBN+2 := $TVBN+2

    210	001116						LET $WVBN := $VBN

    211	001124						LET $WVBN+2 := $VBN+2

    212	001132						LET $FID := $TFID	;INSURE CORRECT FID

    213	001140						LET $FID+2 := $TFID+2

    214	001146						LET $FID+4 := $TFID+4

    215	001154						LET $IHVBN := $THVBN	;INSURE CORRECT IHVBN

    216	001162						LET $IHVBN+2 := $THVBN+2

    217	001170						LET $OHVBN := $THVBN

    218	001176						LET $OHVBN+2 := $THVBN+2

    219	001204						LET $FISIZ := $TFSIZ   ;INSURE CORRECT FISIZ

    220	001212						LET $FISIZ+2 := $TFSIZ+2

    221	001220						LET (R0)+ := $TVBN

    222	001224						LET (R0)+ := $TVBN+2

    223	001230						LET (R0)+ := $FID

    224	001234						LET (R0)+ := $FID+2

    225	001240						LET (R0)+ := $FID+4

    226	001244						LET (R0)+ := $IHVBN

    227	001250						LET (R0)+ := $IHVBN+2

    228	001254						LET (R0)+ := $FISIZ

    229	001260						LET (R0)+ := $FISIZ+2

    230						;RESTORE FID IN PREFIXES

    231	001264						LET R0 := #$BUF2+P.FID

    232	001270						LET (R0)+ := $FID

    233	001274						LET (R0)+ := $FID+2

    234	001300						LET (R0)+ := $FID+4

    235	001304						LET (R0) := #0

    236	001306						LET R0 := #$BUF1+P.FID  ;AND IN OTHER PREFIX

    237	001312						LET (R0)+ := $FID

    238	001316						LET (R0)+ := $FID+2

    239	001322						LET (R0)+ := $FID+4

    240	001326						LET (R0) := #0

    241						;RELEASE BUFFERS

    242	001330						LET $B1HD+B.STAT := #0

    243	001334						LET $B2HD+B.STAT := #0

    244	001340						LET SP := $STAK	;CLEAN OUT STACK

    245	001344						 ERRP ER.RSC

    246	001346						JUMPTO COPY1		;RESUME COPY

    247

    248	001352					   END

    249	001352					   JUMPTO FINISH

    250	001356				RERPET:

    251	001356					$CALL $RWNDU  <,#INLUN,,,R4>

    252	001366					 LET B.STAT(R4) := #0

    253	001372					JUMPTO REPEET		; TRY AGAIN

    254					; READ AND VERIFY THE HEADER LABELS

    255					;

    256	001376				SPACTP:

    257	001376					    $CALL $RDWAT <,#80.,,,2(SP)>	; READ THE VOLUME HEADER LABEL

SWTAP	X0015 - SWITCH TAPE UNI	MACRO M1110  21-AUG-78 20:57  PAGE 4-4





    258	001412					    IF  #KY.NIP SET.IN $FLAG1		; IF CURRENT TAPE IS O.P.

    259	001422						$CALL CKLAB <#$OVBF,,,,,R5>

    260	001432					    ELSE

    261	001434						    $CALL CKLAB <#$IVBF,,,,,R5>	; CHECK THE LABEL

    262	001444					    END

    263	001444					    ON.ERROR THEN RETURN ERROR

    264	001452					    LET B.STAT(R4) := #0	; RELEASE THE BUFFER

    265

    266	001456					    $CALL $SPACB  <,#INLUN,,,R4,#1>

    267	001472					    $CALL $INCK <,,,,R4>

    268	001476					    ON.ERROR

    269	001500					      ERRP ER.ILB

    270	001502					      RETURN ERROR

    271	001506					    END

    272

    273	001506					    $CALL $RDWAT <,#80.,,,R4>	; READ HDR1

    274	001516					     IF #KY.NIP SET.IN $FLAG1			; IF CURR. TAPE IS O.P.

    275	001526						$CALL CKLAB <#$OF1BF,,,,,R5>

    276	001536					     ELSE

    277	001540						    $CALL CKLAB <#$IF1BF,,,,,R5> ; VERIFY IT

    278	001550					    END

    279	001550					    ON.ERROR THEN RETURN ERROR

    280	001556					    LET B.STAT(R4) := #0	; RELEASE THE BUFFER

    281

    282	001562					    $CALL $RDWAT <,#80.,,,R4>	; READ HDR2

    283	001572					     IF #KY.NIP SET.IN $FLAG1			; IF CURR. TAPE IS O.P.

    284	001602						$CALL CKLAB <#$OF2BF,,,,,R5>

    285	001612					     ELSE

    286	001614						    $CALL CKLAB <#$IF2BF,,,,,R5> ; VERIFY IT

    287	001624					    END

    288	001624					    ON.ERROR THEN RETURN ERROR

    289	001632					    LET B.STAT(R4) := #0	; RELEASE THE BUFFER

    290	001636						$CALL $SPACF  <,#INLUN,,,R4,#1>

    291	001652						ON.ERROR THEN ERROR ER.DIR

    292	001656						   IFB (R4) LT #0

    293	001662							IF #KY.VFY SET.IN $FLAG1 OR #KY.CMP SET.IN $OFLAG

    294	001702							  ERROR ER.IIR

    295	001704							ELSE

    296	001706							   ERRP ER.IIR

    297	001710							END

    298	001710						   END

    299	001710						LET $IFLAG := $IFLAG OFF.BY #KY.EOT

    300	001716						LET B.STAT(R4) := #0

    301	001722					    RETURN			; CORRECT TAPE IS ON LINE

    302					;

    303					; FINISH SETTING UP THE TAPE

    304					;

    305	001724				FINISH:

    306	001724					POP R4

    307	001726					$CALL $READ <,#2048.+P.SIZ,,,R4> ; RE-ISSUE ORIGINAL READ

    308	001736					$CALL $WAITI <,,,,R4>		; AND LET IT COMPLETE FOR SYMMETRY

    309	001742					POP R4				; GET READ AHEAD BUFFER

    310	001744					IF RESULT IS NE			; IF EXISTS

    311	001746					  IF 2(R4) NE #0		; IF NOT A DUMMY READ

    312	001754					    $CALL $READ <,#2048.+P.SIZ,,,R4> ; RE-ISSUE IT

    313	001764					  ELSE

    314	001766					    LET B.STAT(R4) := #3	; SET READ IN PROGRESS

SWTAP	X0015 - SWITCH TAPE UNI	MACRO M1110  21-AUG-78 20:57  PAGE 4-5





    315	001774					    $CALL $LINKI <,,,,R4>	; AND LINK TO WAIT LIST

    316	002000					  END

    317	002000					END

    318	002000					RETURN				; DONE AND GOOD LUCK

    319					;

    320					; WE GET HERE TO POSITION I.P. OR O.P. TAPES FOR VERIFY OPERATION

    321					;

    322	002002				POSIT::

    323	002002					ERRP ER.VFY		;INDICATE BEGIN VFY PASS

    324	002004					LET $FLAG1 := $FLAG1 SET.BY #KY.VFY

    325	002012					IF $FLAG1 GT #0 AND $RELNO NE #1

    326						; IF CURR. TAPE IS O.P. AND NOT FIRST REEL

    327

    328	002030					    LET R0 := $OUDEV	; ASSIGN INLUN TO O.P. DEV.

    329	002034					    ALUN$S #INLUN,(R0),2(R0)

    330	002054					    LET $FLAG1 := $FLAG1 SET.BY #KY.NIP  ; INDICATE O.P.

    331	002062					   GOTO SKCMP		; BRANCH

    332	002064					ELSE

    333	002066					    IF $FLAG1 LT #0 AND $RELNI NE #1

    334						; IF CURR. TAPE IS I.P. AND NOT FIRST REEL

    335

    336	002104						GOTO SKCMP	; BRANCH

    337	002106					   END

    338	002106					END

    339	002106					LET SP := $STAK		;CLEAN OUT THE STACK

    340	002112					JUMPTO COMP		;TO VERIFY 1ST REEL

    341	002116				SKCMP:	$CALL $RWND  <,#INLUN,,,R4>

    342	002126					$CALL $INCK <,,,,R4>

    343	002132					ERRP ER.BOT		;TAPE REWINDING

    344	002134				REPETE:

    345	002134					$CALL $INRDY

    346	002140					IF R0 NE #0 THEN GOTO REPETE  ;LOOP UNTIL TAPE AT BOT

    347	002146					LET (SP) := #$B1HD

    348	002152					LET $B1HD+B.STAT := #0

    349	002156					LET $OF1BF := #"HD

    350	002164					LET $OF1BF+2 := #"R1

    351	002172					LET R0 := #$OF1BF+54.

    352	002176					THRU R1 := #3		;ZERO BLOCK COUNT

    353	002202						LET (R0)+ := #"00

    354	002206					END LOOP

    355	002212					LET $OF2BF := #"HD

    356	002220					LET $OF2BF+2 := #"R2

    357	002226					$CALL SPACTP		;SPACE PAST FRONT OF TAPE

    358	002232					ON.NOERROR THEN GOTO CNTVFY

    359	002236					$CALL $RWNDU  <,#INLUN,,,R4>

    360	002246					LET B.STAT(R4) := #0

    361	002252					ERRP ER.BOT

    362	002254					GOTO REPETE

    363	002256				CNTVFY:	LET R0 := $INDEV

    364	002262					ALUN$S #INLUN,(R0),2(R0)	;RE-ASGN LUN TO I.P.

    365	002302					LET R0 := #$HOLD

    366	002306					LET $VBN := (R0)+

    367	002312					LET $VBN+2 := (R0)+

    368	002316					LET $FID := (R0)+

    369	002322					LET $FID+2 := (R0)+

    370	002326					LET $FID+4 := (R0)+

    371	002332					LET $IHVBN := (R0)+

SWTAP	X0015 - SWITCH TAPE UNI	MACRO M1110  21-AUG-78 20:57  PAGE 4-6





    372	002336					LET $IHVBN+2 := (R0)+

    373	002342					LET $FISIZ := (R0)+

    374	002346					LET $FISIZ+2 := (R0)+

    375	002352					LET $WVBN := $VBN

    376	002360					LET $WVBN+2 := $VBN+2

    377	002366					LET $OHVBN := $IHVBN

    378	002374					LET $OHVBN+2 := $IHVBN+2

    379	002402					LET $THVBN := $IHVBN		;RESTORE THVBN

    380	002410					LET $THVBN+2 := $IHVBN+2

    381	002416					LET $TFSIZ := $FISIZ		;RESTORE TFSIZ

    382	002424					LET $TFSIZ+2 := $FISIZ+2

    383	002432					LET $TVBN := $VBN

    384	002440					LET $TVBN+2 := $VBN+2

    385	002446					LET $TFID := $FID

    386	002454					LET $TFID+2 := $FID+2

    387	002462					LET $TFID+4 := $FID+4

    388	002470					IF #KY.NIP SET.IN $FLAG1 AND #KY.DSK SET.IN $IFLAG

    389						; IF TAPE O.P. AND DISK I.P.

    390

    391	002510						LET $IHHD+B.STAT := #0	;RELEASE HEADER BUFFER

    392	002514						LET $FLAG1 := $FLAG1 OFF.BY #KY.NIP  ;TURN OFF O.P.

    393	002522						$CALL $RDHDR  <,,#0,$FID>  ;RESTORE I.P. DISK HDR

    394	002536					ELSE

    395	002540						IF #KY.NIP OFF.IN $FLAG1 AND #KY.DSK SET.IN $OFLAG

    396						; IF TAPE I.P. AND DISK O.P.

    397

    398	002560				   		   LET $OHHD+B.STAT := #0	;RELEASE HEADER BUFFER

    399	002564						   $CALL $RDHDO  <,,#0,$FID>   ;RESTORE O.P. DISK HDR

    400	002600						END

    401	002600					END

    402	002600						LET $FLAG1 := $FLAG1 OFF.BY #KY.NIP   ;TURN OFF O.P.

    403						; ABOVE RESTORES ORIGINAL DISK FILE HDR FOR VFY

    404

    405	002606					LET SP := $STAK		;CLEAN OUT THE STACK

    406	002612					LET $B1HD+B.STAT := #0	;RELEASE BUFFERS

    407	002616					LET $B2HD+B.STAT := #0

    408	002622					JUMPTO COMP1		;RESUME VERIFY

    409

SWTAP	X0015 - SWITCH TAPE UNI	MACRO M1110  21-AUG-78 20:57  PAGE 5





    411					;+

    412					;

    413					; *** - CKLAB	CHECK CONTINUATION TAPE LABEL

    414					;

    415					; THIS ROUTINE VERIFIES THAT THE GIVEN FILE LABEL IS THE EXPECTED

    416					; ONE.

    417					;

    418					; INPUTS:

    419					;

    420					;	CC - C	RESULT OF LABEL READ CALL

    421					;	R0 = ADDRESS OF EXPECTED LABEL

    422					;	R1 = BYTE COUNT READ

    423					;	R5 = ADDRESS OF LABEL READ

    424					;

    425					; OUTPUTS:

    426					;

    427					;	CC - C	CLEAR IF OK

    428					;		SET IF WRONG (MESSAGE PRINTED)

    429					;	R1,R2,R3 CLOBBERED, OTHER REGISTERS PRESERVED

    430					;

    431					;-

    432

    433	002626				CKLAB:

    434	002626					ON.ERROR			; IF ERROR READING LABEL

    435	002630					  ERRP ER.ILB			; REPORT IT

    436	002632					ELSE

    437	002634					  IF R1 NE #80.			; CHECK BYTE COUNT READ

    438	002642					    ERRP ER.IFM			; NOT ANSI IF WRONG

    439	002644					  ELSE

    440	002646					    BEGIN CHECK

    441	002646					      LET R2 := R0		; COPY POINTERS, LEAVING

    442	002650					      LET R3 := R5		; ORIGINALS FOR ERROR PRINTER

    443	002652					      THRU R1 := #40.		; COMPARE LABELS

    444	002656						IF (R2)+ NE (R3)+ LEAVE CHECK

    445	002662					      END LOOP

    446	002666					      RETURN NOERROR		; LABEL IS OK

    447	002672					    END CHECK

    448	002672					    ERRP ER.WRV			; REPORT WRONG VOLUME

    449	002674					  END

    450	002674					END

    451	002674					RETURN				; (C IS SET)

SWTAP	X0015 - SWITCH TAPE UNI	MACRO M1110  21-AUG-78 20:57  PAGE 6





    453					;+

    454					;

    455					; *** - $SWITO	SWITCH TO NEXT OUTPUT TAPE

    456					;

    457					; THIS ROUTINE WRITES A VOLUME TRAILER LABEL SET ON THE CURRENT OUTPUT

    458					; TAPE AND REWINDS IT AND SETS IT OFF-LINE. IT THEN FINDS THE NEXT

    459					; AVAILABLE TAPE UNIT IN THE OUTPUT VOLUME TABLE, READIES IT FOR

    460					; OUTPUT, AND WRITES A NEW VOLUME HEADER LABEL SET.

    461					;

    462					; INPUTS:

    463					;

    464					;	OUTPUT LUN ASSIGNED TO TAPE UNIT

    465					;	$OUDEV POINTING AT CURRENT ENTRY IN TABLE

    466					;	VOLUME LABEL IN $OVBF

    467					;	FILE LABELS IN $OF1BF AND $OF2BF

    468					;

    469					; OUTPUTS:

    470					;

    471					;	OUTPUT UNIT ASSIGNED TO NEW TAPE UNIT

    472					;	$OUDEV POINTING AT NEW DEVICE TABLE ENTRY

    473					;	UPDATED VOLUME LABEL IN $OVBF

    474					;	UPDATED FILE LABELS IN $OF1BF AND $OF2BF

    475					;	OLD TAPE COMPLETED AND REWINDING

    476					;	NEW TAPE LABELED

    477					;	ALL REGISTERS PRESERVED

    478					;

    479					;-

    480

    481	002676				$SWITO::

    482	002676					$CALL $SAVAL			; SAVE ALL REGISTERS

    483	002702					$CALL $TFINO <#1>		; FINISH THIS REEL

    484	002712				$SWCHO:

    485	002712					LET $OFLAG := $OFLAG OFF.BY #KY.EOT ; CLEAR EOT CONDITION

    486					;

    487					; NOW FIND, READY, AND INITIALIZE THE NEXT OUTPUT TAPE

    488					;

    489	002720					LET $RELNO := $RELNO + #1	; BUMP TO NEXT REEL NUMBER O.P.

    490	002724					LET $OUDEV := $OUDEV + #V.SIZ	; BUMP TO NEXT OUTPUT DEVICE

    491	002732					LET R0 := $OUDEV - #$OVTAB	; SEE IF WE WERE USING THE LAST

    492	002742					$CALL $DIV <R0,#V.SIZ>		; ENTRY IN THE DEVICE TABLE

    493	002752					IF R0 HIS $OVNUM

    494	002760					  LET $OUDEV := #$OVTAB		; YES - WRAP TO THE FIRST

    495	002766					END

    496	002766					LET R0 := $OUDEV

    497	002772					ALUN$S #OUTLUN,(R0),2(R0)	; ASSIGN THE LUN TO IT

    498	003012					REPEAT

    499	003012					  $CALL $OTRDY			; AND WAIT UNTIL IT IS READY

    500	003016					  IF R0 EQ #0 LEAVE LOOP	; TAPE MUST BE AT BOT

    501	003022					  $CALL $RWNDU  <,#OUTLUN,,,R4>

    502	003032					  ERRP ER.OBO			; AND OUTPUT MESSAGE

    503	003034					END LOOP			; AND WAIT FOR HIM TO FIX IT

    504	003036					IF #KY.160 SET.IN $OFLAG	; NOW SET THE CORRECT DENSITY

    505	003046					  $CALL $STO16			; 1600 BPI

    506	003052					ELSE

    507	003054					  $CALL $STO08			; OR 800 BPI

    508	003060					END

    509					;

SWTAP	X0015 - SWITCH TAPE UNI	MACRO M1110  21-AUG-78 20:57  PAGE 6-1





    510					; PREPARE AND WRITE THE NEW VOLUME HEADER LABEL

    511					;

    512	003060					LET R0 := #$OVBF+9.		; POINT TO END OF VOLUME NAME

    513	003064	105210 				INCB (R0)			; BUMP SEQUENCE NUMBER IN NAME

    514	003066					IFB (R0) HIS #'9

    515	003074					  LET (R0) :B= #'0		; HANDLE THE CARRY

    516	003100	105240 				  INCB -(R0)

    517	003102					END

    518	003102					LET $OVBF+10. :B= #40		; CLEAR MIXED DENSITY FLAG

    519	003110					$CALL $WRITE <,#80.,,,#$OVHD>	; WRITE THE VOLUME HEADER LABEL

    520	003124					$CALL $WBOOT			; WRITE A BOOT ON THE TAPE

    521					;

    522					; NOW PREPARE AND WRITE THE NEW FILE HEADER LABELS

    523					;

    524	003130					LET $OF1BF := #"HD		; TURN BACK INTO "HDR1"

    525	003136					LET $OF1BF+2 := #"R1

    526	003144					LET R0 := #$OF1BF+31.		; POINT TO FILE SECTION NUMBER

    527	003150					THRU R1 := #4			; INCREMENT BY 1 (IN ASCII)

    528	003154	105240 				  INCB -(R0)			; BUMP DIGIT

    529	003156					  IFB (R0) LOS #'9 LEAVE LOOP

    530	003164					  LET (R0) :B= #'0		; WRAP TO 0 ON CARRY

    531	003170					END LOOP

    532	003174					LET R0 := #$OF1BF+54.		; POINT TO BLOCK COUNT

    533	003200					THRU R1 := #6

    534	003204					  LET (R0)+ :B= #'0		; INIT FIELD TO 0

    535	003210					END LOOP

    536	003214					$CALL $WRITE <,#80.,,,#$OF1HD>	; WRITE HDR1

    537

    538	003230					LET $OF2BF := #"HD		; TURN 2ND LABEL BACK INTO "HDR2"

    539	003236					LET $OF2BF+2 := #"R2

    540	003244					$CALL $WRITE <,#80.,,,#$OF2HD>	; AND WRITE IT

    541

    542	003260					$CALL $WEOF <,,,,#$OF3HD>	; WRITE THE TAPE MARK

    543	003270					$CALL $WAITO <,,,,R4>	;WAIT FOR ALL OF THE ABOVE

    544	003274					ON.ERROR

    545	003276					   LET $FLAG1 := $FLAG1 SET.BY #KY.NIP

    546	003304					   ERROR ER.IOR		; SEND ERROR MESSAGE

    547	003306					END

    548	003306					RETURN				; DONE AND GOOD LUCK

    549

    550

    551

    552		000001 				.END

SWTAP	X0015 - SWITCH TAPE UNI	MACRO M1110  21-AUG-78 20:57  PAGE 6-2

SYMBOL TABLE



A3    = 000001   	KY.VFY= ****** GX	L43     001070R  	TYPS3 = 000006   	$OVTAB= ****** GX

B.LINK= ****** GX	KY.160= ****** GX	L44     001434R  	TYPS4 = 000000   	$O$   = 000000

B.SIZ = ****** GX	LBLS0 = 000106   	L45     001444R  	V.SIZ = ****** GX	$R    = 177777

B.STAT= ****** GX	LBLS1 = 000106   	L46     001452R  	$BUF1 = ****** GX	$RDHDO= ****** GX

B0      000004R  	LBLS2 = 000003   	L47     001506R  	$BUF2 = ****** GX	$RDHDR= ****** GX

B1      000710R  	LBLS3 = 000004   	L5      000114R  	$B1HD = ****** GX	$RDWAT= ****** GX

B2      002202R  	LBLS4 = 000102   	L50     001540R  	$B2HD = ****** GX	$READ = ****** GX

B3      002646R  	L0      000060R  	L51     001550R  	$DIDDO= 000000   	$RELNI= ****** GX

B4      002656R  	L1      000034R  	L52     001556R  	$DIV  = ****** GX	$RELNO= ****** GX

B5      003012R  	L10     000154R  	L53     001614R  	$EF$  = 000000   	$RWND = ****** GX

B6      003154R  	L100    002646R  	L54     001624R  	$E$   = 000001   	$RWNDU= ****** GX

B7      003204R  	L101    002674R  	L55     001632R  	$FID  = ****** GX	$SAVAL= ****** GX

CHECK = 000003   	L102    002766R  	L56     001656R  	$FISIZ= ****** GX	$SPACB= ****** GX

CKLAB   002626R  	L103    003054R  	L57     001710R  	$FLAG1= ****** GX	$SPACF= ****** GX

CNTVFY  002256R  	L104    003060R  	L6      000242R  	$HOLD = ****** GX	$STAK = ****** GX

COMP  = ****** GX	L105    003102R  	L60     001702R  	$IFLAG= ****** GX	$STI08= ****** GX

COMP1 = ****** GX	L106    003306R  	L61     001706R  	$IF1BF= ****** GX	$STI16= ****** GX

CONTCP  001034R  	L11     000200R  	L62     001710R  	$IF2BF= ****** GX	$STO08= ****** GX

COPY1 = ****** GX	L12     000222R  	L63     002000R  	$IHHD = ****** GX	$STO16= ****** GX

ER.BOT= ****** GX	L13     000222R  	L64     001766R  	$IHVBN= ****** GX	$SUPMC= 000043

ER.DIR= ****** GX	L14     000254R  	L65     002000R  	$INCK = ****** GX	$SV$  = 000000

ER.IFM= ****** GX	L15     000276R  	L66     002066R  	$INDEV= ****** GX	$SWCHO  002712R

ER.IIR= ****** GX	L16     000322R  	L67     002106R  	$INRDY= ****** GX	$SWITI  000000RG

ER.ILB= ****** GX	L17     000324R  	L7      000154R  	$IVBF = ****** GX	$SWITO  002676RG

ER.IOR= ****** GX	L2      000044R  	L70     002106R  	$IVNUM= ****** GX	$T    = 000107

ER.OBO= ****** GX	L20     000370R  	L71     002146R  	$IVTAB= ****** GX	$TFID = ****** GX

ER.RSC= ****** GX	L21     000370R  	L72     002236R  	$I$   = 000001   	$TFINO= ****** GX

ER.VFY= ****** GX	L22     000430R  	L73     002540R  	$K$   = 000006   	$TFSIZ= ****** GX

ER.WRV= ****** GX	L23     000514R  	L74     002600R  	$K$L  = 000006   	$THVBN= ****** GX

E0      000076R  	L24     000506R  	L75     002600R  	$K$T  = 000006   	$TVBN = ****** GX

E1      000730R  	L25     000566R  	L76     002634R  	$L    = 000010   	$T1   = 000000

E2      002212R  	L26     000562R  	L77     002674R  	$LINKI= ****** GX	$T2   = 000106

E3      002672R  	L27     000624R  	OUTLUN= ****** GX	$L$   = 000000   	$VBN  = ****** GX

E4      002666R  	L3      000076R  	POSIT   002002RG 	$OFLAG= ****** GX	$WAITI= ****** GX

E5      003036R  	L30     000630R  	P.FID = ****** GX	$OF1BF= ****** GX	$WAITO= ****** GX

E6      003174R  	L31     000646R  	P.SIZ = ****** GX	$OF1HD= ****** GX	$WBOOT= ****** GX

E7      003214R  	L32     000672R  	REPEET  000730R  	$OF2BF= ****** GX	$WEOF = ****** GX

FINISH  001724R  	L33     000704R  	REPETE  002134R  	$OF2HD= ****** GX	$WRITE= ****** GX

IE.EOF= ****** GX	L34     000752R  	RERPET  001356R  	$OF3HD= ****** GX	$WVBN = ****** GX

IIII  = 177777   	L35     000770R  	RLAB  = 000000   	$OHHD = ****** GX	$XXX$ = 000001

INLUN = ****** GX	L36     000774R  	SKCMP   002116R  	$OHVBN= ****** GX	$Y$   = 000000

KY.BSP= ****** GX	L37     001010R  	SKUNL   000232R  	$OTRDY= ****** GX	$Z$   = 000000

KY.CMP= ****** GX	L4      000112R  	SPACTP  001376R  	$OUDEV= ****** GX	$$S   = 000000

KY.DSK= ****** GX	L40     001014R  	TYPS0 = 000000   	$OVBF = ****** GX	$$T   = 000072

KY.EOT= ****** GX	L41     001024R  	TYPS1 = 000000   	$OVHD = ****** GX	$$TT  = 000106

KY.NIP= ****** GX	L42     001352R  	TYPS2 = 000003   	$OVNUM= ****** GX	.$T   = 000005

KY.VER= ****** GX



. ABS.	000000	   000

      	003310	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  12560 WORDS  ( 50 PAGES)

DYNAMIC MEMORY:  14388 WORDS  ( 55 PAGES)

ELAPSED TIME:  00:07:50

EXE$:SWTAP,LIS$:SWTAP/-SP=SRC$:SMAC/PA:1,DSCPRE,SWTAP

