

; Bliss-32 10.1-416	Monday 21-AUG-1978 22:54:38	DBB3:[F11A.SRC]DIRGET.B32;8					Page 1

;

;	0001	MODULE DIRGET (

;	0002			LANGUAGE (BLISS32),

;	0003			IDENT = 'A0008'

;	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 gets a directory record from the directory being

;	0033	!	operated upon.

;	0034	! ENVIRONMENT:

;	0035	!

;	0036	!	STARLET operating system, including privileged system services

;	0037	!	and internal exec routines.

;	0038	!

;	0039	!--

;	0040	!

;	0041	!

;	0042	! AUTHOR:  Andrew C. Goldstein,	 CREATION DATE:  26-Dec-1976  18:48

;	0043	!

;	0044	! REVISION HISTORY:

;	0045	!

;	0046	!   Andrew C. Goldstein, 16-Feb-1977  14:58

;	0047	!   X0002 - Modify for condition handling

;	0048	!

;	0049	!   Andrew C. Goldstein, 30-Mar-1977  17:55

;	0050	!   X0003 - Add DIRPUT routine

;	0051	!

;	0052	!   Andrew C. Goldstein, 5-Apr-1977  16:46

;	0053	!   X0004 - Remove FCB and window arguments

;	0054	!

;	0055	!   Andrew C. Goldstein, 6-May-1977  13:42



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:54:38	DBB3:[F11A.SRC]DIRGET.B32;8					Page 1-1

;

;	0056	!   X0005 - Remove DIRPUT routine (equated to WRITE_BLOCK)

;	0057	!

;	0058	!   Andrew C. Goldstein, 28-Jun-1977  16:16

;	0059	!   X0006 - Shortcut call to READ_BLOCK if block doesn't change

;	0060	!

;	0061	!   Andrew C. Goldstein, 4-Nov-1977  15:04

;	0062	!   X0007 - Name change for end of file cell in FCB

;	0063	!

;	0064	!   Andrew C. Goldstein, 23-APR-78  19:52

;	0065	!   X0008 - Add multi-block read argument

;	0066	!

;	0067	!**

;	0068	

;	0069	

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

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



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:54:38	DBB3:[F11A.SRC]DIRGET.B32;8					Page 2

;

;	0390	GLOBAL ROUTINE DIRGET (RECNUMBER, MULTI) =

;	0391	

;	0392	!++

;	0393	!

;	0394	! FUNCTIONAL DESCRIPTION:

;	0395	!

;	0396	!	This routine gets a directory record from the directory being

;	0397	!	operated upon.

;	0398	!

;	0399	! CALLING SEQUENCE:

;	0400	!	DIRGET (ARG1, ARG2)

;	0401	!

;	0402	! INPUT PARAMETERS:

;	0403	!	ARG1: record number of directory entry to get

;	0404	!	ARG2: 0 to read just 1 block

;	0405	!	      1 to read multiple blocks

;	0406	!

;	0407	! IMPLICIT INPUTS:

;	0408	!	DIR_FCB: address of FCB for directory

;	0409	!	DIR_WINDOW: address of window for directory

;	0410	!

;	0411	! OUTPUT PARAMETERS:

;	0412	!	NONE

;	0413	!

;	0414	! IMPLICIT OUTPUTS:

;	0415	!	NONE

;	0416	!

;	0417	! ROUTINE VALUE:

;	0418	!	address of record in buffer or

;	0419	!	0 if end of file

;	0420	!

;	0421	! SIDE EFFECTS:

;	0422	!	directory blocks read into memory

;	0423	!

;	0424	!--

;	0425	

;	0426	BEGIN

;	0427	

;	0428	LOCAL

;	0429		VBN,				! VBN of directory to read

;	0430		LBN,				! LBN of directory block

;	0431		COUNT,				! number of blocks to read

;	0432		ADDRESS;			! buffer address of record

;	0433	

;	0434	EXTERNAL

;	0435		DIR_VBN,			! VBN of current directory block

;	0436		DIR_BUFFER	: REF BBLOCK,	! address of current directory block

;	0437		DIR_FCB		: REF BBLOCK,	! FCB for directory file

;	0438		DIR_WINDOW	: REF BBLOCK;	! window for directory file

;	0439	

;	0440	EXTERNAL ROUTINE

;	0441		MAP_VBN,			! map VBN to LBN

;	0442		READ_BLOCK;			! read a block from the disk

;	0443	

;	0444	



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:54:38	DBB3:[F11A.SRC]DIRGET.B32;8					Page 2-1

;

;	0445	! Compute the VBN of the directory block containing the desired record.

;	0446	! If the VBN is the same as the last one read, skip the read.

;	0447	! Check it against the directory end of file recorded in the FCB.

;	0448	!

;	0449	

;	0450	VBN = (.RECNUMBER-1) / (512/16) + 1;	! 512 byte blocks, 16 byte records

;	0451	IF .VBN NEQ .DIR_VBN

;	0452	THEN

;	0453	    BEGIN

;	0454	    DIR_VBN = 0;

;	0455	    IF .VBN GTRU .DIR_FCB[FCB$L_EFBLK] THEN RETURN 0; ! no record if beyond end

;	0456	

;	0457	! Now map VBN to LBN. If the directory is contiguous, use the FCB; if not,

;	0458	! call the mapper with the window. Also, if the directory is contiguous

;	0459	! and multi-block reads are enabled, compute the number of blocks to be read.

;	0460	!

;	0461	

;	0462	    COUNT = 1;

;	0463	    IF .DIR_FCB[FCB$L_STLBN] NEQ 0	! non-zero start LBN means contiguous

;	0464	    THEN

;	0465		BEGIN

;	0466		LBN = .DIR_FCB[FCB$L_STLBN] + .VBN - 1;

;	0467		IF .MULTI

;	0468		THEN COUNT = .DIR_FCB[FCB$L_EFBLK] - .VBN + 1;

;	0469		END

;	0470	    ELSE

;	0471		BEGIN

;	0472		LBN = MAP_VBN (.VBN, .DIR_WINDOW);

;	0473		IF .LBN EQL -1 THEN RETURN 0;	! EOF if map fails

;	0474		END;

;	0475	

;	0476	! Read the block and point to the record within it.

;	0477	!

;	0478	

;	0479	    DIR_BUFFER = READ_BLOCK (.LBN, .COUNT, DIRECTORY_TYPE);

;	0480	    DIR_VBN = .VBN;

;	0481	    END;

;	0482	

;	0483	ADDRESS = .DIR_BUFFER + (.RECNUMBER-1)*16 - (.VBN-1)*512;

;	0484	RETURN .ADDRESS;

;	0485	

;	0486	END;					! end of routine DIRGET





							    .TITLE  DIRGET

							    .IDENT  \A0008\



							    .EXTRN  DIR_VBN, DIR_BUFFER, DIR_FCB, DIR_WINDOW, MAP_VBN

							    .EXTRN  READ_BLOCK



							    .PSECT  $CODE$,NOWRT,2



					 007C 00000 	    .ENTRY  DIRGET, Save R2,R3,R4,R5,R6				      ; 0390

		         56 	0000G  CF  9E 00002 	    MOVAB   DIR_VBN, R6						      ;

	   55 	    04   AC	       01  C3 00007 	    SUBL3   #1, RECNUMBER, R5					      ; 0450



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:54:38	DBB3:[F11A.SRC]DIRGET.B32;8					Page 2-2

;

	   50 	         55 	       20  C7 0000C 	    DIVL3   #32, R5, R0						      ;

		         52 	  01   A0  9E 00010 	    MOVAB   1(R0), VBN						      ;

		         66 	       52  D1 00014 	    CMPL    VBN, DIR_VBN					      ; 0451

				       55  13 00017 	    BEQL    3$							      ;

				       66  D4 00019 	    CLRL    DIR_VBN						      ; 0454

		         50 	0000G  CF  D0 0001B 	    MOVL    DIR_FCB, R0						      ; 0455

		    40   A0	       52  D1 00020 	    CMPL    VBN, 64(R0)						      ;

				       5E  1A 00024 	    BGTRU   4$							      ;

		         54 	       01  D0 00026 	    MOVL    #1, COUNT						      ; 0462

				  2C   A0  D5 00029 	    TSTL    44(R0)						      ; 0463

				       18  13 0002C 	    BEQL    1$							      ;

	   51 	         52 	  2C   A0  C1 0002E 	    ADDL3   44(R0), VBN, R1					      ; 0466

		         53 	  FF   A1  9E 00033 	    MOVAB   -1(R1), LBN						      ;

		         22 	  08   AC  E9 00037 	    BLBC    MULTI, 2$						      ; 0467

	   50 	    40   A0	       52  C3 0003B 	    SUBL3   VBN, 64(R0), R0					      ; 0468

		         54 	  01   A0  9E 00040 	    MOVAB   1(R0), COUNT					      ;

				       17  11 00044 	    BRB     2$							      ; 0463

				0000G  CF  DD 00046 1$:     PUSHL   DIR_WINDOW						      ; 0472

				       52  DD 0004A 	    PUSHL   VBN							      ;

		  0000G  CF	       02  FB 0004C 	    CALLS   #2, MAP_VBN						      ;

		         53 	       50  D0 00051 	    MOVL    R0, LBN						      ;

	      FFFFFFFF   8F	       53  D1 00054 	    CMPL    LBN, #-1						      ; 0473

				       27  13 0005B 	    BEQL    4$							      ;

				       02  DD 0005D 2$:     PUSHL   #2							      ; 0479

				       18  BB 0005F 	    PUSHR   #^M<R3,R4>						      ;

		  0000G  CF	       03  FB 00061 	    CALLS   #3, READ_BLOCK					      ;

		  0000G  CF	       50  D0 00066 	    MOVL    R0, DIR_BUFFER					      ;

		         66 	       52  D0 0006B 	    MOVL    VBN, DIR_VBN					      ; 0480

	   50 	         55 	       04  78 0006E 3$:     ASHL    #4, R5, R0						      ; 0483

		         50 	0000G  CF  C0 00072 	    ADDL2   DIR_BUFFER, R0					      ;

	   51 	         52 	       09  78 00077 	    ASHL    #9, VBN, R1						      ;

		         50 	       51  C2 0007B 	    SUBL2   R1, R0						      ;

		         50 	0200   C0  9E 0007E 	    MOVAB   512(R0), ADDRESS					      ;

					   04 00083 	    RET     							      ; 0484

				       50  D4 00084 4$:     CLRL    R0							      ; 0390

					   04 00086 	    RET     							      ;



; Routine Size:  135 bytes





;	0487	

;	0488	END

;	0489	ELUDOM













;				       PSECT SUMMARY

;

;	Name		 Bytes			       Attributes

;

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





; Bliss-32 10.1-416	Monday 21-AUG-1978 22:54:38	DBB3:[F11A.SRC]DIRGET.B32;8					Page 2-3

;







;				LIBRARY STATISTICS

;

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

;	File				     Total    Loaded   Percent      Read

;

;  DBA4:[SYSLIB]LIB.L32;1		      5582         3         0       223











; Size:		135 code + 0 data bytes

; Run Time:	00:05.2

; Elapsed Time:	00:14.8

; Memory Used:	265 pages

; Compilation Complete

