TINI	X0016 - INITIALIZE TAPE	MACRO M1110  21-AUG-78 21:09  PAGE 3





      1	000000					$BEGIN	TINI,0016,<INITIALIZE TAPE FOR INPUT>

						.TITLE	TINI	X0016 - INITIALIZE TAPE FOR INPUT

						.IDENT	"X0016"

      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  27-AUG-76  21:30

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

     26

     27

     28						.MCALL QIOW$S

     29

     30

TINI	X0016 - INITIALIZE TAPE	MACRO M1110  21-AUG-78 21:09  PAGE 4





     32					;

     33					; MAGTAPE CHARACTERISTICS BITS

     34					;

     35		004000 			CH.160 = 4000			; 1600 BPI DENSITY

     36					;

     37					; DEC SYSTEM ID IN VOL HEADER LABEL

     38					;

     39	000000	   104 	   045 	   102 	DECID:	.ASCII	"D%B1111001001"		; VOLUME ID FOR DEC MAGTAPES

	000003	   061 	   061 	   061

	000006	   061 	   060 	   060

	000011	   061 	   060 	   060

	000014	   061

     40

     41						.EVEN

     42

     43					;+

     44					;

     45					; *** - $TINI	INITIALIZE INPUT TAPE

     46					;

     47					; THIS ROUTINE DOES THE NECESSARY INITIALIZATION OF THE INPUT TAPE.

     48					; IT REWINDS THE TAPE IF CALLED FOR AND POSITIONS PAST THE HEADER

     49					; LABEL SET OF THE DESIRED FILE.

     50					;

     51					; INPUTS:

     52					;

     53					;	INLUN ASSIGNED TO DESIRED TAPE UNIT

     54					;

     55					; OUTPUTS:

     56					;

     57					;	TAPE POSITIONED TO FILE

     58					;	TAPE DENSITY SET CORRECTLY

     59					;

     60					;-

     61

     62	000016				$TINI::

     63	000016					IF #KY.NIP SET.IN $FLAG1	; IF TAPE O.P. CURRENT

     64	000026					   LET $RELNO := #1		; INIT. O.P. REEL NO. TO 1

     65	000034					ELSE

     66	000036					   LET $RELNI := #1		; INIT. I.P. REEL NO. TO 1

     67	000044					END

     68	000044					$CALL $INRDY			; VERIFY THAT TAPE IS READY FOR INPUT

     69	000050					PUSH R0				; SAVE BOT INDICATION

     70	000052					LET R2 := #0			; MARK FIRST TRY

     71	000054					BEGIN SEARCH

     72	000054				RETRY:	  				; RETRY UNTIL TAPE IS SET UP

     73	000054					IF #KY.VFY SET.IN $FLAG1	;YES = VFY IN PROGRESS

     74	000064						IF #KY.NIP SET.IN $FLAG1	; YES=INIT O.P.

     75	000074							LET R0 := #$OFLAG

     76	000100						ELSE		;INIT I.P.

     77	000102							LET R0 := #$IFLAG

     78	000106						END

     79	000106						IF #KY.BSP OFF.IN $FLAG1	;YES=FILE AT BOT

     80	000116							LET (R0) := (R0) SET.BY #KY.RWD  ;SIGNAL REWIND

     81	000122						ELSE

     82	000124							LET R4 := #$IF6HD

     83	000130							$CALL $SPACF  <,#INLUN,,,R4,#-3>  ;BACKSPACE IN

     84								; FRONT OF HDR1

