HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2





      1						.TITLE	HEADR

      2						.IDENT	/27/

      3					                                                                                ;**-1

      4					;

      5					; COPYRIGHT (C) 1976

      6					; COPYRIGHT (C) 1977

      7					; DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

      8					;

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

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

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

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

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

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

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

     16					; IN DEC.

     17					;

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

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

     20					; EQUIPMENT CORPORATION.

     21					;

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

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

     24					;

     25					; VERSION 27

     26					;                                                                               ;**-1

     27					; D.N. CUTLER/C. MONIA 26-DEC-73

     28					;

     29					;

     30					;

     31					; MODIFICATIONS

     32					;

     33					; NO.		DATE		PROGRAMMER

     34					; ---		----		----------

     35					;

     36					; 011		25-AUG-73	C. MONIA

     37					; 013		28-AUG-73	C. MONIA

     38					; 034		07-JAN-75	C. MONIA                                        ;**NEW**

     39					; 045		16-MAY-75	C. MONIA

     40					; 048		12-FEB-76	C. MONIA

     41					; 050		26-FEB-76	C. MONIA

     42					; 051		02-MAR-76	C. MONIA

     43					; 053		17-MAR-76	C. MONIA

     44					; 052		29-MAR-76	C. MONIA

     45					; 058		22-APR-76	C. MONIA

     46					; 061		16-MAY-76	C. MONIA

     47					; 062		31-MAY-76	C. MONIA

     48					; 063		31-MAY-76	C. MONIA

     49					; 064		28-JUN-76	C. MONIA

     50					; 066		06-JUL-76	C. MONIA

     51					; 067		31-JUL-76	C. MONIA

     52					; JAK100	31-JAN-77	; CHANGES FOR MULTIUSER TASKS

     53					; JAK101	31-JAN-77	;SAVE R4 AND R5 IN TASK'S STACK

     54					; JAK107	15-DEC-77	ADD REENTANT CHECKPOINTALITY SWITCH "RC"

     55					;

     56

     57					;

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-1





     58					; WRITE TASK IMAGE FILE HEADER

     59					;

     60					; MACRO LIBRARY CALLS

     61					;

     62

     63						.MCALL	CLOSE$

     64

     65					;

     66					; EQUATED SYMBOLS

     67					;

     68

     69

     70						.IF	NDF	R$$11M

     71

     72					SF.XA=004000			;NOT ABORTABLE

     73					SF.XC=040000			;NOT CHECKPOINTABLE

     74					SF.XD=010000			;NOT DISABLABLE

     75					SF.XF=020000			;NOT FIXABLE

     76					SF.PT=000200			;PRIVILEGED

     77

     78

     79						.ENDC

     80

     81					;

     82					; MACRO LIBRARY CALLS

     83					;

     84

     85						.MCALL	GTIM$S

     86

     87					;

     88					; LOCAL MACROS

     89					;

     90					; GENERATE DATA BLOCK

     91					;

     92					; GBLK	ADRS,TXT,COUNT

     93					;

     94					; WHERE:

     95					;

     96					;	ADRS=STARTING ADDRESS IN TASK IMAGE WHERE TEXT IS TO BE WRITTEN.

     97					;	     IF ODD, THIS VALUE POINTS TO THE REAL ADDRESS.

     98					;

     99					;	TXT=STARTING MEMORY ADDRESS OF TEXT TO BE WRITTEN

    100					;

    101					;	COUNT=NUMBER OF WORDS TO BE WRITTEN

    102					;

    103

    104						.MACRO	GBLK	ADRS,TXT,COUNT

    105					.=.-2

    106						.WORD	TXT

    107						.WORD	ADRS

    108						.WORD	COUNT

    109						.WORD	0

    110						.ENDM

    111

    112					;

    113					; GENERATE BIT TRANSFORMATION TABLE ENTRY

    114					;

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-2





    115					; GBTBL MSK1,MSK2

    116					;

    117					; WHERE:

    118					;

    119					;	MSK1=MASK WORD THAT SPECIFIES BIT TO BE TESTED.

    120					;	MSK2=MASK WORD THAT SPECIFIES BIT TO BE SET IF MSK1 BIT IS

    121					;		SET IN FILE SWITCH OPTION WORD.

    122					;

    123

    124						.MACRO	GBTBL MSK1,MSK2

    125						.PSECT	BITBL

    126					.=.-2

    127						.WORD	MSK1

    128						.WORD	MSK2

    129						.WORD	0

    130						.PSECT

    131						.ENDM

    132

    133					;

    134					; GENERATE HEADER BLOCK

    135					;

    136					; GHDRB HDADR,TXADR,COUNT

    137					;

    138					; WHERE:

    139					;

    140					;	HDADR=STARTING ADDRESS IN HEADER OF WHERE TEXT IS TO BE

    141					;		WRITTEN.

    142					;	TXADR=STARTING MEMORY ADDRESS OF TEXT TO BE WRITTEN.

    143					;	COUNT=NUMBER OF WORDS TO BE WRITTEN.

    144					;

    145

    146						.MACRO	GHDRB HDADR,TXADR,COUNT

    147						.PSECT	HDRTBL

    148						GBLK	HDADR,TXADR,COUNT

    149						.PSECT

    150						.ENDM

    151

    152					;

    153					; GENERATE LABEL BLOCK

    154					;

    155					; GLBLB	LBADR,TXADR,COUNT

    156					;

    157					; WHERE:

    158					;

    159					;	LBADR=STARTING ADDRESS IN LABEL WHERE TEXT IS TO BE WRITTEN

    160					;

    161					;	TXADR=STARTING MEMORY ADDRESS OF TEXT TO BE WRITTEN

    162					;

    163					;	COUNT=NUMBER OF WORDS TO BE WRITTEN

    164					;

    165

    166						.MACRO	GLBLB	LBADR,TXADR,COUNT

    167						.PSECT	LBLTBL

    168						GBLK	LBADR,TXADR,COUNT

    169						.PSECT

    170						.ENDM

    171

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-3





    172

    173					;

    174					; LOCAL DATA

    175					;

    176					; BIT TRANSFORMATION TABLE

    177					;

    178					; THIS TABLE IS USED TO TRANSFORM TASK BUILDER BIT DEFINITIONS INTO

    179					; RSX11D TASK STATUS BIT DEFINITIONS.

    180					;

    181

    182	000000					.PSECT	BITBL

    183	000000	000000 			BITBAS:	.WORD	0		;DUMMY ZERO WORD AT START OF TBL

    184	000000					.PSECT

    185

    186						.IF	NDF	R$$11M

    187

    188						GBTBL	SW$CP,SF.XC

    189						GBTBL	SW$AB,SF.XA

    190						GBTBL	SW$DS,SF.XD

    191						GBTBL	SW$FX,SF.XF

    192						GBTBL	SW$PR,SF.PT

    193

    194						.IFF

    195

    196	000000					GBTBL	SW$AC,TS$ACP!TS$PRV

    197	000000					GBTBL	SW$CP,TS$CHK

    198	000000					GBTBL	SW$PR,TS$PRV

    199	000000					GBTBL	SW$NH,TS$NHD

    200	000000					GBTBL	SW$PI,TS$PIC

    201	000000					GBTBL	SW$PM,TS$PMD

    202	000000					GBTBL	SW$SL,TS$SLV

    203	000000					GBTBL	SW$CM,TS$CMP

    204	000000					GBTBL	SW$NT,TS$NET

    205	000000					GBTBL	SW$NS,TS$NSD

    206

    207					 										;**NEW**

    208					;										;**NEW**

    209					; BIT TRANSFORMATION TABLE FOR TASK IMAGE SWITCH OVERFLOW WORD			;**NEW**

    210					;										;**NEW**

    211	000000					.PSECT	OVRTBL								;**NEW**

    212	000000	000000 			OVRBAS:	.WORD	0		; DUMMY ZERO WORD AT START OF TABLE		;**NEW**

    213	000000					.PSECT									;**NEW**

    214					 										;**NEW**

    215	000000					GBTBL	RO$CHK,TS$RCP							;**NEW**

    216						.ENDC

    217

    218					;

    219					; HEADER BLOCK TABLE

    220					;

    221

    222	000000					.PSECT	HDRTBL

    223	000000	000000 			HDRBAS:	.WORD	0		;DUMMY ZERO WORD AT START OF TBL

    224	000000					.PSECT

    225

    226						.IF	NDF	R$$11M

    227

    228						GHDRB	H$DFLP,HDFLP,1

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-4





    229						GHDRB	H$DPDR,$HDPDR,8.

    230						GHDRB	H$DPAR,$HDPAR,8.

    231						GHDRB	H$DPS,HDPS,1

    232						GHDRB	H$DPC,HDPC,1

    233						GHDRB	H$DR0,HDR0,3

    234						GHDRB	H$DR0,HDR0,6

    235						GHDRB	H$DSP,HDSP,1

    236						GHDRB	H$DIPS,HDPS,1

    237						GHDRB	H$DIPC,HDPC,1

    238						GHDRB	H$DISP,HDSP,1

    239						GHDRB	H$DDSV,$ODTV,3

    240						GHDRB	H$DDUC,$TKUIC,1

    241						GHDRB	H$DUIC,$TKUIC,1

    242						GHDRB	H$DSIZ,HDSIZ,1

    243						GHDRB	H$DFZI,$FSIZI,1

    244						GHDRB	H$DLUT,$NUNIT,1

    245

    246						.IFF

    247

    248	000000					GHDRB	H$EFLM,$IDENT,2

    249	000000					GHDRB	H$FSR,$HFSR,1

    250	000000					GHDRB	H$FOT,$HOTV,1

    251	000000					GHDRB	H$OVLY,$HOVLY,1

    252	000000					GHDRB	H$VEXT,$HEXT,1

    253	000000					GHDRB	H$WND,WNADR,1

    254	000000					GHDRB	H$DSIZ,HDSIZ,1

    255	000000					GHDRB	H$IPS,HDPS,1

    256	000000					GHDRB	H$IPC,HDPC,1

    257	000000					GHDRB	H$ISP,HDSP,1

    258	000000					GHDRB	H$ODVA,$ODTV,2

    259	000000					GHDRB	H$TKVA,$TSKV,2

    260	000000					GHDRB	H$FPSA,HDFLP,1

    261	000000					GHDRB	H$DUIC,$TKUIC,1

    262	000000					GHDRB	H$CUIC,$TKUIC,1

    263	000000					GHDRB	H$NLUN,$NUNIT,1

    264	000000					GHDRB	H$GARD,HGARD,1

    265	000000					GHDRB	RGSAV+1,HDR0,6

    266	000000					GHDRB	WNDPT+1,$MXWND,1

    267					;										;JAK101

    268					; STACK BLOCK TABLE								;JAK101

    269					;										;JAK101

    270					 										;JAK101

    271	000164					.PSECT	HDRTBL								;JAK101

    272	000164	000000 			HDRSP4:	.WORD	0		; DUMMY ZERO WORD AT START OF TABLE		;JAK101

    273					 										;JAK101

    274	000000					.PSECT									;JAK101

    275					 										;JAK101

    276	000000					GHDRB	SPSAV+1,SPR4,2							;JAK101

    277

    278						.ENDC

    279

    280

    281					;

    282					; LABEL BLOCK TABLE

    283					;

    284

    285	000000					.PSECT	LBLTBL

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-5





    286	000000	000000 			LBLBAS:	.WORD	0		; DUMMY ZERO WORD AT START OF TABLE

    287	000000					.PSECT

    288

    289						.IF	NDF	R$$11M

    290

    291						GLBLB	L$BTSK,$TNAME,2

    292						GLBLB	L$BPAR,$PNAME,2

    293						GLBLB	L$BFLG,HDSWT,1

    294						GLBLB	L$BPRI,$PRIOR,1

    295						GLBLB	L$BLDZ,HDLDZ,1

    296						GLBLB	L$BMXZ,HDMXZ,1

    297						GLBLB	L$BPOL,$POOL,1

    298						GLBLB	L$BPIC,HDPIC,1

    299						GLBLB	L$BDAT,HDDAT,3

    300

    301						.IFF

    302

    303	000000					GLBLB	L$BTSK,$TNAME,2

    304	000000					GLBLB	L$BPAR,$PNAME,2

    305	000000					GLBLB	L$BHRB,$HDRBN,1

    306	000000					GLBLB	L$BBLK,$LBBLK,1

    307	000000					GLBLB	L$BFLG,HDSWT,1

    308	000000					GLBLB	L$BPRI,$PRIOR,1

    309	000000					GLBLB	L$BLDZ,HDLDZ,1

    310	000000					GLBLB	L$BMXZ,HDMXZ,1

    311	000000					GLBLB	L$BSA,$OFFST,1

    312	000000					GLBLB	L$BXFR,HDPC,1

    313	000000					GLBLB	L$BDAT,HDDAT,3

    314	000000					GLBLB	L$BEXT,$LBEXT,1

    315	000000					GLBLB	L$BHGV,HVRT0,1

    316	000000					GLBLB	L$BMXV,HVRTL,1

    317	000000					GLBLB	L$BWND,$NUMWN,1

    318	000000					GLBLB	L$BSEG,$SZSEG,1

    319	000000					GLBLB	L$BLUN,$NUNIT,1

    320	000000					GLBLB	L$BSGL,$LBSGL,1

    321	000000					GLBLB	L$BOFF,$LBOFF,1

    322	000000					GLBLB	L$BROB,$ROBLK,1							;JAK100

    323	000000					GLBLB	L$BROL,ROLDZ,1							;JAK100

    324

    325						.ENDC

    326

    327					;

    328					; MISC HEADER VALUES-AJACENCY ASSUMED

    329					;

    330

    331	000000				HDDAT:	.BLKW	3		;CREATION DATE

    332						.IIF NDF R$$11M, HDPIC:	.BLKW	1	; POSITION INDEPENDANT FLAG

    333	000006				HDFLP:	.BLKW	1		;FLOATING POINT SAVE AREA POINTER

    334

    335						.IF	DF	R$$11M

    336

    337	000010				HDSIZ:	.BLKW	1		; HEADER SIZE IN BYTES

    338

    339						.ENDC

    340

    341	000012				SPR4:	.BLKW	1		; INITIAL R4 FOR STACK INITIALIZATION		;JAK101

    342	000014				HDR0:	.BLKW	6		; INITIAL R0 - R5

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-6





    343	000030				HDPC:	.BLKW	1		;PC WORD

    344	000032				HDPS:	.BLKW	1		;PS WORD

    345	000034				HDSP:	.BLKW	1		;INITIAL SP CONTENTS

    346	000036				HDLDZ:	.BLKW	1		;LOAD SIZE IN 32W BLOCKS

    347	000040				HDMXZ:	.BLKW	1		;MAX SIZE IN 32W BLOCKS

    348	000042				ROLDZ:	.BLKW	1		; LOAD SIZE OF READ ONLY SEGMENTS		;JAK100

    349	000044				HDSWT:	.BLKW	1		;TASK FLAG WORD

    350

    351						.IF	NDF	R$$11M

    352

    353					HDSIZ:	.BLKW	1		;HEADER SIZE IN 32W BLOCKS

    354

    355						.IFF

    356

    357	000046				HGARD:	.BLKW	1		; ADDRESS OF STACK GUARD WORD

    358	000050				RGSAV:	.BLKW	1		; ADDRESS OF REGISTER SAVE AREA

    359	000052				HVRTL:	.BLKW	1		; HIGH VIRTUAL ADDRESS OF TASK

    360	000054				HVRT0:	.BLKW	1		; HIGH VIRTUAL ADDRESS OF WINDOW 0

    361	000056				WNADR:	.BLKW	1		; ADDRESS OF WINDOW BLOCKS

    362	000060				WNDPT:	.BLKW	1		; OFFSET TO WINDOW BLOCKS

    363	000062				SPSAV:	.BLKW	1		; ADDRESS OF R4 IN TASK'S STACK			;JAK101

    364

    365						.ENDC

    366

    367					;

    368					; **-$HEADR-WRITE TASK IMAGE FILE HEADER

    369					;

    370					; THIS ROUTINE IS CALLED TO WRITE THE TASK HEADER INTO THE TASK IMAGE.

    371					;

    372					; INPUTS:

    373					;

    374					;	NONE.

    375					;

    376					; OUTPUTS:

    377					;

    378					;	TASK HEADER IS WRITTEN INTO THE TASK IMAGE FILE.

    379					;-

    380

    381	000064				$HEADR::			;

    382	000064					SAVRG			; SAVE THE NON-VOLATILE REGISTERS

    383	000070	005067 	000000G			CLR	$WRFLG		; SET UP DESCRIPTOR FLAGS

    384	000074	005000 				CLR	R0		; CLEAR ADDRESS BIAS

    385	000076	032767 	000000G	000000G		BIT	#MP$SY,$SWTCH	; MAPPED SYSTEM?

    386	000104	001002 				BNE	20$		; IF NE YES

    387	000106	016700 	000000G			MOV	$OFFST,R0	; SET ADDRESS BIAS

    388	000112				20$:				;

    389	000112	010067 	177730 			MOV	R0,HGARD	; SET ADDRESS BIAS OF GUARD WORD

    390	000116	010067 	177734 			MOV	R0,WNADR	; SET WINDOW BLOCK ADDRESS BIAS

    391	000122	016705 	000000G			MOV	$TSKPT,R5	;GET TASK IMAGE FILE RECORD BLOCK

    392	000126	016505 	000000G			MOV	R$SWTH(R5),R5	;GET FILE SWITCH WORD

    393

    394					;

    395					; PROCESS BIT TRANSFORMATION TABLE

    396					;

    397

    398	000132	012704 	000044'		HEADR0:	MOV	#HDSWT,R4	;GET ADDRESS OF HEADER SWITCH WORD

    399	000136	005014 				CLR	(R4)		;SET INITIAL FLAG WORD

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-7





    400	000140	012703 	000000'			MOV	#BITBAS,R3	;GET ADDRESS OF BIT TABLE

    401	000144					CALL	10$		; 						;JAK107

    402	000150	010546 				MOV	R5,-(SP)	; SAVE SWITCH WORD				;JAK107

    403	000152	012705 	000000G			MOV	#$SWOVR,R5	; ADDRESS OF SWITCH OVERFLOW WORD		;JAK107

    404	000156	012703 	000000'			MOV	#OVRBAS,R3	; GET ADDRESS OF BIT TABLE			;JAK107

    405	000162					CALL	10$		; TRANSFORM BITS				;JAK107

    406	000166	012605 				MOV	(SP)+,R5	; RESTORE R5					;JAK107

    407	000170	000410 				BR	HEADR1		; DONE TRANSFORMATION				;JAK107

    408	000172	012302 			10$:	MOV	(R3)+,R2	;GET MSK1

    409	000174	001405 				BEQ	20$		; IF EQ DONE					;JAK107

    410	000176	012301 				MOV	(R3)+,R1	;GET MSK2					;**-1

    411	000200	030205 				BIT	R2,R5		;BIT SET?

    412	000202	001773 				BEQ	10$		;IF EQ NO

    413	000204	050114 				BIS	R1,(R4)		;SET BIT IN FLAG WORD

    414	000206	000771 				BR	10$		;

    415	000210				20$:										;JAK107

    416	000210					RETURN			;						;JAK107

    417

    418					;

    419					; ALLOCATE PAR/PDR REGISTERS

    420					;

    421

    422	000212				HEADR1:				;++013

    423	000212	005767 	000000G			TST	$TSKWD		; TASK HAVE RESIDENT OVERLAYS?

    424	000216	001402 				BEQ	5$		; IF EQ YES

    425	000220	052714 	000000G			BIS	#TS$RES,(R4)	; SET TASK ATTRIBUTE

    426	000224				5$:				;

    427	000224	016700 	000000G			MOV	$HVRTL,R0	; GET HIGH VIRTUAL ADDRESS

    428	000230	066700 	000000G			ADD	$OFFST,R0	;++041 ADD BASE ADDRESS OFFSET

    429	000234	103403 				.IIF   DF  R$$11M, BCS	10$		; OVERFLOW IF CS

    430	000236	020067 	000000G			CMP	R0,$HGHAD	;TASK WITHIN LIMITS?

    431						.IIF NDF  R$$11M, BLOS	35$		; IF LOS - YES

    432	000242	101406 				.IIF  DF  R$$11M, BLOS	HEADR2		; IF LOS - YES

    433	000244				10$:				;

    434	000244	012702 	000000G			MOV	#$OUTBF,R2	;POINT TO DUMMY BUFFER AREA

    435	000250	012701 	000000C			MOV	#<S$V0*400!E$R34>,R1 ; GET ERROR/SEVERITY

    436	000254					CALL	CANTSK		; ISSUE ERROR MESSAGE, CANCEL TASK FILE

    437

    438						.IF	NDF	R$$11M

    439

    440					35$:	CALL	GTRT		; GET REAL ADDRESS OF ROOT

    441						MOV	R0,R3		; COPY REAL ADDRESS

    442						MOV	$HDSIZ,(R4)	;SET HEADER SIZE IN BYTES

    443						CALL	BLOCKS		;CALCULATE NUMBER OF 32W BLOCKS

    444						MOV	-(R4),R4	;SET INITIAL BLOCK OFFSET VALUE

    445						MOV	$OFFST,R0	;GET OFFSET BIAS

    446						MOV	#206,R1		;SET ACCESS CODE

    447						TST	S$GRO(R3)	;ANY RO AREA?

    448						BEQ	50$		;IF EQ NO

    449						MOV	S$GRW(R3),R2	;GET LENGTH OF RW AREA

    450						SUB	$HDSIZ,R2	;SUBTRACT OUT SIZE OF HEADER

    451						BEQ	40$		;IF EQ NO RW AREA

    452						ADD	R0,R2		;CALCULATE ENDING ADDRESS

    453						MOV	R2,-(SP)	;SAVE ENDING ADDRESS

    454						CALL	FLAPR		;FILL APR REGISTERS

    455						MOV	(SP)+,R0	;RETRIEVE ENDING ADDRESS

    456						ADD	#17777,R0	;ROUND TO NEXT 4K BOUNDRY

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-8





    457						BIC	#17777,R0	;CLEAR EXCESS BITS

    458					40$:				;

    459						MOV	R0,-(SP)	; SAVE R0

    460						CALL	GTRT		; GET ADDRESS OF ROOT IN R0

    461						MOV	R0,R3		; COPY ADDRESS

    462						MOV	(SP)+,R0	; RESTORE R0

    463						MOV	#202,R1		; SET ACCESS CODE

    464						MOV	S$GRO(R3),R2	;GET LENGTH OF RO AREA

    465						ADD	R0,R2		;CALCULATE ENDING ADDRESS

    466						MOV	R2,-(SP)	;SAVE ENDING ADDRESS

    467						CALL	FLAPR		;FILL APR REGISTERS

    468						MOV	(SP)+,R0	;RETRIEVE ENDING ADDRESS

    469						CMP	#1,$NUMSG	;MORE THAN ONE SEGMENT?

    470						BEQ	HEADR2		;IF EQ NO

    471						ADD	#17777,R0	;ROUND TO NEXT 4K BOUNDRY

    472						BIC	#17777,R0	;CLEAR EXCESS BITS

    473					50$:	MOV	$HVRTL,R2	;GET HIGHEST VIRTUAL ADDRESS

    474						ADD	$OFFST,R2	;ADD IN OFFSET BIAS

    475						CMP	R0,R2		;ANYTHING IN SEGMENT?

    476						BEQ	HEADR2		;IF EQ NO

    477						MOV	#206,R1		;SET ACCESS CODE

    478						CALL	FLAPR		;FILL APR REGISTERS

    479

    480

    481						.ENDC

    482

    483					;

    484					; SET UP REMAINING HEADER WORDS

    485					;

    486

    487	000260				HEADR2:				; REF LABEL

    488

    489						.IF	DF	R$$11M

    490

    491	000260	010067 	177566 			MOV	R0,HVRTL	; SAVE HIGH VIRTUAL ADDRESS BOUND

    492	000264	016700 	000000G			MOV	$HVRT0,R0	; GET ADDRESS 0 LIMIT

    493	000270	066700 	000000G			ADD	$OFFST,R0	; ADD TASK OFFSET

    494	000274	010067 	177554 			MOV	R0,HVRT0	; SAVE LIMIT

    495	000300	020067 	177546 			CMP	R0,HVRTL	; LESS THAN WINDOW 0 LIMIT?

    496	000304	101402 				BLOS	3$		; IF LOS NO

    497	000306	010067 	177540 			MOV	R0,HVRTL	; RESET LIMIT

    498	000312				3$:				;

    499

    500						.ENDC

    501

    502	000312					GTIM$S	#HDDAT		; GET TIME PARAMETERS

    503

    504						.IF	NDF	R$$11M

    505

    506						MOV	#HDPIC,R4	;GET ADDRESS OF MISC DATA AREA

    507						CLR	(R4)+		;ASSUME NOT POSITION INDEPENDENT

    508						BIT	#SW$PI,R5	;POSITION INDEPENDENT?

    509						BEQ	5$		;IF EQ NO

    510						INC	-2(R4)		;SET PIC FLAG

    511

    512						.IFF

    513

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-9





    514	000324	012704 	000006'			MOV	#HDFLP,R4	;  GET ADDRESS OF MISC DATA AREA

    515

    516						.IFTF

    517

    518	000330	005024 			5$:	CLR	(R4)+		;ASSUME NO FLOATING POINT

    519

    520						.IFT

    521

    522						BIT	#SW$FP,R5	;FLOATING POINT SPECIFIED?

    523						BEQ	10$		;IF EQ NO

    524						MOV	$NUNIT,R0	;GET NUMBER OF LOGICAL UNITS

    525						ASL	R0		;MULTIPLY BY 4

    526						ASL	R0		;

    527						ADD	#<H$DLUT-H$DFLP+2>,R0 ; COMPUTE POINTER TO FLOATING POINT SAVE

    528						MOV	R0,-2(R4)	;SET POINTER TO FLOATING POINT SAVE AREA

    529

    530						.IFF

    531

    532	000332	016700 	000000G			MOV	$NUNIT,R0	; FETCH NO. OF UNITS

    533	000336	006300 				ASL	R0		; COMPUTE SIZE OF LUN TABLE

    534	000340	006300 				ASL	R0		;

    535	000342	062700 	000000C			ADD	#<H$LUN-H$CSP>,R0 ; COMPUTE OFFSET TO WINDOW BLOCKS

    536	000346	010067 	177506 			MOV	R0,WNDPT	; SAVE OFFSET TO WINDOW BLOCKS

    537	000352	060067 	177500 			ADD	R0,WNADR	; COMPUTE ADDRESS OF WINDOW BLOCKS

    538	000356	016700 	000000G			MOV	$NUMWN,R0	; GET NUMBER OF TASK WINDOWS

    539	000362	012701 	000000G			MOV	#$MXWND,R1	; POINT TO MAX WINDOWS

    540	000366	060011 				ADD	R0,(R1)		; COMPUTE MAX WINDOWS

    541	000370	011101 				MOV	(R1),R1		; GET RESULT

    542	000372	020127 	000010 			CMP	R1,#8.		; HAVE LEGAL VALUE?

    543	000376	101406 				BLOS	6$		; IF LOS YES

    544	000400	012701 	000000C			MOV	#<S$V0*400!E$R86>,R1 ; GET ERROR/SEVERITY

    545	000404					CALL	CANTSK		; ISSUE ERROR MESSAGE, CANCEL TASK FILE

    546	000410	016701 	000000G			MOV	$MXWND,R1	; RESTORE MAX. WINDOWS

    547	000414				6$:				;

    548	000414	012700 	000000G			MOV	#S$ZWND,R0	; GET SIZE OF EACH WINDOW BLOCK

    549

    550						.IF	DF	V1145

    551

    552						MUL	R0,R1		; COMPUTE WINDOW BLOCK ALLOCATION

    553

    554						.IFF

    555

    556	000420					CALL	$MUL		; COMPUTE WINDOW BLOCK ALLOCATION

    557

    558						.ENDC

    559

    560	000424	062701 	000006 			ADD	#2+4,R1		; INCLUDE SPACE FOR WINDOW COUNT PLUS PS,PC

    561	000430	066701 	177424 			ADD	WNDPT,R1	; COMPUTE OFFSET TO REGISTER SAVE AREA

    562	000434	010167 	177410 			MOV	R1,RGSAV	; SAVE OFFSET

    563	000440	062701 	000014 			ADD	#14,R1		; COMPUTE GUARD WORD OFFSET

    564	000444	060167 	177376 			ADD	R1,HGARD	; SAVE OFFSET

    565	000450	062701 	000002 			ADD	#2,R1		; STEP PAST GUARD

    566	000454	032705 	000000C			BIT	#<SW$FP!SW$EA>,R5 ; EAE OR FLOATING POINT SPECIFIED?

    567	000460	001412 				BEQ	10$		; IF EQ NO

    568	000462	010144 				MOV	R1,-(R4)	; SET OFFSET TO FLOATING PT., EAE

    569	000464	032767 	000000G	000000G		BIT	#MP$SY,$SWTCH	; SYSTEM MAPPED?

    570	000472	001403 				BEQ	7$		; IF EQ NO

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-10





    571	000474	062724 	140000 			ADD	#140000,(R4)+	; BIAS ADDRESS RELATIVE TO APR 6

    572	000500	000402 				BR	10$		;

    573	000502				7$:				;

    574	000502	066724 	000000G			ADD	$OFFST,(R4)+	; CONVERT TO ADDRESS

    575

    576						.IFT

    577

    578					10$:	CLR	(R4)+		;ASSUME ODT NOT SPECIFIED

    579						CLR	(R4)+		;

    580						CLR	(R4)+		;

    581						MOV	$IDENT,(R4)+	; SETUP IDENT

    582						MOV	$IDENT+2,(R4)+	;

    583						CLR	(R4)+		; CLEAR INITIAL R5

    584

    585						.IFF

    586

    587	000506				10$:				;

    588	000506	010124 				MOV	R1,(R4)+	; SET SIZE OF HEADER

    589	000510	016724 	000002G			MOV	$IDENT+2,(R4)+	; SET UP R4 FOR STACK INITIALIZATION		;JAK101

    590	000514	016724 	000000G			MOV	$HDRBN,(R4)+

    591	000520	016724 	000002G			MOV	$IDENT+2,(R4)+	; SETUP IDENT IN INITIAL R3 - R4

    592	000524	016724 	000000G			MOV	$IDENT,(R4)+	;

    593	000530	005024 				CLR	(R4)+		; ASSUME ODT NOT SPECIFIED, CLEAR R2 - R0

    594	000532	005024 				CLR	(R4)+		;

    595	000534	005024 				CLR	(R4)+		;

    596

    597						.ENDC

    598

    599	000536	016724 	000000G			MOV	$XFRAD,(R4)+	;SET TASK TRANSFER ADDRESS

    600	000542	022767 	000001 	000000G		CMP	#1,$ODTAD	;ODT SPECIFIED?

    601	000550	001414 				BEQ	20$		;IF EQ NO

    602

    603						.IF	NDF	R$$11M

    604

    605						MOV	#HDR0,R4	; BACKUP TO INITIAL R0

    606						MOV	$XFRAD,(R4)+	;PROGRAM XFR ADDRESS GOES IN R0

    607						MOV	$TNAME,(R4)+	;TASK NAME IN R1 AND R2

    608						MOV	$TNAME+2,(R4)+	;

    609

    610						.IFF

    611

    612	000552	012704 	000022'			MOV	#HDR0+6,R4	; POINT TO INITIAL R2

    613	000556	016724 	000002G			MOV	$TNAME+2,(R4)+	; TASK NAME TO INITIAL R2 - R1

    614	000562	016724 	000000G			MOV	$TNAME,(R4)+	;

    615	000566	016724 	000000G			MOV	$XFRAD,(R4)+	; TRANSFER ADDRESS GOES IN R0

    616

    617						.ENDC

    618

    619	000572	012704 	000030'			MOV	#HDPC,R4	; POINT TO INITIAL PC

    620	000576	016724 	000000G			MOV	$ODTAD,(R4)+	;SET TRANSFER ADDRESS TO DEBUGGING AID

    621	000602	012724 	174017 		20$:	MOV	#174017,(R4)+	;SET INITIAL PS WORD

    622	000606	032705 	000000G			BIT	#SW$TR,R5	;T BIT REQUESTED?

    623	000612	001403 				BEQ	30$		;IF EQ NO

    624	000614	052764 	000020 	177776 		BIS	#20,-2(R4)	;SET T BIT IN PS WORD

    625	000622				30$:				; REF. LABEL

    626

    627						.IF	DF	R$$11M

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-11





    628

    629	000622	016714 	000000G			MOV	$STACK,(R4)	; SET INITIAL SP CONTENTS

    630	000626	066714 	000000G			ADD	$HDSIZ,(R4)	; ADD HEADER BIAS				;JAK101

    631	000632	011467 	177224 			MOV	(R4),SPSAV	; GET STACK POINTER				;JAK101

    632	000636	162767 	000010 	177216 		SUB	#10,SPSAV	; POINT TO TENTH WORD IN STACK			;JAK101

    633	000644	066724 	000000G			ADD	$OFFST,(R4)+	; ADD IN OFFSET BIAS				;JAK101

    634	000650				35$:

    635	000650					CALL	GTRT		; GET REAL ADDRESS OF ROOT

    636	000654	016014 	000000G			MOV	S$GLNG(R0),(R4)	; SET LOAD SIZE IN BYTES

    637	000660					CALL	BLOCKS		; ROUND TO 32 W BOUNDRY

    638

    639						.IFF

    640

    641						MOV	$STACK,(R4)	; SET INITIAL STACK POINTER CONTENTS

    642						ADD	$OFFST,(R4)+	; ADD IN OFFSET BIAS

    643						CALL	GTRT		; GET REAL ADDRESS OF ROOT

    644						MOV	S$GMEM(R0),(R4)	;SET SIZE OF ROOT IN BYTES

    645						CALL	BLOCKS		;CALCULATE NUMBER OF 32W BLOCKS

    646

    647						.IFTF

    648

    649	000664	016724 	000000G		 	MOV	$MXLGH,(R4)+	; SET MAX. PHYSICAL MEMORY			;JAK100

    650					 										;JAK100

    651						.IFT									;JAK100

    652					 										;JAK100

    653	000670	016714 	000002G			MOV	$MXLGH+2,(R4)	; SET MAX. R-O PHYSICAL MEMORY			;JAK100

    654	000674	032705 	000000G			BIT	#SW$MU,R5	; MULTIUSER ?					;JAK107

    655	000700	001004 				BNE	36$		; IF NE YES					;**-1

    656					 										;JAK100

    657						.IFTF									;JAK100

    658					 										;JAK100

    659	000702	066764 	000002G	177776 		ADD	$MXLGH+2,-2(R4) ; INCLUDE R-O ALLOCATION			;JAK100

    660	000710	005014 				CLR	(R4)		; ZERO R-O PHYSICAL MEMORY			;JAK100

    661	000712				36$:										;JAK100

    662

    663						.IFF

    664

    665						MOV	#$ODTV,R4	;GET ADDRESS OF ODT SST VECTOR

    666						MOV	R4,R1		;SET SYMBOL ADDRESS FOR SEARCH

    667						CALL	GTSYM		;GET SYMBOL VALUE

    668						MOV	R0,(R4)+	;SET ODT VECTOR ADDRESS

    669						BCC	40$		;IF CC DEFINITION FOUND

    670						CLRB	$ODTSZ		;CLEAR SIZE OF ODT VECTOR

    671					40$:	MOV	#$TSKV,R1	;GET ADDRESS OF TSK VECTOR

    672						CALL	GTSYM		;GET SYMBOL VALUE

    673						MOV	R0,(R4)		;SET TSK VECTOR ADDRESS

    674						BCC	HEADR3		;IF CC DEFINITION FOUND

    675						CLRB	$TSKSZ		;CLEAR SIZE OF TSK VECTOR

    676

    677

    678						.IFT

    679

    680	000712	012746 	000754'			MOV	#HEADR3,-(SP)	; PUSH ADDRESS OF NEXT ROUTINE

    681	000716	012704 	000000G			MOV	#$ODTV,R4	; GET ADDRESS OF ODT SST VECTOR

    682	000722					CALL	40$		; SETUP ODT VECTOR

    683	000726	012704 	000000G			MOV	#$TSKV,R4	; GET ADDRESS OF TASK SST VECTOR

    684	000732				40$:

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-12





    685	000732	010401 				MOV	R4,R1	;	; COPY ADDRESS OF SYMBOL FOR SEARCH

    686	000734					CALL	GTSYM		; SEARCH FOR SYMBOL VALUE

    687	000740	010024 				MOV	R0,(R4)+	; SET VALUE

    688	000742	010024 				MOV	R0,(R4)+	; CLEARS VECTOR SIZE IF NOT FOUND

    689	000744	103402 				BCS	50$		; EXIT IF NOT FOUND

    690	000746	011444 				MOV	(R4),-(R4)	; ELSE SET VECTOR  SIZE

    691	000750	006314 				ASL	(R4)		; CONVERT TO BYTES

    692	000752				50$:

    693	000752					RETURN			; EXIT TO CALLER OR NEXT ROUTINE

    694

    695						.ENDC

    696

    697					;

    698					; WRITE FIXED PART OF HEADER

    699					;

    700

    701	000754				HEADR3:				; REF LABEL

    702	000754	032767 	000000G	000000G		BIT	#TS$KF,$SWTCH	; TASK IMAGE FILE REQUESTED?

    703	000762	001503 				BEQ	60$		; IF EQ NO

    704	000764	012746 	001174'			MOV	#HEADR4,-(SP)	; PUSH ADDRESS OF NEXT ROUTINE

    705	000770	005067 	000000G			CLR	$BEGRW		; SET LOW MEMORY LIMIT

    706

    707						.IF	DF	R$$11M

    708

    709	000774	005067 	000000G			CLR	$LOWRW		; CLEAR LOW R/W ADDRESS LIMIT

    710

    711						.ENDC

    712

    713	001000	016700 	000000G			MOV	$HDSIZ,R0	; GET SIZE OF HEADER

    714

    715						.IF	NDF	R$$11M

    716

    717						SUB	$LBLSZ,R0	; OFFSET TO START OF HEADER

    718						CLR	$HDOFF		; CLEAR HEADER OFFSET

    719

    720						.IFF

    721

    722	001004	001433 				BEQ	20$		; SKIP HEADER WRITE IF ZERO

    723

    724						.ENDC

    725

    726	001006	012705 	000000'			MOV	#HDRBAS,R5	; GET BASE ADDRESS OF HEADER BLOCK TABLE

    727	001012	005300 				DEC	R0		; BACK OFF TO REAL END  OF HEADER

    728	001014	010067 	000000G			MOV	R0,$ENDRW	; SET MEMORY LIMITS

    729	001020	016767 	000000G	000000G		MOV	$HDRBN,$RLBLK	; SET RELATIVE BLOCK NUMBER

    730	001026					CALL	30$		; WRITE TASK HEADER

    731	001032					CALL	$FLUSH		; OUTPUT BUFFER CONTENTS.

    732					 										;JAK101

    733						.IF DF	R$$11M								;JAK101

    734					 										;JAK101

    735	001036	005767 	000000G			TST	$STACK		; TASK HAVE STACK?				;JAK101

    736	001042	001414 				BEQ	20$		; IF EQ NO					;JAK101

    737	001044	012705 	000164'			MOV	#HDRSP4,R5	; GET ADDRESS OF REGISTER TABLE			;JAK101

    738	001050	016767 	177006 	000000G		MOV	SPSAV,$ENDRW	; GET STACK ADDRESS				;JAK101

    739	001056	062767 	000010 	000000G		ADD	#10,$ENDRW	; SET MEMORY LIMITS				;JAK101

    740	001064					CALL	30$		; WRITE R4 AND R5 INTO TASK'S STACK		;JAK101

    741	001070					CALL	$FLUSH		; OUTPUT BUFFER CONTENTS			;JAK101

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-13





    742					 										;JAK101

    743						.ENDC									;JAK101

    744	001074				20$:

    745	001074	012705 	000000'			MOV	#LBLBAS,R5	; GET BASE ADDRESS OF LABEL BLOCK TABLE

    746	001100	016767 	000000G	000000G		MOV	$LBLSZ,$ENDRW	; SET ADDRESS LIMIT

    747	001106	005367 	000000G			DEC	$ENDRW		; BACK OFF TO REAL END

    748	001112	005067 	000000G			CLR	$RLBLK		; CLEAR RELATIVE BLOCK NUMBER

    749	001116				30$:				; REF LABEL

    750	001116	005067 	000000G			CLR	$BFFLG		; SET BUFFER FLAG TO FALSE

    751	001122				40$:				; REF LABEL

    752	001122	012503 				MOV	(R5)+,R3	; GET ADDRESS OF TEXT INFORMATION

    753	001124	001422 				BEQ	60$		; IF EQ DONE

    754	001126	012504 				MOV	(R5)+,R4	; GET ADDRESS IN HEADER

    755	001130	032704 	000001 			BIT	#1,R4		; SEE IF INDIRECT ADDRESS SPECIFIED

    756	001134	001403 				BEQ	45$		; IF EQ NO

    757	001136	042704 	000001 			BIC	#1,R4		; YES, CLEAR INDIRECT BIT

    758	001142	011404 				MOV	(R4),R4		; GET REAL ADDRESS

    759	001144				45$:

    760	001144	012546 				MOV	(R5)+,-(SP)	;SET LOOP COUNT

    761	001146				50$:

    762	001146	012301 				MOV	(R3)+,R1	; SET WORD TO BE WRITTEN

    763	001150	010400 				MOV	R4,R0		;SET VIRTUAL ADDRESS OF WORD

    764	001152					CALL	$WRWRD		;WRITE WORD INTO HEADER

    765	001156	062704 	000002 			ADD	#2,R4		;UPDATE VIRTUAL ADDRESS

    766	001162	005316 				DEC	(SP)		;DECREMENT LOOP COUNT

    767	001164	003370 				BGT	50$		; IF GT GO AGAIN

    768	001166	005726 				TST	(SP)+		;CLEAN STACK

    769	001170	000754 				BR	40$		; GO AGAIN

    770	001172				60$:

    771	001172					RETURN

    772

    773					;

    774					; WRITE LUN ASSIGNMENTS

    775					;

    776

    777	001174	012705 	000000G		HEADR4:	MOV	#$LUNHD,R5	;GET ADDRESS OF ASSIGNMENT LISTHEAD

    778	001200	011505 			10$:	MOV	(R5),R5		;GET ADDRESS OF NEXT ASSIGNMENT

    779	001202	001433 				BEQ	HEADR5		;IF EQ DONE

    780	001204	010503 				MOV	R5,R3		;COPY ENTRY ADDRESS

    781	001206	010546 				MOV	R5,-(SP)	;SAVE ENTRY ADDRESS

    782	001210	005723 				TST	(R3)+		;POINT TO DEVICE NAME

    783	001212	012305 				MOV	(R3)+,R5	;GET DEVICE NAME

    784	001214	112304 				MOVB	(R3)+,R4	;GET PHYSICAL UNIT

    785	001216	005046 				CLR	-(SP)		;CLEAR WORD ON STACK

    786	001220	152316 				BISB	(R3)+,(SP)	;SET LOOP COUNT

    787	001222	012300 			20$:	MOV	(R3)+,R0	;GET LUN NUMBER

    788	001224	006300 				ASL	R0		;MULTIPLY BY 4

    789	001226	006300 				ASL	R0		;

    790	001230	062700 	177774G			ADD	#L$BASG-4,R0	;CALCULATE ADDRESS IN LABEL BLOCK

    791	001234	010046 				MOV	R0,-(SP)	;SAVE ADDRESS IN LABEL BLOCK

    792	001236	010501 				MOV	R5,R1		;SET WORD TO BE WRITTEN

    793	001240					CALL	$WRWRD		;WRITE DEVICE NAME INTO LABEL BLOCK

    794	001244	012600 				MOV	(SP)+,R0	;RETRIEVE ADDRESS IN LABEL BLOCK

    795	001246	062700 	000002 			ADD	#2,R0		;POINT TO SECOND ASSIGNMENT WORD

    796	001252	010401 				MOV	R4,R1		;SET WORD TO BE WRITTEN

    797	001254					CALL	$WRWRD		;WRITE PHYSICAL UNIT INTO LABEL BLOCK

    798	001260	005316 				DEC	(SP)		;DECREMENT LOOP COUNT

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-14





    799	001262	003357 				BGT	20$		;IF GT GO AGAIN

    800	001264	005726 				TST	(SP)+		;CLEAN STACK

    801	001266	012605 				MOV	(SP)+,R5	;RETRIEVE ADDRESS OF NEXT ENTRY

    802	001270	000743 				BR	10$		;

    803

    804					;

    805					; WRITE LIBRARY LIST INTO LABEL BLOCK

    806					;

    807

    808	001272				HEADR5:				;

    809	001272	012705 	000000C			MOV	#$LBRHD-L$DNXT,R5 ; GET LISTHEAD ADDRESS MINUS OFFSET

    810	001276	012704 	000000G			MOV	#L$BLIB,R4	; SET OFFSET TO LIBRARY LIST

    811	001302				10$:				;

    812	001302	016505 	000000G			MOV	L$DNXT(R5),R5	; GET NEXT ENTRY

    813	001306	001422 				BEQ	HEADR6		; IF EQ DONE

    814	001310	042765 	000000G	000000G		BIC	#LD$RSV,L$DFLG(R5) ; CLEAR APR RESERVATION FLAG

    815	001316	010503 				MOV	R5,R3		; COPY ADDRESS OF ENTRY

    816	001320	062703 	000000G			ADD	#L$DNME,R3	; POINT TO NAME

    817	001324	012746 	000000C			MOV	#L$BLIB-L$BPAR/2,-(SP) ; SET SIZE OF ENTRY IN WORDS

    818	001330				20$:				;

    819	001330	012301 				MOV	(R3)+,R1	; GET WORD TO BE WRITTEN

    820	001332	010400 				MOV	R4,R0		; SET VIRTUAL ADDRESS TO WRITE DATA

    821	001334	062704 	000002 			ADD	#2,R4		; UPDATE ADDRESS

    822	001340					CALL	$WRWRD		; WRITE WORD INTO TASK IMAGE

    823	001344	005316 				DEC	(SP)		; DECREMENT COUNT

    824	001346	001370 				BNE	20$		; IF NE GO AGAIN

    825	001350	005226 				INC	(SP)+		; CLEAN STACK

    826	001352	000753 				BR	10$		; GET NEXT ENTRY

    827

    828					;

    829					; WRITE SEGMENT LOAD LIST INTO LABEL BLOCK IF TASK IS

    830					; RESIDENT LIBRARY AND HAS OVERLAYS.

    831					;

    832

    833	001354				HEADR6:				;

    834	001354	026727 	000000G	000001 		CMP	$NUMSG,#1	; TASK HAVE OVERLAYS?

    835	001362	001420 				BEQ	10$		; IF EQ NO

    836	001364	016700 	000000G			MOV	$TSKPT,R0	; GET ADDRESS OF TASK RECORD BLOCK

    837	001370	032760 	000000G	000000G		BIT	#SW$NH,R$SWTH(R0) ;  BUILDING RESIDENT LIBRARY?

    838	001376	001412 				BEQ	10$		; IF EQ NO

    839	001400	016700 	000000G			MOV	$LBLSZ,R0	; GET SIZE OF LABEL BLOCK GROUP

    840	001404	162700 	001000 			SUB	#512.,R0	; BACK OFF TO START OF SEGMENT LIST

    841	001410	010067 	176364 			MOV	R0,HDDAT	; SAVE SEGMENT LIST ADDRESS

    842	001414	012700 	001432'			MOV	#HEADR7,R0	; SET ADDRESS OF PHASE DEPENDANT ROUTINE

    843	001420					CALL	$PCTRL		; CALL PHASE DEPENDANT ROUTINE

    844	001424				10$:				;

    845	001424					CALL	$FLUSH		; FLUSH CURRENT BUFFER

    846	001430					RETURN			;

    847

    848					;

    849					; PHASE DEPENDANT ROUTINE TO WRITE SEGMENT LENGTH LIST INTO TASK IMAGE

    850					;

    851

    852	001432				HEADR7:				;

    853	001432	016700 	176342 			MOV	HDDAT,R0	; SET TASK ADDRESS

    854	001436	016702 	000000G			MOV	$CRSEG,R2	; GET REAL ADDRESS OF SEGMENT

    855	001442	016201 	000000G			MOV	S$GLNG(R2),R1	; GET LENGTH OF SEGMENT

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-15





    856	001446	001411 				BEQ	10$		; IF EQ, ZERO LENGTH SEGMENT

    857	001450	132762 	000000G	000000G		BITB	#SG$DSK,S$GSTS(R2) ; SEGMENT HAVE DISK ALLOCATION?

    858	001456	001005 				BNE	10$		; IF NE NO

    859	001460	062767 	000002 	176312 		ADD	#2,HDDAT	; UPDATE TASK ADDRESS

    860	001466					CALL	$WRWRD		; WRITE LENGTH OF DISK READ INTO LABEL BLOCK

    861	001472				10$:				;

    862	001472					RETURN			;

    863

    864					;

    865					; SUBROUTINE TO SUBTRACT OUT SIZE OF LABEL BLOCK, ROUND TO NEXT

    866					; 32W BOUNDRY, AND CALCULATE NUMBER OF RESULTANT 32W BLOCKS.

    867					;

    868

    869	001474				BLOCKS:

    870

    871						.IF	NDF	R$$11M

    872

    873						SUB	$LBLSZ,(R4)	; SUBTRACT OUT SIZE OF LABEL BLOCK

    874

    875						.IFTF

    876

    877	001474	062714 	000077 			ADD	#77,(R4)	;ROUND UP TO NEXT 32W BOUNDRY

    878	001500	042714 	000077 			BIC	#77,(R4)	;CLEAR EXCESS BITS

    879	001504	006014 				ROR	(R4)		;PRESERVE POSSIBLE CARRY

    880	001506	006014 				ROR	(R4)		;CONVERT TO 32W BLOCKS

    881	001510	006014 				ROR	(R4)		;

    882	001512	006014 				ROR	(R4)		;

    883	001514	006014 				ROR	(R4)		;

    884	001516	006024 				ROR	(R4)+		;

    885	001520					RETURN			;

    886

    887					;

    888					; ISSUE ERROR MESSAGE, CANCEL TASK IMAGE OUTPUT AND CLOSE TASK FILE

    889					;

    890

    891	001522				CANTSK:				;

    892	001522					CALL	$ERMSG		; ISSUE NON-FATAL ERROR MESSAGE

    893	001526	042767 	000000G	000000G		BIC	#TS$KF,$SWTCH	; CANCEL TASK IMAGE OUTPUT

    894	001534					CLOSE$	$TSKPT		; CLOSE TASK IMAGE FILE

    895	001544					RETURN			;

    896

    897

    898

    899						.IFT

    900

    901

    902					;

    903					; SUBROUTINE TO FILL APR REGISTERS

    904					;

    905

    906					FLAPR:	MOV	R1,-(SP)	;SAVE ACCESS CODE

    907						MOV	R0,R3		;COPY STARTING ADDRESS

    908						ASL	R3		;ISOLATE APR NUMBER

    909						ROL	R3		;

    910						ROL	R3		;

    911						ROL	R3		;

    912						ASL	R3		;CONVERT TO TABLE INDEX

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-16





    913					10$:	MOV	(SP),$HDPDR(R3)	;SET PDR CONTENTS

    914						MOV	R4,$HDPAR(R3)	;SET ADDITIVE BLOCK NUMBER

    915						CLR	R1		;CLEAR 4K ADDRESS ACCUMULATOR

    916						CLR	R4		;CLEAR ADDITIVE BLOCK NUMBER

    917					20$:				;++011

    918						INC	R1		;

    919						INC	R4		;INCREMENT ADDITIVE BLOCK COUNT

    920						ADD	#100,R0		;++011 INCREMENT TO NEXT 32 W BOUNDARY

    921						BCS	40$		;++011 EXIT IF CROSS 32 K WORD LIMIT.

    922						CMP	R0,R2		;DONE?

    923						BHIS	40$		;IF HIS YES

    924						CMP	R1,#200		;CROSS 4K BOUNDRY?

    925						BHIS	30$		;IF HIS YES

    926						ADD	#400,$HDPDR(R3)	;INCREMENT BLOCK LENGTH FIELD

    927						BR	20$		;

    928					30$:	ADD	#2,R3		;ADVANCE TO NEXT APR

    929						BR	10$		;

    930					40$:	TST	(SP)+		;CLEAN STACK

    931						RETURN			;

    932

    933						.ENDC

    934

    935

    936					;

    937					; SUBROUTINE TO GET SYMBOL VALUE

    938					;

    939

    940	001546	162701 	000000G		GTSYM:	SUB	#S$YM,R1	;CALCULATE PROPER OFFSET

    941	001552					CALL	GTRT		; GET REAL ADDRESS OF ROOT

    942	001556	062700 	000000G			ADD	#S$GSTB,R0	;POINT TO SYMBOL TABLE

    943	001562					CALL	$SRCH		;SEARCH FOR SYMBOL

    944	001566	103431 				BCS	30$		;IF CS NO FIND EM

    945	001570	010001 				MOV	R0,R1		;COPY ENTRY ADDRESS

    946	001572	005000 				CLR	R0		;ASSUME DEFINITION NOT FOUND

    947	001574	132761 	000000G	000000G		BITB	#SY$DEF,S$YFLG(R1);DEFINITION?

    948	001602	000261 				SEC			;ASSUME NOT DEFINITION

    949	001604	001422 				BEQ	30$		;IF EQ NOT A DEFINITION

    950	001606	132761 	000000G	000000G		BITB	#SY$IND,S$YFLG(R1);INDIRECT ENTRY?

    951	001614	001405 				BEQ	10$		;IF EQ NO

    952	001616	016101 	000000G			MOV	S$YVAL(R1),R1	;GET ADDRESS OF REAL ENTRY

    953	001622					CALL	$CVRL		; CONVERT TO REAL ADDRESS

    954	001626	010001 				MOV	R0,R1		; COPY REAL ADDRESS

    955	001630	016100 	000000G		10$:	MOV	S$YVAL(R1),R0	;GET SYMBOL VALUE

    956	001634	132761 	000000G	000000G		BITB	#SY$REL,S$YFLG(R1);RELOCATABLE SYMBOL?

    957	001642	001402 				BEQ	20$		;IF EQ NO

    958	001644	066700 	000000G			ADD	$OFFST,R0	;ADD OFFSET BIAS

    959	001650	000241 			20$:	CLC			;CLEAR CARRY

    960	001652				30$:	RETURN			;

    961

    962					;

    963					; CONVERT VIRTUAL ADDRESS OF ROOT SEGMENT TO REAL ADDRESS IN R0.

    964					;

    965

    966	001654				GTRT:				;

    967	001654	010146 				MOV	R1,-(SP)	; SAVE R1

    968	001656	016701 	000000G			MOV	$RTSEG,R1	; GET VITUAL ADDRESS OF ROOT

    969	001662					CALL	$CVRL		; CONVERT TO REAL ADDRESS IN R0

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-17





    970	001666	012601 				MOV	(SP)+,R1	; RESTORE R1

    971	001670					RETURN

    972		000001 				.END

