DRDID	X0013 - READ INDEX FILE	MACRO M1110  21-AUG-78 20:12  PAGE 3





      1	000000					$BEGIN	DRDID,0013,<READ INDEX FILE DATA>

						.TITLE	DRDID	X0013 - READ INDEX FILE DATA

						.IDENT	"X0013"

      2

      3					;

      4					; COPYRIGHT (C) 1977 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  11-AUG-78  17:36

     25

     26

     27						.MCALL	FHDL2$

     28	000000					FHDL2$				; DEFINE FILE HEADER FORMAT

DRDID	X0013 - READ INDEX FILE	MACRO M1110  21-AUG-78 20:12  PAGE 4





     30					;+

     31					;

     32					; *** - $DRDID	READ INDEX FILE DATA FROM DISK

     33					;

     34					; THIS ROUTINE READS THE DATA FROM THE INDEX FILE THAT NEEDS TO BE

     35					; SAVED AND RESTORED. THIS INCLUDES THE BOOT BLOCK, THE HOME BLOCK,

     36					; AND THE FILE SEQUENCE NUMBERS OF ALL UNUSED HEADERS. THE FIRST

     37					; CALL (I.E., WITH "BLOCK NUMBER" 0) RETURNS THE FORMER DATA.

     38					; SUBSEQUENT CALLS WITH HIGHER BLOCK NUMBERS PACK FILE NUMBERS AND

     39					; FILE SEQUENCE NUMBERS INTO THE OUTPUT BUFFER.

     40					;

     41					; INPUTS:

     42					;

     43					;	R2,R3 = "BLOCK NUMBER"

     44					;

     45					; OUTPUTS:

     46					;

     47					;	CC - C	CLEAR IF NO ERRORS

     48					;		SET IF NO MORE DATA

     49					;	R2,R3 = UPDATED "BLOCK NUMBER"

     50					;	R4 = $BUF2 CONTROL BLOCK

     51					;	DATA IN $BUF2

     52					;	OTHER REGISTERS CLOBBERED

     53					;

     54					;-

     55

     56	000000				$DRDID::

     57	000000					IF R2 EQ #0 AND R3 EQ #0	; IF FIRST CALL

     58						  				; READ BOOT AND HOME BLOCKS

     59	000010					  $CALL $RDW1B <,,$HOMLB+2,$HOMLB,#$B2HD> ; READ THE HOME BLOCK PREVIOUSLY FOUND

     60	000030					  ON.ERROR THEN ERROR ER.RHO

     61	000034					  LET B.STAT(R4) := #0		; FREE BUFFER FOR READ BELOW

     62	000040					  LET R3 := #$B2DAT+512.	; POINT TO 2ND DATA BLOCK OF BUFFER

     63	000044					  THRU R2 := #256.		; AND COPY HOME BLOCK DOWN

     64	000050					    LET (R3)+ := (R5)+

     65	000052					  END LOOP

     66

     67	000056					  LET $VBN := #1		; SET TO VBN 1

     68	000064					  LET $VBN+2 := #0

     69	000070					  $CALL $DRDDA <,#1,,,#$B2HD>

     70	000104					  $CALL $WAITI <,,,,R4>		; AND WAIT FOR COMPLETION

     71	000110					  ON.ERROR THEN ERROR ER.RHO

     72	000114					  LET B.SIZ+P.CNT(R4) := #1024.	; INDICATE 2 BLOCKS OF DATA IN BUFFER

     73	000122					  LET B.SIZ+P.FID(R4) := #1	; FILE ID OF INDEX FILE

     74	000130					  LET B.SIZ+P.FID+2(R4) := #1

     75	000136					  LET B.SIZ+P.FID+4(R4) := $RVN

     76	000144					  PUSH R4

     77	000146					  $CALL $BUFCK <,,,,#$B1HD>	; READY $BUF1 FOR FUTURE USE

     78	000156					  LET $BUF1 := #0		; INIT RESIDENT LBN

     79	000162					  LET $BUF1+2 := #0

     80	000166					  POP R4

     81	000170					  LET R2 := #0

     82	000172					  LET R3 := #1			; RETURN 1 FOR NEXT CALL

     83	000176					  RETURN

     84	000200					END

