

; Bliss-32 10.1-416	Monday 21-AUG-1978 23:03:04	DBB3:[F11A.SRC]RDHEDR.B32;10					Page 1

;

;	0001	MODULE RDHEDR (

;	0002			LANGUAGE (BLISS32),

;	0003			IDENT = 'A0006A'

;	0004			) =

;	0005	BEGIN

;	0006	

;	0007	!

;	0008	! Copyright (c) 1977

;	0009	! Digital Equipment Corporation, Maynard, Massachusetts 01754

;	0010	!

;	0011	! This software is furnished  under a license for use only on a single

;	0012	! computer  system and  may be  copied only with  the inclusion of the

;	0013	! above copyright notice.  This software, or any other copies thereof,

;	0014	! may not be provided or  otherwise made available to any other person

;	0015	! except for use on such system and to one who agrees to these license

;	0016	! terms.  Title to and  ownership of the  software  shall at all times

;	0017	! remain in DEC.

;	0018	!

;	0019	! The information in this software is subject to change without notice

;	0020	! and should  not be construed  as a commitment  by Digital  Equipment

;	0021	! Corporation.

;	0022	!

;	0023	! DEC assumes  no  responsibility  for  the use or  reliability of its

;	0024	! software on equipment which is not supplied by DEC.

;	0025	

;	0026	!++

;	0027	!

;	0028	! FACILITY:  F11ACP Structure Level 1

;	0029	!

;	0030	! ABSTRACT:

;	0031	!

;	0032	!	This routine reads the desired file header, checks it for

;	0033	!	validity and correctness, and returns its address.

;	0034	!

;	0035	! ENVIRONMENT:

;	0036	!

;	0037	!	STARLET operating system, including privileged system services

;	0038	!	and internal exec routines.

;	0039	!

;	0040	!--

;	0041	!

;	0042	!

;	0043	! AUTHOR:  Andrew C. Goldstein,	 CREATION DATE:  13-Dec-1976  22:00

;	0044	!

;	0045	! REVISION HISTORY:

;	0046	!

;	0047	!   Andrew C. Goldstein, 16-Feb-1977  15:12

;	0048	!   X0002 - Modify for condition handling

;	0049	!

;	0050	!   Andrew C. Goldstein, 21-Mar-1977  19:20

;	0051	!   X0003 - Store header address in common

;	0052	!

;	0053	!   Andrew C. Goldstein, 13-Apr-1977  16:28

;	0054	!   X0004 - Check for zero file number

;	0055	!



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:03:04	DBB3:[F11A.SRC]RDHEDR.B32;10					Page 1-1

;

;	0056	!   Andrew C. Goldstein, 12-Dec-1977  14:14

;	0057	!   X0005 - file ID interface changes

;	0058	!

;	0059	!   Andrew C. Goldstein, 14-Jun-78  23:06

;	0060	!   A0006 - Add implicit spooling support

;	0061	!

;	0062	!**

;	0063	

;	0064	

;	0065	LIBRARY 'SYS$LIBRARY:LIB.L32';

;	0066	REQUIRE 'SRC$:FCPDEF.B32';



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:03:04	DBB3:[F11A.SRC]RDHEDR.B32;10					Page 2

;

;	0385	GLOBAL ROUTINE READ_HEADER (FILE_ID, FCB) =

;	0386	

;	0387	!++

;	0388	!

;	0389	! FUNCTIONAL DESCRIPTION:

;	0390	!

;	0391	!	This routine reads the desired file header, checks it for

;	0392	!	validity and correctness, and returns its address.

;	0393	!

;	0394	! CALLING SEQUENCE:

;	0395	!	READ_HEADER (ARG1, ARG2)

;	0396	!

;	0397	! INPUT PARAMETERS:

;	0398	!	ARG1: address of file ID or 0

;	0399	!	ARG2: FCB address or 0 if none

;	0400	!

;	0401	! IMPLICIT INPUTS:

;	0402	!	CURRENT_VCB contains address of VCB in process

;	0403	!

;	0404	! OUTPUT PARAMETERS:

;	0405	!	NONE

;	0406	!

;	0407	! IMPLICIT OUTPUTS:

;	0408	!	HEADER_LBN contains LBN of header read

;	0409	!	FILE_HEADER contains address of header buffer

;	0410	!

;	0411	! ROUTINE VALUE:

;	0412	!	address of file header

;	0413	!

;	0414	! SIDE EFFECTS:

;	0415	!	index file window may be turned

;	0416	!

