

; Bliss-32 10.1-416	Monday 21-AUG-1978 23:00:37	DBB3:[F11A.SRC]MAPVBN.B32;7					Page 1

;

;	0001	MODULE MAPVBN (

;	0002			LANGUAGE (BLISS32),

;	0003			IDENT = 'A0003'

;	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 maps the specified virtual blocks to their

;	0033	!	corresponding logical blocks using the supplied window.

;	0034	!	The window is turned if necessary.

;	0035	!

;	0036	! ENVIRONMENT:

;	0037	!

;	0038	!	STARLET operating system, including privileged system services

;	0039	!	and internal exec routines.

;	0040	!

;	0041	!--

;	0042	!

;	0043	!

;	0044	! AUTHOR:  Andrew C. Goldstein,	 CREATION DATE:  3-Mar-1977  12:20

;	0045	!

;	0046	! REVISION HISTORY:

;	0047	!

;	0048	!   Andrew C. Goldstein, 22-Jul-1977  11:24

;	0049	!   X0002 - Add multi-header support

;	0050	!

;	0051	!   Andrew C. Goldstein, 12-Dec-1977  13:50

;	0052	!   X0003 - file ID interface changes

;	0053	!

;	0054	!**

;	0055	



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:00:37	DBB3:[F11A.SRC]MAPVBN.B32;7					Page 1-1

;

;	0056	

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

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



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:00:37	DBB3:[F11A.SRC]MAPVBN.B32;7					Page 2

;

;	0377	GLOBAL ROUTINE MAP_VBN (VBN, WINDOW, BLOCK_COUNT, UNMAPPED_BLOCKS) =

;	0378	

;	0379	!++

;	0380	!

;	0381	! FUNCTIONAL DESCRIPTION:

;	0382	!

;	0383	!	This routine maps the specified virtual blocks to their

;	0384	!	corresponding logical blocks using the supplied window.

;	0385	!	the window is turned if necessary.

;	0386	!

;	0387	! CALLING SEQUENCE:

;	0388	!	MAP_VBN (ARG1, ARG2, ARG3, ARG4)

;	0389	!

;	0390	! INPUT PARAMETERS:

;	0391	!	ARG1: desired VBN

;	0392	!	ARG2: address of window to use

;	0393	!	ARG3: number of blocks to map

;	0394	!		if not present, 1

;	0395	!

;	0396	! IMPLICIT INPUTS:

;	0397	!	NONE

;	0398	!

;	0399	! OUTPUT PARAMETERS:

;	0400	!	ARG4: if present, addres to store number of unmapped blocks

;	0401	!

;	0402	! IMPLICIT OUTPUTS:

;	0403	!	NONE

;	0404	!

;	0405	! ROUTINE VALUE:

;	0406	!	starting LBN or -1 if no map

;	0407	!

;	0408	! SIDE EFFECTS:

;	0409	!	window may be turned, header may be read

;	0410	!

;	0411	!--

;	0412	

;	0413	BEGIN

;	0414	

;	0415	MAP

;	0416		WINDOW		: REF BBLOCK;

;	0417	

;	0418	LOCAL

;	0419		COUNT,				! number of blocks to map

;	0420		UNMAPPED,			! address to store unmapped block count

;	0421		DUMMY,				! place for above by default

;	0422		FCB		: REF BBLOCK,	! address of FCB of file

;	0423		HEADER		: REF BBLOCK,	! address of file header

;	0424		LBN;				! resulting LBN of map

;	0425	

;	0426	EXTERNAL ROUTINE

;	0427		MAP_WINDOW,			! scan window map

;	0428		READ_HEADER,			! read file header

;	0429		TURN_WINDOW;			! turn window

;	0430	

;	0431	



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:00:37	DBB3:[F11A.SRC]MAPVBN.B32;7					Page 2-1

;

;	0432	! Check the VBN for legality - i.e., non-zero and within the file size

;	0433	! given in the FCB.

;	0434	!

;	0435	

;	0436	FCB = .WINDOW[WCB$L_FCB];

;	0437	IF .VBN EQL 0 OR .VBN GTRU .FCB[FCB$L_FILESIZE]

;	0438	THEN RETURN -1;

;	0439	

;	0440	! If the file is multi-header, scan the extension FCB's for the one

;	0441	! containing the desired VBN. The right FCB is identified by noting that

;	0442	! there are no more, or that the start VBN of the next one is greater than

;	0443	! the desired VBN.

;	0444	!

;	0445	

;	0446	UNTIL

;	0447	    (IF .FCB[FCB$L_EXFCB] EQL 0 THEN 1

;	0448	     ELSE .BBLOCK [.FCB[FCB$L_EXFCB], FCB$L_STVBN] GTRU .VBN

;	0449	    )

;	0450	DO FCB = .FCB[FCB$L_EXFCB];

;	0451	

;	0452	! Default the optional arguments.

;	0453	!

;	0454	

;	0455	COUNT = (IF ACTUALCOUNT GEQ 3

;	0456		THEN .BLOCK_COUNT

;	0457		ELSE 1

;	0458		);

;	0459	UNMAPPED = (IF ACTUALCOUNT GEQ 4

;	0460		THEN .UNMAPPED_BLOCKS

;	0461		ELSE DUMMY

;	0462		);

;	0463	

;	0464	! Attempt to map the transfer with the existing window. If the map fails

;	0465	! completely, turn the window and try once more. When any blocks map,

;	0466	! return the relevant data.

;	0467	!

;	0468	

;	0469	DECR I FROM 2 TO 1 DO

;	0470	   BEGIN

;	0471	

;	0472	    LBN = KERNEL_CALL (MAP_WINDOW, .VBN, .WINDOW, .COUNT, .UNMAPPED);

;	0473	    IF .LBN NEQ -1 THEN EXITLOOP;

;	0474	

;	0475	    HEADER = READ_HEADER (0, .FCB);

;	0476	    KERNEL_CALL (TURN_WINDOW, .WINDOW, .HEADER, .VBN, .FCB[FCB$L_STVBN]);

;	0477	

;	0478	    END;

;	0479	

;	0480	RETURN .LBN;

;	0481	

;	0482	END;					! end of routine MAP_VBN





							    .TITLE  MAPVBN

							    .IDENT  \A0003\



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:00:37	DBB3:[F11A.SRC]MAPVBN.B32;7					Page 2-2

;



							    .EXTRN  MAP_WINDOW, READ_HEADER, TURN_WINDOW, SYS$CMKRNL



							    .PSECT  $CODE$,NOWRT,2



					 07FC 00000 	    .ENTRY  MAP_VBN, Save R2,R3,R4,R5,R6,R7,R8,R9,R10		      ; 0377

		         5A 00000000G  9F  9E 00002 	    MOVAB   @#SYS$CMKRNL, R10					      ;

		         5E 	       04  C2 00009 	    SUBL2   #4, SP						      ;

		         53 	  08   AC  D0 0000C 	    MOVL    WINDOW, R3						      ; 0436

		         52 	  18   A3  D0 00010 	    MOVL    24(R3), FCB						      ;

		         57 	  04   AC  D0 00014 	    MOVL    VBN, R7						      ; 0437

				       06  13 00018 	    BEQL    1$							      ;

		    34   A2	       57  D1 0001A 	    CMPL    R7, 52(FCB)						      ;

				       04  1B 0001E 	    BLEQU   2$							      ;

		         50 	       01  CE 00020 1$:     MNEGL   #1, R0						      ; 0438

					   04 00023 	    RET     							      ;

		         50 	  0C   A2  D0 00024 2$:     MOVL    12(FCB), R0						      ; 0447

				       0B  13 00028 	    BEQL    3$							      ;

		         57 	  28   A0  D1 0002A 	    CMPL    40(R0), R7						      ; 0448

				       05  1A 0002E 	    BGTRU   3$							      ;

		         52 	       50  D0 00030 	    MOVL    R0, FCB						      ; 0450

				       EF  11 00033 	    BRB     2$							      ; 0446

		         03 	       6C  91 00035 3$:     CMPB    (AP), #3						      ; 0455

				       06  1F 00038 	    BLSSU   4$							      ;

		         59 	  0C   AC  D0 0003A 	    MOVL    BLOCK_COUNT, COUNT					      ;

				       03  11 0003E 	    BRB     5$							      ;

		         59 	       01  D0 00040 4$:     MOVL    #1, COUNT						      ;

		         04 	       6C  91 00043 5$:     CMPB    (AP), #4						      ; 0459

				       06  1F 00046 	    BLSSU   6$							      ;

		         54 	  10   AC  D0 00048 	    MOVL    UNMAPPED_BLOCKS, UNMAPPED				      ;

				       03  11 0004C 	    BRB     7$							      ;

		         54 	       6E  9E 0004E 6$:     MOVAB   DUMMY, UNMAPPED					      ;

		         56 	       02  D0 00051 7$:     MOVL    #2, I						      ; 0469

				       54  DD 00054 8$:     PUSHL   UNMAPPED						      ; 0472

				0208   8F  BB 00056 	    PUSHR   #^M<R3,R9>						      ;

				       57  DD 0005A 	    PUSHL   R7							      ;

				       04  DD 0005C 	    PUSHL   #4							      ;

				       5E  DD 0005E 	    PUSHL   SP							      ;

				0000G  CF  9F 00060 	    PUSHAB  MAP_WINDOW						      ;

		         6A 	       07  FB 00064 	    CALLS   #7, SYS$CMKRNL					      ;

		         55 	       50  D0 00067 	    MOVL    R0, LBN						      ;

	      FFFFFFFF   8F	       55  D1 0006A 	    CMPL    LBN, #-1						      ; 0473

				       23  12 00071 	    BNEQ    9$							      ;

				       52  DD 00073 	    PUSHL   FCB							      ; 0475

				       7E  D4 00075 	    CLRL    -(SP)						      ;

		  0000G  CF	       02  FB 00077 	    CALLS   #2, READ_HEADER					      ;

		         58 	       50  D0 0007C 	    MOVL    R0, HEADER						      ;

				  28   A2  DD 0007F 	    PUSHL   40(FCB)						      ; 0476

				       57  DD 00082 	    PUSHL   R7							      ;

				0108   8F  BB 00084 	    PUSHR   #^M<R3,R8>						      ;

				       04  DD 00088 	    PUSHL   #4							      ;

				       5E  DD 0008A 	    PUSHL   SP							      ;

				0000G  CF  9F 0008C 	    PUSHAB  TURN_WINDOW						      ;

		         6A 	       07  FB 00090 	    CALLS   #7, SYS$CMKRNL					      ;

		         BE 	       56  F5 00093 	    SOBGTR  I, 8$						      ; 0469



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:00:37	DBB3:[F11A.SRC]MAPVBN.B32;7					Page 2-3

;

		         50 	       55  D0 00096 9$:     MOVL    LBN, R0						      ; 0480

					   04 00099 	    RET     							      ; 0377



; Routine Size:  154 bytes





;	0483	

;	0484	END

;	0485	ELUDOM













;				       PSECT SUMMARY

;

;	Name		 Bytes			       Attributes

;

;  $CODE$         	   154  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         5         0       226











; Size:		154 code + 0 data bytes

; Run Time:	00:05.5

; Elapsed Time:	00:13.0

; Memory Used:	278 pages

; Compilation Complete

