SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3





      1						.TITLE	SGALO

      2						.IDENT	/25/

      3					                                                                                ;**-1

      4

      5					;

      6					; COPYRIGHT (C) 1976

      7					; COPYRIGHT (C) 1977

      8					; DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

      9					;

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

     11					; SINGLE COMPUTER SYSTEM AND MAY  BE  COPIED   ONLY  WITH  THE

     12					; INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE,  OR

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

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

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

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

     17					; IN DEC.

     18					;

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

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

     21					; EQUIPMENT CORPORATION.

     22					;

     23					; DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF

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

     25					;

     26					; VERSION 25

     27					;                                                                               ;**-1

     28					; D. N. CUTLER/C. MONIA 27-JAN-74

     29					;

     30					;

     31					;

     32					; MODIFICATIONS

     33					;

     34					; NO.		DATE		PROGRAMMER

     35					; ---		----		----------

     36					;

     37					; 001		03-JULY-73	C. MONIA

     38					; 021		27-JAN-74	C. MONIA

     39					; 041		19-MAY-75	C. MONIA

     40					; 047		09-FEB-76	C. MONIA

     41					; 048		09-FEB-76	C. MONIA

     42					; 052		20-MAR-76	C. MONIA

     43					; 058		22-APR-76	C. MONIA

     44					; 062		31-MAY-76	C. MONIA

     45					; 064		28-JUN-76	C. MONIA

     46					; 065		30-JUN-76	J. KASSON

     47					; JAK100	16-FEB-77	CHNAGES FOR MULTIUSER TASKS

     48					; JAK113	20-DEC-77	FIX FOR READ ONLY MEMORY

     49					;

     50					; SEGMENT PHYSICAL AND VIRTUAL MEMORY ALLOCATION

     51					;

     52					; LOCAL DATA

     53					;

     54					; APR ALLOCATION BITMASKS

     55					;

     56					; ASCENDING VIRTUAL ADDRESSES ARE RIGHTMOST

     57					;

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-1





     58

     59						.LIST	MEB

     60

     61		000200 			MSK=200				;

     62

     63	000000				APRMK:				;

     64

     65		000010 				.REPT	8.

     66

     67						.BYTE	MSK		;

     68					MSK=MSK!<MSK/2>			;

     69

     70						.ENDR

	000000	   200 				.BYTE	MSK		;

	000001	   300 				.BYTE	MSK		;

	000002	   340 				.BYTE	MSK		;

	000003	   360 				.BYTE	MSK		;

	000004	   370 				.BYTE	MSK		;

	000005	   374 				.BYTE	MSK		;

	000006	   376 				.BYTE	MSK		;

	000007	   377 				.BYTE	MSK		;

     71

     72						.NLIST	MEB

     73

     74						.EVEN

     75

     76

     77					;

     78					; ADJACENCY IS ASSUMED

     79					;

     80

     81		000010'			CLRBEG=.			; DEFINE START OF AREA TO CLEAR

     82	000010				LCLGH:	.BLKW	1		;LOCAL LENGTH OF SEGMENT

     83	000012				LVADR:	.BLKW	1		;LOCAL VIRTUAL ADDRESS

     84	000014				PHYBD:	.BLKW	1		; PHYSICAL ADDRESS BOUND

     85	000016				VRTBD:	.BLKW	1		; VIRTUAL ADDRESS BOUND

     86	000020				WNLEN:	.BLKW	1		; WINDOW LENGTH FLAG

     87	000022				WNSTS:	.BLKW	1		; WINDOW STATUS

     88		000006 			CLRSZ=.-CLRBEG/2		; NUMBER OF WORDS TO CLEAR

     89	000024				ROFLG:	.BLKW	1		; READ-ONLY ALLOCATION FLAG

     90	000026				TSKSW:	.BLKW	1		; TASK SWITCH WORD

     91	000030				CURWND:	.BLKW	2		; CURRENT R/W AND R/O WINDOWS			;JAK100

     92	000034				LVL:	.BLKW	1		; LEVEL AT WHICH PREVIOUS WINDOW WAS ALLOCATED	;JAK100

     93	000036				COTFLG:	.BLKW	1		; CO-TREE FLAG 					;JAK100

     94	000040				RWND:	.BLKW	2		; CO-TREE ROOT'S WINDOW BLOCK ADDRESS		;JAK100

     95	000044				TLEN:	.BLKW	1		; LENGTH OF LONGEST SEGMENT IN CO-TREE		;JAK100

     96		000017 			CLRSZ2=.-CLRBEG/2		; NUMBER OF WORDS TO CLEAR			;JAK100

     97

     98					;+

     99					; **-$SGALO-SEGMENT MEMORY ALLOCATION

    100					;

    101					; THIS ROUTINE IS CALLED IN PHASE 4 TO ALLOCATE PHYSICAL AND VIRTUAL

    102					; MEMORY FOR ALL SEGMENTS IN THE ALLOCATION.

    103					;

    104					; INPUTS:

    105					;

    106					;	NONE.

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-2





    107					;

    108					; OUTPUTS:

    109					;

    110					;	PHYSICAL AND VIRTUAL MEMORY IS ALLOCATED FOR ALL SEGMENTS.

    111					;-

    112

    113	000046				$SGALO::			;

    114	000046					SAVRG			; SAVE THE NON-VOLATILE REGISTERS

    115	000052	005067 	177746 			CLR	ROFLG		; CLEAR READ-ONLY FLAG

    116	000056					CALL	CLRMEM		; CLEAR WORK AREA

    117	000062	016701 	000000G			MOV	$TSKNM,R1	; GET ADDRESS OF TASK FILE NAMEBLOCK

    118	000066					CALL	$CVRL		; CONVERT TO REAL ADDRESS

    119	000072	016067 	000000G	177726 		MOV	E$LSWT(R0),TSKSW ; COPY TASK SWITCHES

    120	000100	032767 	000000G	177720 		BIT	#SW$CM,TSKSW	; TASK BUILT IN COMPATIBILITY MODE?

    121	000106	001403 				BEQ	5$		; IF EQ NO

    122	000110	012767 	001000 	000000G		MOV	#512.,$PHYBD	; FORCE 256-WORD ALIGNMENT

    123	000116				5$:				;

    124	000116	012700 	001650'			MOV	#SGALO,R0	; GET ADDRESS OF PHASE CONTROL ROUTINE

    125	000122					CALL	$PCTRL		; CALL PHASE CONTROL

    126	000126	005767 	177704 			TST	COTFLG		; ANY CO-TREES PROCESSED			;JAK100

    127	000132	001410 				BEQ	7$		; IF EQ NO					;JAK100

    128	000134	016701 	177672 			MOV	CURWND+2,R1	; GET ADDRESS OF WINDOW TO UNLOCK		;JAK100

    129	000140					CALL	$UNLPG		; UNLOCK					;JAK100

    130	000144	016701 	177670 			MOV	RWND,R1		; GET VIRTUAL ADDRESS OF WINDOW TO UNLOCK	;JAK100

    131	000150					CALL	$UNLPG		; UNLOCK					;JAK100

    132	000154				7$:										;JAK100

    133	000154	005067 	177654 			CLR	LVL		; CLEAR LEVEL COUNT

    134	000160	012700 	002440'			MOV	#WDALO,R0	; GET ADDRESS OF PHASE CONTROL ROUTINE

    135	000164					CALL	$PCTRL		; COMPUTE WINDOW BLOCK REQUIREMENTS

    136	000170	016700 	000000G			MOV	$NUMWN,R0	; GET NUMBER OF WINDOW BLOCKS

    137	000174	066700 	000000G			ADD	$MXWND,R0	; ADD LIBRARY WINDOWS

    138	000200	020027 	000010 			CMP	R0,#8.		; MORE THAT 8 WINDOWS REQUIRED?

    139	000204	101404 				BLOS	10$		; IF LOS NO

    140	000206	012701 	000000C			MOV	#<S$V2*400!E$R86>,R1 ; GET ERROR/SEVERITY

    141	000212					CALL	$ERMSG		; FATAL, NO RETURN

    142	000216				10$:				;

    143	000216	012704 	000000G			MOV	#$HDSIZ,R4	; POINT TO HEADER SIZE

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

    145	000230	001005 				BNE	20$		; IF NE NO

    146	000232	012701 	000000G			MOV	#S$ZWND,R1	; GET LENGTH OF EACH WINDOW IN BYTES

    147

    148						.IF DF	V1145

    149

    150						MUL	R0,R1		; COMPUTE WINDOW ALLOCATION

    151

    152						.IFF

    153

    154	000236					CALL	$MUL		; COMPUTE WINDOW ALLOCATION

    155

    156						.ENDC

    157

    158	000242	060114 				ADD	R1,(R4)		; INCLUDE WINDOW ALLOCATION IN HEADER

    159

    160						.IF NDF	R$$11M

    161

    162						MOV	(R4),R0		; GET SIZE OF HEADER

    163						MOV	$PHYBD,R1	; GET PHYSICAL ADDRESS BOUND

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-3





    164						CALL	ADRUND		; ROUND TO PHYSICAL ADDRESS LIMIT

    165						MOV	R0,(R4)		; SET SIZE OF HEADER

    166					20$:				;

    167						MOV	$STACK,R1	; GET STACK SIZE

    168						MOV	#LVADR,R2	; POINT TO LOCAL VIRTUAL ADDRESS

    169						MOV	R1,(R2)		; SET CURRENT VIRTUAL ADDRESS

    170						ADD	(R4),R1		; ADD HEADER TO STACK

    171						MOV	R1,-(R2)	; SET LOCAL LENGTH

    172

    173						.IFF

    174

    175	000244				20$:				;

    176	000244	012702 	000010'			MOV	#LCLGH,R2	; GET LOCAL LENGTH

    177	000250	011412 				MOV	(R4),(R2)	; SET LOCAL LENGTH

    178	000252	066712 	000000G			ADD	$STACK,(R2)	; INCLUDE SIZE OF STACK

    179	000256	012212 				MOV	(R2)+,(R2)	; SET CURRENT VIRTUAL ADDRESS

    180

    181						.ENDC

    182

    183	000260	005767 	177540 			TST	ROFLG		; ALLOCATING READ-ONLY MEMORY

    184	000264	001543 				BEQ	50$		; IF EQ NO

    185	000266	016701 	000000G			MOV	$RTSEG,R1	; GET VIRTUAL ADDRESS OF ROOT SEGMENT

    186	000272					CALL	$CVRL		; CONVERT TO REAL

    187	000276	010005 				MOV	R0,R5		; SAVE SEGMENT DESCRIPTOR ADDRESS

    188	000300					CALL	$WRMPG		; WRITE-MARK DESCRIPTOR

    189	000304	016500 	000000G			MOV	S$GRO(R5),R0	; GET LENGTH OF READ-ONLY MEMORY

    190	000310	001444 				BEQ	46$		; IF EQ NO					;JAK100

    191	000312	016701 	000000G			MOV	$PHYBD,R1	; GET PHYSICAL ADDRESS BOUND

    192	000316					CALL	ADRUND		; ROUND TO PHYSICAL ADDRESS LIMIT

    193	000322	010065 	000000G			MOV	R0,S$GRO(R5)	; SAVE SIZE OF READ-ONLY ROOT

    194	000326	010001 				MOV	R0,R1		; COPY SIZE

    195	000330					CALL	BLOCKS		; CONVERT TO 32W BLOCKS

    196	000334	010167 	000002G			MOV	R1,$MXLGH+2	; SET PHYSICAL ADDRESS

    197	000340					CALL	ALOAPR		; ALLOCATE APR FOR R-O ROOT			;JAK100

    198	000344	010165 	000000G			MOV	R1,S$GROB(R5)	; RECORD BASE VIRTUAL ADDRESS			;JAK100

    199	000350	005301 				DEC	R1		; DECREMENT BASE ADDRESS

    200	000352	020167 	000000G			CMP	R1,$HGHAD	; TEST AGAINST CURRENT HIGH ADDRESS BOUND

    201	000356	103002 				BHIS	45$		; IF HIS NO CHANGE

    202	000360	010167 	000000G			MOV	R1,$HGHAD	; UPDATE HIGH ADDRESS BOUND

    203	000364				45$:				;

    204	000364	016500 	000000G			MOV	S$GRO(R5),R0	; GET LENGTH OF R/O MEMORY

    205	000370	010503 				MOV	R5,R3		; COPY DESCRIPTOR ADDRESS

    206	000372	012704 	000002 			MOV	#2,R4		; SET R/O BIAS

    207	000376	060403 				ADD	R4,R3		; ...

    208	000400					CALL	BLKAL		; ALLOCATE DISK BLOCKS

    209	000404					CALL	50$		; ALLOCATE MEMORY

    210	000410	016701 	000000G			MOV	$RTSEG,R1	; GET VIRTUAL ADDRESS OF ROOT

    211	000414					CALL	$CVLOK		; CONVERT TO REAL, LOCK IN MEMORY

    212	000420	010005 				MOV	R0,R5		; SAVE REAL ADDRESS

    213	000422				46$:										;JAK100

    214	000422	012701 	000000G			MOV	#L$DLGH,R1	; GET SIZE OF LIBRARY DESCRIPTOR

    215	000426					CALL	$ALBLK		; ALLOCATE DESCRIPTOR

    216	000432	016710 	000000G			MOV	$LBRHD,(R0)	; LINK AS FIRST IN LIST

    217	000436	010067 	000000G			MOV	R0,$LBRHD	; ...

    218	000442	005267 	000004G			INC	$LBRHD+4	; INCREMENT COUNT OF ENTRIES

    219	000446	010003 				MOV	R0,R3		; COPY ADDRESS OF DESCRIPTOR

    220	000450	010004 				MOV	R0,R4		; SAVE DESCRIPTOR ADDRESS

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-4





    221	000452	005723 				TST	(R3)+		; POINT TO NAME

    222	000454	016723 	000000G			MOV	$ROPAR,(R3)+	; GET NAME OF R-O PARTITION NAME (L$DNME)	;JAK100

    223	000460	016723 	000002G			MOV	$ROPAR+2,(R3)+	;				(L$DNME+2)	;JAK100

    224	000464	016513 	000000G			MOV	S$GROB(R5),(R3)	; SET BASE ADDRESS OF LIBRARY

    225	000470	016500 	000000G			MOV	S$GRO(R5),R0	; GET LENGTH OF READ-ONLY ALLOCATION

    226	000474	010046 				MOV	R0,-(SP)	; SAVE LENGTH

    227	000476	016701 	000000G			MOV	$PHYBD,R1	; GET PHYSICAL ADDRESS BOUND

    228	000502					CALL	ADRUND		; ROUND TO ADDRESS LIMIT

    229	000506	005300 				DEC	R0		; BACK OFF TO HIGH ADDRESS

    230	000510	062300 				ADD	(R3)+,R0	; COMPUTE HIGH ADDRESS BOUND

    231	000512	010023 				MOV	R0,(R3)+	; SET HIGH LIMIT (L$DHGV)			;JAK100

    232	000514	005723 				TST	(R3)+		; BY-PASS HIGH VIRTUAL ADDRESS (L$DMXV)		;JAK100

    233	000516	012601 				MOV	(SP)+,R1	; RETRIEVE LENGTH OF ROOT

    234	000520					CALL	BLOCKS		; ROUND TO 32W BLOCKS

    235	000524	010123 				MOV	R1,(R3)+	; SAVE LENGTH OF ROOT

    236	000526	016723 	000002G			MOV	$MXLGH+2,(R3)+	; SET MAX LENGTH OF R/O AREA

    237	000532	005023 				CLR	(R3)+		; ZERO OFFSET (L$DOFF)				;JAK100

    238	000534	042763 	000000G	000000C		BIC	#LD$ACC,<L$DFLG-L$DWND>(R3) ; SET R-O ACCESS (L$DFLG)		;JAK100

    239	000542	062703 	000000C			ADD	#<L$DDAT-L$DWND>,R3 ; POINT TO DATE (L$DDAT)			;JAK100

    240	000546	012700 	000000G			MOV	#$BGTIM,R0	; GET TIME

    241	000552	012023 				MOV	(R0)+,(R3)+	; SET YEAR

    242	000554	012023 				MOV	(R0)+,(R3)+	; MONTH

    243	000556	011023 				MOV	(R0),(R3)+	; DAY

    244	000560	016413 	000000G			MOV	L$DSA(R4),(R3)	; SET CURRENT BASE

    245	000564	016701 	000000G			MOV	$RTSEG,R1	; GET ADDRESS OF ROOT SEGMENT

    246	000570					CALLR	$UNLPG		; UNLOCK PAGE

    247	000574				50$:				;

    248	000574	005067 	177236 			CLR	COTFLG		; CLEAR CO-TREE FLAG AND APR MASK		;JAK100

    249	000600	012700 	000722'			MOV	#PHALO,R0	; GET ADDRESS OF PHASE CONTROL ROUTINE

    250	000604					CALL	$PCTRL		; CALL PHASE CONTROL ROUTINE

    251	000610	005004 				CLR	R4		; CSET BIAS FOR R/W ALLOCATION

    252	000612					CALL	CLSWND		; CLOSE LAST R/W WINDOW

    253	000616	012704 	000002 			MOV	#2,R4		; SET BIAS FOR R/O ALLOCATION

    254	000622					CALL	CLSWND		; CLOSE LAST R/O WINDOW

    255	000626	016701 	000000G			MOV	$RTSEG,R1	; GET ADDRESS OF ROOT SEGMENT

    256	000632					CALL	$CVRL		; CONVERT TO REAL

    257	000636	016001 	000000G			MOV	S$GWDP(R0),R1	; GET ADDRESS OF WINDOW BLOCK

    258	000642					CALL	$CVRL		; CONVERT TO REAL

    259	000646	016001 	000000G			MOV	W.NSIZ(R0),R1	; GET WINDOW SIZE

    260	000652	000301 				SWAB	R1		; MULTIPLY BY 64.

    261	000654	106001 				RORB	R1		; ...

    262	000656	006001 				ROR	R1		; ...

    263	000660	006001 				ROR	R1		; ...

    264	000662	001401 				BEQ	60$		; IF EQ AT LOW LIMIT

    265	000664	005301 				DEC	R1		; BACK OFF TO ADDRESS LIMIT

    266	000666				60$:				;

    267	000666	010167 	000000G			MOV	R1,$HVRT0	; SET HIGH ADDRESS BOUND FOR WINDOW 0

    268	000672	016700 	000000G			MOV	$LBOFF,R0	; GET TASK OFFSET

    269	000676	012701 	000010 			MOV	#512./64.,R1	; GET BOUNDARY VALUE

    270	000702					CALL	ROUND		; ROUND TO 512 BYTE BOUNDARY

    271	000706	103002 				BCC	70$		; IF C/C OK

    272	000710	012700 	177777 			MOV	#-1,R0		; SET OFFSET TO MAX

    273	000714				70$:				;

    274	000714	010067 	000000G			MOV	R0,$LBOFF	; SAVE TASK OFFSET

    275	000720					RETURN			;

    276

    277					;

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-5





    278					; ALLOCATE MEMORY AND DISK SPACE

    279					;

    280

    281	000722				PHALO:				;

    282	000722					SAVRG			; SAVE THE NON-VOLATILE REGISTERS

    283	000726	016701 	000000G			MOV	$CRVSG,R1	; GET VIRTUAL ADDRESS OF CURRENT SEGMENT

    284	000732					CALL	$WRMPG		; WRITE-MARK PAGE

    285	000736	016705 	000000G			MOV	$CRSEG,R5	; GET REAL ADDRESS OF CURRENT SEGMENT

    286	000742	016503 	000000G			MOV	S$GWDP(R5),R3	; GET WINDOW BLOCK ADDRESS			;JAK100

    287	000746	005767 	000000G			TST	$LVL		; ROOT LEVEL?					;JAK100

    288	000752	001032 				BNE	10$		; IF NE NO					;JAK100

    289	000754	020167 	000000G			CMP	R1,$RTSEG	; AT MAIN ROOT?

    290	000760	001004 				BNE	5$		; IF EQ NO					;JAK100

    291	000762	016567 	000000G	177040 		MOV	S$GWDP(R5),CURWND ; SETUP CURRENT WINDOW

    292	000770	000423 				BR	10$		;						;JAK100

    293	000772				5$:										;JAK100

    294	000772	010301 				MOV	R3,R1		; GET WINDOW BLOCK ADDRESS			;JAK100

    295	000774					CALL	$CVRL		; CONVERT TO REAL				;JAK100

    296	001000	032760 	000000G	000000G		BIT	#WS.WRT,W.NSTS(R0) ; READ-ONLY SEGMENT?				;JAK100

    297	001006	001014 				BNE	10$		; IF NE NO					;JAK100

    298	001010	016000 	000000G			MOV	W.NBAS(R0),R0	; GET LENGTH OF CO-TREE OVERLAY STRUCTURE	;JAK100

    299	001014	001407 				BEQ	7$		; IF EQ NO OVERLAYS				;JAK100

    300	001016	005267 	177014 			INC	COTFLG		; FLAG AS CO-TREE				;JAK100

    301	001022					CALL	ALOAPR		; ALLOCATE APRS FOR CO-TREE			;JAK100

    302	001026	005301 				DEC	R1		; BACK OFF BASE ADDRESS				;JAK100

    303	001030	010165 	000000G			MOV	R1,S$GVAD(R5)	; SAVE BASE AS VIRTUAL UPPER BOUND		;JAK100

    304	001034				7$:										;JAK100

    305	001034	005067 	176774 			CLR	LVL		; SET TO LEVEL ZERO (ROOT)			;JAK100

    306	001040				10$:				;

    307	001040	012767 	000004 	176746 		MOV	#4,PHYBD	; SET PHYSICAL ADDRESS BOUND

    308	001046	012767 	000004 	176742 		MOV	#4,VRTBD	; SET VIRTUAL ADDRESS BOUND

    309	001054	010500 				MOV	R5,R0		; COPY ADDRESS OF SEGMENT

    310	001056	016001 	000000G			MOV	S$GUP(R0),R1	; GET LINK-UP

    311	001062	001402 				BEQ	20$		; IF EQ NO LINK UP

    312	001064					CALL	$CVRL		; CONVERT LINK-UP TO REAL ADDRESS

    313	001070				20$:				;

    314	001070	005760 	000000G			TST	S$GDWN(R0)	; ROOT SEGMENT?

    315	001074	001412 				BEQ	30$		; IF EQ YES

    316	001076	132760 	000000G	000000G		BITB	#SG$RES,S$GSTS(R0) ; SEGMENT RESIDENT?

    317	001104	001406 				BEQ	30$		; IF EQ NO

    318	001106	016767 	000000G	176700 		MOV	$PHYBD,PHYBD	; SET PHYSICAL ADDRESS BOUND

    319	001114	016767 	000000G	176674 		MOV	$VRTBD,VRTBD	; SET VIRTUAL ADDRESS BOUND

    320	001122				30$:				;

    321	001122	012704 	000002 			MOV	#2,R4		; ASSUME R/O ALLOCATION

    322	001126	010346 				MOV	R3,-(SP)	; SAVE VIRTUAL ADDRESS

    323	001130	010301 				MOV	R3,R1		; COPY VIRTUAL ADDRESS

    324	001132					CALL	$CVLOK		; CONVERT TO REAL, LOCK IN MEMORY

    325	001136					CALL	$WRMPG		; WRITE-MARK PAGE

    326	001142	010046 				MOV	R0,-(SP)	; SAVE REAL ADDRESS

    327	001144	010002 				MOV	R0,R2		; COPY ADDRESS

    328	001146	016500 	000000G			MOV	S$GRW(R5),R0	; GET R/W ALLOCATION IN BYTES

    329	001152	005767 	176646 			TST	ROFLG		; READ-ONLY ALLOCATION PERFORMED?

    330	001156	001411 				BEQ	50$		; IF EQ NO

    331	001160	005001 				CLR	R1		; ASSUME AT MAIN ROOT

    332	001162	026767 	000000G	000000G		CMP	$CRVSG,$RTSEG	; SEGMENT=MAIN ROOT?

    333	001170	001412 				BEQ	60$		; IF EQ YES, IGNORE R/O ALLOCATION

    334	001172	032762 	000000G	000000G		BIT	#WS.WRT,W.NSTS(R2) ; WINDOW BLOCK IMPURE?

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-6





    335	001200	001413 				BEQ	70$		; IF EQ NO

    336	001202				50$:				;

    337	001202	010065 	000000G			MOV	R0,S$GROB(R5)	; SET BASE OF READ-ONLY SECTIONS

    338	001206	016501 	000000G			MOV	S$GRO(R5),R1	; GET READ-ONLY ALLOCATION

    339	001212	005065 	000000G			CLR	S$GRO(R5)	; CLEAR READ-ONLY ALLOCATION

    340	001216				60$:				;

    341	001216	005004 				CLR	R4		; SET R/W BIAS

    342	001220					CALL	ADOFST		; COMPUTE R/W PLUS R/O

    343	001224	010065 	000000G			MOV	R0,S$GRW(R5)	; SET R/W ALLOCATION SIZE

    344	001230				70$:				;

    345	001230	016700 	176554 			MOV	LCLGH,R0	; GET LOCAL LENGTH

    346	001234	010503 				MOV	R5,R3		; COPY DESCRIPTOR ADDRESS

    347	001236	060403 				ADD	R4,R3		; ADD R/W - R/O BIAS

    348	001240	016301 	000000G			MOV	S$GRW(R3),R1	; GET ALLOCATION COMPONENT

    349	001244					CALL	ADOFST		; ADD OFFSET

    350	001250	016701 	176540 			MOV	PHYBD,R1	; GET PHYSICAL ADDRESS LIMIT

    351	001254					CALL	ADRUND		; ROUND TO PHYSICAL ADDRESS LIMIT

    352	001260	010065 	000000G			MOV	R0,S$GLNG(R5)	; SET LENGTH OF DISK READ

    353	001264	005767 	176546 			TST	COTFLG		; CO-TREE?					;JAK100

    354	001270	001412 				BEQ	77$		; IF EQ NO					;JAK100

    355	001272	005767 	000000G			TST	$LVL		; ROOT OF CO-TREE?				;JAK100

    356	001276	001007 				BNE	77$		; IF NE NO					;JAK100

    357	001300					CALL	ALOAPR		; FIND FREE APR TO ALLOCATE			;JAK100

    358	001304	010165 	000000G			MOV	R1,S$GROB(R5)	; SAVE R-O BASE ADDRESS				;JAK100

    359	001310	010165 	000000G			MOV	R1,S$GLDA(R5)	; STORE LOAD ADDRESS				;JAK100

    360	001314	000470 				BR	90$								;JAK100

    361	001316				77$:										;JAK100

    362	001316	016702 	000000G			MOV	$HVRTL,R2	; GET HIGH VIRTUAL ADDRESS

    363	001322	016501 	000000G			MOV	S$GDWN(R5),R1	; GET LINK-DOWN

    364	001326	001404 				BEQ	80$		; IF EQ AT ROOT

    365	001330					CALL	$CVRL		; CONVERT TO REAL

    366	001334	016002 	000000G			MOV	S$GVAD(R0),R2	; GET LOCAL VIRTUAL ADDRESS

    367	001340				80$:				;

    368	001340	005702 				TST	R2		; AT VIRTUAL ZERO?

    369	001342	001406 				BEQ	85$		; IF EQ YES

    370	001344	005202 				INC	R2		; INCREMENT VIRTUAL ADDRESS

    371	001346	001004 				BNE	85$		; IF NE OK

    372	001350					CALL	OVRFLW		; REPORT ADDRESS OVERFLOW

    373	001354	012702 	177777 			MOV	#-1,R2		; SET BASE ADDRESS TO MAX

    374	001360				85$:				;

    375	001360	010265 	000000G			MOV	R2,S$GLDA(R5)	; SET SEGMENT LOAD ADDRESS

    376	001364	010200 				MOV	R2,R0		; COPY BASE ADDRESS

    377	001366	016701 	176420 			MOV	LVADR,R1	; GET CURRENT VIRTUAL ADDRESS

    378	001372					CALL	ADOFST		; ADD OFFSET

    379	001376	010067 	176410 			MOV	R0,LVADR	; SET LOCAL VIRTUAL ADDRESS

    380	001402	005767 	176416 			TST	ROFLG		; READ-ONLY ALLOCATION RECOGNIZED?

    381	001406	001404 				BEQ	87$		; IF EQ NO

    382	001410	026767 	000000G	000000G		CMP	$CRVSG,$RTSEG	; AT MAIN ROOT?

    383	001416	001402 				BEQ	88$		; IF EQ YES

    384	001420				87$:				;

    385	001420	060065 	000000G			ADD	R0,S$GROB(R5)	; SET READ-ONLY BASE

    386	001424				88$:				;

    387	001424	016301 	000000G			MOV	S$GRW(R3),R1	; GET LENGTH OF ALLOCATION IN BYTES

    388	001430					CALL	ADOFST		; COMPUTE TOP ADDRESS BOUND

    389	001434	016701 	176356 			MOV	VRTBD,R1	; GET VIRTUAL ADDRESS BOUND

    390	001440					CALL	ROUND		; ROUND TO ADDRESS LIMIT

    391	001444	103401 				BCS	880$		; IF C/S OVER 32K LIMIT

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-7





    392	001446	001401 				BEQ	89$		; IF EQ AT LOW LIMIT

    393	001450				880$:				;

    394	001450	005301 				DEC	R1		; BACK OFF LIMIT

    395	001452				89$:				;

    396	001452	010165 	000000G			MOV	R1,S$GVAD(R5)	; SAVE VIRTUAL ADDRESS UPPER BOUND

    397	001456	005767 	176354 			TST	COTFLG		; CO-TREE?					;JAK100

    398	001462	001005 				BNE	90$		; IF NE YES					;JAK100

    399	001464	020167 	000000G			CMP	R1,$HVRTL	; HAVE NEW HIGH LIMIT?

    400	001470	101402 				BLOS	90$		; IF LOS NO

    401	001472	010167 	000000G			MOV	R1,$HVRTL	; SET NEW HIGH LIMIT

    402	001476				90$:				;

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

    404	001504	001410 				BEQ	100$		; IF EQ NO

    405	001506	016602 	000002 			MOV	2(SP),R2	; GET VIRTUAL ADDRESS OF CURRENT WINDOW

    406	001512					CALL	CLSWND		; CLOSEOUT PREVIOUS WINDOW ALLOCATION

    407	001516	011602 				MOV	(SP),R2		; RETRIEVE REAL ADDRESS

    408	001520	016562 	000000G	000000G		MOV	S$GLDA(R5),W.NBAS(R2) ; SET BASE ADDRESS OF WINDOW

    409	001526				100$:				;

    410	001526	016500 	000000G			MOV	S$GLDA(R5),R0	; GET LOAD ADDRESS

    411	001532	016501 	000000G			MOV	S$GLNG(R5),R1	; GET LOAD LENGTH

    412	001536					CALL	ADOFST		; COMPUTE TOP WINDOW ADDRESS

    413	001542	012602 				MOV	(SP)+,R2	; GET REAL ADDRESS OF WINDOW BLOCK

    414	001544	166200 	000000G			SUB	W.NBAS(R2),R0	; SUBTRACT BASE VIRTUAL ADDRESS

    415	001550	020062 	000000G			CMP	R0,W.NSIZ(R2)	; NEW MAX LENGTH?

    416	001554	103402 				BLO	110$		; IF LO NO

    417	001556	010062 	000000G			MOV	R0,W.NSIZ(R2)	; SET NEW MAX LENGTH

    418	001562				110$:				;

    419	001562	012601 				MOV	(SP)+,R1	; GET VIRTUAL ADDRESS OF WINDOW

    420	001564					CALL	$UNLPG		; UNLOCK PAGE

    421	001570					CALL	CSREL		; RELOCATE ALL SECTIONS

    422	001574	012700 	000010'			MOV	#LCLGH,R0	; GET ADDRESS OF LOCAL LENGTH

    423	001600	005020 				CLR	(R0)+		; CLEAR LOCAL LENGTH

    424	001602	005010 				CLR	(R0)		; CLEAR LOCAL VIRTUAL ADDRESS

    425	001604	016500 	000000G			MOV	S$GLNG(R5),R0	; GET DISK ALLOCATION

    426	001610				BLKAL:				;

    427	001610	016463 	000000G	000000G		MOV	$RLBLK(R4),S$GBLK(R3) ; SET DISK ADDRESS

    428	001616	132765 	000000G	000000G		BITB	#SG$DSK,S$GSTS(R5) ; SEGMENT HAVE DISK ALLOCATION?

    429	001624	001010 				BNE	10$		; IF NE NO

    430	001626	000241 				CLC			; CLEAR CARRY

    431	001630	006000 				ROR	R0		; CONVERT TO WORDS

    432	001632	062700 	000377 			ADD	#377,R0		; ROUND TO NEAREST BLOCK

    433	001636	105000 				CLRB	R0		; CLEAR LOW BYTE

    434	001640	000300 				SWAB	R0		; POSITION TO LOW BYTE

    435	001642	060064 	000000G			ADD	R0,$RLBLK(R4)	; COMPUTE ALLOCATION

    436	001646				10$:				;

    437	001646					RETURN			;

    438

    439					;

    440					; SEGMENT MEMORY ALLOCATION ROUTINE

    441					;

    442					; THIS ROUTINE IS CALLED FOR EACH SEGMENT IN THE ALLOCATION.

    443					;

    444

    445	001650				SGALO:				;

    446	001650					SAVRG			; SAVE THE NON-VOLATILE REGISTERS

    447	001654					CALL	CLRM2		; CLEAR WORKING STORAGE				;JAK100

    448	001660	016701 	000000G			MOV	$CRVSG,R1	; GET VIRTUAL ADDRESS OF CURRENT SEGMENT

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-8





    449	001664					CALL	$WRMPG		; WRITE-MARK PAGE

    450	001670	016705 	000000G			MOV	$CRSEG,R5	; GET REAL ADDRESS OF SEGMENT			;JAK100

    451	001674	005767 	000000G			TST	$LVL		; ROOT LEVEL?					;JAK100

    452	001700	001047 				BNE	5$		; IF NE NO					;JAK100

    453	001702	020167 	000000G			CMP	R1,$RTSEG	; AT ROOT?

    454	001706	001012 				BNE	2$		; IF NE NO					;JAK100

    455	001710	056767 	000000G	176102 		BIS	$STACK,WNLEN	; SET STACK SIZE

    456	001716	056767 	000000G	176074 		BIS	$HDSIZ,WNLEN	; SET HEADER SIZE

    457	001724	052767 	000000G	176070 		BIS	#WS.WRT,WNSTS	; FORCE R/W FLAG ON

    458	001732	000432 				BR	5$								;JAK100

    459	001734				2$:										;JAK100

    460	001734	032767 	000000G	000000G		BIT	#MP$SY,$SWTCH	; MAPPED TARGET SYSTEM?				;JAK100

    461	001742	001426 				BEQ	5$		; IF EQ NO					;JAK100

    462	001744	032767 	000000G	176054 		BIT	#<SW$MU>,TSKSW	; RECOGNIZING R/O PROTECTION			;JAK100

    463	001752	001422 				BEQ	5$		; IF EQ NO					;JAK100

    464	001754	010667 	176056 			MOV	SP,COTFLG	; FLAG AT CO-TREE				;JAK100

    465	001760	016701 	176054 			MOV	RWND,R1		; FIRST CO-TREE ?				;JAK100

    466	001764	001402 				BEQ	4$		; IF EQ YES					;JAK100

    467	001766					CALL	$UNLPG		; UNLOCK PRIVOUS WINDOW				;JAK100

    468	001772				4$:										;JAK100

    469	001772	016567 	000000G	176040 		MOV	S$GWDP(R5),RWND ; SAVE VIRTUAL ADDRESS OF WINDOW BLOCK FOR	;JAK100

    470									; CO-TREE ROOT					;JAK100

    471	002000	016701 	176034 			MOV	RWND,R1		; GET VIRTUAL ADDRESS				;JAK100

    472	002004					CALL	$CVLOK		; CONVERT TO REAL AND LOCK IN MEMORY		;JAK100

    473	002010					CALL	$WRMPG		; WRITE MARK PAGE				;JAK100

    474	002014	010067 	176022 			MOV	R0,RWND+2	; SAVE REAL ADDRESS OF WINDOW			;JAK100

    475	002020				5$:				;

    476	002020	005003 				CLR	R3		; CLEAR R/O FLAG				;JAK113

    477	002022	016705 	000000G			MOV	$CRSEG,R5	; GET REAL ADDRESS OF SEGMENT

    478	002026	012704 	000002 			MOV	#2,R4		; SET FLAG FOR R/W ALLOCATION

    479	002032					CALL	CSALO		; ALLOCATE R/W MEMORY

    480	002036	010401 				MOV	R4,R1		; GET ADDRESS LIMIT

    481	002040	012704 	000010'			MOV	#LCLGH,R4	; POINT TO LOCAL LENGTH

    482	002044	011400 				MOV	(R4),R0		; GET LOCAL LENGTH

    483	002046					CALL	ADRUND		; ROUND TO SPECIFIED LIMIT

    484	002052	010065 	000000G			MOV	R0,S$GRW(R5)	; SAVE LENGTH

    485	002056	010014 				MOV	R0,(R4)		; SET NEW LOCAL LENGTH

    486	002060	050067 	175734 			BIS	R0,WNLEN	; SET LENGTH FLAG

    487	002064	001403 				BEQ	10$		; IF EQ SEGMENT HAS NO R/W ALLOCATION

    488	002066	052767 	000000G	175726 		BIS	#WS.WRT,WNSTS	; SET R/W FLAG

    489	002074				10$:				;

    490	002074	005703 				TST	R3		; ANY R/O MEMORY

    491	002076	001463 				BEQ	40$		; IF EQ NO

    492	002100	005024 				CLR	(R4)+		; RESET LOCAL LENGTH

    493	002102	005014 				CLR	(R4)		; CLEAR LOCAL VIRTUAL ADDRESS

    494	002104	012704 	177776 			MOV	#-2,R4		; SET FOR R/O ALLOCATION

    495	002110					CALL	CSALO		; ALLOCATE R/O MEMORY

    496	002114	012704 	000010'			MOV	#LCLGH,R4	; POINT TO LOCAL LENGTH

    497	002120	051467 	175674 			BIS	(R4),WNLEN 	; SET LENGTH FLAG

    498	002124	012701 	000002 			MOV	#2,R1		; GET BOUNDARY VALUE

    499	002130	011400 				MOV	(R4),R0		; GET LOCAL LENGTH

    500	002132					CALL	ADRUND		; ROUND TO LIMIT

    501	002136	010065 	000000G			MOV	R0,S$GRO(R5)	; SAVE LIMIT

    502	002142	032767 	000000G	000000G		BIT	#MP$SY,$SWTCH	; MAPPED TARGET SYSTEM?

    503	002150	001433 				BEQ	30$		; IF EQ NO

    504	002152	032767 	000000G	175646 		BIT	#<SW$MU>,TSKSW	; RECOGNIZING R/O PROTECTION?

    505	002160	001425 				BEQ	20$		; IF EQ NO

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-9





    506	002162	032767 	000000G	175636 		BIT	#SW$NH,TSKSW	; TASK HAVE HEADER?

    507	002170	001021 				BNE	20$		; IF NE NO

    508	002172	010667 	175626 			MOV	SP,ROFLG	; SET READ-ONLY RECOGNITION FLAG

    509	002176	005267 	000000G			INC	$NUMWN		; ASSUME AT MAIN ROOT

    510	002202	026767 	000000G	000000G		CMP	$CRVSG,$RTSEG	; CURRENT=MAIN ROOT?

    511	002210	001416 				BEQ	40$		; IF EQ YES

    512	002212	005367 	000000G			DEC	$NUMWN		; RESET WINDOW COUNT

    513	002216	005767 	000000G			TST	$LVL		; CO-TREE ROOT					;JAK113

    514	002222	001411 				BEQ	40$		; IF EQ YES					;JAK113

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

    516	002232	001005 				BNE	40$		; IF NE YES

    517	002234				20$:				;

    518	002234	005714 				TST	(R4)		; ANY R/O LENGTH?

    519	002236	001403 				BEQ	40$		; IF EQ NO

    520	002240				30$:				;

    521	002240	052767 	000000G	175554 		BIS	#WS.WRT,WNSTS	; SET R/W FLAG

    522	002246				40$:				;

    523	002246	016501 	000000G			MOV	S$GWDP(R5),R1	; GET ADDRESS OF WINDOW BLOCK

    524	002252	001456 				BEQ	50$		; IF EQ NONE

    525	002254					CALL	$CVRL		; CONVERT TO REAL

    526	002260					CALL	$WRMPG		; WRITE-MARK PAGE

    527	002264	056760 	175532 	000000G		BIS	WNSTS,W.NSTS(R0) ; SET FLAGS

    528	002272	056760 	175522 	000000G		BIS	WNLEN,W.NLEN(R0) ; SET LENGTH FLAG

    529	002300	005767 	175532 			TST	COTFLG		; CO-TREE?					;JAK100

    530	002304	001441 				BEQ	50$		; IF EQ NO					;JAK100

    531	002306	016704 	175530 			MOV	RWND+2,R4	; GET CO-TREE ROOT WINDOW BLOCK ADDRESS		;JAK100

    532	002312	056764 	175504 	000000G		BIS	WNSTS,W.NSTS(R4); SET FLAGS					;JAK100

    533	002320	005767 	175476 			TST	WNSTS		; SEGMENT R-W?					;JAK100

    534	002324	001031 				BNE	50$		; IF NE R-W SEGMENT				;JAK100

    535	002326	016501 	000000G			MOV	S$GDWN(R5),R1	; GET LINK DOWN					;JAK100

    536	002332	001417 				BEQ	45$		; IF EQ ROOT					;JAK100

    537	002334					CALL	$CVRL		; CONVERT TO REAL				;JAK100

    538	002340	016001 	000000G			MOV	S$GVAD(R0),R1	; GET LOCAL LENGTH				;JAK100

    539	002344	016500 	000000G			MOV	S$GRO(R5),R0	; GET LEMGTH OF SEGMENT				;JAK100

    540	002350					CALL	ADOFST		; ADD OFFSET					;JAK100

    541	002354	016701 	000000G			MOV	$VRTBD,R1	; GET VIRTUAL BOUND				;JAK100

    542	002360					CALL	ROUND		; ROUND TO PHYSCIAL BOUND			;JAK100

    543	002364	103401 				BCS	44$		; IF C/S OVER LIMIT				;JAK100

    544	002366	001401 				BEQ	45$		; IF EQ AT LOW LIMIT				;JAK100

    545	002370				44$:										;JAK100

    546	002370	005301 				DEC	R1		; BACK OFF LIMIT				;JAK100

    547	002372				45$:										;JAK100

    548	002372	010165 	000000G			MOV	R1,S$GVAD(R5)	; SAVE LOCAL LENGTH				;JAK100

    549	002376	020164 	000000G			CMP	R1,W.NBAS(R4)	; HAVE NEW HIGH LIMIT				;JAK100

    550	002402	101402 				BLOS	50$		; IF LOS NO					;JAK100

    551	002404	010164 	000000G			MOV	R1,W.NBAS(R4)	; SAVE HIGH LOCAL LENGTH IN CO-TREE ROOT	;JAK100

    552	002410				50$:				;

    553	002410					RETURN			;

    554

    555					;

    556					; CLEAR WORKING STORAGE

    557					;

    558

    559						.ENABL	LSB								;JAK100

    560	002412				CLRMEM:				;

    561	002412	012701 	000017 			MOV	#CLRSZ2,R1	; GET NUMBER OF WORDS TO CLEAR			;JAK100

    562	002416	000402 				BR	5$								;JAK100

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-10





    563	002420				CLRM2:										;JAK100

    564	002420	012701 	000006 			MOV	#CLRSZ,R1	; GET NUMBER OF WORDS TO CLEAR			;JAK100

    565	002424				5$:										;JAK100

    566	002424	012700 	000010'			MOV	#CLRBEG,R0	; GET START OF AREA TO CLEAR			;JAK100

    567	002430				10$:				;

    568	002430	005020 				CLR	(R0)+		; CLEAR STORAGE

    569	002432					SOB	R1,10$		; ...

    570	002436					RETURN			;

    571					 										;JAK100

    572						.DSABL	LSB								;JAK100

    573

    574					;

    575					; ALLOCATE HEADER WINDOW BLOCKS

    576					;

    577

    578	002440				WDALO:				;

    579	002440					SAVRG			; SAVE THE NON-VOLATILE REGISTERS

    580	002444	016701 	000000G			MOV	$CRVSG,R1	; GET VIRTUAL ADDRESS OF CURRENT SEGMENT

    581	002450					CALL	$WRMPG		; WRITE-MARK PAGE

    582	002454	016705 	000000G			MOV	$CRSEG,R5	; GET REAL ADDRESS OF CURRENT SEGMENT

    583	002460	020167 	000000G			CMP	R1,$RTSEG	; RESIDENT ROOT?

    584	002464	001404 				BEQ	5$		; IF EQ YES

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

    586	002474	001441 				BEQ	25$		; IF EQ NO

    587	002476				5$:				;

    588	002476	016501 	000000G			MOV	S$GWDP(R5),R1	; GET ADDRESS OF WINDOW DESCRIPTOR

    589	002502					CALL	$CVRL		; CONVERT TO REAL

    590	002506					CALL	$WRMPG		; WRITE-MARK PAGE

    591	002512	032760 	000000G	000000G		BIT	#WS.WRT,W.NSTS(R0) ; AREA READ-ONLY?

    592	002520	001006 				BNE	10$		; IF NE NO

    593	002522	152765 	000000G	000000G		BISB	#SG$RO,S$GSTS(R5) ; SET READ-ONLY FLAG

    594	002530	012760 	000001 	000000G		MOV	#1,W.NRID(R0)	; SET REGION I/D TO R/W AREA

    595	002536				10$:				;

    596	002536	062700 	000000G			ADD	#W.NLEN,R0	; POINT TO MAPPING LENGTH

    597	002542	005767 	000000G			TST	$LVL		; AT ROOT LEVEL?

    598	002546	001404 				BEQ	15$		; IF EQ YES

    599	002550	026767 	000000G	175256 		CMP	$LVL,LVL	; AT HIGHER LEVEL THAN BEFORE?

    600	002556	101407 				BLOS	20$		; IF LOS NO

    601	002560				15$:				;

    602	002560	016767 	000000G	175246 		MOV	$LVL,LVL	; RESET LEVEL

    603	002566	005710 				TST	(R0)		; ANY LENGTH?

    604	002570	001402 				BEQ	20$		; IF EQ NO

    605	002572	005267 	000000G			INC	$NUMWN		; INCREMENT COUNT OF TASK WINDOWS

    606	002576				20$:				;

    607	002576	005010 				CLR	(R0)		; RESET LENGTH TO MAP

    608	002600				25$:				;

    609	002600					RETURN			;

    610

    611					;

    612					; CLOSEOUT CURRENT WINDOW

    613					;

    614					; THIS ROUTINE IS CALLED WHEN A NEW WINDOW IS ENTERED TO COMPLETE THE

    615					; ALLOCATION OF MEMORY TO THE PREVIOUS WINDOW

    616					;

    617

    618	002602				CLSWND:				;

    619	002602	016401 	000030'			MOV	CURWND(R4),R1	; GET VIRTUAL ADDRESS OF CURRENT WINDOW

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-11





    620	002606	010264 	000030'			MOV	R2,CURWND(R4)	; SET NEW CURRENT WINDOW

    621	002612	005701 				TST	R1		; HAVE WINDOW ADDRESS?

    622	002614	001423 				BEQ	10$		; IF EQ NO

    623	002616					CALL	$CVRL		; CONVERT TO REAL

    624	002622					CALL	$WRMPG		; WRITE-MARK PAGE

    625	002626	010002 				MOV	R0,R2		; COPY REAL ADDRESS OF WINDOW

    626	002630	016001 	000000G			MOV	W.NSIZ(R0),R1	; GET LENGTH

    627	002634					CALL	BLOCKS		; CONVERT TO BLOCKS

    628	002640	010160 	000000G			MOV	R1,W.NSIZ(R0)	; RESET SIZE

    629	002644	016400 	000000G			MOV	$MXLGH(R4),R0	; GET CURRENT PHYSICAL LENGTH

    630	002650	010062 	000000G			MOV	R0,W.NOFF(R2)	; SET WINDOW OFFSET INTO PARTITION

    631	002654					CALL	ADOFST		; COMPUTE PHYSICAL LENGTH

    632	002660	010064 	000000G			MOV	R0,$MXLGH(R4)	; SAVE NEW LENGTH

    633	002664				10$:				;

    634	002664					RETURN			;

    635

    636

    637					;

    638					; CONTROL SECTION MEMORY ALLOCATION

    639					;

    640

    641	002666	010500 			CSALO:	MOV	R5,R0		;GET ADDRESS OF CURRENT CONTROL SECTION

    642	002670	032767 	000000G	000000G		BIT	#SE$QA,$SWTCH	;SEQUENCE ALLOCATION?

    643	002676	001404 				BEQ	5$		;IF EQ NO

    644	002700	062700 	000000G			ADD	#S$GSEQ,R0	;POINT TO SEQUENCE ALLOCATION LISTHEAD

    645	002704	010046 				MOV	R0,-(SP)	;SET ADDRESS OF FIRST LINK WORD

    646	002706	000404 				BR	10$		;

    647	002710	062700 	000000G		5$:	ADD	#S$GCST,R0	;POINT TO SECTION TABLE

    648	002714	012746 	000000G			MOV	#$ISED,-(SP)	;SET SYMBOL EDIT ROUTINE ADDRESS

    649	002720	032767 	000000G	000000G	10$:	BIT	#SE$QA,$SWTCH	;SEQUENCE ALLOCATION?

    650	002726	001410 				BEQ	13$		;IF EQ NO

    651	002730	013600 				MOV	@(SP)+,R0	;GET ADDRESS OF NEXT ENTRY

    652	002732	001410 				BEQ	17$		;IF EQ DONE

    653	002734	010046 				MOV	R0,-(SP)	;SET ADDRESS OF NEXT LINK WORD

    654	002736	016001 	000002 			MOV	2(R0),R1	; GET VIRTUAL ADDRESS OF SECTION ENTRY

    655	002742					CALL	$CVRL		; CONVERT TO REAL ADDRESS

    656	002746	000403 				BR	20$		;

    657	002750				13$:	CALL	@(SP)+		;GET NEXT ENTRY

    658	002752	103001 				BCC	20$		;IF CC GOT ONE

    659	002754				17$:	RETURN			;

    660	002756	132760 	000000G	000000G	20$:	BITB	#CS$IND,C$SFLG(R0);INDIRECT ENTRY?

    661	002764	001355 				BNE	10$		;IF NE YES

    662	002766	132760 	000000G	000000G		BITB	#CS$REL,C$SFLG(R0);ABS SECTION?

    663	002774	001751 				BEQ	10$		;IF EQ YES

    664	002776	132760 	000000G	000000G		BITB	#CS$ACC,C$SFLG(R0);WHAT TYPE OF ACCESS?

    665	003004	000164 	003012'			JMP	30$(R4)		;DISPATCH

    666	003010	001004 				BNE	50$		;IF NE RO

    667	003012	000401 			30$:	BR	40$		;

    668	003014	001402 				BEQ	50$		;IF EQ RW

    669	003016	005203 			40$:	INC	R3		;INCREMENT FOUND ENTRY FLAG

    670	003020	000737 				BR	10$		;

    671	003022				50$:				;

    672	003022					CALL	$WRMPG		; WRITE-MARK PAGE

    673	003026	132760 	000000G	000001G		BITB	#CS$RES,C$SFLG+1(R0) ; TASK-RESIDENT SECTION?

    674	003034	001410 				BEQ	52$		; IF EQ NO, PROCESS SECTION

    675	003036	016060 	000000G	000000G		MOV	C$SCUR(R0),C$SLTH(R0) ; SET LENGTH

    676	003044	005060 	000000G			CLR	C$SCUR(R0)	; RESET CURRENT BASE ADDRESS

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-12





    677	003050	005060 	000000G			CLR	C$SBSE(R0)	; RESET BASE ADDRESS

    678	003054	000721 				BR	10$		;

    679	003056				52$:				;

    680	003056					CALL	$LCKPG		; LOCK PAGE IN MEMORY

    681	003062	010146 				MOV	R1,-(SP)	; SAVE VIRTUAL ADDRESS

    682	003064	010446 				MOV	R4,-(SP)	; SAVE R4 AND R3

    683	003066	010346 				MOV	R3,-(SP)	;

    684	003070	010003 				MOV	R0,R3		;SAVE ADDRESS OF SECTION ENTRY

    685	003072	132763 	000000G	000001G		BITB	#CS$VAS,C$SFLG+1(R3) ; VIRTUAL ARRAY STORAGE?

    686	003100	001435 				BEQ	53$		; IF EQ NO

    687	003102	016700 	000000G			MOV	$LBOFF,R0	; GET CURRENT TASK OFFSET

    688	003106	012701 	000010 			MOV	#512./64.,R1	; GET BOUNDARY VALUE

    689	003112					CALL	ADRUND		; ROUND TO 256 WORD BOUNDARY

    690	003116	010067 	000000G			MOV	R0,$LBOFF	; SAVE CURRENT OFFSET

    691	003122	010063 	000000G			MOV	R0,C$SBSE(R3)	; SET BASE OF SECTION

    692	003126	016300 	000000G			MOV	C$SCUR(R3),R0	; GET LENGTH

    693	003132	016363 	000000G	000000G		MOV	C$SBSE(R3),C$SCUR(R3) ; SET CURRENT=BASE

    694	003140	012701 	000010 			MOV	#512./64.,R1	; GET BOUNDARY VALUE

    695	003144					CALL	ADRUND		; ROUND LENGTH TO 256 WORD LIMIT

    696	003150	010063 	000000G			MOV	R0,C$SLTH(R3)	; SET NEW LENGTH

    697	003154	016701 	000000G			MOV	$LBOFF,R1	; GET PREVIOUS BASE

    698	003160					CALL	ADOFST		; CALCULATE NEW STORAGE SIZE

    699	003164	010067 	000000G			MOV	R0,$LBOFF	; STORE NEW ARRAY STORAGE LENGTH

    700	003170	000167 	000420 			JMP	90$

    701	003174				53$:

    702	003174	132763 	000000G	000000G		BITB	#CS$LIB,C$SFLG(R3);LIB SECTION?

    703	003202	001434 				BEQ	55$		;IF EQ NO

    704	003204	016301 	000000G			MOV	C$SELM(R3),R1	; GET BACK POINTER TO ELEMENT DESCRIPTOR

    705	003210					CALL	$CVRL		; CONVERT TO REAL ADDRESS

    706	003214	010004 				MOV	R0,R4		; SAVE REAL ADDRESS

    707	003216	016404 	000000G			MOV	E$LLGH(R4),R4	;GET BACK POINTER TO LIBRARY LIST ENTRY

    708	003222	016400 	000000G			MOV	L$DCUR(R4),R0	;GET CURRENT BASE ADDRESS

    709	003226	012701 	000002 			MOV	#2,R1		; GET BOUNDARY VALUE

    710	003232					CALL	ADRUND		;ROUND VIRTUAL ADDRESS

    711	003236	010063 	000000G			MOV	R0,C$SBSE(R3)	;SET BASE ADDRESS OF SECTION

    712	003242	010063 	000000G			MOV	R0,C$SCUR(R3)	;SET CURRENT BASE OF SECTION

    713	003246	016301 	000000G			MOV	C$SLTH(R3),R1	;GET LENGTH OF SECTION

    714	003252					CALL	ADOFST		;ADD OFFSET VALUE

    715	003256	010064 	000000G			MOV	R0,L$DCUR(R4)	;SET CURRENT BASE OF LIBRARY

    716	003262	166300 	000000G			SUB	C$SBSE(R3),R0	;CALCULATE ACTUAL LENGTH

    717	003266	010063 	000000G			MOV	R0,C$SLTH(R3)	;SET ACTUAL LENGTH

    718	003272	000550 				BR	90$		;

    719	003274				55$:				;

    720	003274	026767 	000000G	000000G		CMP	$CRVSG,$RTSEG	; AT ROOT?

    721	003302	001051 				BNE	58$		; IF NE NO

    722	003304	010301 				MOV	R3,R1		; GET ADDRESS OF SECTION

    723	003306	012700 	000000G			MOV	#$VSCHD,R0	; GET ADDRESS OF LISTHEAD

    724	003312					CALL	$SRCHR		; SEARCH FOR VIRTUAL SECTION ENTRY

    725	003316	103443 				BCS	58$		; IF C/S NOT IN LIST

    726	003320	016046 	000012 			MOV	12(R0),-(SP)	; SAVE PHYSICAL LENGTH

    727	003324	005763 	000000G			TST	S$YM(R3)	; BLANK SECTION?

    728	003330	001426 				BEQ	57$		; IF EQ YES

    729	003332	152763 	000000G	000001G		BISB	#CS$VSC,C$SFLG+1(R3) ; MARK SECTION AS VIRTUAL

    730	003340	062700 	000006 			ADD	#6,R0		; POINT TO BASE ADDRESS

    731	003344	012063 	000000G			MOV	(R0)+,C$SBSE(R3) ; SET BASE ADDRESS

    732	003350	011063 	000000G			MOV	(R0),C$SLTH(R3)	; SET LENGTH

    733	003354	001003 				BNE	56$		; IF NE HAVE LENGTH

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-13





    734	003356	016363 	000000G	000000G		MOV	C$SCUR(R3),C$SLTH(R3) ; RESET LENGTH

    735	003364				56$:				;

    736	003364	005063 	000000G			CLR	C$SCUR(R3)	; RESET CURRENT BASE

    737	003370	016301 	000000G			MOV	C$SBSE(R3),R1	; GET BASE

    738	003374	005301 				DEC	R1		; BACK OFF BASE

    739	003376	016300 	000000G			MOV	C$SLTH(R3),R0	; GET LENGTH

    740	003402					CALL	ADOFST		; ADD BASE TO LENGTH

    741	003406				57$:				;

    742	003406	016701 	000000G			MOV	$LBOFF,R1	; GET CURRENT TASK OFFSET INTO PARTITION

    743	003412	012600 				MOV	(SP)+,R0	; GET PHYSICAL SIZE OF SECTION

    744	003414					CALL	ADOFST		; ADD SIZE

    745	003420	010067 	000000G			MOV	R0,$LBOFF	; SAVE SIZE

    746	003424	000473 				BR	90$		;

    747	003426				58$:				;

    748	003426	012704 	000012'			MOV	#LVADR,R4	; POINT TO CURRENT VIRTUAL ADDRESS

    749	003432	011400 				MOV	(R4),R0		;GET CURRENT VIRTUAL ADDRESS

    750	003434	012701 	000002 			MOV	#2,R1		; GET BOUNDARY VALUE

    751	003440					CALL	ADRUND		;ROUND VIRTUAL ADDRESS

    752	003444	011401 				MOV	(R4),R1		;SAVE CURRENT VIRTUAL ADDRESS

    753	003446	010014 				MOV	R0,(R4)		;SET NEW CURRENT VIRTUAL ADDRESS

    754	003450	160100 				SUB	R1,R0		;CALCULATE NET INCREASE

    755	003452	010001 				MOV	R0,R1		;SET OFFSET VALUE

    756	003454	014400 				MOV	-(R4),R0	;GET CURRENT LENGTH

    757	003456					CALL	ADOFST		;ADD OFFSET VALUE

    758	003462	010046 				MOV	R0,-(SP)	;SAVE CURRENT LENGTH

    759	003464	010301 				MOV	R3,R1		;SET ADDRESS OF SECTION ENTRY

    760	003466	012700 	000000G			MOV	#$SCTHD,R0	;GET ADDRESS OF EXTEND LISTHEAD

    761	003472					CALL	$SRCHR		; SEARCH EXTENSION LIST FOR SECTION

    762	003476	103422 				BCS	80$		;IF CS NO FIND EM

    763	003500	132763 	000000G	000000G		BITB	#CS$ALO,C$SFLG(R3);CONCATENATED SECTION?

    764	003506	001007 				BNE	60$		;IF NE NO

    765	003510	016001 	000000G			MOV	C$SBSE(R0),R1	;GET EXTENSION LENGTH

    766	003514	016300 	000000G			MOV	C$SCUR(R3),R0	;GET CURRENT SECTION LENGTH

    767	003520					CALL	ADOFST		;ADD OFFSET VALUE

    768	003524	000405 				BR	70$		;

    769	003526	016000 	000000G		60$:	MOV	C$SBSE(R0),R0	;GET EXTENSION LENGTH

    770	003532	020063 	000000G			CMP	R0,C$SCUR(R3)	;EXTENSION LENGTH LARGER?

    771	003536	101402 				BLOS	80$		;IF LOS NO

    772	003540	010063 	000000G		70$:	MOV	R0,C$SCUR(R3)	;SET NEW CURRENT SECTION LENGTH

    773	003544	012600 			80$:	MOV	(SP)+,R0	;RETRIEVE CURRENT LENGTH

    774	003546	016301 	000000G			MOV	C$SCUR(R3),R1	;GET LENGTH OF CONTROL SECTION

    775	003552					CALL	ADOFST		;ADD OFFSET VALUE

    776	003556	010024 				MOV	R0,(R4)+	;SET NEW CURRENT LENGTH

    777	003560	011400 				MOV	(R4),R0		;GET CURRENT VIRTUAL ADDRESS

    778	003562	010063 	000000G			MOV	R0,C$SBSE(R3)	;SET BASE ADDRESS OF SECTION

    779	003566	016301 	000000G			MOV	C$SCUR(R3),R1	;GET LENGTH OF SECTION

    780	003572					CALL	ADOFST		;ADD OFFSET VALUE

    781	003576	011463 	000000G			MOV	(R4),C$SCUR(R3)	;SET CURRENT TO SECTION BASE ADDRESS

    782	003602	010014 				MOV	R0,(R4)		;SET NEW CURRENT VIRTUAL ADDRESS

    783	003604	166300 	000000G			SUB	C$SBSE(R3),R0	;CALCULATE ACTUAL LENGTH

    784	003610	010063 	000000G			MOV	R0,C$SLTH(R3)	;SET SECTION LENGTH

    785	003614	012603 			90$:	MOV	(SP)+,R3	;RESTORE R3 AND R4

    786	003616	012604 				MOV	(SP)+,R4	;

    787	003620	012601 				MOV	(SP)+,R1	; RETRIEVE VIRTUAL ADDRESS OF SECTION

    788	003622					CALL	$UNLPG		; UNLOCK PAGE

    789	003626	000167 	177066 			JMP	10$		; GO AGAIN

    790

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-14





    791					;

    792					; RELOCATE ALL CONTROL SECTIONS

    793					;

    794					; THIS ROUTINE IS CALLED AFTER THE ALLOCATION OF VIRTUAL AND PHYSICAL

    795					; MEMORY TO RELOCATE ALL CONTROL SECTIONS WITHIN THE TASK IMAGE.

    796					;

    797

    798	003632				CSREL:				;

    799	003632	010500 				MOV	R5,R0		; COPY ADDRESS OF SEGMENT DESCRIPTOR

    800	003634	062700 	000000G			ADD	#S$GCST,R0	; POINT TO CONTROL SECTION TABLE

    801	003640	012746 	000000G			MOV	#$ISED,-(SP)	; PUSH ADDRESS OF SYMBOL EDIT ROUTINE

    802	003644				10$:				;

    803	003644					CALL	@(SP)+		; GET NEXT SYMBOL

    804	003646	103433 				BCS	40$		; IF C/S NO MORE

    805	003650	016746 	174136 			MOV	LVADR,-(SP)	; PUSH LOCAL VIRTUAL ADDRESS

    806	003654	016002 	000000G			MOV	C$SFLG(R0),R2	; COPY FLAG BYTE

    807	003660	032702 	000000C			BIT	#<CS$VSC!CS$VAS*400!CS$IND!CS$LIB>,R2 ;

    808									; VIRTUAL, INDIRECT OR LIBRARY SECTION?

    809	003664	001022 				BNE	30$		; IF NE YES

    810	003666	132702 	000000G			BITB	#CS$REL,R2	; RELOCATABLE SECTION?

    811	003672	001417 				BEQ	30$		; IF EQ NO

    812	003674	132760 	000000G	000001G		BITB	#CS$RES,C$SFLG+1(R0) ; TASK-RESIDENT SECTION?

    813	003702	001013 				BNE	30$		; IF NE YES

    814	003704				15$:				;

    815	003704	132702 	000000G			BITB	#CS$ACC,R2	; READ-ONLY ACCESS?

    816	003710	001402 				BEQ	20$		; IF EQ NO

    817	003712	016516 	000000G			MOV	S$GROB(R5),(SP)	; GET READ-ONLY RELOCATION BIAS

    818	003716				20$:				;

    819	003716	061660 	000000G			ADD	(SP),C$SBSE(R0)	; SET BASE

    820	003722	061660 	000000G			ADD	(SP),C$SCUR(R0)	; SET CURRENT BASE

    821	003726					CALL	$WRMPG		; WRITE-MARK PAGE

    822	003732				30$:				;

    823	003732	005226 				INC	(SP)+		; CLEAN STACK

    824	003734	000743 				BR	10$		; GO AGAIN

    825	003736				40$:				;

    826	003736					RETURN			;

    827

    828

    829

    830					;

    831					; SUBROUTINE TO ADD AN OFFSET VALUE TO A BASE ADDRESS AND CHECK FOR

    832					; ADDRESS OVERFLOW. IF OVERFLOW IS DETECTED, THEN THE ORIGINAL BASE

    833					; ADDRESS IS RETURNED TO THE CALLER. ELSE THE UPDATED ADDRESS IS RE-

    834					; TURNED TO THE CALLER.

    835					;

    836

    837	003740	010002 			ADOFST:	MOV	R0,R2		;SAVE BASE ADDRESS

    838	003742	060100 				ADD	R1,R0		;ADD IN OFFSET VALUE

    839	003744	103441 				BCS	OVRFLW		;IF CS OVERFLOW

    840	003746					RETURN			;

    841

    842					;

    843					; SUBROUTINE TO ROUND UP AN ADDRESS TO AN ADDRESS BOUNDRY AND CHECK

    844					; FOR ADDRESS OVERFLOW. IF OVERFLOW IS DETECTED, THEN THE ORIGINAL

    845					; ADDRESS IS RETURNED TO THE CALLER. ELSE THE ROUNDED ADDRESS IS RE-

    846					; TURNED TO THE CALLER.

    847					;

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-15





    848

    849	003750				ADRUND:				;

    850	003750					CALL	ROUND		; ROUND TO SPECIFIED ADDRESS LIMIT

    851	003754	103435 				BCS	OVRFLW		; IF C/S REPORT OVERFLOW

    852	003756					RETURN			;

    853

    854					;

    855					; ROUND TO SPECIFIED ADDRESS LIMIT, RETURN C/S ON OVERFLOW

    856					;

    857

    858	003760				ROUND:				;

    859	003760	010002 				MOV	R0,R2		; SAVE BASE ADDRESS

    860	003762	005301 				DEC	R1		;BACK OFF BOUNDRY VALUE BY ONE

    861	003764	060100 				ADD	R1,R0		;ADD BOUNDRY VALUE

    862	003766	103002 				BCC	10$		; IF C/C OK

    863	003770	040101 				BIC	R1,R1		; CLEAR RESULT

    864	003772	000412 				BR	20$		; EXIT

    865	003774				10$:				;

    866	003774	005201 				INC	R1		;ADJUST BACK TO BOUNDRY VALUE

    867	003776	010146 				MOV	R1,-(SP)	;SAVE BOUNDRY VALUE

    868

    869

    870						.IF	NDF	V1145

    871

    872	004000					CALL	$DIV		;

    873

    874						.ENDC

    875

    876

    877						.IF	DF	V1145

    878

    879						MOV	R0,R1		;SET LOW PART OF DIVIDEND

    880						CLR	R0		;CLEAR HIGH PART OF DIVIDEND

    881						DIV	(SP),R0		;DIVIDE EM UP

    882

    883						.ENDC

    884

    885

    886	004004	012601 				MOV	(SP)+,R1	;RETRIEVE BOUNDRY VALUE

    887

    888

    889						.IF	NDF	V1145

    890

    891	004006					CALL	$MUL		;

    892

    893						.ENDC

    894

    895

    896						.IF	DF	V1145

    897

    898						MUL	R1,R0		;

    899

    900						.ENDC

    901

    902

    903	004012	005700 				TST	R0		; OVERFLOW?

    904	004014	001401 				BEQ	20$		; IF EQ NO

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-16





    905	004016	000261 				SEC			; SET CARRY

    906	004020				20$:				;

    907	004020	010100 				MOV	R1,R0		;SET ROUNDED ADDRESS

    908	004022					RETURN			;

    909

    910					;

    911					; CONVERT LENGTH IN R1 TO 32W BLOCKS

    912					;

    913

    914	004024				BLOCKS:				;

    915	004024	062701 	000077 			ADD	#77,R1		; ROUND TO NEAREST 32W LIMIT

    916	004030	006001 				ROR	R1		; SAVE CARRY, DIVIDE BY 64

    917	004032	000241 				CLC			; ...

    918	004034	006001 				ROR	R1		; ...

    919	004036	006201 				ASR	R1		; ...

    920	004040	006201 				ASR	R1		; ...

    921	004042	006201 				ASR	R1		; ...

    922	004044	006201 				ASR	R1		; ...

    923	004046					RETURN			;

    924

    925					;

    926					; ADDRESS OVERFLOW DETECTED

    927					;

    928

    929	004050	010246 			OVRFLW:	MOV	R2,-(SP)	;SAVE BASE ADDRESS

    930	004052	010502 				MOV	R5,R2		;GET ADDRESS OF CURRENT SEGMENT

    931	004054	062702 	000000G			ADD	#S$GNME,R2	;POINT TO SEGMENT NAME

    932	004060	012701 				MOV	(PC)+,R1	;GET ERROR/SEVERITY

    933	004062	   000G	   000G			.BYTE	E$R23,S$V0	;DIAGNOSTIC

    934	004064					CALL	$ERMSG		;OUTPUT ERROR MESSAGE

    935	004070	042767 	000000C	000000G		BIC	#<ST$BF!TS$KF>,$SWTCH ; NO SYMBOL TABLE OR TASK FILES

    936	004076	012600 				MOV	(SP)+,R0	; GET BASE ADDRESS

    937	004100					RETURN			;

    938					 										;JAK100

    939					 										;JAK100

    940					 										;JAK100

    941					; 										;JAK100

    942					;										;JAK100

    943					; ALOAPR - SEARCHES APR'S FROM TOP DOWN TO FIND FREE SPACE			;JAK100

    944					;	   FOR SEGMENT								;JAK100

    945					;										;JAK100

    946					; INPUTS:									;JAK100

    947					;	  R0 - SIZE OF SEGMENT							;JAK100

    948					;										;JAK100

    949					; OUTPUTS:									;JAK100

    950					;	  R0 - APR ALLOCATION							;JAK100

    951					;	  R1 - BASE VIRTUAL ADDRESS						;JAK100

    952					;										;JAK100

    953					;										;JAK100

    954	004102				ALOAPR:										;JAK100

    955	004102	005300 				DEC	R0		; DECREMENT LENGTH				;JAK100

    956	004104	042700 	017777 			BIC	#^C<160000>,R0	; CLEAR ALL BUT DISPLACEMENT			;JAK100

    957	004110	006300 				ASL	R0		; GET BIT 15 IN CARRY				;JAK100

    958	004112	006100 				ROL	R0		; CONVERT DISPLACEMENT TO BYTE INDEX		;JAK100

    959	004114	006100 				ROL	R0		; ...						;JAK100

    960	004116	006100 				ROL	R0		; ...						;JAK100

    961	004120	010002 				MOV	R0,R2		; SAVE INDEX					;JAK100

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-17





    962	004122	116000 	000000'			MOVB	APRMK(R0),R0	; GET APR MASK					;JAK100

    963	004126	005001 				CLR	R1								;JAK100

    964	004130				5$:										;JAK100

    965	004130	005302 				DEC	R2								;JAK100

    966	004132	002403 				BLT	10$								;JAK100

    967	004134	162701 	020000 			SUB	#20000,R1	; 						;JAK100

    968	004140	000773 				BR	5$								;JAK100

    969	004142				10$:										;JAK100

    970	004142	162701 	020000 			SUB	#20000,R1	; DECREMENT VIRTUAL ADDRESS 			;JAK100

    971	004146	130067 	000000G			BITB	R0,$APRMP	; ROOM AT THIS ADDRESS				;JAK100

    972	004152	001407 				BEQ	20$		; IF EQ YES					;JAK100

    973	004154	000241 				CLC			; CLEAR CARRY					;JAK100

    974	004156	106000 				RORB	R0		; ROTATE APR MASK				;JAK100

    975	004160	103370 				BCC	10$		; IF C/C TEST AGAIN				;JAK100

    976	004162	012701 	000000C			MOV	#<S$V2*400!E$R22>,R1 ; FATAL ERROR				;JAK100

    977	004166					CALL	$ERMSG		; NO RETURN					;JAK100

    978	004172				20$:										;JAK100

    979	004172	150067 	000000G			BISB	R0,$APRMP	; RECORD APR ALLOCATION				;JAK100

    980	004176					RETURN									;JAK100

    981

    982		000001 				.END

