Google
 

Trailing-Edge - PDP-10 Archives - BB-H348C-RM_1982 - swskit-v21/listings/tkb-vnp/bcor.bpt
There are no other files named bcor.bpt in the archive.
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

   1	!<SAUTER.TKB20>BCOR.BLI.80, 18-Feb-79 10:51:57, Edit by SROBINSON
   2	!<SAUTER.TKB20>BCOR.BLI.78, 10-Jan-79 06:54:48, Edit by SROBINSON
   3	!<SAUTER.TKB20>BCOR.BLI.76,  9-Jan-79 16:31:19, Edit by SROBINSON
   4	!<SAUTER.TKB20>BCOR.BLI.69,  6-Nov-78 11:04:58, Edit by SROBINSON
   5	!<SAUTER.VNP20>BCOR.BLI.65,  3-Oct-78 13:12:35, Edit by SROBINSON
   6	!<SAUTER.TKB20>BCOR.BLI.64,  2-Oct-78 10:05:59, Edit by SROBINSON
   7	!<SAUTER.VNP20>BCOR.BLI.60, 30-Sep-78 13:10:52, Edit by SROBINSON
   8	!<SAUTER.VNP20>BCOR.BLI.53, 30-Sep-78 08:25:09, Edit by SROBINSON
   9	!<SAUTER.VNP20>BCOR.BLI.43, 29-Sep-78 13:17:07, Edit by SROBINSON
  10	!<SAUTER.VNP20>BCOR.BLI.33, 29-Sep-78 08:02:10, Edit by SROBINSON
  11	!<SAUTER.VNP20>BCOR.BLI.29, 28-Sep-78 16:31:42, Edit by SROBINSON
  12	!<SAUTER.VNP20>BCOR.BLI.26, 28-Sep-78 14:29:13, Edit by SROBINSON
  13	!<SAUTER.VNP20>BCOR.BLI.22, 28-Sep-78 11:19:05, Edit by SROBINSON
  14	MODULE BCOR (					!BUILD CORE IMAGE
  15			IDENT = 'X0.1-5'
  16			) =
  17	BEGIN
  18	!
  19	!
  20	!
  21	! COPYRIGHT (C) 1978, 1979 BY
  22	! DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
  23	!
  24	!
  25	! THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
  26	! ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
  27	! INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
  28	! COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
  29	! OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
  30	! TRANSFERRED.
  31	!
  32	!
  33	! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
  34	! AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
  35	! CORPORATION.
  36	!
  37	! DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
  38	! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
  39	!
  40	
  41	!++
  42	! FACILITY: TKB-20
  43	!
  44	! ABSTRACT:
  45	!
  46	!
  47	! THIS MODULE BUILDS THE CORE IMAGE OF THE TASK.
  48	!  IT COPIES ALL TEXT INTO THE CORE IMAGE,
  49	!   AND COMPUTES THE RELOCATION INFORMATION.
  50	!
  51	!
  52	! ENVIRONMENT: TOPS-20 USER MODE
  53	!
  54	! AUTHOR: J. SAUTER, CREATION DATE: 08-MAR-78
  55	!
  56	! MODIFIED BY:
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

  57	!
  58	!	Scott G. Robinson, 28-SEP-78 : VERSION X0.1-2A
  59	!	- Enhance error message capability within EVAL
  60	!	- Fix EVAL to handle COMPLEMENT operation correctly
  61	!	- Fix BCOR to correctly set the task size so we get a good
  62	!	   and useful task image written to disk
  63	!
  64	!	Scott G. Robinson, 6-NOV-78 : VERSION X0.1-3A
  65	!	- Fix BLBL to not clobber core image when number of units
  66	!	   is not in range 1 - 8
  67	!
  68	!	Scott G. Robinson, 9-JAN-79 : VERSION X0.1-4A
  69	!	- Fix RESV to resolve PSECTS to an even boundary
  70	!
  71	!	Scott G. Robinson, 18-FEB-79 : VERSION X0.1-5
  72	!	- Fix Map output of TKB20 to be mostly reasonable (in other words,
  73	!	   make a previous hack a feature)
  74	!
  75	!	, : VERSION
  76	! 01	-
  77	!--
  78	
  79	!<BLF/PAGE>
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

  80	!
  81	! TABLE OF CONTENTS:
  82	!
  83	
  84	FORWARD ROUTINE
  85	    STO11 : NOVALUE,				! STORE A PDP-11 BYTE
  86	    EVAL,					!COMPUTE RELOCATION
  87	    STO_TEXT : NOVALUE,				!STORE TEXT INFO
  88	    PRC_RLD,					!STORE RELOCATION INFO
  89	    RESV,					!RESOLVE PSECTS
  90	    SEL_MODU,					!FIND MODULE WITH STARTING ADDRESS
  91	    BCOR : NOVALUE,				!BUILD CORE IMAGE
  92	    BLBL : NOVALUE,				!BUILD LABEL AND HEADER
  93	    STO16L : NOVALUE,				!STORE 16 BITS IN LABEL
  94	    STO16H : NOVALUE;				!STORE 16 BITS IN HEADER
  95	
  96	!
  97	! INCLUDE FILES
  98	!
  99	
 100	LIBRARY 'VNP-LIB.L36';
 101	
 102	!REQUIRE 'BLOCKH.REQ';				!PREPARE TO DEFINE STORAGE BLOCKS
 103	!REQUIRE 'FILE.REQ';				!FILE BLOCK
 104	!REQUIRE 'FILSW.REQ';				!FILE SWITCH BLOCK
 105	!REQUIRE 'GLOBL.REQ';				!GLOBAL SYMBOL BLOCK
 106	!REQUIRE 'MODU.REQ';				!MODULE BLOCK
 107	!REQUIRE 'PSECT.REQ';				!PSECT BLOCK
 108	!REQUIRE 'RLDD.REQ';				!RELOCATION DATA BLOCK
 109	!REQUIRE 'RLDH.REQ';				!RELOCATION HEADER BLOCK
 110	!REQUIRE 'ROOT.REQ';				!ROOT BLOCK
 111	!REQUIRE 'TEXTD.REQ';				!TEXT DATA BLOCK
 112	!REQUIRE 'TEXTH.REQ';				!TEXT HEADER BLOCK
 113	!REQUIRE 'BLOCKT.REQ';				!END OF DEFINING STORAGE BLOCKS
 114	!
 115	! MACROS:
 116	!
 117	!	NONE
 118	!
 119	! EQUATED SYMBOLS:
 120	!
 121	
 122	LITERAL
 123	    DEBUG = 0;
 124	
 125	!
 126	! OWN STORAGE:
 127	!
 128	!	NONE
 129	!
 130	! EXTERNAL REFERENCES:
 131	!
 132	
 133	EXTERNAL ROUTINE
 134	    ATOR50,					!ASCII TO RADIX_50 CONVERSION
 135	    ERRMSG : NOVALUE,				!TYPE AN ERROR MESSAGE
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 136	    ERROR : NOVALUE,				!SIGNAL AN INTERNAL ERROR
 137	    GETSTG,					!GET STORAGE
 138	    GBL_VAL,					!GET VALUE OF GLOBAL
 139	    GET_SW,					!GET A FILE SWITCH
 140	    OUTNUM : NOVALUE,				!WRITE A NUMBER ON A FILE
 141	    OUTPUT : NOVALUE,				!WRITE ON A FILE
 142	    OUTSTR : NOVALUE,				!WRITE A STRING ON A FILE
 143	    PCRLF : NOVALUE,				!SEND CRLF TO A FILE
 144	    FND_CHAIN;					!FIND A BLOCK IN A CHAIN
 145	
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 146	ROUTINE STO11 (BYTEVAL, ADDRESS, CORE_IMAGE, CORE_SIZE) : NOVALUE = 	!STORE PDP-11 BYTE
 147	
 148	!++
 149	! FUNCTIONAL DESCRIPTION:
 150	!
 151	!
 152	!	ROUTINE TO STORE A BYTE INTO SIMULATED PDP-11 MEMORY.
 153	!
 154	!
 155	! FORMAL PARAMETERS:
 156	!
 157	!	BYTEVAL - THE VALUE OF THE BYTE TO STORE
 158	!	ADDRESS - PDP-11 ADDRESS OF WHERE TO STORE
 159	!	CORE_IMAGE - POINTER TO SIMULATED PDP-11 CORE
 160	!	CORE_SIZE - SIZE OF CORE, FOR ERROR CHECKING.
 161	!
 162	! IMPLICIT INPUTS:
 163	!
 164	!	NONE
 165	!
 166	! IMPLICIT OUTPUTS:
 167	!
 168	!	STORES INTO THE CORE IMAGE
 169	!
 170	! ROUTINE VALUE:
 171	!
 172	!	NONE
 173	!
 174	! SIDE EFFECTS
 175	!
 176	!	NONE
 177	!
 178	!--
 179	
 180	    BEGIN
 181	
 182	    MAP
 183		CORE_IMAGE : REF VECTOR;
 184	
 185	    LOCAL
 186		ADDR1,
 187		ADDR2,
 188		CORE_WORD;
 189	
 190	    IF (.ADDRESS GEQU .CORE_SIZE)
 191	    THEN
 192		ERROR (UPLIT (%ASCIZ'ADDRESS OUT OF RANGE - STO11'))
 193	    ELSE
 194		BEGIN
 195		ADDR1 = .ADDRESS/4;
 196		ADDR2 = .ADDRESS MOD 4;
 197		CORE_WORD = .CORE_IMAGE [.ADDR1];
 198		CORE_WORD<(CASE .ADDR2 FROM 0 TO 3 OF
 199			SET
 200			[0] : 18;
 201			[1] : 26;
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 202			[2] : 0;
 203			[3] : 8;
 204			TES), 8> = .BYTEVAL;
 205		CORE_IMAGE [.ADDR1] = .CORE_WORD;
 206		END;
 207	
 208	    END;					!OF STO11
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 209	ROUTINE EVAL (OPND_TYPE, OPND, RELOC_INFO) = 	!EVALUATE RELOCATION
 210	
 211	!++
 212	! FUNCTIONAL DESCRIPTION:
 213	!
 214	!
 215	!	ROUTINE TO EVALUATE RELOCATION.  CALLS ITSELF RECURSIVELY.
 216	!
 217	!
 218	! FORMAL PARAMETERS:
 219	!
 220	!	OPND_TYPE - THE TYPE OF OPERAND: CONSTANT, GLOBAL, ETC.
 221	!	OPND - THE OPERAND.  OFTEN A POINTER.
 222	!	RELOC_INFO - VARIOUS INFORMATION CARRIED FOR RELOCATION PROCESSING
 223	!
 224	! IMPLICIT INPUTS:
 225	!
 226	!	NONE
 227	!
 228	! IMPLICIT OUTPUTS:
 229	!
 230	!	NONE
 231	!
 232	! ROUTINE VALUE:
 233	!
 234	!	THE VALUE TO BE STORED IN PDP-11 MEMORY
 235	!
 236	! SIDE EFFECTS
 237	!
 238	!	NONE
 239	!
 240	!--
 241	
 242	    BEGIN
 243	
 244	    BIND
 245		ROUTINE_NAME = UPLIT (%ASCIZ'EVAL');
 246	
 247	    MAP
 248		RELOC_INFO : REF VECTOR;
 249	
 250	    BIND
 251		PSECT_PTR = RELOC_INFO [0],		!POINTER TO CURRENT PSECT
 252		STACK_BASE = RELOC_INFO [1],		!BASE OF THE PDP-11'S STACK
 253		HAA = RELOC_INFO [2],			!HIGHEST ALLOCATED ADDRESS
 254		CORE_IMAGE = RELOC_INFO [3],		!IMAGE OF SIMULATED PDP-11 CORE
 255		CORE_SIZE = RELOC_INFO [4],		!SIZE OF SIMULATED PDP-11 CORE
 256		A_OFFS = RELOC_INFO [5];		!ADDRESS OFFSET INTO TASK
 257	
 258	    MAP
 259		PSECT_PTR : REF PSECT_BLOCK;
 260	
 261	    OWN
 262		EVAL_LEVEL : INITIAL (0);
 263	
 264	    LOCAL
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 265		RESULT,
 266		GLOBL_PTR : REF GLOBL_BLOCK,
 267		OPERATOR,
 268		OPND1,
 269		OPND2,
 270		PSECT_PTR1 : REF PSECT_BLOCK,
 271		RLDD_PTR : REF RLDD_BLOCK;
 272	
 273	    IF (DEBUG GEQ 2)
 274	    THEN
 275		BEGIN
 276		PCRLF (1);
 277		OUTSTR (1, UPLIT (%ASCIZ'	Eval Called with Operand type '));
 278		OUTNUM (1, .OPND_TYPE, 10, 0);
 279		OUTSTR (1, UPLIT (%ASCIZ' and Operand of '));
 280		OUTNUM (1, .OPND, 10, 0);
 281		END;
 282	
 283	    CASE .OPND_TYPE FROM 1 TO MAX_RLD_OPND OF
 284		SET
 285	
 286		[RLD_OPND_CON] :
 287		    .OPND;
 288	
 289		[RLD_OPND_PSECT] :
 290		    BEGIN
 291		    PSECT_PTR1 = .OPND;
 292		    .PSECT_PTR1 [PSECT_BASE]
 293		    END;
 294	
 295		[RLD_OPND_GLOBAL] :
 296		    BEGIN
 297		    GLOBL_PTR = .OPND;
 298		    GBL_VAL (.GLOBL_PTR)
 299		    END;
 300	
 301		[RLD_OPND_BSTK] :
 302		    .STACK_BASE;
 303	
 304		[RLD_OPND_HLA] :
 305		    .HAA;
 306	
 307		[RLD_OPND_OPR] :
 308		    BEGIN
 309		    RLDD_PTR = .OPND;
 310		    OPERATOR = .RLDD_PTR [RLDD_OPER];
 311	
 312		    IF (DEBUG GEQ 1)
 313		    THEN
 314			BEGIN
 315			EVAL_LEVEL = .EVAL_LEVEL + 1;
 316			PCRLF (1);
 317			OUTSTR (1, UPLIT (%ASCIZ'Begin Relocation at Level '));
 318			OUTNUM (1, .EVAL_LEVEL, 10, 0);
 319			OUTSTR (1, UPLIT (%ASCIZ' Using Operator '));
 320			OUTNUM (1, .OPERATOR, 10, 0);
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 321			OUTSTR (1, UPLIT (%ASCIZ' with Operands '));
 322			OUTNUM (1, .RLDD_PTR [RLDD_OP1T], 10, 0);
 323			OUTSTR (1, UPLIT (%ASCIZ' and '));
 324			OUTNUM (1, .RLDD_PTR [RLDD_OP2T], 10, 0);
 325			END;
 326	
 327		    RESULT = (CASE .OPERATOR FROM 1 TO MAX_RLD_OP OF
 328			SET
 329			[RLD_OP_ADD] : EVAL (.RLDD_PTR [RLDD_OP1T], .RLDD_PTR [RLDD_OPND1], .RELOC_INFO) + EVAL (
 330				.RLDD_PTR [RLDD_OP2T], .RLDD_PTR [RLDD_OPND2], .RELOC_INFO);
 331			[RLD_OP_SUB] : EVAL (.RLDD_PTR [RLDD_OP1T], .RLDD_PTR [RLDD_OPND1], .RELOC_INFO) - EVAL (
 332				.RLDD_PTR [RLDD_OP2T], .RLDD_PTR [RLDD_OPND2], .RELOC_INFO);
 333			[RLD_OP_MUL] : EVAL (.RLDD_PTR [RLDD_OP1T], .RLDD_PTR [RLDD_OPND1], .RELOC_INFO)*EVAL (
 334				.RLDD_PTR [RLDD_OP2T], .RLDD_PTR [RLDD_OPND2], .RELOC_INFO);
 335			[RLD_OP_DIV] :
 336			    BEGIN
 337			    OPND1 = EVAL (.RLDD_PTR [RLDD_OP1T], .RLDD_PTR [RLDD_OPND1], .RELOC_INFO);
 338			    OPND2 = EVAL (.RLDD_PTR [RLDD_OP2T], .RLDD_PTR [RLDD_OPND2], .RELOC_INFO);
 339	
 340			    IF (.OPND2 EQL 0)
 341			    THEN
 342				BEGIN
 343				ERRMSG (1, 17, ROUTINE_NAME, PSECT_PTR [PSECT_NAME], 0, 0, 0);
 344				0
 345				END
 346			    ELSE
 347				.OPND1/.OPND2
 348	
 349			    END;
 350			[RLD_OP_AND] : EVAL (.RLDD_PTR [RLDD_OP1T], .RLDD_PTR [RLDD_OPND1], .RELOC_INFO) AND EVAL (
 351				.RLDD_PTR [RLDD_OP2T], .RLDD_PTR [RLDD_OPND2], .RELOC_INFO);
 352			[RLD_OP_OR] : EVAL (.RLDD_PTR [RLDD_OP1T], .RLDD_PTR [RLDD_OPND1], .RELOC_INFO) OR EVAL (
 353				.RLDD_PTR [RLDD_OP2T], .RLDD_PTR [RLDD_OPND2], .RELOC_INFO);
 354			[RLD_OP_COM] : NOT (IF (.RLDD_PTR [RLDD_OP1T] NEQ RLD_OPND_OMIT) THEN EVAL (.RLDD_PTR [
 355					RLDD_OP1T], .RLDD_PTR [RLDD_OPND1], .RELOC_INFO) ELSE EVAL (.RLDD_PTR [
 356					RLDD_OP2T], .RLDD_PTR [RLDD_OPND2], .RELOC_INFO));
 357			[OUTRANGE] :
 358			    BEGIN
 359			    ERRMSG (1, 39, ROUTINE_NAME, UPLIT (%ASCIZ'Operator'), .OPERATOR, 0, 0);
 360			    0
 361			    END;
 362			TES);
 363	
 364		    IF (DEBUG GEQ 1) THEN EVAL_LEVEL = .EVAL_LEVEL - 1;
 365	
 366		    .RESULT
 367		    END;
 368	
 369		[INRANGE, OUTRANGE] :
 370		    BEGIN
 371		    ERRMSG (1, 39, ROUTINE_NAME, UPLIT (%ASCIZ'Operand'), .OPND_TYPE, 0, 0);
 372		    0
 373		    END;
 374		TES
 375	
 376	    END;					!OF EVAL
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 377	ROUTINE STO_TEXT (TEXTH_PTR, RELOC_INFO) : NOVALUE = 	!STORE TEXT INFO
 378	
 379	!++
 380	! FUNCTIONAL DESCRIPTION:
 381	!
 382	!
 383	!	ROUTINE TO STORE TEXT INFORMATION IN THE PDP-11
 384	!	 SIMULATED MEMORY.
 385	!
 386	!
 387	! FORMAL PARAMETERS:
 388	!
 389	!	TEXTH_PTR - POINTER TO TEXTH BLOCK HEADING THE TEXT
 390	!	RELOC_INFO - VARIOUS INFORMATION CARRIED TO PERFORM RELOCATION
 391	!
 392	! IMPLICIT INPUTS:
 393	!
 394	!	NONE
 395	!
 396	! IMPLICIT OUTPUTS:
 397	!
 398	!	STORES INTO THE CORE IMAGE
 399	!
 400	! ROUTINE VALUE:
 401	!
 402	!	NONE
 403	!
 404	! SIDE EFFECTS
 405	!
 406	!	NONE
 407	!
 408	!--
 409	
 410	    BEGIN
 411	
 412	    BIND
 413		ROUTINE_NAME = UPLIT (%ASCIZ'STO_TEXT');
 414	
 415	    MAP
 416		RELOC_INFO : REF VECTOR,
 417		TEXTH_PTR : REF TEXTH_BLOCK;
 418	
 419	    BIND
 420		PSECT_PTR = RELOC_INFO [0],		!POINTER TO CURRENT PSECT
 421		STACK_BASE = RELOC_INFO [1],		!BASE OF THE PDP-11'S STACK
 422		HAA = RELOC_INFO [2],			!HIGHEST ALLOCATED ADDRESS
 423		CORE_IMAGE = RELOC_INFO [3],		!IMAGE OF SIMULATED PDP-11 CORE
 424		CORE_SIZE = RELOC_INFO [4],		!SIZE OF SIMULATED PDP-11 CORE
 425		A_OFFS = RELOC_INFO [5];		!ADDRESS OFFSET INTO TASK
 426	
 427	    MAP
 428		PSECT_PTR : REF PSECT_BLOCK;
 429	
 430	    LOCAL
 431		START_SEGMENT,
 432		BYTEVAL,
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 433		TEXTH_PTR1 : REF TEXTH_BLOCK,
 434		TEXTD_PTR : REF TEXTD_BLOCK,
 435		LOCATION,
 436		NUM_BYTES,
 437		TEXTD_ADDR,
 438		FILE_PTR : REF FILE_BLOCK,
 439		MODU_PTR : REF MODU_BLOCK,
 440		SEG_PTR : REF MODU_BLOCK;
 441	
 442	    TEXTH_PTR1 = .TEXTH_PTR;
 443	    SEG_PTR = 0;
 444	
 445	    WHILE (.TEXTH_PTR1 NEQ 0) DO
 446		BEGIN
 447	
 448		IF (.PSECT_PTR NEQ .TEXTH_PTR1 [TEXTH_PSECT])
 449		THEN
 450		    ERROR (UPLIT (%ASCIZ'BAD PSECT POINTER - STO_TEXT'))
 451		ELSE
 452		    BEGIN
 453		    LOCATION = .PSECT_PTR [PSECT_BASE] + .TEXTH_PTR1 [TEXTH_OFFSET];
 454		    TEXTD_PTR = .TEXTH_PTR1 [TEXTH_DATA];
 455		    MODU_PTR = .TEXTH_PTR1 [TEXTH_MODU];
 456		    FILE_PTR = .MODU_PTR [MODU_OBJ_FILE];
 457	
 458		    IF (.SEG_PTR NEQ .MODU_PTR)
 459		    THEN
 460			BEGIN
 461			START_SEGMENT = .LOCATION;
 462			SEG_PTR = .MODU_PTR;
 463			PCRLF (1);
 464			OUTSTR (1, UPLIT (%ASCIZ'			'));
 465			OUTNUM (1, .LOCATION, 8, 6);
 466			OUTPUT (1, %O'11');
 467			END;
 468	
 469		    WHILE (.TEXTD_PTR NEQ 0) DO
 470			BEGIN
 471			NUM_BYTES = .TEXTD_PTR [TEXTD_NUM_BYTES];
 472			TEXTD_ADDR = CH$PTR (TEXTD_PTR [TEXTD_DATA], -1, 8);
 473	
 474			WHILE (.NUM_BYTES NEQ 0) DO
 475			    BEGIN
 476			    BYTEVAL = CH$A_RCHAR (TEXTD_ADDR);
 477			    STO11 (.BYTEVAL, .LOCATION - .A_OFFS, .CORE_IMAGE, .CORE_SIZE);
 478			    LOCATION = .LOCATION + 1;
 479			    NUM_BYTES = .NUM_BYTES - 1;
 480			    END;
 481	
 482			TEXTD_PTR = .TEXTD_PTR [TEXTD_NEXT];
 483			END;
 484	
 485		    TEXTH_PTR1 = .TEXTH_PTR1 [TEXTH_NEXT];
 486	
 487		    IF ((.MODU_PTR NEQ .TEXTH_PTR1 [TEXTH_MODU]) OR (.TEXTH_PTR1 EQL 0))
 488		    THEN
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 489			BEGIN
 490			OUTNUM (1, .LOCATION - .START_SEGMENT, 8, 6);
 491			OUTPUT (1, %O'11');
 492	
 493			IF (.FILE_PTR NEQ 0) THEN OUTSTR (1, FILE_PTR [FILE_NAME]);
 494	
 495			OUTPUT (1, %O'11');
 496	
 497			IF (.MODU_PTR NEQ 0) THEN OUTSTR (1, MODU_PTR [MODU_NAME]);
 498	
 499			OUTPUT (1, %O'11');
 500	
 501			IF ((.MODU_PTR NEQ 0) AND (.MODU_PTR [MODU_FLAG_IDENT] NEQ 0))
 502			THEN
 503			    OUTSTR (1,
 504				MODU_PTR [MODU_IDENT]);
 505	
 506			END;
 507	
 508		    END;
 509	
 510		END;
 511	
 512	    END;					!OF STO_TEXT
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 513	ROUTINE PRC_RLD (RLDH_PTR, RELOC_INFO) = 	!STORE RELOCATED INFORMATION
 514	
 515	!++
 516	! FUNCTIONAL DESCRIPTION:
 517	!
 518	!
 519	!	ROUTINE TO COMPUTE AND STORE RELOCATED INFORMATION.
 520	!
 521	!
 522	! FORMAL PARAMETERS:
 523	!
 524	!	RLDH_PTR - POINTER TO RLDH HEADER BLOCK
 525	!	RELOC_INFO - VECTOR OF RELOCATION INFORMATION
 526	!
 527	! IMPLICIT INPUTS:
 528	!
 529	!	NONE
 530	!
 531	! IMPLICIT OUTPUTS:
 532	!
 533	!	STORES INTO THE CORE IMAGE
 534	!
 535	! ROUTINE VALUE:
 536	!
 537	!	NONE
 538	!
 539	! SIDE EFFECTS
 540	!
 541	!	NONE
 542	!
 543	!--
 544	
 545	    BEGIN
 546	
 547	    BIND
 548		ROUTINE_NAME = UPLIT (%ASCIZ'PRC_RLD');
 549	
 550	    MAP
 551		RELOC_INFO : REF VECTOR,
 552		RLDH_PTR : REF RLDH_BLOCK;
 553	
 554	    BIND
 555		PSECT_PTR = RELOC_INFO [0],		!POINTER TO CURRENT PSECT
 556		STACK_BASE = RELOC_INFO [1],		!BASE OF THE PDP-11'S STACK
 557		HAA = RELOC_INFO [2],			!HIGHEST ALLOCATED ADDRESS
 558		CORE_IMAGE = RELOC_INFO [3],		!IMAGE OF SIMULATED PDP-11 CORE
 559		CORE_SIZE = RELOC_INFO [4],		!SIZE OF SIMULATED PDP-11 CORE
 560		A_OFFS = RELOC_INFO [5];		!ADDRESS OFFSET INTO TASK
 561	
 562	    MAP
 563		PSECT_PTR : REF PSECT_BLOCK;
 564	
 565	    LOCAL
 566		ADDRESS,
 567		BYTE_FLAG,
 568		VAL_TO_STORE;
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 569	
 570	    IF (.PSECT_PTR NEQ .RLDH_PTR [RLDH_PSECT])
 571	    THEN
 572		ERROR (UPLIT (%ASCIZ'BAD PSECT POINTER - PRC_RELOC'))
 573	    ELSE
 574		BEGIN
 575		ADDRESS = .RLDH_PTR [RLDH_ADDR] + .PSECT_PTR [PSECT_BASE];
 576		BYTE_FLAG = .RLDH_PTR [RLDH_BYTE];
 577		VAL_TO_STORE = EVAL (RLD_OPND_OPR, .RLDH_PTR [RLDH_VALUE], .RELOC_INFO);
 578	
 579		IF ((.BYTE_FLAG NEQ 0) AND (.VAL_TO_STORE GTRU 255))
 580		THEN
 581		    ERRMSG (0, 18, ROUTINE_NAME,
 582			PSECT_PTR [PSECT_NAME], .VAL_TO_STORE, 0, 0);
 583	
 584		STO11 (.VAL_TO_STORE<0, 8>, .ADDRESS - .A_OFFS, .CORE_IMAGE, .CORE_SIZE);
 585	
 586		IF (.BYTE_FLAG EQL 0)
 587		THEN
 588		    STO11 (.VAL_TO_STORE<8, 8>, .ADDRESS + 1 - .A_OFFS, .CORE_IMAGE,
 589			.CORE_SIZE);
 590	
 591		END;
 592	
 593	    END;					!OF PRC_RLD
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 594	ROUTINE RESV (GLOBL_PTR, PSECT_PTR, RELOC_BASE) = 	!COMPUTE PSECT BASES
 595	
 596	!++
 597	! FUNCTIONAL DESCRIPTION:
 598	!
 599	!	COMPUTE THE BASE ADDRESS FOR EACH PSECT.  PSECTS ARE ARRANGED
 600	!	 IN MEMORY IN TWO SECTIONS: READ/WRITE AND READ-ONLY.
 601	!	 WITHIN EACH SECTION PSECTS ARE ARRANGED IN ALPHABETICAL
 602	!	 ORDER.  AS PSECTS ARE ENCOUNTERED IN THE INPUT FILES THEY
 603	!	 ARE LINKED IN THIS ORDER.
 604	!
 605	! FORMAL PARAMETERS:
 606	!
 607	!	GLOBL_PTR - POINTER TO FIRST GLOBAL FOR THE MAP
 608	!	PSECT_PTR - POINTER TO THE FIRST PSECT TO BE ALLOCATED MEMORY
 609	!	RELOC_BASE - BASE FROM WHICH TO RELOCATE EVERYTHING
 610	!
 611	! IMPLICIT INPUTS:
 612	!
 613	!	NONE
 614	!
 615	! IMPLICIT OUTPUTS:
 616	!
 617	!	NONE
 618	!
 619	! ROUTINE VALUE:
 620	!
 621	!	HIGHEST ALLOCATED ADDRESS
 622	!
 623	! SIDE EFFECTS
 624	!
 625	!	MODIFIES THE DATA STRUCTURE
 626	!
 627	!--
 628	
 629	    BEGIN
 630	
 631	    MAP
 632		GLOBL_PTR : REF GLOBL_BLOCK,
 633		PSECT_PTR : REF PSECT_BLOCK;
 634	
 635	    LOCAL
 636		CURRENT_BASE,
 637		FLAGS,
 638		PSECT_PTR1 : REF PSECT_BLOCK;
 639	
 640	    PSECT_PTR1 = .PSECT_PTR;
 641	    CURRENT_BASE = (.RELOC_BASE + 1) AND ( NOT 1);
 642	
 643	    WHILE (.PSECT_PTR1 NEQ 0) DO
 644		BEGIN
 645		PSECT_PTR1 [PSECT_BASE] = .CURRENT_BASE;
 646		FLAGS = .PSECT_PTR1 [PSECT_FLAGS];
 647	
 648		IF (.FLAGS<PSECT_FLG_REL, 1> NEQ 0)
 649		THEN
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 650		    CURRENT_BASE = .CURRENT_BASE + ((.PSECT_PTR1 [PSECT_SIZE] + 1) AND ( NOT 1));
 651	
 652		PSECT_PTR1 = .PSECT_PTR1 [PSECT_NEXT];
 653		END;
 654	
 655	    .CURRENT_BASE
 656	    END;					!OF RESV
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 657	ROUTINE SEL_MODU (MODU_PTR, UNUSED) = 		!SELECT MODULE WITH STARTING ADDR
 658	
 659	!++
 660	! FUNCTIONAL DESCRIPTION:
 661	!
 662	!
 663	!	ROUTINE TO SELECT A MODULE WITH A STARTING ADDRESS
 664	!
 665	!
 666	! FORMAL PARAMETERS:
 667	!
 668	!	MODU_PTR - POINTER TO A MODULE BLOCK
 669	!	UNUSED - ARGUMENT FROM CALL TO FND_CHAIN, NOT USED
 670	!
 671	! IMPLICIT INPUTS:
 672	!
 673	!	NONE
 674	!
 675	! IMPLICIT OUTPUTS:
 676	!
 677	!	NONE
 678	!
 679	! ROUTINE VALUE:
 680	!
 681	!	0 IF NO STARTING ADDRESS (WHICH CAUSES FND_CHAIN TO KEEP
 682	!	 SCANNING), OR THE STARTING ADDRESS + %O'200000'.
 683	!
 684	! SIDE EFFECTS
 685	!
 686	!	NONE
 687	!
 688	!--
 689	
 690	    BEGIN
 691	
 692	    MAP
 693		MODU_PTR : REF MODU_BLOCK;
 694	
 695	    LOCAL
 696		PSECT_PTR : REF PSECT_BLOCK,
 697		TTA;
 698	
 699	    TTA = .MODU_PTR [MODU_XFR_OFFSET];
 700	
 701	    IF ((.TTA<0, 1>) NEQ 0)
 702	    THEN
 703		0
 704	    ELSE
 705		%O'200000' + (IF ((PSECT_PTR = .MODU_PTR [MODU_XFR_PSECT]) EQL 0) THEN .TTA ELSE .TTA + .PSECT_PTR [
 706			PSECT_BASE])
 707	
 708	    END;					!OF SEL_MODU
 709	
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 710	GLOBAL ROUTINE BCOR (PSECT_PTR, GLOBL_PTR, MODU_CHAIN, FILE_PTR, ROOT_PTR) : NOVALUE = 	!BUILD CORE IMAGE
 711	
 712	!++
 713	! FUNCTIONAL DESCRIPTION:
 714	!
 715	!
 716	!	ROUTINE TO BUILD THE PDP-11 CORE IMAGE.
 717	!
 718	!
 719	! FORMAL PARAMETERS:
 720	!
 721	!	PSECT_PTR - POINTER TO FIRST PSECT OF PROGRAM
 722	!	GLOBL_PTR - POINTER TO FIRST GLOBAL OF PROGRAM
 723	!	MODU_CHAIN - POINTER TO CHAIN OF MODULES
 724	!	FILE_PTR - POINTER TO TASK FILE, TO GET SWITCHES
 725	!	ROOT_PTR - POINTER TO ROOT BLOCK, FOR RETURNING RESULTS
 726	!
 727	! IMPLICIT INPUTS:
 728	!
 729	!	NONE
 730	!
 731	! IMPLICIT OUTPUTS:
 732	!
 733	!	STORES INTO THE CORE IMAGE
 734	!
 735	! ROUTINE VALUE:
 736	!
 737	!	NONE
 738	!
 739	! SIDE EFFECTS
 740	!
 741	!	NONE
 742	!
 743	!--
 744	
 745	    BEGIN
 746	
 747	    BIND
 748		ROUTINE_NAME = UPLIT (%ASCIZ'BUILD_CORE_IMAGE');
 749	
 750	    MAP
 751		FILE_PTR : REF FILE_BLOCK,
 752		GLOBL_PTR : REF GLOBL_BLOCK,
 753		PSECT_PTR : REF PSECT_BLOCK,
 754		ROOT_PTR : REF ROOT_BLOCK;
 755	
 756	    LOCAL
 757		CORE_IMAGE : REF VECTOR,
 758		HAA,
 759		NOHD_FSW_PTR : REF FILSW_BLOCK,
 760		PBASE,
 761		PBASE_FSW_PTR : REF FILSW_BLOCK,
 762		PSECT_PTR1 : REF PSECT_BLOCK,
 763		PSIZE,
 764		PSIZE_FSW_PTR : REF FILSW_BLOCK,
 765		RELOC_INFO : VECTOR [8],
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 766		STACK_BASE,
 767		STACK_FSW_PTR : REF FILSW_BLOCK,
 768		TTA,
 769		UNITS,
 770		UNITS_FSW_PTR : REF FILSW_BLOCK;
 771	
 772	!
 773	! RELOC INFO IS LAID OUT AS FOLLOWS:
 774	!
 775	! 0 - POINTER TO CURRENT PSECT
 776	! 1 - STACK BASE
 777	! 2 - HIGHEST ALLOCATED ADDRESS
 778	! 3 - POINTER TO PDP-11 CORE IMAGE
 779	! 4 - SIZE OF CORE
 780	! 5 - BASE ADDRESS OF TASK, USUALLY 0
 781	! 6 - POINTER TO TASK LABEL, OR 0
 782	! 7 - LENGTH OF TASK LABEL, OR 0
 783	!
 784	!
 785	! GET THE RELEVANT SWITCHES
 786	!
 787	    STACK_FSW_PTR = GET_SW (.FILE_PTR, UPLIT (%ASCII'STACK', 0));
 788	    PBASE_FSW_PTR = GET_SW (.FILE_PTR, UPLIT (%ASCII'PBASE', 0));
 789	    PSIZE_FSW_PTR = GET_SW (.FILE_PTR, UPLIT (%ASCII'PSIZE', 0));
 790	    NOHD_FSW_PTR = GET_SW (.FILE_PTR, UPLIT (%ASCII'NOHD', 0));
 791	    UNITS_FSW_PTR = GET_SW (.FILE_PTR, UPLIT (%ASCII'UNITS', 0));
 792	!
 793	! COMPUTE NUMBER OF UNITS
 794	!
 795	    UNITS = (IF (.UNITS_FSW_PTR EQL 0) THEN 6 ELSE .UNITS_FSW_PTR [FSW_VAL]);
 796	!
 797	! COMPUTE SIZE OF STACK
 798	!
 799	    STACK_BASE = (IF (.NOHD_FSW_PTR NEQ 0) THEN 0 ELSE %O'142' + (.UNITS*4));
 800	    STACK_BASE = .STACK_BASE + (IF (.STACK_FSW_PTR EQL 0) THEN 512 ELSE IF (.STACK_FSW_PTR [FSW_VAL_PRES] EQL
 801		    0) THEN 512 ELSE (.STACK_FSW_PTR [FSW_VAL])*2);
 802	!
 803	! COMPUTE BASE ADDRESS OF TASK.  THIS WILL USUALLY BE ZERO.
 804	!
 805	    PBASE = (IF (.PBASE_FSW_PTR EQL 0) THEN 0 ELSE .PBASE_FSW_PTR [FSW_VAL]);
 806	!
 807	! RESOLVE PSECT BASES AND GLOBAL ADDRESSES, AND COMPUTE
 808	!  HIGHEST ALLOCATED ADDRESS.
 809	!
 810	    HAA = RESV (.GLOBL_PTR, .PSECT_PTR, .STACK_BASE + .PBASE);
 811	!
 812	! COMPUTE SIZE OF TASK
 813	!
 814	    PSIZE = (IF (.PSIZE_FSW_PTR EQL 0) THEN 0 ELSE .PSIZE_FSW_PTR [FSW_VAL]);
 815	
 816	    IF (.PSIZE EQL 0) THEN PSIZE = .HAA - .PBASE;
 817	
 818	    IF (.PSIZE LSS (.HAA - .PBASE))
 819	    THEN
 820		BEGIN
 821		ERRMSG (0, 22, ROUTINE_NAME, .PSIZE, .HAA - .PBASE, 0, 0);
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 822		PSIZE = .HAA - .PBASE;
 823		END;
 824	
 825	!
 826	! GET STORAGE FOR THE CORE IMAGE
 827	!
 828	
 829	    IF ((CORE_IMAGE = GETSTG ((.PSIZE + 3)/4)) EQL 0)
 830	    THEN
 831		ERRMSG (0, 1, ROUTINE_NAME, 0, 0, 0, 0)
 832	    ELSE
 833		BEGIN
 834	!
 835	! PUT INFORMATION IN RELOCATION VECTOR FOR OTHER ROUTINES
 836	!
 837		RELOC_INFO [1] = .STACK_BASE;
 838		RELOC_INFO [2] = .HAA;
 839		RELOC_INFO [3] = .CORE_IMAGE;
 840		RELOC_INFO [4] = .PSIZE;
 841		RELOC_INFO [5] = .PBASE;
 842	!
 843	! COMPUTE TASK TRANSFER ADDRESS
 844	!
 845		TTA = FND_CHAIN (.MODU_CHAIN, SEL_MODU, 0);
 846		TTA = (IF (.TTA EQL 0) THEN 1 ELSE .TTA<0, 16>);
 847	!
 848	! CREATE THE LABEL AND FILL IN THE HEADER
 849	!
 850		BLBL (.FILE_PTR, RELOC_INFO, .TTA);
 851	!
 852	! NOW SCAN THROUGH THE PSECTS, PUTTING EACH IN CORE.
 853	!
 854		OUTPUT (1, %O'14');
 855		OUTSTR (1, UPLIT (%ASCIZ'PSECT Storage Map'));
 856		PCRLF (1);
 857		PCRLF (1);
 858		OUTSTR (1, UPLIT (%ASCIZ'Name	Loc	Length	/Start	Length	File	Module	Ident'));
 859		PSECT_PTR1 = .PSECT_PTR;
 860	
 861		WHILE (.PSECT_PTR1 NEQ 0) DO
 862		    BEGIN
 863		    RELOC_INFO [0] = .PSECT_PTR1;
 864		    PCRLF (1);
 865		    OUTSTR (1, PSECT_PTR1 [PSECT_NAME]);
 866		    OUTPUT (1, %O'11');
 867		    OUTNUM (1, .PSECT_PTR1 [PSECT_BASE], 8, 6);
 868		    OUTPUT (1, %O'11');
 869		    OUTNUM (1, .PSECT_PTR1 [PSECT_SIZE], 8, 6);
 870		    STO_TEXT (.PSECT_PTR1 [PSECT_TEXT], RELOC_INFO);
 871		    FND_CHAIN (.PSECT_PTR1 [PSECT_RLD], PRC_RLD, RELOC_INFO);
 872		    PSECT_PTR1 = .PSECT_PTR1 [PSECT_NEXT];
 873		    END;
 874	
 875	!
 876	! RETURN RESULTS IN THE ROOT BLOCK
 877	!
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 878		ROOT_PTR [ROOT_CIMAGE] = .CORE_IMAGE;
 879		ROOT_PTR [ROOT_CSIZE] = ((.HAA + %O'777') AND %O'177000') - .PBASE;
 880		ROOT_PTR [ROOT_TBASE] = .PBASE;
 881		ROOT_PTR [ROOT_LBL] = .RELOC_INFO [6];
 882		ROOT_PTR [ROOT_LSIZE] = .RELOC_INFO [7];
 883		END;					!OF HAVE CORE IMAGE VECTOR
 884	
 885	    END;					!OF BCOR
 886	
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 887	ROUTINE BLBL (FILE_PTR, RELOC_INFO, TTA) : NOVALUE = 	!BUILD TASK LABEL AND HEADER
 888	
 889	!++
 890	! FUNCTIONAL DESCRIPTION:
 891	!
 892	!	BUILD THE TASK LABEL AND HEADER.  THE INFORMATION IS TAKEN MOSTLY
 893	!	 FROM SWITCHES IN THE COMMAND STRING.
 894	!
 895	! FORMAL PARAMETERS:
 896	!
 897	!	FILE_PTR - THE TASK FILE POINTER: ROOT FOR SWITCHES
 898	!	RELOC_INFO - VECTOR OF RELOCATION INFORMATION
 899	!	TTA - TASK TRANSFER ADDRESS, 1 IF NONE.
 900	!
 901	! IMPLICIT INPUTS:
 902	!
 903	!	NONE
 904	!
 905	! IMPLICIT OUTPUTS:
 906	!
 907	!	NONE
 908	!
 909	! ROUTINE VALUE:
 910	!
 911	!	NONE
 912	!
 913	! SIDE EFFECTS
 914	!
 915	!	OBTAINS STORAGE FROM THE FREE STORAGE LIST
 916	!
 917	!--
 918	
 919	    BEGIN
 920	
 921	    BIND
 922		ROUTINE_NAME = UPLIT (%ASCIZ'BLBL');
 923	
 924	    MAP
 925		FILE_PTR : REF FILE_BLOCK,
 926		RELOC_INFO : REF VECTOR;
 927	
 928	    BIND
 929		PSECT_PTR = RELOC_INFO [0],		!POINTER TO CURRENT PSECT
 930		STACK_BASE = RELOC_INFO [1],		!BASE OF THE PDP-11'S STACK
 931		HAA = RELOC_INFO [2],			!HIGHEST ALLOCATED ADDRESS
 932		CORE_IMAGE = RELOC_INFO [3],		!IMAGE OF SIMULATED PDP-11 CORE
 933		CORE_SIZE = RELOC_INFO [4],		!SIZE OF SIMULATED PDP-11 CORE
 934		A_OFFS = RELOC_INFO [5];		!ADDRESS OFFSET INTO TASK
 935	
 936	!
 937	! DEFINE THE OFFSETS INTO THE FIRST LABEL BLOCK AND THE TASK HEADER
 938	!
 939	! ALREADY INCLUDED IN LIBRARY ABOVE
 940	!    REQUIRE 'TSKDEF.REQ';
 941	!
 942	
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 943	    LOCAL
 944		PDR_OFFSET,
 945		PDR_NUMBER,
 946		PDR_VALUE,
 947		AC_FSW_PTR : REF FILSW_BLOCK,
 948		FLAGS,
 949		LBL_PTR : REF VECTOR,
 950		NOHD_FSW_PTR : REF FILSW_BLOCK,
 951		NOMM_FSW_PTR : REF FILSW_BLOCK,
 952		PAR_FSW_PTR : REF FILSW_BLOCK,
 953		PBASE_FSW_PTR : REF FILSW_BLOCK,
 954		PR_FSW_PTR : REF FILSW_BLOCK,
 955		PSIZE_FSW_PTR : REF FILSW_BLOCK,
 956		PRI_FSW_PTR : REF FILSW_BLOCK,
 957		TASK_FSW_PTR : REF FILSW_BLOCK,
 958		UNITS,
 959		UNITS_FSW_PTR : REF FILSW_BLOCK,
 960		VLEN,
 961		WINDOW;
 962	
 963	!
 964	! GET POINTERS TO SWITCHES
 965	!
 966	    AC_FSW_PTR = GET_SW (.FILE_PTR, UPLIT (%ASCII'AC', 0));
 967	    NOHD_FSW_PTR = GET_SW (.FILE_PTR, UPLIT (%ASCII'NOHD', 0));
 968	    NOMM_FSW_PTR = GET_SW (.FILE_PTR, UPLIT (%ASCII'NOMM', 0));
 969	    PAR_FSW_PTR = GET_SW (.FILE_PTR, UPLIT (%ASCII'PAR', 0));
 970	    PBASE_FSW_PTR = GET_SW (.FILE_PTR, UPLIT (%ASCII'PBASE', 0));
 971	    PR_FSW_PTR = GET_SW (.FILE_PTR, UPLIT (%ASCII'PR', 0));
 972	    PSIZE_FSW_PTR = GET_SW (.FILE_PTR, UPLIT (%ASCII'PSIZE', 0));
 973	    PRI_FSW_PTR = GET_SW (.FILE_PTR, UPLIT (%ASCII'PRI', 0));
 974	    TASK_FSW_PTR = GET_SW (.FILE_PTR, UPLIT (%ASCII'TASK', 0));
 975	    UNITS_FSW_PTR = GET_SW (.FILE_PTR, UPLIT (%ASCII'UNITS', 0));
 976	
 977	    IF ((LBL_PTR = GETSTG (1024)) EQL 0)
 978	    THEN
 979		ERRMSG (0, 1, ROUTINE_NAME, 0, 0, 0, 0)
 980	    ELSE
 981		BEGIN					!FILL IN LABEL INFORMATION
 982	!
 983	! FILL IN TASK NAME
 984	!
 985	
 986		IF (.TASK_FSW_PTR NEQ 0)
 987		THEN
 988		    BEGIN				!WE HAVE "/TASK"
 989	
 990		    IF (.TASK_FSW_PTR [FSW_TEXT_PRES] NEQ 0)
 991		    THEN
 992			BEGIN				!WE HAVE A TASK NAME
 993			ATOR50 (TASK_FSW_PTR [FSW_TEXT], LBL_PTR [L$BTSK]);
 994			END;
 995	
 996		    END;
 997	
 998	!
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

 999	! FILL IN PARTITION NAME