;	0417	!--

;	0418	

;	0419	BEGIN

;	0420	

;	0421	MAP

;	0422		FILE_ID		: REF BBLOCK,	! file ID arg

;	0423		FCB		: REF BBLOCK;	! FCB arg

;	0424	

;	0425	LOCAL

;	0426		VBN,				! VBN of header

;	0427		LBN,				! LBN of header

;	0428		HEADER		: REF BBLOCK,		! address of header block

;	0429		FID		: REF BBLOCK,	! local file ID pointer

;	0430		IDX_FCB		: REF BBLOCK;	! address of index file FCB

;	0431	

;	0432	EXTERNAL

;	0433		CLEANUP_FLAGS	: BITVECTOR,	! cleanup_action flags

;	0434		HEADER_LBN,			! longword to get LBN of header

;	0435		FILE_HEADER	: REF BBLOCK,	! longword to get buffer address

;	0436		CURRENT_VCB	: REF BBLOCK;	! address of VCB in process

;	0437	

;	0438	EXTERNAL ROUTINE

;	0439		MAP_VBN,			! map virtual to logical



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:03:04	DBB3:[F11A.SRC]RDHEDR.B32;10					Page 2-1

;

;	0440		READ_BLOCK,			! read a disk block

;	0441		CHECK_HEADER;			! check header for correctness

;	0442	

;	0443	! Get the LBN of the file header. If an FCB is supplied, it contains

;	0444	! the LBN. If not, derive it from the file number.

;	0445	!

;	0446	

;	0447	LBN =

;	0448	    BEGIN

;	0449	    IF .FCB NEQ 0

;	0450	    THEN .FCB[FCB$L_HDLBN]

;	0451	    ELSE

;	0452		BEGIN

;	0453		IF .FILE_ID[FID$W_NUM] EQL 0 THEN ERR_EXIT (SS$_NOSUCHFILE);

;	0454		VBN = .FILE_ID[FID$W_NUM] + .CURRENT_VCB[VCB$B_IBMAPSIZE] + 2;

;	0455		IDX_FCB = .CURRENT_VCB[VCB$L_FCBFL];

;	0456		MAP_VBN (.VBN, .IDX_FCB[FCB$L_WLFL])

;	0457		END

;	0458	    END;

;	0459	

;	0460	IF .LBN EQL -1 THEN ERR_EXIT (SS$_NOSUCHFILE);

;	0461	

;	0462	! Now read the header and check it for correctness. If a file ID

;	0463	! was supplied, use the file number and file sequence number from

;	0464	! it; else use the arguments. If the file operation is being done on a

;	0465	! spooled device, the file must be marked as spooled.

;	0466	!

;	0467	

;	0468	HEADER = READ_BLOCK (.LBN, 1, HEADER_TYPE);

;	0469	IF .CLEANUP_FLAGS[CLF_SPOOLFILE]

;	0470	AND NOT .HEADER[FH1$V_SPOOL]

;	0471	AND .HEADER[FH1$W_FID_NUM] GTRU 5

;	0472	THEN ERR_EXIT (SS$_NOSUCHFILE);

;	0473	

;	0474	IF .FILE_ID NEQ 0

;	0475	THEN

;	0476	    FID = .FILE_ID

;	0477	ELSE

;	0478	    FID = FCB[FCB$W_FID];

;	0479	

;	0480	IF NOT CHECK_HEADER (.HEADER, .FID) THEN ERR_EXIT ();

;	0481	

;	0482	HEADER_LBN = .LBN;			! return LBN of header

;	0483	FILE_HEADER = .HEADER;			! and address

;	0484	RETURN .HEADER;				! and the header itself

;	0485	END;					! end of routine READ_HEADER





							    .TITLE  RDHEDR

							    .IDENT  \A0006A\



							    .EXTRN  CLEANUP_FLAGS, HEADER_LBN, FILE_HEADER, CURRENT_VCB

							    .EXTRN  MAP_VBN, READ_BLOCK, CHECK_HEADER



							    .PSECT  $CODE$,NOWRT,2



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:03:04	DBB3:[F11A.SRC]RDHEDR.B32;10					Page 2-2