SGALO	MACRO M1110  22-AUG-78 01:59  PAGE 3-18

SYMBOL TABLE



ADOFST  003740R  	C$SFLG= ****** GX	R$$11M= 000000   	S$ZWND= ****** GX	$HVRT0= ****** GX

ADRUND  003750R  	C$SLTH= ****** GX	SE$QA = ****** GX	TLEN    000044R  	$ISED = ****** GX

ALOAPR  004102R  	E$LLGH= ****** GX	SGALO   001650R  	TSKSW   000026R  	$LBOFF= ****** GX

APRMK   000000R  	E$LSWT= ****** GX	SG$DSK= ****** GX	TS$KF = ****** GX	$LBRHD= ****** GX

BLKAL   001610R  	E$R22 = ****** GX	SG$RES= ****** GX	VRTBD   000016R  	$LCKPG= ****** GX

BLOCKS  004024R  	E$R23 = ****** GX	SG$RO = ****** GX	VT    = 000013   	$LVL  = ****** GX

CLRBEG= 000010R  	E$R86 = ****** GX	SPA   = 000040   	WDALO   002440R  	$MUL  = ****** GX

CLRMEM  002412R  	FF    = 000014   	ST$BF = ****** GX	WNLEN   000020R  	$MXLGH= ****** GX