1000	!
1001	
1002		IF (.PAR_FSW_PTR NEQ 0)
1003		THEN
1004		    BEGIN				!WE HAVE "/PAR"
1005	
1006		    IF (.PAR_FSW_PTR [FSW_TEXT_PRES] NEQ 0)
1007		    THEN
1008			BEGIN				!WE HAVE A PARTITION NAME
1009			ATOR50 (PAR_FSW_PTR [FSW_TEXT], LBL_PTR [L$BPAR]);
1010			END;
1011	
1012		    END
1013		ELSE
1014		    ATOR50 (UPLIT (%ASCII'GEN   '), LBL_PTR [L$BPAR]);
1015	
1016	!
1017	! FILL IN BASE ADDRESS OF TASK
1018	!
1019		STO16L (.A_OFFS, LBL_PTR [L$BSA]);
1020	!
1021	! FILL IN HIGHEST ADDRESS
1022	!
1023		VLEN = ((((.HAA - .A_OFFS) + 63)/64)*64) - 1;
1024		STO16L (.A_OFFS + .VLEN, LBL_PTR [L$BHGV]);
1025		STO16L (.A_OFFS + .VLEN, LBL_PTR [L$BMXV]);
1026	!
1027	! STORE SIZE OF TASK IN 64-BYTE BLOCKS
1028	!
1029		STO16L ((.VLEN + 1)/64, LBL_PTR [L$BLDZ]);
1030		STO16L ((.VLEN + 1)/64, LBL_PTR [L$BMXZ]);
1031	!
1032	! STORE NUMBER OF TASK WINDOWS
1033	!
1034		STO16L (1, LBL_PTR [L$BWND]);
1035	!
1036	! STORE SIZE OF OVERLAY SEGMENT DESCRIPTORS
1037	!
1038		STO16L (12, LBL_PTR [L$BSEG]);
1039	!
1040	! COMPUTE FLAGS AND STORE THEM
1041	!
1042		FLAGS = (IF (.NOHD_FSW_PTR NEQ 0) THEN TS$NHD ELSE 0)	!
1043		OR (IF (.AC_FSW_PTR NEQ 0) THEN TS$ACP ELSE 0)	!
1044		OR (IF ((.PR_FSW_PTR EQL 0) AND (.AC_FSW_PTR EQL 0)) THEN 0 ELSE TS$PRV)	!
1045		OR TS$CHK;
1046		STO16L (.FLAGS, LBL_PTR [L$BFLG]);
1047	!
1048	! STORE PRIORITY
1049	!
1050		STO16L ((IF (.PRI_FSW_PTR EQL 0) THEN 0 ELSE .PRI_FSW_PTR [FSW_VAL]), LBL_PTR [L$BPRI]);
1051	!
1052	! STORE TASK TRANSFER ADDRESS
1053	!
1054		STO16L (.TTA, LBL_PTR [L$BXFR]);
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

