SMSCN	X0001 - STORAGE MAP SCA	MACRO M1110  21-AUG-78 20:55  PAGE 3





      1	000000					$BEGIN	SMSCN,0001,<STORAGE MAP SCAN>

						.TITLE	SMSCN	X0001 - STORAGE MAP SCAN

						.IDENT	"X0001"

      2

      3					;

      4					; COPYRIGHT (C) 1976 BY DIGITAL EQUIPMENT CORPORATION,

      5					; MAYNARD, MASSACHUSETTS

      6					;

      7					; THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY ON A

      8					; SINGLE  COMPUTER  SYSTEM AND MAY BE COPIED ONLY WITH THE IN-

      9					; CLUSION OF THE ABOVE COPYRIGHT NOTICE.   THIS  SOFTWARE,  OR

     10					; ANY  OTHER  COPIES THEREOF, MAY NOT BE PROVIDED OR OTHERWISE

     11					; MADE AVAILABLE TO ANY OTHER PERSON EXCEPT FOR  USE  ON  SUCH

     12					; SYSTEM  AND TO ONE WHO AGREES TO THESE LICENSE TERMS.  TITLE

     13					; TO AND OWNERSHIP OF THE SOFTWARE SHALL AT ALL  TIMES  REMAIN

     14					; IN DIGITAL.

     15					;

     16					; THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITH-

     17					; OUT  NOTICE  AND  SHOULD NOT BE CONSTRUED AS A COMMITMENT BY

     18					; DIGITAL EQUIPMENT CORPORATION.

     19					;

     20					; DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY  FOR

     21					; THE USE OR RELIABILITY OF ITS SOFTWARE ON EQUIPMENT WHICH IS

     22					; NOT SUPPLIED BY DIGITAL.

     23					;

     24					; ANDREW C. GOLDSTEIN  1-AUG-76  13:17

     25					; PETER H. LIPMAN	27-FEB-74

SMSCN	X0001 - STORAGE MAP SCA	MACRO M1110  21-AUG-78 20:55  PAGE 4





     27					;+

     28					;

     29					; *** - .SMSCN	SCAN AND OPERATE ON STORAGE MAP

     30					;

     31					; THIS ROUTINE ACCEPTS A BIT COUNT AND A STARTING BIT ADDRESS, AND

     32					; THE ADDRESS OF A ROUTINE TO CALL. STARTING WITH THE SPECIFIED BIT,

     33					; THE ROUTINE IS CALLED ITERATIVELY WITH THE ADDRESS AND VALUE OF EACH

     34					; BIT UNTIL:

     35					; 	1) THE BIT COUNT GOES TO ZERO, I.E. THE SCAN SUCCEEDED

     36					; 	2) C = 1 IS RETURNED BY THE SPECIFIED ROUTINE I.E. THE SCAN FAILED

     37					;

     38					; INPUTS:

     39					;

     40					; 	R0 = BIT MASK STARTING BIT

     41					; 	R1 = BIT WORD ADDRESS OF STARTING BIT

     42					; 	R2,R3 = COUNT OF BITS TO OPERATE ON

     43					; 	R4 = DEVICE TABLE ENTRY

     44					; 	R5 = ADDRESS OF ROUTINE TO CALL

     45					; 	   CALLING AND RETURN CONVENTIONS DOCUMENTED BELOW

     46					; 	.SMVBN CONTAINS CURRENT STORAGE MAP VBN IN .SMBUF

     47					;

     48					; OUTPUTS:

     49					;

     50					; 	C = 0 IF DESIRED NO. OF BITS SUCCESSFULLY OPERATED ON

     51					; 	C = 1 IF COUNT NOT EXHAUSTED

     52					; 	R0 = BIT MASK OF LAST BIT OPERATED ON

     53					; 	R1 = BIT WORD ADDRESS OF LAST BIT OPERATED ON

     54					; 	R2,R3 = REMAINING BIT COUNT

     55					; 	R4,R5 PRESERVED

     56					;

     57					;-

     58

     59	000000	000241 			.SMSCN::CLC

     60	000002	030011 			10$:	BIT	R0,(R1)

     61	000004	004715 				CALL	(R5)		; C = 0 AND Z = 0 IF BIT OFF, Z = 1 IF BIT ON

     62	000006	103411 				BCS	20$

     63	000010	162703 	000001 			SUB	#1,R3		; COUNT THIS OPERATION

     64	000014	005602 				SBC	R2		; AND CLEAR CARRY

     65	000016	010346 				MOV	R3,-(SP)	; ANY MORE BITS TO TEST

     66	000020	050226 				BIS	R2,(SP)+

     67	000022	001403 				BEQ	20$		; BRANCH IF DONE

     68	000024	004767 	000000G			CALL	.SMNXB		; SET UP NEXT BIT

     69	000030	103364 				BCC	10$		; BRANCH IF ANOTHER BIT IS AVAILABLE

     70	000032				20$:	RETURN

