

; Bliss-32 10.1-416	Monday 21-AUG-1978 23:10:08	DBB3:[F11B.SRC]CREFCB.B32;7					Page 1

;

;	0001	MODULE CREFCB (

;	0002			LANGUAGE (BLISS32),

;	0003			IDENT = 'B0008'

;	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 2

;	0029	!

;	0030	! ABSTRACT:

;	0031	!

;	0032	!	These routines create and initialize a file control block

;	0033	!	from the given file header.

;	0034	!

;	0035	! ENVIRONMENT:

;	0036	!

;	0037	!	STARLET operating system, including privileged system services

;	0038	!	and internal exec routines. These routines must be called in

;	0039	!	kernel mode.

;	0040	

;	0041	!

;	0042	!--

;	0043	!

;	0044	!

;	0045	! AUTHOR:  Andrew C. Goldstein,	 CREATION DATE:  14-Dec-1976  16:48

;	0046	!

;	0047	! REVISION HISTORY:

;	0048	!

;	0049	!   Andrew C. Goldstein, 16-Feb-1977  15:02

;	0050	!   X0002 - Modify for condition handling

;	0051	!

;	0052	!   Andrew C. Goldstein, 9-Aug-1977  14:23

;	0053	!   X0003 - Add UPDATE_FCB routine

;	0054	!

;	0055	!   Andrew C. Goldstein, 1-Nov-1977  15:11



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:10:08	DBB3:[F11B.SRC]CREFCB.B32;7					Page 1-1

;

;	0056	!   X0004 - Break out from INIFCB

;	0057	!

;	0058	!   Andrew C. Goldstein, 15-Nov-1977  18:26

;	0059	!   X0005 - Replicate code in INIFCB to get correct EOF check

;	0060	!

;	0061	!   Andrew C. Goldstein, 14-Dec-1977  14:19

;	0062	!   X0006 - Modify for structure level 2

;	0063	!

;	0064	!   Andrew C. Goldstein, 6-Mar-1978  15:34

;	0065	!   B0007 - Zero starting LBN if not contiguous

;	0066	!

;	0067	!   Andrew C. Goldstein, 6-Jun-78  0:59

;	0068	!   B0008 - Add implicit spooling support

;	0069	!

;	0070	!**

;	0071	

;	0072	

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

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

;	0423	

;	0424	

;	0425	FORWARD ROUTINE

;	0426		CREATE_FCB,

;	0427		UPDATE_FCB	: NOVALUE;



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:10:08	DBB3:[F11B.SRC]CREFCB.B32;7					Page 2

;

;	0428	GLOBAL ROUTINE CREATE_FCB (HEADER) =

;	0429	

;	0430	!++

;	0431	!

;	0432	! FUNCTIONAL DESCRIPTION:

;	0433	!

;	0434	!	This routine creates an FCB and initializes it according to

;	0435	!	the given file header.

;	0436	!

;	0437	! CALLING SEQUENCE:

;	0438	!	CREATE_FCB (ARG1)

;	0439	!

;	0440	! INPUT PARAMETERS:

;	0441	!	ARG1: address of file header

;	0442	!

;	0443	! IMPLICIT INPUTS:

;	0444	!	NONE

;	0445	!

;	0446	! OUTPUT PARAMETERS:

;	0447	!	NONE

;	0448	!

;	0449	! IMPLICIT OUTPUTS:

;	0450	!	NONE

;	0451	!

;	0452	! ROUTINE VALUE:

;	0453	!	ADDRESS OF FCB

;	0454	!

;	0455	! SIDE EFFECTS:

;	0456	!	FCB created and initialized

;	0457	!

;	0458	!--

;	0459	

;	0460	BEGIN

;	0461	

;	0462	MAP

;	0463		HEADER		: REF BBLOCK;	! file header argument

;	0464	

;	0465	LOCAL

;	0466		FCB		: REF BBLOCK;	! address of FCB created

;	0467	

;	0468	EXTERNAL ROUTINE

;	0469		ALLOCATE,			! allocate dynamic memory

;	0470		INIT_FCB2;			! initialize contents of FCB

;	0471	

;	0472	! Allocate an FCB sized and typed block. Then use the common routine

;	0473	! to init it.

;	0474	!

;	0475	

;	0476	FCB = ALLOCATE (FCB$C_LENGTH, FCB_TYPE);

;	0477	FCB[FCB$L_WLFL] = FCB[FCB$L_WLFL];	! init null window list

;	0478	FCB[FCB$L_WLBL] = FCB[FCB$L_WLFL];

;	0479	FCB[FCB$L_STVBN] = 1;			! init start VBN to 1

;	0480	INIT_FCB2 (.FCB, .HEADER);

;	0481	RETURN .FCB;

;	0482	



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:10:08	DBB3:[F11B.SRC]CREFCB.B32;7					Page 2-1

;

;	0483	END;					! end of routine CREATE_FCB





							    .TITLE  CREFCB

							    .IDENT  \B0008\



							    .EXTRN  ALLOCATE, INIT_FCB2



							    .PSECT  $CODE$,NOWRT,2



					 0004 00000 	    .ENTRY  CREATE_FCB, Save R2					      ; 0428

				       7E  D4 00002 	    CLRL    -(SP)						      ; 0476

		         7E 	  48   8F  9A 00004 	    MOVZBL  #72, -(SP)						      ;

		  0000G  CF	       02  FB 00008 	    CALLS   #2, ALLOCATE					      ;

		         52 	       50  D0 0000D 	    MOVL    R0, FCB						      ;

		    10   A2	  10   A2  9E 00010 	    MOVAB   16(FCB), 16(FCB)					      ; 0477

		    14   A2	  10   A2  9E 00015 	    MOVAB   16(FCB), 20(FCB)					      ; 0478

		    28   A2	       01  D0 0001A 	    MOVL    #1, 40(FCB)						      ; 0479

				  04   AC  DD 0001E 	    PUSHL   HEADER						      ; 0480

				       52  DD 00021 	    PUSHL   FCB							      ;

		  0000G  CF	       02  FB 00023 	    CALLS   #2, INIT_FCB2					      ;

		         50 	       52  D0 00028 	    MOVL    FCB, R0						      ; 0481

					   04 0002B 	    RET     							      ; 0428



; Routine Size:  44 bytes







; Bliss-32 10.1-416	Monday 21-AUG-1978 23:10:08	DBB3:[F11B.SRC]CREFCB.B32;7					Page 3

;

;	0484	GLOBAL ROUTINE UPDATE_FCB (HEADER) : NOVALUE =

;	0485	

;	0486	!++

;	0487	!

;	0488	! FUNCTIONAL DESCRIPTION:

;	0489	!

;	0490	!	This routine updates the file attributes of the file's primary FCB,

;	0491	!	if any, with the file attributes of the given header. The file size

;	0492	!	is preserved.

;	0493	!

;	0494	!

;	0495	! CALLING SEQUENCE:

;	0496	!	UPDATE_FCB (ARG1)

;	0497	!

;	0498	! INPUT PARAMETERS:

;	0499	!	ARG1: address of file header

;	0500	!

;	0501	! IMPLICIT INPUTS:

;	0502	!	NONE

;	0503	!

;	0504	! OUTPUT PARAMETERS:

;	0505	!	NONE

;	0506	!

;	0507	! IMPLICIT OUTPUTS:

;	0508	!	PRIMARY_FCB: address of file FCB or 0

;	0509	!

;	0510	! ROUTINE VALUE:

;	0511	!	NONE

;	0512	!

;	0513	! SIDE EFFECTS:

;	0514	!	FCB is updated if it exists

;	0515	!

;	0516	!--

;	0517	

;	0518	BEGIN

;	0519	

;	0520	MAP

;	0521		HEADER		: REF BBLOCK;	! file header arg

;	0522	

;	0523	LINKAGE

;	0524		L_MAP_POINTER	= JSB :

;	0525				  GLOBAL (COUNT = 6, LBN = 7, MAP_POINTER = 8);

;	0526	

;	0527	GLOBAL REGISTER

;	0528		COUNT		= 6,		! retrieval pointer count

;	0529		LBN		= 7,		! retrieval pointer LBN

;	0530		MAP_POINTER	= 8;		! pointer to scan map area

;	0531	

;	0532	LOCAL

;	0533		FCB		: REF BBLOCK;	! FCB address

;	0534	

;	0535	EXTERNAL

;	0536		PRIMARY_FCB	: REF BBLOCK,	! FCB of file in process

;	0537		HEADER_LBN;			! LBN of file header

;	0538	



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:10:08	DBB3:[F11B.SRC]CREFCB.B32;7					Page 3-1

;

;	0539	EXTERNAL ROUTINE

;	0540		GET_MAP_POINTER	: L_MAP_POINTER; ! get value of file map pointer

;	0541	

;	0542	

;	0543	

;	0544	FCB = .PRIMARY_FCB;

;	0545	IF .FCB EQL 0 THEN RETURN;

;	0546	

;	0547	! Get the known constants and the simple stuff from the file header

;	0548	! (i.e., header LBN, file ID, starting VBN, file owner and file protection).

;	0549	!

;	0550	

;	0551	FCB[FCB$L_HDLBN]	= .HEADER_LBN;

;	0552	FCB[FCB$W_FID_NUM]	= .HEADER[FH2$W_FID_NUM];

;	0553	FCB[FCB$W_FID_SEQ]	= .HEADER[FH2$W_FID_SEQ];

;	0554	FCB[FCB$W_FID_RVN]	= .HEADER[FH2$W_FID_RVN];

;	0555	FCB[FCB$L_FILEOWNER]	= .HEADER[FH2$L_FILEOWNER];

;	0556	FCB[FCB$W_FILEPROT]	= .HEADER[FH2$W_FILEPROT];

;	0557	IF .HEADER[FH2$V_SPOOL] THEN FCB[FCB$V_SPOOL] = 1;

;	0558	FCB[FCB$L_EFBLK]	= ROT (.BBLOCK[HEADER[FH2$W_RECATTR], FAT$L_EFBLK], 16);

;	0559	IF  .FCB[FCB$L_EFBLK] NEQ 0

;	0560	AND .BBLOCK[HEADER[FH2$W_RECATTR], FAT$W_FFBYTE] EQL 0

;	0561	THEN FCB[FCB$L_EFBLK] = .FCB[FCB$L_EFBLK] - 1;

;	0562	

;	0563	! Now scan the map area. Get the starting LBN if the file is contiguous

;	0564	! and count up the file size from the retrieval pointers.

;	0565	!

;	0566	

;	0567	MAP_POINTER = .HEADER + .HEADER[FH2$B_MPOFFSET]*2;

;	0568	GET_MAP_POINTER ();

;	0569	FCB[FCB$L_STLBN] = 0;

;	0570	IF .HEADER[FH2$V_CONTIG]

;	0571	THEN FCB[FCB$L_STLBN] = .LBN;

;	0572	

;	0573	IF .FCB[FCB$L_EFBLK] GTR .FCB[FCB$L_FILESIZE]

;	0574	THEN FCB[FCB$L_EFBLK] = .FCB[FCB$L_FILESIZE];

;	0575	

;	0576	END;					! end of routine UPDATE_FCB







							    .EXTRN  PRIMARY_FCB, HEADER_LBN, GET_MAP_POINTER



					 0FFC 0002C 	    .ENTRY  UPDATE_FCB, Save R2,R3,R4,R5,R6,R7,R8,R9,R10,R11	      ; 0484

		         52 	0000G  CF  D0 0002E 	    MOVL    PRIMARY_FCB, FCB					      ; 0544

				       5A  13 00033 	    BEQL    4$							      ; 0545

		    30   A2	0000G  CF  D0 00035 	    MOVL    HEADER_LBN, 48(FCB)					      ; 0551

		         53 	  04   AC  D0 0003B 	    MOVL    HEADER, R3						      ; 0552

		    20   A2	  08   A3  D0 0003F 	    MOVL    8(R3), 32(FCB)					      ;

		    24   A2	  0C   A3  B0 00044 	    MOVW    12(R3), 36(FCB)					      ; 0554

		    38   A2	  3C   A3  D0 00049 	    MOVL    60(R3), 56(FCB)					      ; 0555

		    3C   A2	  40   A3  B0 0004E 	    MOVW    64(R3), 60(FCB)					      ; 0556

	   04 	    35   A3	       04  E1 00053 	    BBC     #4, 53(R3), 1$					      ; 0557

		    1E   A2	       10  88 00058 	    BISB2   #16, 30(FCB)					      ;

		         54 	  40   A2  9E 0005C 1$:     MOVAB   64(FCB), R4						      ; 0558



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:10:08	DBB3:[F11B.SRC]CREFCB.B32;7					Page 3-2

;

	   64 	    1C   A3	       10  9C 00060 	    ROTL    #16, 28(R3), (R4)					      ;

				       07  13 00065 	    BEQL    2$							      ; 0559

				  20   A3  B5 00067 	    TSTW    32(R3)						      ; 0560

				       02  12 0006A 	    BNEQ    2$							      ;

				       64  D7 0006C 	    DECL    (R4)						      ; 0561

		         50 	  01   A3  9A 0006E 2$:     MOVZBL  1(R3), R0						      ; 0567

		         58 	     6340  3E 00072 	    MOVAW   (R3)[R0], MAP_POINTER				      ;

				     0000G 30 00076 	    BSBW    GET_MAP_POINTER					      ; 0568

				  2C   A2  D4 00079 	    CLRL    44(FCB)						      ; 0569

	   04 	    34   A3	       07  E1 0007C 	    BBC     #7, 52(R3), 3$					      ; 0570

		    2C   A2	       57  D0 00081 	    MOVL    LBN, 44(FCB)					      ; 0571

		    34   A2	       64  D1 00085 3$:     CMPL    (R4), 52(FCB)					      ; 0573

				       04  15 00089 	    BLEQ    4$							      ;

		         64 	  34   A2  D0 0008B 	    MOVL    52(FCB), (R4)					      ; 0574

					   04 0008F 4$:     RET     							      ; 0484



; Routine Size:  100 bytes





;	0577	

;	0578	END

;	0579	ELUDOM













;				       PSECT SUMMARY

;

;	Name		 Bytes			       Attributes

;

;  $CODE$         	   144  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        32         0       244











; Size:		144 code + 0 data bytes

; Run Time:	00:06.5

; Elapsed Time:	00:18.8

; Memory Used:	285 pages

; Compilation Complete