1055	!
1056	! STORE BLOCK NUMBER OF HEADER
1057	!
1058		STO16L (2, LBL_PTR [L$BHRB]);
1059	!
1060	! STORE NUMBER OF BLOCKS IN LABEL
1061	!
1062		STO16L (2, LBL_PTR [L$BBLK]);
1063	!
1064	! STORE NUMBER OF UNITS
1065	!
1066		UNITS = (IF (.UNITS_FSW_PTR EQL 0) THEN 6 ELSE .UNITS_FSW_PTR [FSW_VAL]);
1067		STO16L (.UNITS, LBL_PTR [L$BLUN]);
1068	!
1069	! STORE TABLE OF UNITS
1070	!
1071	
1072		INCR UNIT_NO FROM 1 TO .UNITS DO
1073		    BEGIN				!STORE ASCII DEVICE NAME AND BINARY UNIT NUMBER
1074		    STO16L ((CASE .UNIT_NO FROM 1 TO 8 OF
1075			    SET
1076			    [1, 2, 3, 4] : %C'S' + (%C'Y'*256);
1077			    [5] : %C'T' + (%C'I'*256);
1078			    [6] : %C'C' + (%C'L'*256);
1079			    [7, 8] : %C'S' + (%C'Y'*256);
1080			    [OUTRANGE] : %C'S' + (%C'Y'*256);
1081			    TES), LBL_PTR [(%O'1000' + ((.UNIT_NO - 1)*4))]);
1082		    STO16L ((CASE .UNIT_NO FROM 1 TO 8 OF
1083			    SET
1084			    [1, 2, 3, 4, 5, 6, 7, 8] : 0;
1085			    [OUTRANGE] : 0;
1086			    TES), LBL_PTR [(%O'1000' + ((.UNIT_NO - 1)*4) + 2)]);
1087		    END;
1088	
1089	!
1090	! NOW STORE HEADER
1091	!
1092		STO16H (%O'142' + (.UNITS*4), H$HDLN, .RELOC_INFO);
1093		STO16H (%O'107117', H$EFLM, .RELOC_INFO);	!?
1094		STO16H (%O'424', H$CUIC, .RELOC_INFO);	![1,24]
1095		STO16H (%O'424', H$DUIC, .RELOC_INFO);	![1,24]
1096		STO16H (%O'170017', H$IPS, .RELOC_INFO);
1097		STO16H (.TTA, H$IPC, .RELOC_INFO);
1098		STO16H (.A_OFFS + .STACK_BASE, H$ISP, .RELOC_INFO);
1099		STO16H (%O'76' + (.UNITS*4), H$WND, .RELOC_INFO);
1100		STO16H (%O'140' + (.UNITS*4), H$GARD, .RELOC_INFO);
1101		STO16H (.UNITS, H$NLUN, .RELOC_INFO);
1102	
1103		INCR UNIT_NO FROM 1 TO .UNITS DO
1104		    BEGIN
1105	!
1106	! I DONT UNDERSTAND HOW THE LUN TABLE IS CONSTRUCTED, SO I
1107	!  AM GOING TO LEAVE IT ALL ZERO.
1108	!
1109		    END;
1110	
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

