Google
 

Trailing-Edge - PDP-10 Archives - bb-h138e-bm_tops20_v6_1_distr - 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/PY/MFB/JBS 10-Jan-85
	
	
;COPYRIGHT (C) 1973, 1985 BY
;DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
;
;
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
;ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
;INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
;COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
;OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
;TRANSFERRED.
;
;
;THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
;AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
;CORPORATION.
;
;DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
;SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.

SEARCH	MACTEN,UUOSYM,SCNMAC
IFN TOPS20,<SEARCH MONSYM>	;[2071]
SALL
	
	
CUSTVR==0		;CUSTOMER VERSION
DECVER==6		;DEC VERSION
DECMVR==0		;DEC MINOR VERSION
DECEVR==2353		;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 .EXSYM,0		;1 =EXTENDED SYMBOLS VERSION
ND .NWBLK,1		;1 =NEW BLOCK TYPES (1000-1777)
ND .ASBLK,1		;1 =ASCIZ TEXT BLOCK
ND FTKIONLY,0		;1= KI10 D.P. INST (DMOVE, DMOVEM)
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
	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)
ND LN.BF,<10*.IPS>	;[1401] SIZE OF REL FILE PMAP BUFFER
> ;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,525000	;[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 PATORG,700000	;[1242] ORIGIN OF PA1050
ND KILPAT,12		;[1263] PA1050 SUICIDE COMPT. FUNCTION NUMBER
ND .PGSIZ,777		;KNOWN PAGE SIZE MASK
ND LN.FL,^D13		;[2041] WORDS NEEDED FOR ASCIZ FILESPEC
ND FILSIZ,^D23		;[2301] WORDS FOR JFNS% OF TOPS-10 COMPATIBLE FILESPEC
>
ND %HISEG,540000	;[1750] 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
ND LN.OTS,50000		;[1225] AMOUNT TO LEAVE FREE BELOW OTS @/SYSLIB TIME
ND TP.MRB,2000		;[2270] Blocks to return before garbage collect
ND MAXSEC,^D32		;[2200] Max number of sections (must be .LT. 36)
ND PAGSEC,^D512		;[2247] Number of pages in a section
ND MAXSYM,^D72		;[2210] Max number of characters in a symbol
ND SYMSIZ,<<MAXSYM+5>/6> ;[2210] Number of words of storage for long symbols
ND ERRLEN,^D132		;[2304] Length of ERSTR% buffer in words
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 5I
;1000	Define more primary symbol bits for block 1070 support.
;1004	Define new symbol table header offsets
;1005	Add /EQUIVALENCE switch.
;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).

;START OF VERSION 4B
;1222	Allow full symbol character set in /NOREQUEST:.
;1223	Make the argument to /SEVERITY: be decimal instead of octal.
;1225	Make runtime OTS origin compiler-specific.
;1230	Define the $SYM?? symbols for all of LINK, not just LNKWLD.
;1236	Teach LINK about KS10s.
;1240	Fix /CPU switch, make it work on TOPS-20.
;1242	Add definition of PATORG as start of PA1050 on TOPS-20
;1243	Define PS.GLD to make left half fixups to global symbols work.
;1244	Add definition of PATLEN as number of pages of PA1050
;1260	Default for /SYMSEG should be /SYMSEG:LOW
;1264	Add ZAPTP2 and U2 Macros.
;1267	Add ALGOL and ALGDDT to list of debuggers in DEB macro.
;1300	Add RC.NM and /LIMIT switch.
;1307	Add /SUPPRESS switch.
;1326	Add KILPAT definition.

;START OF VERSION 5
;1402	Add LN.BF for .REL file I/O on TOPS-20.
;1411	Add AT.NC and AT.NZ relocaton block flags.
;1422	Add Pascal to list of supported libraries
;1423	Add offsets,switches and definitions for the program data vector.
;1424	Implement /MAXNODE.
;1425	New fork writing code under FTFRK2 for extended addressing.
;1433	Distinguish COBOL and COBOL-68 in the PROCESSORS macro.
;1442	Add /EXTEND to the SWTCHS macro.
;1450	Add PRGFRK symbolic fork handle, remove /EXTEND.
;1462	Add JOVIAL to list of known processors.
;1465	Change FORTRAN entries in PROCESSOR macro.

