MLSG2	MACRO M1110  22-AUG-78 01:47  PAGE 2





      1						.TITLE	MLSG2

      2						.IDENT	/11/

      3					                                                                                ;**-1

      4					;

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

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

      7					; COPYRIGHT   1976,  DIGITAL  EQUIPMENT  CORP.,  MAYNARD,   MASS.

      8					;

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

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

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

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

     13					;

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

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

     16					; EQUIPMENT CORPORATION.

     17					;

     18					; DEC  ASSUMES NO  RESPONSIBILITY  FOR  THE  USE  OR RELIABILITY

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

     20					;

     21					; VERSION 11

     22					;                                                                               ;**-1

     23					; D. N. CUTLER/C. MONIA 10-DEC-73

     24					;

     25					; MODIFICATIONS:

     26					;

     27					; NO.		DATE		PROGRAMMER

     28					; ---		----		----------

     29					;

     30					; 043		23-SEP-75	C. MONIA

     31					; 048		09-FEB-76	C. MONIA

     32					; 049		25-FEB-76	C. MONIA

     33					; 052		22-MAR-76	C. MONIA

     34					; 059		08-APR-76	C. MONIA

     35					; 062		21-MAY-76	C. MONIA

     36					; 064		28-JUN-76	C. MONIA

     37					;

     38					; BUILD THE SEGMENT DESCRIPTION FOR AN OVERLAYED TASK

     39					;

     40					; LOCAL DATA

     41					;

     42					; AUTOLOAD ENTRY POINT NAME

     43					;

     44

     45	000000	124375 	077530 		AUTO:	.RAD50	/$AUTO/		;

     46	000004					.BLKW	2		;

     47

     48

     49					;

     50					; NAME OF POINTER TO IMPURE AREA IN OVERLAY RUNTIME ROUTINES

     51					;

     52

     53	000010	130477 	105571 		NOVLY:	.RAD50	/.NOVLY/	;                                               ;**NEW**

     54	000014					.BLKW	2		;

     55

     56					                                                                                ;**-1

     57					;

MLSG2	MACRO M1110  22-AUG-78 01:47  PAGE 2-1





     58					; TEMPORARY STORAGE

     59					;

     60

     61	000020				TMP:	.BLKW	5

     62

     63					;

     64					; TASK IMAGE FILE SWITCHES

     65					;

     66

     67	000032				TSKSW:	.BLKW	1		;

     68

     69					;

     70					; CURRENT WINDOW OFFSET INTO WINDOW DESCRIPTOR SECTION

     71					;

     72

     73	000034				WNOFF:	.BLKW	1		;

     74

     75					;

     76					; WINDOW DESCRIPTOR FLAGS

     77					;

     78

     79	000036				WNFLG:	.BLKW	1		;

     80

     81

     82					;

     83					;+

     84					; **-MLSG2-BUILD SEGMENT DESCRIPTORS

     85					;

     86					; INPUTS:

     87					;

     88					;	PARSED SEGMENT DESCRIPTION BUILT BY $MLSG1

     89					;

     90					; OUTPUTS:

     91					;

     92					;	$PATH=ADDRESS OF PATH LIST

     93					;	$SGLST=ADDRESS OF SEGMENT LIST

     94					;

     95					;	SEGMENT TABLES AND ELEMENT LIST FOR EACH SEGMENT

     96					;

     97					;

     98					;	THIS ROUTINE IS ENTERED FROM $MULSG TO CONSTRUCT THE

     99					; ABOVE TABLES. THE SEGMENT DESCRIPTORS ARE LINKED AND ELEMENT

    100					; DESCRIPTORS STRUNG OFF EACH BRANCH. ANY .PSECTS SPECIFIED IN

    101					; THE ODL ARE ENTERED IN THE SECTION TABLE OF THE APPROPRIATE

    102					; SEGMENT.

    103					;

    104					; IF THE NUMBER OF SEGMENTS EXCEEDS ONE, BUFFERS FOR THE

    105					; SEGMENT AND PATH LISTS ARE ALLOCATED.

    106					;

    107					;-

    108					;

    109

    110	000040				$MLSG2::			;

    111	000040	012705 	000000G			MOV	#$DIRHD,R5	; GET ADDRESS OF PARSED DIRECTIVE HEADER

    112	000044					CALL	RELEAS		; RELEASE MEMORY

    113	000050	016701 	000000G			MOV	$TSKNM,R1	; GET ADDRESS OF TASK FILE NAMEBLOCK

    114	000054					CALL	$CVRL		; CONVERT TO REAL ADDRESS