1111	!
1112	! COMPUTE LOCATION IN THE HEADER OF THE WINDOW BLOCK
1113	!
1114		WINDOW = H$LUN + (.UNITS*4);
1115	!
1116	! STORE NUMBER OF WINDOW BLOCKS
1117	!
1118		STO16H (1, .WINDOW, .RELOC_INFO);
1119	!
1120	! THE PCB ADDRESS IS LEFT ZERO BECAUSE I DON'T KNOW WHAT TO PUT THERE.
1121	!
1122	! STORE PARTITION BASE AS LOW VIRTUAL ADDRESS LIMIT
1123	!
1124		STO16H (.A_OFFS, .WINDOW + 4, .RELOC_INFO);
1125	!
1126	! STORE PARTITION SIZE AS HIGH VIRTUAL ADDRESS LIMIT
1127	!
1128		STO16H (.VLEN + .A_OFFS, .WINDOW + 6, .RELOC_INFO);
1129	!
1130	! STORE WINDOW SIZE
1131	!
1132		STO16H ((.VLEN + 1)/64, .WINDOW + 10, .RELOC_INFO);
1133	!
1134	! STORE PDR INFORMATION
1135	!
1136		PDR_OFFSET = (.A_OFFS/4096) + %O'200';
1137		PDR_NUMBER = (.VLEN/8192) + 1;
1138		PDR_VALUE = ((.VLEN + 1)/64) - 1;
1139		STO16H (.PDR_OFFSET<0, 8> + .PDR_NUMBER<0, 8>*256, .WINDOW + 14, .RELOC_INFO);
1140		STO16H (.PDR_VALUE<0, 7>*256 + 6, .WINDOW + 16, .RELOC_INFO);
1141	!
1142	! REMAINDER OF WINDOW BLOCK IS LEFT ALL ZERO
1143	!
1144	! THE INITIAL VALUES OF THE REGISTERS ARE LEFT ALL ZERO.
1145	!
1146	!
1147	! STORE BASE AND SIZE OF LABEL AREA
1148	!
1149		RELOC_INFO [6] = .LBL_PTR;
1150		RELOC_INFO [7] = 1024;
1151		END;					!HAVE STORAGE FOR LABEL
1152	
1153	    END;					!OF BLBL
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

