Google
 

Trailing-Edge - PDP-10 Archives - BB-D868C-BM - language-sources/lnkpar.mac
There are 48 other files named lnkpar.mac in the archive. Click here to see a list.
UNIVERSAL LNKPAR - PARAMETERS FOR LINK
SUBTTL	D.M.NIXON/DMN/JLd/RKH/SRM/JBC/JNG/MCHC/PAH/DZN	24-Aug-79


;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1973, 1979 BY DIGITAL EQUIPMENT CORPORATION


SEARCH	MACTEN,UUOSYM,SCNMAC
SALL


CUSTVR==0		;CUSTOMER VERSION
DECVER==4		;DEC VERSION
DECMVR==1		;DEC MINOR VERSION
DECEVR==1220		;DEC EDIT VERSION

	LOC	137	;KEEPS MACRO HAPPY
.JBVER:	<BYTE(3)CUSTVR(9)DECVER(6)DECMVR(18)DECEVR>
	RELOC
SUBTTL	CONDITIONAL ASSEMBLY SWITCHES


ND FTOVERLAY,1		;1= OVERLAY MODULE REQUIRED
ND TOPS20,0		;1=TOPS20 VERSION (WILL NOT RUN ON TOPS10)
ND DEBSW,0		;1=DEBUGGING VERSION
ND .OSJOB,0		;1= OLD STYLE JOBXXX SYMBOLS IN INITIAL TABLE
ND FTCN6,0		;1= PUT .JBCN6 (& JOBCN6) IN INITIAL SYMBOL TABLE
ND .FORLB,0		;-1= FORSE, 0 OR +1= FOROTS
ND .EXSYM,0		;1 =EXTENDED SYMBOLS VERSION
ND .NWBLK,0		;1 =NEW BLOCK TYPES (1000-1777)
ND .ASBLK,1		;1 =ASCIZ TEXT BLOCK
ND FMXFOR,1		;NON-ZERO =FORTRAN-10 / F40 LIBRARY COMPATIBILITY
			;-1 FOR MIXFOR BY DEFAULT, +1 FOR BY SWITCH ONLY
ND FTKIONLY,0		;1= KI10 D.P. INST (DMOVE, DMOVEM)
ND FTMANTIS,0		;1= MANTIS AS FORTRAN DEBUGGER (INSTEAD OF FORDDT)
ND FTVM,1		;1=USES TOPS-10 VM IF AVAILABLE
ND FTSINGLE,0		;1= SINGLE SEGMENT VERSION
ND FTFORK,0		;1= RUN IN SEVERAL FORKS (NOT YET IMPLEMENTED)
ND FTOPTION,1		;1= INCLUDE OSCAN CODE (VERY SLOW)
ND FTEXE,1		;1= EXE FILE GENERATED



;DEPENDENT CONDITIONALS

IFN TOPS20,<
	FTSINGLE==1
	FTKIONLY==1
	FMXFOR==0
	FTVM==0
>
;ASSEMBLY PARAMETERS

ND LN.PDL,^D60		;LENGTH OF PUSH-DOWN LIST
ND LN.PPD,^D60		;POLISH PUSHDOWN STACK
ND LN.EPD,^D20		;EMERGENCY PUSH DOWN STACK LENGTH
ND LN.LPP,^D56		;LINES PER PAGE OF DATA
ND LN.CPL,^D72		;CHAR PER LINE ON TTY
ND LN.DRB,6		;LENGTH OF SFD NESTING
ND .L,3			;LENGTH OF BASIC SYMBOL BLOCK
ND PATSP.,100		;LENGTH TO LEAVE IN SYMBOL TABLE FOR PATCHING
IFN FTVM!TOPS20,<
ND .IPS,^D512		;[650] INTERNAL PAGE SIZE
ND LN.WD,10000		;[650] SIZE OF CORE WINDOW (IF POSSIBLE)
> ;END IFN FTVM!TOPS20
ND LN.WD,2000		;SIZE OF CORE WINDOW (IF POSSIBLE)
ND .IPS,^D128		;INTERNAL PAGE SIZE
ND .IPM,.IPS-1		;MASK FOR ABOVE
ND .IPS2W,^D35-^L<.IPS>	;[650] LSH TO CONVERT INTERNAL PAGES TO WORDS
ND .IWS,2*.IPS	;[750] RESERVE WINDOW SIZE TO BE 2*INTERNAL PAGE.
ND .IWM,.IWS-1		;[750] MASK FOR ABOVE
ND .DBS,^D128		;DSK BLOCK SIZE (TO DISTINGUISH FROM ABOVE)
ND .DBM,.DBS-1		;MASK
ND .DBS2W,^D35-^L<.DBS>	;[650] LSH TO CONVERT BLOCKS TO WORDS
ND .CORX,4*1000		;MINIMUM SIZE TO USE FOR CORE UUO (UNLESS FAILS)
ND .VCRX,^D10*1000	;[650] .CORX IF ON A VM SYSTEM
ND .HS%,^D90		;% OF HASH TABLE TO FILL BEFORE REHASHING
ND .LVL,0		;CUTOFF LEVEL FOR ASSEMBLING ERROR MESSAGES
ND .IBR,5		;NUMBER OF BUFFERS IN INPUT RING (DEFAULT)
ND .EXC,^D9		;SIZE OF BASIC LINKED BLOCKS FOR INCLUDE/EXCLUDE
ND I.PRM,^D251		;INITIAL PRIME NUMBER FOR HASHING
ND E.PRM,^D227		;PRIME NUMBER USED TO HASH LONG ERROR MESSAGES
ND LN.12,100		;NUMBER OF LINKS IN BLOCK TYPE 12
IFN TOPS20,<
ND %HISEG,540000	;[710] HIGH SEGMENT ORIGIN
ND LC.ORG,040000	;START OF CODE AREA
ND LS.ORG,240000	;[710] START OF LOCAL SYMBOLS
ND GS.ORG,440000	;[710] START OF GLOBAL SYMBOLS
ND .PGSIZ,777		;KNOWN PAGE SIZE MASK
>
ND %HISEG,400000	;HIGH SEGMENT ORIGIN
ND .SPA,4000		;DEFAULT SIZE FOR BUFFER ON /SPACE SWITCH
ND .SPL,0		;[635] DEFAULT SPACE IN LINKS OTHER THAN ROOT
ND .ARS,10		;[635] DEFAULT VALUE FOR /ARSIZE SWITCH
ND LN.OVL,^D128*^D10*2	;MAX. NO. OF OVERLAYS ALLOWED
ND LN.ABL,^D10		;LENGTH OF ALGOL .SYM FILE DESCRIPTOR
ND LN.SWV,^D28		;MAX SWITCH VALUE LENGTH SCAN WILL RETURN
ND LN.PLC,300		;[600] LENGTH OF PHASED LOWSEG CODE IN LNKINI
ND LN.PAG,^D128		;[650] LENGTH OF PAGE. UUO ARGUMENT BLOCK
SUBTTL	REVISION HISTORY


;START OF VERSION 1A
;46	ADD KLUDGE FEATURE
;47	INTEGRATE WITH SCAN %4
;52	ADD ASCIZ TEXT BLOCK
;54	ADD KIONLY D.P. MACROS
;60	ADD /VERSION SWITCH
;65	TENEX SPEEDUP
;102	ADD FLAG FOR NO END BLOCK
;104	ADD FLAG FOR FAIL LOCAL BLOCKS
;105	ADD SYMBOL (LN.12) FOR LENGTH OF LINKS IN BLOCK TYPE 12
;107	REPLACE KLUDGE BY MIXFOR

;START OF VERSION 1B
;124	ADD FLAGS FOR /ONLY SWITCH

;START OF VERSION 2
;135	ADD OVERLAY FACILITY
;137	ADD SUPPORT FOR PLOT PACKAGE
;143	ADD BIT FOR INCLUDE MODE SEARCH
;145	IMPLEMENT /USERLIB & /NOUSERLIB
;147	TURN ON MIXFOR FEATURE
;161	ADD LANGUAGE SPECIFICATION TO /USERLIB
;167	CHANGE ARGUMENTS TO /OTSEG SWITCH
;170	INTEGRATE PLOT STUFF WITH BLISS CODE
;175	CHANGE /RESET TO /NODE
;206	ADD FLAGS FOR CHAINED FIXUP IF NOT ALL IN CORE
;221	GET PROTECTION OF XPN FILE RIGHT

