

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

; Digital Equipment Corporation

;

;	0001	MODULE MWTUR2 (

;	0002			LANGUAGE (BLISS32),

;	0003			IDENT = 'X0007'

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

;	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:59	DBB3:[MOUNT.SRC]MWTUR2.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, 21-Nov-1977  16:43

;	0062	!   X0006 - Modify for structure level 2

;	0063	!

;	0064	!   Andrew C. Goldstein, 9-Jan-1978  17:28

;	0065	!   X0007 - Fix edge condition of VBN 0 in first header

;	0066	!

;	0067	!**

;	0068	

;	0069	

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

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

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



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

; Digital Equipment Corporation

;

;	0478	GLOBAL ROUTINE TURN_WINDOW2 (WINDOW, HEADER, DESIRED_VBN, START_VBN) =

;	0479	

;	0480	!++

;	0481	!

;	0482	! FUNCTIONAL DESCRIPTION:

;	0483	!

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

;	0485	!	and builds retrieval pointers in the window until

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

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

;	0488	!

;	0489	! CALLING SEQUENCE:

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

;	0491	!

;	0492	! INPUT PARAMETERS:

;	0493	!	ARG1: address of window block

;	0494	!	ARG2: address of file header

;	0495	!	ARG3: desired VBN

;	0496	!	ARG4: starting VBN of file header

;	0497	!

;	0498	! IMPLICIT INPUTS:

;	0499	!	NONE

;	0500	!

;	0501	! OUTPUT PARAMETERS:

;	0502	!	updated window

;	0503	!

;	0504	! IMPLICIT OUTPUTS:

;	0505	!	NONE

;	0506	!

;	0507	! ROUTINE VALUE:

;	0508	!	1

;	0509	!

;	0510	! SIDE EFFECTS:

;	0511	!	NONE

;	0512	!

;	0513	!--

;	0514	

;	0515	BEGIN

;	0516	

;	0517	MAP

;	0518		WINDOW		: REF BBLOCK,	! pointer to window

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

;	0520	

;	0521	LINKAGE

;	0522		L_MAP_POINTER	= JSB :

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

;	0524	

;	0525	GLOBAL REGISTER

;	0526		COUNT		= 6,		! retrieval pointer count

;	0527		LBN		= 7,		! retrieval pointer start LBN

;	0528		MAP_POINTER	= 8 : REF BBLOCK; ! pointer to scan header map area

;	0529	

;	0530	LABEL

;	0531		MAP_BUILD;			! loop to build window map

;	0532	



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

; Digital Equipment Corporation

;

;	0533	LOCAL

;	0534		VBN,				! VBN in scanning window

;	0535		COUNTER,			! loop counter

;	0536		W_POINTER	: REF BBLOCK;	! pointer to scan window

;	0537	

;	0538	MACRO

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

;	0540	

;	0541	EXTERNAL ROUTINE

;	0542		GET_MAP_POINTER	: L_MAP_POINTER; ! get value of next header map pointer

;	0543	

;	0544	! Scan the window looking for the starting VBN of the header. If it is

;	0545	! contained within the window, truncate the window so that it maps exactly

;	0546	! up to the start of the header. If the starting VBN is not contained in the

;	0547	! window, the entire window must be discarded. However, if the desired VBN

;	0548	! precedes the header start VBN, we do nothing since the window is already

;	0549	! best effort.

;	0550	!

;	0551	

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

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

;	0554	

;	0555	IF .START_VBN LEQU .VBN

;	0556	OR

;	0557	    BEGIN

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

;	0559	    DO

;	0560		BEGIN

;	0561		VBN = .VBN + .W_POINTER[WCB$W_COUNT];	! VBN at end of this pointer

;	0562		W_POINTER = .W_POINTER + 6;

;	0563		IF.START_VBN EQL .VBN

;	0564		THEN

;	0565		    BEGIN

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

;	0567		    EXITLOOP 0;

;	0568		    END;

;	0569		END

;	0570	    END

;	0571	

;	0572	THEN						! header VBN is not in window

;	0573	    BEGIN

;	0574	    IF .DESIRED_VBN LSSU .START_VBN

;	0575	    AND .START_VBN GTRU 1

;	0576	    THEN

;	0577		RETURN 1				! leave it alone

;	0578	    ELSE

;	0579		BEGIN

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

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

;	0582		W_POINTER = WINDOW_MAP;			! point to first pointer

;	0583		END;

;	0584	    END;

;	0585	

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

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



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

; Digital Equipment Corporation

;

;	0588	!

;	0589	

;	0590	MAP_POINTER = .HEADER + .HEADER[FH2$B_MPOFFSET]*2;	! point to map area

;	0591	

;	0592	MAP_BUILD: BEGIN

;	0593	UNTIL .MAP_POINTER GEQA .HEADER + (.HEADER[FH2$B_MPOFFSET] + .HEADER[FH2$B_MAP_INUSE]) * 2

;	0594	DO

;	0595	    BEGIN

;	0596	

;	0597	    GET_MAP_POINTER ();

;	0598	

;	0599	! Build new retrieval pointers, using as many as needed to run out the

;	0600	! count. If the window is full, shuffle the entries up by one. If this

;	0601	! would cause the pointer mapping the  desired VBN to fall off the top,

;	0602	! we are done.

;	0603	!

;	0604	

;	0605	    IF .COUNT NEQ 0

;	0606	    THEN

;	0607		WHILE 1 DO

;	0608		BEGIN

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

;	0610		    GTRU .WINDOW[WCB$W_SIZE]

;	0611		THEN

;	0612		    BEGIN

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

;	0614		    THEN LEAVE MAP_BUILD;

;	0615	

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

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

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

;	0619		    W_POINTER = .W_POINTER - 6;

;	0620		    END;

;	0621	

;	0622	! Finally build the pointer and count it.

;	0623	!

;	0624	

;	0625		W_POINTER[WCB$W_COUNT] = MINU (.COUNT, 65535);

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

;	0627		W_POINTER = .W_POINTER + 6;

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

;	0629		LBN = .LBN + 65535;

;	0630		COUNT = .COUNT - MINU (.COUNT, 65535);

;	0631		IF .COUNT EQL 0 THEN EXITLOOP;

;	0632		END;

;	0633	

;	0634	    END;					! end of header scan loop

;	0635	END;						! end of block MAP_BUILD

;	0636	

;	0637	RETURN 1;

;	0638	

;	0639	END;						! end of routine TURN_WINDOW2





							    .TITLE  MWTUR2



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

; Digital Equipment Corporation

;

							    .IDENT  \X0007\



							    .GLOBL  GET_MAP_POINTER



							    .PSECT  $CODE$,NOWRT,2



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

		         59	  04   AC  D0 00002 	    MOVL    WINDOW, R9						      ; 0552

	   7E	         59	       24  C1 00006 	    ADDL3   #36, R9, -(SP)					      ;

				       6E  DD 0000A 	    PUSHL   (SP)						      ;

		         52	  20   A9  D0 0000C 	    MOVL    32(R9), VBN						      ; 0553

		         50	  10   AC  D0 00010 	    MOVL    START_VBN, R0					      ; 0555

		         52	       50  D1 00014 	    CMPL    R0, VBN						      ;

				       21  1B 00017 	    BLEQU   3$							      ;

		         53	  16   A9  3C 00019 	    MOVZWL  22(R9), R3						      ; 0558

				       51  D4 0001D 	    CLRL    J							      ;

				       15  11 0001F 	    BRB     2$							      ;

		         54	  00   BE  3C 00021 1$:     MOVZWL  @W_POINTER, R4					      ; 0561

		         52	       54  C0 00025 	    ADDL2   R4, VBN						      ;

		         6E	       06  C0 00028 	    ADDL2   #6, W_POINTER					      ; 0562

		         52	       50  D1 0002B 	    CMPL    R0, VBN						      ; 0563

				       06  12 0002E 	    BNEQ    2$							      ;

		    16   A9	       51  B0 00030 	    MOVW    J, 22(R9)						      ; 0566

				       1A  11 00034 	    BRB     5$							      ; 0567

	   E7	         51	       53  F3 00036 2$:     AOBLEQ  R3, J, 1$						      ; 0558

		         50	  0C   AC  D1 0003A 3$:     CMPL    DESIRED_VBN, R0					      ; 0574

				       05  1E 0003E 	    BGEQU   4$							      ;

		         01	       50  D1 00040 	    CMPL    R0, #1						      ; 0575

				       53  1A 00043 	    BGTRU   8$							      ;

				  16   A9  B4 00045 4$:     CLRW    22(R9)						      ; 0580

		    20   A9	       50  D0 00048 	    MOVL    R0, 32(R9)						      ; 0581

		         6E	  04   AE  D0 0004C 	    MOVL    4(SP), W_POINTER					      ; 0582

		         5B	  08   AC  D0 00050 5$:     MOVL    HEADER, R11						      ; 0590

		         50	  01   AB  9A 00054 	    MOVZBL  1(R11), R0						      ;

		         58	     6B40  3E 00058 	    MOVAW   (R11)[R0], MAP_POINTER				      ;

		         50	  01   AB  9A 0005C 6$:     MOVZBL  1(R11), R0						      ; 0593

		         51	  3A   AB  9A 00060 	    MOVZBL  58(R11), R1						      ;

		         50	       51  C0 00064 	    ADDL2   R1, R0						      ;

		         50	     6B40  3E 00067 	    MOVAW   (R11)[R0], R0					      ;

		         50	       58  D1 0006B 	    CMPL    MAP_POINTER, R0					      ;

				       77  1E 0006E 	    BGEQU   11$							      ;

				     0000  30 00070 	    BSBW    GET_MAP_POINTER					      ; 0597

				       56  D5 00073 	    TSTL    COUNT						      ; 0605

				       E5  13 00075 	    BEQL    6$							      ;

		         5A	  16   A9  9E 00077 	    MOVAB   22(R9), R10						      ; 0609

		         50	       6A  3C 0007B 7$:     MOVZWL  (R10), R0						      ;

		         50	       06  C4 0007E 	    MULL2   #6, R0						      ;

		         50	       2A  C0 00081 	    ADDL2   #42, R0						      ;

      08   A9	         10	       00  ED 00084 	    CMPZV   #0, #16, 8(R9), R0					      ; 0610

				       50     00089									      ;

				       2B  1E 0008A 	    BGEQU   9$							      ;

		         50	  04   BE  3C 0008C 	    MOVZWL  @4(SP), R0						      ; 0613

		         50	  20   A9  C0 00090 	    ADDL2   32(R9), R0						      ;

		    0C   AC	       50  D1 00094 	    CMPL    R0, DESIRED_VBN					      ;

				       4D  1A 00098 8$:     BGTRU   11$							      ;



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

; Digital Equipment Corporation

;

				       6A  B7 0009A 	    DECW    (R10)						      ; 0616

		         50	  04   BE  3C 0009C 	    MOVZWL  @4(SP), R0						      ; 0617

		    20   A9	       50  C0 000A0 	    ADDL2   R0, 32(R9)						      ;

		         50	       6A  3C 000A4 	    MOVZWL  (R10), R0						      ; 0618

		         50	       06  C4 000A7 	    MULL2   #6, R0						      ;

	   7E	    04   AE	       06  C1 000AA 	    ADDL3   #6, 4(SP), -(SP)					      ;

      04   BE	         9E	       50  28 000AF 	    MOVC3   R0, @(SP)+, @4(SP)					      ;

		         6E	       06  C2 000B4 	    SUBL2   #6, W_POINTER					      ; 0619

		         50	       56  D0 000B7 9$:     MOVL    COUNT, R0						      ; 0625

	      0000FFFF   8F	       50  D1 000BA 	    CMPL    R0, #65535						      ;

				       05  1B 000C1 	    BLEQU   10$							      ;

		         50	FFFF   8F  3C 000C3 	    MOVZWL  #65535, R0						      ;

		    00   BE	       50  B0 000C8 10$:    MOVW    R0, @W_POINTER					      ;

	   51	         6E	       02  C1 000CC 	    ADDL3   #2, W_POINTER, R1					      ; 0626

		         61	       57  D0 000D0 	    MOVL    LBN, (R1)						      ;

		         6E	       06  C0 000D3 	    ADDL2   #6, W_POINTER					      ; 0627

				       6A  B6 000D6 	    INCW    (R10)						      ; 0628

		         57 0000FFFF   E7  9E 000D8 	    MOVAB   65535(R7), LBN					      ; 0629

		         56	       50  C2 000DF 	    SUBL2   R0, COUNT						      ; 0630

				       97  12 000E2 	    BNEQ    7$							      ; 0631

				     FF75  31 000E4 	    BRW     6$							      ;

		         50	       01  D0 000E7 11$:    MOVL    #1, R0						      ; 0637

					   04 000EA 	    RET     							      ; 0478



; Routine Size:  235 bytes





;	0640	

;	0641	END

;	0642	ELUDOM













;				       PSECT SUMMARY

;

;	Name		 Bytes			       Attributes

;

;  $CODE$         	   235  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        14         0       229











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

; Digital Equipment Corporation

;



; Size:		235 code + 0 data bytes

; Run Time:	00:16.1

; Elapsed Time:	00:39.8

; Memory Used:	316 pages

; Compilation Complete