CLRM2   002420R  	HT    = 000011   	SW$CM = ****** GX	WNSTS   000022R  	$MXWND= ****** GX

CLRSZ = 000006   	LCLGH   000010R  	SW$MU = ****** GX	WS.WRT= ****** GX	$NUMWN= ****** GX

CLRSZ2= 000017   	LD$ACC= ****** GX	SW$NH = ****** GX	W.NBAS= ****** GX	$PCTRL= ****** GX

CLSWND  002602R  	LF    = 000012   	S$GBLK= ****** GX	W.NLEN= ****** GX	$PHYBD= ****** GX

COTFLG  000036R  	LVADR   000012R  	S$GCST= ****** GX	W.NOFF= ****** GX	$RLBLK= ****** GX

CR    = 000015   	LVL     000034R  	S$GDWN= ****** GX	W.NRID= ****** GX	$ROPAR= ****** GX

CSALO   002666R  	L$DCUR= ****** GX	S$GLDA= ****** GX	W.NSIZ= ****** GX	$RTSEG= ****** GX

CSREL   003632R  	L$DDAT= ****** GX	S$GLNG= ****** GX	W.NSTS= ****** GX	$SAVRG= ****** GX

CS$ACC= ****** GX	L$DFLG= ****** GX	S$GNME= ****** GX	$ALBLK= ****** GX	$SCTHD= ****** GX