MLSG2	MACRO M1110  22-AUG-78 01:47  PAGE 2-2





    115	000060	016067 	000000G	177744 		MOV	E$LSWT(R0),TSKSW ; COPY TASK SWITCHES

    116	000066	005067 	177742 			CLR	WNOFF		; CLEAR WINDOW OFFSET INTO SECTION

    117	000072	012767 	000000C	177736 		MOV	#<WS.MAP!WS.64B>,WNFLG ; SET TO MAP ON CREATE, AND ALIGN

    118	000100	032767 	000000G	177724 		BIT	#SW$CM,TSKSW	; TASK IN COMPATIBILITY MODE?

    119	000106	001403 				BEQ	5$		; IF EQ NO

    120	000110	042767 	000000G	177720 		BIC	#WS.64B,WNFLG	; CLEAR 64-BYTE ALIGNMENT

    121	000116				5$:				;

    122	000116	012700 	000000G			MOV	#$DSTK,R0	; GET ADDRESS OF DESCRIPTION STACK

    123	000122	010001 			10$:	MOV	R0,R1		;COPY HEADER ADDRESS

    124	000124	005720 				TST	(R0)+		;POINT TO LAST

    125	000126	010120 				MOV	R1,(R0)+	;LAST POINTS TO FIRST INITIALLY

    126	000130	020027 	000000C			CMP	R0,#$DSTK+<N$PLVL*4> ; END OF LIST?

    127	000134	103772 				BLO	10$		;IF LO NO

    128	000136	012704 	000002G			MOV	#$DSTK+2,R4	; GET ADDRESS OF FIRST HEADER

    129	000142	011403 				MOV	(R4),R3		;GET ADDRESS OF NEXT ITEM

    130	000144	016701 	000000G			MOV	$RTSEG,R1	; GET VITUAL ADDRESS OF ROOT SEGMENT

    131	000150					CALL	$CVLOK		; CONVERT TO REAL, LOCK IN MEMORY

    132	000154					CALL	$WRMPG		; WRITE MARK PAGE

    133	000160					CALL	GNSEG		;GENERATE SEGMENT DESCRIPTORS

    134	000164	016701 	000000G			MOV	$CRVSG,R1	; GET VIRTUAL ADDRESS OF LAST SEGMENT

    135	000170					CALL	$WRMPG		; WRITE-MARK PAGE

    136	000174					CALL	$UNLPG		; UNLOCK PAGE

    137	000200	012704 	000000G			MOV	#$DSTK,R4	; GET ADDRESS OF DESCRIPTION STACK

    138	000204	010405 			20$:	MOV	R4,R5		;SET HEADER ADDRESS

    139	000206					CALL	RELEAS		;RELEASE MEMORY

    140	000212	022424 				CMP	(R4)+,(R4)+	;ADJUST TO NEXT HEADER

    141	000214	020427 	000000C			CMP	R4,#$DSTK+<N$PLVL*4> ; END OF LIST?

    142	000220	103771 				BLO	20$		;IF LO NO

    143	000222	012700 	000000G			MOV	#SY$GBL,R0	; SET GLOBAL FLAG

    144	000226	032767 	000000G	177576 		BIT	#SW$NH,TSKSW	; TASK IMAGE HAVE HEADER?

    145	000234	001402 				BEQ	21$		; IF EQ NO

    146	000236	152700 	000000G			BISB	#SY$WK,R0	; FLAG WEAK REFERENCE

    147	000242				21$:				;

    148	000242	010067 	000000C			MOV	R0,AUTO+S$YFLG-S$YM ; SET SYMBOL TABLE FLAGS

    149	000246	010067 	000000C			MOV	R0,NOVLY+S$YFLG-S$YM ; ...

    150	000252	005767 	000000G			TST	$TSKWD		; TASK HAVE RESIDENT OVERLAYS?

    151	000256	001407 				BEQ	210$		; IF EQ NO

    152	000260	032767 	000000G	177544 		BIT	#SW$NH,TSKSW	; BUILDING RESIDENT LIBRARY?

    153	000266	001403 				BEQ	210$		; IF EQ NO

    154	000270	012767 	000001 	000000G		MOV	#1,$NUMRG	; SET NUMBER OF REGION DESCRIPTORS

    155	000276				210$:				;

    156	000276	016701 	000000G			MOV	$NUMSG,R1	; GET NUMBER OF SEGMENTS

    157	000302	020127 	000001 			CMP	R1,#1		; MORE THAN ONE SEGMENT?

    158	000306	001414 				BEQ	22$		; IF EQ NO

    159	000310	006301 				ASL	R1		; MULTIPLY BY 2

    160	000312	005201 				INC	R1		; ACCOUNT FOR TERMINAL ZERO IN LISTS

    161	000314	006301 				ASL	R1		; MULTIPLY BY 2

    162	000316	010103 				MOV	R1,R3		; HAVE LENGTH OF ONE LIST

    163	000320	006301 				ASL	R1		; CONVERT TO LENGTH IN BYTES

    164	000322					CALL	$ALBLK		; ALLOCATE BLOCK

    165	000326	010067 	000000G			MOV	R0,$PATH	; SAVE ADDRESS OF PATH LIST BUFFER

    166	000332	060300 				ADD	R3,R0		; COMPUTE ADDRESS OF SEGMENT LIST BUFFER

    167	000334	010067 	000000G			MOV	R0,$SGLST	; SAVE ADDRESS OF SEGMENT LIST

    168	000340				22$:				;

    169	000340	012705 	000010'			MOV	#NOVLY,R5	; POINT TO IMPURE AREA NAME                     ;**NEW**

    170	000344					CALL	25$		;INSERT IN SYMBOL TABLE                         ;**-1

    171	000350	005767 	000000G			TST	$AFLG		; AUTOLOAD SPECIFIED?