HEADR	MACRO M1110  22-AUG-78 01:43  PAGE 2-18

SYMBOL TABLE



BITBAS  000000R     002	H$CSP = ****** GX	L$BSEG= ****** GX	S$V0  = ****** GX	$LBEXT= ****** GX

BLOCKS  001474R  	H$CUIC= ****** GX	L$BSGL= ****** GX	S$YFLG= ****** GX	$LBLSZ= ****** GX

CANTSK  001522R  	H$DSIZ= ****** GX	L$BTSK= ****** GX	S$YM  = ****** GX	$LBOFF= ****** GX

CR    = 000015   	H$DUIC= ****** GX	L$BWND= ****** GX	S$YVAL= ****** GX	$LBRHD= ****** GX

E$R34 = ****** GX	H$EFLM= ****** GX	L$BXFR= ****** GX	S$ZWND= ****** GX	$LBSGL= ****** GX

E$R86 = ****** GX	H$FOT = ****** GX	L$DFLG= ****** GX	TS$ACP= ****** GX	$LOWRW= ****** GX

FF    = 000014   	H$FPSA= ****** GX	L$DNME= ****** GX	TS$CHK= ****** GX	$LUNHD= ****** GX

GTRT    001654R  	H$FSR = ****** GX	L$DNXT= ****** GX	TS$CMP= ****** GX	$MUL  = ****** GX