1154	ROUTINE STO16L (VALUE, LOCN) : NOVALUE = 	!STORE 16 BITS IN LABEL
1155	
1156	!++
1157	! FUNCTIONAL DESCRIPTION:
1158	!
1159	!	STORE 16 BITS IN THE LABEL BUFFER.  THIS BUFFER HOLDS 8 BITS
1160	!	 PER VALUE.
1161	!
1162	! FORMAL PARAMETERS:
1163	!
1164	!	VALUE - THE 16-BIT NUMBER TO STORE
1165	!	LOCN - POINTER TO THE PLACE TO STORE THE LOW 8 BITS.
1166	!
1167	! IMPLICIT INPUTS:
1168	!
1169	!	NONE
1170	!
1171	! IMPLICIT OUTPUTS:
1172	!
1173	!	NONE
1174	!
1175	! ROUTINE VALUE:
1176	!
1177	!	NONE
1178	!
1179	! SIDE EFFECTS
1180	!
1181	!	STORES IN THE LABEL BUFFER
1182	!
1183	!--
1184	
1185	    BEGIN
1186	
1187	    BIND
1188		ROUTINE_NAME = UPLIT (%ASCIZ'STO16L');
1189	
1190	    MAP
1191		LOCN : REF VECTOR;
1192	
1193	    LOCN [0] = .VALUE<0, 8>;
1194	    LOCN [1] = .VALUE<8, 8>;
1195	    END;					!OF STO16L
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

