

; Bliss-32 7.352	Saturday 22-AUG-1978 00:09:18	DBB3:[MOUNT.SRC]MWTUR1.B32;8					Page 1

; Digital Equipment Corporation

;

;	0001	MODULE MWTUR1 (

;	0002			LANGUAGE (BLISS32),

;	0003			IDENT = 'X0006'

;	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:  MOUNT Utility Structure Level 1

;	0029	!

;	0030	! ABSTRACT:

;	0031	!

;	0032	!	This module generates a window mapping the desired VBN from

;	0033	!	the supplied file header. This module is a direct crib from the

;	0034	!	FCP module WITURN. When we get conditional compilation with different

;	0035	!	parameter files worked out, they should really be the same source.

;	0036	!

;	0037	! ENVIRONMENT:

;	0038	!

;	0039	!	STARLET operating system, including privileged system services

;	0040	!	and internal exec routines.

;	0041	!

;	0042	!--

;	0043	!

;	0044	!

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

;	0046	!

;	0047	! REVISION HISTORY:

;	0048	!

;	0049	!   Andrew C. Goldstein, 17-Mar-1977  16:53

;	0050	!   X0002 - Add system interlock while turning window

;	0051	!

;	0052	!   Andrew C. Goldstein, 26-Apr-1977  11:36

;	0053	!   X0003 - Move code to locked down PSECT

;	0054	!

;	0055	!   Andrew C. Goldstein, 21-Jul-1977  15:17



; Bliss-32 7.352	Saturday 22-AUG-1978 00:09:18	DBB3:[MOUNT.SRC]MWTUR1.B32;8					Page 1-1

; Digital Equipment Corporation

;

;	0056	!   X0004 - Add multi-header code

;	0057	!

;	0058	!   Andrew C. Goldstein, 18-Oct-1977  11:29

;	0059	!   X0005 - Remove interlocks for use in MOUNT

;	0060	!

;	0061	!   Andrew C. Goldstein, 9-Jan-1978  17:27

;	0062	!   X0006 - Fix edge condition of VBN 0 on first header

;	0063	!

;	0064	!**

;	0065	

;	0066	

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

;	0068	REQUIRE 'SRC$:MOUDEF.B32';

;	0375	REQUIRE 'LIBD$:[VMSLIB.OBJ]MOUNTMSG.B32';



; Bliss-32 7.352	Saturday 22-AUG-1978 00:09:18	DBB3:[MOUNT.SRC]MWTUR1.B32;8					Page 2

; Digital Equipment Corporation

;

;	0475	GLOBAL ROUTINE TURN_WINDOW1 (WINDOW, HEADER, DESIRED_VBN, START_VBN) =

;	0476	

;	0477	!++

;	0478	!

;	0479	! FUNCTIONAL DESCRIPTION:

;	0480	!

;	0481	!	This routine scans the map area of the supplied file header

;	0482	!	and builds retrieval pointers in the window until

;	0483	!	(1) the entire header has been scanned, or

;	0484	!	(2) the first retrieval pointer in the window maps the desired VBN

;	0485	!

;	0486	! CALLING SEQUENCE:

;	0487	!	TURN_WINDOW (ARG1, ARG2, ARG3, ARG4)

;	0488	!

;	0489	! INPUT PARAMETERS:

;	0490	!	ARG1: address of window block

;	0491	!	ARG2: address of file header

;	0492	!	ARG3: desired VBN

;	0493	!	ARG4: starting VBN of file header

;	0494	!

;	0495	! IMPLICIT INPUTS:

;	0496	!	NONE

;	0497	!

;	0498	! OUTPUT PARAMETERS:

;	0499	!	updated window

;	0500	!

;	0501	! IMPLICIT OUTPUTS:

;	0502	!	NONE

;	0503	!

;	0504	! ROUTINE VALUE:

;	0505	!	1

;	0506	!

;	0507	! SIDE EFFECTS:

;	0508	!	NONE

;	0509	!

;	0510	!--

;	0511	

;	0512	BEGIN

;	0513	

;	0514	MAP

;	0515		WINDOW		: REF BBLOCK,	! pointer to window

;	0516		HEADER		: REF BBLOCK;	! pointer to file header

;	0517	

;	0518	LOCAL

;	0519		VBN,				! VBN in scanning window

;	0520		COUNT,				! retrieval pointer count

;	0521		COUNTER,			! loop counter

;	0522		LBN,				! retrieval pointer start LBN

;	0523		W_POINTER	: REF BBLOCK,	! pointer to scan window

;	0524		M_POINTER	: REF BBLOCK,	! pointer to scan header map area

;	0525		MAP_AREA	: REF BBLOCK;	! pointer to start of header map area

;	0526	

;	0527	MACRO

;	0528		WINDOW_MAP	= (.WINDOW+WCB$C_MAP)%;	!start of window map area

;	0529	



; Bliss-32 7.352	Saturday 22-AUG-1978 00:09:18	DBB3:[MOUNT.SRC]MWTUR1.B32;8					Page 2-1

; Digital Equipment Corporation

;

;	0530	! Scan the window looking for the

;	0531	! starting VBN of the header. If it is contained within the window, truncate

;	0532	! the window so that it maps exactly up to the start of the header.

;	0533	! If the starting VBN is not contained in the window, the entire window must be

;	0534	! discarded. However, if the desired VBN precedes the header start VBN, we

;	0535	! do nothing since the window is already best effort.

;	0536	!

;	0537	

;	0538	W_POINTER = WINDOW_MAP;				! point to first retrieval pointer

;	0539	VBN = .WINDOW[WCB$L_STVBN];			! get starting VBN of window

;	0540	

;	0541	IF

;	0542	    BEGIN

;	0543	    INCR J FROM 1 TO .WINDOW[WCB$W_NMAP]

;	0544	    DO

;	0545		IF .VBN + .W_POINTER[WCB$W_COUNT] LSSU .START_VBN

;	0546		THEN

;	0547		    BEGIN

;	0548		    VBN = .VBN + .W_POINTER[WCB$W_COUNT];	! accumulate running VBN

;	0549		    W_POINTER = .W_POINTER + 6;		! and move to next pointer

;	0550		    END

;	0551		ELSE					! VBN is in or precedes current pointer

;	0552		    BEGIN

;	0553		    IF .VBN LSSU .START_VBN

;	0554		    THEN

;	0555			BEGIN

;	0556			W_POINTER[WCB$W_COUNT] = .START_VBN - .VBN;

;	0557			W_POINTER = .W_POINTER + 6;	! bump the pointer

;	0558			WINDOW[WCB$W_NMAP] = .J;	! truncate the window

;	0559			EXITLOOP 0;

;	0560			END

;	0561		    ELSE

;	0562			EXITLOOP -1;			! precedes the window

;	0563		    END

;	0564	    END

;	0565	

;	0566	THEN						! header VBN is not in window

;	0567	    BEGIN

;	0568	    IF .DESIRED_VBN LSSU .START_VBN

;	0569	    AND .START_VBN GTRU 1

;	0570	    THEN

;	0571		RETURN 1				! leave it alone

;	0572	    ELSE

;	0573		BEGIN

;	0574		WINDOW[WCB$W_NMAP] = 0;			! flush the window

;	0575		WINDOW[WCB$L_STVBN] = .START_VBN;

;	0576		W_POINTER = WINDOW_MAP;			! point to first pointer

;	0577		END;

;	0578	    END;

;	0579	

;	0580	! The window is now suitably initialized. Set up necessary pointers.

;	0581	! Now scan the map area, extracting retrieval pointers.

;	0582	!

;	0583	

;	0584	MAP_AREA = .HEADER + .HEADER[FH1$B_MPOFFSET]*2;	! point to map area



; Bliss-32 7.352	Saturday 22-AUG-1978 00:09:18	DBB3:[MOUNT.SRC]MWTUR1.B32;8					Page 2-2

; Digital Equipment Corporation

;

;	0585	M_POINTER = .MAP_AREA + FM1$C_POINTERS;		! point to start of pointers

;	0586	

;	0587	DECR COUNTER FROM .MAP_AREA[FM1$B_INUSE]/2 TO 1 DO

;	0588	    BEGIN

;	0589	

;	0590	    COUNT = .M_POINTER[FM1$B_COUNT] + 1;		! get retrieval pointer count

;	0591	    LBN = .M_POINTER[FM1$W_LOWLBN];			! low order LBN

;	0592	    LBN<16,8> = .M_POINTER[FM1$B_HIGHLBN];		! and high order LBN

;	0593	    M_POINTER = .M_POINTER + 4;			! update map pointer

;	0594	

;	0595	! See if this set of blocks is contiguous with the preceding (in the

;	0596	! window). If so, merge them.

;	0597	!

;	0598	

;	0599	    IF .WINDOW[WCB$W_NMAP] NEQ 0	! only if non-empty window

;	0600		AND .W_POINTER[WCB$W_PREVCOUNT] + .W_POINTER[WCB$L_PREVLBN] EQL .LBN

;	0601		AND .W_POINTER[WCB$W_PREVCOUNT] + .COUNT LSSU 65536

;	0602	    THEN W_POINTER[WCB$W_PREVCOUNT] = .W_POINTER[WCB$W_PREVCOUNT] + .COUNT

;	0603	

;	0604	! Build a new retrieval pointer. If the window is full, shuffle the

;	0605	! entries up by one. If this would cause the pointer mapping the 

;	0606	! desired VBN to fall off the top, we are done.

;	0607	!

;	0608	

;	0609	    ELSE

;	0610		BEGIN

;	0611		IF (.WINDOW[WCB$W_NMAP]+1)*6 + WCB$C_LENGTH

;	0612		    GTRU .WINDOW[WCB$W_SIZE]

;	0613		THEN

;	0614		    BEGIN

;	0615		    IF .WINDOW[WCB$L_STVBN] + .WINDOW[WCB$W_P1_COUNT] GTRU .DESIRED_VBN

;	0616		    THEN EXITLOOP;

;	0617	

;	0618		    WINDOW[WCB$W_NMAP] = .WINDOW[WCB$W_NMAP] - 1;

;	0619		    WINDOW[WCB$L_STVBN] = .WINDOW[WCB$L_STVBN] + .WINDOW[WCB$W_P1_COUNT];

;	0620		    CH$MOVE (.WINDOW[WCB$W_NMAP]*6, WINDOW_MAP+6, WINDOW_MAP);

;	0621		    W_POINTER = .W_POINTER - 6;

;	0622		    END;

;	0623	

;	0624	! Finally build the pointer and count it.

;	0625	!

;	0626	

;	0627		W_POINTER[WCB$W_COUNT] = .COUNT;

;	0628		W_POINTER[WCB$L_LBN] = .LBN;

;	0629		W_POINTER = .W_POINTER + 6;

;	0630		WINDOW[WCB$W_NMAP] = .WINDOW[WCB$W_NMAP] + 1;

;	0631		END;

;	0632	

;	0633	    END;					! end of header scan loop

;	0634	

;	0635	RETURN 1;

;	0636	

;	0637	END;						! end of routine TURN_WINDOW1







; Bliss-32 7.352	Saturday 22-AUG-1978 00:09:18	DBB3:[MOUNT.SRC]MWTUR1.B32;8					Page 2-3

; Digital Equipment Corporation

;

							    .TITLE  MWTUR1

							    .IDENT  \X0006\







							    .PSECT  $CODE$,NOWRT,2



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

		         5E	       08  C2 00002 	    SUBL2   #8, SP						      ;

		         57	  04   AC  D0 00005 	    MOVL    WINDOW, R7						      ; 0538

	   5A	         57	       24  C1 00009 	    ADDL3   #36, R7, R10					      ;

		         56	       5A  D0 0000D 	    MOVL    R10, W_POINTER					      ;

		         51	  20   A7  D0 00010 	    MOVL    32(R7), VBN						      ; 0539

		         58	  16   A7  9E 00014 	    MOVAB   22(R7), R8						      ; 0543

		         54	       68  3C 00018 	    MOVZWL  (R8), R4						      ;

		         50	  10   AC  D0 0001B 	    MOVL    START_VBN, R0					      ; 0545

				       53  D4 0001F 	    CLRL    J							      ; 0543

				       27  11 00021 	    BRB     3$							      ;

		         52	       66  3C 00023 1$:     MOVZWL  (W_POINTER), R2					      ; 0545

		         52	       51  C0 00026 	    ADDL2   VBN, R2						      ;

		         50	       52  D1 00029 	    CMPL    R2, R0						      ;

				       0B  1E 0002C 	    BGEQU   2$							      ;

		         52	       86  3C 0002E 	    MOVZWL  (W_POINTER)+, R2					      ; 0548

		         51	       52  C0 00031 	    ADDL2   R2, VBN						      ;

		         56	       04  C0 00034 	    ADDL2   #4, W_POINTER					      ; 0549

				       11  11 00037 	    BRB     3$							      ; 0545

		         50	       51  D1 00039 2$:     CMPL    VBN, R0						      ; 0553

				       10  1E 0003C 	    BGEQU   4$							      ;

	   86	         50	       51  A3 0003E 	    SUBW3   VBN, R0, (W_POINTER)+				      ; 0556

		         56	       04  C0 00042 	    ADDL2   #4, W_POINTER					      ; 0557

		         68	       53  B0 00045 	    MOVW    J, (R8)						      ; 0558

				       18  11 00048 	    BRB     6$							      ; 0559

	   D5	         53	       54  F3 0004A 3$:     AOBLEQ  R4, J, 1$						      ; 0543

		         50	  0C   AC  D1 0004E 4$:     CMPL    DESIRED_VBN, R0					      ; 0568

				       05  1E 00052 	    BGEQU   5$							      ;

		         01	       50  D1 00054 	    CMPL    R0, #1						      ; 0569

				       7B  1A 00057 	    BGTRU   9$							      ;

				       68  B4 00059 5$:     CLRW    (R8)						      ; 0574

		    20   A7	       50  D0 0005B 	    MOVL    R0, 32(R7)						      ; 0575

		         56	       5A  D0 0005F 	    MOVL    R10, W_POINTER					      ; 0576

		         51	  08   AC  D0 00062 6$:     MOVL    HEADER, R1						      ; 0584

		         50	  01   A1  9A 00066 	    MOVZBL  1(R1), R0						      ;

		         50	     6140  3E 0006A 	    MOVAW   (R1)[R0], MAP_AREA					      ;

	   59	         50	       0A  C1 0006E 	    ADDL3   #10, MAP_AREA, M_POINTER				      ; 0585

		         51	  08   A0  9A 00072 	    MOVZBL  8(MAP_AREA), R1					      ; 0587

      04   AE	         51	       02  C7 00076 	    DIVL3   #2, R1, 4(SP)					      ;

				  04   AE  D6 0007B 	    INCL    COUNTER						      ;

				       75  11 0007E 	    BRB     11$							      ;

		         5B	  01   A9  9A 00080 7$:     MOVZBL  1(M_POINTER), COUNT					      ; 0590

				       5B  D6 00084 	    INCL    COUNT						      ;

		         6E	  02   A9  3C 00086 	    MOVZWL  2(M_POINTER), LBN					      ; 0591

		    02   AE	       89  90 0008A 	    MOVB    (M_POINTER)+, LBN					      ; 0592

		         59	       03  C0 0008E 	    ADDL2   #3, M_POINTER					      ; 0593

				       68  B5 00091 	    TSTW    (R8)						      ; 0599

				       23  13 00093 	    BEQL    8$							      ;



; Bliss-32 7.352	Saturday 22-AUG-1978 00:09:18	DBB3:[MOUNT.SRC]MWTUR1.B32;8					Page 2-4

; Digital Equipment Corporation

;

		         50	  FA   A6  3C 00095 	    MOVZWL  -6(W_POINTER), R0					      ; 0600

		         50	  FC   A6  C0 00099 	    ADDL2   -4(W_POINTER), R0					      ;

		         6E	       50  D1 0009D 	    CMPL    R0, LBN						      ;

				       16  12 000A0 	    BNEQ    8$							      ;

		         50	  FA   A6  3C 000A2 	    MOVZWL  -6(W_POINTER), R0					      ; 0601

		         50	       5B  C0 000A6 	    ADDL2   COUNT, R0						      ;

	      00010000   8F	       50  D1 000A9 	    CMPL    R0, #65536						      ;

				       06  1E 000B0 	    BGEQU   8$							      ;

		    FA   A6	       5B  A0 000B2 	    ADDW2   COUNT, -6(W_POINTER)				      ; 0602

				       3D  11 000B6 	    BRB     11$							      ; 0599

		         50	       68  3C 000B8 8$:     MOVZWL  (R8), R0						      ; 0611

		         50	       06  C4 000BB 	    MULL2   #6, R0						      ;

		         50	       2A  C0 000BE 	    ADDL2   #42, R0						      ;

      08   A7	         10	       00  ED 000C1 	    CMPZV   #0, #16, 8(R7), R0					      ; 0612

				       50     000C6									      ;

				       24  1E 000C7 	    BGEQU   10$							      ;

		         50	       6A  3C 000C9 	    MOVZWL  (R10), R0						      ; 0615

		         50	  20   A7  C0 000CC 	    ADDL2   32(R7), R0						      ;

		    0C   AC	       50  D1 000D0 	    CMPL    R0, DESIRED_VBN					      ;

				       23  1A 000D4 9$:     BGTRU   12$							      ;

				       68  B7 000D6 	    DECW    (R8)						      ; 0618

		         50	       6A  3C 000D8 	    MOVZWL  (R10), R0						      ; 0619

		    20   A7	       50  C0 000DB 	    ADDL2   R0, 32(R7)						      ;

		         50	       68  3C 000DF 	    MOVZWL  (R8), R0						      ; 0620

		         50	       06  C4 000E2 	    MULL2   #6, R0						      ;

	   6A	    06   AA	       50  28 000E5 	    MOVC3   R0, 6(R10), (R10)					      ;

		         56	       06  C2 000EA 	    SUBL2   #6, W_POINTER					      ; 0621

		         86	       5B  B0 000ED 10$:    MOVW    COUNT, (W_POINTER)+					      ; 0627

		         86	       6E  D0 000F0 	    MOVL    LBN, (W_POINTER)+					      ; 0628

				       68  B6 000F3 	    INCW    (R8)						      ; 0630

		         87	  04   AE  F5 000F5 11$:    SOBGTR  COUNTER, 7$						      ; 0587

		         50	       01  D0 000F9 12$:    MOVL    #1, R0						      ; 0635

					   04 000FC 	    RET     							      ; 0475



; Routine Size:  253 bytes





;	0638	END

;	0639	ELUDOM













;				       PSECT SUMMARY

;

;	Name		 Bytes			       Attributes

;

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









;				LIBRARY STATISTICS



; Bliss-32 7.352	Saturday 22-AUG-1978 00:09:18	DBB3:[MOUNT.SRC]MWTUR1.B32;8					Page 2-5

; Digital Equipment Corporation

;

;

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

;	File				     Total    Loaded   Percent      Read

;

;  DBA4:[SYSLIB]LIB.L32;1		      5582        20         0       229











; Size:		253 code + 0 data bytes

; Run Time:	00:17.4

; Elapsed Time:	00:39.5

; Memory Used:	333 pages

; Compilation Complete