TINI	X0016 - INITIALIZE TAPE	MACRO M1110  21-AUG-78 21:09  PAGE 4-1





     85	000144							$CALL  $INCK  <,,,,R4>

     86	000150							LET (R0) := (R0) OFF.BY #KY.RWD

     87	000154							LET $FLAG1 := $FLAG1 OFF.BY #KY.BSP

     88	000162						END

     89	000162					END

     90	000162					IF #KY.NIP SET.IN $FLAG1

     91	000172						LET R4 := #$OVHD

     92	000176						LET R0 := #$OFLAG

     93	000202					ELSE

     94	000204						LET R4 := #$IVHD

     95	000210						LET R0 := #$IFLAG

     96	000214					END

     97	000214					LET B.STAT(R4) := #0		;RELEASE THE VOL. HDR. BUFFR

     98	000220					  IF #KY.RWD SET.IN (R0)	; SEE IF REWIND REQUESTED

     99	000226						$CALL $RWND  <,#INLUN,,,R4>  ;REWIND THE TAPE

    100	000236					    $CALL $INCK <,,,,R4>	; CHECK FOR ERRORS

    101	000242					    LET (SP) := #0		; SET BOT FLAG

    102	000244					  END

    103	000244					  BEGIN SPACE			; NOW ATTEMPT TO SPACE TO LABELS

    104	000244					    IF (SP) EQ #0		; IF AT BOT

    105	000250					      IF R2 EQ #0		; ON FIRST TRY

    106	000254						$CALL $STI08		; SET DENSITY TO 800 BPI

    107	000260					      ELSE

    108	000262						$CALL $STI16		; SET 1600 BPI

    109	000266					      END

    110	000266					      $CALL $RDWAT <,#80.,,,R4> ; READ THE VOLUME HEADER LABEL

    111	000276					      ON.ERROR

    112	000300						LET R2 := R2 + #1	; BUMP RETRY COUNT

    113	000302						JUMPTO ESPACE		; RETRY FROM THE TOP

    114	000306					      END

    115	000306					      IF R1 NE #80. OR (R5) NE #"VO OR 2(R5) NE #"L1

    116	000332						ERROR ER.IFM		; NOT ANSI FORMAT

    117	000334					      END

    118	000334						IF #KY.NIP SET.IN $FLAG1

    119	000344							LET R4 := #$OF1HD

    120	000350						ELSE

    121	000352						      LET R4 := #$IF1HD		; USE NEXT STATUS BLOCK

    122	000356						END

    123	000356						$CALL $SPACB  <,#INLUN,,,R4,#1>  ;SKIP 1ST BOOT BLOCK

    124	000372					      $CALL $INCK <,,,,R4>

    125	000376					      IFB (R4) LT #0 THEN ERROR ER.IIR

    126	000404					      IFB 10.(R5) EQ #'A	; IF ALTERNATE DENSITY

    127	000414						$CALL $STI16		; SET IT

    128	000420					      END

    129					;

    130					; NOW SEARCH FOR A "HDR1"

    131					;

    132	000420						LET B.STAT(R4) := #0

    133	000424					      REPEAT			; LOOP TO SKIP OVER BOOTSTRAP

    134	000424						$CALL $RDWAT <,#80.,,,R4> ; TRY TO READ A LABEL

    135	000434						ON.ERROR

    136	000436						  IFB (R4) EQ #IE.BBE THEN JUMPTO ESPACE ; IF DENSITY IS WRONG

    137	000450						  IFB (R4) EQ #IE.EOF THEN ERROR ER.IFM	; MUST BE A LABEL BEFORE EOF

    138							  			; BOOT RECORDS ARE TOO LONG

    139	000460						  IFB (R4) NE #IE.DAO THEN ERROR ER.IIR	; ANYTHING ELSE IS AN ERROR

    140	000470						ELSE

    141	000472						  IF R1 EQ #80. AND (R5) EQ #"HD AND 2(R5) EQ #"R1 LEAVE LOOP