;



					 000C 00000 	    .ENTRY  READ_HEADER, Save R2,R3				      ; 0385

		         50 	  08   AC  D0 00002 	    MOVL    FCB, R0						      ; 0449

				       06  13 00006 	    BEQL    1$							      ;

		         53 	  30   A0  D0 00008 	    MOVL    48(R0), LBN						      ; 0448

				       2C  11 0000C 	    BRB     3$							      ;

				  04   BC  B5 0000E 1$:     TSTW    @FILE_ID						      ; 0453

				       04  12 00011 	    BNEQ    2$							      ;

				0910   8F  BF 00013 	    CHMU    #2320						      ;

		         50 	0000G  CF  D0 00017 2$:     MOVL    CURRENT_VCB, R0					      ; 0454

		         51 	  04   BC  3C 0001C 	    MOVZWL  @FILE_ID, R1					      ;

		         52 	  38   A0  9A 00020 	    MOVZBL  56(R0), R2						      ;

		         51 	       52  C0 00024 	    ADDL2   R2, R1						      ;

		         51 	       02  C0 00027 	    ADDL2   #2, VBN						      ;

		         50 	       60  D0 0002A 	    MOVL    (R0), IDX_FCB					      ; 0455

				  10   A0  DD 0002D 	    PUSHL   16(IDX_FCB)						      ; 0456

				       51  DD 00030 	    PUSHL   VBN							      ;

		  0000G  CF	       02  FB 00032 	    CALLS   #2, MAP_VBN						      ;

		         53 	       50  D0 00037 	    MOVL    R0, LBN						      ;

	      FFFFFFFF   8F	       53  D1 0003A 3$:     CMPL    LBN, #-1						      ; 0460

				       04  12 00041 	    BNEQ    4$							      ;

				0910   8F  BF 00043 	    CHMU    #2320						      ;

		         7E 	       01  7D 00047 4$:     MOVQ    #1, -(SP)						      ; 0468

				       53  DD 0004A 	    PUSHL   LBN							      ;

		  0000G  CF	       03  FB 0004C 	    CALLS   #3, READ_BLOCK					      ;

		         52 	       50  D0 00051 	    MOVL    R0, HEADER						      ;

	   0F 	  0000G  CF	       07  E1 00054 	    BBC     #7, CLEANUP_FLAGS, 5$				      ; 0469

	   0A 	    0D   A2	       04  E0 0005A 	    BBS     #4, 13(HEADER), 5$					      ; 0470

		         05 	  02   A2  B1 0005F 	    CMPW    2(HEADER), #5					      ; 0471

				       04  1B 00063 	    BLEQU   5$							      ;

				0910   8F  BF 00065 	    CHMU    #2320						      ; 0472

				  04   AC  D5 00069 5$:     TSTL    FILE_ID						      ; 0474

				       06  13 0006C 	    BEQL    6$							      ;

		         50 	  04   AC  D0 0006E 	    MOVL    FILE_ID, FID					      ; 0476

				       05  11 00072 	    BRB     7$							      ; 0474

	   50 	    08   AC	       20  C1 00074 6$:     ADDL3   #32, FCB, FID					      ; 0478

				       50  DD 00079 7$:     PUSHL   FID							      ; 0480

				       52  DD 0007B 	    PUSHL   HEADER						      ;

		  0000G  CF	       02  FB 0007D 	    CALLS   #2, CHECK_HEADER					      ;

		         02 	       50  E8 00082 	    BLBS    R0, 8$						      ;

				       00  BF 00085 	    CHMU    #0							      ;

		  0000G  CF	       53  D0 00087 8$:     MOVL    LBN, HEADER_LBN					      ; 0482

		  0000G  CF	       52  D0 0008C 	    MOVL    HEADER, FILE_HEADER					      ; 0483

		         50 	       52  D0 00091 	    MOVL    HEADER, R0						      ; 0484

					   04 00094 	    RET     							      ; 0385



; Routine Size:  149 bytes





;	0486	

;	0487	END

;	0488	ELUDOM









; Bliss-32 10.1-416	Monday 21-AUG-1978 23:03:04	DBB3:[F11A.SRC]RDHEDR.B32;10					Page 2-3

;







;				       PSECT SUMMARY

;

;	Name		 Bytes			       Attributes

;

;  $CODE$         	   149  NOWRT,  RD ,  EXE,NOSHR,  LCL,  REL,  CON,NOPIC,ALIGN(2)









;				LIBRARY STATISTICS

;

;					     -------- Symbols --------    Blocks

;	File				     Total    Loaded   Percent      Read

;

;  DBA4:[SYSLIB]LIB.L32;1		      5582        10         0       231











; Size:		149 code + 0 data bytes

; Run Time:	00:05.2

; Elapsed Time:	00:12.6

; Memory Used:	272 pages

; Compilation Complete