DRDID	X0013 - READ INDEX FILE	MACRO M1110  21-AUG-78 20:12  PAGE 5





     86					;

     87					; IF R2 AND R3 ARE NON-ZERO, THEN THEY ARE THE NEXT FILE NUMBER TO

     88					; CHECK FOR FILE SEQUENCE NUMBER RECORDING. CONTINUE SCANNING THE

     89					; INDEX FILE BITMAP FOR IDLE FILE HEADERS.

     90					;

     91	000200					BEGIN MAKBUF

     92	000200					  $CALL $BUFCK <,,,,#$B2HD>	; OBTAIN BUFFER #2

     93	000210					  LET B.STAT(R4) := #1		; MARK BUSY

     94	000216					  LET $BUF2 := #$B2DAT		; INIT POINTER

     95	000224					  BEGIN SCANIX

     96	000224				NBLK:	    				; LOOP FOR BITMAP BLOCKS

     97	000224					    PUSH R2,R3			; SAVE FILE NUMBER

     98	000230					    LET R1 := R2

     99	000232					    LET R2 := R3 - #01		; DOWN 1 TO START AT 0

    100	000240					    LET R1 := R1 - CARRY

    101	000242					    $CALL $DDIV <#4096.,R1,R2>	; COMPUTE BLOCK OFFSET

    102	000252					    PUSH R0			; SAVE REMAINDER

    103	000254					    LET R5 := $INDEV		; GET DEVICE TABLE ADDRESS

    104	000260					    IF R2 HIS V.IBSZ(R5)

    105	000266					      LET SP := SP + #6		; CLEAN THE STACK

    106	000272					      LEAVE SCANIX		; OFF END OF BITMAP

    107	000274					    END

    108	000274					    LET R3 := R2 + V.IBLB(R5)	; COMPUTE LBN

    109	000302					    LET R2 := V.IBLB+2(R5) + CARRY

    110	000310					    $CALL $RDWTA <,#512.,R2,R3,#$B1HD,#$B1DAT> ; READ BLOCK

    111	000330					    ON.ERROR THEN ERROR ER.IXB

    112

    113	000334					    POP R0			; GET BIT NUMBER IN BLOCK

    114	000336					    $CALL $DIV <R0,#16.>	; SPLIT INTO WORD AND BIT

    115	000346					    LET R0 := R0 L.SHIFT 1 + R5	; WORD ADDRESS

    116	000352					    LET R1 := R1 + #1

    117	000354					    LET R4 := #0

    118	000356	000261 				    SEC

    119	000360					    THRU R1			; FIND STARTING BIT

    120	000360					      LET R4 := R4 L.ROTATE 1

    121	000362					    END LOOP

    122	000366					    POP R3,R2			; GET BACK FILE NUMBER