TINI	X0016 - INITIALIZE TAPE	MACRO M1110  21-AUG-78 21:09  PAGE 4-2





    142	000516						END

    143	000516						LET B.STAT(R4) := #0	; INVALIDATE BUFFER FOR RETRY

    144	000522					      END LOOP

    145	000524					      GOTO CKHD1		; SEE IF THIS HDR1 IS RIGHT

    146	000526					    END

    147					;

    148					; WE GET HERE WHILE IN THE MIDDLE OF THE TAPE.

    149					; SKIP TO THE NEXT EOF AND LOOK FOR A HDR1. IF ONE IS NOT FOUND

    150					; AFTER 3 EOF'S, THE TAPE IS NOT ANSI.

    151					;

    152	000526					REPEAT

    153	000526						LET $FLAG1 := $FLAG1 SET.BY #KY.BSP

    154	000534						IF #KY.NIP SET.IN $FLAG1	;IF TAPE O.P. AND /VFY OR /CMP

    155	000544							LET R4 := #$OF1HD

    156	000550						ELSE

    157	000552							LET $IFLAG := $IFLAG OFF.BY #KY.RWD

    158	000560							LET R4 := #$IF1HD		; USE NEXT STATUS BLOCK

    159	000564						END

    160	000564					      BEGIN SCAN

    161	000564						THRU R3 := #3		; SEARCH FOR 3 EOF'S

    162	000570						  $CALL $SPACF  <,#INLUN,,,R4,#1>

    163	000604						  $CALL $INCK <,,,,R4>

    164	000610						  ON.ERROR

    165	000612						    IFB (R4) EQ #IE.BBE LEAVE SPACE ; RETRY ON DENSITY

    166	000620						    IFB (R4) EQ #IE.EOV	; END OF TAPE

    167	000626							$CALL $RWND  <,#INLUN,,,R4>	; REWIND IT

    168	000636						      ERROR ER.FNF	; AND PRINT MESSAGE

    169	000640						    END

    170	000640						    ERROR ER.IIR	; ELSE REPORT INPUT ERROR

    171	000642						  END

    172	000642						  LET B.STAT(R4) := #0

    173	000646						  $CALL $RDWAT <,#80.,,,R4> ; TRY TO READ HDR1

    174	000656						  ON.ERROR

    175	000660						    IFB (R4) EQ #IE.EOF	; HIT FILE MARK

    176	000666							$CALL $RWND  <,#INLUN,,,R4>	;REWIND IT

    177	000676						      ERROR ER.FNF	; AND PRINT MESSAGE

    178	000700						    END

    179	000700						    IFB (R4) NE #IE.DAO THEN ERROR ER.IIR

    180	000710						  ELSE

    181	000712						    IF R1 EQ #80. AND (R5) EQ #"HD AND 2(R5) EQ #"R1

    182	000736						      LEAVE SCAN	; FOUND A HDR1

    183	000740						    END

    184	000740						  END

    185	000740						  LET B.STAT(R4) := #0	; INVALIDATE BUFFER FOR RETRY

    186	000744						END LOOP

    187	000750						ERROR ER.IFM		; NO HEADER AFTER 3 EOF'S

    188	000752					      END SCAN

    189					;

    190					; WE HAVE READ A HDR1 - SEE IF IT IS THE ONE DESIRED.

    191					;

    192	000752				CKHD1:

    193	000752					      BEGIN CHECK

    194	000752	022525 					CMP (R5)+,(R5)+		; POINT TO FILE LABEL

    195	000754						IF #KY.NIP SET.IN $FLAG1

    196	000764							LET R0 := #$OLAB

    197	000770						ELSE

    198	000772							LET R0 := #$ILAB	; GET USER LABEL STRING

TINI	X0016 - INITIALIZE TAPE	MACRO M1110  21-AUG-78 21:09  PAGE 4-3





    199	000776						END

    200	000776						IFB (R0) EQ #0		; NULL MEANS MATCH ANY

    201	001002						  THRU R1 := #12.

    202	001006						    LET (R0)+ :B= (R5)+	; COPY LABEL FROM THIS FILE

    203	001010						  END LOOP

    204	001014						  LEAVE SEARCH

    205	001016						END

    206	001016						THRU R1 := #12.

    207	001022						  IFB (R0)+ NE (R5)+ LEAVE CHECK ; COMPARE LABELS

    208	001026						END LOOP

    209	001032						LEAVE SEARCH

    210	001034					      END CHECK

    211	001034					      LET B.STAT(R4) := #0	; INVALIDATE HDR1 FOR RETRY

    212	001040					    END LOOP

    213	001042					  END SPACE

    214	001042				ESPACE:	  IF R2 HI #1 THEN ERROR ER.IIR	; TWO TRIES IS ALL YOU GET

    215	001052					  IF #KY.NIP SET.IN $FLAG1

    216

    217	001062						LET $OFLAG := $OFLAG SET.BY #KY.RWD

    218	001070						LET $OVHD+B.STAT := #0

    219	001074					  ELSE

    220	001076						  LET $IFLAG := $IFLAG SET.BY #KY.RWD ; FORCE REWIND

    221	001104						  LET $IVHD+B.STAT := #0	; INVALIDATE VOL HEADER BUFFER

    222	001110					   END

    223	001110					  JUMPTO RETRY			; LOOP UNTIL TAPE DENSITY IS CORRECT

    224	001114					END SEARCH

    225					;

    226					; SET INTERNAL DENSITY FLAG ACCORDING TO PRESENT TAPE CHARACTERISTICS.

    227					;

    228					; CHECK THE FILE SECTION NUMBER TO MAKE SURE THIS IS THE FIRST REEL.

    229					;

    230	001114					LET R5 := R5 + #11.		; POINT TO SECTION NUMBER

    231	001120					IFB (R5)+ NE #'0 ORB (R5)+ NE #'0 ORB (R5)+ NE #'0 ORB (R5)+ NE #'1

    232	001150					  ERROR ER.NFI

    233	001152					END

    234					;

    235	001152	005726 				TST (SP)+			; CLEAN THE STACK

    236	001154					IF #KY.NIP SET.IN $FLAG1

    237	001164						LET R4 := #$OF2HD

    238	001170						LET R0 := #$OFLAG

    239	001174					ELSE

    240	001176						LET R4 := #$IF2HD		; USE NEXT STATUS BLOCK

    241	001202						LET R0 := #$IFLAG

    242	001206					END

    243	001206					LET B.STAT(R4) := #0	;RELEASE THE BUFFER

    244	001212					QIOW$S #IO.SEC,#INLUN,#EFN,,R4	; GET TAPE CHARACTERISTICS

    245	001256					$CALL $INCK <,,,,R4>

    246	001262					IF #CH.160 SET.IN 2(R4)		; NOTE TAPE DENSITY

    247	001272					  LET (R0) := (R0) SET.BY #KY.160 ; AND SAVE

    248	001276					ELSE				; FOR FUTURE USE

    249	001300					  LET (R0) := (R0) OFF.BY #KY.160

    250	001304					END

    251					;

    252					; READ AND CHECK HDR2

    253					;

    254	001304					$CALL $RDWAT <,#80.,,,R4>

    255	001314					ON.ERROR THEN ERROR ER.IIR