MLSG2	MACRO M1110  22-AUG-78 01:47  PAGE 2-3





    172	000354	001465 				BEQ	30$		;IF EQ NO

    173	000356	012705 	000000'			MOV	#AUTO,R5	;POINT TO NAME OF AUTOLOAD ROUTINE

    174	000362				25$:				;

    175	000362	016701 	000000G			MOV	$RTSEG,R1	; GET ADDRESS OF ROOT SEGMENT

    176	000366					CALL	$CVLOK		; CONVERT TO REAL, LOCK IN MEMORY

    177	000372					CALL	$WRMPG		; WRITE-MARK PAGE

    178	000376	010004 				MOV	R0,R4		; SAVE REAL ADDRESS OF SEGMENT

    179	000400	132765 	000000G	000000C		BITB	#SY$WK,S$YFLG-S$YM(R5) ; WEAK REFERENCE?

    180	000406	001004 				BNE	27$		; IF NE YES

    181	000410	005267 	000000G			INC	$MSYMC		; INCREMENT MASTER UNDEFINED COUNT

    182	000414	005264 	000000G			INC	S$GUND(R4)	; INCREMENT COUNT OF UDEFINED SYMBOLS

    183	000420				27$:				;

    184	000420	012701 	000000G			MOV	#S$YLGH,R1	; GET LENGTH OF SYMBOL TABLE ENTRY

    185	000424					CALL	$ALVRT		; ALLOCATE VIRTUAL MEMORY

    186	000430	012560 	000000G			MOV	(R5)+,S$YM(R0)	; SET NAME OF SYMBOL

    187	000434	012560 	000002G			MOV	(R5)+,S$YM+2(R0) ; SET SECOND HALF OF NAME

    188	000440	011560 	000000G			MOV	(R5),S$YFLG(R0)	; SET FLAGS

    189	000444	016760 	000000G	000000G		MOV	$ASCT,S$YCMT(R0) ; SET ADDRESS OF DEFINING SECTION

    190	000452	016700 	000000G			MOV	$RTSEG,R0	; GET ADDRESS OF SEGMENT

    191	000456	010025 				MOV	R0,(R5)+	; SET SEGMENT ADDRESS

    192	000460	010125 				MOV	R1,(R5)+	; SET ADDRESS OF SYMBOL

    193	000462	062700 	000000C			ADD	#S$GSTB/2,R0	; GET VIRTUAL DESCRIPTOR ADDRESS

    194	000466					CALL	$SRCHI		;SEARCH FOR INSERT                              ;**-3

    195	000472					CALL	$ISYM		;INSERT SYMBOL

    196	000476	010501 				MOV	R5,R1		; COPY DESCRIPTOR ADDRESS

    197	000500	162701 	000016 			SUB	#<4+3>*2,R1	; COMPUTE DESCRIPTOR ADDRESS MINUS OFFSET

    198	000504	012700 	000000G			MOV	#$SYMHD,R0	; GET ADDRESS OF MASTER TABLE LISTHEAD

    199	000510					CALL	$SRCIV		; SEARCH FOR INSERTION

    200	000514					CALL	$ISYMV		; INSERT SYMBOL

    201	000520				29$:				;

    202	000520	016701 	000000G			MOV	$RTSEG,R1	; GET ADDRESS OF ROOT SEGMENT

    203	000524					CALL	$UNLPG		; UNLOCK PAGE

    204	000530				30$:	RETURN			;

    205

    206					;

    207					; SUBROUTINE TO GENERATE SEGMENT DESCRIPTORS

    208					;

    209

    210	000532				GNSEG:				;

    211	000532	016701 	000000G			MOV	$CRVSG,R1	; GET VIRTUAL ADDRESS OF CURRENT SEGMENT

    212	000536					CALL	$CVRL		; CONVERT TO REAL ADDRESS

    213	000542	010005 				MOV	R0,R5		; SET REAL ADDRESS OF CURRENT

    214	000544	010067 	000000G			MOV	R0,$CRSEG	; SET REAL ADDRESS OF CURRENT

    215	000550	011303 				MOV	(R3),R3		; GET ADDRESS OF NEXT ITEM TYPE

    216	000552	116302 	000000G			MOVB	T$YP(R3),R2	; GET ITEM TYPE

    217	000556	042702 	000001 			BIC	#1,R2		;CLEAR POSSIBLE AUTOLOAD BIT

    218	000562	000172 	000566'			JMP	@10$(R2)	;DISPATCH ON ITEM TYPE

    219

    220					;

    221					; ITEM TYPE DISPATCH VECTOR

    222					;

    223

    224	000566	000532'			10$:	.WORD	GNSEG		;SOS

    225	000570	000650'				.WORD	GNRPAR		;EOS

    226	000572	000614'				.WORD	GNLPAR		;LPAR

    227	000574	000650'				.WORD	GNRPAR		;RPAR

    228	000576	000652'				.WORD	GNCOMA		;COMA