; Start of Version 5A
;1472	Add symbols for typecheck offsets, masks and constants.
;1500-1677	Reserved for maintenance.
;1700	Change FOROTS origin to 500000
;1750	Move LINK-10 origin up to 540000
;1754	Add long symbol definitions and handly macros.
;1774	Turn .NWBLK on by default.
;2002	Implement /PLTTYP switch.
;2005	Change arg checking parameters, add comments.
;2010	Fix value of TPMCH
;2017	Add LN.FL, Max asciz size (words) of TOPS-10 style filespec.
;2020	Change some typechecking offsets to reflect added word.
;2026	Update copyright and clean up listing for release.
;2036	Fix JOVIAL compiler type, add ADA compiler type.
;2041	Increase LN.FL so 39 character directories names will work.
;2046	Add number of typecheck blocks to return before GC.
;2053	Add offsets and size for defered character fixup block.
;2071	Remove OPDEFs of JSYSes and .GTxxx bits, definitions of PDV words
;2103	Add mask, bytepointer and constants for argchecking structure field.

;Start of Version 6
;2200	Change fixups codes to high six bits, add 30 bit address names.
;2202	Remove AP and CRTFRK argument block definitions.
;2210	Define max characters (MAXSYM) and storage (SYMSIZ) for long symbols
;2211	Add /NOJOBDAT command to not load JOBDAT into hi or lo segs.
;2212	Update polish symbols for type 1072 block.
;2214	Add 30 bit fixups.
;2220	Add Long symbol support for type in and map file.
;2223	Add R.RED and the /REDIRECT switch.
;2227	Add /PSCOMMON and the data block offsets for it.
;2237	Add constants for PDV memory map.
;2245	Add constants for PDV symbol table vector.
;2250	Remove .MMXTD - PDV space allocater is smarter now.
;2254	Add some title segment bits, remove the fail block fixup.
;2257	Add generic JSYS handling macro, define ERSTR% buffer length.
;2262	Add fields for type 1060 rel block.
;2270	Add pagable TP area, remove 18 bit address from argchecking structures.
;2271	Fix default for /ERRORLEVEL, maximum for all error switches.
;2277	Add symbols for new /DEBUG code.
;2300	Remove F40 code and conditionals, and FTFORK conditional.
;2301	Add FILSIZ, max length of TOPS-10 style filespec on TOPS-20.
;2304	Rearrange the ERNAM macro.
;2306	Make /PVDATA use special switch handler, and EXPORT keyword.
;2314	Add a constant to define where UDDT begins.
;2336	Add S.FIL flag for title blocks (TOPS-20 style file spec).
;2344	Add compiler type for C.
;2353	Add SPLFK% symbols, remove unnecessary DDT symbols and bad AC names.
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


IFN TOPS20,<

;[2353] Splice fork argument block (only parts defined are those
;[2353] used by LINK)

	.SFLEN==0	;[2353] Length of argument block
	.SFCOD==1	;[2353] Function code
	.SFUIN==2	;[2353] New inferior
	.SFUFL==3	;[2353] Flags
	.SFUA1==4	;[2353] PC Flags
	.SFUA2==5	;[2353] PC Address

	SF%ADR==1B2	;[2353] Flag to start at PC address

	SF%EXT==1B0	;[2353] SPLFK% extended function

	.SFUNS==1	;[2353] Unsplice and start function

;[2277] DDT addresses for mapping
	DDTSA==770000		;[2277] UDDT'S START ADDR.
	DDTPAG==764		;[2314] LOWER PAGE BOUND OF WHERE UDDT LIVES

> ;[2257] END IFN TOPS20
;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
 XXX	(PC,14,.IODPR)		;[2270] ARGUMENT TYPECHECKING 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)
