WRHDR	X0004 - WRITE FILE HEAD	MACRO M1110  21-AUG-78 21:23  PAGE 4





      2	000000					$BEGIN	WRHDR,0004,<WRITE FILE HEADER>

						.TITLE	WRHDR	X0004 - WRITE FILE HEADER

						.IDENT	"X0004"

      3

      4					;

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

      6					; MAYNARD, MASSACHUSETTS

      7					;

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

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

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

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

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

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

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

     15					; IN DIGITAL.

     16					;

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

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

     19					; DIGITAL EQUIPMENT CORPORATION.

     20					;

     21					; DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY  FOR

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

     23					; NOT SUPPLIED BY DIGITAL.

     24					;

     25					; ANDREW C. GOLDSTEIN  16-AUG-76  3:31

     26

     27						.MCALL	FHDL2$

     28	000000					FHDL2$				; DEFINE FILE HEADER OFFSETS

WRHDR	X0004 - WRITE FILE HEAD	MACRO M1110  21-AUG-78 21:23  PAGE 5





     30					;+

     31					;

     32					; *** - $WRHDR	WRITE FILE HEADER

     33					;

     34					; THIS ROUTINE WRITES THE INDICATED FILE HEADER TO THE OUTPUT DISK.

     35					;

     36					; INPUTS:

     37					;

     38					;	R4 = BUFFER CONTROL BLOCK ADDRESS OF HEADER

     39					;	OUTLUN ASSIGNED TO OUTPUT DEVICE

     40					;

     41					; OUTPUTS:

     42					;

     43					;	HEADER WRITE IN PROGRESS

     44					;	R4 PRESERVED, OTHER REGISTERS CLOBBERED

     45					;

     46					;

     47					; *** - $WRHDA	WRITE HEADER AT ALTERNATE ADDRESS

     48					;

     49					; AS ABOVE, BUT INPUTS:

     50					;

     51					;	R5 = HEADER ADDRESS

     52					;

     53					;

     54					; *** - $WRHD1	WRITE DELETED FILE HEADER

     55					;

     56					; THIS ENTRY WRITES A DELETED FILE HEADER TO THE INDEX FILE.

     57					;

     58					; INPUTS:

     59					;

     60					;	R3 = FILE NUMBER

     61					;	R4 = BCB ADDRESS

     62					;	R5 = HEADER ADDRESS

     63					;

     64					; OUTPUTS:

     65					;

     66					;	AS ABOVE

     67					;

     68					;-

     69

     70	000000				$WRHDR::

     71	000000					LET R5 := R4 + #B.SIZ		; GET BUFFER ADDRESS

     72

     73	000006				$WRHDA::

     74	000006					$CALL $CKSUM <,,,,,R5>		; COMPUTE HEADER CHECKSUM

     75	000012					LET R3 := H.FNUM(R5)		; GET FILE NUMBER

     76

     77	000016				$WRHD1::

     78	000016					LET R0 := $OUDEV		; GET OUTPUT DEVICE TABLE ENTRY

     79	000022					LET $FNU := R3			; SAVE FOR ERROR MESSAGES

     80	000026					LET R3 := R3 + V.IBSZ(R0)	; COMPUTE INDEX FILE VBN

     81	000032					LET R2 := #0 + CARRY

     82					;

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

     84					; THE BACKUP COPY OF THE INDEX FILE HEADER.

     85					;

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

WRHDR	X0004 - WRITE FILE HEAD	MACRO M1110  21-AUG-78 21:23  PAGE 5-1





     87					;

     88	000036	016046 	000000G			MOV  V.CLF(R0),-(SP)		; CLUSTER FACTOR TO TEMP.

     89	000042	006316 				ASL  (SP)			; MULT BY

     90	000044	006316 				ASL  (SP)			;         FOUR.

     91	000046	062603 				ADD  (SP)+,R3

     92	000050	005502 				ADC  R2

     93	000052					PUSH R5				; SAVE ADDRESS

     94	000054					$CALL $MPVBN <,,R2,R3,,#$OXBF>	; MAP TO LBN

     95	000064					ON.ERROR THEN ERROR ER.OFN	; NOT MAPPED

     96	000070					POP R5

     97	000072					$CALL $WRITA <,#512.,R2,R3,R4,R5> ; WRITE IT

     98	000102					$CALL $WAITO <,,,,R4>		; WAIT FOR COMPLETION

     99	000106					ON.ERROR THEN ERROR ER.WHD

    100	000112					RETURN

    101

    102

    103

    104		000001 				.END

WRHDR	X0004 - WRITE FILE HEAD	MACRO M1110  21-AUG-78 21:23  PAGE 5-2

SYMBOL TABLE



B.SIZ = ****** GX	H.FRVN= 000014   	IIII  = 177777   	S.MPHD= 000000   	$OXBF = ****** GX

ER.OFN= ****** GX	H.FSEG= 000004   	I.BKDT= 000052   	TYPS0 = 000000   	$O$   = 000000

ER.WHD= ****** GX	H.FSEQ= 000012   	I.CRDT= 000022   	UC.CON= 000200   	$R    = 177777

FP.DEL= 000010   	H.IDOF= 000000   	I.EXDT= 000042   	UC.DLK= 000100   	$SUPMC= 000043

FP.EXE= 000004   	H.MPOF= 000001   	I.FNAM= 000000   	V.CLF = ****** GX	$T    = 000002

FP.RDV= 000001   	H.PRIV= 000073   	I.RVDT= 000032   	V.IBSZ= ****** GX	$WAITO= ****** GX

FP.WRV= 000002   	H.PROG= 000074   	I.RVNO= 000020   	$CKSUM= ****** GX	$WRHDA  000006RG

H.ACOF= 000002   	H.PROJ= 000076   	I.ULAB= 000062   	$DIDDO= 000000   	$WRHDR  000000RG

H.CKSM= 000776   	H.RPRO= 000102   	LBLS0 = 000001   	$EF$  = 000000   	$WRHD1  000016RG

H.EFNU= 000016   	H.RSOF= 000003   	L0      000070R  	$E$   = 000001   	$WRITA= ****** GX

H.EFSQ= 000020   	H.SCHA= 000065   	L1      000112R  	$FNU  = ****** GX	$Y$   = 000007

H.ERVN= 000022   	H.SEMK= 000104   	SC.BAD= 000100   	$I$   = 000001   	$Z$   = 000000

H.FCHA= 000064   	H.SMMX= 000110   	SC.DIR= 000040   	$L    = 000000   	$$T   = 000001

H.FLEV= 000006   	H.UCHA= 000064   	SC.MDL= 000200   	$L$   = 000000   	.$T   = 000005

H.FNUM= 000010   	H.UFAT= 000024   	S.HDHD= 000114   	$MPVBN= ****** GX	...GBL= 000000

H.FOWN= 000074   	H.USE = 000072   	S.IDHD= 000202   	$OUDEV= ****** GX	...TPC= 000000

H.FPRO= 000100



. ABS.	000000	   000

      	000114	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  12783 WORDS  ( 50 PAGES)

DYNAMIC MEMORY:  14388 WORDS  ( 55 PAGES)

ELAPSED TIME:  00:00:35

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