GTSYM   001546R  	H$GARD= ****** GX	MP$SY = ****** GX	TS$KF = ****** GX	$MXLGH= ****** GX

G.TICP= 000016   	H$IPC = ****** GX	OVRBAS  000000R     003	TS$NET= ****** GX	$MXWND= ****** GX

G.TICT= 000014   	H$IPS = ****** GX	PAR$$$= 000067   	TS$NHD= ****** GX	$NUMSG= ****** GX

G.TIDA= 000004   	H$ISP = ****** GX	RGSAV   000050R  	TS$NSD= ****** GX	$NUMWN= ****** GX

G.TIHR= 000006   	H$LUN = ****** GX	ROLDZ   000042R  	TS$PIC= ****** GX	$NUNIT= ****** GX

G.TIMI= 000010   	H$NLUN= ****** GX	RO$CHK= ****** GX	TS$PMD= ****** GX	$ODTAD= ****** GX

G.TIMO= 000002   	H$ODVA= ****** GX	R$SWTH= ****** GX	TS$PRV= ****** GX	$ODTV = ****** GX

G.TISC= 000012   	H$OVLY= ****** GX	R$$11M= 000000   	TS$RCP= ****** GX	$OFFST= ****** GX

G.TIYR= 000000   	H$TKVA= ****** GX	SG$DSK= ****** GX	TS$RES= ****** GX	$OUTBF= ****** GX