R.RED==(1B2)		;[2223] LOADING WITH /REDIRECT (FORCED LOAD TO PSECTS)
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.CNV==(1B5)		;[1000] CONVERT NON-RADIX50 CHAR TO "%" IN OLD DDT TBL
R.TRU==(1B6)		;[1000] TRUNCATE LONG NAMES TO OLD DDT TBL

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.GLD==:1B23		;[1243] POSSIBLE LEFT HALF DEFERRED FIXUP
PS.MPO==:1B24		;[1000] MAP ONLY(/PURGE SKILLS IT FROM DDT TABLE)
PS.EXF==:1B25		;[1000] EXTENDED (30-BIT) FIXUP
PS.FWF==:1B26		;[1000] FULL WORD FIXUP

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
S.OTH==:1B5		;"OTHER" BLOCK FOR TYPECHECKING

;SECONDARY SYMBOL BITS
S.LNM==:1B6		;LONG NAME
S.COM==:1B7		;COMMON (SIZE OF IT)
S.FOR==:1B6		;IF S.OTH SET, VAL IS PTR TO CALLEE DATA
S.ACT==:1B7		;IF S.ACT SET, VAL IS PTR TO CALLER DATA
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
S.LLN==:1B11		;LAST TRIPLET OF A LONG NAME

;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.SHI==:1B14		;[2254] RELOCATION FOR HIGH SEG OR PSECTS
S.PSC==:1B13		;PSECT RELOC BLOCKS
S.PSV==:1B14		;[2220] PSECT VALUES
S.PSN==:1B15		;[2220] PSECT NAME
S.FIL==:1B16		;[2326] Title block flag for TOPS-20 file spec
SS.PS==:1B0		;[2254] HIGH SEG BREAK IS REALLY PSECT POINTER

;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)

;[2212] OTHER FIXUP FLAGS FOR POLISH TRIPLETS ONLY

FF.NEW==:1B10		;[2212] NEW STYLE (TYPE 1072) POLISH BLOCK

;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.FXE==:1B16		;[1000] EXTENDED (30-BIT) FIXUP
FS.REL==:PS.REL		;DEFINING SYMBOL WAS RELOCATABLE
;TYPE CHECKING OFFSETS, MASKS AND CONSTANTS

;BITS IN FLAG HALFWORD
TPCNT==:1B0		;[2005] 1 IF DIFFERENT NUMBER OF ARGS IS AN ERROR
TPWHO==:1B1		;[2005] 1 IF CALLER, 0 IF CALLEE
TPLOD==:1B2		;[2005] 1 IF LOAD DESCRIPTOR BLOCK INTO USER IMAGE
TPVAL==:1B3		;[2005] 1 IF LAST DESCRIPTOR IS FOR RETURNED VALUE
TPSOF==:1B4		;[2005] 1 IF COMPLAIN ABOUT SUBROUTINE/FUNCTION ERROR

;[2005] PRIMARY ARGUMENT DESCRIPTOR BITS
TPCNV==:1B0		;[2005] RESERVED
TPNUP==:1B1		;[2005] PARAMETER WILL/MUST NOT BE MODIFIED

TPPAS==:POINT 3,0,4	;[2005] PASSING MECHANISM BYTE POINTER
	TPADD==:0	;[2005] PASS BY ADDRESS
	TPDSC==:1	;[2005] PASS BY DESCRIPTOR
	TPIMM==:2	;[2005] PASS IMMEDIATE VALUE
			;[2005] (OTHERS RESERVED)

TPPASM==:7B4		;[2005] PASSING MECHANISM BITS
TPCTC==:1B5		;[2005] 1 IF COMPILE TIME CONSTANT