1196	ROUTINE STO16H (VALUE, LOCN, RELOC_INFO) : NOVALUE = 	!STORE 16 BITS IN HEADER
1197	
1198	!++
1199	! FUNCTIONAL DESCRIPTION:
1200	!
1201	!	STORE 16 BITS IN THE TASK HEADER.  USE STO11.
1202	!
1203	! FORMAL PARAMETERS:
1204	!
1205	!	VALUE - THE 16-BIT NUMBER TO STORE
1206	!	LOW-MEMORY ADDRESS IN PDP-11 TASK: PLACE IN THE HEADER.
1207	!	RELOC_INFO - VECTOR OF RELOCATION INFORMATION
1208	!
1209	! IMPLICIT INPUTS:
1210	!
1211	!	NONE
1212	!
1213	! IMPLICIT OUTPUTS:
1214	!
1215	!	NONE
1216	!
1217	! ROUTINE VALUE:
1218	!
1219	!	NONE
1220	!
1221	! SIDE EFFECTS
1222	!
1223	!	STORES IN TASK HEADER
1224	!
1225	!--
1226	
1227	    BEGIN
1228	
1229	    BIND
1230		ROUTINE_NAME = UPLIT (%ASCIZ'STO16H');
1231	
1232	    MAP
1233		RELOC_INFO : REF VECTOR;
1234	
1235	    BIND
1236		PSECT_PTR = RELOC_INFO [0],		!POINTER TO CURRENT PSECT
1237		STACK_BASE = RELOC_INFO [1],		!BASE OF THE PDP-11'S STACK
1238		HAA = RELOC_INFO [2],			!HIGHEST ALLOCATED ADDRESS
1239		CORE_IMAGE = RELOC_INFO [3],		!IMAGE OF SIMULATED PDP-11 CORE
1240		CORE_SIZE = RELOC_INFO [4],		!SIZE OF SIMULATED PDP-11 CORE
1241		A_OFFS = RELOC_INFO [5];		!ADDRESS OFFSET INTO TASK
1242	
1243	    STO11 (.VALUE<0, 8>, .LOCN, .CORE_IMAGE, .CORE_SIZE);
1244	    STO11 (.VALUE<8, 8>, .LOCN + 1, .CORE_IMAGE, .CORE_SIZE);
1245	    END;					!OF STO16H
1246	END
1247	
1248	ELUDOM
1249	! Local Modes:
1250	! Comment Column:36
1251	! Comment Start:!
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