HDDAT   000000R  	H$VEXT= ****** GX	SPA   = 000040   	TS$SLV= ****** GX	$PCTRL= ****** GX

HDFLP   000006R  	H$WND = ****** GX	SPR4    000012R  	VT    = 000013   	$PNAME= ****** GX

HDLDZ   000036R  	LBLBAS  000000R     005	SPSAV   000062R  	WNADR   000056R  	$PRIOR= ****** GX

HDMXZ   000040R  	LD$RSV= ****** GX	SW$AC = ****** GX	WNDPT   000060R  	$RLBLK= ****** GX

HDPC    000030R  	LF    = 000012   	SW$CM = ****** GX	$BEGRW= ****** GX	$ROBLK= ****** GX

HDPS    000032R  	L$BASG= ****** GX	SW$CP = ****** GX	$BFFLG= ****** GX	$RTSEG= ****** GX

HDRBAS  000000R     004	L$BBLK= ****** GX	SW$EA = ****** GX	$CRSEG= ****** GX	$SAVRG= ****** GX

HDRSP4  000164R     004	L$BDAT= ****** GX	SW$FP = ****** GX	$CVRL = ****** GX	$SRCH = ****** GX

HDR0    000014R  	L$BEXT= ****** GX	SW$MU = ****** GX	$ENDRW= ****** GX	$STACK= ****** GX