TPTYP==:POINT 6,0,11	;[2005] ARGUMENT TYPE CODE BYTE POINTER
	TPTNUL==:0	;[2005] DON'T CARE
	TPTLOG==:1	;[2005] FORTRAN LOGICAL
	TPTINT==:2	;[2005] INTEGER
	TPTREL==:3	;[2005] (RESERVED)
	TPTSRL==:4	;[2005] SINGLE PRECISION REAL
	TPT36B==:6	;[2005] 36 BIT STRING
	TPTALT==:7	;[2005] ALTERNATE RETURN (LABEL)
	TPTDRL==:10	;[2005] DOUBLE PRECISION REAL
	TPTDIN==:11	;[2005] DOUBLE PRECISION INTEGER
	TPT72B==:12	;[2005] DOUBLE PRECISION OCTAL
	TPTGFL==:13	;[2005] G-FLOATING REAL
	TPTCMP==:14	;[2005] COMPLEX
	TPTOBS==:15	;[2005] COBOL BYTE STRING DESCRIPTOR
			;[2005] OR FORTRAN CHARACTER
	TPTSBS==:16	;[2005] BASIC SHARED STRING DESCRIPTOR
	TPTASZ==:17	;[2005] ASCIZ STRING
	TPTASC==:20	;[2005] SEVEN BIT ASCII STRING
TPTYPM==:77B11		;[2005] ARGUMENT TYPE CODE BITS

TPSTR==:POINT 6,0,17	;[2103] ARGUMENT STRUCTURE FIELD BYTEPOINTER
TPSTRM==:77B17		;[2103] ARGUMENT STRUCTURE CODE BITS

TPIAD==:1B18		;[2005] IMPLICIT ARGUMENT DESCRIPTOR
TPRES==:377B26 		;[2005] RESERVED FOR DEC, MBZ
TPSND==:POINT 9,0,35	;[2005] NUMBER OF SECONDARY DESCRIPTORS
TPSNDM==777B35		;[2005] NUMBER OF SECONDARIES - MUST END IN LSB

;BITS IN SECONDARY DESCRIPTOR
TPMCH==:POINT 3,0,2	;[2010] FORMAL/ACTUAL LENGTH RELATIONSHIP BYTE POINTER
	TPMNUL==:0	;[2005] ALL RELATIONSHIPS ARE ALLOWED
	TPMEQL==:1	;[2005] LENGTHS MUST BE EQUAL
	TPMLSS==:2	;[2005] ACTUAL .LT. FORMAL
	TPMLEQ==:3	;[2005] ACTUAL .LE. FORMAL
	TPMGTR==:4	;[2005] ACTUAL .GT. FORMAL
	TPMGTE==:5	;[2005] ACTUAL .GE. FORMAL
			;[2005] (OTHERS RESERVED)
TPSIZ==:POINT 33,0,35	;[2005] LENGTH OF ARGUMENT

;COERSION BLOCK CODES
FCNUP==:0		;[2005] CHECK IF MODIFIED
FCPAS==:1		;[2005] CHECK PASSING MECHANISM
FCTYP==:2		;[2005] CHECK ARGUMENT TYPE CODE
FCCTC==:3		;[2005] CHECK IF COMPILE TIME CONSTANT
FCWNA==:4		;[2005] CHECK NUMBER OF ARGUMENTS
FCRTV==:5		;[2005] CHECK FOR RETURN VALUE
FCLEN==:6		;[2005] CHECK LENGTH OF ARGUMENT
FCSTR==:7		;[2103] CHECK ARGUMENT STRUCTURE CODE

CBFUNC==:POINT 18,0,17	;[2005] FORMAL ATTRIBUTE BYTE POINTER
CBCALL==:POINT 18,0,35	;[2005] ACTUAL ATTRIBUTE BYTE POINTER
;[2053] Offsets for the deferred character fixup block
TPCLK==:0		;[2053] Link to next block, must be word 0
TPCAD==:1		;[2053] Overlay Index,,User Address
TPCBK==:2		;[2053] Length of typechecking character fixup block

;OFFSETS FOR DESCRIPTOR BLOCK IN MEMORY - NOT THE SAME AS IN
;THE ACTUAL REL BLOCK
ABSIZ==:0
ABLNK==:ABSIZ+1		;[2270] LINK TO NEXT TYPECHECKING BLOCK (MUST BE ZERO)
ABMOD==:ABLNK+1		;[2270] MODULE NAME BLOCK WAS FOUND IN
ABOVH==:ABMOD+1		;[2270] # OVERHEAD WORDS (WORDS NOT IN REL BLOCK)