;START OF VERSION 2B
;225	ADD SUPPORT FOR PSECT (MACRO VERSION 51)
;230	LINK ALL DDT SYMBOL TABLES IN OVERLAYS CORRECTLY
;243	ADD SIMULA TO KNOWN PROCESSORS
;274	Add flag bit which indicates TWOSEG forced while
;	loading DATA.
;303	GET PAGE SIZE RIGHT IF TENEX!FTVM
;345	INCLUDE EDIT 303 IN MAINTENANCE SOURCES.  LABEL EDIT 230.
;353	REMOVE EDIT 225
;363	UPDATE MINOR VERSION #
;364	Add new fixup type so NAME block doesn't have to be
;	in core when HISEG block is seen.
;400	Change Prototype Data Block offsets so SFD's can be referenced.
;402	Make /TEST unique. (Conflicts with /TMPCOR in SCAN 7B)
;404	Insert edits 334 and 340, which vanished.
;411	Add /K switch to fix ASCII text problems.
;START OF VERSION 2C
;440	Change macro so /ONLY switch ca be global
;454	Fix LITYPE macro for LNKNEW (again).
;464	Implement /MISSING and LNKIMM message.
;471	Add code for ALGOL debugging system.
;502	Increase size of basic stack for SCAN error processing.
;503	Increase lines per LPT page to 56 (was 55).
;510	Define 3 new symbol fixups for relocatable symbols.
;517	Change ABLLEN to LN.ABL.
;530	Clean up triplet flag definitions for TXxx macros.
;534	Implement /CRLF switch.
;543	Clarify comments about PS.UD? flags.
;544	SOUP in LINK version 3 stuff for TOPS-20.
;545	Make LINK understand 100(8) .LINK chains.
;551	Change /SYMBOL to /SYFILE.
;552	Organize .REQUEST/.REQUIRE stuff.
;554	Define LN.SWV.
;557	Clean up listing for release.

;START OF VERSION 3
;446	CHANGES FOR TENEX VERSION (UNDER TOPS20 SWITCH)

;START OF VERSION 3A
;560	Release on both TOPS-10 and TOPS-20 as LINK version 3A(560)

;START OF VERSION 4
;577	Define new LS fixup type for local block name chain.
;600	Define LN.PLC, AD.???, PD.???, & MX.??? in this module.
;603	Delete PPDL.
;611	Support COBOL-74
;621	/SAVE and /SSAVE switches generate an EXE  file.
;625	Add .EB to print a blank line after a message
;635	Change .SPL default to 0, add /ARSIZE switch.
;650	Use VM on TOPS-10 if available under FTVM.
;674	Define .GTRDI, .GTRDV, and .GTRS0 until they appear in UUOSYM.
;703	Add 4 more compiler types.
;715	Modify SYMSEG to take psect name.
;721	Make it /SYMSEG:PSECT:psectname
;722	Implement PSECT atrributes
;723	Add /UPTO.
;727	Add symbols .FRESP and .SYLIM for default symbol limit.
;731	Search MACTEN, UUOSYM instead of C.
;732	Add .LLOC for initial LOWLOC value.
;734	Add KL in CPUs.
;740	Remove /VERSION from switch table.
;745	Default symbol table limit(.SYLIM) is 777777.
;750	Add symbols .IWS and .IWM to reserved 2-page window size.
;756	Fix bug with PSECT attribute definition.
;761	Define  a relocatable PSECT bit(AT.RP) as part of RC.AT.
;765	Release on both TOPS-10 and TOPS-20 as LINK version 4(765)
;START OF VERSION 4A
;1112	Insert the ADD. macro.
;1117	Add /NOINCLUDE switch.
;1120	Redefine CPU types to be bits rather than values.
;1122	Remove edit 740 and make /VERSION unique in any abbreviation.
;1132	Add AT.PS.
;1144	Juggle fields in .ERR. and .ETC. words to get more flags, add .EN.
;1172	Delete .FRESP, .SYLIM, .OVPSP, AND .LLOC.
;1174	Label and clean up all error messages.
;1177	Add a global entry point for /VERSION in SWTCHS macro.
;1201	Split out the /SEGMENT and /SYMSEG keywords; disallow /SEGMENT:PSECT.
;1202	Make assemble on TOPS-20 after edit 1174.
;1203	Add support for extended FORTRAN.
;1213	Define the FS.MDC bit.
;1217	Clean up the listings for release.
;1220	Release on both TOPS-10 and TOPS-20 as version 4A(1220).
SUBTTL	STANDARD MNEMONICS--REGISTERS, BITS, UUOS


;AC NAMES
;MUST NOT BE REDEFINED, ALL LOCAL ACCS MUST BE DEFINED IN TERMS OF THESE

FL=0		;FLAGS (LH=PERMANENT, RH=TEMPORARY)
T1=1		;VERY TEMPORARIES
T2=2
T3=3
T4=4

P1=5		;PRESERVED TEMPORARIES
P2=6
P3=7
P4=10

W1=11		;MORE PERMANENT
W2=12
W3=13

R1=14		;EVEN MORE PERMANENT
R2=15
R3=16
R==R1		;ALTERNATIVE NAME

P=17		;PUSH-DOWN POINTER



;*********** TEMPORARY DEFINITIONS
;*********** REMOVE WHEN DEFINED IN FIELD-IMAGE UUOSYM

.GTRDV==135			;GETTAB FOR DEVICE RUN FROM
.GTRDI==136			;GETTAB FOR UFD RUN FROM
.GTRS0==145			;GETTAB FOR FIRST SFD RUN FROM
;I/O CHANNELS

;DEFINE I/O CHANNEL DATA

DEFINE IODATA <
;;REAL CHANNELS

 XXX	(ZC,0,.IODPR)		;GETSEG AND SCAN/WILD ONLY
 XXX	(DC,1,.IOBIN)		;READ DATA FILE
 XXX	(MC,2,.IOASC)		;MAP CHANNEL (OUTPUT)
 XXX	(RC,3,.IOASC)		;RECORD LOG FILE CHANNEL
 XXX	(OC,4,.IODPR)		;OVERLAY CHANNEL
 XXX	(LC,5,.IODPR)		;LOW SEG CODE OVERFLOW 
 XXX	(HC,6,.IODPR)		;HIGH SEG CODE OVERFLOW
 XXX	(SC,7,.IODPR)		;LOCAL SYMBOL OVERFLOW
 XXX	(GC,10,.IODPR)		;GLOBAL SYMBOL OVERFLOW
 XXX	(FC,11,.IODPR)		;FIXUP OVERFLOW
 XXX	(TC,12,.IODPR)		;TEMP CHAN (USED TO REPROCESS FIXUPS ETC)
 XXX	(AC,13,.IODPR)		;ALGOL SYMBOL OVERFLOW

;;PSEUDO-CHANNELS, USED TO HOLD LOOKUP/ENTER INFO

 XXXX	(%RC,RC,.IOASC)		;LOG FILE
 XXXX	(%SC,MC,.IODPR)		;SYMBOL FILE
 XXXX	(%VC,DC,.IODPR)		;SAVE/SSAVE FILE
 XXXX	(%XC,LC,.IODPR)		;XPN FILE
 XXXX	(%OC,OC,.IODPR)		;OVERLAY FILE
 XXXX	(%PC,0,-1)		;PLOT CHANNEL (WILL BE 17 AT RUN TIME)
>

DEFINE XXX (A,B,C)<
 A==:B
 %%==:B+1
>
DEFINE XXXX (A,B,C)<
 A==:%%
 %%==%%+1
>

IODATA
PURGE	XXX,XXXX,%%

OPDEF	HALT	[HALT]	;PUT IN CREF LISTING
OPDEF	ERRUUO	[1B8]	;ERROR UUO
;PERMANENT FLAGS (LH)

L.INC==1000		;IN SPECIAL /INC MODE (ONLY LOAD IF INCLUDED)
L.HSO==400		;LOAD HIGH SEGMENT ONLY
L.LSO==200		;LOAD LOW SEGMENT ONLY
L.FNS==100		;FORCED LOAD TO NORMAL SEGMENTS (DEFAULT)
L.FHS==40		;FORCED LOAD TO HIGH SEGMENT
L.FLS==20		;FORCED LOAD TO LOW SEGMENT
L.SPD==10		;DO SOMETHING SPECIAL FOR DEBUGGER
L.ISA==4		;IGNORE STARTING ADDRESS BLOCKS
L.SYM==2		;LOAD LOCAL SYMBOLS
L.LIB==1		;IN LIBRARY SEARCH MODE

;TEMPORARY FLAGS (RH)

R.TWSG==(1B0)		;TWOSEGMENT PROGRAM
R.LOD==(1B1)		;LOADING IN PROGRESS (BETWEEN TYPE 6 & TYPE 5)
;*****FREE BIT*****
R.CDT==(1B3)		;TWOSEG FLAG FORCED WHILE LOADING
			; DATA INCASE COMMON AND DIFF SEG
R.LHR==(1B4)		;IN NEW BLOCK TYPE THAT CAN HAVE RELOC LH

R.INC==L.INC		;IN SPECIAL /INC MODE (ONLY LOAD IF INCLUDED)
R.HSO==L.HSO		;LOAD HIGH SEGMENT ONLY
R.LSO==L.LSO		;LOAD LOW SEGMENT ONLY
R.FNS==L.FNS		;FORCED LOAD TO NORMAL SEGMENTS (DEFAULT)
R.FHS==L.FHS		;FORCED LOAD TO HIGH SEGMENT
R.FLS==L.FLS		;FORCED LOAD TO LOW SEGMENT
R.SPD==L.SPD		;DO SOMETHING SPECIAL FOR DEBUGGER
R.ISA==L.ISA		;IGNORE STARTING ADDRESS BLOCKS
R.SYM==L.SYM		;LOAD LOCAL SYMBOLS
R.LIB==L.LIB		;LIBRARY SEARCH MODE
;PRIMARY SYMBOL BITS