MLSG2	MACRO M1110  22-AUG-78 01:47  PAGE 2-4





    229	000600	001074'				.WORD	GNDASH		;DASH

    230	000602	000532'				.WORD	GNSEG		;STAR

    231	000604	000532'				.WORD	GNSEG		; EXCLAMATION POINT

    232	000606	001232'				.WORD	GNSCTN		;SCTN

    233	000610	001520'				.WORD	GNSEGN		;SEGN

    234	000612	001370'				.WORD	GNFILE		;FILE

    235

    236					;

    237					; LPAR-LEFT PARENTHESIS

    238					;

    239

    240	000614	032763 	000001 	000000G	GNLPAR:	BIT	#1,T$YP(R3)	; AUTOLOAD SPECIFIED?

    241	000622	001402 				BEQ	10$		;IF EQ NO

    242	000624	105265 	000001G			INCB	S$GSTS+1(R5)	;SET AUTOLOAD FLAG

    243	000630				10$:				;

    244	000630	011300 				MOV	(R3),R0		; GET ADDRESS OF NEXT ITEM

    245	000632	122760 	000000G	000000G		CMPB	#S$CTN,T$YP(R0)	; OPERAND?

    246	000640	101734 				BLOS	GNSEG		;IF LOS YES

    247	000642					CALL	GNLVL		;CHANGE LEVEL

    248	000646	000731 				BR	GNSEG		;

    249

    250					;

    251					; RPAR-RIGHT PARENTHESIS

    252					;

    253

    254	000650				GNRPAR:	RETURN			;

    255

    256					;

    257					; COMA-COMMA

    258					;

    259

    260	000652				GNCOMA:	CALL	$ALSGD		;ALLOCATE SEGMENT DESCRIPTOR

    261	000656					CALL	$LCKPG		; LOCK NEW SEGMENT IN MEMORY

    262	000662	016560 	000000G	000000G		MOV	S$GWDP(R5),S$GWDP(R0) ; COPY ADDRESS OF WINDOW BLOCK

    263	000670	016560 	000000G	000000G		MOV	S$GWND(R5),S$GWND(R0) ; COPY WINDOW DESCRIPTOR OFFSET

    264	000676	132765 	000000G	000000G		BITB	#SG$RES,S$GSTS(R5) ; CURRENT SEGMENT RESIDENT?

    265	000704	001420 				BEQ	5$		; IF EQ NO

    266	000706	005765 	000000G			TST	S$GDWN(R5)	; CURRENT=ROOT?

    267	000712	001415 				BEQ	5$		; IF EQ YES

    268	000714	010146 				MOV	R1,-(SP)	; SAVE ADDRESSES

    269	000716	010046 				MOV	R0,-(SP)	; ...

    270	000720					CALL	ALCWD		; ALLOCATE WINDOW DESCRIPTOR

    271	000724	012600 				MOV	(SP)+,R0	; GET REAL ADDRESS OF DESCRIPTOR

    272	000726	010260 	000000G			MOV	R2,S$GWND(R0)	; SAVE OFFSET INTO WINDOW

    273	000732	010160 	000000G			MOV	R1,S$GWDP(R0)	; SET ADDRESS OF WINDOW DESCRIPTOR

    274	000736	012601 				MOV	(SP)+,R1	; RESTORE VIRTUAL ADDRESS OF SEGMENT

    275	000740	152760 	000000G	000000G		BISB	#SG$RES,S$GSTS(R0) ; MARK SEGMENT RESIDENT

    276	000746				5$:				;

    277	000746	032763 	000001 	000000G		BIT	#1,T$YP(R3)	; AUTOLOAD BIT SET?

    278	000754	001402 				BEQ	10$		;IF EQ NO

    279	000756	105260 	000001G			INCB	S$GSTS+1(R0)	;SET SEGMENT AUTOLOAD

    280	000762				10$:				;

    281	000762	016546 	000000G			MOV	S$GNXT(R5),-(SP) ; GET LINK NEXT OF CURRENT

    282	000766	010165 	000000G			MOV	R1,S$GNXT(R5)	; SET NEW LINK NEXT

    283	000772	011660 	000000G			MOV	(SP),S$GNXT(R0)	; SET LINK NEXT OF NEW

    284	000776	016560 	000000G	000000G		MOV	S$GDWN(R5),S$GDWN(R0) ;SET LINK DOWN OF NEW

    285	001004	016760 	000000G	000000G		MOV	$CRVSG,S$GPRV(R0) ; SET LINK TO PREVIOUS