ABABA==:ABMOD+1		;[2270] ADDRESS OF ARG BLOCK IN USERS ADDRESS SPACE
ABCAL==:ABABA+1		;[2270] ADDRESS OF CALL IN USERS ADDRESS SPACE

ABCNT==:ABCAL+2		;[2270] LENGTH OF NAME IN BYTES
ABNAM==:ABCNT+1		;[2270] FUNCTION NAME


;[2227] Symbols for /PSCOMMON data block

PC.LNK==0		;[2227] Next common/psect block
PC.PSC==1		;[2227] Psect name
PC.CMN==2		;[2227] Common name
PC.SIZ==3		;[2227] Size of block

;[2262] Bits for fields in type 1160 block

	X60.R==1B0		;[2262] Repetion count exists in type 1060
	X60.F==1B1		;[2262] Fill character wanted in type 1060
	X60.B==1B2		;[2262] Byte count exists in type 1060
	X60.P==77B8		;[2262] Position of first byte in type 1060
	X60.SL==377B17		;[2262] Symbol length in type 1060
	X60.S==77B5		;[2262] Byte size in type 1060
;FIXUP TYPES

;CORE FIXUPS
DEFINE CFIXUPS<
X CR;;		Chained right halfword
X CL;;		Chained left halfword
X CF;;		Chained fullword
X CE;;[2214]	Chained thirty bit
X AR;;		Additive right halfword
X AL;;		Additive right halfword
X AF;;		Additive fullword
X AE;;[2214]	Additive thirty bit
X RR;;		Replace right halfword
X RL;;		Replace left halfword
X RF;;		Replace fullword
X RE;;[2214]	Replace thirty bit
>

;SYMBOL TABLE FIXUPS
DEFINE SFIXUPS<
X AR;;		;[2214] Absolute right half
X AL;;		;[2214] Absolute left half
X AF;;		;[2214] Absolute fullword
X AE;;		;[2214] Absolute thirty bit
X RR;;		;SAME AS AR BUT RELOCATABLE **DON'T MOVE**
X RL;;		; "   "  AL  "        "         "     "
X RF;;		; "   "  AF  "        "         "     "
X RE;;		; "   "  AE  "        "         "     "    [2214]
X TL
X SG
X SL;		;ADD NEW FIXUP IN SFIXUPS MACRO FOR SG, LEFT HALF
>

;DEFINE CORE FIXUP OFFSETS
DEFINE X (A)<
 CPF.'A==<%%>B5		;;[2200] Put the type in the high order bits
 %%==%%+1
>
%%==0
CFIXUPS

;DEFINE SYMBOL TABLE FIXUPS
DEFINE X (A)<
 SPF.'A==<%%>B5		;;[2200] Put the type in the high order bits
 %%==%%+1
>
%%==0
SFIXUPS
IFN FTEXE,<

;30 Bit addressing byte pointers
OPDEF ADDRES [POINT 30,0,35]	;[2200] 30 bit address byte pointer
OPDEF HIGH6 [POINT 6,0,5]	;[2200] 6 remaining bits

