DWTSU	X0013 - WRITE VOLUME SU	MACRO M1110  21-AUG-78 19:43  PAGE 3





      1	000000					$BEGIN	DWTSU,0013,<WRITE VOLUME SUMMARY TO DISK>

						.TITLE	DWTSU	X0013 - WRITE VOLUME SUMMARY TO DISK

						.IDENT	"X0013"

      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  15-AUG-76  18:30

     25					;GEORGE RITTENBURG  11-MAR-77	001  CONDITIONAL FOR 11D AND IAS INSERTED

     26

     27						.MCALL	GLUN$C,FHDOF$

     28	000000					FHDOF$				; DEFINE FILE HEADER OFFSETS

DWTSU	X0013 - WRITE VOLUME SU	MACRO M1110  21-AUG-78 19:43  PAGE 4





     30					;

     31					; RAD-50 FILE NAMES FOR THE STORAGE MAP AND BAD BLOCK FILES

     32					;

     33	000000	006774 	050570 	000000 	BITNAM:	.RAD50	"BITMAP   SYS"

	000006	075273

     34	000010	006254 	007153 	000000 	BADNAM:	.RAD50	"BADBLK   SYS"

	000016	075273

     35

     36

     37					;+

     38					;

     39					; *** - $DWTSU	WRITE VOLUME SUMMARY TO DISK

     40					;

     41					; THIS ROUTINE ESSENTIALLY PERFORMS AN INITVOL ON THE CURRENT

     42					; OUTPUT DISK. THE BAD BLOCK MAP IS CONSTRUCTED FROM THE BAD BLOCK

     43					; DATA, THE SYSTEM FILES ARE ALLOCATED, AND THE STORAGE MAP IS

     44					; INITIALIZED. THEN THE INDEX FILE, STORAGE MAP, AND BAD BLOCK

     45					; FILE HEADERS ARE RECONSTRUCTED AND WRITTEN TO THE DISK.

     46					;

     47					; INPUTS:

     48					;

     49					;	OUTLUN ASSIGNED TO DISK

     50					;	VOLUME SUMMARY BLOCK IN $BUF2

     51					;	$OUDEV POINTING AT DEVICE TABLE ENTRY

     52					;

     53					; OUTPUTS:

     54					;

     55					;	DISK INITIALIZED

     56					;	REST OF DEVICE TABLE ENTRY FILLED IN

     57					;	INDEX FILE HEADER IN $OXBF AND $OHBF

     58					;	ALL REGISTERS CLOBBERED

     59					;

     60					;-

     61

     62	000020				$DWTSU::

     63	000020					$CALL $BUFCK <,,,,#$B1HD>	; USE BUF1 AS SCRATCH AREA

     64	000030					THRU R1 := #<2048.+B.SIZ+P.SIZ>/2

     65	000034					  LET (R4)+ := #0		; INIT IT TO ZERO

     66	000036					END LOOP

     67

     68	000042					GLUN$C OUTLUN,$LUNBF		; GET DEVICE CHARACTERISTICS

     69	000050					$CALL	$CMEFX			; REARRANGE GEOMETRY INFO.

     70	000054					LET $VOLSZ := $CW3		; SAVE VOLUME SIZE

     71	000062					LET $VOLSZ+2 := $CW2

     72	000070					$CALL $DSCBD			; DO BAD BLOCK PROCESSING

     73	000074					LET R0 := $OUDEV		; POINT TO DEVICE TABLE ENTRY

     74										; SEE IF DISK HAS ENOUGH SPACE

     75	000100					DCOMP V.FRBK+2(R0),V.FRBK(R0), $B2DAT+S.USE+2,$B2DAT+S.USE

     76	000116					IF RESULT IS LO THEN ERROR ER.DEX

     77

     78	000122					$CALL $DSCAL			; ALLOCATE SYSTEM FILES

     79	000126					LET R0 := $OUDEV + #V.RVN	; DEVICE TABLE ENTRY AGAIN

     80	000136					LET (R0)+ := $B2DAT+S.RVN	; SET RVN OF THIS DISK

     81	000142					LET (R0)+ := $B2DAT+S.HFNU	; HIGHEST FILE NUMBER USED

     82	000146	166720 	000000C			SUB $B2DAT+S.USE,(R0)+		; COMPUTE SPACE THAT WILL BE LEFT

     83	000152	005610 				SBC (R0)

     84	000154	166720 	000000C			SUB $B2DAT+S.USE+2,(R0)+