DRDID	X0013 - READ INDEX FILE	MACRO M1110  21-AUG-78 20:12  PAGE 6





    124	000372					    REPEAT

    125	000372					      REPEAT

    126	000372						IF R4 OFF.IN (R0)	; IF HEADER IS IDLE

    127	000376						  PUSH R0,R4,R2,R3	; SAVE FILE NUMBER AND MASK

    128	000406						  LET R5 := $INDEV

    129	000412						  LET R3 := R3 + V.IBSZ(R5) ; COMPUTE HEADER VBN

    130	000416						  LET R2 := R2 + CARRY

    131					;

    132					; ACCOUNT FOR THE BOOT BLOCK, HOME BLOCK, BACKUP HOME BLOCK AND

    133					; THE BACKUP COPY OF THE INDEX FILE HEADER.

    134					;

    135					; EACH OCCUPIES ONE CLUSTER OF VBNS AND LBNS. (CLUSTER FACTOR*4)+1

    136					;

    137	000420	016546 	000000G				  MOV  V.CLF(R5),-(SP)	; CLUSTER FACTOR TO TEMP.

    138	000424	006316 					  ASL  (SP)		; MULT BY

    139	000426	006316 					  ASL  (SP)		;         FOUR.

    140	000430	062603 					  ADD  (SP)+,R3

    141	000432	005502 					  ADC  R2

    142	000434						  $CALL $MPVBN <,,R2,R3,,#$IXBF>

    143	000444						  ON.ERROR

    144	000446						    LET SP := SP + #8.	; CLEAN STACK

    145	000452						    LEAVE SCANIX	; HEADER OFF END OF FILE

    146	000454						  END

    147	000454						  $CALL $RDWTA <,#512.,R2,R3,#$B1HD1,#$B1DAT+512.>

    148	000474						  BEGIN CHECK

    149	000474						    ON.NOERROR

    150	000476						      IF (R5) EQ #27027 AND H.FNUM(R5) EQ #0 AND H.CKSM(R5) EQ #0

    151	000520							IF H.FLEV(R5) EQ #1001 ; STRUCT LVL 2 VERSION 1.

    152	000530							  LET R0 := H.FSEQ(R5) ; GET SEQ FOR REAL HEADERS

    153	000534							  LEAVE CHECK

    154	000536							END

    155	000536						      END

    156	000536						    END

    157	000536						    LET R0 := #0	; OTHERWISE USE 0

    158	000540						  END CHECK

    159	000540						  LET B.STAT(R4) := #0	; INVALIDATE BUFFER

    160	000544						  POP R3,R2		; GET BACK FILE NUMBER

    161	000550						  LET R5 := $BUF2	; INSERTED 5-10-77

    162	000554						  LET (R5)+ := R3	; STORE FILE NUMBER

    163	000556						  LET (R5)+ := R2

    164	000560						  LET (R5)+ := R0	; AND FILE SEQ NUMBER

    165	000562						  LET $BUF2 := R5

    166	000566						  POP R4,R0		; RECOVER ADDRESS AND MASK

    167	000572						  IF R5 HI #$B2DAT+2048.-6 LEAVE MAKBUF	; OUT IF FULL

    168	000600						END

    169	000600						LET R3 := R3 + #01	; BUMP FILE NUMBER

    170	000604						LET R2 := R2 + CARRY

    171	000606						LET R4 := R4 L.ROTATE 1	; ADVANCE TO NEXT BIT

    172	000610					      UNTIL RESULT IS CS	; LOOP ON BITS IN WORD

    173	000612	005720 				      TST (R0)+			; NEXT WORD

    174	000614					      LET R4 := #1

    175	000620					    UNTIL R0 HIS #$B1DAT+512.	;UNTIL END OF BUFFER

    176	000626					    LET $B1HD+B.STAT := #0	; INVALIDATE BITMAP

    177	000632					    JUMPTO NBLK			; LOOP FOR BITMAP BLOCKS

    178	000636					  END SCANIX

DRDID	X0013 - READ INDEX FILE	MACRO M1110  21-AUG-78 20:12  PAGE 7





    180					;

    181					; TO HERE AT END OF INDEX FILE BITMAP

    182					;

    183	000636					  LET R3 := #177777		; RETURN HIGHEST NUMBER  ; *5-10-77

    184	000642					  LET R2 := #377		; TO FORCE ERROR ON NEXT CALL

    185	000646					  LET $B1HD+B.STAT := #0	; INVALIDATE BITMAP BUFFER

    186	000652					  IF $BUF2 EQ #$B2DAT		; IF NO DATA RETURNED

    187	000662					    LET $B2HD+B.STAT := #0	;INVALIDATE DATA BUFFER

    188	000666					    RETURN ERROR

    189	000672					  END

    190	000672					END MAKBUF

    191

    192	000672					LET $B1HD+B.STAT := #0		; INVALIDATE BITMAP BUFFER

    193	000676					LET R5 := $BUF2			; GET BUFFER POINTER

    194	000702					WHILE R5 LO #$B2DAT+2048.

    195	000710					  LET (R5)+ := #0		; ZERO REST OF BUFFER

    196	000712					END LOOP

    197	000714					LET R0 := #$BUF2		; INIT BLOCK PREAMBLE

    198	000720					LET (R0)+ := #2048.		; BYTE COUNT

    199	000724					LET (R0)+ := #PF.DAT		; FLAG WORD

    200	000730					LET (R0)+ := R3			; VBN

    201	000732					LET (R0)+ := R2

    202	000734					LET (R0)+ := #1			; FILE ID

    203	000740					LET (R0)+ := #1

    204	000744					LET (R0)+ := $RVN

    205	000750					LET (R0)+ := #0			; SPARE

    206	000752					LET R4 := #$B2HD		; RETURN BUFFER DESCRIPTOR

    207	000756					RETURN

    208

    209

    210

    211		000001 				.END

DRDID	X0013 - READ INDEX FILE	MACRO M1110  21-AUG-78 20:12  PAGE 7-1