;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>,		;;[1225]
X F40,F40,<F40>,400000			;;[1225]
X COBOL,C68,<COBOL-68>,400000		;;[1433]
X ALGOL,ALG,<Algol>,400000		;;[1225]
X NELIAC,NLI,<NELIAC>,			;;[1225]
X PLI,PLI,<PL/I>,			;;[1225]
X BLISS,BLI,<BLISS-10>,			;;[1225]
X SAIL,SAI,<SAIL>,			;;[1225]
X FORTRAN,FOR,<FORTRAN>,500000		;;[1700]
X MACRO,MAC,<MACRO>,			;;[1225]
X FAIL,FAI,<FAIL>,			;;[1225]
X BCPL,BCP,<BCPL>,			;;[1225]
X MIDAS,MID,<MIDAS>,			;;[1225]
X SIMULA,SIM,<SIMULA>,			;;[1225]
X CBL74,C74,<COBOL-74>,400000		;;[1225]
X COBOL,CBL,<COBOL>,400000		;;[1433]
X BLS36,B36,<BLISS-36>,			;;[1225]
X BASIC,BAS,<BASIC>,			;;[1225]
X SITGO,STG,<SITGO>,			;;[1225]
X FORTRAN,XFR,<G-Floating FORTRAN>,500000	;;[1700]
X PASCAL,PAS,<PASCAL>,540000		;;[1422]
X JOVIAL,JOV,<JOVIAL>,			;;[1462]
X ADA,ADA,<ADA>				;;[2036]
X C,C,<C>				;;[2344]
>
;***NOTE***	ADD NEW ITEMS IN KEYWORDS MACRO ALSO

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

DEFINE X (A,B,C,D)<			;;[1225] ACCOUNT FOR NEW ARG
 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
  X KS,KS			;;[1236] ADD KS CPU
>

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.LM==^D10	;[1300] UPPER LIMIT
RC.INC==^D11	;[1300] SIZE OF EACH BLOCK

;[722] BIT DEFINITION FOR RC.AT

AT.RP==:1B0	;[761]  RELOCATABLE PSECT ( MUST BE BIT 0 )
AT.PS==:1B1	;[1132] PSECT SEEN (IN THIS MODULE)
AT.LE==:1B2	;[1300] PSECT LIMIT EXCEEDED FLAG
AT.NC==:1B11	;[1411] DON'T CROSS SECTION BOUNDARIES
AT.NZ==:1B12	;[1411] LOAD IN NONZERO SECTION ONLY
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

;[2220] Flags for switch block in scan block
SWT.S1==1B0			;[2220] First argument is a symbol
SWT.S2==1B1			;[2220] Second argument is a symbol
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>
>
DEFINE U2(SYMBOL,LENGTH)<		;;[1264]
 SYMBOL=.ZZ				;;[1264]
 IFB <LENGTH>,<.ZZ==.ZZ+1>		;;[1264]
 IFNB <LENGTH>,<.ZZ==.ZZ+LENGTH>	;;[1264]
 IFG .ZZ-.TEMP2-.TLEN,<PRINTX Too much TEMP2 space used> ;;[1264]
>					;;[1264]

;TO CLEAR TEMP SPACE IN EACH MODULE
DEFINE ZAPTMP <
	MOVE	T1,[.TEMP,,.TEMP+1]
	SETZM	.TEMP
	BLT	T1,.TEMP+.TLEN-1
>
DEFINE ZAPTP2 <				;;[1264]
	MOVE	T1,[.TEMP2,,.TEMP2+1]	;;[1264]
	SETZM	.TEMP2			;;[1264]
	BLT	T1,.TEMP2+.TLEN-1	;;[1264]
>					;;[1264]
;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	(TP)	;[2270] TYPECHECKING
	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 PUSH 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
	OPDEF	.XERR. [OUTSTR (T1)] ;[1301] USED AT END OF LNKXIT
> ;END IFE TOPS20


IFN TOPS20,<
	DEFINE	.OERR.(TEXT)<
	HRROI	1,TEXT;;	;[1202] SAME AS OUTSTR DEF BELOW
	PSOUT%
	>
	OPDEF .XERR. [PSOUT%]	;[1301] USED AT END OF LNKXIT

DEFINE	ERNAM(JNAME),<		;[2304]
IF1,<IFB <JNAME>,<PRINTX %Missing JSYS name in ERNAM macro call>>
IF2,<IFNDEF E$$UMF,<EXTERNAL E$$UMF>> ;[2304]
	ERCAL	[MOVX	P2,SIXBIT\JNAME\ ;[2304]
		PJRST	E$$UMF]> ;[2304]

> ;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)

;MESSAGE TYPES	[1301]
M%P==:JWW.PR		;[1301] PREFIX (CODE)
M%F==:JWW.FL		;[1301] FIRST LINE
M%C==:JWW.CN		;[1301] CONTINUATION