MLSG2	MACRO M1110  22-AUG-78 01:47  PAGE 2-5





    286	001012	010067 	000000G			MOV	R0,$CRSEG	; SAVE REAL ADDRESS OF SEGMENT

    287	001016	010167 	000000G			MOV	R1,$CRVSG	; SAVE VIRTUAL ADDRESS OF SEGMENT

    288	001022	016001 	000000G			MOV	S$GPRV(R0),R1	; GET VIRTUAL ADDRESS OF PREVIOUS

    289	001026					CALL	$UNLPG		; UNLOCK PAGE

    290	001032	012601 				MOV	(SP)+,R1	; GET VIRTUAL ADDRESS OF LINK NEXT

    291	001034					CALL	$CVRL		; CONVERT TO REAL ADDRESS

    292	001040					CALL	$WRMPG		; WRITE-MARK PAGE

    293	001044	016760 	000000G	000000G		MOV	$CRVSG,S$GPRV(R0) ; SET NEW LINK TO PREVIOUS

    294	001052	011301 				MOV	(R3),R1		;GET ADDRESS OF NEXT ITEM

    295	001054	122761 	000000G	000000G		CMPB	#S$CTN,T$YP(R1)	; OPERAND?

    296	001062	101623 				BLOS	GNSEG		;IF LOS YES

    297	001064					CALL	GNLVL		;CHANGE LEVEL

    298	001070	010146 				MOV	R1,-(SP)	; SAVE VIRTUAL ADDRESS OF CURRENT SEGMENT

    299	001072	000442 				BR	GND1		;

    300

    301					;

    302					; DASH-MINUS

    303					;

    304

    305	001074	011300 			GNDASH:	MOV	(R3),R0		;GET ADDRESS OF NEXT ITEM

    306	001076	122760 	000000G	000000G		CMPB	#S$CTN,T$YP(R0)	; OPERAND?

    307	001104	101612 				BLOS	GNSEG		;IF LOS YES

    308	001106					CALL	$ALSGD		;ALLOCATE SEGMENT DESCRIPTOR

    309	001112	016560 	000000G	000000G		MOV	S$GWDP(R5),S$GWDP(R0) ; SET ADDRESS OF WINDOW BLOCK

    310	001120	016560 	000000G	000000G		MOV	S$GWND(R5),S$GWND(R0) ; COPY DESCRIPTOR OFFSET

    311	001126					CALL	$LCKPG		; LOCK NEW IN CORE

    312	001132	010165 	000000G			MOV	R1,S$GUP(R5)	; SET LINK UP OF CURRENT

    313	001136	016760 	000000G	000000G		MOV	$CRVSG,S$GDWN(R0) ; SET LINK DOWN OF NEW

    314	001144	010167 	000000G			MOV	R1,$CRVSG	; SET NEW CURRENT SEGMENT

    315	001150	016001 	000000G			MOV	S$GDWN(R0),R1	; GET VIRTUAL ADDRESS OF OLD

    316	001154					CALL	$WRMPG		; WRITE-MARK PAGE

    317	001160					CALL	$UNLPG		; UNLOCK PAGE BUFFER

    318	001164					CALL	GNLVL		;CHANGE LEVEL

    319	001170					CALL	$CVRL		; GET REAL ADDRESS OF CURRENT SEGMENT

    320	001174	016046 	000000G			MOV	S$GDWN(R0),-(SP) ; RESTORE CURRENT SEGMENT

    321	001200				GND1:				;

    322	001200	016701 	000000G			MOV	$CRVSG,R1	; GET VIRTUAL ADDRESS OF CURRENT SEG.

    323	001204					CALL	$UNLPG		; UNLOCK CURRENT

    324	001210	012601 				MOV	(SP)+,R1	; GET NEW CURRENT

    325	001212					CALL	$CVLOK		; CONVERT TO REAL, LOCK IN MEMORY

    326	001216					CALL	$WRMPG		; WRITE-MARK PAGE

    327	001222	010167 	000000G			MOV	R1,$CRVSG	; SET NEW CURRENT

    328	001226	000167 	177300 			JMP	GNSEG		;

    329

    330					;

    331					; SCTN-SECTION NAME

    332					;

    333

    334	001232	010301 			GNSCTN:	MOV	R3,R1		;COPY ADDRESS OF ITEM

    335	001234	062701 	000000G			ADD	#L$AB,R1	; CALCULATE PROPER OFFSET

    336	001240	162701 	000000G			SUB	#S$YM,R1	;

    337	001244	010500 				MOV	R5,R0		;COPY ADDRESS OF CURRENT SEGMENT

    338	001246	062700 	000000G			ADD	#S$GCST,R0	;POINT TO SECTION TABLE

    339	001252					CALL	$SRCH		;SEARCH FOR SECTION NAME

    340	001256	103040 				BCC	20$		;IF CC ALREADY THERE

    341	001260	012701 	000000G			MOV	#C$SLGH,R1	;GET SIZE OF BLOCK NEEDED

    342	001264					CALL	$ALVRT		; ALLOCATE VIRTUAL MEMORY                       ;**NEW**