DWTSU	X0013 - WRITE VOLUME SU	MACRO M1110  21-AUG-78 19:43  PAGE 4-1





     85	000160					LET (R0)+ := #1			; FIRST FREE LBN SET TO 1

     86	000164					LET (R0)+ := $B2DAT+S.IBSZ	; INDEX FILE BITMAP SIZE

     87	000170					LET (R0)+ := $INDXF+4		; INDEX FILE BITMAP LBN

     88	000174					LET (R0)+ := $INDXF+6

     89	000200					LET (R0) := $SBM		; STORAGE MAP SIZE,

     90	000204	005320 				DEC (R0)+			; EXCLUDING SCB

     91	000206					LET (R0)+ := $SBM+4		; AND LBN

     92	000212					LET (R0)+ := $SBM+6

     93	000216					LET (R0)+ := $B2DAT+S.CLF	; STORAGE MAP CLUSTER FACTOR

     94

     95	000222					$CALL $DSCBT			; INIT STORAGE BITMAP

     96

     97					;

     98					; NOW CONSTRUCT THE INDEX FILE HEADER FROM THE ONE READ IN WITH

     99					; THE VOLUME SUMMARY BLOCK.

    100					;

    101	000226					$CALL $BUFCK <,,,,#$OXHD>	; GET INDEX FILE HEADER BUFFER

    102	000236					LET B.STAT(R4) := #1		; MARK IT BUSY

    103	000244					LET R5 := #$OXBF		; POINT TO INDEX FILE HEADER BUFFER

    104	000250					LET R1 := R5

    105	000252					LET R2 := #$B2DAT+512.		; POINT TO INDEX FILE HEADER IMAGE

    106	000256					THRU R0 := #256.

    107	000262					  LET (R1)+ := (R2)+		; COPY INDEX FILE HEADER IMAGE

    108	000264					END LOOP

    109	000270					$CALL $ZMAP <,,,,,R5>		; CLEAN OUT THE MAP AREA

    110	000274					LET R4 := #$BOOTB		; POINT TO START OF ALLOCATION TABLE

    111	000300					$CALL ALCRP			; BUILD MAP FOR BOOT BLOCK

    112	000304					$CALL ALCRP			; AND HOME BLOCK

    113	000310					$CALL ALCRP			; AND REST OF INDEX FILE

    114	000314					$CALL $WRHDR <,,,,#$OXHD>	; WRITE INDEX FILE HEADER

    115					;

    116					; CONSTRUCT AND WRITE THE STORAGE BITMAP FILE HEADER

    117					;

    118	000324					$CALL $BUFCK <,,,,#$OHHD>	; GET HEADER BUFFER

    119	000334					LET R5 := #$OHBF		; POINT TO HEADER BUFFER

    120	000340					LET R1 := R5

    121	000342					LET R2 := #$OXBF		; AND INDEX FILE HEADER

    122	000346					THRU R0 := #256.

    123	000352					  LET (R1)+ := (R2)+		; COPY THE HEADER

    124	000354					END LOOP

    125	000360					LET H.FNUM(R5) := #2		; STORAGE MAP IS FILE #2

    126	000366					LET H.FSEQ(R5) := #2

    127	000374					LET R0 := #0

    128	000376					LET R0 :B= R0 SET.BY H.IDOF(R5)	; FIND THE IDENT AREA

    129	000402					LET R0 := R0 L.SHIFT 1 + #$OHBF+I.FNAM

    130	000410					LET R1 := #BITNAM

    131	000414					THRU R2 := #4

    132	000420					  LET (R0)+ := (R1)+		; COPY IN FILE NAME OF BITMAP

    133	000422					END LOOP

    134	000426					$CALL $ZMAP <,,,,,R5>		; CLEAN OUT MAP AREA

    135	000432					LET R4 := #$SBM+8.		; GET STORAGE MAP ALLOCATION

    136	000436					LET R2 := -(R4)			; LBN

    137	000440					LET R3 := -(R4)

    138	000442					LET R0 := #0

    139	000444					LET R1 := #1			; STORAGE CONTROL BLOCK IS SEPARATE

    140	000450					$CALL $BLDRP <R0,R1,R2,R3,,R5>	; DUE TO SOME OLD FILE SYSTEMS

    141	000454					LET R0 := -(R4)			; GET COUNT OF REST