;SEVERITY
S%D==:0			;[2005] DEFERRED (SEVERITY DEPENDS ON
			;[2005] LOOKUP/ENTER CODE OR VALUE ON STACK)
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	SL,CPU,,CPUK,1,3;;	;[1240] PUT SWITCH OUTSIDE TOPS-20 CONDITIONAL
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,LIMIT,,.SWSYM,SYM,4,.,,.SYOSW  ;;[1300] ADD /LIMIT SWITCH
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	SP,MAXNODE,,.SWDEC,MAX,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,NOJOBDAT,,0,,3	;[2211] DON'T LOAD JOBDAT INTO HI OR LOSEG
SWMAC	SS,NOLOCAL,,0,,3,.,*
SWMAC	SP,NOREQUESTS,,.SWSYM,SYM,3,. ;;[1222] ALLOW RADIX-50
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	SL,PLTTYP,,PTPK,1,3		;;[2002] SET PLOTTER TYPE
SWMAC	SP,PSCOMMON,,.SWSYM,SYM,4,.,,.SWSYM ;[2227]
IFN TOPS20,<
SWMAC	SL,PVBLOCK,,SSGK,5,4,,,.SWSYM	;[2220]
SWMAC	SL,PVDATA,,PDVK,,4,,,.SWPDV	;[2306]
> ;[1423]
SWMAC	SP,REDIRECT,,.SWSYM,SYM,4,.,,.SWSYM ;[2223]
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,,.SWDEC,SEV,3 ;;[1223] MAKE ARGUMENT DECIMAL
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	SP,SUPPRESS,,.SWSYM,SYM,3 ;;[1307] ADD SUPPRESS SWITCH
SWMAC	SL,SYFILE,,SYMK,1,3
SWMAC	SL,SYMSEG,,SSGK,1,4,.,,.SWSYM	;[1260]
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	SP,ESTIMATE,,.SWDEC,EST,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
 >
>
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,0,L%W		;[2271]
DM	EST,<<.C+1>_-8>,0,0
DM	HAS,^D13001,^D101,^D101
DM	LOG,L%MAX,0,0		;[2271]
DM	MAX,.C,0,0		;[1424]
DM	MTP,.C,1,1
DM	PAT,.C,PATSP.,PATSP.
DM	SAV,.C,0,.NULARG
DM	SEV,S%MAX,0,S%W		;[2271]
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,KS10>	;[1236] ADD KS10
KEYMAC	DEB,<,MACRO,DDT,*FORTRAN,FORDDT,*COBOL,COBDDT,SAIL,SDDT
,FAIL,SDDT,SIMULA,SIMDDT,ALGOL,ALGDDT,*PASCAL,PASDDT> ;[2036]
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,*PASCAL
,JOVIAL,ADA,C> ;;[2344]
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	PTP,<DEFAULT,PLOTTER,PRINTER>	;[2002]
KEYMAC	PDV,<NAME,VERSION,START,MEMORY,PROGRAM,CBLOCK,EXPORT>	;[2306]
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>,<
  %%==1B35
  IRP B,<
   $'A'B==:%%
   %%==%%_1
>>>

KEYWORDS

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

KEYWORDS


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

KEYWORDS


DEFINE KEYMAC(A,B)<		;;[1230] DEFINE $SYM?? SYMBOLS
  IFIDN <A><SYM>,<
    %%==1
    IRP B,<
      IFIDN <B><RADIX50>,<
        $'A'B==:-1
      >
      IFDIF <B><RADIX50>,<
        $'A'B==:%%
        %%==%%+1
      >
    >
  >
>

KEYWORDS			;[1230] DEFINE $SYM?? SYMBOLS

DEFINE KEYMAC (A,B)<		;;[2002] DEFINE $PTPDE,
 IFIDN <A><PTP>,<		;;[2002]	$PTPPL,
  %%==1				;;[2002]	$PTPPR
  IRP B,<			;;[2002]
   $'A'B==:%%			;;[2002]
   %%==%%+1			;;[2002]