SYMBOL TABLE



A3    = 000001   	H.ERVN= 000022   	LBLS0 = 000015   	S.HDHD= 000114   	$EF$  = 000000

B.SIZ = ****** GX	H.FCHA= 000064   	LBLS1 = 000007   	S.IDHD= 000202   	$E$   = 000001

B.STAT= ****** GX	H.FLEV= 000006   	LBLS10= 000011   	S.MPHD= 000000   	$HOMLB= ****** GX

B0      000050R  	H.FNUM= 000010   	LBLS2 = 000013   	TYPS0 = 000000   	$INDEV= ****** GX

B1      000200R  	H.FOWN= 000074   	LBLS3 = 000012   	TYPS1 = 000001   	$IXBF = ****** GX

B2      000224R  	H.FPRO= 000100   	LBLS4 = 000005   	TYPS10= 000000   	$I$   = 000001

B3      000360R  	H.FRVN= 000014   	LBLS5 = 000012   	TYPS2 = 000000   	$K$   = 000001

B4      000372R  	H.FSEG= 000004   	LBLS6 = 000007   	TYPS3 = 000000   	$L    = 000010

B5      000372R  	H.FSEQ= 000012   	LBLS7 = 000010   	TYPS4 = 000000   	$L$   = 000000

B6      000474R  	H.IDOF= 000000   	L0      000200R  	TYPS5 = 000000   	$MPVBN= ****** GX

B7      000702R  	H.MPOF= 000001   	L1      000034R  	TYPS6 = 000000   	$O$   = 000000

CHECK = 000006   	H.PRIV= 000073   	L10     000536R  	TYPS7 = 000000   	$R    = 177777

ER.IXB= ****** GX	H.PROG= 000074   	L11     000536R  	UC.CON= 000200   	$RDWTA= ****** GX

ER.RHO= ****** GX	H.PROJ= 000076   	L14     000672R  	UC.DLK= 000100   	$RDW1B= ****** GX

E0      000056R  	H.RPRO= 000102   	L15     000714R  	V.CLF = ****** GX	$RVN  = ****** GX

E1      000672R  	H.RSOF= 000003   	L2      000114R  	V.IBLB= ****** GX	$SUPMC= 000043

E2      000636R  	H.SCHA= 000065   	L3      000274R  	V.IBSZ= ****** GX	$T    = 000016

E3      000366R  	H.SEMK= 000104   	L4      000334R  	$BUFCK= ****** GX	$T1   = 000001

E4      000626R  	H.SMMX= 000110   	L5      000600R  	$BUF1 = ****** GX	$T2   = 000007

E5      000612R  	H.UCHA= 000064   	L6      000454R  	$BUF2 = ****** GX	$VBN  = ****** GX

E6      000540R  	H.UFAT= 000024   	L7      000536R  	$B1DAT= ****** GX	$WAITI= ****** GX

E7      000714R  	H.USE = 000072   	MAKBUF= 000001   	$B1HD = ****** GX	$Y$   = 000000

FP.DEL= 000010   	IIII  = 177777   	NBLK    000224R  	$B1HD1= ****** GX	$Z$   = 000000

FP.EXE= 000004   	I.BKDT= 000052   	PF.DAT= ****** GX	$B2DAT= ****** GX	$$S   = 000000

FP.RDV= 000001   	I.CRDT= 000022   	P.CNT = ****** GX	$B2HD = ****** GX	$$T   = 000015

FP.WRV= 000002   	I.EXDT= 000042   	P.FID = ****** GX	$DDIV = ****** GX	$$TT  = 000012

H.ACOF= 000002   	I.FNAM= 000000   	SCANIX= 000002   	$DIDDO= 000000   	.$T   = 000006

H.CKSM= 000776   	I.RVDT= 000032   	SC.BAD= 000100   	$DIV  = ****** GX	...GBL= 000000

H.EFNU= 000016   	I.RVNO= 000020   	SC.DIR= 000040   	$DRDDA= ****** GX	...TPC= 000000

H.EFSQ= 000020   	I.ULAB= 000062   	SC.MDL= 000200   	$DRDID  000000RG



. ABS.	000000	   000

      	000760	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  13136 WORDS  ( 52 PAGES)

DYNAMIC MEMORY:  14388 WORDS  ( 55 PAGES)

ELAPSED TIME:  00:02:35

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