CS$ALO= ****** GX	L$DLGH= ****** GX	S$GRO = ****** GX	$APRMP= ****** GX	$SGALO  000046RG

CS$IND= ****** GX	L$DSA = ****** GX	S$GROB= ****** GX	$BGTIM= ****** GX	$SRCHR= ****** GX

CS$LIB= ****** GX	L$DWND= ****** GX	S$GRW = ****** GX	$CRSEG= ****** GX	$STACK= ****** GX

CS$REL= ****** GX	MP$SY = ****** GX	S$GSEQ= ****** GX	$CRVSG= ****** GX	$SWTCH= ****** GX

CS$RES= ****** GX	MSK   = 000377   	S$GSTS= ****** GX	$CVLOK= ****** GX	$TSKNM= ****** GX

CS$VAS= ****** GX	OVRFLW  004050R  	S$GUP = ****** GX	$CVRL = ****** GX	$UNLPG= ****** GX

CS$VSC= ****** GX	PHALO   000722R  	S$GVAD= ****** GX	$DIV  = ****** GX	$VRTBD= ****** GX

CURWND  000030R  	PHYBD   000014R  	S$GWDP= ****** GX	$ERMSG= ****** GX	$VSCHD= ****** GX

C$SBSE= ****** GX	ROFLG   000024R  	S$V0  = ****** GX	$HDSIZ= ****** GX	$WRMPG= ****** GX

C$SCUR= ****** GX	ROUND   003760R  	S$V2  = ****** GX	$HGHAD= ****** GX	$$    = 000001

C$SELM= ****** GX	RWND    000040R  	S$YM  = ****** GX	$HVRTL= ****** GX



. ABS.	000000	   000

      	004200	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  2533 WORDS  ( 10 PAGES)

DYNAMIC MEMORY:  3828 WORDS  ( 14 PAGES)

ELAPSED TIME:  00:00:27

OBJ$:SGALO,LIS$:SGALO/-SP=SRC$:MACFLM,PLSDF,SGALO