>>>				;;[2002]

KEYWORDS			;;[2002]
SUBTTL	LIBRARY SETTING BITS


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

DEFINE X (A,B,C,D)<			;;[1225] ACCOUNT FOR NEW ARG
 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 PDV AND OTHER DEFINITIONS

IFN TOPS20,<
	.SVPDV==1774		;[1423]	PDV SECTION IN .EXE FILE
	.ELEV==3		;[1423] LENGTH, ENTRY VECT SECTION OF .EXE FILE
	.ELPDV==2		;[1423] LENGTH, PDV SECTION OF .EXE FILE

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

DEFINE	OUTCHR (ACC)<
 IFN ACC-1,<
	HRRZ	1,ACC
 >
	PBOUT%
>
SUBTTL PDV SUPPORT

	PV.LEN==16		;[1423] ALLOCATED LENGTH OF PDV
	PV.SPR==2		;[1423] EXTRA STORAGE ASSOCIATED W/PDV

;[2246] REMOVE THE FOLLOWING DEFINITIONS ONCE THEY'RE IN MONSYM
	SV.LEN==7		;[2246] CURRENT SYMBOL TABLE VECTOR MAX LEN
	SV.SLN==3		;[2246] SYMBOL TABLE VECTOR SUBTABLE LENGTH
	MM.SLN==3		;[2246] MEMORY MAP SUB-TABLE LENGTH

;[2237] Memory map table indexes
	.MMLEN==0		;[2245] INDEX INTO MAP FOR TABLE LENGTH WORD
	.MMDAT==0		;[2245] INDEX INTO SUB-TABLE FOR BITS,,LENGTH
	.MMLOW==1		;[2245] LOWEST ADDR. OF BLOCK
	.MMHGH==2		;[2245] HIGHEST ADDR. OF BLOCK

	ST%TYP==77B5		;[2245] SYMBOL TABLE VECTOR TYPE FIELD
	.R50D==1		;[2245] DEFINED RADIX-50 SYMBOL TABLE TYPE
	.R50U==2		;[2245] UNDEFINED RADIX-50 SYMBOL TABLE TYPE

> ;[1423] IFN TOPS20
;[1754] THE DEFINITIONS FOLLOWING ARE ADDED FOR EXTENDED SYMBOL SUPPORT

;SYMBOL DEFINITIONS:
PL.IL==400000			;PSECT INDEX LOW VALUE
PL.IH==777777			;PSECT INDEX HIGH VALUE
PL.OL==100			;POLISH OPERATOR LOW VALUE
PL.OH==121			;POLISH OPERATOR HIGH VALUE
PL.SL==700			;POLISH STORE OPERATOR LOW VALUE
PL.SH==777			;POLISH STORE OPERATOR HIGH VALUE
	PL.SRH==777		;RELOCATABLE ADDR FIXUP
	PL.SRL==770
	PL.SAH==767		;ABSOLUTE ADDR FIXUP
	PL.SAL==760
	PL.SSH==757		;SYMBOL FIXUP
	PL.SSL==750
	PL.SNH==747		;NOT DEFINED
	PL.SNL==700

PL.ABH==0			;[2212] Absolute halfword
PL.ABF==1000			;[2212] Absolute fullword
PL.RLH==1			;[2212] Relocatable halfword
PL.RLF==1001			;[2212] Relocatable fullword
PL.SYM==10			;[2212] Symbol
PL.NEW==500000			;[2212] New-style operator
PL.NSO==510000			;[2212] New-style store operator
PL.NMX==770000			;[2212] New style operator bits

;[2212] New style store operator offsets

PL.NS=51			;[2212] Lowest number assigned to store
PL.NSH==51-4			;[2212] Halfword address store
PL.NSF==55-4			;[2212] Fullword address store
PL.NSS==61-4			;[2212] Symbol store

;BIT DEFINITIONS:
LENGTH==777000			;[2212] Length field mask
S.ADR==20			;[2212] Store operator contains address
S.REL==10			;[2212] Store operator is relocatable

	END