1252	! Mode:Fundamental
1253	! Auto Save Mode:2
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

AC_FSW_PTR	 947	 966#	1043	1044
ADDR1		 186	 195#	 197	 205
ADDR2		 187	 196#	 198
ADDRESS		 146	 190	 195	 196	 566	 575#	 584
		 588
ATOR50		 134*	 993	1009	1014
A_OFFS		 256#	 425#	 477	 560#	 584	 588	 934#
		1019	1023	1024	1025	1098	1124	1128
		1136	1241#
BCOR		  14#	  91	 710*
BLBL		  92	 850	 887*
BYTEVAL		 146	 204	 432	 476#	 477
BYTE_FLAG	 567	 576#	 579	 586
CORE_IMAGE	 146	 183	 197	 205#	 254#	 423#	 477
		 558#	 584	 588	 757	 829#	 839	 878
		 932#	1239#	1243	1244
CORE_SIZE	 146	 190	 255#	 424#	 477	 559#	 584
		 589	 933#	1240#	1243	1244
CORE_WORD	 188	 197#	 198#	 205
CURRENT_BASE	 636	 641#	 645	 650#	 655
ERRMSG		 135	 343	 359	 371	 581	 821	 831
		 979
ERROR		 136	 192	 450	 572
EVAL		  86	 209*	 329	 331	 333	 337	 338
		 350	 352	 354	 355	 577
EVAL_LEVEL	 262	 315#	 318	 364#
FILE_BLOCK	 438	 751	 925
FILE_NAME	 493
FILE_PTR	 438	 456#	 493	 710	 751	 787	 788
		 789	 790	 791	 850	 887	 925	 966
		 967	 968	 969	 970	 971	 972	 973
		 974	 975
FILSW_BLOCK	 759	 761	 764	 767	 770	 947	 950
		 951	 952	 953	 954	 955	 956	 957
		 959
FLAGS		 637	 646#	 648	 948	1042#	1046
FND_CHAIN	 144	 845	 871
FSW_TEXT	 993	1009
FSW_TEXT_PRES	 990	1006
FSW_VAL		 795	 801	 805	 814	1050	1066
FSW_VAL_PRES	 800
GBL_VAL		 138	 298
GETSTG		 137	 829	 977
GET_SW		 139	 787	 788	 789	 790	 791	 966
		 967	 968	 969	 970	 971	 972	 973
		 974	 975