TINI	X0016 - INITIALIZE TAPE	MACRO M1110  21-AUG-78 21:09  PAGE 4-4





    256	001320					IF R1 NE #80. OR (R5) NE #"HD OR 2(R5) NE #"R2

    257	001344					  ERROR ER.IFM			; NOT ANSI FORMAT

    258	001346					END

    259					;

    260					; IF WE HAVEN'T READ A VOLUME HEADER LABEL, CONSTRUCT ONE.

    261					; THIS LABEL IS (HOPEFULLY) A REASONABLE FACSIMILE OF THE REAL

    262					; VOLUME HEADER LABEL, AND IS USED FOR LABEL VERIFICATION WHEN

    263					; WE SWITCH REELS.

    264					;

    265	001346					IF #KY.NIP SET.IN $FLAG1

    266	001356						LET R4 := #$OVHD

    267	001362					ELSE

    268	001364						LET R4 := #$IVHD		; POINT TO VOL HEADER BUFFER

    269	001370					END

    270	001370					IF B.STAT(R4) EQ #0

    271	001376					  LET R0 := R4 + #B.SIZ

    272	001404					  LET (R0)+ := #"VO		; PUT IN "VOL1"

    273	001410					  LET (R0)+ := #"L1

    274	001414						IF #KY.NIP SET.IN $FLAG1

    275	001424							LET R1 := #$OF1BF + #21.

    276	001434						ELSE

    277	001436						  LET R1 := #$IF1BF + #21.		; POINT TO FILE SET ID

    278	001446						END

    279	001446					  THRU R2 := #6			; FOR USE AS VOLUME LABEL

    280	001452					    LET (R0)+ :B= (R1)+

    281	001454					  END LOOP

    282	001460					  THRU R1 := #27.

    283	001464					    LET (R0)+ :B= #40		; FILL WITH BLANKS

    284	001470					  END LOOP

    285	001474					  LET R1 := #DECID		; POINT TO STANDARD DEC IDENTIFIER

    286	001500					  THRU R2 := #13.		; AND COPY IT IN. INDICATES

    287	001504					    LET (R0)+ :B= (R1)+		; READ ONLY FOR ALL AND OWNED

    288	001506					  END LOOP			; BY [1,1]

    289	001512					  THRU R1 := #29.

    290	001516					    LET (R0)+ :B= #40		; FILL WITH BLANKS

    291	001522					  END LOOP

    292	001526					  LET (R0)+ :B= #'1		; ANSI LEVEL 1 INDICATOR

    293	001532					  LET B.STAT(R4) := #1		; MARK BUFFER BUSY

    294	001540					END

    295					;

    296					; FINALLY SKIP THE EOF PRECEDING THE FILE DATA

    297					;

    298	001540					LET R4 := #$B1HD1		; USE SPARE STATUS BLOCK

    299	001544					$CALL $SPACF  <,#INLUN,,,#$B1HD,#1>

    300	001564					$CALL $INCK

    301	001570					RETURN

    302

    303

    304

    305		000001 				.END

TINI	X0016 - INITIALIZE TAPE	MACRO M1110  21-AUG-78 21:09  PAGE 4-5

SYMBOL TABLE



A3    = 000001   	E4      000752R  	L21     000356R  	L60     001344R  	$K$   = 000000