MLSG2	MACRO M1110  22-AUG-78 01:47  PAGE 2-6





    343	001270	016360 	000000G	000000G		MOV	L$AB(R3),S$YM(R0) ; INSERT SECTION NAME                         ;**-1

    344	001276	016360 	000002G	000002G		MOV	L$AB+2(R3),S$YM+2(R0) ;

    345	001304	116360 	000000G	000000G		MOVB	F$LG(R3),C$SFLG(R0) ; SET FLAG BYTE

    346	001312	142760 	000000G	000000G		BICB	#CS$MEM,C$SFLG(R0) ; CLEAR MEMORY FLAG(USED FOR AUTOLOAD)

    347	001320	032763 	000001 	000000G		BIT	#1,T$YP(R3)	; AUTOLOAD SPECIFIED?

    348	001326	001403 				BEQ	10$		;IF EQ NO

    349	001330	152760 	000000G	000000G		BISB	#CS$ATL,C$SFLG(R0) ; SET AUTOLOAD BIT

    350	001336				10$:				;                                               ;**NEW**

    351	001336	016700 	000000G			MOV	$CRVSG,R0	; GET VIRTUAL ADDRESS OF CURRENT SEGMENT        ;**NEW**

    352	001342	062700 	000000C			ADD	#S$GCST/2,R0	; POINT TO SECTION TABLE                        ;**NEW**

    353	001346					CALL	$SRCHI		;SEARCH FOR INSERT                              ;**-3

    354	001352	103002 				BCC	20$		;IF CC ALREADY DEFINED FOR SEGMENT

    355	001354					CALL	$ISYM		;INSERT SECTION

    356	001360	005765 	000000G		20$:	TST	S$GNME(R5)	;SEGMENT HAVE NAME YET?

    357	001364	001106 				BNE	GNSEG2		;IF NE YES

    358	001366	000477 				BR	GNSEG1		;GIVE IT NAME NOW

    359

    360					;

    361					; FILE-FILE NAME

    362					;

    363

    364	001370	016301 	000004 		GNFILE:	MOV	4(R3),R1	; GET VIRTUAL ADDRESS OF ELEMENT DESCR.

    365	001374					CALL	$CVRL		; CONVERT TO REAL ADDRESS

    366	001400					CALL	$WRMPG		; WRITE-MARK PAGE

    367	001404	020167 	000000G			CMP	R1,$LIBNM	; DEFAULT LIBRARY

    368	001410	001003 				BNE	2$		; IF NE NO

    369	001412	062701 	000000C			ADD	#<E$LMND+4>/2,R1 ; OFFSET TO FILE NAME

    370	001416	000426 				BR	15$		; SET NAME OF SEGMENT

    371	001420				2$:				;

    372	001420	016046 	000002G			MOV	E$LIDT+2(R0),-(SP) ; RECORD ADDRESS OF MNT TABLE (IF ANY)

    373	001424	001003 				BNE	5$		; IF NE MODULE NAME-LIST ALLOCATED

    374	001426	010116 				MOV	R1,(SP)		; COPY ADDRESS OF ELEMENT DESCRIPTOR

    375	001430	062716 	000000C			ADD	#<E$LMND+4>/2,(SP) ; OFFSET TO FILE NAME

    376	001434				5$:				;

    377	001434	032763 	000001 	000000G		BIT	#1,T$YP(R3)	; AUTOLOAD SPECIFIED?

    378	001442	001403 				BEQ	10$		; IF EQ NO

    379	001444	052760 	000000G	000000G		BIS	#SW$AL,E$LSWT(R0) ; SET AUTOLOAD FLAG

    380	001452				10$:				;

    381	001452	016700 	000000G			MOV	$CRVSG,R0	; GET VIRTUAL ADDRESS OF CURRENT SEGMENT

    382	001456	062700 	000000C			ADD	#<S$GELT/2>,R0	; OFFSET TO ELEMENT LISTHEAD

    383	001462	012702 	000000G			MOV	#E$LNXT,R2	; GET OFFSET TO NEXT

    384	001466					CALL	$LNKVM		; LINK VIRTUAL LIST

    385	001472	012601 				MOV	(SP)+,R1	; GET VIRTUAL ADDRESS OF NAME

    386	001474				15$:				;

    387	001474	005765 	000000G			TST	S$GNME(R5)	; SEGMENT HAVE NAME?

    388	001500	001040 				BNE	GNSEG2		; IF NE YES

    389	001502					CALL	$CVRL		; CONVERT NAME ADDRESS TO REAL

    390	001506	012065 	000000G			MOV	(R0)+,S$GNME(R5) ; SET SEGMENT NAME

    391	001512	011065 	000002G			MOV	(R0),S$GNME+2(R5) ; ...

    392	001516	000431 				BR	GNSEG2		;

    393

    394					;

    395					; SEGN-SEGMENT NAME

    396					;

    397

    398	001520	032763 	000001 	000000G	GNSEGN:	BIT	#1,T$YP(R3)	; AUTOLOAD SPECIFIED?

    399	001526	001402 				BEQ	10$		; IF EQ NO