GLOBL_BLOCK	 266	 632	 752
GLOBL_PTR	 266	 297#	 298	 594	 632	 710	 752
		 810
H$CUIC		1094
H$DUIC		1095
H$EFLM		1093
H$GARD		1100
H$HDLN		1092
H$IPC		1097
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

H$IPS		1096
H$ISP		1098
H$LUN		1114
H$NLUN		1101
H$WND		1099
HAA		 253#	 305	 422#	 557#	 758	 810#	 816
		 818	 821	 822	 838	 879	 931#	1023
		1238#
L$BBLK		1062
L$BFLG		1046
L$BHGV		1024
L$BHRB		1058
L$BLDZ		1029
L$BLUN		1067
L$BMXV		1025
L$BMXZ		1030
L$BPAR		1009	1014
L$BPRI		1050
L$BSA		1019
L$BSEG		1038
L$BTSK		 993
L$BWND		1034
L$BXFR		1054
LBL_PTR		 949	 977#	 993	1009	1014	1019	1024
		1025	1029	1030	1034	1038	1046	1050
		1054	1058	1062	1067	1081	1086	1149
LOCATION	 435	 453#	 461	 465	 477	 478#	 490
LOCN		1154	1191	1193#	1194#	1196	1243	1244
MAX_RLD_OPND	 283
MAX_RLD_OP	 327
MODU_BLOCK	 439	 440	 693
MODU_CHAIN	 710	 845
MODU_FLAG_IDENT	 501
MODU_IDENT	 504
MODU_NAME	 497
MODU_OBJ_FILE	 456
MODU_PTR	 439	 455#	 456	 458	 462	 487	 497
		 501	 504	 657	 693	 699	 705
MODU_XFR_OFFSET	 699
MODU_XFR_PSECT	 705
NOHD_FSW_PTR	 759	 790#	 799	 950	 967#	1042
NOMM_FSW_PTR	 951	 968#
NUM_BYTES	 436	 471#	 474	 479#
OPERATOR	 267	 310#	 320	 327	 359
OPND		 209	 280	 287	 291	 297	 309
OPND1		 268	 337#	 347
OPND2		 269	 338#	 340	 347
OPND_TYPE	 209	 278	 283	 371
OUTNUM		 140	 278	 280	 318	 320	 322	 324
		 465	 490	 867	 869
OUTPUT		 141	 466	 491	 495	 499	 854	 866
		 868
OUTSTR		 142	 277	 279	 317	 319	 321	 323
		 464	 493	 497	 503	 855	 858	 865
PAR_FSW_PTR	 952	 969#	1002	1006	1009
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

PBASE_FSW_PTR	 761	 788#	 805	 953	 970#
PBASE		 760	 805#	 810	 816	 818	 821	 822
		 841	 879	 880
PCRLF		 143	 276	 316	 463	 856	 857	 864
PDR_NUMBER	 945	1137#	1139
PDR_OFFSET	 944	1136#	1139
PDR_VALUE	 946	1138#	1140
PRC_RLD		  88	 513*	 871
PRI_FSW_PTR	 956	 973#	1050
PR_FSW_PTR	 954	 971#	1044
PSECT_BASE	 292	 453	 575	 645	 706	 867
PSECT_BLOCK	 259	 270	 428	 563	 633	 638	 696
		 753	 762
PSECT_FLAGS	 646
PSECT_FLG_REL	 648
PSECT_NAME	 343	 582	 865
PSECT_NEXT	 652	 872
PSECT_PTR	 251#	 259	 343	 420#	 428	 448	 453
		 555#	 563	 570	 575	 582	 594	 633
		 640	 696	 705#	 710	 753	 810	 859
		 929#	1236#
PSECT_PTR1	 270	 291#	 292	 638	 640#	 643	 645#
		 646	 650	 652#	 762	 859#	 861	 863
		 865	 867	 869	 870	 871	 872#
PSECT_RLD	 871
PSECT_SIZE	 650	 869
PSECT_TEXT	 870
PSIZE_FSW_PTR	 764	 789#	 814	 955	 972#
PSIZE		 763	 814#	 816#	 818	 821	 822#	 829
		 840
RELOC_BASE	 594	 641
RELOC_INFO	 209	 248	 251	 252	 253	 254	 255
		 256	 329	 330	 331	 332	 333	 334
		 337	 338	 350	 351	 352	 353	 355
		 356	 377	 416	 420	 421	 422	 423
		 424	 425	 513	 551	 555	 556	 557
		 558	 559	 560	 577	 765	 837#	 838#
		 839#	 840#	 841#	 850	 863#	 870	 871
		 881	 882	 887	 926	 929	 930	 931
		 932	 933	 934	1092	1093	1094	1095
		1096	1097	1098	1099	1100	1101	1118
		1124	1128	1132	1139	1140	1149#	1150#
		1196	1233	1236	1237	1238	1239	1240
		1241
RESULT		 265	 327#	 366
RESV		  89	 594*	 810
RLDD_BLOCK	 271
RLDD_OP1T	 322	 329	 331	 333	 337	 350	 352
		 354	 355
RLDD_OP2T	 324	 330	 332	 334	 338	 351	 353
		 356
RLDD_OPER	 310
RLDD_OPND1	 329	 331	 333	 337	 350	 352	 355
RLDD_OPND2	 330	 332	 334	 338	 351	 353	 356
RLDD_PTR	 271	 309#	 310	 322	 324	 329	 330
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

		 331	 332	 333	 334	 337	 338	 350
		 351	 352	 353	 354	 355	 356
RLDH_ADDR	 575
RLDH_BLOCK	 552
RLDH_BYTE	 576
RLDH_PSECT	 570
RLDH_PTR	 513	 552	 570	 575	 576	 577
RLDH_VALUE	 577
RLD_OPND_BSTK	 301
RLD_OPND_CON	 286
RLD_OPND_GLOBAL	 295
RLD_OPND_HLA	 304
RLD_OPND_OMIT	 354
RLD_OPND_OPR	 307	 577
RLD_OPND_PSECT	 289
RLD_OP_ADD	 329
RLD_OP_AND	 350
RLD_OP_COM	 354
RLD_OP_DIV	 335
RLD_OP_MUL	 333
RLD_OP_OR	 352
RLD_OP_SUB	 331
ROOT_BLOCK	 754
ROOT_CIMAGE	 878
ROOT_CSIZE	 879
ROOT_LBL	 881
ROOT_LSIZE	 882
ROOT_PTR	 710	 754	 878#	 879#	 880#	 881#	 882#
ROOT_TBASE	 880
ROUTINE_NAME	 245#	 343	 359	 371	 413#	 548#	 581
		 748#	 821	 831	 922#	 979	1188#	1230#
SEG_PTR		 440	 443#	 458	 462#
SEL_MODU	  90	 657*	 845
STACK_BASE	 252#	 302	 421#	 556#	 766	 799#	 800#
		 810	 837	 930#	1098	1237#
STACK_FSW_PTR	 767	 787#	 800	 801
START_SEGMENT	 431	 461#	 490
STO11		  85	 146*	 477	 584	 588	1243	1244
STO16H		  94#	1092	1093	1094	1095	1096	1097
		1098	1099	1100	1101	1118	1124	1128
		1132	1139	1140	1196*
STO16L		  93	1019	1024	1025	1029	1030	1034
		1038	1046	1050	1054	1058	1062	1067
		1074	1082	1154*
STO_TEXT	  87	 377*	 870
TASK_FSW_PTR	 957	 974#	 986	 990	 993
TEXTD_ADDR	 437	 472#	 476
TEXTD_BLOCK	 434
TEXTD_DATA	 472
TEXTD_NEXT	 482
TEXTD_NUM_BYTES	 471
TEXTD_PTR	 434	 454#	 469	 471	 472	 482#
TEXTH_BLOCK	 417	 433
TEXTH_DATA	 454
TEXTH_MODU	 455	 487
		DSK:BCOR.XRF[4,31]               31-Aug-79 14:36

TEXTH_NEXT	 485
TEXTH_OFFSET	 453
TEXTH_PSECT	 448
TEXTH_PTR	 377	 417	 442
TEXTH_PTR1	 433	 442#	 445	 448	 453	 454	 455
		 485#	 487
TS$ACP		1043
TS$CHK		1045
TS$NHD		1042
TS$PRV		1044
TTA		 697	 699#	 701	 705	 768	 845#	 846#
		 850	 887	1054	1097
UNITS_FSW_PTR	 770	 791#	 795	 959	 975#	1066
UNITS		 769	 795#	 799	 958	1066#	1067	1072
		1092	1099	1100	1101	1103	1114
UNIT_NO		1072	1074	1081	1082	1086	1103
UNUSED		 657
VALUE		1154	1193	1194	1196	1243	1244
VAL_TO_STORE	 568	 577#	 579	 582	 584	 588
VLEN		 960	1023#	1024	1025	1029	1030	1128
		1132	1137	1138
WINDOW		 961	1114#	1118	1124	1128	1132	1139
		1140