

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

;

;	0001	MODULE DIRSCN (

;	0002			LANGUAGE (BLISS32),

;	0003			IDENT = 'B0004B'

;	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	!	This routine performs the basic directory scan, searching for the

;	0033	!	given entry.

;	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:  30-Dec-1977  11:14

;	0044	!

;	0045	! REVISION HISTORY:

;	0046	!

;	0047	!   Andrew C. Goldstein, 14-Jan-1978  18:53

;	0048	!   B0002 - Directory structure change

;	0049	!

;	0050	!   Andrew C. Goldstein, 21-Jan-1978  23:37

;	0051	!   B0003 - Changes for ENTER function

;	0052	!

;	0053	!   Andrew C. Goldstein, 28-APR-78  9:54

;	0054	!   B0004 - Add multi-block directory reads

;	0055	!



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

;

;	0056	!**

;	0057	

;	0058	

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

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

;	0409	

;	0410	

;	0411	FORWARD ROUTINE

;	0412		DIR_SCAN,			! directory scanner

;	0413		NEXT_REC,			! get next directory record

;	0414		UPDATE_IDX;			! update directory index entry



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

;

;	0415	GLOBAL ROUTINE DIR_SCAN (NAME_DESC, FILE_ID, START_BLOCK, START_REC, START_VER, REC_COUNT) =

;	0416	

;	0417	!++

;	0418	!

;	0419	! FUNCTIONAL DESCRIPTION:

;	0420	!

;	0421	!	This routine scans a directory, searching for the given entry.

;	0422	!

;	0423	!

;	0424	! CALLING SEQUENCE:

;	0425	!	DIR_SCAN (ARG1, ARG2, ARG3, ARG4, ARG5, ARG6)

;	0426	!

;	0427	! INPUT PARAMETERS:

;	0428	!	ARG1: address of file name descriptor block

;	0429	!	ARG2: address of file ID block

;	0430	!	ARG3: relative block number to start search

;	0431	!	ARG4: address of record at which to start

;	0432	!	ARG5: address of version entry at which to start

;	0433	!	ARG6: maximum number of records to scan

;	0434	!

;	0435	! IMPLICIT INPUTS:

;	0436	!	NONE

;	0437	!

;	0438	! OUTPUT PARAMETERS:

;	0439	!	NONE

;	0440	!

;	0441	! IMPLICIT OUTPUTS:

;	0442	!	DIR_VBN: relative block + 1 of current directory buffer

;	0443	!	DIR_BUFFER: address of current directory block buffer

;	0444	!	DIR_RECORD: record number within block of found entry

;	0445	!	DIR_ENTRY: address in buffer of found record

;	0446	!	DIR_VERSION: address if buffer of found version entry

;	0447	!

;	0448	! ROUTINE VALUE:

;	0449	!	1 if entry found

;	0450	!	0 if no match, in which case:

;	0451	!		DIR_ENTRY = next record in collating sequence

;	0452	!			  = 0 if whole directory scanned (name belongs off the end)

;	0453	!		DIR_VERSION = next version in collating sequence if name & type matched

;	0454	!			    = 0 if name or type did not match

;	0455	!

;	0456	! SIDE EFFECTS:

;	0457	!	directory blocks read

;	0458	!	directory index in FCB updated

;	0459	!

;	0460	!--

;	0461	

;	0462	BEGIN

;	0463	

;	0464	MAP

;	0465		NAME_DESC	: REF BBLOCK;	! name descriptor block arg

;	0466	

;	0467	LABEL

;	0468		SEARCH_LOOP;			! body of search code

;	0469	



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

;

;	0470	LOCAL

;	0471		STATUS,				! routine return status

;	0472		K,				! cluster factor of directory index

;	0473		COUNT,				! entry count within current block

;	0474		BLOCK,				! relative block number

;	0475		LAST_BLOCK,			! last block of directory to read

;	0476		LAST_ENTRY	: BYTE,		! starting letter of last entry in block

;	0477		DN		: REF BBLOCK,	! address of name descriptor block

;	0478		ENTRY		: REF BBLOCK,	! pointer to current directory record

;	0479		P		: REF BBLOCK,	! pointer to current directory version

;	0480		DIR_INDEX	: REF VECTOR [,BYTE]; ! pointer to directory index

;	0481	

;	0482	EXTERNAL

;	0483		DIR_VBN,			! VBN of directory block last read

;	0484		DIR_RECORD,			! record number in block of entry

;	0485		DIR_BUFFER,			! address of current directory buffer

;	0486		DIR_ENTRY,			! address of found directory record

;	0487		DIR_VERSION,			! address of found directory version

;	0488		DIR_FCB		: REF BBLOCK;	! FCB of directory file

;	0489	

;	0490	EXTERNAL ROUTINE

;	0491		READ_BLOCK;			! read a disk block

;	0492	

;	0493	

;	0494	! Initialize basic pointers. Compute the cluster factor of the directory

;	0495	! index from the directory size.

;	0496	!

;	0497	

;	0498	DN = .NAME_DESC;

;	0499	STATUS = 0;

;	0500	BLOCK = .START_BLOCK;

;	0501	ENTRY = .START_REC;

;	0502	P = .START_VER;

;	0503	COUNT = .DIR_RECORD;

;	0504	

;	0505	IF .BLOCK GTRU .DIR_FCB[FCB$L_EFBLK]

;	0506	THEN BLOCK = .DIR_FCB[FCB$L_EFBLK];

;	0507	DIR_INDEX = DIR_FCB[FCB$B_DIRIDX];

;	0508	K = (.DIR_FCB[FCB$L_EFBLK] + 1 + FCB$S_DIRIDX - 1) / FCB$S_DIRIDX;

;	0509	

;	0510	! If there is not a wild card name, search the index in the directory FCB

;	0511	! for the appropriate block to start the search. Also search for the block

;	0512	! in which to stop. If we are directed to start at a block that is clearly

;	0513	! past eligible entries, return failure immediately.

;	0514	!

;	0515	

;	0516	SEARCH_LOOP: BEGIN			! outer directory search loop

;	0517	

;	0518	LAST_BLOCK = .DIR_FCB[FCB$L_EFBLK] - 1;

;	0519	

;	0520	IF NOT (.DN[FND_WILD_NAME] OR .DN[FND_FIND_FID])

;	0521	AND .DIR_FCB[FCB$V_DIR]

;	0522	THEN

;	0523	    BEGIN

;	0524	    LAST_BLOCK = .K - 1;



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

;

;	0525	    UNTIL (.DIR_INDEX[(.LAST_BLOCK-.K+1)/.K] NEQ 255

;	0526	       AND .DIR_INDEX[(.LAST_BLOCK-.K+1)/.K] GTRU CH$RCHAR (.DN[FND_STRING]))

;	0527	    OR .LAST_BLOCK GEQU .DIR_FCB[FCB$L_EFBLK] - 1

;	0528	    DO

;	0529		LAST_BLOCK = .LAST_BLOCK + 1;

;	0530	

;	0531	    UNTIL .DIR_INDEX[.BLOCK/.K] GEQU CH$RCHAR (.DN[FND_STRING])

;	0532	    DO

;	0533		BLOCK = .BLOCK + 1;

;	0534	    END;

;	0535	

;	0536	! Loop, scanning blocks of the directory until we hit EOF.

;	0537	!

;	0538	

;	0539	WHILE 1 DO

;	0540	    BEGIN

;	0541	

;	0542	    IF .BLOCK GTRU .LAST_BLOCK

;	0543	    THEN LEAVE SEARCH_LOOP;

;	0544	    IF .ENTRY EQL 0

;	0545	    THEN

;	0546		BEGIN

;	0547		ENTRY = READ_BLOCK (.BLOCK+.DIR_FCB[FCB$L_STLBN],

;	0548				    IF  .DN[FND_WILD_NAME]

;	0549				    AND .DN[FND_WILD_TYPE]

;	0550				    AND .DN[FND_WILD_VER]

;	0551				    THEN 1

;	0552				    ELSE .LAST_BLOCK - .BLOCK + 1,

;	0553				    DIRECTORY_TYPE);

;	0554		DIR_BUFFER = .ENTRY;

;	0555		END;

;	0556	

;	0557	! Loop, scanning the records of the directory. A record size of -1 indicates

;	0558	! the end of the block. We attempt to match name and type against the entry,

;	0559	! under control of the various name control flags.

;	0560	!

;	0561	

;	0562	    LAST_ENTRY = -1;

;	0563	    UNTIL .ENTRY[DIR$W_SIZE] EQL 65535

;	0564	    DO

;	0565		BEGIN

;	0566		IF .COUNT GEQU .REC_COUNT THEN LEAVE SEARCH_LOOP;

;	0567		IF .P EQL 0

;	0568		THEN P = .ENTRY + DIR$C_LENGTH + .ENTRY[DIR$B_NAMECOUNT] + 1 AND NOT 1;

;	0569	

;	0570		IF

;	0571		    BEGIN

;	0572	

;	0573		    IF .DN[FND_FIND_FID]

;	0574		    THEN 1

;	0575	

;	0576		    ELSE

;	0577			BEGIN

;	0578			LOCAL C, CP;

;	0579			C = .ENTRY[DIR$B_NAMECOUNT];



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

;

;	0580			CP = CH$FIND_CH (.C, ENTRY[DIR$T_NAME], '.');

;	0581			IF CH$FAIL (.CP)

;	0582			THEN ERR_EXIT (SS$_BADIRECTORY);

;	0583	

;	0584			IF .DN[FND_WILD_NAME]

;	0585			THEN

;	0586			    BEGIN

;	0587			    IF .DN[FND_WILD_TYPE]

;	0588			    THEN 1

;	0589			    ELSE CH$EQL (.DN[FND_COUNT], .DN[FND_STRING],

;	0590					 .C+ENTRY[DIR$T_NAME]-.CP, .CP)

;	0591			    END

;	0592	

;	0593			ELSE

;	0594			    BEGIN

;	0595			    IF .DN[FND_WILD_TYPE]

;	0596			    THEN C = .CP - ENTRY[DIR$T_NAME] + 1;

;	0597			    IF CH$EQL (.DN[FND_COUNT], .DN[FND_STRING],

;	0598				       .C, ENTRY[DIR$T_NAME])

;	0599			    THEN 1

;	0600			    ELSE

;	0601				BEGIN

;	0602				IF CH$LSS (.DN[FND_COUNT], .DN[FND_STRING],

;	0603					    .C, ENTRY[DIR$T_NAME])

;	0604				THEN

;	0605				    BEGIN

;	0606				    P = 0;

;	0607				    LEAVE SEARCH_LOOP;

;	0608				    END

;	0609	

;	0610				ELSE 0

;	0611				END

;	0612			    END

;	0613			END

;	0614		    END

;	0615	

;	0616	! If the name and type match on a record, loop to process the versions of

;	0617	! the record.

;	0618	!

;	0619	

;	0620		THEN

;	0621		    BEGIN

;	0622		    UNTIL .P GEQA .ENTRY + .ENTRY[DIR$W_SIZE] + 2

;	0623		    DO

;	0624			BEGIN

;	0625			IF .COUNT GEQU .REC_COUNT THEN LEAVE SEARCH_LOOP;

;	0626	

;	0627			IF .DN[FND_WILD_VER]

;	0628			OR .DN[FND_MAX_VER]

;	0629			OR

;	0630			    BEGIN

;	0631	

;	0632			    IF .DN[FND_FIND_FID]

;	0633			    THEN CH$EQL (FID$C_LENGTH, .FILE_ID, FID$C_LENGTH, P[DIR$W_FID])

;	0634	



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:13:21	DBB3:[F11B.SRC]DIRSCN.B32;10					Page 2-4

;

;	0635			    ELSE IF (.DN[FND_VERSION] EQL 0

;	0636				     AND NOT .ENTRY[DIR$V_PREVREC]

;	0637				     AND .P EQL (.ENTRY + DIR$C_LENGTH

;	0638						 + .ENTRY[DIR$B_NAMECOUNT] + 1 AND NOT 1))

;	0639			    THEN 1

;	0640	

;	0641			    ELSE IF .DN[FND_VERSION] GTR .P[DIR$W_VERSION]

;	0642			    THEN EXITLOOP

;	0643	

;	0644			    ELSE .DN[FND_VERSION] EQL .P[DIR$W_VERSION]

;	0645	

;	0646			    END

;	0647	

;	0648			THEN

;	0649			    BEGIN

;	0650			    STATUS = 1;

;	0651			    LEAVE SEARCH_LOOP;

;	0652			    END;

;	0653	

;	0654			P = .P + DIR$C_VERSION;

;	0655			COUNT = .COUNT + 1;

;	0656			END;			! end of record scanning loop

;	0657	

;	0658	! We have gone through a directory record without finding a match. If no

;	0659	! name control bits are set and no continuation records are present, we

;	0660	! can quit now.

;	0661	!

;	0662	

;	0663		    IF .DN[FND_FLAGS] EQL 0

;	0664		    AND NOT .ENTRY[DIR$V_NEXTREC]

;	0665		    THEN LEAVE SEARCH_LOOP;

;	0666	

;	0667		    END;			! end of record processing conditional

;	0668	

;	0669		LAST_ENTRY = CH$RCHAR (ENTRY[DIR$T_NAME]);

;	0670		ENTRY = NEXT_REC (.ENTRY);	! get next record

;	0671		COUNT = .COUNT + (.ENTRY-.P) / DIR$C_VERSION;

;	0672		P = 0;

;	0673		END;				! end of block scanning loop

;	0674	

;	0675	! We have tripped out of the record scan loop, either because we reached

;	0676	! the end of the block or we ran out the record count. In the latter case

;	0677	! (i.e., if this was a position to record number call), we are done.

;	0678	! Otherwise update the directory index (causing it to be built on the fly)

;	0679	! and read the next block.

;	0680	!

;	0681	

;	0682	    KERNEL_CALL (UPDATE_IDX, .BLOCK, .LAST_ENTRY);

;	0683	    BLOCK = .BLOCK + 1;

;	0684	    ENTRY = 0;

;	0685	    P = 0;

;	0686	    COUNT = 0;

;	0687	    IF .REC_COUNT LSSU 63 THEN LEAVE SEARCH_LOOP;

;	0688	    END;				! end of block loop

;	0689	



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:13:21	DBB3:[F11B.SRC]DIRSCN.B32;10					Page 2-5

;

;	0690	END;					! end of block SEARCH_LOOP

;	0691	

;	0692	! Return the record count and pointer in global storage and return status.

;	0693	!

;	0694	

;	0695	DIR_VBN = .BLOCK + 1;

;	0696	DIR_RECORD = .COUNT;

;	0697	DIR_ENTRY = .ENTRY;

;	0698	DIR_VERSION = .P;

;	0699	

;	0700	RETURN .STATUS;

;	0701	

;	0702	END;					! end of routine DIR_SCAN





							    .TITLE  DIRSCN

							    .IDENT  \B0004B\



							    .EXTRN  DIR_VBN, DIR_RECORD, DIR_BUFFER, DIR_ENTRY, DIR_VERSION

							    .EXTRN  DIR_FCB, READ_BLOCK, SYS$CMKRNL



							    .PSECT  $CODE$,NOWRT,2



					 0FFC 00000 	    .ENTRY  DIR_SCAN, Save R2,R3,R4,R5,R6,R7,R8,R9,R10,R11	      ; 0415

		         5E 	       04  C2 00002 	    SUBL2   #4, SP						      ;

		         55 	  04   AC  D0 00005 	    MOVL    NAME_DESC, DN					      ; 0498

				       5B  D4 00009 	    CLRL    STATUS						      ; 0499

		         57 	  0C   AC  D0 0000B 	    MOVL    START_BLOCK, BLOCK					      ; 0500

		         54 	  10   AC  D0 0000F 	    MOVL    START_REC, ENTRY					      ; 0501

		         58 	  14   AC  D0 00013 	    MOVL    START_VER, P					      ; 0502

		         59 	0000G  CF  D0 00017 	    MOVL    DIR_RECORD, COUNT					      ; 0503

		         50 	0000G  CF  D0 0001C 	    MOVL    DIR_FCB, R0						      ; 0505

		    40   A0	       57  D1 00021 	    CMPL    BLOCK, 64(R0)					      ;

				       04  1B 00025 	    BLEQU   1$							      ;

		         57 	  40   A0  D0 00027 	    MOVL    64(R0), BLOCK					      ; 0506

		         51 	  48   A0  9E 0002B 1$:     MOVAB   72(R0), DIR_INDEX					      ; 0507

	   52 	    40   A0	       10  C1 0002F 	    ADDL3   #16, 64(R0), R2					      ; 0508

		         52 	       10  C6 00034 	    DIVL2   #16, K						      ;

	   53 	    40   A0	       01  C3 00037 	    SUBL3   #1, 64(R0), R3					      ; 0518

		         5A 	       53  D0 0003C 	    MOVL    R3, LAST_BLOCK					      ;

	   3B 	         65 	       05  E0 0003F 	    BBS     #5, (DN), 5$					      ; 0520

	   37 	         65 	       0B  E0 00043 	    BBS     #11, (DN), 5$					      ;

		         33 	  1E   A0  E9 00047 	    BLBC    30(R0), 5$						      ; 0521

		         5A 	  FF   A2  9E 0004B 	    MOVAB   -1(R2), LAST_BLOCK					      ; 0524

	   50 	         5A 	       52  C3 0004F 2$:     SUBL3   K, LAST_BLOCK, R0					      ; 0525

				       50  D6 00053 	    INCL    R0							      ;

		         50 	       52  C6 00055 	    DIVL2   K, R0						      ;

		    FF   8F	     6041  91 00058 	    CMPB    (R0)[DIR_INDEX], #255				      ;

				       07  13 0005D 	    BEQL    3$							      ;

		    08   B5	     6041  91 0005F 	    CMPB    (R0)[DIR_INDEX], @8(DN)				      ; 0526

				       09  1A 00064 	    BGTRU   4$							      ;

		         53 	       5A  D1 00066 3$:     CMPL    LAST_BLOCK, R3					      ; 0527

				       04  1E 00069 	    BGEQU   4$							      ;

				       5A  D6 0006B 	    INCL    LAST_BLOCK						      ; 0529

				       E0  11 0006D 	    BRB     2$							      ; 0525



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:13:21	DBB3:[F11B.SRC]DIRSCN.B32;10					Page 2-6

;

	   50 	         57 	       52  C7 0006F 4$:     DIVL3   K, BLOCK, R0					      ; 0531

		    08   B5	     6041  91 00073 	    CMPB    (R0)[DIR_INDEX], @8(DN)				      ;

				       04  1E 00078 	    BGEQU   5$							      ;

				       57  D6 0007A 	    INCL    BLOCK						      ; 0533

				       F1  11 0007C 	    BRB     4$							      ; 0531

		         5A 	       57  D1 0007E 5$:     CMPL    BLOCK, LAST_BLOCK					      ; 0542

				       45  1A 00081 	    BGTRU   11$							      ;

				       54  D5 00083 	    TSTL    ENTRY						      ; 0544

				       30  12 00085 	    BNEQ    8$							      ;

				       02  DD 00087 	    PUSHL   #2							      ; 0547

	   0C 	         65 	       05  E1 00089 	    BBC     #5, (DN), 6$					      ; 0548

	   08 	         65 	       04  E1 0008D 	    BBC     #4, (DN), 6$					      ; 0549

	   04 	         65 	       03  E1 00091 	    BBC     #3, (DN), 6$					      ; 0550

				       01  DD 00095 	    PUSHL   #1							      ; 0548

				       08  11 00097 	    BRB     7$							      ;

	   50 	         5A 	       57  C3 00099 6$:     SUBL3   BLOCK, LAST_BLOCK, R0				      ; 0552

				       50  D6 0009D 	    INCL    R0							      ;

				       50  DD 0009F 	    PUSHL   R0							      ; 0548

		         50 	0000G  CF  D0 000A1 7$:     MOVL    DIR_FCB, R0						      ; 0547

				  2C B047  9F 000A6 	    PUSHAB  @44(R0)[BLOCK]					      ;

		  0000G  CF	       03  FB 000AA 	    CALLS   #3, READ_BLOCK					      ;

		         54 	       50  D0 000AF 	    MOVL    R0, ENTRY						      ;

		  0000G  CF	       54  D0 000B2 	    MOVL    ENTRY, DIR_BUFFER					      ; 0554

		         6E 	       01  8E 000B7 8$:     MNEGB   #1, LAST_ENTRY					      ; 0562

		  FFFF   8F	       64  B1 000BA 9$:     CMPW    (ENTRY), #65535					      ; 0563

				       03  12 000BF 	    BNEQ    10$							      ;

				     00F7  31 000C1 	    BRW     27$							      ;

		    18   AC	       59  D1 000C4 10$:    CMPL    COUNT, REC_COUNT					      ; 0566

				       70  1E 000C8 11$:    BGEQU   17$							      ;

				       58  D5 000CA 	    TSTL    P							      ; 0567

				       0D  12 000CC 	    BNEQ    12$							      ;

		         50 	  05   A4  9A 000CE 	    MOVZBL  5(ENTRY), R0					      ; 0568

		         50 	  07 A044  9E 000D2 	    MOVAB   7(R0)[ENTRY], R0					      ;

	   58 	         50 	       01  CB 000D7 	    BICL3   #1, R0, P						      ;

	   5D 	         65 	       0B  E0 000DB 12$:    BBS     #11, (DN), 18$					      ; 0573

		         56 	  05   A4  9A 000DF 	    MOVZBL  5(ENTRY), C						      ; 0579

      06   A4	         56 	       2E  3A 000E3 	    LOCC    #46, C, 6(ENTRY)					      ; 0580

				       02  12 000E8 	    BNEQ    13$							      ;

				       51  D4 000EA 	    CLRL    R1							      ;

		         50 	       51  D0 000EC 13$:    MOVL    R1, CP						      ;

				       07  12 000EF 	    BNEQ    14$							      ; 0581

				0828   8F  BF 000F1 	    CHMU    #2088						      ; 0582

				     00FF  31 000F5 	    BRW     29$							      ;

	   1B 	         65 	       05  E1 000F8 14$:    BBC     #5, (DN), 15$					      ; 0584

	   3C 	         65 	       04  E0 000FC 	    BBS     #4, (DN), 18$					      ; 0587

	   51 	         56 	       54  C1 00100 	    ADDL3   ENTRY, C, R1					      ; 0590

		         51 	       50  C2 00104 	    SUBL2   CP, R1						      ;

		         51 	       06  C0 00107 	    ADDL2   #6, R1						      ;

	   00 	    08   B5	  04   A5  2D 0010A 	    CMPC5   4(DN), @8(DN), #0, R1, (CP)				      ; 0589

		         60 	       51     00110									      ;

				       28  13 00112 	    BEQL    18$							      ;

				     0087  31 00114 	    BRW     26$							      ;

	   07 	         65 	       04  E1 00117 15$:    BBC     #4, (DN), 16$					      ; 0595

		         50 	       54  C2 0011B 	    SUBL2   ENTRY, R0						      ; 0596

		         56 	  FB   A0  9E 0011E 	    MOVAB   -5(R0), C						      ;



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

;

	   00 	    08   B5	  04   A5  2D 00122 16$:    CMPC5   4(DN), @8(DN), #0, C, 6(ENTRY)			      ; 0597

		    06   A4	       56     00128									      ;

				       0F  13 0012B 	    BEQL    18$							      ;

	   00 	    08   B5	  04   A5  2D 0012D 	    CMPC5   4(DN), @8(DN), #0, C, 6(ENTRY)			      ; 0602

		    06   A4	       56     00133									      ;

				       66  1E 00136 	    BGEQU   26$							      ;

				       58  D4 00138 	    CLRL    P							      ; 0606

				       50  11 0013A 17$:    BRB     23$							      ; 0607

		         50 	       64  3C 0013C 18$:    MOVZWL  (ENTRY), R0						      ; 0622

		         50 	  02 A044  9E 0013F 	    MOVAB   2(R0)[ENTRY], R0					      ;

		         50 	       58  D1 00144 	    CMPL    P, R0						      ;

				       4C  1E 00147 	    BGEQU   25$							      ;

		    18   AC	       59  D1 00149 	    CMPL    COUNT, REC_COUNT					      ; 0625

				       3D  1E 0014D 	    BGEQU   23$							      ;

	   36 	         65 	       03  E0 0014F 	    BBS     #3, (DN), 22$					      ; 0627

	   32 	         65 	       09  E0 00153 	    BBS     #9, (DN), 22$					      ; 0628

	   08 	         65 	       0B  E1 00157 	    BBC     #11, (DN), 19$					      ; 0632

      02   A8	    08   BC	       06  29 0015B 	    CMPC3   #6, @FILE_ID, 2(P)					      ; 0633

				       24  11 00161 	    BRB     21$							      ;

		         51 	  0C   A5  32 00163 19$:    CVTWL   12(DN), R1						      ; 0635

				       16  12 00167 	    BNEQ    20$							      ;

	   11 	    04   A4	       07  E0 00169 	    BBS     #7, 4(ENTRY), 20$					      ; 0636

		         50 	  05   A4  9A 0016E 	    MOVZBL  5(ENTRY), R0					      ; 0638

		         50 	  07 A044  9E 00172 	    MOVAB   7(R0)[ENTRY], R0					      ;

		         50 	       01  CA 00177 	    BICL2   #1, R0						      ; 0637

		         50 	       58  D1 0017A 	    CMPL    P, R0						      ;

				       0A  13 0017D 	    BEQL    22$							      ;

		         51 	       68  B1 0017F 20$:    CMPW    (P), R1						      ; 0641

				       11  19 00182 	    BLSS    25$							      ;

		         51 	       68  B1 00184 	    CMPW    (P), R1						      ; 0644

				       05  12 00187 21$:    BNEQ    24$							      ;

		         5B 	       01  D0 00189 22$:    MOVL    #1, STATUS						      ; 0650

				       50  11 0018C 23$:    BRB     28$							      ; 0651

		         58 	       08  C0 0018E 24$:    ADDL2   #8, P						      ; 0654

				       59  D6 00191 	    INCL    COUNT						      ; 0655

				       A7  11 00193 	    BRB     18$							      ; 0622

				       65  B5 00195 25$:    TSTW    (DN)						      ; 0663

				       05  12 00197 	    BNEQ    26$							      ;

	   40 	    04   A4	       06  E1 00199 	    BBC     #6, 4(ENTRY), 28$					      ; 0664

		         6E 	  06   A4  90 0019E 26$:    MOVB    6(ENTRY), LAST_ENTRY				      ; 0669

				       54  DD 001A2 	    PUSHL   ENTRY						      ; 0670

		  0000V  CF	       01  FB 001A4 	    CALLS   #1, NEXT_REC					      ;

		         54 	       50  D0 001A9 	    MOVL    R0, ENTRY						      ;

	   50 	         54 	       58  C3 001AC 	    SUBL3   P, ENTRY, R0					      ; 0671

		         50 	       08  C6 001B0 	    DIVL2   #8, R0						      ;

		         59 	       50  C0 001B3 	    ADDL2   R0, COUNT						      ;

				       58  D4 001B6 	    CLRL    P							      ; 0672

				     FEFF  31 001B8 	    BRW     9$							      ; 0563

		         7E 	       6E  9A 001BB 27$:    MOVZBL  LAST_ENTRY, -(SP)					      ; 0682

				       57  DD 001BE 	    PUSHL   BLOCK						      ;

				       02  DD 001C0 	    PUSHL   #2							      ;

				       5E  DD 001C2 	    PUSHL   SP							      ;

				0000V  CF  9F 001C4 	    PUSHAB  UPDATE_IDX						      ;

	      00000000G  9F	       05  FB 001C8 	    CALLS   #5, @#SYS$CMKRNL					      ;

				       57  D6 001CF 	    INCL    BLOCK						      ; 0683



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:13:21	DBB3:[F11B.SRC]DIRSCN.B32;10					Page 2-8

;

				       54  D4 001D1 	    CLRL    ENTRY						      ; 0684

				       58  7C 001D3 	    CLRQ    P							      ; 0685

		         3F 	  18   AC  D1 001D5 	    CMPL    REC_COUNT, #63					      ; 0687

				       03  1F 001D9 	    BLSSU   28$							      ;

				     FEA0  31 001DB 	    BRW     5$							      ;

		  0000G  CF	  01   A7  9E 001DE 28$:    MOVAB   1(R7), DIR_VBN					      ; 0695

		  0000G  CF	       59  D0 001E4 	    MOVL    COUNT, DIR_RECORD					      ; 0696

		  0000G  CF	       54  D0 001E9 	    MOVL    ENTRY, DIR_ENTRY					      ; 0697

		  0000G  CF	       58  D0 001EE 	    MOVL    P, DIR_VERSION					      ; 0698

		         50 	       5B  D0 001F3 	    MOVL    STATUS, R0						      ; 0700

					   04 001F6 	    RET     							      ;

				       50  D4 001F7 29$:    CLRL    R0							      ; 0415

					   04 001F9 	    RET     							      ;



; Routine Size:  506 bytes







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

;

;	0703	GLOBAL ROUTINE NEXT_REC (ENTRY) =

;	0704	

;	0705	!++

;	0706	!

;	0707	! FUNCTIONAL DESCRIPTION:

;	0708	!

;	0709	!	This routine locates the next directory record and checks it for

;	0710	!	consistency.

;	0711	!

;	0712	!

;	0713	! CALLING SEQUENCE:

;	0714	!	NEXT_REC (ARG1)

;	0715	!

;	0716	! INPUT PARAMETERS:

;	0717	!	ARG1: address of present record

;	0718	!

;	0719	! IMPLICIT INPUTS:

;	0720	!	DIR_BUFFER: address of current directory block buffer

;	0721	!

;	0722	! OUTPUT PARAMETERS:

;	0723	!	NONE

;	0724	!

;	0725	! IMPLICIT OUTPUTS:

;	0726	!	NONE

;	0727	!

;	0728	! ROUTINE VALUE:

;	0729	!	address of next directory record

;	0730	!

;	0731	! SIDE EFFECTS:

;	0732	!	NONE

;	0733	!

;	0734	!--

;	0735	

;	0736	BEGIN

;	0737	

;	0738	MAP

;	0739		ENTRY		: REF BBLOCK;	! current directory record

;	0740	

;	0741	LOCAL

;	0742		NEXT_ENTRY	: REF BBLOCK;	! new directory record

;	0743	

;	0744	EXTERNAL

;	0745		DIR_BUFFER	: REF BBLOCK;	! address of current directory block

;	0746	

;	0747	! Find the next record by adding in the record size of the current entry.

;	0748	! The count field of the next entry must be either 65535 or be contained within

;	0749	! the block and even. Check the legality of the record type field.

;	0750	!

;	0751	

;	0752	IF .ENTRY[DIR$W_SIZE] LSSU DIR$C_LENGTH + DIR$C_VERSION

;	0753	THEN ERR_EXIT (SS$_BADIRECTORY);

;	0754	NEXT_ENTRY = .ENTRY + .ENTRY[DIR$W_SIZE] + 2;

;	0755	

;	0756	IF .NEXT_ENTRY[DIR$W_SIZE] NEQ 65535

;	0757	THEN



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

;

;	0758	    IF .NEXT_ENTRY<0,1>

;	0759	    OR .(NEXT_ENTRY[DIR$W_SIZE])<0,1>

;	0760	    OR .NEXT_ENTRY + .NEXT_ENTRY[DIR$W_SIZE] + 2 GEQA .DIR_BUFFER + 512

;	0761	    OR .NEXT_ENTRY[DIR$V_TYPE] NEQ DIR$C_FID

;	0762	    THEN ERR_EXIT (SS$_BADIRECTORY);

;	0763	

;	0764	RETURN .NEXT_ENTRY

;	0765	

;	0766	END;					! end of routine NEXT_REC











					 0004 001FA 	    .ENTRY  NEXT_REC, Save R2					      ; 0703

		         0E 	  04   BC  B1 001FC 	    CMPW    @ENTRY, #14						      ; 0752

				       35  1F 00200 	    BLSSU   1$							      ;

		         50 	  04   BC  3C 00202 	    MOVZWL  @ENTRY, R0						      ; 0754

		         50 	  04   AC  C0 00206 	    ADDL2   ENTRY, R0						      ;

		         50 	       02  C0 0020A 	    ADDL2   #2, NEXT_ENTRY					      ;

		         51 	       60  3C 0020D 	    MOVZWL  (NEXT_ENTRY), R1					      ; 0756

		  FFFF   8F	       51  B1 00210 	    CMPW    R1, #65535						      ;

				       26  13 00215 	    BEQL    2$							      ;

		         1D 	       50  E8 00217 	    BLBS    NEXT_ENTRY, 1$					      ; 0758

		         1A 	       60  E8 0021A 	    BLBS    (NEXT_ENTRY), 1$					      ; 0759

		         52 	  02 A140  9E 0021D 	    MOVAB   2(R1)[NEXT_ENTRY], R2				      ; 0760

	   51 	  0000G  CF 00000200   8F  C1 00222 	    ADDL3   #512, DIR_BUFFER, R1				      ;

		         51 	       52  D1 0022C 	    CMPL    R2, R1						      ;

				       06  1E 0022F 	    BGEQU   1$							      ;

		         07 	  04   A0  93 00231 	    BITB    4(NEXT_ENTRY), #7					      ; 0761

				       06  13 00235 	    BEQL    2$							      ;

				0828   8F  BF 00237 1$:     CHMU    #2088						      ; 0762

				       50  D4 0023B 	    CLRL    R0							      ; 0703

					   04 0023D 2$:     RET     							      ;



; Routine Size:  68 bytes







; Bliss-32 10.1-416	Monday 21-AUG-1978 23:13:21	DBB3:[F11B.SRC]DIRSCN.B32;10					Page 4

;

;	0767	GLOBAL ROUTINE UPDATE_IDX (BLOCK, CHARACTER) =

;	0768	

;	0769	!++

;	0770	!

;	0771	! FUNCTIONAL DESCRIPTION:

;	0772	!

;	0773	!	This routine updates the indicated cell in the directory file index.

;	0774	!

;	0775	!

;	0776	! CALLING SEQUENCE:

;	0777	!	UPDATE_IDX (ARG1, ARG2)

;	0778	!

;	0779	! INPUT PARAMETERS:

;	0780	!	ARG1: relative block number for which to update

;	0781	!	ARG2: character to be written

;	0782	!

;	0783	! IMPLICIT INPUTS:

;	0784	!	DIR_FCB: FCB of directory file to be updated

;	0785	!

;	0786	! OUTPUT PARAMETERS:

;	0787	!	NONE

;	0788	!

;	0789	! IMPLICIT OUTPUTS:

;	0790	!	NONE

;	0791	!

;	0792	! ROUTINE VALUE:

;	0793	!	1

;	0794	!

;	0795	! SIDE EFFECTS:

;	0796	!	directory index updated

;	0797	!

;	0798	!--

;	0799	

;	0800	BEGIN

;	0801	

;	0802	LOCAL

;	0803		K,				! cluster factor of directory index

;	0804		DIR_INDEX	: REF VECTOR [,BYTE]; ! pointer to index

;	0805	

;	0806	EXTERNAL

;	0807		DIR_FCB		: REF BBLOCK;	! FCB of directory file

;	0808	

;	0809	

;	0810	! Compute the cluster factor of the index. If the given block is the last

;	0811	! one in its cluster, update the corresponding entry.

;	0812	!

;	0813	

;	0814	DIR_INDEX = DIR_FCB[FCB$B_DIRIDX];

;	0815	K = (.DIR_FCB[FCB$L_EFBLK] + 1 + FCB$S_DIRIDX - 1) / FCB$S_DIRIDX;

;	0816	

;	0817	IF .DIR_FCB[FCB$V_DIR]

;	0818	AND (.BLOCK+1) MOD .K EQL 0

;	0819	THEN DIR_INDEX[.BLOCK/.K] = .CHARACTER;

;	0820	

;	0821	RETURN 1;



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:13:21	DBB3:[F11B.SRC]DIRSCN.B32;10					Page 4-1

;

;	0822	

;	0823	END;					! end of routine UPDATE_IDX











					 0004 0023E 	    .ENTRY  UPDATE_IDX, Save R2					      ; 0767

		         50 	0000G  CF  D0 00240 	    MOVL    DIR_FCB, R0						      ; 0814

		         52 	  48   A0  9E 00245 	    MOVAB   72(R0), DIR_INDEX					      ;

	   51 	    40   A0	       10  C1 00249 	    ADDL3   #16, 64(R0), R1					      ; 0815

		         51 	       10  C6 0024E 	    DIVL2   #16, K						      ;

		         1D 	  1E   A0  E9 00251 	    BLBC    30(R0), 1$						      ; 0817

	   50 	    04   AC	       01  C1 00255 	    ADDL3   #1, BLOCK, R0					      ; 0818

	   00 	         50 	       01  7A 0025A 	    EMUL    #1, R0, #0, -(SP)					      ;

				       7E     0025E									      ;

	   50 	         8E 	       51  7B 0025F 	    EDIV    K, (SP)+, R0, R0					      ;

				       50     00263									      ;

				       50  D5 00264 	    TSTL    R0							      ;

				       0A  12 00266 	    BNEQ    1$							      ;

	   50 	    04   AC	       51  C7 00268 	    DIVL3   K, BLOCK, R0					      ; 0819

		       6042 	  08   AC  90 0026D 	    MOVB    CHARACTER, (R0)[DIR_INDEX]				      ;

		         50 	       01  D0 00272 1$:     MOVL    #1, R0						      ; 0821

					   04 00275 	    RET     							      ; 0767



; Routine Size:  56 bytes





;	0824	

;	0825	END

;	0826	ELUDOM













;				       PSECT SUMMARY

;

;	Name		 Bytes			       Attributes

;

;  $CODE$         	   630  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        25         0       231









; Bliss-32 10.1-416	Monday 21-AUG-1978 23:13:21	DBB3:[F11B.SRC]DIRSCN.B32;10					Page 4-2

;





; Size:		630 code + 0 data bytes

; Run Time:	00:15.4

; Elapsed Time:	00:29.9

; Memory Used:	380 pages

; Compilation Complete