DWTSU	X0013 - WRITE VOLUME SU	MACRO M1110  21-AUG-78 19:43  PAGE 4-2





    142	000456					LET R1 := -(R4) - #01

    143	000464					LET R0 := R0 - CARRY		; LBN IS SET UP BY PREVIOUS CALL

    144	000466					$CALL $BLDRP <R0,R1,R2,R3,,R5>

    145	000472					$CALL $WRHDR <,,,,#$OHHD>	; WRITE THE HEADER

    146					;

    147					; NOW CONSTRUCT AND WRITE THE BAD BLOCK FILE HEADER

    148					;

    149	000502					$CALL $BUFCK <,,,,#$OHHD>	; GET HEADER BUFFER

    150	000512					LET H.FNUM(R5) := #3		; BAD BLOCK FILE IS NUMBER 3

    151	000520					LET H.FSEQ(R5) := #3

    152	000526					LET R0 := #0

    153	000530					LET R0 :B= R0 SET.BY H.IDOF(R5)	; FIND THE IDENT AREA

    154	000534					LET R0 := R0 L.SHIFT 1 + #$OHBF+I.FNAM

    155	000542					LET R1 := #BADNAM

    156	000546					THRU R2 := #4

    157	000552					  LET (R0)+ := (R1)+		; COPY IN FILE NAME OF BITMAP

    158	000554					END LOOP

    159	000560					$CALL $ZMAP <,,,,,R5>		; CLEAN OUT MAP AREA

    160	000564					LET R4 := #$BADBK		; POINT TO START OF BAD BLOCK DATA

    161	000570					WHILE R4 LO $BADP		; LOOP FOR ALL BAD EXTENTS

    162	000576					  $CALL ALCRP			; CREATE RETRIEVAL POINTER FOR EACH

    163	000602					END LOOP

    164	000604					$CALL $WRHDR <,,,,#$OHHD>	; AND WRITE THE HEADER

    165

    166	000614					$CALL $BUFCK <,,,,#$OHHD>	; GET HEADER BUFFER

    167	000624					LET B.STAT(R4) := #1		; MARK IT BUSY

    168	000632					LET R0 := #$OHBF

    169	000636					LET R1 := #$OXBF

    170	000642					THRU R2 := #256.

    171	000646					  LET (R0)+ := (R1)+		; COPY INDEX FILE HEADER INTO

    172	000650					END LOOP			; HEADER BUFFER

    173	000654					LET (R0)+ := #0			; INIT BASE VBN

    174	000656					LET (R0)+ := #0

    175	000660					LET $B1HD+B.STAT := #0		; RELEASE THE I/O BUFFERS

    176	000664					LET $B2HD+B.STAT := #0

    177	000670					RETURN

DWTSU	X0013 - WRITE VOLUME SU	MACRO M1110  21-AUG-78 19:43  PAGE 5





    179					;+

    180					;

    181					; SUBROUTINE TO CALL THE RETRIEVAL POINTER BUILDER WITH AN ALLOCATION

    182					; TABLE ENTRY AS INPUT. R4 POINTS TO THE TABLE ENTRY, ON RETURN IT IS

    183					; BUMPED TO THE NEXT.

    184					;

    185					;-

    186

    187	000672				ALCRP:	LET R1 := (R4)+		; GET BLOCK COUNT

    188	000674					LET R0 := (R4)+

    189	000676					LET R3 := (R4)+		; AND LBN

    190	000700					LET R2 := (R4)+

    191	000702					$CALL $BLDRP <R0,R1,R2,R3,,R5>	; CONSTRUCT RETRIEVAL POINTERS

    192	000706					RETURN

    193

    194

    195

    196		000001 				.END

DWTSU	X0013 - WRITE VOLUME SU	MACRO M1110  21-AUG-78 19:43  PAGE 5-1

SYMBOL TABLE