SMSCN	X0001 - STORAGE MAP SCA	MACRO M1110  21-AUG-78 20:55  PAGE 5





     72					;+

     73					;

     74					; THE FOLLOWING ROUTINES OPERATE ON A BIT IN THE STORAGE MAP AND OBEY

     75					; THE FOLLOWING INPUT AND OUTPUT CONVENTIONS.

     76					;

     77					; INPUTS:

     78					;

     79					; 	C = 0

     80					; 	Z = 0 IF BIT IS CLEAR

     81					; 	Z = 1 IF BIT IS SET

     82					; 	R0 = BIT MASK WORD OF BIT TO OPERATE ON

     83					; 	R1 = BIT WORD ADDRESS OF BIT TO OPERATE ON

     84					;

     85					; OUTPUTS:

     86					;

     87					; 	C = 0 IF OPERATION IS SUCCESSFUL

     88					; 	C = 1 IF OPERATION FAILED

     89					; 	IF BIT IS ALTERED, THEN "DIRTY BIT" IN .SMVBN

     90					; 		(SIGN BIT) MUST BE SET

     91					;-

     92

     93					;

     94					; CHECK IF BIT IS AVAILABLE, C = 1 IF NOT

     95					;

     96	000034				.CKFRE::

     97	000034	001001 				BNE	10$		; BRANCH IF BIT IS AVAILABLE

     98	000036	000261 				SEC

     99	000040				10$:	RETURN

    100					;

    101					; ALLOCATE (CLEAR) SPECIFIED BIT

    102					;

    103						.ENABL	LSB

    104

    105	000042				.ALOBT::

    106	000042	001405 				BEQ	10$		; BRANCH IF BIT ALREADY ALLOCATED

    107	000044	040011 				BIC	R0,(R1)		; ALLOCATE IT

    108	000046	052767 	000001 	000000G		BIS	#1,.SMFLG	; MARK BUFFER DIRTY

    109	000054					RETURN

    110

    111	000056				10$:	FATAL <BIT IN USE BUT SHOULD HAVE BEEN FREE>

    112

    113

    114

    115		000001 				.END

SMSCN	X0001 - STORAGE MAP SCA	MACRO M1110  21-AUG-78 20:55  PAGE 5-1

SYMBOL TABLE



IIII  = 177777   	$E$   = 000001   	$R    = 177777   	.ALOBT  000042RG 	.SMNXB= ****** GX

$DIDDO= 000000   	$L    = 000000   	$SUPMC= 000043   	.CKFRE  000034RG 	.SMSCN  000000RG

$EF$  = 000000   	$L$   = 000000   	$T    = 000000   	.SMFLG= ****** GX



. ABS.	000000	   000

      	000060	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  11170 WORDS  ( 44 PAGES)

DYNAMIC MEMORY:  12276 WORDS  ( 47 PAGES)

ELAPSED TIME:  00:00:21

EXE$:SMSCN,LIS$:SMSCN/-SP=SRC$:SMAC/PA:1,DSCPRE,SMSCN