B.SIZ = ****** GX	E5      000750R  	L22     000404R  	L61     001346R  	$K$L  = 000002

B.STAT= ****** GX	E6      001034R  	L23     000420R  	L62     001364R  	$K$T  = 000005

B0      000054R  	E7      001014R  	L24     000472R  	L63     001370R  	$L    = 000015

B1      000244R  	IE.BBE= ****** GX	L25     000450R  	L64     001540R  	$L$   = 000000

B10     001022R  	IE.DAO= ****** GX	L26     000460R  	L65     001436R  	$OFLAG= ****** GX

B11     001452R  	IE.EOF= ****** GX	L27     000470R  	L66     001446R  	$OF1BF= ****** GX

B12     001464R  	IE.EOV= ****** GX	L3      000102R  	L7      000204R  	$OF1HD= ****** GX

B13     001504R  	IIII  = 177777   	L30     000516R  	RETRY   000054R  	$OF2HD= ****** GX

B14     001516R  	INLUN = ****** GX	L31     000516R  	SCAN  = 000004   	$OLAB = ****** GX

B2      000424R  	IO.SEC= ****** GX	L32     000552R  	SEARCH= 000000   	$OVHD = ****** GX

B3      000526R  	KY.BSP= ****** GX	L33     000564R  	SPACE = 000001   	$O$   = 000000

B4      000564R  	KY.NIP= ****** GX	L34     000642R  	TYPS0 = 000000   	$R    = 177777

B5      000570R  	KY.RWD= ****** GX	L35     000640R  	TYPS1 = 000006   	$RDWAT= ****** GX

B6      000752R  	KY.VFY= ****** GX	L36     000712R  	TYPS2 = 000005   	$RELNI= ****** GX

B7      001006R  	KY.160= ****** GX	L37     000700R  	TYPS3 = 000003   	$RELNO= ****** GX

CHECK = 000006   	LBLS0 = 000064   	L4      000106R  	TYPS4 = 000006   	$RWND = ****** GX

CH.160= 004000   	LBLS1 = 000014   	L40     000710R  	TYPS5 = 000000   	$SPACB= ****** GX

CKHD1   000752R  	LBLS2 = 000003   	L41     000740R  	TYPS6 = 000000   	$SPACF= ****** GX

DECID   000000R  	LBLS3 = 000006   	L42     000740R  	$B1HD = ****** GX	$STI08= ****** GX

EFN   = ****** GX	LBLS4 = 000010   	L43     000772R  	$B1HD1= ****** GX	$STI16= ****** GX

ER.FNF= ****** GX	LBLS5 = 000046   	L44     000776R  	$DIDDO= 000000   	$SUPMC= 000043

ER.IFM= ****** GX	LBLS6 = 000042   	L45     001016R  	$EF$  = 000000   	$SV$  = 000000

ER.IIR= ****** GX	L0      000036R  	L46     001052R  	$E$   = 000001   	$T    = 000067

ER.NFI= ****** GX	L1      000044R  	L47     001076R  	$FLAG1= ****** GX	$TINI   000016RG

ESPACE  001042R  	L10     000214R  	L5      000124R  	$IFLAG= ****** GX	$T1   = 000000

E0      001114R  	L11     000244R  	L50     001110R  	$IF1BF= ****** GX	$T2   = 000064

E1      001042R  	L12     000526R  	L51     001150R  	$IF1HD= ****** GX	$XXX$ = 000001

E10     001032R  	L13     000262R  	L52     001152R  	$IF2HD= ****** GX	$Y$   = 000000

E11     001460R  	L14     000266R  	L53     001176R  	$IF6HD= ****** GX	$Z$   = 000000

E12     001474R  	L15     000306R  	L54     001206R  	$ILAB = ****** GX	$$S   = 000000

E13     001512R  	L16     000332R  	L55     001300R  	$INCK = ****** GX	$$T   = 000060

E14     001526R  	L17     000334R  	L56     001304R  	$INRDY= ****** GX	$$TT  = 000061

E2      000524R  	L2      000162R  	L57     001320R  	$IVHD = ****** GX	$$$ARG= 000002

E3      001042R  	L20     000352R  	L6      000162R  	$I$   = 000001   	.$T   = 000006



. ABS.	000000	   000

      	001572	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  13040 WORDS  ( 51 PAGES)

DYNAMIC MEMORY:  14388 WORDS  ( 55 PAGES)

ELAPSED TIME:  00:03:45

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