HDSIZ   000010R  	L$BFLG= ****** GX	SW$NH = ****** GX	$ERMSG= ****** GX	$SWOVR= ****** GX

HDSP    000034R  	L$BHGV= ****** GX	SW$NS = ****** GX	$FLUSH= ****** GX	$SWTCH= ****** GX

HDSWT   000044R  	L$BHRB= ****** GX	SW$NT = ****** GX	$HDRBN= ****** GX	$SZSEG= ****** GX

HEADR0  000132R  	L$BLDZ= ****** GX	SW$PI = ****** GX	$HDSIZ= ****** GX	$TKUIC= ****** GX

HEADR1  000212R  	L$BLIB= ****** GX	SW$PM = ****** GX	$HEADR  000064RG 	$TNAME= ****** GX

HEADR2  000260R  	L$BLUN= ****** GX	SW$PR = ****** GX	$HEXT = ****** GX	$TSKPT= ****** GX

HEADR3  000754R  	L$BMXV= ****** GX	SW$SL = ****** GX	$HFSR = ****** GX	$TSKV = ****** GX

HEADR4  001174R  	L$BMXZ= ****** GX	SW$TR = ****** GX	$HGHAD= ****** GX	$TSKWD= ****** GX

HEADR5  001272R  	L$BOFF= ****** GX	SY$DEF= ****** GX	$HOTV = ****** GX	$WRFLG= ****** GX

HEADR6  001354R  	L$BPAR= ****** GX	SY$IND= ****** GX	$HOVLY= ****** GX	$WRWRD= ****** GX

HEADR7  001432R  	L$BPRI= ****** GX	SY$REL= ****** GX	$HVRTL= ****** GX	$XFRAD= ****** GX

HGARD   000046R  	L$BROB= ****** GX	S$GLNG= ****** GX	$HVRT0= ****** GX	$$    = 000001

HT    = 000011   	L$BROL= ****** GX	S$GSTB= ****** GX	$IDENT= ****** GX	$$$OST= 000020

HVRTL   000052R  	L$BSA = ****** GX	S$GSTS= ****** GX	$LBBLK= ****** GX	.CLOSE= ****** G

HVRT0   000054R



. ABS.	000000	   000

      	001672	   001

BITBL 	000056	   002

OVRTBL	000002	   003

HDRTBL	000174	   004

LBLTBL	000200	   005

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  2580 WORDS  ( 11 PAGES)

DYNAMIC MEMORY:  3828 WORDS  ( 14 PAGES)

ELAPSED TIME:  00:00:31

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