MLSG2	MACRO M1110  22-AUG-78 01:47  PAGE 2-7





    400	001530	105265 	000001G			INCB	S$GSTS+1(R5)	; SET AUTOLOAD FLAG

    401	001534				10$:				;

    402	001534	142765 	000000C	000000G		BICB	#^C<SG$RES!SG$LOD>,S$GSTS(R5) ; CLEAR ALL BUT RESIDENCY, LOAD FLAGS

    403	001542	156365 	000000G	000000G		BISB	F$LG(R3),S$GSTS(R5) ; SET SEGMENT FLAGS

    404	001550	026767 	000000G	000000G		CMP	$CRVSG,$RTSEG	; CURRENT = ROOT?

    405	001556	001003 				BNE	GNSEG1		; IF NE NO

    406	001560	142765 	000000G	000000G		BICB	#SG$MEM,S$GSTS(R5) ; MARK SEGMENT IN MEMORY

    407	001566	016365 	000000G	000000G	GNSEG1:	MOV	L$AB(R3),S$GNME(R5) ; SET SEGMENT NAME

    408	001574	016365 	000002G	000002G		MOV	L$AB+2(R3),S$GNME+2(R5) ;

    409	001602				GNSEG2:				;

    410	001602	132765 	000000G	000000G		BITB	#SG$RES,S$GSTS(R5) ; SEGMENT RESIDENT?

    411	001610	001025 				BNE	10$		; IF NE YES

    412	001612	132763 	000000G	000001G		BITB	#RS$FLG,T$YP+1(R3) ; RESIDENCY FLAG SET IN ITEM?

    413	001620	001421 				BEQ	10$		; IF EQ NO

    414	001622	032767 	000000G	000000G		BIT	#MP$SY,$SWTCH	; SYSTEM MAPPED?

    415	001630	001415 				BEQ	10$		; IF EQ NO

    416	001632	032767 	000000G	000000G		BIT	#RS$OV,$SWTCH	; RESIDENT OVERLAYS RECOGNIZED?

    417	001640	001011 				BNE	10$		; IF NE NO

    418	001642	152765 	000000G	000000G		BISB	#SG$RES,S$GSTS(R5) ; SET RESIDENCY FLAG

    419	001650					CALL	ALCWD		; ALLOCATE WINDOW BLOCK

    420	001654	010165 	000000G			MOV	R1,S$GWDP(R5)	; SET ADDRESS OF WINDOW BLOCK

    421	001660	010265 	000000G			MOV	R2,S$GWND(R5)	; SET OFFSET INTO DESCRIPTOR SECTION

    422	001664				10$:				;

    423	001664	000167 	176642 			JMP	GNSEG		;

    424

    425					;

    426					; SUBROUTINE TO CHANGE LEVLES

    427					;

    428

    429	001670	010314 			GNLVL:	MOV	R3,(R4)		;SAVE ADDRESS OF CURRENT ITEM

    430	001672	022424 				CMP	(R4)+,(R4)+	;ADVANCE LEVEL

    431	001674	011403 				MOV	(R4),R3		;GET ADDRESS OF CURRENT ITEM

    432	001676	016746 	000000G			MOV	$CRVSG,-(SP)	; SAVE CURRENT VIRTUAL SEGMENT ADDRESS

    433	001702					CALL	GNSEG		;RECURSE

    434	001706	012601 				MOV	(SP)+,R1	; RESTORE VIRTUAL ADDRESS OF SEGMENT

    435	001710	010314 				MOV	R3,(R4)		;SAVE ADDRESS OF CURRENT ITEM

    436	001712	024444 				CMP	-(R4),-(R4)	;REDUCE LEVEL

    437	001714	011403 				MOV	(R4),R3		;RETRIEVE ADDRESS OF CURRENT ITEM

    438	001716					RETURN			;

    439

    440					;

    441					; ALLOCATE WINDOW DESCRIPTOR

    442					;

    443

    444	001720				ALCWD:				;

    445	001720	012701 	000000G			MOV	#W$NLGH,R1	; GET SIZE OF DESCRIPTOR

    446	001724					CALL	$ALVRT		; ALLOCATE VIRTUAL MEMORY

    447	001730	056760 	176102 	000000G		BIS	WNFLG,W.NSTS(R0) ; SET DESCRIPTOR FLAGS

    448	001736	005267 	000000G			INC	$TSKWD		; INCREMENT TOTAL DESCRIPTOR COUNT

    449	001742	016702 	176066 			MOV	WNOFF,R2	; GET OFFSET

    450	001746	062767 	000000G	176060 		ADD	#W$NLGH,WNOFF	; SET OFFSET TO NEXT DESCRIPTOR

    451	001754					RETURN			;

    452

    453					;

    454					; SUBROUTINE TO RELEASE MEMORY

    455					;

    456