PT.SGN==:1B0		;SIGN BIT (MUST BE SET)
PT.EXT==:1B1		;EXTENDED TRIPLET REQUIRED
PT.SYM==:1B2		;SYMBOL TYPE
PT.TTL==:1B3		;SPECIAL TITLE BLOCK (DDT)
PT.RLC==:1B4		;RELOCATION COUNTER TYPE
PT.OTH==:1B5		;OTHER TYPE (RANDOM BLOCKS)

;FLAG BITS IN PRIMARY SYMBOL TRIPLET
PS.GLB==:1B6		;GLOBAL SYMBOL
PS.ENT==:1B7		;ENTRY POINT
PS.COM==:1B8		;COMMON
PS.REQ==:1B9		;GLOBAL REQUEST
PS.UDL==:1B10		;PARTIAL VALUE SEEN FOR LH, BUT DEPENDENT
			;GLOBAL NOT YET SEEN (I.E. A:=B##,,4)
PS.UDR==:1B11		;PARTIAL VALUE SEEN FOR RH
PS.UDF==:PS.UDL!PS.UDR	;BOTH HALVES "DEFINED" IN TERMS OF
			;OTHER SYMBOLS. NOTE THAT IF EITHER BIT
			;IS ON ALONE, THEN THE OTHER HALF MUST BE
			;FULLY DEFINED, SINCE IT WAS EITHER
			;CONSTANT (A:=B##,,4) OR WAS IN TERMS OF
			;ANOTHER GLOBAL THAT HAS SINCE BEEN
			;DEFINED.
PS.LCL==:1B12		;LOCAL SYMBOL
PS.DDT==:1B13		;HALF-KILLED (TO DDT)
PS.MDF==:1B15		;MULTIPLY DEFINED
PS.FXP==:1B16		;REFERENCE IN FIXUP TABLE
PS.REL==:1B17		;SYMBOL IS RELOCATABLE
;RIGHT HALF SIDE

PS.EXO==:1B18		;EXTENDED TRIPLET REQUIRED (FUTURE)
PS.BGS==:1B19		;COPIED FROM A BOUND GLOBAL TABLE
PS.RBG==:1B20		;RELOCATABLE BOUND GLOBAL
PS.NOE==:1B21		;NOT AN ENTRY FOR OVERLAYS
PS.NRQ==:1B22		;NOT A REQUEST (IF UNDEF) FOR OVERLAY

PS.TYP==:17		;MASK FOR OUTPUT TYPE
PS.UND==:0		;UNDEFINED
PS.LOG==:1		;LOGICAL
PS.SPI==:2		;S.P. INTEGER
PS.SPR==:4		;S.P. REAL
PS.OCT==:6		;OCTAL
PS.LBL==:7		;LABEL
PS.DPR==:10		;D.P. REAL
PS.DPI==:11		;D.P. INTEGER
PS.DO==:12		;D.P. OCTAL
PS.CMP==:14		;COMPLEX
PS.AS==:17		;ASCII STRING

;BITS IN "OTHER" BLOCKS

PO.IND==:1B6		;BLOCK IS POINTER TO WHERE REAL BLOCK WENT

;FLAG BITS IN PRIMARY TITLE BLOCK

PT.MSF==:1B6		;THIS BLOCK DESCRIBES ANOTHER SOURCE FILE
PT.FAK==:1B7		;TITLE DEFINED BY LINK NOT USER
PT.BLK==:1B8		;FAIL LOCAL BLOCK
PT.PSP==:1B9		;POINTER TO PSECT RELOC BLOCK
PT.PSC==:1B10		;PSECT RELOC BLOCKS
;SECONDARY TRIPLET BITS

S.SGN==:1B0		;SIGN BIT (MUST BE OFF)
S.LST==:1B1		;LAST SECONDARY TRIPLET
S.SYM==:1B2		;SYMBOL TYPE
S.TTL==:1B3		;TITLE BLOCK
S.RLC==:1B4		;RELOCATION CTRS

;SECONDARY SYMBOL BITS
S.LNM==:1B6		;LONG NAME
S.COM==:1B7		;COMMON (SIZE OF IT)
S.FXP==:1B8		;POINTER TO FIXUP CHAIN
S.PVS==:1B9		;PARTIAL VALUE ONLY (SYMBOL FIXUP NEEDED)
S.RBG==:1B10		;BOUND GLOBAL DEFINED IN RELOCATABLE LINK


;SECONDARY TITLE BITS: LEFT HALF (PUBLISHED VALUES)
S.CMT==:1B6		;ASCII COMMENT ABOUT PROGRAM
S.PRC==:1B7		;PROCESSOR USED TO COMPILE PROGRAM
S.CRE==:1B8		;CREATION DATE AND TIME
S.DEV==:1B9		;DEVICE & UFD FOR SOURCE FILE
S.NAM==:1B10		;FILE NAME & EXT
S.SFD==:1B11		;SFD'S
S.VER==:1B12		;VERSION
S.SEG==:1B13		;RELOCATION CTRS FOR LOW/HIGH
S.PSC==:1B13		;PSECT RELOC BLOCKS

;RIGHT HALF (INTERNAL VALUES)
S.RLD==:1B18		;REL FILE DEVICE & UFD
S.RLN==:1B19		;REL FILE NAME AND EXTENSION
S.RLS==:1B20		;REL FILE SFD'S

;THE FOLLOWING FLAGS ARE FOR INTERNAL USE ONLY, AND DO NOT APPEAR
;IN THE .REL FILE OR THE LS AREA.
S.MSF==:1B34		;PROCESSING A MULT. SRC. FILE 3RPLET
S.MUL==:1B35		;MORE THAN ONE OF THIS TRIPLET LEGAL
;CORRESPONDING BITS IN OLD RADIX-50 SYMBOLS

R5.DDT==:1B0		;HALF-KILLED TO DDT
R5.REQ==:1B1		;GLOBAL REQUEST
R5.LCL==:1B2		;LOCAL SYMBOL
R5.GLB==:1B3		;GLOBAL SYMBOL

;AND BITS IN ADDITIVE GLOBAL REQUESTS
R5.FXA==:1B0		;ADDITIVE GLOBAL FIXUP
R5.FXL==:1B1		;LEFT HALF FIXUP
R5.FXS==:1B2		;SYMBOL TABLE FIXUP
R5.FXC==:1B3		;RIGHT HALF CHAINED FIXUP

;FLAGS IN FIXUP BLOCK FIRST WORD (LEFT HALF)

FP.SGN==:1B0		;SIGN BIT (MUST BE ON FOR PRIMARY)
FP.SYM==:1B1		;SYMBOL BLOCK FIXUP (ADDITIVE GLOBAL)
FP.PTR==:1B2		;RIGHT HALF IS POINTER TO CHAIN OF FIXUPS
FP.POL==:1B3		;POLISH FIXUP BLOCK
FP.LBT==:1B4		;LOADER BLOCK TYPE (USUALLY 1)
FP.F4==:1B5		;OLD FORTRAN TABLES
FP.PRU==:1B6		;PAGE FAULT RIGHT-HALF FIXUP UNDEFINED
FP.TTL==:1B7		;STUFF FOR TITLE BLOCKS (SEG  POINTERS)

;OTHER FIXUP FLAGS FOR SYMBOL TRIPLETS ONLY

FS.FXR==:1B10		;RIGHT HALF FIXUP (R5.FXR)
FS.FXL==:1B11		;LEFT HALF FIXUP (R5.FXL)
FS.FXF==:1B12		;FULL WORD FIXUP
FS.FXS==:1B13		;SYMBOL TABLE FIXUP (R5.FXS)
FS.FXC==:1B14		;RIGHT HALF CHAINED FIXUP (R5.FXC)
FS.MDC==:1B15		;[1213] MULTIPLE PARTIAL DEFINITION FIXUP
			;[1213] FOR COMPARE WITH TRUE VALUE ONLY
			;[1213] DON'T USE OR DELETE S.PVS TRIPLET

FS.REL==:PS.REL		;DEFINING SYMBOL WAS RELOCATABLE
;FIXUP TYPES

;CORE FIXUPS
DEFINE CFIXUPS<
X CR
X CL
X CF
X AR
X AL
X AF
X RR
X RL
X RF
>

;SYMBOL TABLE FIXUPS
DEFINE SFIXUPS<
X AR
X AL
X AF
X RR;;		;SAME AS AR BUT RELOCATABLE **DON'T MOVE**
X RL;;		; "   "  AL  "        "         "     "
X RF;;		; "   "  AF  "        "         "      "
X TL
X TB;;		;[577] FIXUP LH 3RD WORD PRIMARY TITLE BLOCK
X SG
X SL;		;ADD NEW FIXUP IN SFIXUPS MACRO FOR SG, LEFT HALF
>

;DEFINE CORE FIXUP OFFSETS
DEFINE X (A)<
 CPF.'A==%%
 %%==%%+1
>
%%==0
CFIXUPS

;DEFINE SYMBOL TABLE FIXUPS
DEFINE X (A)<
 SPF.'A==%%
 %%==%%+1
>
%%==0
SFIXUPS
IFN FTEXE,<

;EXE FILE

;FLAG BIT FOR RIGHT HALF OF SSEXT (LH OF SSEXT IS THE SAVE FILE EXTENSION)

SS.SHR==000001		;SHARABLE--SET IF SSAVE SWITCH USED

;EXE FILE DIRECTORY TYPE
.SVEVC==1775		;ENTRY VECTOR

>

;COMPILER TYPES

DEFINE PROCESSORS<
X UNKNOWN,UNK,<Unknown>
X F40,F40,<F40>
X COBOL,CBL,<COBOL-68>
X ALGOL,ALG,<Algol>
X NELIAC,NLI,<NELIAC>
X PLI,PLI,<PL/I>
X BLISS,BLI,<BLISS-10>
X SAIL,SAI,<SAIL>
X FORTRAN,FOR,<FORTRAN>
X MACRO,MAC,<MACRO>
X FAIL,FAI,<FAIL>
X BCPL,BCP,<BCPL>
X MIDAS,MID,<MIDAS>
X SIMULA,SIM,<SIMULA>
X CBL74,C74,<COBOL-74>
X CBL80,C80,<COBOL-80>
X BLS36,B36,<BLISS-36>
X BASIC,BAS,<BASIC>
X SITGO,STG,<SITGO>
X FORTRAN,XFR,<Extended FORTRAN>
>
;***NOTE***	ADD NEW ITEMS IN KEYWORDS MACRO ALSO

CT.LEN==0
CT.BIT==1B0

DEFINE X (A,B,C)<
 CT.'B==CT.LEN
 CT.LEN==CT.LEN+1
 B'BIT==CT.BIT
 CT.BIT==CT.BIT_-1
>

PROCESSORS

IFE CT.BIT,<PRINTX TOO MANY PROCESSORS>
PURGE X,CT.BIT

CT.ANY=-CT.UNK
;CPU TYPES. FIRST ARGUMENT TO INTERNAL X MACRO IS THE NAME AS
;IT SHOULE BE PRINTED IN THE MAP. THE SECOND IS A TWO LETTER MNEMONIC,
;USED TO BUILD SYMBOLS. THESE ARE CURRENTLY THE SAME.

DEFINE CPUS<
  X KA,KA
  X KI,KI
  X KL,KL
>

CP.MSK==0			;[1120] TO BE MASK OF ALL VALID CPUS
CP.BIT==1B35			;[1120] STARTING CPU BIT

DEFINE X(A,B)<
  CP.'B==CP.BIT			;;[1120] ALLOCATE NEXT CPU BIT	
  CP.MSK==CP.MSK!CP.BIT		;;[1120] BUILD MASK OF ALL CPU BITS
  CP.BIT==CP.BIT_1		;;[1121] ADVANCE TO NEXT BIT
>

CPUS

PURGE X,CP.BIT
;RELOCATION TABLE POINTERS
RC.SG==0	;SEGMENT NUMBER
RC.NM==1	;NAME
RC.IV==2	;INITIAL VALUE
RC.CV==3	;CURRENT VALUE
RC.OF==4	;OFFSET IN SEGMENT RELATIVE TO 0 OR 400000
RC.HL==5	;HIGHEST LOC LOADED
RC.LB==6	;POINTER TO TAB.LB(SEG)
RC.WD==7	;POINTER TO LW.S0(SEG)
RC.PG==^D8	;POINTER TO UW.S0(SEG)
RC.AT==^D9	;[722] PSECT ATTRIBUTES

RC.INC==^D10	;SIZE OF EACH BLOCK

;[722] BIT DEFINITION FOR RC.AT

AT.RP==:1B0	;[761]  RELOCATABLE PSECT
AT.PS==:1B1	;[1132] PSECT SEEN (IN THIS MODULE)
AT.PA==:1B13	;[722] PAGE ALIGNED
AT.CN==:1B14	;[756][722] CONCATENATE
AT.OV==:1B15	;[756][722] OVERLAY
AT.RO==:1B16	;[756][722] READ ONLY
AT.RW==:1B17	;[756][722] READ/WRITE


;STANDARD ENTRY POINTS FOR EXECUTE ONLY HIGH SEGS

IFE FTSINGLE,<
%%UUO==0		;UUO ENTRY
%%RET==1		;CPOPJ
%%ST==2		;SEGMENT START
>
SUBTTL	PROTOTYPE SCAN BLOCK


F.NXT==:0			;POINTER TO NEXT FILE AREA
F.SWP==:F.NXT+1			;POINTER TO SWITCH BLOCKS
F.ZER==:F.NXT+2			;START OF AREA FOR SPEC STORAGE
F.DEV==:F.ZER+.FXDEV		;DEVICE
F.NAME==:F.ZER+.FXNAM		;NAME
F.NAMM==:F.ZER+.FXNMM		;NAME MASK
F.EXT==:F.ZER+.FXEXT		;EXT,,MASK
F.MOD==:F.ZER+.FXMOD		;MODIFIER WORD
F.PROT==:F.MOD			;OUTPUT PROTECTION
F.MODM==:F.ZER+.FXMOM		;MODIFIER MASK
F.DIR==:F.ZER+.FXDIR		;DIRECTORY
F.DIRM==:F.ZER+.FXDIM		;DIRECTORY MASK
F.SFD==:F.DIRM+1		;FIRST SFD
F.SFDM==:F.SFD+1		;FIRST SFD MASK
F.BFR==:F.ZER+.FXBFR		;/BEFORE
F.SNC==:F.ZER+.FXSNC		;/SINCE
F.ABF==:F.ZER+.FXABF		;/ABEFORE
F.ASN==:F.ZER+.FXASN		;/ASINCE
F.FLI==:F.ZER+.FXFLI		;FILE MIN SIZE (WORDS)
F.FLM==:F.ZER+.FXFLM		;FILE MAX SIZE (WORDS)
F.EST==:F.ZER+.FXEST		;/ESTIMATE
F.VER==:F.ZER+.FXVER		;/VERSION

F.LEN==:F.ZER+.FXLEN		;LENGTH REQUIRED FOR FILE SPECS
SUBTTL	PROTOTYPE DATA BLOCK


I.ZER==:0		;BASE
I.MOD==:I.ZER		;MODE OF OPEN
I.DEV==:I.MOD+1		;DEVICE
I.BUF==:I.MOD+2		;BUFFER HEADERS
I.DVZ==:I.MOD+3		;DEVSIZ WORD
I.RNG==:I.MOD+4		;POINTER TO RING BUFFERS
I.SCN==:I.MOD+5		;POINTER TO SPECIAL SCAN MOD WORD
I.CHN==:I.MOD+6		;CHAN NUMBER IN AC FIELD (TO FORM I/O INSTS)
I.SWT==:I.MOD+7		;SWITCHES STILL TO DO
			;AFTER OPEN (LH) ,, AFTER CLOSE (RH)
LN.OPN==I.SWT-I.MOD+1	;LENGTH OF "OPEN" BLOCK

I.RIB==:I.ZER+LN.OPN	;START OF LOOKUP/ENTER BLOCK
I.PPN==:I.RIB+.RBPPN	;DIRECTORY NAME OR POINTER
I.NAM==:I.RIB+.RBNAM	;FILENAME
I.EXT==:I.RIB+.RBEXT	;EXTENSION
I.PRV==:I.RIB+.RBPRV	;PRIVS, MODE, TIME DATE
I.SIZ==:I.RIB+.RBSIZ	;SIZE (OLD STYLE LOOKUP PPN)
I.VER==:I.RIB+.RBVER	;VERSION
I.EST==:I.RIB+.RBEST	;ESTIMATED LENGTH
I.ALC==:I.RIB+.RBALC	;ALLOCATED LENGTH
I.LDV==:I.RIB+.RBDEV	;LOGICAL UNIT NAME

LN.RIB==:I.LDV-I.RIB+1	;LENGTH OF ENTER BLOCK


;OFFSETS FOR FULL PATH STORAGE
I.PTH==:I.ZER+LN.OPN+LN.RIB
I.ARG==:I.PTH+.PTFCN
I.SSW==:I.PTH+.PTSWT
I.UFD==:I.PTH+.PTPPN
I.SFD==:I.UFD+1				;FIRST SFD
I.END==:I.UFD+LN.DRB
LN.SFD==:I.END-I.PTH+1
LN.IO==:LN.OPN+LN.RIB+LN.SFD		;TOTAL LENGTH REQUIRED
SUBTTL	DATA BLOCK FORMAT FOR REQUEST/REQUIRE BLOCKS


R.NXT==:0		;POINTER TO THE NEXT BLOCK
R.ZER==:R.NXT+1		;FIRST WORD CONTAINING DATA
R.DEV==:R.ZER+0		;DEVICE
R.NAM==:R.ZER+1		;FILE NAME
R.EXT==:R.ZER+2		;EXTENSION
R.PPN==:R.ZER+3		;PROJECT PROGRAMMER NUMBER
R.SFD==:R.ZER+4		;FIRST SFD
R.END==:R.SFD+5		;LAST WORD IN BLOCK
R.LEN==:R.END-R.NXT+1	;LENGTH OF THE DATA BLOCK
SUBTTL	MACROS


DEFINE VERSION<
	LOC	137
.JBVER:	<BYTE(3)CUSTVR(9)DECVER(6)DECMVR(18)DECEVR>
	RELOC
	EZCOR=:EZCOR
>

DEFINE SEGMENT<
	TWOSEG	%HISEG
>


DEFINE	U (SYMBOL,LENGTH)<
 SYMBOL=.ZZ
 IFB <LENGTH>,<.ZZ==.ZZ+1>
 IFNB <LENGTH>,<.ZZ==.ZZ+LENGTH>
 IFG .ZZ-.TEMP-.TLEN,<PRINTX Too much TEMP space used>
>

;TO CLEAR TEMP SPACE IN EACH MODULE
DEFINE ZAPTMP <
	MOVE	T1,[.TEMP,,.TEMP+1]
	SETZM	.TEMP
	BLT	T1,.TEMP+.TLEN-1
>
;DEFINE AREAS FOR LOADING INTO

DEFINE AREAS <
	XXX	(DY)	;DYNAMIC DATA
	XXX	(LC)	;LOW SEG CODE
	XXX	(HC)	;HIGH SEG CODE
	XXX	(AS)	;ALGOL SYMBOLS
	XXX	(RT)	;RELOCATION TABLE
	XXX	(LS)	;LOCAL SYMBOLS
	XXX	(FX)	;FIXUPS
	XXX	(BG)	;BOUND GLOBALS
	XXX	(GS)	;GLOBAL SYMBOLS
>
;MACRO TO MULTIPLEX OUTPUT TO LOG AND TTY
DEFINE	OUTVIA (SUBROUTINE)<
	PUSHJ	P,TTYCHK
	 PUSHJ	P,SUBROUTINE
>

;MACRO TO CLEAR ^O
DEFINE CLEARO<
	SKPINC
	  JFCL
>

;MACRO TO XLIST ERROR TEXT
DEFINE .ASCIZ (TEXT)<
	XLIST
 ASCIZ	\TEXT\
	LIST
>

DEFINE SPUSH (AC) <
 IRP AC,<
	PUSH	P,AC
>>

DEFINE SPOP (AC) <
 IRP AC,<
	POP	P,AC
>>
;MACRO TO ENTER DDT IF LOADED AND DEBUG CONDITION IS TRUE
DEFINE .JDDT (MODULE,LABEL,INST)<
 IFE DEBSW,<>
 IFN DEBSW,<
  IRP INST,<
	INST
  >
	PUSHJ	P,ENTDDT
	  .JDDTX (MODULE,LABEL,\<.-LABEL>)
	OPDEF	CONTINUE [JRSTF	@.JBOPC]
>>

DEFINE	.JDDTX	(MODULE,LABEL,INCREMENT)<
 JFCL	[ASCIZ	\MODULE:	LABEL + INCREMENT\]
>

IFN TOPS20,<
 OPDEF	ADD.	[ADDI]		;[1112] IMMEDIATE MODE
 OPDEF	IOR.	[IORI]		;IMMEDIATE MODE
 OPDEF	ANDCM.	[ANDCMI]	;IMMEDIATE MODE
>
IFE TOPS20,<
 OPDEF	ADD.	[ADD]		;[1112] FROM MEMORY
 OPDEF	IOR.	[IOR]		;FROM MEMORY
 OPDEF	ANDCM.	[ANDCM]		;FROM MEMORY
>

;MACRO TO STORE INTO USER CODE
IFE FTOVERLAY,<
	OPDEF	CSTORE	[MOVEM	W1,(P3)]
>
IFN FTOVERLAY,<
	DEFINE CSTORE,<
	XWD	CS.LHS##,CS.RHS##
>>
;MACRO TO GENERATE USER LIBRARIES BY DEFAULT
;CALL IS
;MAKLIB	LANGUAGE,DEVICE,FILE,EXT,PRJ,PRG,<SFD LIST>
;TO GENERATE THEM PUT ABOVE DEFINITIONS INTO USELIB MACRO
DEFINE USELIB <
>
;DOUBLE AND TRIPLE WORD MOVES
DEFINE TMOVE (AC,M)<
 IFL <Z M>-<@>,<
	MOVE	AC,M
	DMOVE	AC+1,1+M
 >
 IFGE <Z M>-<@>,<
	MOVEI	AC+2,M
	DMOVE	AC,(AC+2)
	MOVE	AC+2,2(AC+2)
>>

DEFINE TMOVEM (AC,M)<
	MOVEM	AC,M
	DMOVEM	AC+1,1+M
>

IFE FTKIONLY,<
 DEFINE DMOVE (AC,M)<
  IFL <Z M>-<@>,<
	MOVE	AC,M
	MOVE	AC+1,1+M
  >
  IFGE <Z M>-<@>,<
	MOVEI	AC+1,M
	MOVE	AC,(AC+1)
	MOVE	AC+1,1(AC+1)
 >>

 DEFINE DMOVEM (AC,M)<
	MOVEM	AC,M
	MOVEM	AC+1,1+M
 >
>;END IFE FTKIONLY

DEFINE SMOVE (AC,M)<
 IFE M,<
	TDZA	AC,AC
 >
 IFN M,<
	SKIPA	AC,[M]
>>
;THESE MACROS TO MOVE WORD PHYSICALLY (BUT NOT LOGICALLY) ADJACENT
;USED INCASE DATA BASE CHANGES

DEFINE DGET (AC,M1,M2)<
 IFE <M1>-<M2>+1,<
	DMOVE	AC,M1
 >
 IFN <M1>-<M2>+1,<
	MOVE	AC,M1
	MOVE	AC+1,M2
>>

DEFINE DSTORE (AC,M1,M2)<
 IFE <M1>-<M2>+1,<
	DMOVEM	AC,M1
 >
 IFN <M1>-<M2>+1,<
	MOVEM	AC,M1
	MOVEM	AC+1,M2
>>

DEFINE TGET (AC,M1,M2,M3)<
 IFE <M1>-<M2>+1,<
	DMOVE	AC,M1
	MOVE	AC+2,M3
 >
 IFN <M1>-<M2>+1,<
	MOVE	AC,M1
	DGET	AC+1,M2
>>

DEFINE TSTORE (AC,M1,M2,M3)<
 IFE <M1>-<M2>+1,<
	DMOVEM	AC,M1
	MOVEM	AC+2,M3
 >
 IFN <M1>-<M2>+1,<
	MOVEM	AC,M1
	DSTORE	AC+1,M2
>>
;BLOCK TYPE DISPATCH MACRO

DEFINE LITYPE(F,L)<
 IF1,<BLOCK <L-F+2>/2>	;ALLOCATE ENOUGH SPACE
 IF2,<
  ZZ.==F
  ZZH.==<L-F+2>/2
  ZZT.==ZZH.+ZZ.
  REPEAT ZZH.,<
   PTYPE (\ZZT.,\ZZ.)
   ZZ.==ZZ.+1
   ZZT.==ZZT.+1

 >>
 DEFINE PTYPE (X,Y)<
  IFDEF T.'X,<
   IFDEF T.'Y,<
    T.'X,,T.'Y
   >
   IFNDEF T.'Y,<
    T.'X,,E$$IRB	;;[1174]
  >>
  IFNDEF T.'X,<
   IFDEF T.'Y,<
    E$$IRB,,T.'Y	;;[1174]
   >
   IFNDEF T.'Y,<
    E$$IRB,,E$$IRB	;;[1174]
>>>>
;MACRO TO INITIALIZE REL FILE INPUT IN LNKNEW

DEFINE	RELOCATE(SIZE,WHICH),<

;;FIRST, CHECK FOR RELOCATE(NONE), AS IN NAME BLOCK INPUT ETC.
IFIDN	<SIZE><NONE>,<
	HRLI	WC,400000	;;SO T.REL? WON'T LOOK FOR REL WORDS
	SETZ	RB,		;;AND IF THEY DO THEY WON'T FIND ANY
>

;;NOT NONE, MUST BE RELOCATION BYTE SIZE. SETUP FOR THAT DATA.
IFDIF	<SIZE><NONE>,<
	MOVEI	T1,SIZE		;;GRAB SPECIFIED SIZE
	MOVEM	T1,RELSIZ	;;AND STORE FOR T.REL?
	PURGE	SETUP		;;MAKE SURE UNDEFINED FOR TEST BELOW

IFB	<WHICH>,<PRINTX ?ERRONEOUS RELOCATE MACRO>
IFNB	<WHICH>,<

IFIDN	<WHICH><RIGHT>,<OPDEF SETUP[TRZ FL,R.LHR]>;;LH ABSOLUTE
IFIDN	<WHICH><BOTH>,< OPDEF SETUP[TRO FL,R.LHR]>;;LH RELOCATABLE

;;IF THAT WON, USE IT. IF NOT, WE HAVE AN ERROR
IFDEF	<SETUP>,<	SETUP	>
IFNDEF	<SETUP>,<PRINTX ?ERRONEOUS RELOCATE MACRO>
>>>
SUBTTL	ERROR/LOG MACROS


;.ERR. MACRO GENERATES USUAL CALLS TO ERROR/LOG MODULE. GENERAL FORM IS:
;
;	.ERR.   (TYP,FLG,VER,LVL,SEV,CODE,TXT)
;	.ETC.   (TYP,FLG,,,,CODE,TXT)
;	...
;
;TYP	TYPE OF ERROR, USED AS DISPATCH, ONE OF:
;	MS	PRINTS SELF-EXPLANATORY MESSAGE
;	LRE	LOOKUP/RENAME/ENTER ERROR, I/O CHANNEL ON STACK, PRINTS REASON
;		AND FILE
;	I	INIT/OPEN ERROR, I/O CHANNEL ON STACK, PRINTS DEVICE
;	ST	I/O ERROR, CHANNEL ON STACK, PRINTS STATUS AND FILE
;FLG	LOGICAL 'OR' OF SPECIAL CASE FLAGS, SUCH AS:
;	.EP	CODE IS POINTER TO ERROR WORD
;	.EC	ERROR OUTPUT IS CONTINUED (MORE .ETC.'S COMING)
;	.EB	PRINT BLANK LINE IN LOG AFTER THIS MESSAGE
;	.EN	.ERR. WITHOUT MESSAGE (JUST CODE)
;VER	VERBOSITY LEVEL, ONE OF:
;	V%S	ONLY PREFIX AVAILABLE (LNKxxx)
;	V%M	PREFIX AND FIRST LINE AVAILABLE
;	V%L	PREFIX, FIRST LINE AND LONG EXPLANATION AVAILABLE
;LVL	ASSIGNED TYPE-OUT LEVEL (WHETHER TO PRINT)
;SEV	ASSIGNED SEVERITY LEVEL (WHETHER [, % OR ?)
;CODE	MESSAGE NMEMONIC (THE xxx IN LNKxxx)
;TXT	TEXT OF MESSAGE
;
;THE .ERR. CALL (OR THE PUSHJ P,[CHANNEL] THAT PRECEEDS IT) THAT DEFINES TXT (OR
;THAT USES THE .EN FLAG IN ITS PLACE) SHOULD HAVE THE LABEL E$$xxx::, WHERE xxx
;IS THE CODE ARGUMENT. ALL OTHER .ERR.'S THAT USE THE SAME CODE SHOULD HAVE
;LABELS OF Ennxxx, WHERE nn BEGINS WITH 01 AND INCREASES BY 1 FOR EACH USE.
;REALLY FATAL ERRORS THAT CANNOT USE .ERR. SHOULD USE .OERR. WITH THE SAME LABEL
;CONVENTIONS.
DEFINE	.ERR.(TYP,FLG,VER,LVL,SEV,CODE,TXT)<
  IFL L%MAX-LVL,<LVL=L%MAX>
  %LVL==LVL-.LVL
  IFGE %LVL,<
    IFL V%MAX-VER,<VER=V%MAX>
    IFL S%MAX-SEV,<SEV=S%MAX>
    IFNB <TYP>,<
      ERRUUO ER%'TYP
    >
    IFNB <CODE>,<
      ..PTR==1			;;[1144] ASSUME POINTER TO MESSAGE
      IFNB <TXT>,<..PTR==0>	;;[1144] TEXT SPECIFIED--NO POINTER
      IFN <<FLG>&.EN>,<..PTR==0>;;[1144] TEXT EXPLICTLY MISSING--NO POINTER
      IFE ..PTR,<		;;[1144] GENERATE TEXT HERE
        EXP <FLG>+<VER>B<B%VER>+<SEV>B<B%SEV>+<LVL>B<B%LVL>+<
          [
            .ER'CODE::ASCIZ \CODE\	;;[1174]
            IFE <<FLG>&.EN>,<ASCIZ \TXT\>
	    IFN <<FLG>&.EN>,<0>		;;[1174] NULL TEXT
          ]
        >
      >
      IFN ..PTR,<		;;[1144] GENERATE POINTER TO MESSAGE
        IF2,<
          IFNDEF .ER'CODE,<EXTERN .ER'CODE>
        >
        EXP <FLG>+<VER>B<B%VER>+<SEV>B<B%SEV>+<LVL>B<B%LVL>+<.ER'CODE>
      >
      PURGE ..PTR		;;[1144]
    >
    IFB <CODE>,<
      EXP <FLG>+<VER>B<B%VER>+<SEV>B<B%SEV>+<LVL>B<B%LVL>+<[ ASCIZ \TXT\]>
    >
  >
>


IFE TOPS20,<
	SYN	OUTSTR,.OERR.	;[1174] USED FOR MESSAGES LNKLOG CAN'T HANDLE
> ;END IFE TOPS20


IFN TOPS20,<
	DEFINE	.OERR.(TEXT)<
	HRROI	1,TEXT;;	;[1202] SAME AS OUTSTR DEF BELOW
	PSOUT
	>
> ;END IFN TOPS20
;CONTINUED ERROR WORDS HAVE SIMILAR FORM. DIFFERENCES ARE:
;TYP	INTERNALLY STORED IN LVL FIELD, ONE OF:
;	STR	ASCII STRING, TXT IS MESSAGE, OR CODE IS ADDRESS OF IT
;	SBX	CODE IS ADDRESS OF SIXBIT WORD
;	OCT	CODE IS ADDRESS OF OCTAL WORD
;	DEC	CODE IS ADDRESS OF DECIMAL WORD
;	FSP	CODE IS I/O CHANNEL, PRINT THE FILE SPEC
;	ASC	CODE IS ADDRESS OF ASCII CHARACTER
;	COR	CODE IS ADDRESS OF CORE SIZE, PRINT nK OR nP
;	JMP	CODE IS ADDRESS OF NEW LIST OF .ETC.'S
;	RTN	RETURN FROM PREVIOUS JMP
;	NLN	PRINT A NEW LINE WITH CORRECT INDENTATION
;	XCT	CODE IS ADDRESS OF INSTRUCTION TO XCT, SKIP ALLOWED
;	BKL	PRINT A BLANK IN THE LOG FILE ONLY, AND ONLY IF REAL LOG FILE
;	DAT	PRINT TODAY'S DATE
;	NOP	NO OPERATION (GOOD FOR JMPING TO)
;VER	BLANK
;LVL	BLANK
;SEV	BLANK
;CODE	SET UP ACCORDING TO TYPE ABOVE
;TXT	BLANK, OR ASCII TEXT IF .EP NOT SPECIFIED AND TYP = STR

DEFINE	.ETC.(TYP,FLG,VER,LVL,SEV,CODE,TXT)< ;;[1174]
 IFGE %LVL,<
  IFNB <CODE>,<
   EXP <FLG>+<ET%'TYP>B<B%LVL>+<CODE>
  >
  IFB <CODE>,<
   IFIDN <TYP><STR>,<			;;[1174]
    EXP <FLG>+<ET%'TYP>B<B%LVL>+<[ ASCIZ \TXT\]>
   >
   IFDIF <TYP><STR>,<			;;[1174]
    EXP <FLG>+<ET%'TYP>B<B%LVL>
  >>
 >
>
;DEFINE ALL MAIN ERROR TYPES

DEFINE ERRTYPE <
 XXX	(MS);;		ASCII MESSAGE
 XXX	(LRE);;		LOOKUP/RENAME/ENTER ERROR
 XXX	(I);;		INIT/OPEN ERROR
 XXX	(ST);;		STATUS ERROR
>

DEFINE XXX (TYPE) <
 ER%'TYPE==:ZZ
 ZZ==ZZ+1
>
ZZ==0
ERRTYPE

;DEFINE ALL CONTINUATION ERROR TYPES

DEFINE ETCTYPE <
 XXX	(STR);;		ASCIZ STRING
 XXX	(SBX);;		SIXBIT WORD
 XXX	(OCT);;		OCTAL WORD
 XXX	(DEC);;		DECIMAL WORD
 XXX	(FSP);;		FILE SPEC
 XXX	(ASC);;		ASCII CHARACTER
 XXX	(COR);;		CORE SIZE (K OR P)
 XXX	(JMP);;		GOTO ADDRESS
 XXX	(RTN);;[1174]	RETURN FROM LAST JMP
 XXX	(NLN);;[1174]	NEW LINE
 XXX	(XCT);;[1174]	XCT AN INSTRUCTION
 XXX	(BKL);;[1174]	BLANK LINE IN LOG FILE (OLD .EB FLAG)
 XXX	(DAT);;[1174]	PRINT TODAY'S DATE
 XXX	(NOP);;[1174]	NO OPERATION
IFN .NWBLK,<
 XXX	(LSP);;		LS AREA POINTER (TO A TRIPLET)
> ;END IFN .NWBLK
>
DEFINE XXX (TYPE)<
 ET%'TYPE==:ZZ
 ZZ==ZZ+1
>
ZZ==0
ETCTYPE
PURGE XXX,ZZ
;DEFINE SPECIAL VALUES USED IN .ERR. AND .ETC. MACROS

;	 0      5 67 8   12 13    17 18                       35
;	!-------------------------------------------------------!
;	! Flags  !VB!SEVERE!LOG LVL !    ADDRESS OF ARGUMENT    !
;	!-------------------------------------------------------!

;FLAGS 
.EP==1B0		;[1144] WORD IS A POINTER, **MUST** BE SIGN BIT
.EC==1B1		;[1144] WORD IS CONTINUED
.EN==1B2		;[1174] .ERR. WITHOUT MESSAGE (JUST CODE)

;BIT POSITIONS
B%VER==:^D7		;[1144] VERBOSITY FIELD
B%SEV==:^D12		;[1144] SEVERITY FIELD
B%LVL==:^D17		;LEVEL FIELD

;MAXIMUM VALUES
V%MAX==:3		;[1144] VERBOSITY FIELD
S%MAX==:37		;[1144] SEVERITY FIELD
L%MAX==:37		;[1144] LEVEL FIELD

;FIELD POSITIONS
F%VER==:<V%MAX>B<B%VER>	;[1144] VERBOSITY FIELD
F%SEV==:<S%MAX>B<B%SEV>	;[1144] SEVERITY FIELD
F%LVL==:<L%MAX>B<B%LVL>	;[1144] LEVEL FIELD

;VERBOSITY
V%S==:1			;SHORT (CODE ONLY)
V%M==:2			;MEDIUM (ONE LINE)
V%L==:3			;LONG (MUCH MORE)

;SEVERITY
S%D==:0			;[1174] DEFERRED (SEVERITY DEPENDS ON LOOKUP/ENTER CODE)
S%I==:1			;INFORMATION ONLY
S%W==:^D8		;WARNING (NOT FATAL)
S%B==:^D16		;FATAL IN BATCH MODE
S%E==:^D24		;FATAL UNLESS EDITED
S%C==:^D28		;[1174] FATAL (?) BUT CONTINUE ANYWAY
S%F==:37		;ALWAYS FATAL

;LOG LEVEL CUTOFF
L%D==:0			;[1174] DEFERRED (LEVEL DEPENDS ON LOOKUP/ENTER CODE)
L%I==:1			;INFORMATION ONLY
L%W==:^D8		;WARNING (NOT FATAL)
L%F==:37		;ALWAYS VISIBLE

DEFINE LEVELS (ITEM,LEVEL)<
 IRPC LEVEL,<
  ITEM'%I'LEVEL==:ITEM'%I+LEVEL
>>

LEVELS S,<1234567>
LEVELS L,<1234567>

%ENT==1B0		;ENTER ERROR
%LKP==1B1		;LOOKUP ERROR
%REN==1B2		;RENAME ERROR
SUBTTL	SWITCH MACROS


;SWTCHS MACRO CONTAINS ALL KNOW SWITCHES
;IT IS EXPANDED IN VARIOUS PLACES  (LNKSCN, LNKWLD)
;FORM IS SWMAC A,B,C,D,E,F,G,H,I
;WHERE
;SWMAC IS A MACRO REDINED ON EACH CALL TO SWTCHS
;A	IS A MACRO KNOWN TO SCNMAC (SL, SP, OR SS)
;B	IS THE SWITCH NAME IN SIXBIT
;C	IS STORAGE (NULL UNLESS MULTIPLE WORD) GENERATES A TOKEN#
;D	IS PROCESSOR REQUIRED (SP)
;	OR KEY WORD LIST (SL)
;	OR VALUE (SS)
;E	IS ABBREVIATION FOR DEFAULT VALUES (SP)
;	OR DEFAULT KEY VALUE (SL)
;	OR NULL (SS)
;F	IS SIZE OF BLOCK REQUIRED TO STORE SWITCH (SINGLE OCCURANCE)
;G	IS "." IF SWITCH ACTION IS DIFFERENT IF SEEN BEFORE FILE NAME
;	THAN IF SEEN AFTER FILE NAME, NULL IF NOT
;H	IS "*" IF SWITCH WILL ALWAYS BE UNIQUE TO ONE CHARACTER
;I	IS DISPATCH IF SWITCH HAS TWO VALUES
;	I.E. /SWITCH:SYMBOL:VALUE

;THE SWITCHES NEED NOT BE IN ALPHABETICAL ORDER
;TO ADD A NEW ONE  JUST PUT IN TABLE
;AND DEFINE ALL SYMBOLS REQUIRED BY SWTCHS EXPANSION
DEFINE SWTCHS<
SWMAC	SP,ARSIZE,,.SWDEC,ARS,3;;	;[635] MAKE AR TABLE BIGGER
SWMAC	SP,BACKSPACE,,.SWDEC,MTP,3,.
SWMAC	SP,COMMON,,.SWSYM,SYM,4,.,,.DECNW
SWMAC	SL,CONTENT,,CONK,1,3
SWMAC	SS,COUNTER,,0,,3,.
SWMAC	SS,CRLF,,0,,3,.;;	;REMEMBER EOL'S IN ASCII TEXT
SWMAC	SL,DDEBUG,,DEBK,1,3
SWMAC	SL,DEBUG,,DEBK,1,3,.,*
SWMAC	SL,DEFAULT,,DEFK,1,3,.
SWMAC	SP,DEFINE,,.SWSYM,SYM,4,,,.DECNW
SWMAC	SS,ENTRY,,0,,3,.
SWMAC	SP,ERRORLEVEL,,.SWDEC,ERR,3
SWMAC	SP,EXCLUDE,,.SWSYM,SYM,3,.
SWMAC	SS,EXECUTE,,0,,3,,*
SWMAC	SP,FRECOR,,.SWDEC,FRC,3
SWMAC	SS,GO,,0,,3,,*
SWMAC	SP,HASHSIZE,,.SWDEC,HAS,3
SWMAC	SP,INCLUDE,,.SWSYM,SYM,3,.
SWMAC	SS,K,,0,,3,,*
SWMAC	SP,LINK,,.SWSIX,SYM,3
SWMAC	SS,LOCALS,,0,,3,.,*
SWMAC	SS,LOG,,0,,3
SWMAC	SP,LOGLEVEL,,.SWDEC,LOG,3
SWMAC	SL,MAP,,MAPK,1,3,,*
SWMAC	SS,MISSING,,0,,3,.;;	;FOR INCLUDES NOT SATISFIED
SWMAC	SL,MPSORT,,MPSK,1,3
SWMAC	SL,MTAPE,,MTPK,1,3,.
SWMAC	SL,NEWPAGE,,HYLK,1,3,.
SWMAC	SP,NODE,,.SWSXD,SYM,3
SWMAC	SP,NOENTRY,,.SWSYM,SYM,3,.
SWMAC	SS,NOINCLUDE,,0,,3,.;;		;[1117] TURN OFF STICKY /INCLUDE
SWMAC	SS,NOINITIAL,,0,,3
SWMAC	SS,NOLOCAL,,0,,3,.,*
SWMAC	SP,NOREQUESTS,,.SWSIX,SYM,3,.
SWMAC	SS,NOSEARCH,,0,,3,.
SWMAC	SS,NOSTART,,0,,3,.
SWMAC	SS,NOSYMBOL,,0,,3
SWMAC	SL,NOSYSLIBRARY,,LIBK,1,3
SWMAC	SL,NOUSERLIBRARY,,LIBK,1,3
SWMAC	SL,ONLY,,ONLK,1,3,.
SWMAC	SL,OTSEGMENT,,OTSK,1,3
SWMAC	SL,OVERLAY,,OVLK,1,3,.
SWMAC	SP,PATCHSIZE,,.SWDEC,PAT,3
SWMAC	SL,PLOT,,PLTK,1,4,,,.DECNW
SWMAC	SS,REQUEST,,0,,3,.
SWMAC	SP,REQUIRE,,.SWSYM,SYM,3
SWMAC	SS,REWIND,,0,,3,.
SWMAC	SP,RUNAME,,.SWSIX,SYM,3
SWMAC	SS,SAVE,,0,,3
SWMAC	SS,SEARCH,,0,,3,.,*
SWMAC	SL,SEGMENT,,SEGK,1,3,.
SWMAC	SP,SEVERITY,,.SWOCT,SEV,3
SWMAC	SP,SET,,.SWSYM,SYM,4,.,,.SYOSW
SWMAC	SP,SKIP,,.SWDEC,MTP,3,.
SWMAC	SP,SPACE,,.SWDEC,SPA,3
SWMAC	SP,START,,.SWSYO,STA,3,.
SWMAC	SL,SYFILE,,SYMK,1,3
SWMAC	SL,SYMSEG,,SSGK,2,4,.,,.SWSYM	;[1201]
SWMAC	SL,SYSLIBRARY,,LIBK,1,3,.
SWMAC	SL,SYSORT,,SYSK,1,3
SWMAC	SL,TEST,,DEBK,1,3,.,*
SWMAC	SS,UNDEFINED,,0,,3,.,*
SWMAC	SS,UNLOAD,,0,,3
SWMAC	SP,UPTO,,.SYOSW,UPT,3	;[723]
SWMAC	SL,USERLIBRARY,,LIBK,1,3
SWMAC	SP,VALUE,,.SWSYM,SYM,3,.
SWMAC	SL,VERBOSITY,,VERK,2,3
SWMAC	SP,VERSION,,.SWVER,SYM,3,.,*	;;[1177]
IFE TOPS20,<
SWMAC	SP,CORE,2,.SWDPK,COR,4
SWMAC	SL,CPU,,CPUK,1,3
SWMAC	SP,ESTIMATE,,.SWDEC,EST,3
SWMAC	SS,FOROTS,,0,,3
SWMAC	SS,FORSE,,0,,3
SWMAC	SP,MAXCOR,2,.SWDPK,COR,4
SWMAC	SP,RESET,,.SWSXD,SYM,3
SWMAC	SP,RUNCOR,2,.SWDPK,COR,4
SWMAC	SS,SSAVE,,0,,3
SWMAC	SS,XPN,,0,,3
SWMAC	SS,ZERO,,0,,3
 >
IFN FMXFOR,<
SWMAC	SS,MIXFOR,,0,,3
SWMAC	SS,NOMIXFOR,,0,,3
 >
>
COMMENT	\SWITCHES HANDLED DIRECTLY BY SCAN
ABEFORE
ASINCE
BEFORE
DENSITY
ERNONE
ERPROTECTION
ERSUPERSEDE
ESTIMATE
*HELP
LENGTH
MESSAGE
NOOPTION
NOPHYSICAL
NOSTRS
OKNONE
OKPROTECTION
OKSUPERSEDE
OPTION
PARITY
PHYSICAL
PROTECTION
RUN
RUNCORE
RUNOFFSET
SINCE
STRS
VERSION
\
SUBTTL	DEFAULT VALUES


;.C==^D256*2000-1		;ALL OF CORE
.C==^D128*2000-1		;SCAN CANNOT HANDLE BIT 18 ON
.NULARG==,,-1			;SCAN BARFS ON 0
;*** NOTE **** SCAN CANNOT HANDLE MAXIMUM SIZE GREATER THAN 377777


DM	ARS,.C,.ARS,.ARS	;[635]
DM	COR,.C,0,0
DM	ERR,L%MAX-1,0,L%W-1
DM	EST,<<.C+1>_-8>,0,0
DM	HAS,^D13001,^D101,^D101
DM	LOG,L%MAX-1,0,0
DM	MTP,.C,1,1
DM	PAT,.C,PATSP.,PATSP.
DM	SAV,.C,0,.NULARG
DM	SEV,S%MAX-1,0,S%W
DM	SPA,.C,.SPA,.SPA
DM	STA,.C,0,.C
DM	SYM,.C,0,0
DM	VER,V%MAX,0,0
DM	FRC,.C,4000,4000
DM	SPC,.C,.SPA,.SPA
DM	UPT,.C,0,.NULARG
SUBTTL	KEY WORDS


;NOTE - CON ARGS ARE PAIRS AS <FLAG,NOFLAG>
;	  EXCEPT FOR <DEFAULT> , ORDER MUST BE <DEFAULT,ALL,NONE>
;NOTE - DEBUG ARGS ARE REALLY PAIRS AS <COMPILER,DEBUG AID>

DEFINE KEYWORDS<
KEYMAC	CON,<DEFAULT,ALL,NONE,GLOBAL,NOGLOBAL,LOCALS,NOLOCAL,ENTRY,NOENTRY
,UNDEFINED,NOUNDEFINED,RELOCATABLE,NORELOCATABLE,ABSOLUTE,NOABSOLUTE,COMMON,NOCOMMON
,ZERO,NOZERO>
KEYMAC	CPU,<KA10,KI10,KL10>
IFE FTMANTIS,<
KEYMAC	DEB,<,MACRO,DDT,*FORTRAN,FORDDT,*COBOL,COBDDT,SAIL,SDDT
,FAIL,SDDT,SIMULA,SIMDDT>
>
IFN FTMANTIS,<
KEYMAC	DEB,<,MACRO,DDT,*FORTRAN,MANTIS,*COBOL,COBDDT,SAIL,SDDT
,FAIL,SDDT,SIMULA,SIMDDT>
>
KEYMAC	DEF,<INPUT,OUTPUT>
KEYMAC	HYL,<LOW,HIGH>
KEYMAC	LIB,<ANY,F40,COBOL,ALGOL,NELIAC,PL1,BLISS,SAIL,*FORTRAN,MACRO
,FAIL,BCPL,MIDAS,SIMULA,CBL74,CBL79,BLS36,BASIC,SITGO,FORTRAN>
KEYMAC	MAP,<END,NOW,ERROR,INCREMENTAL>
KEYMAC	MPS,<UNSORTED,ALPHABETICAL,NUMERICAL>
KEYMAC	MTP,<MTWAT.,MTREW.,MTEOF.,MTSKR.,MTBSR.,MTEOT.
,MTUNL.,MTBLK.,MTSKF.,MTBSF.,MTDEC.,MTIND.>
KEYMAC	ONL,<BOTH,LOW,HIGH>
KEYMAC	OTS,<DEFAULT,NONSHARABLE,SHARABLE,LOW,HIGH>
KEYMAC	OVL,<DEFAULT,ABSOLUTE,RELOCATABLE,TREE,NETWORK,PURE,WRITABLE
,PATH,NOPATH,SINGLE,MULTIPLE,LOGFILE,NOLOGFILE,WARNING,NOWARNING>
KEYMAC	PLT,<INCHES,LEAVES,STEPS>
KEYMAC	SEG,<LOW,HIGH,DEFAULT,NONE>	;[1201]
KEYMAC	SSG,<LOW,HIGH,NONE,PSECT,DEFAULT> ;[1201] LOW & HIGH MUST BE FIRST 2
KEYMAC	SYM,<RADIX50,TRIPLET,ALGOL>;	;;ADD ALGOL KEYWORD
KEYMAC	SYS,<UNSORTED,ALPHABETICAL,NUMERICAL>
KEYMAC	VER,<SHORT,MEDIUM,LONG>
>
SUBTTL	PRE-DEFINED KEYWORDS


DEFINE KEYMAC (A,B)<
 IFIDN <A><CPU>,<
  %%==0
  IRP B,<
   $'A'B==:%%
   %%==%%+1
>>>

KEYWORDS

DEFINE KEYMAC (A,B)<
 IFIDN <A><SSG>,<
  %%==1
  IRP B,<
   $'A'B==:%%
   %%==%%+1
>>>

KEYWORDS
SUBTTL	LIBRARY SETTING BITS


;THIS SETS MORE BITS THAN ACTUALLY EXIST BUT ONLY THE REQUIRED ONES
;ARE USED

DEFINE X (A,B,C)<
 IFIDN <B><UNK>,<
  $LIBDEFAULT==UNKBIT
 >
 $LIB'B==B'BIT
>

PROCESSORS
SUBTTL	MAP FORMAT  AND CONTENTS


DEFINE  KEYMAC (A,B)<
 IFIDN <A><CON>,<
  C%BIT==1B0
  %%==0
  IRP B,<
   IFN %%&1,<
    C%'B==:C%BIT
    C%ALL==:C%ALL!C%BIT
    C%BIT==C%BIT_-1
    IFE C%BIT,<PRINTX	TOO MANY MAP CONTENT KEY WORDS>
   >
   %%==%%+1
>>>

KEYWORDS
C%DEFAULT==:C%GLOBAL!C%ENTRY!C%RELOC!C%ABSOL!C%COMMON

PURGE	KEYMAC,C%BIT,%%

DEFINE	KEYMAC (A,B)<
 IFIDN <A><MAP>,<
  %%==0
  IRP B,<
   IFIDN <B><INCREMENTAL>,<
    $'A'B==:-1
   >
   IFDIF <B><INCREMENTAL>,<
    $'A'B==:<%%==%%+1>
   >
>>>

KEYWORDS

	PURGE	KEYMAC,%%
SUBTTL	OVERLAY TYPE KEY WORDS


DEFINE	KEYMAC (A,B)<
 IFIDN <A><OVL>,<
  %%==1B35
  IRP B,<
   $OV'B==%%
   IFN <%%==%%_1>&<-1,,0>,<PRINTX	TOO MANY OVERLAY TYPES>
>>>

KEYWORDS
$OVDEFAULT==$OVABSOLUTE!$OVTREE!$OVPURE!$OVSINGLE

	PURGE	KEYMAC,%%
SUBTTL	TOPS-20 JSYS


IFN TOPS20,<
	OPDEF	JSYS	[104B8]
	OPDEF	SEVEC	[JSYS	204]
	OPDEF	GEVEC	[JSYS	205]
	OPDEF	GET	[JSYS	200]
	OPDEF	GTJFN	[JSYS	 20]
	OPDEF	CIS	[JSYS	141]
	OPDEF	DIR	[JSYS	130]
	OPDEF	PBOUT	[JSYS	 74]
	OPDEF	PSOUT	[JSYS	 76]
	OPDEF	PMAP	[JSYS	56]
	OPDEF	CFORK	[JSYS	152]

DEFINE	OUTSTR (TEXT)<
	HRROI	1,TEXT
	PSOUT
>

DEFINE	OUTCHR (ACC)<
 IFN ACC-1,<
	HRRZ	1,ACC
 >
	PBOUT
>

>;END IFN TOPS20
SUBTTL	THE END


	END