ALCRP   000672R  	G.LUCW= 000004   	I.RVDT= 000014   	S.RVN = ****** GX	$I$   = 000001

A3    = 000002   	G.LUFB= 000003   	I.RVNO= 000012   	S.USE = ****** GX	$L    = 000007

BADNAM  000010R  	G.LULU= 000002   	I.RVTI= 000023   	TYPS0 = 000006   	$LUNBF= ****** GX

BITNAM  000000R  	G.LUNA= 000000   	I.TISZ= 000006   	TYPS1 = 000001   	$L$   = 000000

B.SIZ = ****** GX	G.LUNU= 000002   	LBLS0 = 000006   	UC.CON= 000200   	$OHBF = ****** GX

B.STAT= ****** GX	H.CKSM= 000776   	LBLS1 = 000005   	UC.DLK= 000100   	$OHHD = ****** GX

B0      000034R  	H.FCHA= 000014   	L0      000122R  	V.FRBK= ****** GX	$OUDEV= ****** GX

B1      000262R  	H.FLEV= 000006   	L1      000604R  	V.RVN = ****** GX	$OXBF = ****** GX

B2      000352R  	H.FNUM= 000002   	M.CTSZ= 000006   	$BADBK= ****** GX	$OXHD = ****** GX

B3      000420R  	H.FOWN= 000010   	M.EFNU= 000002   	$BADP = ****** GX	$O$   = 000000

B4      000552R  	H.FPRO= 000012   	M.EFSQ= 000004   	$BLDRP= ****** GX	$R    = 177777

B5      000570R  	H.FSEQ= 000004   	M.ERVN= 000001   	$BOOTB= ****** GX	$SBM  = ****** GX

B6      000646R  	H.IDOF= 000000   	M.ESQN= 000000   	$BUFCK= ****** GX	$SUPMC= 000043

ER.DEX= ****** GX	H.MPOF= 000001   	M.LBSZ= 000007   	$B1HD = ****** GX	$T    = 000002

E0      000042R  	H.PROG= 000010   	M.MAX = 000011   	$B2DAT= ****** GX	$T1   = 000006

E1      000270R  	H.PROJ= 000011   	M.RTRV= 000012   	$B2HD = ****** GX	$T2   = 000006

E2      000360R  	H.SCHA= 000015   	M.USE = 000010   	$CMEFX= ****** GX	$VOLSZ= ****** GX

E3      000426R  	H.UCHA= 000014   	OUTLUN= ****** GX	$CW2  = ****** GX	$WRHDR= ****** GX

E4      000560R  	H.UFAT= 000016   	P.SIZ = ****** GX	$CW3  = ****** GX	$Y$   = 000000

E5      000604R  	IIII  = 177777   	SC.BAD= 000100   	$DIDDO= 000000   	$ZMAP = ****** GX

E6      000654R  	I.CRDT= 000031   	SC.MDL= 000200   	$DSCAL= ****** GX	$Z$   = 000000

FP.DEL= 000010   	I.CRTI= 000040   	S.CLF = ****** GX	$DSCBD= ****** GX	$$T   = 000001

FP.EXT= 000004   	I.DASZ= 000007   	S.HDHD= 000056   	$DSCBT= ****** GX	$$$   = 000000R     002

FP.RAT= 000001   	I.EXDT= 000046   	S.HFNU= ****** GX	$DWTSU  000020RG 	$$$OST= 000014

FP.RDV= 000001   	I.FNAM= 000000   	S.IBSZ= ****** GX	$EF$  = 000000   	.$T   = 000006

FP.WRV= 000002   	I.FTYP= 000006   	S.IDHD= 000056   	$E$   = 000001   	...GBL= 000000

G.LUBA= 000004   	I.FVER= 000010   	S.MPHD= 000012   	$INDXF= ****** GX	...TPC= 000012

G.LUBL= 000006



. ABS.	000000	   000

      	000710	   001

$DPB$$	000006	   002

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  12374 WORDS  ( 49 PAGES)

DYNAMIC MEMORY:  13332 WORDS  ( 51 PAGES)

ELAPSED TIME:  00:04:02

EXE$:DWTSU.OB1,LIS$:DWTSU.LS1/-SP=SRC$:SMAC/PA:1,DSCPRE,DWTSU.OD1