MLSG2	MACRO M1110  22-AUG-78 01:47  PAGE 2-8





    457	001756	011505 			RELEAS:	MOV	(R5),R5		;GET ADDRESS OF FIRST ENTRY

    458	001760	001414 				BEQ	20$		;IF EQ NONE TO RELEASE

    459	001762	010502 			10$:	MOV	R5,R2		;SET ADDRESS OF BLOCK TO RELEASE

    460	001764	116201 	000001G			MOVB	T$YP+1(R2),R1	; SET SIZE OF BLOCK

    461	001770	042701 	000000C			BIC	#177400!RS$FLG,R1 ; CLEAR EXTRANEOUS BITS

    462	001774	012700 	000000G			MOV	#$FRHD,R0	;GET ADDRESS OF FREE SPACE HEADER

    463	002000	011505 				MOV	(R5),R5		;GET ADDRESS OF NEXT ENTRY

    464	002002					CALL	$RLCB		;RELEASE BLOCK

    465	002006	005705 				TST	R5		;ANY MORE?

    466	002010	001364 				BNE	10$		;IF NE YES

    467	002012				20$:	RETURN			;

    468

    469		000001 				.END

MLSG2	MACRO M1110  22-AUG-78 01:47  PAGE 2-9

SYMBOL TABLE



ALCWD   001720R  	GNSEGN  001520R  	SY$WK = ****** GX	VT    = 000013   	$LCKPG= ****** GX

AUTO    000000R  	GNSEG1  001566R  	S$CTN = ****** GX	WNFLG   000036R  	$LIBNM= ****** GX

CR    = 000015   	GNSEG2  001602R  	S$GCST= ****** GX	WNOFF   000034R  	$LNKVM= ****** GX

CS$ATL= ****** GX	HT    = 000011   	S$GDWN= ****** GX	WS.MAP= ****** GX	$MLSG2  000040RG

CS$MEM= ****** GX	LF    = 000012   	S$GELT= ****** GX	WS.64B= ****** GX	$MSYMC= ****** GX

C$SFLG= ****** GX	L$AB  = ****** GX	S$GNME= ****** GX	W$NLGH= ****** GX	$NUMRG= ****** GX

C$SLGH= ****** GX	MP$SY = ****** GX	S$GNXT= ****** GX	W.NSTS= ****** GX	$NUMSG= ****** GX

E$LIDT= ****** GX	NOVLY   000010R  	S$GPRV= ****** GX	$AFLG = ****** GX	$PATH = ****** GX

E$LMND= ****** GX	N$PLVL= ****** GX	S$GSTB= ****** GX	$ALBLK= ****** GX	$RLCB = ****** GX

E$LNXT= ****** GX	RELEAS  001756R  	S$GSTS= ****** GX	$ALSGD= ****** GX	$RTSEG= ****** GX

E$LSWT= ****** GX	RS$FLG= ****** GX	S$GUND= ****** GX	$ALVRT= ****** GX	$SGLST= ****** GX

FF    = 000014   	RS$OV = ****** GX	S$GUP = ****** GX	$ASCT = ****** GX	$SRCH = ****** GX

F$LG  = ****** GX	R$$11M= 000000   	S$GWDP= ****** GX	$CRSEG= ****** GX	$SRCHI= ****** GX

GNCOMA  000652R  	SG$LOD= ****** GX	S$GWND= ****** GX	$CRVSG= ****** GX	$SRCIV= ****** GX

GNDASH  001074R  	SG$MEM= ****** GX	S$YCMT= ****** GX	$CVLOK= ****** GX	$SWTCH= ****** GX

GND1    001200R  	SG$RES= ****** GX	S$YFLG= ****** GX	$CVRL = ****** GX	$SYMHD= ****** GX

GNFILE  001370R  	SPA   = 000040   	S$YLGH= ****** GX	$DIRHD= ****** GX	$TSKNM= ****** GX

GNLPAR  000614R  	SW$AL = ****** GX	S$YM  = ****** GX	$DSTK = ****** GX	$TSKWD= ****** GX

GNLVL   001670R  	SW$CM = ****** GX	TMP     000020R  	$FRHD = ****** GX	$UNLPG= ****** GX

GNRPAR  000650R  	SW$NH = ****** GX	TSKSW   000032R  	$ISYM = ****** GX	$WRMPG= ****** GX

GNSCTN  001232R  	SY$GBL= ****** GX	T$YP  = ****** GX	$ISYMV= ****** GX	$$    = 000001

GNSEG   000532R



. ABS.	000000	   000

      	002014	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  1204 WORDS  ( 5 PAGES)

DYNAMIC MEMORY:  2772 WORDS  ( 10 PAGES)

ELAPSED TIME:  00:00:20

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

