WSINI	MACRO M1110  22-AUG-78 02:02  PAGE 2





      1						.TITLE	WSINI

      2						.IDENT	/00/

      3

      4					;

      5					; COPYRIGHT   1975,  DIGITAL  EQUIPMENT  CORP.,  MAYNARD,   MASS.

      6					;

      7					; THIS SOFTWARE IS FURNISHED TO PURCHASER UNDER A LICENSE FOR USE

      8					; ON A SINGLE COMPUTER SYSTEM  AND  CAN BE COPIED (WITH INCLUSION

      9					; OF DEC'S COPYRIGHT NOTICE)  ONLY FOR USE IN SUCH SYSTEM, EXCEPT

     10					; AS MAY OTHERWISE BE PROVIDED IN WRITING BY DEC.

     11					;

     12					; THE INFORMATION IN  THIS DOCUMENT IS  SUBJECT TO CHANGE WITHOUT

     13					; NOTICE AND SHOULD NOT  BE CONSTRUED AS  A COMMITMENT BY DIGITAL

     14					; EQUIPMENT CORPORATION.

     15					;

     16					; DEC ASSUMES  NO  RESPONSIBILITY  FOR  THE  USE  OR  RELIABILITY

     17					; OF ITS  SOFTWARE  ON  EQUIPMENT  WHICH IS NOT  SUPPLIED BY DEC.

     18					;

     19					;

     20					; C. MONIA 23-SEP-75

     21					;

     22					; INITIALIZE WHOLE-SEARCH ALGORITHM

     23					;

     24					; LOCAL DATA

     25					;

     26					; VIRTUAL ADDRESS OF ROOT SEGMENT IN THIS TREE

     27					;

     28

     29	000000				ROOT:	.BLKW	1		;

     30

     31					;+

     32					; **-$WSINI-INITIALIZE WHOLE-SEARCH ALGORITM

     33					;

     34					; THIS ROUTINE IS CALLED TO INITIALIZE THE SEGMENT PATH LIST THAT

     35					; IS REFERENCED WHEN TRAVERSING THE OVERLAY STRUCTURE IN SEARCH OF

     36					; A SYMBOL OR SECTION NAME.

     37					;

     38					; INPUTS:

     39					;

     40					;	$CRSEG=ADDRESS OF CURRENT SEGMENT BEING PROCESSED

     41					;	$CRVSG=VIRTUAL ADDRESS OF SEGMENT BEING PROCESSED

     42					;	$PATH=ADDRESS OF SEGMENT PATH LIST

     43					;

     44					; OUTPUTS:

     45					;

     46					;	SEGMENT PATH LIST IS BUILT CONTAINING ENTRIES IN THE FOLLOWING

     47					;	FORMAT:

     48					;

     49					;		.WORD	SGADR		; VIRTUAL ADDRESS OF SEGMENT DESCR.

     50					;		.WORD	PATHF		; PATH FLAG

     51					;

     52					;	THE PATH FLAG INDICATES THE LOCATION OF THE SEGMENT WITH RESPECT

     53					;	TO THE CURRENT SEGMENT BEING PROCESSED AS FOLLOWS:

     54					;

     55					;		PATHF=0			; CURRENT SEGMENT

     56					;		PATHF=1			; SEGMENT IS UPTREE

     57					;		PATHF=2			; SEGMENT IS IN CO-TREE

WSINI	MACRO M1110  22-AUG-78 02:02  PAGE 2-1





     58					;		PATHF<0			; SEGMENT IS DOWNTREE

     59					;

     60					;	ENTRIES ARE MADE IN THE LIST IN THE FOLLOWING SEQUENCE:

     61					;

     62					;		CURRENT SEGMENT

     63					;		ALL ENTRIES DOWNTREE

     64					;		ALL ENTRIES UP-TREE

     65					;		ALL CO-TREE ENTRIES

     66					;

     67					;	A ZERO WORD TERMINATES THE LIST.

     68					;

     69					;-

     70

     71	000002				$WSINI::			;

     72	000002					SAVRG			; SAVE THE VOLATILE REGISTERS

     73	000006	016705 	000000G			MOV	$PATH,R5	; GET ADDRESS OF PATH LIST

     74	000012	016701 	000000G			MOV	$CRVSG,R1	; GET VIRTUAL ADDRESS OF CURRENT SEGMENT

     75	000016	005046 				CLR	-(SP)		; MARK BOTTOM OF STACK

     76	000020	010146 				MOV	R1,-(SP)	; SET SENTINEL AT THIS LEVEL

     77	000022	005004 				CLR	R4		; SET PATH FLAG=CURRENT SEGMENT

     78	000024				10$:				;

     79	000024	010167 	177750 			MOV	R1,ROOT		; MARK VIRTUAL ADDRESS OF ROOT

     80	000030					CALL	$CVRL		; CONVERT SEGMENT TO REAL ADDRESS

     81	000034					CALL	BLDEN		; ENTER IN PATH LIST

     82	000040	005304 				DEC	R4		; FLAG=PATH DOWN

     83	000042	016001 	000000G			MOV	S$GDWN(R0),R1	; GET ADDRESS OF DOWNTREE SEGMENT

     84	000046	001366 				BNE	10$		; IF NE HAVE SEGMENT ADDRESS

     85	000050	012704 	000001 			MOV	#1,R4		; SET FLAG=PATH-UP

     86	000054	016700 	000000G			MOV	$CRSEG,R0	; GET REAL ADDRESS OF CURRENT SEGMENT

     87	000060	016046 	000000G			MOV	S$GPRV(R0),-(SP) ; SET SENTINEL AT THIS LEVEL

     88	000064				20$:				;

     89	000064	016001 	000000G			MOV	S$GUP(R0),R1	; GET LINK UP

     90	000070	001407 				BEQ	40$		; IF EQ NO LINK UP

     91	000072	010146 				MOV	R1,-(SP)	; SET SENTINEL AT THIS LEVEL

     92	000074				30$:				;

     93	000074	010146 				MOV	R1,-(SP)	; SAVE ADDRESS OF CURRENT SEGMENT

     94	000076					CALL	$CVRL		; CONVERT TO REAL ADDRESS

     95	000102					CALL	BLDEN		; BUILD PATH LIST ENTRY

     96	000106	000766 				BR	20$		; GO AGAIN

     97	000110				40$:				;

     98	000110	011601 				MOV	(SP),R1		; GET SEGMENT AT PREVIOUS LEVEL

     99	000112	001411 				BEQ	50$		; IF EQ TRAVERSED ENTIRE TREE

    100	000114					CALL	$CVRL		; CONVERT TO REAL ADDRESS

    101	000120	005226 				INC	(SP)+		; REMOVE ADDRESS OF CURRENT ENTRY

    102	000122	016001 	000000G			MOV	S$GNXT(R0),R1	; GET LINK-NEXT

    103	000126	020116 				CMP	R1,(SP)		; PROCESSED ALL LINK-NEXT?

    104	000130	001361 				BNE	30$		; IF NE NO

    105	000132	005226 				INC	(SP)+		; REMOVE SENTINEL AT THIS LEVEL

    106	000134	000765 				BR	40$		; PROCESS LINK NEXT

    107	000136				50$:				;

    108	000136	005204 				INC	R4		; INCREMENT PATH FLAG

    109	000140	020427 	000002 			CMP	R4,#2		; PROCESSED ALL CO-TREES?

    110	000144	101004 				BHI	60$		; IF HI YES

    111	000146	016746 	177626 			MOV	ROOT,-(SP)	; SET ROOT SEGMENT OF THIS TREE

    112	000152	011646 				MOV	(SP),-(SP)	; DUPLICATE SEGMENT ADDRESS

    113	000154	000755 				BR	40$		; LOCATE ALL CO-TREE SEGMENTS

    114	000156				60$:				;

WSINI	MACRO M1110  22-AUG-78 02:02  PAGE 2-2





    115	000156	005226 				INC	(SP)+		; CLEAN THE STACK

    116	000160					RETURN			;

    117

    118					;

    119					; APPEND AN ENTRY TO THE PATH LIST

    120					;

    121

    122	000162				BLDEN:				;

    123	000162	010125 				MOV	R1,(R5)+	; RECORD VIRTUAL ADDRESS OF SEGMENT

    124	000164	010425 				MOV	R4,(R5)+	; RECORD PATH FLAG

    125	000166	005015 				CLR	(R5)		; TERMINATE TABLE

    126	000170					RETURN			;

    127

    128		000001 				.END

WSINI	MACRO M1110  22-AUG-78 02:02  PAGE 2-3

SYMBOL TABLE



BLDEN   000162R  	LF    = 000012   	S$GDWN= ****** GX	VT    = 000013   	$PATH = ****** GX

CR    = 000015   	ROOT    000000R  	S$GNXT= ****** GX	$CRSEG= ****** GX	$SAVRG= ****** GX

FF    = 000014   	R$$11M= 000000   	S$GPRV= ****** GX	$CRVSG= ****** GX	$WSINI  000002RG

HT    = 000011   	SPA   = 000040   	S$GUP = ****** GX	$CVRL = ****** GX	$$    = 000001



. ABS.	000000	   000

      	000172	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  630 WORDS  ( 3 PAGES)

DYNAMIC MEMORY:  2772 WORDS  ( 10 PAGES)

ELAPSED TIME:  00:00:05

OBJ$:WSINI,LIS$:WSINI/-SP=SRC$:MACFLM,WSINI

