	.TITLE 		MACRO-15 
/
/COPYRIGHT DIGITAL EQUIPMENT CORPORATION,1971 ,MAYNARD,MASS.
/
/EDIT# 82	DATE OF LAST EDIT 9.06.71
/
	.IFDEF	RSX
%BIN=1
%DOS15=1
ECLA=641000
X10=10
/
/	DEFAULT LUN ASSIGNMENTS FOR RSX
/
	.IFUND	DAT2
DAT2=4
	.ENDC
	.IFUND	DAT3
DAT3=15
	.ENDC
	.IFUND	DAT10
DAT10=24
	.ENDC
	.IFUND	DAT11
DAT11=17
	.ENDC
	.IFUND	DAT12
DAT12=20
	.ENDC
	.IFUND	DAT13
DAT13=21
	.ENDC
	.IFUND	DAT14
DAT14=22
	.ENDC
	.ENDC
	.IFDEF %BIN		/RELOCATABLE VERSION
	.IODEV -10,-11,-12,-13,-14
	.EBREL
	.IFUND	RSX
PAGPOS=1
	.ENDC
	.ENDC
	.IFUND	RSX
.SCOM=100
%BOSS=.SCOM+52
	.ENDC
/
/IF MACRO GETS LOADED PAST 17636 OF ANY BANK PASS3 IS 'GUARANTEED' NOT TO
/WORK IN A NON-DOS-15 SYSTEM.
/
	.IFUND	RSX
.DTBLK=17637	/1ST BLOCK NO OF MACRO-15 FROM BOOTSTRAP
.DTWC=17641	/2'S COMP OF MACRO-15 WORD COUNT.
	.ENDC
	.IFDEF %BMACI
%MACI=1
%BMODE=1
	.ENDC
	.IFUND .MACRO	/THE NUMBER OF BLOCKS IN MACRO(PASS1,2 ONLY)
	.IFUND %MACI
.MACRO=32		/ASSUME A SIZE OF 32(8) BLOCKS.	
	.ENDC
	.IFDEF %MACI
.MACRO=7
	.ENDC
	.ENDC
	.IFUND CREFCA	/.LOAD ADDR-1
CREFCA=15427
	.ENDC
	.IFUND CREFWC	/SIZE OF CREF
CREFWC=2150
	.ENDC
	.IFUND CREFST	/STARTING ADDR OF CREF.
CREFST=15431
	.ENDC
	.IFUND	RSX
.DTBEG=17663	/START AT THIS ADDR IN BOOT TO LOAD PASS3.
	.ENDC
	.IFDEF PTP
P3ARGS=17667
	.ENDC
/THE WORD .MACRO (ABOVE) IS USED TO COMPUT THE FIRST BLOCK NO.
/OF PASS3.
/
	.IFUND BANK
BANK=0
	.ENDC
	.TITLE --------------------------------------------------
	.IFUND RSX
	.IFUND %KM15	/NON-DOS ADSS
	.IFUND %BF15	/BF MACRO(FULL BLOWN)
	.IFUND %BF15A	/BF MACROA
	.IFUND %PTP	/I/O MONITOR SYSTEM.
	.IFUND %MACI	/8K DECTAPE SYSTEM.
%DOS15=1		/***DEFAULT CASE***
PAGPOS=1
%DFALT=1
	.IFUND %BIN
	.ABS
	.LOC 2530
	.ENDC
	.ENDC
	.ENDC
	.ENDC
	.ENDC
	.ENDC
	.ENDC
	.IFUND %BIN
	.IFUND %DOS15
	.ABS
	.ENDC
/
/ THE FOLLOWING CONDITIONALIZATION YIELDS THE DIFFERENT VERSIONS
/OF MACRO.SINCE NO PARAMETERS RESULT IN MACRO-15,EVERYTHING
/ELSE MUST BE UNDEFINED TO YIELD THE FULL BLOWN.
/
	.IFUND %DOS15
	.IFUND %MACI
	.IFUND %BF15
	.IFUND %BF15A
	.IFUND PTP
	.IFUND %DIMAC
	.LOC 2730	/MACRO-15  FOR ADSS
PAGPOS=1	/AN EXTRA PAGE IS POSSIBLE.
%DFALT=1
	.ENDC
	.ENDC
	.ENDC
	.ENDC
	.ENDC
	.ENDC
	.EJECT
	.IFDEF %BF15
BF=1
	.LOC 3430
BFIRST=.
	.ENDC
	.IFDEF %BF15A
BF=1
	.LOC 5130	/B/F MACROA-15
%BFA=1
BFIRST=.
	.ENDC
	.IFDEF PTP
%PTP=1
	.LOC BANK*20000+3345
PAGPOS=1
	.ENDC
	.IFDEF %DIMAC
PAGPOS=1
%DOS15=1
	.LOC 2600
	.ENDC
	.IFDEF %MACI
	.LOC 4520
	.ENDC
/ ***
/
	.ENDC	/STARTED AT .IFUND %BIN.
/
/ **
GOTO=JMP
	.DEFIN .GT.
	SPA
	.ENDM
	.DEFIN IFUNA,A,B,C,D
	.IFUND %BFA
	A	B
	C	D
	.ENDC
	.ENDM
	.DEFIN .LT.
	SMA!SZA
	.ENDM
/A COMPARING MACRO.
	.DEFIN IF,A,B,C,D,E
	LAC A
	JMS TWOS
	TAD C
	B
	D E
	.ENDM
	.DEFIN IFDEA A,B,C,D
	.IFDEF %BFA
	A B
	C D
	.ENDC
	.ENDM
	.IFUND P3ARGS
/IF THE STARTING ADDRESS OF THE PASS3 ARGUMENTS CHANGES
/THE P3ARGS SYMBOL MUST BE DEFINED TO EQUAL THE NEW
/ADDRESS.
/
	.IFUND BF
P3ARGS=17610
	.ENDC
	.IFDEF BF
P3ARGS=17710
	.ENDC
	.ENDC
	.TITLE USER SYMBOL TABLE DESCRIPTION.
/
/
/ALL ENTRIES IN THE MACRO-15 SYMBOL TABLE ARE 54 BITS LONG.
/THE USER SYMBOLS ARE STORED DIRECTLY UNDER MACRO AND WORK DOWN TO LOW
/CORE.IF AN EXTRA PAGE IS AVAILABLE THE SYMBOL TABLE IS BROKEN UP INTO TWO
/SEGMENTS. THE 1ST IN THE EXTRA PAGE AND THE 2ND BELOW MACRO.IN BOTH THE 
/TABLE IS BUILT DOWNWARD. THE EXCEPTION TO THIS IS THE .LOCAL AREA
/THE SYMBOLS OF THE LOCAL AREA START JUST ABOVE THE MACRO DEFINITIONS
/AND BUILD UP TOWARD MACRO. THE ASSEMBLY TERMINATES WHEN ANY OF THE TABLES
/MEET. IF AN EXTRA PAGE IS NOT AVAILABLE THE EXTRA PAGE CODE UP TO ENDPP
/IS OVERLAID.
/E.G. LOCATIONS 4000,4001, AND 4002 CONTAIN A SYMBOL 'ZZ'.IF A NEW SYMBOL
/IS INTRODUCED 'AA' IT WOULD BE STORED IN 3775-3777.THE LOWEST
/WORD CONTAINS THE 1ST HALF OF THE SYMBOL IN RADIX 50, THE 2ND WORD THE 2ND HALF.
/  SYMBOLS ARE STORED IN ALPHABETIC SEQUENCE.
/IF A SYMBOL MUST BE INSERTED INTO THE MIDDLE THE ENTIRE TABLE IS MOVED.
/
/WORD1		BIT 0: 1=DIRECT ASSIGNMENT
/		       0=NOT A DIRECT ASSIGNMENT
/
/		BIT 1: 1=RELOCATABLE SYMBOL
/		       0=ABSOLUTE SYMBOL
/
/		BITS 2-17: SYMBOL CHARS 1-3 IN RADIX 50.
/
/
/WORD2		BITS 0-1: 00=SYMBOL UNDEFINED
/			  01=EXTERNAL SYMBOL (GLOBL)
/			  10=LOCAL SYMBOL
/			  11=INTERNAL SYMBOL (GLOBL)
/
/		BITS 2-17: SYMBOL CHARS 4-6 IN RADIX 50.
/
/
/WORD3		18 BIT VALUE IF BIT0 OF WORD1=1.
/		OTHERWISE:
/		BIT0: IF BIT 2=0, 0=NOT A VARIABLE
/				  1=VARIABLE
/
/			IF BIT 2=1, 0=MACRO NOT DEFINED IN PASS2
/			    	1=MACRO DEFINED IN PASS2
/
/		BIT 1: 0=NOT MULTIPLY DEFINED
/		       1=MULTIPLY DEFINED (ERROR)
/
/		BIT 2: 0=NOT MACRO NAME
/		       1=MACRO NAME
/
/		BITS 3-15: 15 BIT VALUE IF WORD 1, BIT 0
/			   IS 0. (NOT DIRECT ASSIGNMENT)
	.TITLE EXTRA PAGE CODE,OVERLAID IF NONE.
/
/
	.IFUND RSX
	.IFUND %MACI
	.IFUND BF
FIRST	LAC* (.SCOM+4	/BIT 11 = PAGE BANK BIT
%%MODE	DZM %%MODE	/ASSUME PAGE MODE.
	AND L100	/GET BIT 11.
	SNA		/IF 1 ITS BANK MODE.
	JMP FIRDON	/NO..PGE MODE END OF FIRST TEST.
	LAC L1
	DAC %%MODE	/SET FOR BANK MODE DEFAULT.
	LAC ID		/CHANGE IDENTIFICATION FROM
	AND (3777	/(SPACE)MACRO TO BMACRO.
	TAD (410000
	DAC ID
FIRDON=.
	.ENDC
	.ENDC
	.ENDC
/
/
	.IFUND RSX
	.IFUND %PTP
	JMP SETX
	.ENDC
	.IFDEF %PTP
	JMP INITBB
	.ENDC
	.ENDC
	.IFDEF RSX
	CAL	REDPAR	/READ PARAMETERS FROM TDV
	ISZ	BATCH	/SET THE BATCH PROCESSING SWITCH
	LAC	(PARBUF+2 /SET UP THE POINTER TO THE PARAMETER BUFFER
	DAC	UPKAD
	LAC	L1	/SET UP THE CHARACTER POINTER
	DAC	PKNUM
DELLOP	JMS	GETCHR	/UNPACK A CHARACTER
	LAC	CHRHLD	/PICK UP THE CHARACTER
	SAD	(040)	/IS IT A SPACE?
	JMP	CHRSPF	/SPACE FOUND PROCESS COMMAND
	SAD	(015)	/IS IT A CR?
	JMP	EXIT	/YES EXIT COMMAND STRING TERMINATED
	SAD	(175)	/IS IT AN ALTMODE?
	JMP	EXIT	/YES EXIT COMMAND STRING TERMINATED
	JMP	DELLOP	/NO TRY THE NEXT CHARACTER
CHRSPF	LAC	UPKAD	/PSAVE THE CHARACTER POINTERS
	DAC	UPKADS
	LAC	PKNUM	/PICK UP THE CHARACTER COUNT AND SAVE IT
	DAC	PKNUMS
	JMP	PASS1	/JUMP RIGHT IN IF RSX
	.ENDC
/
/
/MACRO-15 MAY HAVE AN EXTRA PAGE OF MEMORY FOR
/SYMBOL TABLE SPACE.  THIS MEANS THAT SYMBOL TABLE
/SPACE IS NOT CONTIGUOUS AND IN TWO SECTIONS.
/THE FOLLOWING CODE DOES MOST OF THE WORK TO HANDLE
/THE EXTRA PAGE.  IF THE EXTRA PAGE IS NOT IN,
/MEMORY IS CONTIGUOUS, SO THIS CODE IS NOT REQUIRED.
/.SCOM+3 WOULD THEN BE ADJUSTED UPWARD SO THAT
/THE WORDS UP TO 'ENDPP' ARE OVERLAYED WITH
/SYMBOLS.
	.IFUND RSX
	.IFDEF PAGPOS
PAGIN	LAC PAGTOP		/HIGHEST CORE LOCATION
	DAC PAGBOT		/LOWEST OF XTRA PAGE (SO FAR)
	DAC BEGUST		/BEGINNING (LOWEST) OF USER SYMBOLS.
	LAC SCOM20
	DAC PAGEND
	LAC* L103
	DAC USTEND
	JMP PG001
	.EJECT
/THIS CODE IS EXECUTED AFTER PASS1 BUT BEFORE PASS2 BEGINS.
/THE PROGRAM SEARCHES THROUGH THE SYMBOL TABLE AND
/PRINTS ALL UNDEFINED SYMBOLS.  IT STARTS AT THE BOTTOM
/AND WORKS UP.
/CONTROL COMES HERE AFTER A SYMBOL IS PROCESSED.  WE MUST
/DETERMINE WHETHER OR NOT TO SKIP OVER THE PROGRAM BLOCK, ETC.
/THE USTBEG POINTER IS POINTING TO THE LAST WORD OF THE SYMBOL
/JUST PROCESSED.  IF IT IS EQUAL TO THE END OF SECTION 2 POINTER
/SKIP OVER THE BLOCK.
/
PAGSYM	LAC USTBEG
	SAD USTEND		/END OF BOTTOM SECTION.
	SKP
	JMP PG0003
	LAC PAGEND		/SKIP OVER TO THE SYMBOLS IN
	DAC USTBEG		/THE EXTRA PAGE.
	JMP CVA
/FROM SUBS GIVS,CKEST
/THE SYMBOL TABLE POINTER 'USTBEG' HAS REACHED THE
/TOP OF THE BOTTOM SECTION.  ADJUST THE POINTER SO THAT IT
/IS POINTING TO THE LOWEST SYMBOL IN THE UPPER PAGE.
/
PAG005	LAC PAGEND
	DAC USTBEG
	JMP TBLOK		/TEST FOR LITERAL
/TEST FOR END OF SYMBOL TABLE
/
PAG006	SAD PAGTOP
	JMP* CKEST
	JMP TBLOK
	.EJECT
/SEARCH THE EXTRA PAGE FIRST.  IF THE SYMBOL IS FOUND, EXIT.
/IF ITS NOT FOUND COMPARE THE MERGING LOCATION PRODUCED FROM
/SEARCH WITH THE PAGE END LOCATION.  IF IT IS GREATER, THE
/SYMBOL DOESN'T EXIST IN THE SYMBOL TABLE YET, OTHERWISE;
/THE SYMBOL IS LESS THAN THE BOTTOM SYMBOL IN THE UPPER
/PAGE.  SEARCH THE LOWER SECTION IN THAT EVENT.
/
SRXPAG	LAC SRCUS1		/GET AND SET THE SRCUST INPUT ARG.
	DAC SRCUS2
	JMS SEARCH
	LAC PAGTOP		/TOP (HIGHEST AVAIL LOC. OF PAGE.
	LAC PAGBOT		/BOTTOM OF EXTRA PAGE SO FAR.
	LAC AD32		/POINTER TO CURRENT SYMBOL.
SRCUS2	XX			/400002 OR 2 (CONTROL WORD).
	JMP* SRCUST		/FOUND, EXIT
/THE SYMBOL WAS NOT FOUND.  A POINTER (MRGLOC) HAS BEEN SET
/BY 'SEARCH' FOR THE ADDRESS TO MERGE THIS SYMBOL IN.  IF
/THE MERGE LOCATION IS GREATER THAN PAGEND, THE
/SYMBOL DOESN'T EXIST.  (TABLE IN ALPHA SEQUENCE).
	LAC MRGLOC
	JMS TWOS
	TAD PAGEND
	SMA
	JMP NOEXPG		/SEARCH BOTTOM SECTION
	JMP SRCNFD		/.SYMBOL NOT FOUND, EXIT
SCOM20	0	/AFTER SET, REMAINS CONSTANT FOR ENTIRE
/A SYMBOL HAS TO BE MERGED INTO THE USER SYMBOL TABLE.  THE
/SYMBOL TABLE IS IN TWO NON-CONTIGUOUS SECTIONS.  IF THE
/MERGING LOCATION SET UP BY 'SEARCH' IS POINTING TO SOMEWHERE
/IN THE UPPER PAGE, THE BOTTOM SECTION MAY HAVE TO BE
/PUSHED DOWN IF THE UPPER PAGE IS FULL.
/BECAUSE OF THE WAY 'SRCUST' IS SET UP, PAGEND AND
/MRGLOC CAN NEVER BE EQUAL.  IF THE SYMBOL TABLE IN THE
/EXTRA PAGE BECAME FULL THE LAST TIME A SYMBOL WAS
/MERGED THE 'BEGUST' SWITCH HAS BEEN SET TO THE BOTTOM
/SECTION.
/
MGXPAG	LAC MRGLOC		/MERGING LOCATION+3
	JMS TWOS
	TAD PAGEND
	SMA
	JMP NOXMRG		/MERGE INTO BOTTOM.
	.EJECT
/THE SYMBOL MUST BE STORED IN THE TOP SECTION.  IF THE PAGE IS
/FULL MOVE THE BOTTOM SECTION DOWN THREE WORDS, AND THE
/BOTTOM THREE WORD FROM THE TOP SECTION.
	LAC PAGBOT		/IS THE PAGE FULL?
	SAD PAGEND
	SKP			/YES..DO THE ADJUSTING
	JMP PNOFUL
	JMS MOVMRG		/MOVE THE BOTTOM SECTION DOWN 3 WORDS.
	LAC USTEND		/TOP OF BOTTOM SECTION.
	LAC BEGUST		/BOTTOM OF BOTTOM SECTION.
	LAC PAGBOT		/POINTER TO THREE WORDS TO MOVE IN.
	JMS ADD3		/ADJUST POINTER(DECREMENTED LATER).
	DAC PAGBOT
PNOFUL	JMS MOVMRG		/MERGE SYMBOL INTO TOP PAGE.
	LAC MRGLOC
	LAC PAGBOT
	LAC CMPLOC
	JMS SUB3		/ADJUST PAGE BOTTOM
	DAC PAGBOT
	JMS SUB3
	DAC BEGUST
/THE SYMBOL HAS BEEN MERGED IN AND ALL POINTERS HAVE BEEN
/ADJUSTED.  IF THE PAGE JUST BECAME FULL 'BEGUST' AND 'PAGEND'
/MUST BE EQUAL.  IN THAT EVENT ADJUST BEGUST TO POINT TO THE
/TOP OF THE SECOND SECTION.  (.SCOM+3).
	SAD PAGEND
	LAC USTEND		/C(.SCOM+3)
	JMP MGOUT1
/THE DUMMY ARGUMENTS OF A MACRO DEFINITION ARE BEING
/SET UP. IF THE EXTRA PAGE IS NOT ALREADY FULL,
/SAVE THE PAGE POINTERS. IF IT IS FULL TURN THE EXTRA-
/PAGE-IN SWITCH OFF.
/
PAGDUM	LAC PAGTOP
	DAC GETBOP		/SAVE TOP OF PAGE POINTER.
	LAC PAGBOT
	DAC ERNMBR		/SAVE BOTTOM POINTER.
	SAD PAGEND		/IS PAGE FULL?
	JMP PAGDM1		/PAGE IS ALREADY FULL.
	DAC PAGTOP
	LAC* L103
	DAC USTEND
	JMP DUMBAK
PAGDM1	LAC SKPLIT
	DAC EXPAGE
	JMP DUMBAK
PAGRES	LAC GETBOP	/RESTORE PAGE POINTERS
	DAC PAGTOP
	LAC ERNMBR
	DAC PAGBOT
	JMP .ENDMA
	.EJECT
/THE MACRO DEFINITION IS BEING BUILT UPWARD TOWARD THE USER
/SYMBOL TABLE. IF THE DEFINITIONS REACH LOCATION
/USTEND (C(103)) MOVE THE DEF TO TOP OF PAGE .
/
PAKPAG	SAD USTEND
	SKP			/TERMINATE ASSEMBLY
	JMP PKPGA		/OK...STORE THE CHAR.
/MACRO DEFINITIONS HAVE REACHED THE BEGINNING
/OF THE PROGRAM. RESET THE DEFINITION LINE IN
/THE EXTRA PAGE.
	LAC SCOM20
	DAC* GETCMD		/3RD WORD OF S/T
	JMS SET10
PAGMOV	LAC* BEGDEF
	DAC* 10
	LAC BEGDEF
	SAD PK57AD
	JMP PAGMAC
	IDX BEGDEF
	IDX PAGEND
	JMP PAGMOV
PAGMAC	LAC* L10
	DAC PK57AD
	JMP PKPGA
/TEST THE LITERAL POINTER AT USTEND FOR THE END OF THIS SECTION.
/IF ITS THE END SKIP OVER MACRO
 /AND GO TO THE EXTRA PAGE LITERAL.
TSTXLT	0
	LAC* L12
	SAD USTEND
	SKP		/MAKE THE ADJUSTMENT.
	JMP* TSTXLT
	LAC PAGBOT
	DAC* L12
	JMP* TSTXLT
/THE LITERAL TABLE IS ABOUT TO DISAPPEAR. IT MAY BE IN TWO SECTIONS.
/PART1 IN THE BOTTOM AND PART2 IN THE EXTRA PAGE. ADJUST BEGUST
/TO POINT TO THE FIRST USER SYMBOL
DRPLTX	DAC TSTXLT
	IF BEGUST,.GT.,USTEND,GOTO,DRPXA
	IF TSTXLT,.LT.,USTEND,GOTO,DRPXA2
	JMS TWOS	/GET POS VALUE.
	TAD PAGBOT
	SKP
DRPXA	LAC TSTXLT
	DAC PAGBOT	/ADJUST PAGE ALSO
	JMP DROPLA
DRPXA2	LAC TSTXLT
	JMP DROPLA
	.ENDC
	.ENDC
ENDPP=.-1
	.ENDC
	.ENDC
	.TITLE	SYSTEM MACROS, TEXT, AND PERM. TABLES.
/
/
/SYSTEM MACROS SYMBOL TABLE **********
/
SMBEG	SMBEG+1
	.IFUND	RSX
	.SIXBT /.CLEAR/
	CLEAR.
	.SIXBT /.CLOSE/
	CLOSE.
	.SIXBT /.DLETE/
	DLETE.
	.SIXBT /.ENTER/
	ENTER.
	.SIXBT /.EXIT/
	EXIT.
	.SIXBT /.FSTAT/
	FSTAT.
	.IFDEF %DOS15
	.SIXBT	/.GTBUF/
	GTBUF.
	.SIXBT	/.GVBUF/
	GVBUF.
	.ENDC
	.IFDEF	BF
	.SIXBT	/.IDLE/
	IDLE.
	.SIXBT	/.IDLEC/
	IDLEC.
	.ENDC
	.SIXBT /.INIT/
	INIT.
	.SIXBT /.MTAPE/
	MTAPE.
	.IFDEF %DOS15
	.SIXBT	/.OVRLA/
	OVRLA.
	.SIXBT /.RAND/
	RAND.
	.ENDC
	.SIXBT /.READ/
	READ.
	.IFDEF	BF
	.SIXBT	/.REALR/
	REALR.
	.SIXBT	/.REALW/
	REALW.
	.ENDC
	.SIXBT /.RENAM/
	RENAM.
	.IFDEF %DOS15
	.SIXBT /.RTRAN/
	RTRAN.
	.ENDC
	.IFDEF	BF
	.SIXBT	/.RLXIT/
	RLXIT.
	.ENDC
	.SIXBT /.SEEK/
	SEEK.
	.SIXBT /.TIMER/
	TIMER.
	.SIXBT /.TRAN/
	TRAN.
	.IFDEF %DOS15
	.SIXBT	/.USER/
	USER.
	.ENDC
	.SIXBT /.WAIT/
	WAIT.
	.SIXBT /.WAITR/
	WAITR.
	.SIXBT /.WRITE/
	WRITE.
	.ENDC
SMEND	SMEND
	.IFUND	RSX
	.TITLE	SYSTEM MACRO DEFINITIONS
/
/
/SYSTEM MACROS DEFINITIONS
/
CLEAR.	.ASCII <11>/CAL /<001><000>/&777/<15><11>/5/<15><177>
/
CLOSE.	.ASCII <11>/CAL /<001><000>/&777/<15><11>/6/<15><177>
/
DLETE.	.ASCII <11>/CAL+1000 /<001><000>/&777/<15><11>/2/<15>
	.ASCII <11><001><001><15><177>
/
ENTER.	.ASCII <11><001><002>/+CAL*1000 /<001><000>
	.ASCII /&777/<15><11>/4/<15><11><001>
	.ASCII <001><15><177>
/
/
EXIT.	.ASCII <11>/CAL/<15><11>/15/<15><177>
/
FSTAT.	.ASCII <11>/CAL+3000 /<001><000>/&777/<15><11>/2/<15>
	.ASCII <11><001><001><15><177>
	.IFDEF %DOS15
GTBUF.	.ASCII <11>/CAL/<15>
	.ASCII <11>/21/<15><11>
	.ASCII /0/<15><177>
GVBUF.	.ASCII <11>/CAL/<15>
	.ASCII <11>/22/<15><11>
	.ASCII /0/<15><177>
	.ENDC
	.IFDEF	BF
/
IDLE.	.ASCII <11>/CAL/<15><11>/17/<15><177>
/
IDLEC.	.ASCII <11>/CAL+1000/<15><11>/17/<15><177>
	.ENDC
/
INIT.	.ASCII <11>/CAL+/<001><001>/*1000 /<001><000>
	.ASCII /&777/<15><11>/1/<15><11><001><002>/+0/<15><11>/0/<15><177>
/
MTAPE.	.ASCII <11>/CAL+/<001><001>/*1000 /<001><000>
	.ASCII /&777/<15><11>/7/<15><177>
	.IFDEF %DOS15
OVRLA.	.ASCII <11>/CAL/<15>
	.ASCII <11>/24/<15><11>
	.ASCII <001><000><15><177>
RAND.	.ASCII <11>/CAL+5000 /
	.ASCII <001><000>/&777/<15><11>/2/<15>
	.ASCII <11><001><001><15><11>
	.ASCII /00/<15><177>
	.ENDC
//
//
//
/
READ.	.ASCII <11>/CAL+/<001><001>/*1000 /<001><000>
	.ASCII /&777/<15><11>/10/<15><11>
	.ASCII <001><002><15><11>/.DEC/<15><11>
	.ASCII /-/<001><003><15><177>
	.IFDEF	BF
/
REALR.	.ASCII <11>/CAL+/<001><001>/*1000+10000 /<001>
	.ASCII <0>/&777/<15><11>/10/<15>
	.ASCII <11><001><002><15><11>/.DEC/<15>
	.ASCII <11>/-/<001><003><15>
	.ASCII <11>/.OCT/<15><11><001><005>/+/
	.ASCII /0*100000+/<001><004><15><177>
/
REALW.	.ASCII <11>/CAL+/<001><001>/*1000+10000 /<001>
	.ASCII <0>/&777/<15><11>/11/<15>
	.ASCII <11><001><002><15><11>/.DEC/<15>
	.ASCII <11>/-/<001><003><15>
	.ASCII <11>/.OCT/<15><11><001><005>/+/
	.ASCII /0*100000+/<001><004><15><177>
	.ENDC
RENAM.	.ASCII <11>/CAL+2000 /<001><000>/&777/<15><11>/2/<15>
	.ASCII <11><001><001><15><177>
	.IFDEF	BF
RLXIT.	.ASCII	<11>/CAL /
	.ASCII <001><000><15><11>/20/<15><177>
	.ENDC
	.IFDEF %DOS15
RTRAN.	.ASCII <11>/CAL+4000 /
	.ASCII <001><000>/&777/<15><11>/2/<15>
	.ASCII <11><001><001>/*400000/
	.ASCII /+/<001><002><15><11>
	.ASCII <001><003><15><11><001>
	.ASCII <004><15><11>/.DEC/<15><11><001>
	.ASCII <005><15><177>
	.ENDC
SEEK.	.ASCII <11>/CAL /<001><000>/&777/<15><11>/3/<15>
	.ASCII <11><001><001><15><177>
TIMER.	.ASCII <11>/CAL/<15><11>/14/<15><11>
	.ASCII <001><002>/+0*100000+/<001><001><15>
	.ASCII <11>/.DEC/
	.ASCII <15><11>/-/<001><000><15><177>
TRAN.	.ASCII <11>/CAL+/<001><001>/*1000 /<001><000>
	.ASCII /&777/<15><11>/13/<15><11>
	.ASCII <001><002><15><11><001>
	.ASCII <003><15><11>/.DEC/<15><11>/-/
	.ASCII <001><004><15><177>
//
	.IFDEF %DOS15
//
//
USER.	.ASCII <11>/CAL /<001><000>/&777/<15><11>/23/
	.ASCII <15><11>/.SIXBT '/<001><001>/'/<15><177>
	.ENDC
WAIT.	.ASCII <11>/CAL /<001><000>/&777/<15><11>/12/<15><177>
WAITR.	.ASCII <11>/CAL+1000 /<001><000>/&777/<15><11>/12/
	.ASCII <15><11><001><001><15><177>
WRITE.	.ASCII <11>/CAL+/<001><001>/*1000 /<001><000>
	.ASCII /&777/<15><11>/11/<15><11>
	.ASCII <001><002><15><11>/.DEC/<15><11>
	.ASCII /-/<001><003><15><177>
	.ENDC
	.IFUND %BFA
/END OF SYSTEM MACROS DEFINITIONS
/SPECIAL TABLE FOR MACRO PSEUDO-OPS
/
MOPBEG	MOPBEG+1
	.SIXBT '.DEFIN'
	JMP NSTDFN
	.SIXBT '.ENDM'
	JMP .ENDM
	.SIXBT '.ETC'
	JMP .ETC
MOPEND	MOPEND
	.ENDC
	.ENDC
	.TITLE TABLE OF PSEUDO-OPS AND THEIR JMPS.
/
/
/PSEUDO-OP TABLE **********
/
POPBEG	POPBEG+1
	.IFUND %BFA
	.SIXBT /.ABS/
	JMP .ABS		/PDP-15 ABSOLUTE MODE
	.SIXBT /.ABSP/
	JMP .ABSP		/PDP-9 ABSOLUTE FORMAT
	.ENDC
	.SIXBT /.ASCII/
	JMP .ASCII
	.SIXBT /.BLOCK/
	JMP .BLOCK
	.SIXBT	/.CBD/
	JMP .CBD
	.IFUND %BFA
	.SIXBT	/.DBREL/
	JMP .DBREL
	.ENDC
	.SIXBT /.DEC/
	JMP .DEC
	.IFUND %BFA
	.SIXBT /.DEFIN/
	JMP .DEFIN
	.ENDC
	.SIXBT	/.DSA/
	JMP .DSA
	.IFUND %BFA
	.SIXBT	/.EBREL/
	JMP .EBREL
	.ENDC
	.SIXBT /.EJECT/
	JMP .EJECT
	.SIXBT /.END/
	JMP .END
	.SIXBT /.ENDC/
ENDCOP	JMP .ENDC
	560517	/.EOT
	240000
	JMP .EOT
	.IFUND %BFA
	560625	/.FULL
	141400
	JMP .FULL
	.SIXBT	/.FULLP/
	JMP .FULLP	/PDP-15 FULL BINARY MODE
	.ENDC
	.ENDC
	.SIXBT	/.GLOBL
	JMP .GLOBL
IFOP	.SIXBT /.IFDEF/
	JMP .IFDEF
	.SIXBT /.IFNEG/
	JMP .IFNEG
	.SIXBT /.IFNOZ/
	JMP .IFNOZ
	.SIXBT /.IFNZR/
	JMP .IFNZR
	.SIXBT /.IFPNZ/
	JMP .IFPNZ
	.SIXBT /.IFPOZ/
	JMP .IFPOZ
	.SIXBT /.IFUND/
	JMP .IFUND
	.SIXBT /.IFZER/
	JMP .IFZER
	.SIXBT /.IODEV/
	JMP .IODEV
	.SIXBT	/.LOC/
	JMP .LOC
	.SIXBT	/.LOCAL/
	JMP .LOCAL
	.SIXBT	/.LST/	/TURN ON LIST SWITCH
	JMP .LST	/IF 'L' OPTION TYPED.
	.IFUND %MACI
	.IFUND %BFA
	.SIXBT	/.LTORG/
	JMP .LTORG
	.ENDC
	.ENDC
	.SIXBT	/.NDLOC/
	JMP .NDLOC
	.SIXBT	/.NOLST/	/TURN OFF LIST SWITCH
	JMP	.NOLST
	.SIXBT	/.OCT/
	JMP .OCT
	.IFUND %BFA
	.SIXBT	/.REPT/
	JMP .REPT
	.ENDC
	.SIXBT	/.SIXBT/
	JMP .SIXBT
	.SIXBT	/.SIZE/
	JMP .SIZE
	.SIXBT	/.TITLE/
	JMP TITLE
POPEND	POPEND
	.TITLE	BUFFERS AND SOME UTILITIES
/
/
/INITIALIZER PRINT AREA WITH SPACES
/
PRTINT	0
	LAC AD110	/CLEAR FLGWD TO RDBUF+1 (INCLUSIVE).
	JMS ZEROIT
	TOPBFP
	JMP* PRTINT
/THE LINE IMAGE LOOKS LIKE THIS (DASH=SPACE):
/SSSS-EEEEEPPPPP-T-OOOOOO-T-(3 WORD EXTENSION OR 3 SPACES).
/
/PRINT AND READIN BUFFERS (5 CHARS/2 WORDS)
/
STOPPER	0
ERRORA
ERRORB
ERRORD
ERRORE
ERRORF		/FORWARD REFERENCE.
ERRORI
ERRORL
ERRORM
ERRORN
ERRORP
ERRORQ
ERRORR
ERRORS
ERRORT
ERRORU
ERRORW
ERRORX
/BUFFERS:
PRTBUF	0;	0	/SOURCE LINE SEQUENCE #
	0;	0	/FLAGS MAXIMUM OF 5
	0;	0	/LOCATION 5 OCTAL CHARS.
	0;	0	/TAG TYPE PLUS 1ST 2 CHAR OF OBJ CODE.
	0;	0	/LAST 4 CHAR OF OBJ CODE + 1 SPACE.
			/OBJECT CODE TYPE, SPACE, 2 CHAR EXTENSION + 1 SPACE OR 3 SPACES.
/
RDBUF	201004;	020100	/HEADER WORDS ADD 6 AND MOVE TO PRTBUF.
EFLGN=STOPPER-ERRORX
CLRRD=.
TOPBFP=STOPPER-CLRRD
	.EJECT
/IF THE MULTIWORD STOPPER SWITCH COMES ON PACK A CR IN THE HEADER (RDBUF)
/AND MAKE THE PRTBUF SET TO 8 WORD PAIRS.
	.BLOCK 47
RDLST	0
/HEADER LINE IMAGE
HDRLNE	.ASCII 'PAGE '
PNMBR	0; 0		/ALLOW 2 WORDS FO PAGE NUMBER.
	.ASCII '     '	/5 SPACES AFTER PAGE # AND BEFORE TITLE.
PRNAIM	0; 0	/PROGRAM NAME
	0; 0	/PROGRAM EXTENSION
	0; 0
	IFDEA 064000	/TRUNC TOP OF THE PAGE TITLE BUFFER
	.IFUND %BFA
TEXTT	0; 0	/1-5 OF TITLE
	0; 0	/6-10
	0; 0	/11-15
	0; 0	/16-20
	0; 0	/21-25
	0; 0	/26-30
	0; 0	/31-35
	0; 0	/36-40
	0; 0	/41-45
	0; 0	/46-50
	0	/ALLOW FOR CARRIAGE RETURN
	.ENDC
HOF	060320	/FORM FEED,CARRIAGE RETURN.
/BANK BITS INITIALIZATION ROUTINE.
/WILL BE OVERLAYED
/
PRTLIN	034500;	0	/PRINT BUFFER
	.EJECT
INITBB=.
	.IFUND %MACI
	.IFUND RSX
	.IFUND %PTP	/BANK BIT INIT NOT REQ IN PAPER TAPE
	.IFUND %BIN
/SYSTEMS BECAUSE THE .LOC CAUSES THE TRANSFER VECTORS TO BE
/ASSEMBLED WITH THE BANK BITS ALREADY TURNED ON.
	LAC* L103
	AND INTOV1	/PICK UP BANK BITS
	XOR INTOV2
	DAC BNKBTS	/FROM MONITOR
	ADCT		/ADCON COUNT
	DAC CTR
	LAC INTOV3
	XOR BNKBTS
	DAC* L10	/FIRST LOC-1 OF TABLE
	DAC* L11	/OF ADCONS
LOOP	LAC* 10
	XOR BNKBTS
	DAC* 11
	ISZ CTR
	JMP LOOP
/ROUTINE TO SET BANK BITS IN LOCATIONS
/SCATTERED THROUGHOUT THE PROGRAM
/
	MODCT		/LOCATION COUNT
	DAC CTR
	LAC AD00	/MODF
	DAC TMP		/FIRST LOC. OF TABLE
LOOP1	LAC* TMP
	XOR BNKBTS	/ADD ON BANK BITS
	DAC TMP1
	LAC* TMP1
	XOR BNKBTS
	DAC* TMP1
	ISZ TMP
	ISZ CTR
	JMP LOOP1
	.ENDC
	.ENDC
/IF THERE IS AN EXTRA PAGE AVAILABLE THE EXPAGE SWITCH MUST
/BE SET TO NOP.  COMPUTE FOR THE TOP AND BOTTOM OF THE EXTRA,
/IT MUST BE AN INTEGRAL OF 3.
	.IFUND BF
	.IFUND %PDP9
	LAC* L120	/IS THERE AN EXTRA 4K AVAILABLE?
	SMA
	JMP PASS1	/NO..PROCEED WITH ASSEMBLY
	AND L47S	/LOW-ORDER 12-BITS.
	JMS TWOS	/SUBTRACT IT FROM TOP (7777).
	TAD L47S
	DAC SEARCH	/DIFFERENCE
	TAD* L120	/POINTER TO TOP.
	AND L57S
	DAC PAGTOP
	JMS DIVIDE	/GET # OF 3 WORD SYMBOLS THAT CAN FIT.
	LAC SEARCH
	LAC L3
	DAC MERGE	/
	SNA		/NO SYM WILL FIT
	JMP PASS1
	JMS MPY
	LAC L3
	JMS TWOS
	TAD PAGTOP
	DAC SCOM20
	LAC NOPLIT
	DAC EXPAGE
	.ENDC
	.ENDC
	.ENDC
	JMP PASS1	/PROCEED WITH ASSEMBLY
	.IFUND	RSX
INTOV1	60000
INTOV2	BANK*20000
INTOV3	ADF-1
	.ENDC
	.BLOCK	INITBB-.+70
	.IFUND %MACI
SRCBUF	.BLOCK 44
	.ENDC
TXTBF	.BLOCK 32	/26(10) LOCATIONS FOR TEXT
	.TITLE	SHIFTERS
/
/
/SHIFTING UTILITY ROUTINES**********
/THIS AREA OF CODE CAN BE CONDENSED, BUT ITS NOT WORTH IT.
/THESE ROUTINES ARE USED EXTENSIBLY FOR THE TIME CONSUMING
/TASK OF SHIFTING BITS TO PACK AND UNPACK CHARACTERS.
/THE ROTATE 8 ROUTINES COULD BE MADE SHORTER BY CALLING
/THE ROTATE 4 ROUTINE TWICE.  4 MIROSECONDS ARE ADDED
/EVERY TIME A SUBROUTINE IS CALLED (A JMS=2 AND AJMP*=2).
/THE ADDED MICRO-SECONDS ARE TOO EXPENSIVE
LEFT8	0
	.IFUND %MACI
	RTL; RTL; RTL; RTL
	.ENDC
	.IFDEF %MACI
	JMS LEFT4	/IF MACRO-I
	JMS LEFT4	/SPEED IS NO FACTOR.
	.ENDC
	JMP* LEFT8
	.IFUND %MACI
RIGHT8	0
	RTR; RTR; RTR; RTR
	JMP* RIGHT8
	.ENDC
LEFT6	0
	.IFUND %MACI
	RTL; RTL; RTL
	.ENDC
	.IFDEF %MACI
	JMS LEFT4
	RTL
	.ENDC
	JMP* LEFT6
RIGHT6	0
	.IFUND %MACI
	RTR; RTR; RTR
	.ENDC
	.IFDEF %MACI
	RTR
	JMS RIGHT4
	.ENDC
	JMP* RIGHT6
	.IFUND %MACI
LEFT4	0
	RTL; RTL
	JMP* LEFT4
	.ENDC
RIGHT4	0
	RTR; RTR
	JMP* RIGHT4
RIGHT3	0
	RTR; RAR
	JMP* RIGHT3
	.TITLE	PERMANENT SYMBOL TABLES.
/
/
/PERMANENT SYMBOL TABLE FOR 3 WORD SYMBOLS
/SIX BIT TRIMMED - ZERO FILLED
/MUST BE MAINTAINED IN ALPHABETIC ORDER
/
PS3BEG	PS3BEG+1
ALSS=660700
DIVS=644323
FRDIV=650323
FRDIVS=654323
IDIV=653323
IDIVS=657323
LACQ=641002
LACS=641001
LLSS=660600
LRSS=660500
MULS=657122
NORM=640444
NORMS=660444
	.SIXBT	/ALSS/
	ALSS
	.SIXBT	/CLLR/
	736000			/CLEAR LIMIT REGISTER
	.SIXBT	/DIVS/
	DIVS
	.SIXBT	/FRDIV/
	FRDIV
	.SIXBT	/FRDIVS/
	FRDIVS
	.SIXBT	/IDIV/
	IDIV
	.SIXBT	/IDIVS/
	IDIVS
	.SIXBT	/IORS/
	IORS
	.SIXBT	/LACQ/
	LACQ
	.SIXBT	/LACS/
	LACS
	.SIXBT	/LLSS/
	LLSS
	.SIXBT	/LRSS/
	LRSS
	.SIXBT	/MULS/
	MULS
	.SIXBT	/NORM/
	NORM
	.SIXBT	/NORMS/
	NORMS
	.SIXBT	/SWHA/
	742030			/SWAP HALVES OF THE AC.
PS3END	PS3END
/--------------------------------------------
/
/PERMANENT SYMBOL TABLE FOR 2 WORD SYMBOLS
/SIX BIT TRIMMED
/MUST BE MAINTAINED IN ALPHABETIC ORDER
/
PS2BEG	PS2BEG+1
	.IFUND %PDP9
	.SIXBT	/AAC/
AACI	723000			/ADD (IMMEDIATE) TO AC
	.ENDC
	.SIXBT	/ABS/
	644000
	.SIXBT	/ADD/
XREG	ADD
	.SIXBT /ALS/
	640700
	.SIXBT	/AND/
	AND
	.IFUND %PDP9
	.SIXBT	/AXR/
AXRI	737000			/ADD (IMMEDIATE) TO XR
	.SIXBT	/AXS/
AXSI	725000			/ADD (IMMEDIATE) TO XR AND SKIP IF .GF.LR
	.ENDC
	.SIXBT	/CAF/
	CAF
	.SIXBT	/CAL/
	CAL
	.SIXBT	/CCL/
	CCL
	.SIXBT	/CLA/
	CLA
	.SIXBT	/CLC/
	CLC
	.SIXBT	/CLL/
	CLL
	.SIXBT	/CLQ/
	650000
	.IFUND %PDP9
	.SIXBT	/CLX/
	735000			/CLEAR XR
	.ENDC
	.SIXBT	/CMA/
	CMA
	.SIXBT	/CML/
	CML
	.SIXBT	/CMQ/
	640004
	.SIXBT	/DAC/
	DAC
	.IFUND %PDP9
	.SIXBT	/DBA/
DBALIT	707762
	.ENDC
	.SIXBT	/DBK/
	DBK
	.SIXBT	/DBR/
	DBR
	.SIXBT	/DIV/
	640323
	.SIXBT	/DZM/
DZMLIT	DZM
	.SIXBT	/EAE/
EAELIT	EAE
	.IFUND %PDP9
	.SIXBT	/EBA/
EBALIT	707764
	.ENDC
	.SIXBT	/GLK/
	GLK
	.SIXBT	/GSM/
	664000
	.SIXBT	/HLT/
HLTLIT	HLT
	.IFUND %PDP9
	.SIXBT	/IAC/
	740030			/INCREMENT THE AC
	.ENDC
	.SIXBT	/IOF/
	IOF
	.SIXBT	/ION/
	ION
	.SIXBT	/IOT/
IOTLIT	IOT
	.IFUND %BF9A
	.SIXBT	/ISA/
	ISA
	.ENDC
	.SIXBT	/ISZ/
	ISZ
	.SIXBT	/JMP/
JMPLIT	JMP
	.SIXBT	/JMS/
JMSLIT	JMS
	.SIXBT	/LAC/
LACLIT	LAC
	.SIXBT	/LAS/
	LAS
	.SIXBT	/LAT/
	LAT
	.SIXBT	/LAW/
LAWLIT	LAW
	.SIXBT	/LLS/
	640600
	.SIXBT	/LMQ/
	652000
	.SIXBT	/LRS/
	640500
	.SIXBT	/MUL/
	653122
	.SIXBT	/NOP/
	NOP
	.SIXBT	/OAS/
	OAS
	.SIXBT	/OMQ/
	640002
	.SIXBT	/OPR/
	OPR
	.SIXBT	/OSC/
	640001
	.IFUND %PDP9
	.SIXBT	/PAL/
	722000			/PLACE AC IN LR.
	.SIXBT	/PAX/
	721000			/PLACE AC IN XR.
	.SIXBT	/PLA/
	730000			/PLACE LR IN AC.
	.SIXBT	/PLX/
	731000			/PLACE XR IN AC.
	.SIXBT	/PXA/
	724000			/PLACE XR IN AC.
	.SIXBT	/PXL/
	726000			/PLACE XR IN LR.
	.ENDC
	.SIXBT	/RAL/
	RAL
	.SIXBT	/RAR/
	RAR
	.SIXBT	/RCL/
	RCL
	.SIXBT	/RCR/
	RCR
	.IFUND %PDP9
	.SIXBT	/RES/
	707742
	.ENDC
	.SIXBT 'RPL'
	705512
	.SIXBT	/RTL/
	RTL
	.SIXBT	/RTR/
	RTR
	.SIXBT	/SAD/
	SAD
	.SIXBT	/SKP/
	SKP
	.SIXBT	/SMA/
	SMA
	.SIXBT	/SML/
	SML
	.SIXBT	/SNA/
	SNA
	.SIXBT	/SNL/
	SNL
	.SIXBT	/SPA/
	SPA
	.IFUND %BF9A
	.SIXBT	/SPI/
	SPI
	.ENDC
	.SIXBT	/SPL/
	SPL
	.SIXBT	/STL/
	STL
	.SIXBT	/SZA/
	SZA
	.SIXBT	/SZL/
	SZL
	.SIXBT	/TAD/
TADLIT	TAD
	.IFUND %PDP9
	.SIXBT	/TCA/
	740031			/2'S COMP AC
	.ENDC
	.SIXBT	/XCT/
XCTLIT	XCT
	.SIXBT	/XOR/
	XOR
	.SIXBT	/XX/
	XX
PS2END	PS2END
	.TITLE	ROUTINES TO MERGE, SEARCH, AND COMPARE
/
/
/ROUTINE TO COMPARE MAGNITUDES OF 2 LOCATIONS
/JMS TRC ARG1=LAC LOC1, ARG2=LAC LOC2
/RETURN 1 - LOC 1 < LOC 2, RET. 2 - LOC1 .GE. LOC2
/
TRC	0
	XCT* TRC
	DAC USET1	/LOC 1
	IDX TRC
	SPA
	JMP TRC1
	XCT* TRC
	SPA
	JMP TRC4	/LOC 1 < LOC 2
	JMP TRC2	/BOTH HAVE SAME SIGN
TRC1	XCT* TRC
	SMA
	JMP TRC3	/LOC  1 > LOC 2
TRC2	JMS TWOS	/BOTH LOCS HAVE SAME SIGN
	TAD USET1	/LOC 1 > OR=TO LOC 2
	SMA		/LOC 1 < LOC 2
TRC3	IDX TRC		/LOC 1 > OR= TO LOC 2
TRC4	IDX TRC		/LOC 1 < LOC 2
	JMP* TRC
/SUBROUTINE TO MOVE A TABLE UP INTO HIGH CORE.  THE TWO ARGS ARE
/THE STARTING ADDRESS (HIGH CORE) AND THE ENDING ADDRESS (LOW).
/
MOVEUP	0
	XCT* MOVEUP
	DAC MOVMRG	/TOP OF THE TABLE
	JMS TWOS	/BOT - TOP = 2'S CTR.
	DAC SEARCH
	IDX MOVEUP
	XCT* MOVEUP	/MERGIN LOCATION
	TAD SEARCH
	DAC CTR
	SNA		/ARE THEY EQUAL
	JMP* MOVEUP	/YES .. NO MOVE REQ.
LACL3L	LAC L3		/POINT TO FIRST RECEIVER LOC.
	TAD MOVMRG
	DAC SEARCH
MOVLUP	JMS SUB1
	DAC MOVMRG
	JMS SUB1
	DAC SEARCH
	LAC* MOVMRG
	DAC* SEARCH
	ISZ CTR		/FINISHED MOVING?
	JMP MOVLUP	/NO .. LOOP AGAIN.
	JMP* MOVEUP	/YES .. EXIT
	.EJECT
/SUBROUTINE TO MERGE A SYMBOL AND ITS VALUE INTO THE UST.
/IF THERE IS AN EXTRA PAGE THE SYMBOL TABLE MAY BE IN TWO
/NON-CONTIGUOUS SECTIONS.
/IF THE END OF THE MACRO DEFINITION TABLE MEETS THE
/BOTTOM OF THE SYMBOL TABLE THE ASSEMBLY TERMINATES.
/MRGLOC = 3 WORDS.GT. ITS SET PLACE.
/
MERGE	0
	LAC ENDUMT
	JMS TABORT	/TEST FOR TABLE OVERFLOW
	XCT LOCALS	/IS THIS A .LOCAL AREA?
	SKP		/(SKP=NO, NOP=YES..LOCAL ON)
	JMP PTEST
	LAC TAGSW	/IS THIS A TAG?
	SNA		/YES ... MERGE IT
	JMP PTEST
/MERGE THE SYMBOL INTO THE LOCAL TABLE.
/
	LAC TOPLUS
	JMS TABORT	/ABORT ASSEMBLY IF OVERFLOW.
	JMS MOVEUP
	LAC TOPLUS
	LAC MRGLOC
	JMS ADD3
	DAC TOPLUS
	JMS MRGSYM	/NOW MERGE INTO LOCAL TABLE
	JMP* MERGE
PTEST=.
	.IFDEF PAGPOS	/IS AN EXTRA PAGE POSSIBLE?
	XCT EXPAGE
	JMP MGXPAG
	.ENDC
/MERGE THE SYMBOL INTO THE BOTTOM SECTION
/
NOXMRG	JMS MOVMRG
	LAC MRGLOC
	LAC BEGUST
	LAC CMPLOC
	JMS SUB3	/ADJUST BEGUST
MGOUT1	DAC BEGUST
	INC USTSZE	/COUNT SYMBOLS.
	JMP* MERGE	/EXIT.
	.EJECT
/SUBROUTINE TO MOVE A BLOCK OF CORE DOWN THREE WORDS.
/THE NUMBER OF WORDS IN THE BLOCK IS COMPUTED BY
/SUBTRACTING THE HIGH ADDRESS FROM THE LOW ADDRESS.
/IF THE RESULT IS 0 NO MOVING TAKES PLACE AND AUTO
/INDEX REGISTER 11 IS SET UP TO RECEIVE THREE WORDS.
/THE LAST ARGUMENT TO THIS SUBROUTINE POINTS TO THE
/THREE WORDS TO BE MERGED IN.
/
MOVMRG	0		/MOVE-MERGE SUBROUTINE.
	XCT* MOVMRG	/HIGHEST LOCATION ON BLOCK
	JMS TWOS
	DAC SEARCH	/SAVE IT.
	IDX MOVMRG	/POINT TO LOWEST LOC OF BLOCK
	XCT* MOVMRG
	TAD SEARCH
	DAC CTR		/NEG DIFFERENCE
	XCT* MOVMRG	/LOWEST LOC OF BLOCK
	JMS SET10	/SET UP 10 AND 11
	JMS SET11	/10=BOTTOM-1,11=BOTTOM-4
	LAC CTR
	IDX MOVMRG
	SZA
	JMS MOVAUT
	XCT* MOVMRG
	JMS SET10	/GET ADDRESS OF 3 WORDS TO MOVE IN.
	LAW -3
	JMS MOVAUT
	JMP* MOVMRG
/SUBROUTINE TO TEST IF THE SYMBOL TABLE EXCEEDS CAPACITY.
/
TABORT	0
	TAD L3
	CMA
	TAD BEGUST	/BEGINNING OF SYMBOL TABLE.
	SPA
	JMP STOVA
	JMP* TABORT
/SUBROUTINE TO INSERT THE SYMBOL AT SQZOUT INTO A TABLE
/AT MRGLOC. THIS ROUTINE WOULD BE USED FOR THE 'LOCAL' SYMBOL TABLE
/AND FOR UPDATING WORDS (NOT REALLY PUTTING A NEW SYMBOL IN)
/
MRGSYM	0
	LAC SQZOUT
	DAC* MRGLOC
	IDX MRGLOC
	LAC SQZOUT+1
	DAC* MRGLOC
	IDX MRGLOC
	LAC SQZOUT+2	/VALUE
	DAC* MRGLOC
	JMP* MRGSYM
	.EJECT
/MACRO DEFINITIONS ARE STORED AT THE BOTTOM OF CORE (.SCOM+2)
/AND ARE BUILT UPWARDS TOWARD THE UST.  THE INVERSE IS TRUE
/FOR SYMBOLS, THEY ARE STORED AT THE TOP OF CORE (.SCOM+3, TOP
/XTRA CORE) AND ARE BUILT DOWNWARD TOWARD THE MACRO DEFINITIONS.
/IF THE EXTRA PAGE BECOMES FULL THE UST IS EXTENDED.
/IF MACRO-DEFS. FILL LOWER CORE IT IS EXTENDED TO THE XPAGE.
/WHEN BOTH TABLES MEET, THE ASSEMBLY TERMINATES.
SRCUST	0
	DAC SRCUS1	/STORE INPUT ARG.
	.IFDEF PAGPOS
	XCT EXPAGE
	JMP SRXPAG
	.ENDC
NOEXPG	JMS SEARCH	/SEARCH SYMBOL TABLE UNDER
	LAC USTEND	/MACRO-15.
	LAC BEGUST
	LAC AD32	/SQZOUT
SRCUS1	XX		/400002 OR 2.
	JMP* SRCUST
/THIS SYMBOL IS NOT IN THE RESIDENT USER'S SYMBOL TABLE.
/IF THE LOCAL SWITCH IS ON (NOP), SAVE THE POINTER
/THAT RESULTED FROM THE 'RUST' SEARCH AND SEARCH
/THE LOCAL USERS SYMBOL TABLE.
SRCNFD	XCT LOCALS	/SKP IF NOT IN .LOCAL AREA
	JMP SRCLOC	/.LOCAL AREA IS BUSY.
	IDX SRCUST
	JMP* SRCUST
SRCLOC	LAC MRGLOC	/SEARCH THE LOCAL TABLE
	DAC SRCUS1
	JMS SEARCH
	LAC TOPLUS	/TOP OF LOC
	LAC BOTLUS
	LAC AD32
SYMARG	400002
	JMP* SRCUST	/THE SYMBOL HAS BEEN FOUND.
/THE SYBOL IS NOT IN THE LUST.  IF THIS SYMBOL IS A TAG
/GO TO THE NORMAL "NOT FOUND" EXIT AT SRCNFD+2
/THE SYMBOL WILL LATER BE MERGED INTO THE LOCAL-UST
	LAC TAGSW	/IS THIS A TAG?
	SZA
	JMP SRCNFD+2	/YES ... MOVE IT IN TO LOCAL TABLE LATER.
/THE SYMBOL IS NOT A TAG, THEREFORE ITS A FORWARD
/REFERENCE AND MUST BE MERGED INTO THE RESIDENT UST.
	LAC SRCUS1	/RESTORE THE MERGING LOC
	DAC MRGLOC	/FROM THE 'RUST' SEARCH.
	JMP SRCNFD+2
	.TITLE SUBR TO SEARCH A TABLE.
/
/
/THE ARGUMENTS ARE AS FOLLOWS:  ENDING LOCATION OF TABLE
/(GREATEST MAGNITUDE), BEGINNING LOCATION (LOWEST MAGNITUDE),
/LOCATION OF SYMBOL TO COMPARE WITH, A CONTROL WORD WHICH TELLS
/WHETHER OR NOT THE TABLE IS 2 OR 3 WORD ENTRIES AND ALSO
/HOW MANY BITS TO COMPARE (18 OR 16 BITS).
/CALLING SEQ:
/	JMS SEARCH
/	LAC ENDLOC	/TOP OF TABLE
/	LAC BEGLOC	/BOTTOM OF TABLE (LOWEST MAGNITUDE)
/	LAC SYMLOC	/POINTER TO SYMBOL
/	CONTROL WORD	/
/	FOUND		/RETURN HERE IF SYMBOL FOUND.
/	NOT FOUND
/
SEARCH	0
	XCT* SEARCH	/ENDING LOCATION OF TABLE
	DAC HILIM
	IDX SEARCH
	XCT* SEARCH
	DAC LOLIM	/NUMBER OF SYMBOLS
	IDX SEARCH
	XCT* SEARCH	/LOCATION OF SYMBOL
	DAC CMPLOC	/TO COMPARE TABLE WITH
	IDX SEARCH
	LAC* SEARCH	/PICK UP CONTROL WORD
	SPA
	JMP .+3
	LAC NOPLIT	/CHECK ALL 18 BITS
	JMP .+2
	LAC .+4		/CHECK LO ORDER 16 BITS
	DAC MSK2
	DAC MSK2A
	LAC* SEARCH
	AND L157S
	DAC INCR
	ISZ INCR	/2 OR 3
	JMS TWOS	/TWOS COMPLEMENT
	DAC WORDCT
	IDX SEARCH	/FOUND EXIT
	LAC HILIM	/FIRST ENTRY?
	SAD LOLIM
	JMP NTFND+1	/YES..SET MRGLOO
/SPLIT TABLE LIMITS
/
SPLIT	LAC HILIM
	TAD LOLIM
	RCR		/DIVIDE BY 2
	SZL		/ADJUST BY -1
	TAD LAWM1	/IF REMAINDER PRESENT
	DAC MRGLOC	/MERGING LOCATION
	LAC WORDCT	/LENGTH 2 SYMBOL
	TAD L1
	SZA!CLA		/YES
	JMP CMPL1	/NO
	LAC HILIM
	TAD MRGLOC	/IF HIGH LIMIT AND MERGING
	AND L1		/LOCATION ARE NOT SAME WITH
	SNA!CLC		/RESPECT TO ODD/EVEN
	CLA
CMPL1	TAD MRGLOC
	DAC MRGLOC
/COMPARE ITEM VALUE AGAINST TABLE VALUE
/
	JMS SET10	/TABLE LOCATION
	LAC CMPLOC
	TAD LAWM1
	DAC* L11	/ITEM LOCATION
	LAC WORDCT
	DAC CTR1
CMPLUP	LAC* 10		/TABLE VALUE
MSK2	AND L157S	/OR NOP
	DAC TMPT	/TABLE VALUE
	LAC* 11
MSK2A	AND L157S	/OR NOP
	DAC TMPI	/ITEM VALUE
	SAD TMPT
	SKP
	JMP CKLORG	/CHECK <OR>
	ISZ CTR1	/CHECK N WORDS
	JMP CMPLUP
	JMP* SEARCH	/FOUND EXIT
CKLORG	JMS TRC		/CHECK FOR
	LAC TMPI	/< OR >
	LAC TMPT
	SKP		/<
	JMP GRTR	/>
LESS	LAC MRGLOC	/ITEM < TABLE
	SAD LOLIM	/END OF SPLITTING
	JMP NTFND+2	/YES, NOT FOUND
	DAC HILIM	/SET NEW HI LIMIT
	JMP SPLIT	/ONCE AGAIN
GRTR	LAC MRGLOC	/ITEM > TABLE
	SAD LOLIM	/END OF SPLITTING
	JMP NTFND	/YES, NOT FOUND
	TAD INCR	/2 OR 3
	SAD HILIM
	JMP NTFND+1
	DAC LOLIM	/SET NEW LOW LIMIT
	JMP SPLIT
NTFND	TAD INCR	/2 OR 3
	DAC MRGLOC
	IDX SEARCH	/NOT FOUND EXIT
	JMP* SEARCH
	.TITLE MACRO CALL AND SYMBOL TABE OVERFLOW.
/
/IMBEDDED MACRO CALL OVERFLOW
/
ERCAL	.ASCII 'CALL'
ERTAB	.ASCII 'TABLE'
ICOVA	LAC ERCAL
	DAC TORC	/CALL
	LAC ERCAL+1
	JMP STOVB-1
/SYMBOL TABLE OVERFLOW
/
STOVA	LAC ERTAB
	DAC TORC	/TABLE
	LAC ERTAB+1
	DAC TORC+1
STOVB=.
	.IFUND	RSX
	.IFUND %MACI
	CAL+2775
	11
MOD33	PRTOVA
LM35=.
PRTOVA	-35
	.ENDC
	.ENDC
	.IFDEF	RSX
	CAL	OVFLMS	/PRINT CORE OVER FLOW MESSAGE
	JMS	WAITFR	/WAIT FOR PRINTING TO FINISH
	.ENDC
	.IFDEF %MACI
	JMS TTYOUT
	TORC-2
	.ENDC
	JMP PASS1	/RETURN TO COMMAND STRING
	.IFDEF	RSX
	LM35-TORC+1/2*1000+2	/HEADER WORD FOR OVERFLOW MESSAGE
	0
	.ENDC
TORC	0;	0	/TABLE OR CALL
	.ASCII	/ OVERFLOW/<15>
	.IFDEF	RSX
LM35	-35	/LITERAL -35 DISPLACED FROM WRITE MACRO
	.ENDC
	.IFUND %BFA
	.TITLE .ABS(P) BINARY LOADERS.
/
/
	.IFUND %MACI
	.IFUND %DIMAC
/***ABSOLUTE BINARY LOADER ***
/
CLOF=700004
RRB=700112
RSB=700144
RSF=700101
LDSTRT=BANK*20000+17720
BINLDR	CAF		/CLEAR FLAGS
	CLOF		/CLOCK OFF
	IOF+10		/INTERRUPT OFF
	ISA		/TURN OFF API
LODMOD	NOP		/(EBA), (DBA), (NOP)
	707702		/PDP-9 COMPATIBILITY (EEM)
LDNXBK=BANK*20000+17726
	DZM LDCKSM	/CHECKSUMMING LOCATION
	JMS LDREAD
	DAC LDSTAD	/GET STARTING ADDRESS
	SPA		/BLOCK HEADING OR
	JMP LDXFR	/START BLOCK
	JMS LDREAD
	DAC LDWDCT	/WORD COUNT (2'S COMPLEMENT)
	JMS LDREAD
LDNXWD=BANK*20000+17736
	JMS LDREAD
	DAC* LDSTAD	/LOAD DATA INTO APPROPRIATE
	ISZ LDSTAD	/MEMORY LOCATIONS
	ISZ LDWDCT	/FINISHED LOADING
	JMP LDNXWD	/NO
	TAD LDCKSM
	SZA		/LDCKSM SHOULD CONTAIN 0
	HLT		/CHECKSUM ERROR HALT
	JMP LDNXBK	/PRESS CONTINUE TO IGNORE
LDXFR=BANK*20000+17747
	DAC LDWDCT
	ISZ LDWDCT
	JMP LDWAIT	/EXECUTE START ADDRESS
	HLT		/NO ADDRESS ON .END STATEMENT
LDREAD=BANK*20000+17753		/MANUALLY START USER PROGRAM
	0
	RSB
	TAD LDCKSM
	DAC LDCKSM
	RSF
	JMP LDREAD+4
	RRB
	JMP* LDREAD
/THE LAST FRAME OF EVERY .ABS(P) PROG IS GARBAGE.
LDWAIT=BANK*20000+17763
	JMS LDREAD	/PASS OVER LAST FRAME (PDP-9
	JMP* LDSTAD	/COMPATABILITY).
ENDLDR=.
HRMWD	003500;	0	/HEADER
	261;	277	/HRM START
	320;	0
LDCKSM=BANK*20000+17775
LDSTAD=BANK*20000+17776
LDWDCT=BANK*20000+17777
/
/*** END OF LOADER ***
	.ENDC
	.IFDEF %DIMAC
/***ABSOLUTE BINARY LOADER FOR DIAGNOSTIC PROGRAMS***
CLOF=700004
RRB=700112
RSB=700144
RSF=700101
LDSTRT=17700
KRS=700322
KRB=700312
KSF=700301
BINLDR	CAF		/CLEAR FLAGS
	CLOF		/CLOCK OFF
	IOF+10		/INTERRUPT OFF
	ISA		/TURN OFF API
LODMOD	NOP		/(EBA OR DBA) EBA IF .ABS, DBA IF .ABSP
	707702
LDNXBK=17706
	DZM LDCKSM	/CHECKSUMMING LOCATION
	JMS LDREAD
	DAC LDSTAD	/GET STARTING ADDRESS
	SPA		/BLOCK HEADING OR
	JMP LDXFR	/START BLOCK
	JMS LDREAD
	DAC LDWDCT	/WORD COUNT (2'S COMPLEMENT)
	JMS LDREAD	/ADD PROGRAM'S CHECKSUM.
LDNXWD=17716
	JMS LDREAD
	DAC* LDSTAD	/LOAD DATA INTO APPROPRIATE
	ISZ LDSTAD	/MEMORY LOCATIONS
	ISZ LDWDCT	/FINISHED LOADING
	JMP LDNXWD	/NO
	TAD LDCKSM
	SZA		/LDCKSM SHOULD CONTAIN 0
	HLT		/CHECKSUM ERROR HALT
	JMP LDNXBK	/PRESS CONTINUE TO IGNORE
LDXFR=17727
	DAC LDWDCT	/IF IT WAS -1 NO ADDRESS WAS
	ISZ LDWDCT	/SPECIFIED AFTER THE .END AT ASSEMBLY TIME.
	JMP* LDSTAD	/EXECUTE START ADDRESS
	HLT		/NO ADDRESS ON .END STATEMENT
/
/THE READ ROUTINE SELECTS BOTH THE HOGH SPEED AND
/THE LOAW SPEED PAPER TAPE READERS.THE DEVICES ARE
/MUTUALLY EXCLUSIVE,THEREFORE ONLY ONE OF THE TWO
/MAY BE ATTACHED TO THE PDP-15 AT ANY ONE TIME.
/THE SELECT TO THE UNATTACHED DEVICE WILL OPERATE 
/AS A NOP.
/
LDREAD=17733
	0
	TAD LDCKSM
	DAC LDCKSM
	LAW -3
	DAC LDCTR
	DZM LDTMP
	RSB		/HISPEED SELECT
LDRDA=17742
	KRS		/LOW SPEED SELECT
	RSF		/HIGH SPEED FLAG ON?
	SKP		/NO TRY THE LOW SPEED
	JMP HIGHIN	/YES READ AND EXIT
	KSF		/IS THE LOW FLAG ON?
	JMP LDRDA+1	/NO  TEST HIGH FLAG AGAIN
	KRB		/USE LOW SPEED
	TAD LDMSK	/IS THIS A NULL FRAME
	SPA!CLL
	JMP LDRDA	/YES  IGNORE IT
	TAD LDTMP
	ISZ LDCTR
	SKP!RTL
	JMP* LDREAD
	RTL; RTL
	DAC LDTMP
	JMP LDRDA
HIGHIN=17764
	RRB
	JMP* LDREAD
LDMSK=17766
	777600
LDCTR=17773
LDTMP=17774
LDCKSM=17775
LDSTAD=17776
LDWDCT=17777
ENDLDR=.
HRMWD	003500;	0	/HEADER
	261;	277	/HRM START
	300;	0
	.ENDC
/SUBROUTINE TO TURN THE PAGE BIT OF THE .ABS,.ABSP
/LOADER ON OR OFF.
/
	.IFUND %BF9
ABSLOD	0
	LAC AD50	/LODMOD+1
	DAC ABSADR	/START OF LOOP ADDRESS
	LODMOD+1-ENDLDR	/WORD COUNT
	DAC ABSCNT
ABSLUP	LAC* ABSADR	/GET NEXT WORD
	DAC WRDVAL
	AND IOTLIT	/(700000
	CLL		/IS IT A MEMREF?
	TAD L157S
	SZL		/YES
	JMP ABSNON	/NO..TEST FOR END
	LAC PDP9SW	/YES..TURN PAGE BIT ON OR OFF.
	JMS PAGBIT
	DAC* ABSADR
ABSNON	IDX ABSADR
	ISZ ABSCNT
	JMP ABSLUP
	JMP* ABSLOD
	.ENDC
	.ENDC
	.ENDC
	.IFUND %BFA
	.TITLE BINARY OUTPUT ROUTINES.
BLDBIN	0
	XCT PASSNO	/WHICH PASS
	JMP* BLDBIN	/EXIT ON PASS1
	LAC BNOPTN	/BINARY REQUESTED
	SNA		/YES
	JMP* BLDBIN	/NO
	LAC LOCSW	/.LOC (A SPECIAL TEST IS MADE FOR THE EXTERNAL,)
	TAD BSSW	/.BLOCK (BLOCK, LITERAL, .END, AND LOC SWITCHES. IF THEY ARE)
	TAD ENDSW	/OR .END ON (ON A NEW LOAD-ADDRESS CODE IS REQ. IF RE.)
	TAD EXLTSW	/OR EXT OR LIT
	SNA		/YES
	JMP BLDBN1	/NO
	LAC BNWDCT	/WORD COUNT 0
	SNA		/NO, OUTPUT THE INCOMPLETE BUFFER.
	JMP* BLDBIN	/YES, EXIT
BLDBN2	DAC WDCSAV	/SAVE WORD COUNT
	JMS TWOS
	DAC BNWDCT	/MAKE 2'S COMPLEMENT
	TAD BNCKSM	/ADD IT TO CHECKSUM
	JMS TWOS
	DAC BNCKSM	/2'S COMPLEMENT CHECKSUM
	.IFUND %MACI
	JMS WAIT13	/WAIT FOR PUNCH
	.ENDC
	LAC (LAC AD25
	DAC BLDBN5
	LAC BMODE	/WHAT MODE
	SAD L2		/.FULL
	JMP BLDBN4
	JMS ADD3	/UPDATE WORD COUNT BY 3
	DAC WDCSAV	/FOR .ABS
	SKP
BLDBN4	ISZ BLDBN5	/AD26 NOT AD25
	LAC WDCSAV	/WORD COUNT
	JMS TWOS
	DAC BLDBN3
	JMS MOVER
BLDBN5	XX		/LAC AD25 OT LAC AD26
	LAC AD27
	DZM BNWDCT
	.IFUND %MACI
	JMS NULFRM
	.IFUND	RSX
	CAL+4765	/WRITE DUMP MODE
	11
MOD35	PTPBUF+2
BLDBN3	0		/CONTAINS W/C IN 2'S
	.ENDC
	.IFDEF	RSX
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL	WRDMP	/WRITE DUMP MODE
	JMS	RSAUTO	/RESTORE AUTO XR'S
	.ENDC
	.IFDEF %MACI
	JMS DWRITE
	XCT PTPBUF+2
BLDBN3	XX
	.ENDC
	JMP* BLDBIN	/EXIT
BLDBN1	LAC BNWDCT	/WORD COUNT 0
	SZA		/YES
	JMP BLDBN7
	LAC PC		/PC TO
	DAC BNADDR	/ADDRESS AND
	DAC BNCKSM	/CHECKSUM
BLDBN7	LAC WRDVAL	/ADD WORD
	TAD BNCKSM	/TO CHECKSUM
	DAC BNCKSM
	LAC (DAC BNDATA
	TAD BNWDCT
	DAC .+2
	LAC WRDVAL
	XX		/STORE WORD IN
	LAC BNWDCT	/APPROPRIATE POSITION
	TAD L1
	DAC BNWDCT	/UPDATE WORD COUNT
	SAD L31		/CHECK IF FILLED UP
	JMP BLDBN2	/OUTPUT IT
	JMP* BLDBIN	/EXIT
	.IFUND %MACI
NULFRM	0
	LAC BBFSIZ
	SMA
	JMP* NULFRM
	.IFUND	RSX
	CAL+3765
	11
MOD34C	BLNKS
	-4
	.ENDC
	.IFDEF	RSX
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL	WRBLKN	/WRITE BLANKS
	JMS	RSAUTO	/RESTORE AUTO XR'S
	.ENDC
	JMP* NULFRM
BLNKS	002500;	0
	0;	0
	.ENDC
	.ENDC
	.ENDC
	.ENDC
	.TITLE 	PUNCH BUFFER, BANK BIT POINTERS.
/
/
PTPBUF	000500;	0	/PUNCH BUFFER
/THE FOLLOWING AR%LOCATIONS FOR WHICH BANK BITS
/HAVE TO BE SET. THIS TABLE CAN BE OVERLAYED WHEN THE
/PROGRAM HAS BEEN INITIALIZED.
/
MODF=.
	.IFUND RSX
	.IFUND %MACI
	.IFUND %BFA
	MOPBEG	/BEGINNING OF MACRO SYMBOLS.
	.ENDC
	PS3BEG	/BEGINNING OF 3-WORD SYMBOL TABLE.
	.ENDC
	PS2BEG	/BEGINNING OF 2-WORD PERM SYMBOL TABLE.
	SMBEG	/BEGINNING OF SYSTEM MACRO TABLE.
	POPBEG	/BEGINNING OF PSEUDO-OP TABLE.
	MOD1
	MOD1A
	.IFUND %PDP9
	MPMB02
	.ENDC
	MPMB04
	MOD3A
	MOD4
	MOD4A
	MOD5
	MOD5B
	.IFUND %BFA
	MOD27
	MOD28
	MOD31
	MOD31A
	MOPEND
	MOD34C
	MOD35
	.ENDC
	.IFDEF %BFA
	SEKFYL
	.ENDC
	MOD29
	PS3END
	PS2END
	SMEND
	POPEND
	MOD33
	MOD33B
	MOD33C
	.IFUND %BFA
	MAX.C
	.ENDC
	MOD34
	MOD34A
	MOD34B
	TCMOD
	MOD36
	MOD37
	.IFDEF %DOS15
	PAS3
	.ENDC
	MOD38
	.ENDC
MODL=.
MODCT=MODL-MODF\777777+1	/MOD COUNT
	.BLOCK	MODF-MODL+34+34
BNADDR=.-34
BNWDCT=.-33
BNCKSM=.-32
BNDATA=.-31
	.ENDC
	.TITLE 	BUILD L.L. BINARY OUTPUT
/
/BUILD LINKING LOADER BINARY OUTPUT
/
IOPHDR=BNADDR
LLCKSM=BNWDCT
LLDATA=BNCKSM
LITDLL	DAC LLDATA	/USE INSTAD OF LIT
BLDLLB	0
	XCT PASSNO
	JMP* BLDLLB
	LAC BNOPTN
	SNA
	JMP* BLDLLB
	LAC LITDLL
	TAD LLWDCT	/OUTPUT DATA WORD TO
	DAC .+2		/APPROPRIATE BUFFER POSITION
	LAC LLBWRD
LOLIM	XX
	ISZ LLWDCT	/UPDATE BUFFER POSITION
	JMS DIVIDE	/DIVIDE POSITION BY 4
	LAC LLWDCT
	LAC K4
/
/PACK CURRENT CODE INTO ACCUMULATED CODE WORD
/
	LAC DVD		/REMAINDER; 2=1ST
	SZA		/3=2ND, 0=3RD
	JMP PKCDA
	LAC LLCODE	/PICK UP CURRENT CODE
	JMP PKCDC
PKCDA	SAD L3
	JMP PKCDB
	LAC LLCODE
	RCR
	JMS RIGHT6
	JMP PKCDC
PKCDB	CLL
	LAC LLCODE
	JMS LEFT6
PKCDC	XOR LLBCDE
	DAC LLBCDE	/ACCUMULATE CODE WORD
	LAC DVD
	SNA
	JMP LLB1
	LAC LLCODE	/CHECK FOR
	SAD L27		/END OF PROGRAM CODE
	SKP
	JMP* BLDLLB	/EXIT
	ISZ LLWDCT
	LAC DVD		/ADJUST WORD COUNT
	SAD L2
	ISZ LLWDCT
LLB1	LAC LITDLL
	TAD LLWDCT	/OUTPUT CODE WORD
	TAD LAWM4	/TO APPROPRIATE POSITION
	DAC .+2
	LAC LLBCDE
HILIM	XX
	DZM LLBCDE	/CLEAR ACCUMULATED CODE WORD
	LAC LLWDCT
	SAD L30		/BUFFER FULL
	JMP LLB3	/YES
	LAC LLCODE
	SAD L27		/END
	JMP LLB3	/YES
	ISZ LLWDCT	/UPDATE WORD COUNT
	JMP* BLDLLB	/EXIT
LLB3	ISZ LLWDCT
	ISZ LLWDCT	/WORD / PAIR COUNT
	LAC LLWDCT
	JMS LEFT8	/ROTATE AC LEFT 8-BITS
	AND (77000
	XOR (500
	DAC IOPHDR
	.IFUND %MACI
	JMS WAIT13	/WAIT FOR BINARY DEVICE
	.ENDC
	LAW -32
	JMS MOVER
	LAC AD29	/IOPHDR-1
	LAC AD30	/PTPBUF-1
	LAC L1
	DAC LLWDCT	/RESET COUNT
	.IFUND %MACI
	.IFUND	RSX
	CAL+0765	/WRITE IOPS BINARY
	11
MOD36	PTPBUF
	-32
	.ENDC
	.ENDC
	.IFDEF	RSX
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL	WRD13	/WRITE IOPS BINARY
	JMS	RSAUTO	/RESTORE AUTO XR'S
	.ENDC
	.IFDEF %MACI
	JMS DWRITE
	PTPBUF
	.ENDC
	JMP* BLDLLB
/
/CHECK FOR L/L BINARY
/
CKFLLB	0
	IFUNA JMS,TMODE,JMP*,CKFLLB
	IFDEA LAC,L40
	IFUNA IDX,CKFLLB
	XCT PASSNO
	JMP* CKFLLB
	LAC LASW	/NEW LOAD ADDRESS
	SNA		/YES
	JMP LLINST
	LAC LOCSW	/LOC OR
	TAD BSSW	/BLOCK
	SZA		/NO
	JMP* CKFLLB	/EXIT
	DZM LASW
	JMS NEWLA	/GET LOAD ADDRESS
LLINST	LAC WRDVAL	/DATA WORD
	DAC LLBWRD
	LAC K4		/ABS
	DAC LLCODE
	LAC AREL
	SNA
	JMP LLINSA
	ISZ LLCODE
	LAC BITS	/-2 = 13R, 0 = 15R
	TAD LLCODE
	DAC LLCODE
LLINSA	JMS BLDLLB
	JMP* CKFLLB
/
/GET NEW LOAD ADDRESS
/
NEWLA	0
	LAC L2		/L/A CODE
	DAC LLCODE
	LAC PC		/PC IS L/A
	DAC LLBWRD
	LAC SYMTYP
	SPA
	JMP .+4
	LAC LLBWRD
	XOR XCTLIT	/SET ABSOLUTE
	DAC LLBWRD
	JMS BLDLLB	/BUILD LL-BINARY
	JMP* NEWLA
/
LL.OUT	0
	DAC LLBWRD
	XCT* LL.OUT
	DAC LLCODE
	IDX LL.OUT
	JMS BLDLLB
	JMP* LL.OUT
	.TITLE 	SYMBOL OUTPUT(FOR DDT(L.LOAD ONLY)).
/BUILD LINKING LOADER SYMBOLS
/
LLSTBL	0
	JMS SYM3	/PICK UP 3 WORDS OF SYMBOL
	LAC* LLSTBL	/0=LOCAL, 1=INTERNAL
	TAD (JMP LLSTA	/2=VIRTUAL
	DAC LLSTB
	ISZ LLSTBL
	JMS MACFST
	JMP LLSTB-2
	SKP
	JMP* LLSTBL
	LAC* SWD2	/WORD 2 OF SYMBOL
	AND JMPLIT
LLSTB	XX
LLSTA	JMP LSZMA	/LOCAL
	JMP LLSBI	/INTERNAL
	JMP LLSBV	/EXTERNAL
LSZMA	SZA!SMA
	JMP* LLSTBL	/NOT LOCAL
	JMS PUSLL	/PICK UP SYMBOL
	LAC* SWD1	/WORD1
	SMA
	JMP LLSTC
	LAC L30		/P/A CODE
	DAC LLCODE
	LAC* SWD3	/VALUE
	JMP LLSTD
LLSTC	LAC L23		/LOCAL CODE
	DAC LLCODE
LLSTE	LAC* SWD3	/PICK UP 15 BITS OF VALUE
	AND L57S
LLSTD	DAC LLBWRD
	JMS BLDLLB	/BUILD L/L BINARY
	JMP* LLSTBL
LLSBI	XOR JMPLIT
	SZA
	JMP* LLSTBL	/NOT INTERNAL
	JMS PUSLL
	LAC L12		/INTERNAL CODE
	JMP LLSTE-1
LLSBV	SAD LACLIT
	SKP
	JMP* LLSTBL	/NOT VIRTUAL
	JMS PUSLL
	LAC L11
	JMP LLSTE-1
/PICK UP SYMBOL FOR LINK LOADER
/
PUSLL	0
	LAC L7
	DAC LLCODE	/L/L CODE 1-3
	LAC XCTLIT
	DAC TMP		/1-3 OR 4-6 INDICATOR
	LAC* SWD2
	AND L157S
	DAC TMP1	/SAVE LAST 3 CHARS, IF ANY
	SNA
	DZM TMP
	LAC* SWD1
	AND L157S
	XOR TMP		/LENGTH IND
	DAC LLBWRD	/DATA WORD
	JMS BLDLLB	/BUILD L/L BINARY
	LAC TMP
	SMA		/> 3 CHARS
	JMP* PUSLL	/NO
	LAC L10		/L/L CODE 4-6
	DAC LLCODE
	LAC TMP1	/CHARS 4-6
	DAC LLBWRD
	JMS BLDLLB
	JMP* PUSLL
/SUBROUTINE TO SET RELOC TO 13/12 BITS.
LL13	0
	LAW -2
	DAC BITS
	JMP* LL13
/SUBROUTINE TO PRINT A MACRO LINE. THE PACK57 UTILITY
/ROUTINE IS USED SO THE POINTERS MUST BE SAVED BEFORE
/MORE PACKING CAN BE DONE.
/
PRTMAC	0
	JMS PUTSAV	/SAVE POINTERS AND COUNTERS.
	JMS PRTCOM	/PRINT THE LINE.
	JMS PUTRST	/RESTORE POITERS .
	JMP* PRTMAC
	.IFUND %BFA
	.TITLE MACALL---MACRO CALL ,SETUP FOR EXPANSIONS.
/
/
/AT MACALL A SYMBOL IS IN THE OPERATOR FIELD AND IS A MAXRO NAME.
/THE THIRD WORD IN THE SYMBOL TABLE FOR THIS SYMBOL IS 
/POINTING TO THE AREA IN LOW CORE WHERE THIS MACRO IS DEFINED.
/IF BIT 0 OF WORD3 IS ON THIS SYMBOL HAS BEEN SEFINED IN
/PASS2.
/THE FIRST DECISION MADE AT MACALL IS TO SEE OS THIS CALL IS
/IMBEDDED IN ANOTHER MACRO CALL.
/IS SO, AND 'MCLCTR' GOES TO -4 ITS A TERMINAL ERRER BECAUSE
/ONLY THREE LEVELS OF MACROS ARE ALLOWED.SINCE MI;ULTI
/LEVEL MACRO PROCESSING IS ALLOWED POINTERS MUST BE SVED FOR EACH
/LEVEL.THIS IS DONE EVERTIME AN INSTRUCTION IS BUILT USING 'MCLCTR'.
/*** MACRO CALL PROCESSING
/
MACALL	JMS WRD3	/POINT TO THE THIRD WORD TO GET
	LAC* MRGLOC
	.ENDC
	.ENDC
SYSCAL	DAC MACLOC	/STARTING LOC OF MACRO DEF
	JMS SUB1	/SUB1 FROM CALL LEVEL
	DAC MCLCTR	/UPDATE FOR NEXT LEVEL (SUB1 ARGUMENT)
	SAD LAWM4
	JMP ICOVA	/TOO MANY IMBEDDED CALLS
	TAD (DAC BEGRL1+1
	DAC .+3		/GET BEGINNING OF R/A
	LAC ENDUMT	/LIST FOR CALL LEVEL N
	DAC BEGRAL
	XX		/BEGRL1, BEGRL2 OR BEGRL3
	JMS P57INT
	LAC MCLCTR	/SAVE TEMP CREAT SYMBOL BUILDER.
	TAD (DAC CHVDA1+1
	DAC SAVCRE
	LAC CHVDA
SAVCRE	XX
	DZM CHVDA
	DZM RANUM	/REAL ARGUMENT NUMBER
	DZM BRKCTR	/ANGLE BRACKETS COUNTER
	JMS TSTC15
	JMP MCLE	/END OF CALL
/STORING OF REAL ARGUMENTS
/
MCLA	JMS GETCHR
	JMS CKSPTB	/CHECK FOR SPACE OR TAB
	JMP MCLA	/BYPASS INITIAL SPACES AND TABS
	SAD L15
	JMP MCLE	/NO ARGUMENTS
MCLF	LAC L1		/ARGUMENT INDICATOR
	JMS PAKRAM	/REAL ARGUMENT PACKING
	LAC RANUM	/REAL ARGUMENT NUMBER
	JMS PAKRAM
	LAC CHRHLD
	JMP TREALE	/TEST FOR REAL ARG END.
MCLJ	SAD LEFTAB	/<
	JMP MCLK
	SAD RITEAB	/>
	JMP MCLL
MCLN	LAC CHRHLD
	JMS PAKRAM	/PACK CHARACTERS INTO TABLE
	JMP MCLD
MCLK	LAC BRKCTR	/IF OUTERMOST, DO NOT PACK IT
	SNA!CLC
	JMP MCLM
	LAC CHRHLD
	JMS PAKRAM	/PACK <
	JMS SUB1	/UPDATE COUNT FOR BALANCING
MCLM	DAC BRKCTR
	JMP MCLD
MCLL	LAC BRKCTR
	SZA
	ISZ BRKCTR	/IF OUTERMOST, DO NOT PACK IT
	JMP MCLN
MCLD	JMS GETCHR	/GET NEXT CHARACTER
	JMS CKSPTB	/CHECK FOR SPACE OR TAB
	JMP MCLE	/END OF REAL ARGUMENTS
TREALE	SAD L15		/**********(SPACE-TAB)
	JMP MCLE
	SAD KOMMA	/,
	JMP MCLB	/END OF CURRENT ARGUMENT
	SAD (44		/$
	JMP MCLC	/ARGUMENT CONTINUATION
	JMP MCLJ	/PACK THE CHARACTER
MCLB	LAC BRKCTR
	SZA
	JMP MCLN
	INC RANUM	/UPDATE R/A NUMBER
	LAC L1
	JMS PAKRAM
	LAC RANUM
	JMP MCLN+1	/PACK R/A #
MCLC	JMS PRTMAC	/PRINT
	LAC MCLCTR
	TAD L1		/BYPASS READ ON IMBEDDED CALLS
	SMA
	.IFUND %MACI
	JMS DBLBUF	/GET NEXT SOURCE LINE
	.ENDC
	.IFDEF %MACI
	JMS RDSRC
	.ENDC
	JMS GETCHR
	SAD L12		/LINE FEED
	JMP MCLD
	JMP MCLD+1
MCLE	LAC BRKCTR	/CHAR ENCLOSED IN <>
	SNA		/YES
	JMP MCLP
	JMS TSTC15	/CR?
	SKP
	JMP MCLN
	JMS PAKRAM	/PACK AND GET NEXT LINE
	JMP MCLC
MCLP	JMS RSET57	/END OF ARGUMENTS INDICATOR
	LAC PACKT	/WAS THERE A TAG
	SNA		/ON THE CALL LINE?
	JMP MCLG	/NO
	ISZ MCLSW	/MACRO CALL SWITCH
	JMP PRTGPA	/MERGE SYMBOL INTO
MCLH	DZM MCLSW	/TABLE AND PRINT LINE
	JMP EXPMAC
MCLG	JMS PRTMAC	/PRINT
	.TITLE MACRO EXPANSION ROUTINE **
/
/AT EXPMAC THE REAL ARGUMENTS FOR THIS MACRO HAVE ALREADY
/BEEN STORED. NOW THE ACTUAL EXPANSIONTAKES PLACE. THE MACRO
/DEFINITION IS PROCESSED CHAR BY CHAR UNTIL SOME REAL ARG
/CODE IS ENCOUNTERED.THAT CODE CAUSE A BRANCH TO 'EXPMC' WHERE
/A SEARCH IS MADE THROUGH THE REAL ARG STRING JUST STORED 
/ABOVE AT THE 'MCLA' CODE.
/
/AS THE MACRO DEF IS BEING EXPANDED A LINE IS BEING BUILT AT
/RDBUF+2(THE NORMAL PLACE WHERE THI INPUT LINE IS PROCESSED).
/SO WE ARE UNPACKING IN 5/7 FROM THE MACRO DEF. AND PACKING
/IN 5/7 INTO RDBUF+2.WHEN FINISHE THE LINE WILL LOOK LIKE A NORMAL
/INPUT LINE TO THE REST OF MACRO-15.
/
EXPMAC	LAC MACLOC	/STARTING LOCATION OF DEFINTION
	JMS USET57	/INIT 5/7 UNPACKING
	JMS SAVRDX	/SAVE CURRENT RADIX
	SKP
/RETURN HERE AFTER ASSEMBLING A DEFINITION LINE
/
EXPMCR    JMS GETRST /RESTORE MACRO DEFINITION POSITION
/
EXPMD     LAC AD01	/RDBUF+2
	JMS P57INT
	SET EXPSW	/SET EXPANDING SWITCH
EXPMA	JMS GETCHR	/GET CHAR FROM DEFINITION
	SNA
	JMP EXPMA	/BYPASS NULL
	SAD L177	/CHECK FOR END OF DEFINITION
	JMP EXPMB
	DAC DATYPE
	TAD LAWM3	/D/A INDICATOR
	SPA
	JMP EXPMC	/YES
	JMS GETDEF	/PACK DEFINITION INTO RDBUF
	JMS TSTC15
	SKP
	JMP EXPMA	/GET NEXT MACRO CHARACTER
	JMS GETSAV	/SAVE MACRO DEFINITION POSITION
EXPMM	JMS UPBLB	/RESET TO RDBUF+2
	JMP SCNTAG	/SCAN TAG FIELD
EXPMB	LAC NOREST
	SZA
	JMP .+3		/DEFT. ENTERED IN TABLE DURING EXPANSION
	JMS GETRAL	/RESET FOR NEXT
	DAC ENDUMT	/DEFINITION OR R/A LIST
	LAC MCLCTR
	TAD LIT01
	DAC EXPMJ
	LAC MCLCTR	/UPDATE BASE FOR CREATED SYMBOLS
	TAD (DAC CSNL1+1
	DAC EXPMK
EXPMJ	XX		/CSNL1, CSNL2, CSNL3
	TAD CHVDA	/CURRENT HIGH VALUE OF D/A
	TAD L1
EXPMK	XX		/CSNL1, CSNL2, CSNL3
	LAC MCLCTR
	TAD (LAC CHVDA1+1
	DAC .+1
	XX
	DAC CHVDA
	JMS RSTRDX	/RESTORE PRE-EXPANSION RADIX
	JMP NXTLNE	/GET NEXT LINE
EXPMC	JMS GETCHR	/PICK UP D/A NUMBER
	DAC SAVDA1
	JMS TWOS
	DAC SAVDA	/SAVE D/A NUMBER
	JMS GETSAV	/SAVE MACRO DEF POSITON
	JMS GETRAL
	JMS USET57	/INIT UNPACKING
EXPMF	JMS GETCHR	/GET AN R/A CHARACTER
	SAD L177	/END OF LIST
	JMP EXPME	/YES
	SAD L1		/R/A INDICATOR
	SKP		/YES
	JMP EXPMF
	JMS GETCHR	/PICK UP R/A NUMBER
	TAD SAVDA	/COMPARE TO D/A/ NUMBER
	SZA!SMA
	JMP EXPME	/NO REAL ARGUMENT
	SZA		/EQUAL
	JMP EXPMF	/D/A > R/A - LOOK FURTHER
EXPMG     JMS GETCHR
          SAD L1
          JMP EXPME   /NO REAL ARGUMENT
          SAD L177
          JMP EXPME   /END OF R/A LIST
          JMS GETDEF	/PACK R/A CHARACTER
	ISZ RASUPL	/R/A SUPPLIED
	JMS TSTC15	/CHECK FOR A REAL ARGUMENT
	SKP
	JMP EXPMG
	LAC UPKAD
	DAC SVUPK	/SAVE 5/7 UNPACKING VALUES
	LAC PKNUM
	DAC SVPKNM
	SET RASW	/SET RETURN TO REAL ARGUMENT LIST
	JMP EXPMM	/ASSEMBLE THE LINE
/RETURN HERE TO CONTINUE GETTING INPUT FROM R/A LIST
/
RARET	LAC SVUPK
	DAC UPKAD
	LAC SVPKNM	/RESTORE UNPACKING VALUES
	DAC PKNUM
	LAC AD01	/RDBUF+2
	JMS P57INT
	DZM RASW	/RESET RETURN SWITCH
	JMP EXPMG
EXPME	LAC DATYPE	/CREATE SYMBOL
	SAD L2
	SKP		/YES
	JMP EXPMH	/NO
	LAC RASUPL	/WAS R/A SUPPLIED
	SZA		/NO - CREATE A SYMBOL
	JMP EXPMH	/YES
	LAC MCLCTR
	TAD LIT01
	DAC .+1
	XX		/PICK UP BASE
	TAD SAVDA1	/DA NUMBER
	DAC CSBVAL	/CREATE SYMBOL VALUE
	LAC CHVDA
	TAD SAVDA	/CHECK IF CURRENT D/A NUMBER
	SMA		/IS GREATER THAN CHVDA
	JMP .+3
	LAC SAVDA1
	DAC CHVDA	/NEW HIGH VALUE OF D/A
	JMS BINDEC	/BINARY TO DECIMAL
	LAC CSBVAL	/VIA CSBVAL
	LAC L56		/.
	DAC DECOUT
	DAC DECOUT+1
	LAC AD40	/DECOUT-1
	DAC* L10
	LAW -6
	DAC CTR
EXPML	LAC* 10
	SAD L40		/CHANGE SPACE TO ZERO
	LAC L60
	DAC CHRHLD
	JMS GETDEF	/PACK THE CREATED SYMBOL
	ISZ CTR
	JMP EXPML
EXPMH	JMS GETRST	/RESTORE DEFINITION POSITION
	DZM RASUPL	/R/A SUPPLIED
	JMP EXPMA
LIT01	LAC CSNL1+1
	.TITLE .DEFIN A USER MACRO.
/
/
	.IFUND %BFA
/MACRO DEFINITION PROCESSOR.
/THE .DEFIN PSEUDO-OP PACKS A MACRO DEFINITION INTO LOW CORE.
/THE DUMMY ARGUMENTS ARE STORED JUST BELOW THE USERS
/SYMBOL TABLE. THE POINTERS AND COUNTERS IN THE
/-SRCUST- AND -MERGE- SUBROUTINES ARE SAVED SO THESE
/ROUTINES CAN BE USED DURING DEFINITION TIME WITHOUT
/SCREWING UP.
/
DEFERR	SET ERRORS
.DEFIN	XCT LOCALS
	JMP OUTERR
	JMS ARGMNT	/PICK UP MACRO NAME
	JMP PRPOP	/NO NAME
	JMP DEFERR	/SYMBOLIC LOOKUP(NUMERIC NAME?!)
	CLC		/INITIALIZE THE .DEFIN COUNT. IF THIS COUNT GOES
	DAC DFNCTR	/BELOW -3 AT EXPANSION TIME ITS TERMINAL
	JMS USTLKP	/LOOK UP IN USER TABLE
	SKP		/FOUND
	JMP DFNA	/NOT FOUND
	JMS CKMAC	/IS ENTRY A MACRO
	SKP		/NO
	JMP DFNB	/YES
	LAC* TMP	/IS IT A VARIABLE
	SMA		/YES
	JMP DFNC
	JMS SUB1	/SUBTRACT 1 FROM VARIABLE COUNT
	DAC VARCTR	/ARGUMENT(SUB1)
	JMP DFNB
DFNC	JMS TSTUND	/UNDEFINED?
	SPA		/RETURN HERE IF DEFINED, IS IT LOCAL?
	JMP DFNB
	JMS SUB1	/CHANGE EXTERNAL COUNT
	DAC EXTCTR	/ARGUMENT(SUB1)
	JMP DFNB
DFNA	XCT PASSNO
	SET ERRORP	/P TO FLAG WORD
DFNJ	JMS MERGE	/MERGE MACRO NAME INTO S/T
	LAC* L11	/POINTER OF WD3 OF THIS ENTRY IN S/T.
	DAC TMP		/SET MACRO NAME BIT, AND POINTER TO DEFINITION.
	DAC GETCMD
DFNB	LAC ENDUMT	/STARTING LOCATION OF MACRO
	DAC BEGDEF	/FOR 12K SYSTEMS.
	JMS P57INT
	XOR JMSLIT	/MACRO BIT
	XCT PASSNO
	JMP TSTFFF
MACBT0	XOR XCTLIT	/SET DEFINITION ENCOUNTERED
	DAC* TMP	/IS PASS 2
	.EJECT
/THE MACRO NAME HAS BEEN STORED IN THE USERS SYMBOL TABLE.
/PREPARE THE COUNTERS AND POINTERS FOR STORING DUMMY
/ARGUMENTS.
/
	SET DFNSW	/MACRO DEFINITION SWITCH.
	LAC USTEND
	DAC TT3
	LAC USTSZE
	DAC TT1		/SAVE NUMBER OF USER SYMBOLS.
	LAC BEGUST
	DAC TT2		/BEGINNING OF USER TABLE
	DAC USTEND	/END OF USER TABLE
	.IFDEF PAGPOS
	LAC EXPAGE
	DAC LL13	/EXTRA-PAGE-IN SWITCH.
	XCT EXPAGE	/PAGE IN?
	JMP PAGDUM
	.ENDC
DUMBAK	DZM USTSZE	/DUMMY ARGUMENT COUNT.
	SKP
DFNFER	SET ERRORS
DFNF	JMS ARGMNT	/SCAN FOR D/A NAME
	JMP DFNK	/NO D/A'S
	JMP DFNFER	/SYMBOLIC NAMES
/A DUMMY ARGUMENT EXISTS AND IS LIVING IN PACKS AND PACKS+1.
/IF ITS ALREADY IN THE DUMMY ARGUMENT TABLE, IGNORE IT.
/IF NOT, MERGE IT IN.
/
	LAC USTSZE	/D/A NUMBER
	TAD CSBSW	/TURN ON BIT 0 IF CREATE
	DZM CSBSW	/SYMBOL SWITCH IS ON
	DAC SQZOUT+2
	JMS LUKDUM	/LOOK UP IN DUMMY TABLE.
	SKP		/FOUND, IGNORE IT.
	JMS MERGE	/NOT FOUND, MERGE IT IN.
DFNK	JMS PUTSAV	/SAVE 5/7 POINTERS
	JMS TKOM	/ANY MORE DUMMIES?
	JMP DFNF	/YES...CONTINUE.
/CONTROL COMES TO PKMDJ AFTER A LINE IS READ IN
/AT NXTLNE AND THE SWITCHES ARE CLEARED AT SCNTAG.
/PACK MACRO DEFINITION INTO TABLE
/
PKMCDF	JMS PUTRST
	SET NDIL	/NO DATA IN LINE IND
PKMDJ	JMS CLEARS	/VARIABLE SWITCH
	JMS GETCHR	/GET NEXT DEFINITION CHAR
	JMS LEGAL	/IS THIS A LEGAL SYMBOL CHARACTER?
	SKP		/NO..
	JMP PKMDA
	SAD L57		/SLASH
	SKP
	JMP PKMDB
	LAC NDIL	/COMMENT
	SNA		/YES
	JMP PKMDB	/NO
	LAC L15
	DAC CHRHLD	/CHANGE / TO CR
	JMP PKMDB
PKMDA	JMS SIXP	/6 CHARS PACKED? IF NO, PACK IT.
PKMDC	JMS GETCHR	/GET NEXT CHARACTER
	JMS LEGAL	/VALID SYMBOL CHAR?
	SKP		/NO
	JMP PKMDA	/YES
	JMS CHRLKP	/SPACE,TAB,;,CR
	007765		/+,-,/,*,&,!,OR\
	JMP PKMDD	/YES
	SAD EQSIGN	/=
	JMP PKMDD
	SAD KOMMA	/,
	JMP PKMDD
	SAD CONCAT
	JMP PKMDD
	SAD VARAB	/#
	SKP
	JMP PKMDD	/UNRECOGNIZABLE CHAR ,DELIMIT THE STRING.
	ISZ VARSW	/SET VARIABLE INDICATOR
	JMP PKMDC
PKMDD	JMS SEARCH	/SEARCH FOR .DEFIN,
	LAC MOPEND		/.ENDM OR .ETC
	LAC MOPBEG
	LAC AD08	/PACKS
	2
	SKP		/FOUND
	JMP PKMDG	/NOT FOUND, PACK IT 5/7
	JMS WRD3
	XCT* MRGLOC	/SWITCH TO APPROPRIATE ROUTINE
	.TITLE  .DEFIN WITHIN A .DEFIN
/
NSTDFN	JMS SUB1
	DAC DFNCTR	/ADD -1 TO COUNTER
NSTDA	JMS INTUPN
PKMDE	JMS UNPACK	/UNPACK 6-BIT CHAR
	TAD LM33	/A-Z
	SPA!CLA		/YES
	LAC L100
	XOR UPKCHR
	JMS PAKRAM	/PACK INTO MACRO DEFINITION TABLE
	ISZ CTR
	JMP PKMDE
PKMDK	LAC VARSW	/VARIABLE ENCOUNTERED
	SNA		/YES
	JMP PKMDB
	DZM VARSW
	LAC VARAB	/#
	JMS PAKRAM
PKMDB	LAC CHRHLD	/PACK CURRENT CHARACTER
	SAD CONCAT
	SKP
	JMS PAKRAM
	JMS TSTC15
	JMP PKMDH
	SAD L73		/;
	JMP PKMCDF+1
	JMS CKSPTB	/SPACE OR TAB
	JMP PKMCDF+1	/YES
	JMP PKMDJ
PKMDH	JMS PRTMAC	/PRINT
	JMP NXTLNE	/GET NEXT SOURCE LINE
/CHECK IF PACKED SYMBOL IS A DUMMY ARGUMENT
/THE PACKED SYMBOL IS NOT A PSEUDO-OP OF THE MACRO VARIETY
/IF ITS A DUMMY ARGUMENT, PACK ITS POSITION NUMBER (0,1,2
/..ETC.). IF ITS NOT, PACK THE ARGUMENT ITSELF.
/
PKMDG	JMS LUKDUM	/DUMMY?
	SKP		/YES.
	JMP NSTDA	/NO, PACK THE SYMBOL.
	JMS WRD3	/POINT TO WORD 3 TO GET THE
	LAC* MRGLOC	/DUMMY ARGUMENT NUMBER.
	SPA!CLA
	LAC L1
	TAD L1
	JMS PAKRAM
	LAC* MRGLOC
	JMS PAKRAM
	JMP PKMDK
	.IFDEF RSX
L764	-14
	.ENDC
	.EJECT
/THE ,DEFIN MAY BE IN THE F-FILE. IF IT IS AND THE ZSWICH IS OFF
/TURN ON BIT0(DEF IN PASS2 BIT) TO FAKE OUT SYMBLD AT PASS2
/EVALUATION.
/
TSTFFF	DAC SIXP	/SAVE IT TEMPORARILY.
	.IFUND %MACI
	.IFUND	RSX
	LAC DBLBUF+1	/CHECK THE .WAIT CAL.
	SAD L764	/-14 DAT SLOT?
	.ENDC
	.IFDEF	RSX
	LAC	RDSRLN	/CHECK THE AUX INPUT LUN SLOT
	SAD	(DAT14)	/IS IT THE EQUIVALENT OF DAT-14?
	.ENDC
	JMP FFFYES	/YES  GO CHECK Z-SWITCH.
	.ENDC
	.IFDEF %MACI
	LAC FSWCH
	SNA
	JMP FFFNO
	LAC SIXP
	JMP MACBT0
	.ENDC
FFFNO	LAC SIXP	/RESTORE WORD AND EXIT.
	JMP MACBT0+1
	.IFUND %MACI
FFFYES	LAC ZSWCH
	SZA
	JMP FFFNO
	LAC SIXP
	JMP MACBT0
	.ENDC
/PUT THE SYMBOL IN SQZOUT AND SQZOUT+1, THEN SEARCH
/THE DUMMY TABLE.
/
LUKDUM	0
	LAC PACKS
	DAC SQZOUT
	LAC PACKS+1
	DAC SQZOUT+1
	LAC L2		/SEARCH AND COMPARE 18 BITS.
	JMS SRCUST
	JMP* LUKDUM	/FOUND
	INC LUKDUM
	JMP* LUKDUM	/NOT FOUND.
	.TITLE .ENDM,.ETC,AND PACKERS.
/*** .ENDM ***
/
.ENDM	ISZ DFNCTR	/IS .ENDM ASSOCIATED WITH
	JMP NSTDA	/HIGHEST LEVEL - NO
	DZM DFNSW	/YES
	JMS RSET57
	LAC TT3
	DAC USTEND	/RESET TOP OF BOTTOM SECTION OF UST.
	LAC TT2
	DAC BEGUST	/RESET BOTTOM OF U/S TABLE.
	LAC TT1
	DAC USTSZE	/RESET U/S COUNT.
	.IFDEF PAGPOS
	LAC LL13
	DAC EXPAGE
	XCT EXPAGE
	JMP PAGRES
	.ENDC
.ENDMA	LAC EXPSW
	SZA
	ISZ NOREST
	JMP PRPOP
/*** .ETC ***
/
.ETC	LAC DFNCTR	/IS .ETC ASSOCIATED
	TAD L1		/WITH HIGHEST LEVEL .DEFIN
	SZA		/YES
	JMP NSTDA
	LAC ENDUMT
	JMS P57INT
	JMP DFNF	/SCAN FOR MORE D/A'S
	.ENDC
	.ENDC
/PACK THE END INDICATOR AND RESET POINTER
/
RSET57	0
	LAC L177	/END OF ARG INDICATOR.
	JMS PAKRAM
	LAC CTR57
	SZA
	IDX PK57AD
	LAC PK57AD
	DAC ENDUMT
	JMP* RSET57
	.EJECT
/REAL ARGUMENT AND MACRO
/DEFINITION PACKING ROUTINE
/
PAKRAM	0
	DAC GETDEF
	LAC PK57AD	/TEST FOR OVERFLOW
	TAD L1
	.IFDEF PAGPOS
	XCT EXPAGE
	JMP PAKPAG
	.ENDC
PKPGA	SAD BEGUST
	JMP STOVA	/TYPE OUT OVERFLOW
	LAC GETDEF
	JMS PACK57	/5/7 PACKING
	JMP* PAKRAM
/ROUTINE TO GET CHARACTERS FROM MACRO
/DEFINITION IN SYMBOL TABLE AND PACK
/INTO SOURCE INPUT AREA
/
GETDEF	0
	LAC PK57AD
	SAD AD39	/RDLST
	JMP .+4		/LINE OVERFLOW
	LAC CHRHLD
	JMS PACK57
	JMP* GETDEF
	SET ERRORW	/W TO FLAG WORD
	JMP* GETDEF
CHVDA3	0
CHVDA2	0
CHVDA1	0
BEGRL3	0		/R/A ADDRESS FOR LEVEL 3
BEGRL2	0		/R/A ADDRESS FOR LEVEL 2
BEGRL1	0		/R/A ADDRESS FOR LEVEL 1
CSNL3	0		/CREATE SYMBOL BASE -L3
CSNL2	0		/CSB -L2
CSNL1	0		/CSB -L1
SVUPK3	0		/UNPACKING SAVE -L3
SVUPK2	0		/LEVEL 2
SVUPK1	0		/LEVEL 1
SVPKN3	0
SVPKN2	0
SVPKN1	0
RDXSV3	0		/RADIX SAVE -L3
RDXSV2	0		/RADIX SAVE -L2
RDXSV1	0		/RADIX SAVE -L1
	.TITLE
/SAVE UNPACKING VALUES
/
GETSAV	0
	LAC MCLCTR
	TAD (DAC SVUPK1+1
	DAC .+2
	LAC UPKAD
WORK1	XX
	LAC MCLCTR
	TAD (DAC SVPKN1+1
	DAC .+2
	LAC PKNUM
WORK2	XX
	JMP* GETSAV
/RESTORE UNPACKING VALUES
/
GETRST	0
	LAC MCLCTR
	TAD (LAC SVUPK1+1
	DAC .+1
WORK3	XX
	DAC UPKAD
	LAC MCLCTR
	TAD (LAC SVPKN1+1
	DAC .+1
WORK4	XX
	DAC PKNUM
	JMP* GETRST
/SAVE MACRO PACKING
/
PUTSAV	0
	LAC CTR57
	DAC CT57SV
	LAC PK57AD
	DAC PK57SV
	JMP* PUTSAV
/RESTORE MACRO PACKING
/
PUTRST	0
	LAC CT57SV
	DAC CTR57
	LAC PK57SV
	DAC PK57AD
	JMP* PUTRST
/SAVE CURRENT RADIX
/
SAVRDX	0
	LAC MCLCTR
	TAD (DAC RDXSV1+1
	DAC .+2
	LAC RADIX
WDCSAV	XX
	DZM RADIX	/SET TO OCTAL
	JMP* SAVRDX
/RESTORE PRE-EXPANSION RADIX
/
RSTRDX	0
	LAC MCLCTR
	TAD (LAC RDXSV1+1
	DAC .+1
PTMVCT	XX
	DAC RADIX
	ISZ MCLCTR	/SWITCH TO NEXT LEVEL
	SKP
	DZM EXPSW	/RESET EXPANDING
	JMP* RSTRDX
/GET START OF ASSOCIATED REAL ARGUMENTS
/
GETRAL	0
	LAC MCLCTR
	TAD (LAC BEGRL1+1
	DAC .+1
USQCTR	XX
	JMP* GETRAL
	.TITLE COMMAND STRING PROCESSOR.
FILE	0		/NAME 1
	0
NAME1X	0		/NAME 1 EXTENSION
	.IFUND %MACI
	.IFUND %BFA	/NO MULTIPLE NAME PROCESSING FOR A'S
	0		/NAME 2
	0
NAME2X	0		/NAME 2 EXTENSION.
	0		/NAME 3
	0
NAME3X	0		/NAME 3 EXTENSION.
	.ENDC
	.IFUND RSX
OUTNAM	0
	0
OUTEXT	0
	.ENDC
	.ENDC
	.ENDC
	.ENDC
BNOPTN	0		/BINARY OPTION.
OSWCH	0		/OMIT 33 L.L. CODE.
TSWCH	0
ALOPTN	0		/LISTING OPTION.
ASWCH	0		/ALPHA SEQUENCE FOR OUTPUTTING SYMBOLS.
ESWCH	0	/ERROR LINES TO -12, AND -3.
CSWCH	0		/DON'T PRINT UNSATISFIED CONDITIONAL AREA.
VSWCH	0		/VALUE SEQUENCE FOR OUTPUTTING SYMBOLS.
IFEXT	0
	.IFDEF %MACI
DSWCH	0
MSWCH	0
	.ENDC
PSWCH	0		/PARAMETER ASSIGNMENT OPTION
HSWCH	0		/PRINT SYMBOLS HORIZONTALLY.
	.IFUND %BFA
	.IFUND %MACI
ISWCH	0		/IGNORE .EJECTS
ZSWCH	0	/PROCESS F FILE TWICE.
	.ENDC
	.ENDC
GSWCH	0		/DO NOT PRINT GENERATED LINES.
XSWCH	0		/NUMBER LINE AND CROSS REFERENCE DURING PASS3.
NSWCH	0		/NUMBER THE LINE SWITCH.
LSWCH	0		/LIST PARAN USED SWITCH (USED BY .LST,.NO LST)
	.TITLE
/
/THE FOLLOWING SEQUENCE OF WORDS CANNOT BE CHANGE. THEY ARE ARGUMENTS TO
/PASS3 AND ARE PASSED AT XSETUP.
/
FSWCH	0	/ON IF A FILE FROM -14 MUST BE PASSED
BATCH	0	/ASSEMBLE 'N' PROGS OR GO TO MONITOR.
USTSZE	0	/NO OF USER SYMBOLS.
USTEND	0	/TOP OF USER SYMBOL TABLE.
BEGUST	0	/BOTTOM OF USER SYMBOL TABLE.
	.IFUND %MACI
PAGTOP	0	/TOP OF UST IN EXTRA PAGE.
PAGBOT	0	/BOTTOM "   "   "     "
PAGEND	0	/POINT AT WHICH SYM MUST GO TO BOT SECTION.
	.ENDC
	.IFDEF %MACI
	DSEEK
	DREAD
	DWRITE
	.ENDC
MSZE	0	/2'S COMP OF MACRO SIZE(FROM BOOTSTRAP).
MLOAD	0	/LOAD ADDR -1 MACRO(FROM BOOTSTRAP)
FBLOCK	0	/1ST BLOCK OF PASS3(MLOAD+.MACRO)
	.IFUND %MACI
EXPAGE	SKP	/EXTRA PAGE IN SWITCH(NOP OR SKP)
	.ENDC
	.IFDEF %MACI
	TTYOUT
	.ENDC
LNSAVE	0	/MAX LINE COUNT.
PGCTR	0
EOTSW	0
	.IFDEF %MACI
	DCLOSE
DDDMCI	0		/FOR DWSCH
	DTIBUF
	TTCLOS
CONTC	CTLC		/CONTROL C ADDRESS.
	.ENDC
P3BLOK	0	/1ST BLOCK NO OF PASS3.
	.EJECT
	.IFUND %MACI
/SOME I/O ROUTINES.
/
	.IFDEF RSX
MES.3=WRTBUF
	.ENDC
	.IFUND RSX
WAIT13	0
	CAL+765		/WAIT FOR BINARIES TO STOP.
	12
	JMP* WAIT13	/EXIT
	.ENDC
	.ENDC
	.IFDEF	RSX
WAIT13	0
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL	WFEV13	/WAIT FOR EVENT VARIABLE -- ALLOWS SOME
	JMS	RSAUTO	/RESTORE AUTO XR'S
			/PROCESSING BEFORE BINARY OUTPUT IS NECESSARY
	LAC	EV13	/PICK UP EVENT VARIABLE
	SMA		/WAS THERE AN ERROR?
	JMP*	WAIT13	/NO -- RETURN I/O FINISHED
	JMS	IOERR	/YES -- I/O ERROR PRINT SUCH FACT
	LAC	(DAT13)	/I/O ERROR ON LUN - DAT13
	.ENDC
WRITE3	0
	DAC MES.3
	.IFUND %MACI
	.IFUND RSX
L2775	CAL+2775
	11
MES.3	XX
BULK14	0
	.ENDC
	.ENDC
	.IFDEF RSX
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL WRTCB
	JMS	RSAUTO	/RESTORE AUTO XR'S
	JMS WAITFR
	.ENDC
	.IFDEF %MACI
	DZM MSWCH
	JMS TTYOUT
MES.3	XX
	.ENDC
	JMP* WRITE3
/THE CODE AT PASS1P IS EXECUTED ONLY WHEN A ^P IS TYPED.
/THE TELETYPE IS CLOSED WITH A CR,LF AND THE CTLP REGISTER
/IS CHECKED TO DETERMINE WHETHER OR NOT THE ^P WAS
/EXPECTED. IF IT WAS, CONTROL STARTS AT THE LOCATION STOED
/IN CTLP. IF IT WAS UNEXPECTED THE MACRO PROGRAM IS
/RESTARTED. AFTER THE BANK BITS ARE INITIALIZED,
/CONTROL GOES TO PASS1.
/
	.IFUND %BFA
	.IFUND %MACI
.SEK11	0	/ADDRESS OF -11 NAME.
.SEK14	0	/ADDRESS OF -14 NAME.
	.ENDC
	.ENDC
PASS1P=.
	.IFUND %MACI
	.IFDEF %BFA
	LAC PSWCH /YO-YO THE INPUT DAT SLOTS
	SZA	/WAS PREV FILE FROM -10?
	DZM EOTSW	/YES CLEAR EOT SWITCH.
	SZA
	CLC
	JMS ALTER
	DZM PSWCH
	.ENDC
	.IFUND RSX
	CAL+775
	6
	.ENDC
	LAC CTLP
	SZA
	JMP* CTLP
	.TITLE IDENTIFY YOURSELF AND RESTART(START).
/
PASS1=.
	.IFUND RSX
	CAL+1775	/.INIT TTY OUTPUT
	1
MOD1	PASS1P		/RETURN TO PROCESSOR
POWA=.
CTLP	NOP
	DZM CTLP	/CONTROL P TO PASS1
	.ENDC
	.ENDC
	.IFDEF	RSX
	LAC	(DAT11)	/ATTACH INPUT DEVICE
	JMS ATACH
	LAC	(DAT10)	/DETACH DEVICES
	JMS DETHCB
	LAC	(DAT12)	
	JMS DETHCB
	LAC	(DAT13)
	JMS DETHCB
	LAC	(DAT14)
	JMS DETHCB /LUN'S 10,12,13,14 ARE NOW RELEASED
	.ENDC		/BE NEEDED SO WHY TIE THEM UP UNNECESSARILY)
CMDSTP	LAC ADFILE
	JMS ZEROIT
	.IFUND	RSX
	FILE-USTEND
	.ENDC
	.IFDEF	RSX
	FILE-NAME3X
	DZM	USTSZE	/CLEAR USER SIZE AND END
	DZM	USTEND
	LAC	PSWCHS	/PICK UP THE SAVED P SWITCH
	DAC	PSWCH	/RESTORE THE P SWITCH
	ISZ	POISW	/SET EXIT ON CR - ALTMODE SWITCH
	LAC	UPKADS	/RESET THE POINTERS TO THE COMMAND BUFFER
	DAC	UPKAD
	LAC	PKNUMS	/RESET THE CHARACTER POINTER ASLO
	DAC	PKNUM
	LAC	INITSW	/CHECK THE FIRST TIME SWITCH
	SZA		/IS IT SET?
	JMP	CMDNAM	/YES -- GO LOOK ONLY FOR A NAME
	ISZ	INITSW	/SET INIT SWITCH TO PREVENT READING SWITCHES TWICE
	.ENDC
	SET HSWCH
	.IFDEF %MACI
	JMS INITIO
	.ENDC
	.IFUND	RSX
	.IFDEF %DOS15
/
/IN BOSS-15 MODE DO NOT PRINT 'MACRO-VNN' OR (>).
/
	LAC* (%BOSS
	SPA
	JMP BOSSIN	/SKIP OVER TYPING.
/
	.ENDC
	LAC MESMAC
	JMS WRITE3	/IDENTIFY THE PROG 'MACRO '.
	LAC MESCRT
	JMS WRITE3
BOSSIN=.
	.IFDEF %MACI
	SET MSWCH
RSTRT=PASS1P
PASS1=PASS1P
OUTEXT=FILE+2
BEGIN=PASS1P
	.ENDC
	JMS UPBLB
	.ENDC
/*****COMMAND STRING PROCESSOR*****
/
	.IFUND RSX
	.IFUND %MACI
L2776	CAL+2776	/.READ KEYBOARD
	10
MOD1A	RDBUF
LM33	-33
	CAL+776
	12
	.ENDC
	.ENDC
	.IFDEF %MACI
	JMS TTYIN
	.ENDC
/
CMDA	JMS GETCHR	/GET A CHARACTER
	SAD L137	/LEFT ARROW
	JMP CMDNAM	/GET FILE NAME
/AN ALTMODE OR CR BEFORE THE _ IS ILLEGAL.
/
	SAD L15		/CR
	JMP CMDE	/ERROR
	SAD L175	/ALT MODE
	JMP CMDE	/ERROR
	SAD L101	/A?
	SET ASWCH
	SAD L102	/B
	SET BNOPTN
	SAD L105	/E-SWITCH(ERRORS PRINTED ON -3).
	SET ESWCH	/USEFUL WHERE -12 IS MASS STORAGE.
	.IFDEF %MACI
	SAD L104	/D?
	SKP
	JMP .+3
	SET DSWCH
	JMP CSPL+1
	SAD L125	/U?
	SET DTSAMS
	.ENDC
	.IFDEF	RSX
	SAD	L122	/R? IDENTIFY MACRO VERSION
	SET	VERPNT
	.ENDC
	SAD L103	/C?
	SKP
	JMP CSPG
	SET CSWCH
	JMP CSPL+1
CSPG	SAD L107	/G?
	SKP
	JMP CSPN
	SET GSWCH
	JMP CSPL+1
CSPN	SAD L116
	JMP CSPNST
	SAD L117	/0 ??
	SET OSWCH	/TURN ON OMIT SWITCH.
	SAD L124	/TABLE OF CONTENTS(T?)
	SET TSWCH
	.IFUND %BFA
	SAD L106
	SET FSWCH	/F?
	.IFUND %MACI
	SAD L111	/I?
	SET ISWCH
	.ENDC
	.ENDC
	SAD L110	/H?
	DZM HSWCH
	SAD L120	/P?
	SET PSWCH
	.IFDEF	RSX
	SAD	L120	/P?
	SET	PSWCHS	/SET P SWITCH SAVE ALSO
	.ENDC
	.IFUND %BFA
	.IFUND %MACI
	SAD L132	/Z?
	SET ZSWCH
	.ENDC
	.ENDC
	SAD L123	/S?
	SKP
	JMP .+3
	SET ASWCH
	SET VSWCH
	SAD L126	/V?
	SET VSWCH
	SAD L130	/X?
	SET XSWCH
CSPL	SAD L114	/oL?
	SET ALOPTN
	JMP CMDA	/IGNORE ANYTHING ELSE
SRCEXT	.SIXBT 'SRC'
BINEXT	.SIXBT 'BIN'
LSTEXT	.SIXBT 'LST'
CSPNST	SET NSWCH
	JMP CSPL+1
	.EJECT
/THE TEXT TYPED AFTER THE LEFT ARROW REPRESENTS THE PROGRAM NAME,
/OR NAMES. THREE NAMES ARE ACCEPTED,ANYTHING AFTER IT IS IGNORED.
/AFTER THE LEFT ARROW ARE IGNORED. ALL SUBSEQUENT SPACES ARE CRUCIAL
/LEADING SPACES ARE IGNORED BEFORE EACH NAME. A NAME IS DELIMITED BY A
/COMMA ONLY. A SPACE DELIMITS THE PROPER NAME AND CAUSES SET-UP FOR THE
/EXTENSION. A SECOND SPACE BEFORE A COMMA DELIMITS THE ENTIRE COMMAND STRING.
/
CMDNAM=.
/
	.IFDEF	RSX
	LAC	VERPNT	/IS THE TITLE WANTED (MACRORSX)?
	SNA
	JMP	NOTIT	/NO DON'T PRINT IT
	LAC	MESMAC	/YES PRINT ON TTY
	JMS	WRITE3
NOTIT=.
	.ENDC
/
/IF X AND L ARE USED FORCE 'N'.
/
	LAC XSWCH
	DZM SAVEF
	SNA
	JMP .+4
	LAC ALOPTN
	SZA
	SET NSWCH
	.IFDEF	RSX
	DZM	POISW	/SET NO EXIT ON CR - ALTMODE SWITCH
	LAC	TSWCH	/CHECK THE TSWITCH TO SEE IF ATTACH IS NECESSARY
	SNA
	JMP	.+3	/NO DON'T ATTACH
	LAC	(DAT12)	/YES -- ATTACH OUTPUT LISTING DEVICE
	JMS	ATACH
	.ENDC
	.IFUND %BFA
	.IFUND %MACI
	.IFUND	RSX
	LAW -3
	DAC FLDSW
	.ENDC
	.ENDC
	.ENDC
	.IFDEF	RSX
	DZM	FLDSW	/CLEAR THE FILES COUNT
	LAC	PSWCH	/PARAMETER FILES?
	SNA
	JMP	NPSW	/NO DON'T COUNT IT
	LAC	(DAT10)	/DO A HINF ON THIS LUN TO SEE IF IT IS FILE
	JMS	HINFRQ	/STRUCTURED
	SZA		/0=NON FILSTRUCTURED
	ISZ	FLDSW	/FILE STRUCTURED COUNT A FILE
NPSW	LAC	FSWCH	/AUX INPUT?
	SNA
	JMP	NFSW	/NO DON'T COUNT IT
	LAC	(DAT14)
	JMS	HINFRQ	/DO HINF TO SEE IF FILE STRUCTURED
	SZA		/0 = NON FILE STRUCTURED
	ISZ	FLDSW
NFSW	LAC	FLDSW	/RESET THE FILES COUNT TO INCLUDE -11
	TCA		/AND COMPLEMENT IT
	AAC	-1
	DAC	FLDSW	/RESTORE THE COUNT
	.ENDC
	LAW	-6	/MAX OF 6 CHARACTERS PER NAME
	DAC SIXP+1	/MAX OF NINE CHARS PER NAME.
	LAC AD02	/FILE, +1, +2
NXTNAM=.
	.IFUND %BFA
	.IFUND %MACI
	DAC PACKER
	.ENDC
	.ENDC
	JMS P6INT
	JMS GETCMD
	SAD L40
	JMP .-2		/IGNORE LEADING BLANKS/
	DZM PRVCHR	/PSEUDO COUNTER FOR SPACES.
	SKP
CMDSUB	JMS GETCMD	/GET A CHAR AND RETURN IF NOT DELIMITED.
	SAD L40
	JMP CMDEXT
	.IFUND %BFA
	.IFUND %MACI
	SAD KOMMA
	JMP NAMDUN
	.ENDC
	.ENDC
	JMS SIXP	/DONT PACK AFTER 9 CHARS ARE IN.
	JMP CMDSUB	/GET NEXT CHAR
CMDEXT	SAD PRVCHR
	JMP PASALL	/LINE DELIMITED FIND CR OR ALT.
	DAC PRVCHR
	LAW -3
	DAC SIXP+1	/MAX OF 3 CHARS FOR EXTENSIONS.
	.IFDEF %MACI
	LAC AD02
	TAD L2
	JMS P6INT
	JMP	CMDSUB
	.ENDC
	.IFDEF %BFA
	LAC	AD02
	TAD	L2	/SET UP TO RECEIVE THE EXTENSION
	JMS	P6INT
	JMP	CMDSUB
	.ENDC
	.IFUND %MACI
	.IFUND %BFA
	LAC PACKER	/SET ADDRESS FOR EXTENSION.
	TAD L2
	JMS	P6INT
	JMP	CMDSUB	/THIS TRIGGERS THE DOUBLE SPACE THING
	.ENDC
	.ENDC
GETCMD	0
	JMS GETCHR
	SAD L15
	JMP CMD15
	SAD L175
	JMP CMD175
	JMP* GETCMD
	.IFUND %BFA
	.IFUND %MACI
/A NAME HAS BEEN DELIMITED BY EITHER A COMMA OR A 2ND SPACE.
/
NAMDUN	ISZ FLDSW
	SKP
	JMP PASALL	/3 NAMES IN IGNORE REST.
	LAW -11
	DAC SIXP+1
	LAC PACKER
	TAD L3
	JMP NXTNAM
	.ENDC
	.ENDC
	.IFUND	RSX
PASALL	JMS GETCMD	/LOOP UNTIL CR OR ALT.
	JMP .-1
	.ENDC
	.IFDEF	RSX
PASALL	LAC	PKNUM	/SAVE THE CHARACTER COUND
	DAC	PKNUMS
	LAC	UPKAD	/SAVE THE WORD POINTER
	DAC	UPKADS
	SKP
	.ENDC
CMD175=.
	.IFDEF	RSX
CMD15	DZM	BATCH	/INDICATE THAT COMMAND STRING IS COMPLETE
	LAC	POISW	/CHECK TO SEE IF AN EXIT SHOULD OCCUR
	SZA
	JMP	EXIT	/YES EXIT MACRO
	.ENDC
	.IFDEF %MACI
NAMDUN=PASALL
	JMS TTCLOS
	.ENDC
	.IFUND RSX
	.IFUND %MACI
	CAL+775
	6
	.ENDC
	SKP!CLA
CMD15	CLC
	DAC BATCH
	.IFDEF %MACI
	LAC DSWCH
	SZA
	DZM BNOPTN
	LAC FILE	/HAS ANY NAME BEEN TYPED?
	SNA
	JMP CMDE
	.ENDC
	.ENDC
/IF AN OPTION WAS SPECIFIED WHICH REQUIRES PRINTING SET THE LSTSW.
	LAW -6		/RESET MAXIMUM COUNTER ROUTINE.
	DAC SIXP+1
	LAC ALOPTN
	DAC LSWCH	/FOR .LST, .NOLST PSEUDO-OPS.
	LAC HSWCH
	SZA!CMA
	LAW -4
	DAC CNTSYM
	.IFDEF %BFA
	LAC NAME1X /TEST FOR INSERTION OF DEFAULT EXTENSION
	SNA
	LAC SRCEXT
	DAC NAME1X
	LAC PSWCH
	JMS ALTER
	JMP PASS1A
ALTER	0
	DAC TMP
	LAC CAL6
	TAD TMP
	DAC CAL6
	LAC RDSRC+1
	TAD	TMP
	DAC RDSRC+1
	LAC DBLBUF+1
	TAD TMP
	DAC DBLBUF+1
	LAC MOD5B-2
	TAD TMP
	DAC MOD5B-2
	LAC DOTSEK
	TAD TMP
	DAC DOTSEK
	CAL+767	/NORMAL INPUT DAT SLOT=-11
	1	/INIT THE CURRENT INPUT DAT SLOT
MOD5B	PASS1P
	0
	JMP* ALTER
	.ENDC
	.ENDC
	.IFUND %BFA
	.TITLE .SEEK,.FSTAT,AND OUTPUT FILE SETUP.
/
/MULTIPLE NAMES MAY HAVE BEEN INPUT.  SET UP THE POINTERS HERE FOR
/ALL THE .SEEK'S .
/REMEMBER THE NAME POINTER TO -11.  THIS IS THE
/NAME THAT WILL BE USED AS THE LISTING FILE NAME AND AS THE
/BINARY FILE NAME.
/
	.IFUND %MACI
	LAC PSWCH	/WAS THE P TYPED? (-10 INPUT)
	SNA		/YES .. DO AN .FSTAT.
	JMP TRYF	/NO .. TRY THE F SWITCH.
	LAC AD02
	JMS TST.FS
	.IFUND RSX
L770	CAL+770		/CAL -10
	.ENDC
	.IFDEF RSX
	DAT10		/DO AN FSTAT ON DAT10
	.ENDC
TRYF	TAD AD02	/IF P, AND BULKY-10, ADD 3 TO AD02 FOR
	DAC .SEK14	/NEW NAME.
	LAC FSWCH	/WAS F - TYPED?
	SNA
	JMP LASTNM	/NO .. SET UP FOR LAST NAME.
	LAC .SEK14
	JMS TST.FS
	.IFUND RSX
L764	CAL+764		/CAL -14
	.ENDC
	.IFDEF RSX
	DAT14		/DO AN FSTAT ON DAT14
	.ENDC
	DAC BULK14	/REMEMBER AT ^P IF BULK DEVICE OR NOT.
LASTNM	TAD .SEK14
	DAC .SEK11
	JMS SET10	/SETUP OUTPUT FILE NAME.
	LAC* 10
	DAC OUTNAM
	LAC* 10
	DAC OUTNAM+1
	LAC .SEK11
	JMS TST.FS
	.IFUND RSX
L767	CAL+767
	.ENDC
	.IFDEF RSX
	DAT11		/DO AN FSTAT ON DAT 11
	.ENDC
	DAC BULK11	/REMEMBER AT ^P.
	JMP PASS1A
	.IFDEF RSX
BULK11	0	/RESULT OF FSTAT ON DAT11
BULK14	0	/RESULT OF FSTAT ON DAT14
	.ENDC
/SUBROUTINE TO OPEN A FILE (A .INIT IS CONSIDERED AN OPEN FILE), DO
/AN .FSTAT TO DETERMINE DEVICE TYPE (BULK,NONBULK), AND WHETHER
/OR NOT THE NAMED FILE EXITS.  IF THE DEVICE IS BULK STORAGE
/EXIT IS MADE FROM THIS SUBR WITH '3' IN THE AC (ASSUMING
/OF COURSE THAT THE NAMED FILE WAS FOUND).  THE FILE IS
/CLOSED AT EXIT.  THE REASON FOR .INITING, .FSTATING, .CLOSING
/ALL AT ONCE IS BECAUSE WE WANT TO FIND OUT RIGHT AWAY IF
/THE NAMED FILE DOESN'T EXIST.  IF WE DON'T DO A CLOSE WE
/MAY WIND UP WITH TOO MANY DEVICES OPEN AT ONE TIME.
/
TST.FS	0
	.IFUND RSX
	DAC .FSTNM	/NAME POINTER FOR .FSTAT
	TAD L2
	DAC EXTPTR	/POINTER TO EXTENSION
	LAC* EXTPTR	/IF 0 REPLACE WITH 'SRC'.
	SNA
	LAC SRCEXT
	DAC* EXTPTR
	LAC* TST.FS	/EXECUTE THE CAL
	DAC CAL1
	DAC CAL3
	TAD L3000	/BUILD AN FSTAT
	DAC CAL2
	LAC* .FSTNM
	SNA
	JMP NAMERR
CAL1	XX
	1			/.INIT
MAX.C	PASS1P
FOUND	0		/USE AS TEMP STORAGE.
BULK11=FOUND
EXTPTR=FOUND
CAL2	XX		/CAL
	2		/.FSTAT
.FSTNM	XX
	DAC FOUND	/0=NOT FOUND, NON0=FOUND.
CAL3	XX		/CAL
	6		/.CLOSE
	IDX TST.FS	/POINT TO RET. ADDR.
	LAC .FSTNM
	AND IOTLIT		/BULK STORAGE?
	SNA
	JMP* TST.FS		/NO .. WHO CARES IF IT'S FOUND!
	LAC FOUND		/YES .. IT'S BULKY, ERROR IF NOT FOUND.
	SNA
	JMP NAMERR		/NOT FOUND .. TERMINATE.
	LAC L3
	JMP* TST.FS
	.ENDC
	.ENDC
	.ENDC
	.ENDC
	.IFDEF RSX
	AAC -1
	DAC* L10
	JMS STSKFL	/SET THE FILE NAME INTO THE SEEK CPB
	SNA
	LAC SRCEXT	/USE SRC FOR DEFAULT EXT.
	DAC FILEXT
	LAC* TST.FS
	ISZ TST.FS	/NOW SET THE LUN
	DAC HIFLUN
	DAC SEKLUN
	DAC CLSLUN
/
/
/
	CAL HINFCB
	JMS WAITSK
	LAC SKEV	/FILE ORIENTED?
	AND L40000
	SNA
	JMP* TST.FS	/NO; EXIT WITHOUT SEEKING
	CAL SEEKCB	/SEE IF THE FILE IS THERE; TERMINAL IF NOT
	CAL	WFSK	/WAIT FOR SEEK TO COMPLETE
	LAC	SKEV	/PICK UP THE EVENT VARIABLE
	SPA		/TO SEE IF FILE WAS FOUND
	JMP	SKERR	/CHECK TO SEE IF EV = -13 -- ERROR
	CAL	CLOSCB	/CLOSE THE DEVICE REQUESTED
	LAC L3		/OK, TRY THE NEXT LUN (IF ANY)
	JMP* TST.FS
SKERR	SAD	(-13)	/WAS IT FILE NOT FOUND?
	JMP	NAMERR	/YES -- NAME ERROR
	JMS	IOERR	/NO -- I/O ERROR
	LAC	HIFLUN	/PICK UP THE LUN OF THE I/O ERROR
/
/
/
STSKFL	0
	LAC* 10
	DAC FILNM1	/FILL UP THE NAME BLOCK IN THE SEEK CPB
	LAC* 10
	DAC FILNM2
	LAC* 10
	JMP* STSKFL
/
/
L40000	40000	/HINF FILE ORIENTED BIT CHECKER
/
/
	.ENDC
	.TITLE
	.IFUND %BFA
	LAC FILE+2
	SNA
	LAC SRCEXT
	DAC IFEXT
	JMP PASS1A
	.ENDC
CMDE	LAC MESER
	JMS WRITE3
	.IFUND	RSX
	.IFDEF %DOS15
	JMP TSTBOS
	.ENDC
	.ENDC
	.IFDEF	RSX
QMARK	QMARKS-QMARK/2*1000+2	/SYNTAX ERROR
	0
	.ASCII	'MAC-SYNTAX ERR'<15>
QMARKS=.
	.ENDC
	JMP CMDSTP
	.IFUND %BFA
	.IFUND %MACI
	.IFUND	RSX
NAMERR	LAC MESNAM
	JMS WRITE3
/
	.IFDEF %DOS15
/ALL ERRORS ARE FATAL ON BOSS-15 MODE.
/
TSTBOS	LAC* (%BOSS
	SPA
	JMP L775
	.ENDC
	JMP CMDSTP
	.ENDC
	.ENDC
	.ENDC
	.IFDEF	RSX
NAMERR	LAC	(NTMES)	/PRINT NAME ERROR IN IMAGE
	DAC*	(X10)	/SET UP TO INSERT MESSAGE
	LAC	FILNM1	/PICK UP THE FIRST HALF OF THE FILE NAME
	JMS	DECNAM	/DECODE THE NAME
	LAC	FILNM2	/PICK UP THE SECOND HALF
	JMP	DECNAM	/DECODE IT ALSO
	ISZ*	(X10)	/INSERT A SPACE
	LAC	FILEXT	/PICK UP THE EXTENSION
	JMS	DECNAM	/DECODE IT TOO
	CAL	WRNMER	/WRITE NAME ERROR
	JMS	WAITFR	/WAIT FOR EVENT VARIABLE
	JMP	EXIT	/EXIT MACRO -- FATAL ERROR
/
/	DELNAM -- DECODES SIXBIT TO IMAGE ASCII
/
DECNAM	0
	LMQ		/SAVE THE NAME IN THE MQ
	LAW	-3	/SET UP TO DO 3 CHARACTERS
	DAC	PSWCHS	/SAVE THE COUNT
DELLPN	ECLA!LLS 6	/PICK UP THE FIRST 6 BITS
	DAC	PSWCH	/SAVE THE VALUE
	AND	(40)	/CONVERT TO 7 BITS
	SNA!CLA		/ADD BIT 11 IF LETTER
	AAC	100
	TAD	PSWCH	/ADD IN THE VALUE
	DAC*	X10	/STORE IT IN THE MESSAGE
	ISZ	PSWCHS	/FINISHED?
	JMP	DELLPN	/NO DO THE NEXT CHARACTER
	JMP*	DECNAM	/YES -- RETURN
/
NOTHER	NTERND-NOTHER/2*1000+3
	0
	116		/M
	101		/A
	103		/C
	055		/-
	117		/N
	101		/A
	116		/M
	105		/E
	040		/SP
	105		/E
	122		/R
	122		/R
	117		/O
	122		/R
	040		/SP
	.REPT	12
NTMES	040		/SP - FILE NAME
	012		/LF
	015		/CR
NTERND=.
	.ENDC
	.IFUND	RSX
QMARK	374320		/QUESTION MARK <15>
	.ENDC
	.IFUND %MACI
	.IFUND %BFA
	.IFUND	RSX
NOTHERE	.ASCII 'NAME ERROR'<15>
	.ENDC
	.ENDC
	.ENDC
/
/IDENTIFICATION TITLES
/
	.IFDEF %BIN
ID	.ASCII	' MACRO-15 V7A'<15> /INSERT BY P. HENDERSON 8 FEB 72
	.ENDC
	.IFDEF RSX
	PASS1A-ID+1/2*1000+2
	0
ID	.ASCII /MACRO RSX V1A/<15>
	.ENDC
	.IFUND RSX
	.IFUND %BIN
	.IFDEF %DFALT
ID	.ASCII / MACRO-15 V7A/<15>	/THE BIG ONE
	.ENDC
	.ENDC
	.ENDC
	.IFDEF %MACI
	.IFUND %BMACI
ID	.ASCII / MACROI V4A/<15>	/MACROI-9 IS NO LONGER
	.ENDC
	.IFDEF %BMACI
ID	.ASCII /BMACROI V4A/<15>	/SLICK HUH?
	.ENDC
	.ENDC
	.IFDEF %BF15
ID	.ASCII /BF MACRO-15 V5A/<15>
	.ENDC
	.IFDEF %BF15A
ID	.ASCII /BF MACROA-15 V5A/<15>
	.ENDC
	.IFDEF %BDIMAC
ID	.ASCII / MACROD-15 V7A/<15>
	.ENDC
	.ENDC
	.IFDEF	RSX
	PASS1A-LF+1/2*1000+2
	0
	.ENDC
LF	050320
	373720		/> ALT MODE
	.TITLE INITIALIZE FOR PASS1.
/
/
PASS1A	LAC NOPLIT	/SET PASS 1
	DAC PASSNO
	.IFUND %MACI
	DAC SET1ST	/FOR USING DAT SLOT -12.
	.IFUND RSX
	LAC* L102
	.ENDC
	.ENDC
	.IFDEF %MACI
	LAC ENDIMB
	.ENDC
	.IFDEF RSX
	LAC	..SIZE	/PICK UP THE END OF MACRO
	.ENDC
	DAC ENDUMT
	DAC MACFFF
	LAC AD41	/BPIT-1
	JMS ZEROIT	/ZERO SWITCHES
	BP1T-EP1T
	.IFUND RSX
	LAC ADBEG	/(OVERLAY EXTRA PAGE CODE IF NO XPAGE)
	.ENDC
	.IFDEF RSX
	CAL	PARDEF	/FIND THE DEFINITION OF THE PARTITION BLOCK
	LAC	PARSIZ
	.ENDC
	DAC USTEND
	DAC BEGUST
	.IFDEF PAGPOS
	XCT EXPAGE	/EXTRA PAGE IN?
	JMP PAGIN	/YES..INIT******.
	.ENDC
PG001=.
	.IFDEF %MACI
	LAC LSTEXT
	DAC OUTEXT	/SETUP OUTPUT LISTING NAME.
	LAC DSWCH
	SZA
	JMS DENTER
	.ENDC
	JMP READ1
/
/
	.TITLE ENTRY AND INITIALIZATION FOR   PASS2
/
/
PASS2=.
	.IFUND %MACI
	DZM CTLP	/SET CONTRL P TO PASS 1
	.ENDC
	LAC LSWCH
	DAC ALOPTN
	LAC SKPLIT
	DAC PASSNO	/SET PASS 2 SWITCH
	LAC MACFFF
	DAC ENDUMT
	LAC BNOPTN	/BINARY REQUESTED
	SNA		/YES
	JMP READ1	/NO
	.IFUND %MACI
	.IFUND RSX
	CAL+1765	/.INIT BINARY OUTPUT DEVICE
	1
MOD4A	PASS1P
BBFSIZ	0
	LAC BBFSIZ	/OUTPUT BUFFER SIZE.
	SAD (376	/DOS-15 BUFFER SIZE.
	JMP DOS.13	/DOS FILE STRUCT. FOR -13.
	LAW -377
	SKP
DOS.13	LAW -376
	TAD BBFSIZ
	DAC BBFSIZ
	.ENDC
	.ENDC
	.IFDEF	RSX
	LAC	(DAT13)	/CHECK TO SEE IF THIS IS FILE STRUCTURED
	DAC	HIFLUN	/SET IT IN THE HINF REQUEST
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL	HINFCB	/DO A HINF REQUEST
	CAL	WFSK	/WAIT FOR HINF
	JMS	RSAUTO	/RESTORE AUTO XR'S
	LAC	SKEV	/PICK UP THE EVENT VARIABLE
	AND	L400000	/MASK OFF FILE STRUCTURED BIT
	SNA!CLA		/IS IT FILE STRUCTURED?
	AAC	-1	/SUBTRACT 1 FILE STRUCTURED=0
	DAC	BBFSIZ	/SET IT IN BUFFER SIZE POINTER
	.ENDC
	.IFUND %BFA
	LAC BMODE
	SZA!CLL
	CML
	LAC ABXEXT
	SNL
	.ENDC 
	LAC BINEXT	/BINARY
	DAC OUTEXT
	.IFUND RSX
	.IFUND %MACI
	CAL+765		/.ENTER BINARY OUTPUT DEVICE
	4
MOD5	OUTNAM
	.ENDC
	.ENDC
	.IFDEF RSX
	LAC	(DAT13)	/ATTACH OUTPUT BINARY DEVICE
	DAC	OUTNAM-1 /SAVE IT IN THE LUN SLOT
	JMS	ATACH
	JMS	SVAUTO	/SAVE AUTOXR'S
	CAL ENTCPB	/DO AN ENTER ON -13
	CAL	WFSK	/WAIT FOR THE ENTER TO COMPLETE
	LAC	SKEV	/PICK UP THE EVENT VARIABLE
	SMA		/IS IT LEGAL?
	JMP	ENTOK	/YES CONTINUE
	SAD	(-6)	/WAS THIS A NONFILE STRUCTURED DEVICE?
	JMP	ENTOK	/YES MUST BE OK
	JMS	IOERR	/NO -- I/O ERROR
	LAC	(DAT13)	/PICK UP THE LUN OF THE I/O ERROR
/
/
ENTOK	JMS	RSAUTO	/RESTORE AUTO XR'S
	.ENDC
	.IFDEF %MACI
	JMS DENTER
	LAC IFEXT	/REPLACE THE EXTENSION.
	DAC FILE+2
	.ENDC
	DZM LLBCDE
	LAC L1
	DAC LLWDCT
	DZM BNADDR	/BINARY OUTPUT ADDRESS
	DZM BNWDCT	/BINARY OUTPUT WORD COUNT
	DZM BNCKSM	/BINARY OUTPUT CHECKSUM
	.TITLE INITIALIZE FOR BOTH PASSES..
/
/
READ1=.
	.IFUND %MACI
	.IFUND %BFA
	LAC ADLITG	/RESET POINTER TO .LTORG TABLE
	DAC .LTGPT	/TO WORD1 TO GET FIRST LITLOC AREA.
	JMS SETLIT	/SET THE LITERAL COUNTER-POINTER.
	.ENDC
	.ENDC
	LAC %%MODE
	DAC DIRASW
	DZM EOTSW
	DZM PGCTR
	LAC SKPLIT	/TURN THE .LOCAL SWITCH OFF.
	DAC LOCALS
	DZM CSNL1	/CREATE SYMBOL - LEVEL 1
	LAC (7640	/4000 (10)
	DAC CSNL2	/CREATE SYMBOL - LEVEL 2
	LAC (15530	/7000 (10)
	DAC CSNL3	/CREATE SYMBOL - LEVEL 3
	CLC
	DAC SYMTYP	/SYMBOL TYPE -=REL,+=ABS
	DAC FSTLNE	/FIRST LINE SWITCH
	LAC AD42	/BP12T-1
	JMS ZEROIT
	BP12T-EP12T
/SET UP THE .SEEKS.
	.IFUND %BFA
	.IFUND %MACI
FNDFIL	LAC PSWCH	/P-OPTION SPECIFIED?
	SNA
	JMP SET.14	/NO TRY THE F-SWCH
	DZM PSWCH
	LAC AD02	/FIRST NAME FOR -10
	JMS SETINP	/TERMINAL SUBR.
	.IFUND RSX
	LAC L770
	.ENDC
	.IFDEF RSX
	LAC	(DAT10)	/DAT10 SET UP
	.ENDC
SET.14	LAC FSWCH	/F-OPTION?
	SNA
	JMP SET.11
	DZM FSWCH
	LAC .SEK14	/ADDRESS OF -14 NAME.
	JMS SETINP
	.IFUND RSX
	LAC L764
	.ENDC
	.IFDEF RSX
	LAC	(DAT14)	/DAT 14 SETUP
	.ENDC
SET.11	LAC .SEK11	/NAME ADDRESS.
	JMS SETINP
	.IFUND RSX
	LAC L767	/CAL -11
	.ENDC
	.IFDEF RSX
	LAC	(DAT11)	/DAT 11 SETUP
	.ENDC
	.EJECT
SETINP	0
	.IFUND RSX
	DAC SEEKAD	/SAVE NAME ADDRESS.
	.ENDC
	.ENDC
	.ENDC
	.IFDEF RSX
	AAC -1
	DAC* L10
	IAC	/RESET POINTER TO FILE NAME
	.ENDC
	.IFDEF %BFA
	LAC	AD02	/THERE EXISTS ONLY ONE INPUT FILE FOR THE
/A (MACROA) VERSIONS
	.ENDC
	.IFDEF %MACI
	LAC AD02
	.ENDC
	JMS UP6INT
	LAC ADPNAM
	JMS P57INT
	JMS P657
	JMS PKBLNK	/ONE BLANK BETWEEN NAME AND EXT.
	LAW -3		/USE P657 CODE.
	DAC P657+1
	JMS P657	/OUTPUT THE EXTENSION.
	LAW -6
	DAC P657+1	/RESTORE P657.
	LAW -5
	JMS SPACKS
	LAW -1
	DAC LNCTR
	IFUNA LAC,(064000,DAC,TEXTT
	.IFDEF RSX
	JMS	SVAUTO	/SAVE AUTO XR'S
	JMS STSKFL
	XCT* SETINP
	DAC CLSLUN
	DAC RDSRLN
	DAC SEKLUN
	CAL SEEKCB
	JMS WAITSK
	JMS	RSAUTO	/RESTORE AUTO XR'S
	JMP NEWTP1
	.ENDC
	.IFUND RSX
	.IFUND %MACI
	.IFUND %BFA
	XCT* SETINP
	DAC CAL4
	DAC CAL5
	DAC NEWTAP
	DAC CAL6
	DAC DBLBUF+1
	TAD L2000	/READ IN ASCII MODE.
	DAC RDSRC+1
CAL4	XX		/CAL 
	1
MOD5B	PASS1P
	0
CAL5	XX		/CAL
	.ENDC
	.ENDC
	.IFDEF %BFA
	LAC PSWCH /AVOID .SEEKS TO THE TT
	SZA
	JMP NEWTP1
DOTSEK	CAL+767	/.SEEK TO -11
	.ENDC
	3
	.IFUND %BFA
SEEKAD	XX
	.ENDC
	.IFDEF %BFA
SEKFYL	FILE	/BANK BIT INITIALIZED ADDRESS OF FILE
	.ENDC
	JMP NEWTP1
	.ENDC
	.ENDC
	.IFDEF %MACI
	LAC PSWCH	/PARAMETER FILE(FROM TTY ONLY)?
	DAC MSWCH	/1,READ FROM TTY BUFFER (DTIBUF)...0,FROM RDBUF
	SZA		/NO IF 0.
	JMP NEWTP1	/YES..ITS TAKEN CARE OF AT RDSRC.
FNDFIL	LAC FSWCH	/MACRO DEF FILE?
	SNA
	JMP SET.11	/NO PROCESS SOURCE FILE
FFILE	JMS DSEEK
	LAC (MACFIL
	JMP NEWTP1
MACFIL	.SIXBT	/.MACROSRC/
SET.11	LAC IFEXT
	DAC OUTEXT
	JMS DSEEK
	LAC LFILE
	JMP NEWTP1
	.ENDC
	.ENDC
	.TITLE NEXT FILE OR NEXT LINE.
/
/ENTER HERE FOR NEW TAPES
/A TAPE HAS JUST BEEN DELIMITED AND THE 'EOTSW' SWITCH HAS BEEN SET.
/IF THE NEXT FILE TO BE PROCESSED IS FROM A BULK STORAGE DEVICE DON'T
/BOTHER TO WAIT(UNLESS OF COURSE THE FILE JUST ENDED WAS FROM -11).
NEWTAP=.
	.IFUND %MACI
	.IFUND %BFA
	.IFUND RSX
	XX	/CAL OF BUSY DAT SLOT (-10, -14, -11)
	6		/CLOSE CODE.
	LAC NEWTAP	/WAS THE LAST FILE FROM -10?
	SAD L770
	JMP PREV10
	SAD L764	/WAS IT FROM -14?
	JMP PREV14
	.ENDC
	.ENDC
	.ENDC
	.IFDEF RSX
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL CLOSCB	/CLOSE LUN SLOTS BECAUSE EOT WAS FOUND
	JMS	RSAUTO	/RESTORE AUTO XR'S
	LAC CLSLUN
	SAD	(DAT10)	/WAS IT THE AUX PARAMETER FILE?
	JMP PREV10
	SAD	(DAT14)	/WAS IT THE AUX MAIN FILE?
	JMP PREV14
	.ENDC
/
/THE FILE JUST DELIMITED WAS FROM -11. PRINT THE ^P STUFF AND
/WAIT FOR THE OPERATOR TO RESPOND.
/
	.IFUND %BFA
	LAC ADST11
	.ENDC
	.IFDEF %BFA
	LAC	ADDTSK
	.ENDC
SETWAT	DAC POWA
	JMP WAITCP
	.IFUND %BFA
/
/AT PREV10 THE PREVIOUS FILE WAS FROM -10. TURN OFF THE EOTSW
/AND TEST TO SEE WHAT FILE IS NEXT AND FROM WHAT TYPE OF DEVICE.
/
PREV10	DZM EOTSW
	DZM PGCTR
	LAC FSWCH	/IS THE NEXT FILE FROM -14?
	SNA
	JMP NXT.11	/NO ITS FROM -11
	LAC BULK14	/YES..IS -14 BULKY?
	SZA
	JMP FNDFIL	/YES DON'T WAIT.
	LAC ADFNDF	/ADDRESS OF FNDFIL
	JMP SETWAT
/
/AT PREV14 THE LAST FILE WAS FROM DAT -14 AND THE NEXT WILL BE
/FROM -11.TURN OFF EOTSW AND SET THE MACRO TABLE POINTER(IF Z
/IS OFF).
/
PREV14	DZM EOTSW
	LAC ZSWCH
	SNA
	DZM PGCTR
	DAC SAVEF	/SAVE FOR PASS3.
	DAC FSWCH
	SZA
	JMP NXT.11
	LAC ENDUMT
	XCT PASSNO
	DAC MACFFF
/
/THE NEXT FILE IS FROM -11.
/
NXT.11	LAC BULK11
	SZA
	JMP SET.11
	LAC ADST11
	JMP SETWAT
	.ENDC
	.ENDC
	.ENDC
	.IFDEF RSX
POWA	0
CTLP	0
	.ENDC
	.IFDEF %MACI
	LAC PSWCH
	DZM MSWCH
	DZM PSWCH
	SZA
	JMP FNDFIL
	LAC FSWCH
	DZM FSWCH
	SNA
	JMP SET.11
	LAC ENDUMT
	DAC MACFFF
	JMP SET.11
	.ENDC
	.IFUND %MACI
NEWTP1	DZM CTLP	/SET ^P TO PASS 1
	JMS RDSRC
	.ENDC
/READ SUBSEQUENT LINES
/
NXTLNE	DZM STOPPER	/CLEAR C/R
	LAC RASW	/IN MIDDLE OF R/A LAST
	SZA
	JMP RARET	/RETURN TO EXPANSION
	LAC EXPSW	/IS A MACRO BEING EXPANDED
	SZA		/NO
	JMP EXPMCR	/RETURN TO EXPANDING ROUTINE
	DZM NOREST
	.IFUND %MACI
	JMS DBLBUF	/GET NEXT SOURCE LINE
	.ENDC
	.IFDEF %MACI
	JMS RDSRC
NEWTP1=NXTLNE
	.ENDC
	JMS PRTINT
	.TITLE LOGICAL LINE PROCESSOR.
/
/******SCNTAG*****
/ROUTINE TO PROCESS A LOGICAL LINE (ONE THAT MAY END
/WITH ; AS WELL AS CR).  THE BEGINNING OF THE ROUTINE
/SETS UP OR CLEARS SWITCHES FOR THE SYMCHR AND LEGAL
/SUBROUTINES.  AFTER THE SET-UP AND THE SYMCHR
/CALL THE ROUTINE WILL DO SOME EXTENSIVE ERROR
/CHECKING ON THE TAG (IF ONE IS IN).
/
SCNTAG	LAC AD43
	DZM TAGSW
	JMS ZEROIT	/CLEAR LINE SWITCHES
	BST-EST
	SET NDIL	/NO DATA IN LINE SWITCH.
	.IFUND %BFA
	LAC DFNSW	/IF THIS IS WITHIN A MACRO DEFINITION
	SZA
	JMP PKMCDF	/AREA, RETURN TO MACRO DEFIN ROUTINE.
	.ENDC
	JMS CLEARS	/CLEAR SYMBOL SWITCHES
TAGCKA	JMS SYMCHR
/CONTROL COMES BACK FROM SYMCHR WHEN AN ILLEGAL
/OR DELIMITING CHARACTER IS ENCOUNTERED IN THE CHAR
/STRING.  THE CURRENT CHAR IN CHRHLD IS THE ONE THAT
/CAUSED THE TAG STRING TO BE DELIMITED.
/IF THE LEGAL COUNT LCOUNT IS NON-ZERO, AT LEAST ONE
/CHARACTER APPEARS AS A TAG, IF A TAG IS STORED MAKE
/SURE THE FIRST CHAR IS NON-NUMERIC.
	LAC PACKS	/STORE THE TAG BUILT UP IN
	DAC PACKT	/PACKS IN PACKT.
	LAC PACKS+1
	DAC PACKT+1
	LAC LCOUNT	/LEGAL CHARACTER COUNT
	SNA		/YES
	JMP TSTVVV	/NO LEGAL CHARACTERS.
/ITS LEGAL TO HAVE A # SIGN WITH A SYMBOL IF THAT SYMBOL IS
/IN A LOCAL AREA. THIS TELLS THE ASSEMBLER TO STICK THIS SYMBOL
/IN THE RESIDENT USER'S SYMBOL TABL EVEN IF ITS NOT A FORWARD REF.
	LAC VARSW	/VARIABLE SWITCH
	DAC LOCVAR	/SAVE IT FOR TAG PROCESSOR.
	SNA
	JMP TGNOTV
	XCT LOCALS
	SKP
	JMP TERROR
TGNOTV	LAC CHAR1	/MAKE SURE THE FIRST CHAR IS ALPHA.
	SNA		/0 IF ALPHA, NON 0 IF NUMERIC
	JMP TAGCKC
TERROR	SET ERRORT
	DZM PACKT
	JMP TAGCKC
	.EJECT
/IF THERE IS NO TAG SYMBOL, CHECK THE FIRST CHARACTER FOR
/BEING A SLASH OR CR.  IF THIS IS THE CASE TREAT THE LINE
/AS A COMMENT.
/
TSTVVV	LAC VARSW
	DAC ERRORT
TAGCKB	JMS TSTC15	/CR?
	JMP TAGCOM
	SAD L57		/SLASH
	JMP TAGCOM
/CHECK CHRHLD FOR A VALID SYMBOL DELIMETER
/
TAGCKC	JMS CKSPTB	/SPACE OR TAB?
	JMP SCNOP	/YES.. SCAN FOR OP SYMBOL.
	SAD EQSIGN
	JMP TAGCKE
	JMS CKSCR
	JMP ENDLNE
/THE CHARACTER IN CHRHLD IS UNRECOGNIZABLE.  IF SIX
/CHARACTERS HAVE ALREADY BEEN PROCESSED KEEP THE
/TAG SYMBOL AND PRINT THE ERROR MESSAGE.
/
	LAW -6
	TAD CHRNUM
	SMA
	JMP TAGCKD
TAGERR	DZM PACKT
	DZM PACKT+1
TAGCKD	SET ERRORT	/KEEP PROCESS TAG CHARS UNTIL A
	JMS CHR6	/SYMBOL DELIMITER IS FOUND, BUT
	JMS CKSCR
	JMP ENDLNE
	JMP TAGCKA	/DO NOT STORE ANYTHING.
 
/AN = SIGN HAS BEEN ENCOUNTERED WHICH DELIMITED THE
/TAG PROCESSING.  IF NO CHARACTERS WERE STORED IN
/PACKT ITS AN ERROR, AND WILL BE PICKED UP AT PRTGPA.
/
TAGCKE	SET PASW	/SET PARAM SWITCH
	JMP SCNOP
/A SLASH OR A CR WAS THE FIRST CHAR OF THIS
/LOGICAL LINE. IF THE MULTI WORD STOPPER IS ON
/GET THE NEXT LINE
/
TAGCOM	LAC STOPPER
	SNA
TAG.C2	JMS PRTCOM	/PRINT IF PASS2
	JMP NXTLNE
	.TITLE OPERATION AND ADDRESS FIELD PROCESSORS.
/
/CONTINUE PROCESSING A LINE.
/CONTROL GOES TO SCNOP WHEN A TAG IS DELIMITED, CONTROL
/GOES TO SCNADR WHEN THE OPERATION FIELD IS DELIMITED.
/THE FIELD SWITCH FLDSW IS 0 IF PROCESSING AND OPERATION
/SYMBOL AND NON 0 FOR AN OPERAND.  IN EITHER CASE, THE
/LINE IS SCANNED UNTIL A SYMBOL IS DELIMITED, IF THE
/DELIMITER IS LEGAL THE SYMBOL IS EVALUATED BY EITHER
/SEARCHING THROUGH TABLES OR (IF NUMERIC) CONVERTING
/THE ASCII STRING TO NUMBERS.
/
SCNADR	SET FLDSW	/ADDRESS FIELD.
	SKP
SCNOP	DZM FLDSW	/OPERATION FIELD
	DZM OPRTR	/CLEAR PREVIOUS OPERATION.
	LAC ENDSW	/DON'T CLEAR FLDVAL IS THE LAST
	SNA		/SYMBOL WAS THE END STATEMENT.
	DZM FLDVAL	/NO IT WASN'T.
	DZM LKAHED	/CHARACTER IN OR OUT SWITCH
FLDCHR	JMS IGNORE
	SAD L11		/AS A .DSA PSEUOD-OP
	JMP .DSA
MORSYM	JMS CLEARS	/NEITHER.. PROCESS THE STRING
	JMS SYMCHR
 
/CONTROL RETURNS HERE WHEN THE CHARACTER STRING, USED TO
/BUILD A SYMBOL IS DELIMITED.  IF PACKS IS 0 NO SYMBOL
/EXISTS.  IF THIS IS THE CASE CHECK ALL THE VALID DELIMITERS
/AND SPECIAL CHARACTERS, IF NONE OF THESE ARE SATISFIED
/FLAG THE LINE.
/
	LAC LCOUNT	/IF NO LEGAL CHARACTERS WERE
	SZA		/PROCESSED AND THE LOOK AHEAD
	JMP SYMIN	/SWITCH IS ON, THE LINE IS
	LAC LKAHED	/QUESTIONABLE (E.G. LAC**B)
	SZA
	SET ERRORQ
	JMS CHRLKP	/CHECK FOR / ; OR CR, IF YES THERE
	27775		/IS NO NEW ITEM TO EVALUATE, BUT THERE
	JMP ENDLNE	/MAY HAVE BEEN BEFORE ON THIS LINE
	SAD LPAREN	/IF ITS NOT A LITERAL, CHECK TO SEE IF
	JMP LTERAL	/ITS A UNARY SIGN + OR -.
	JMS CHRLKP
	57776
	JMP NOTIN	/CHAR IS + OR -.
	JMP SYMERR	/UNIDENTIFIABLE.....SYMBOL ERROR.
	.EJECT
/
/CONTROL ONLY COMES TO NXOPAD IN THE EVENT THAT A LEGAL
/CHARACTER IS TERMINATED BY AN OPERATOR  (+ - * ETC)
/WHICH IS NOT FOLLOWED BY A SPACE OR A TAB.  THE FIELD
/SWITCH IS NOT CHANGED AND THE 'OPRTR' VALUE IS STORED
/WITH THE OP TO PERFORM THE NEXT TIME A SYMBOL IS DELIMITED.
/
NXOPAD	LAC BYPASS	/CHECK IF CHAR IN FROM INDIRECT
	SZA
	JMP OPASTR	/IS ON.
NOTIN	LAC CHRHLD
	DZM BYPASS	/CLEAR NEXT CHAR SWITCH.
OPASTR	DAC OPRTR	/OPERATOR IN BYPASS OR CHRHLD.
	SET LKAHED	/WHEN CONTROL RETURNS FROM SYMCHAR, IF
	JMP MORSYM	/NO LEGAL SYMBOLS - ERROR
 
/THE CURRENT CHARACTER IS LEFT PAREN.  IF MORE THAN
/ONE HAS BEEN ENCOUNTERED FLAG THE LINE WITH AN L.
/SAVE THE OPERATION VALUE AND TURN ON THE OP SAVE
/SWITCH.  THE OPVALUE WAS SET TO 0 BEFORE THE TAG
/WAS SCANNED.
 
LTERAL	LAC LITSW	/FLAG IF MORE THAN ONE (.
	SZA
	SET ERRORL
	SET LITSW	/TURN ON LITERAL SWITCH.
	SET OPSVSW	/OPERATION VALUE SAVED.
	LAC OPVAL	/IF THIS IS A NESTED LITERAL
	DZM OPVAL	/THE OLD VALUES ARE CLOBBERED.
	DAC OPSAV
	LAC FLDSW	/IS THIS A LITERAL IN THE OP FIELD.
	SNA		/NO
	SET NULOPF	/YES.. SET FOR 15-BIT RELOC.
	DZM FLDSW	/ASSUME NEXT FIELD IS OP FIELD
	DZM FLDVAL
	DZM NCD		/NOT COMPLETELY DEFINED.
	JMS GETCHR	/IF THE NEXT CHARACTER IS A
	SET BYPASS	/SPACE OR A TAB SET THE
	JMS CKSPTB	/FIELD SWITCH
	SKP	
	JMP MORSYM
	DZM BYPASS
	SET FLDSW
	JMP FLDCHR
	.EJECT
 
 
/A SYMBOL OF SOME SORT IS IN PACKS.  IF THE FIRST
/CHARACTER WAS NUMERIC THEY ALL HAVE TO BE NUMERIC.
 
SYMIN	DZM LKAHED	/OK TO TURN OFF, LEGAL CHAR IS IN.
	JMS CHRLKP	/MAKE SURE THE SYMBOL
	7765		/TERMINATOR WAS OK
	JMP TERMOK	/ SPACE, TAB, ; , CR, +, -, / *, &,
	SAD KOMMA	/ !, BACKSLASH, OR COMMA
	JMP TERMOK
	JMS RPTEST	/RIGHT PAREN?
	JMP SYMERR	/SYMBOL TERIMATE ERROR
 
/WAS THE SYMBOL PRECEEDING THE TERMINATOR, NUMERIC
/OR ALPHANUMERIC (BEGINS WITH ALPHA).  THE 1ST CHARACTER
/CODE = 0 IF ALPHA AND NON0 IF NUMERIC.
/
TERMOK	LAC CHAR1	/NUMERIC?
	SNA		/YES
	JMP SYMBLD	/NO..EVALUATE SYMBOL.
	LAC VARSW	/ALPHA AND # CANNOT BE
	TAD ALPCIN	/WITH NUMBERS.
	SNA
	JMP NUMCON	/ABSOLUTE, EVALUATE NUMBER.
	JMS CLEARS	/CLEAR THE GARBAGE STRING
	JMP NUMER	/VALID TERMINATOR BUT NON-NUMBERS
			/WHERE ENCOUNTERED IN THE LEGAL C.S.
/A LEGAL NUMBER IS IN AN UNSATISFIED CONDITIONAL AREA.DON'T 
/BOTHER EVALUATING IT.
/
NUMCON	LAC CONDSW	/UNSAT COND AREA?
	SZA		/NO
	JMP ENDFLD	/YES IGNORE IT.
	JMP NUMEND	/EVALUATE IT.
 
/AN INVALID CHAR WAS ENCOUNTERED AND CAUSED THE
/CHARACTER STRING TO BE DELIMITED.  IGNORE IT
/
SYMERR	SET ERRORS	/THE WHOLE SYMBOL IS LOST.
	DZM BYPASS
	JMP MORSYM+1
/SUBROUTINE 'RPTEST' LOOKS AT THE AC FOR A RIGHT PAREN,
/IF IT IS A '(' THE RETURN ADDRESS IS INCREMENTED
/AND THE CHAR IS REPLACED WITH A SPACE (40).
/
RPTEST	0
	SAD RPAREN	/RIGHT PAREN?
	SKP		/YES
	JMP* RPTEST	/NO EXIT
	ISZ RPTEST
	LAC L40
	DAC CHRHLD
	JMP* RPTEST
 
/SUBROUTINE TO SET ALL SYMBOL SWITCHES.
/
CLEARS	0
	LAC AD08	/PACKS
	JMS P6INT
	DZM PACKS+1	/SYMBOLS.
	DZM VARSW	/# IN CHARACTER STRING SWITCH.
	DZM FNDSW
	DZM LCOUNT
	DZM NUMBR
	DZM CHAR1	/FIRST CHAR SWITCH.
	DZM ALPCIN
	JMP* CLEARS
CHR6	0
	LAC L6
	DAC CHRNUM
	JMP* CHR6
	.TITLE SYMBOL PARSING .
/
/SUBROUTINE IGNORE: LOOKS AT THE NEXT CHAR
/IF THE CHAR IS
/BLANK ITS IGNORED, AND THE NEXT CHAR COMES IN.
/
IGNORE	0
	JMS GETCHR	/NO. GET ANOTHER CHAR.
	SAD L40		/IGNORE BLANKS
	JMP .-2
	DAC BYPASS	/SET CHAR IN SWITCH
	JMP* IGNORE
/SUBROUTINE TO PROCESS A LEGAL CHARACTER.  CONTROL STAYS IN
/THIS SUBROUTINE UNTIL A STRING OF CHARS IS DELIMITED, OR
/UNTIL AN ILLEGAL CHAR IS ENCOUNTERED.  THE CHARS ARE
/PACKED .SIXBT IN PACKS AND PACKS+1.  THE PAPERTAPE CONTROL
/PUNCHES VT, LF, AND FF ARE ALWAYS IGNORED.  THE SIXBT 
/CHARACTER COUNTER CHRNUM MUST BE SET TO ZERO BEFORE ENTRANCE
/THE BYPASS (GETCHR) SWITCH MUST ALSO BE PRESET. LEADING 0'S OF
/A NUMERIC STRING ARE NOT PACKED, BUT THE 1ST CHAR
/SWITCH IS SET.
/
SYMCHR	0
	LAC BYPASS	/IS THE CHARACTER ALREADY IN?
	SNA		/YES
SYMGET	JMS GETCHR	/NO
	SAD VARAB	/IF ITS THE # SIGN, TURN ON THE VARAIBLE
	JMP SYMVAR	/AND GET ANOTHER CHARACTER
	JMS CHRLKP	/ALWAYS IGNORE LF, FF, VT
	157775
	JMP SYMGET
	DZM BYPASS	/CLEAR CHAR IN SWITCH
	JMS LEGAL	/IS THE CHARACTER LEGAL?
	JMP* SYMCHR	/NO.. EXIT
	LAC CHRNUM	/HAVE ANY CHARS BEEN PACKED?
	SZA		/NO..TEST FOR LEADING ZEROES?
	JMP SYMSTO	/ZEROES ARE IGNORED
	LAC CHRHLD
	SAD L60
	JMP SYMGET
			/IF IT IS IGNORE IT
SYMSTO	JMS SIXP	/SIXBT PACKING
	JMP SYMGET
SYMVAR	SET VARSW
	JMP SYMGET
	.EJECT
/SUBROUTINE LEGAL: LOOKS AT A CHARACTER AND DETERMINES WHETHER
/OR NOT THE CHARACTER IS A LEGAL SYMBOL VALUE: A-Z,.,%,OR
/0-9.  IF IT IS LEGAL, A COUNT IS MADE OF THAT TYPE OF CHARACTER.
/IF THE CHARACTER IS THE FIRST ONE IN, A SWITCH IS SET FOR ITS
/TYPE.  CHAR1=0 IF FIRST CHAR IS ALPHA AND NON 0 IF IT IS
/NUMERIC.
LEGAL	0
	JMS CKALF	/IS THE CHAR A-Z?
	JMP LEGALA
	JMS CKNUM	/NUMERIC?
	JMP LEGALN
	JMS CHRLKP
	137776		/' OR %?
	JMP LEGALA
	JMP* LEGAL	/ILLEGAL
LEGALA	SET ALPCIN	/ALPHA CHARACTER IN
	JMP LEGALO	/EXIT FROM LEGAL.
LEGALN	LAC ALPCIN	/IF ALPCIN IS 0, THE FIRST CHAR
	SNA		/IS NUMERIC.
	SET CHAR1
LEGALO	ISZ LCOUNT	/COUNT CHARACTERS
	ISZ LEGAL	/BUMP TO LEGAL-CHAR-IN RETURN.
	JMP* LEGAL
/CHECK THIS CHARACTER FOR BEING A SEMICOLON.
/
CKSEMI	0
	LAC CHRHLD
	SAD L73
	ISZ CKSEMI	/CHAR IS A SEMICOLON
	JMP* CKSEMI


/SUBROUTINE SUB1 PERFORMS THE FUNCTION: LAW -1, TAD ADDR,
/DAC ADDR. I.E. ONE IS SUBTRACTED FROM THE CONTENTS OF
/A LOCATION.
SUB1	0
LAWM1	LAW -1
	JMS ADDER
SUB2	0
	LAW -2
	JMS ADDER
SUB3	0
LAWM3	LAW -3
	JMS ADDER
ADD3	0	/(LAC L3)
	LAC LACL3L
	JMS ADDER
ADDER	0
	DAC ADDER1
	LAW -3
	TAD ADDER
	DAC ADDER
	LAC* ADDER
	DAC ADDER
	LAC* ADDER
	AND L347S
	TAD TADLIT
	DAC ADDER2
ADDER1	XX
ADDER2	XX
	JMP* ADDER
/NUMBER ERROR
/
NUMER	SET ERRORN	/N TO FLAG WORD
	JMS CKSCR	/CHECK FOR ; OR CR
	JMP NUMEND
ENDALL	JMS SCNEND	/SCAN TO END OF WORD
	JMP ENDLNE	/END WORD/LINE
NUMEND	JMS NUMEVL	/NUMBER EVALUATION
	DZM CREL
	.TITLE COMBINE SYM. VALUES PASSED SO FAR.
/
/
ARITHOP	LAC OPRTR	/DETERMINE WHAT OPERATION
	AND L7		/IS TO BE PERFORMED
	TAD (JMP .+4
	DAC .+2
	LAC FLDVAL
	0
	JMP ARADD	/ADD
	JMP ARIOR	/INCLUSIVE OR
	JMP ARMUL	/MULTIPLY
	JMP ARADD	/ADD
	JMP ARXOR	/EXCLUSIVE OR
	JMP ARSUB	/SUBTRACT
	JMP ARAND	/AND
	JMP ARDIV	/DIVISION
ARADD	TAD NUMBR
	JMP STORIT
ARSUB	LAC NUMBR
	JMS TWOS	/CHANGE NUMBR TO 2'S COMP
	TAD FLDVAL
	JMP STORIT
ARMUL	JMS MPY		/FLDVAL IS MULTIPLIER
	LAC NUMBR	/MULTIPLICAND
	JMP STORIT	/AC IS LOW ORDER PRODUCT
ARDIV	JMS DIVIDE	/DIVIDE ROUTINE
	LAC FLDVAL	/DIVIDEND
	LAC NUMBR	/DIVISOR
	JMP STORIT
ARAND	AND NUMBR
	JMP STORIT
ARIOR	AND NUMBR	/A!B=(A&B(XOR)A(XOR)B).
	XOR FLDVAL
ARXOR	XOR NUMBR
STORIT	DAC FLDVAL
	.IFUND %BFA
	JMS MODETR	/WHAT OUPUT MODE
	.ENDC
	JMP ACCREL	/REL
	.EJECT
/END OF OP OR ADDRESS FIELD
/
/
ENDFLD	JMS CKSCR	/CHECK FOR ; OR CR
	JMP ENDLNE	/END WORD-LINE ROUTINE
	JMS CKSPTB	/CHECK FOR SPACE OR TAB
	SKP
	JMP NXOPAD	/GET NEXT ELEMENT OF EXPRESSION
	LAC FLDSW	/WHAT FIELD
	SZA
	JMP ENDALL	/ADDRESS FIELD
	LAC FLDVAL	/OPERATION FIELD
	DAC OPVAL
	JMS IGNORE
	JMS CHRLKP
	017774		/CHECK FOR TAB,CR,;OR /
	JMP ENDALL	/END OF STATEMENT
	DZM FLDVAL
	DZM OPRTR
	SET FLDSW
	JMP MORSYM
ACCREL	LAC OPRTR	/PICK UP OPERATOR
	AND L7
	TAD (JMP .+3
	DAC .+1
USET1	0
	JMP ARLC	/ADD
	JMP ARLC	/OR
	JMP ARLA	/MPY
	JMP ARLC	/ADD
	JMP ARLC	/XOR
	JMP ARLB	/SUB
	JMP ARLC	/AND
			/DVD
ARLA	LAC CREL	/CURRENT RELOCATION
	SNA
	JMP ARLD
	LAC L1
	DAC AREL	/ACCUMULATED RELOCATION
ARLF	SET ERRORR	/R TO FLAG WORD
	JMP ARLE
ARLD	LAC AREL
	SAD L1
	JMP ARLF
	JMP ARLE
ARLB	LAC AREL
	SZA
	JMP ARLG
ARLC	LAC CREL
	JMP ARLH
ARLG	LAC CREL
	JMS TWOS
ARLH	TAD AREL
	DAC AREL
ARLE	DZM CREL
	JMP ENDFLD	/END OF OP OR ADDRESS FIELD
	.TITLE SYMBOL EVALUATOR AND TABLE BUILDER.
/
/
SYMBLD	LAC PACKS	/CHECK FOR CURRENT
	SNA		/SYMBOL IS IN
	JMP VAL155	/NO SYMBOL IN PACKS OR PACKS+1.
SYMBIN	SAD (560000	/LOCATION REFERENCE
	SKP
	JMP NOTDOT
	LAC PC		/PC PICKED UP
	DAC NUMBR	/AS ITS VALUE
	DZM CREL
	LAC SYMTYP	/PICK UP RELOCATION
	SPA
	ISZ CREL
	JMP ARITHOP	/PERFORM ARITHMETIC OPERATIONS
/
/
NOTDOT	LAC IFSW	/.IF STATEMENT?
	SZA		/NO
	JMP IFEXP	/YES
	TAD FLDSW	/OP FIELD?
	TAD LITSW	/PSEUDO-OP CANNOT BE IN LITERAL.
	TAD PASW	/PARAM?
	TAD ENDSW
	TAD OPRTR
	SZA		/FOR SYMBOL OR EXPRESSION
	JMP CNVIT	/IF SYMBOL, LOOK FOR
	JMS CHRLKP	/PSEUDO-OP
	007774		/CHECK FOR SPACE, TAB, CR, OR ;
	SKP		/FOUND
	JMP CNVIT
	JMS SEARCH	/SEARCH PSEUDO-OP TABLE
	LAC POPEND
	LAC POPBEG	/CALLING SEQUENCE
	LAC AD08	/PACKS
	2		/
	SKP		/FOUND
	JMP CNVIT	/NOT FOUND
	.EJECT
/THIS SYMBOL IS A PSEUDO OP IN THE OPERATOR FIELD.IF ITS IN AN
/UNSATISFIED CONDITIONAL AREA TEST IT FOR BEING AN .IF OR AN
/.ENDC.  IF SO UPDATE THE COUNT SO THAT EVENTUALLY THE UNSATISFIED
/AREA WILL END. IF NOT .IF,OT .ENDC IGNORE IT(UNLESS OF COURSE
/THIS IS NOT IN AN UNSAT. COND. AREA.
/
	JMS CKPFV
	LAC* MRGLOC
	JMS WRD3	/PICK UP JUMP INSTRUCTION
	SAD IFOP	/.IF PSEUDO OP
	JMP POPIT	/YES
	LAC CONDSW	/CONDITIONALIZED SECTION
	SNA		/YES
POPIT	XCT* MRGLOC	/NO - JUMP TO PSEUDO-OP RTNE
	LAC* MRGLOC
	SAD ENDCOP	/.ENDC
	XCT* MRGLOC	/YES
CNVIT	LAC CONDSW	/CONDITIONALIZED SECTION
	SZA		/NO
	JMP ENDLNE	/EXIT TO END LINE ROUTINE
/
/********************
/*                  *
/*  USER TABLE      *
/*                  *
/********************
/
	JMS USTLKP	/LOOK UP SYMBOL IN USER TABLE
	.IFDEF %BFA
	JMP	NOTMAC
	.ENDC
	.IFUND %BFA
	SKP		/FOUND
	JMP CKSYSM	/NOT FOUND
	JMS CKMAC	/IS ENTRY A MACRO
	JMP NOTMAC	/NO
	LAC FLDSW	/IF NOT OP FIELD
	SZA		/IT'S A USAGE ERROR
	JMP MACERR
	XCT PASSNO	/WHICH PASS
	JMP MACALL	/MACRO CALL ROUTINE
	LAC* TMP	/WAS MACRO DEFINED FOR PASS 2
	SPA		/NO
	JMP MACALL	/YES
MACERR	SET ERRORX	/X TO FLAG WORD
	DZM NUMBR
	JMP ARITHOP
	.ENDC
CKSYSM	LAC FLDSW	/BYPASS SYSTEM MACRO SEARCH
	SZA		/IF NOT OP FIELD
	JMP SPST
	JMS SEARCH	/SEARCH FOR SYSTEM MACRO
	LAC SMEND
	LAC SMBEG
	LAC AD08	/PACKS
	2
	SKP
	JMP SPST
	JMS WRD3	/PICK UP WORD3
	LAC* MRGLOC
	XOR BNKBTS
	JMP SYSCAL	/MACRO CALL PROLESSING
NOTMAC	LAC* MRGLOC	/IS IT A PARAMETER ASSIGNMENT
	SMA		/YES
	JMP STFND
/
/****************************
/*                          *
/* DIRECT ASSIGNMENT        *
/*                          *
/****************************
/
	JMS GETREL	/PICK UP RELOCATION
	LAC VARSW	/VARIABLE INDICATOR ON
	SNA		/YES
	JMP SPSTA
	LAC* MRGLOC
	AND L357S
	DAC* MRGLOC	/CHANGE SYMBOL TABLE ENTRY
	JMS WRD3	/FROM P/A TO VARIABLE
	JMS SETB0	/SET BIT 0.
	JMS SUB2	/C(MRGLOC)=C(MRGLOC)-2
	DAC MRGLOC
	ISZ VARCTR	/UPDATE VARIABLE COUNT
	JMP STFND
SPSTA	LAC FLDSW
	SNA
	JMP SPSTB
SPSTAP	JMS SYMVAL	/PICK UP SYMBOL VALUE
	JMP ARITHOP	/PERFORM ARITHMETIC OPERATIONS
STFND	SET FNDSW	/SET FOUND IN USER TABLE
	LAC MRGLOC
	DAC MRGSAV	/SAVE MERGING LOCATION
/IF THE SYMBOL VALUE IS X IT HAS TO BE TREATED AS A
/SPECIAL CASE.
SPST=.
	.IFUND %PDP9
	LAC PACKS	/GET THE SIXBT SYMBOL VALUE.
	SAD XREG	/IS IT X?
	SKP		/YES-CHECK FOR OPERATION FIELD.
	JMP SPSTNX	/NO-SCAN PERM IF OP FIELD.
	LAC INDXSW
	DAC ERRORX
	SET INDXSW	/TURN ON XR SWITCH.
	LAC FLDSW	/IS IT THE OPERATION FIELD?
	SNA		/NO.
	SET ERRORX	/YES...FLAG THE LINE.
	LAC NULOPF	/IS THIS A NULL OPERATOR?
	SZA		/NO
	SET ERRORX	/YES..FLAG THE LINE.
	JMP ENDFLD	/GET NEXT SYMBOL  .
	.ENDC
SPSTNX	LAC FLDSW	/IF OP FIELD
	SZA		/SEARCH PERMANENT SYMBOL TABLE
	JMP NOTPST	/BYPASS SEARCH
SPSTX	LAC PACKS+1	/BYPASS 2 WORDS
	SZA		/IF 2ND WORD NONFILE
	JMP SPSTF
	JMS SEARCH	/SEARCH 2 WORD S/T
	LAC PS2END
	LAC PS2BEG
	LAC AD08	/PACKS
L1	1
	SKP		/FOUND
	JMP NOTPST	/NOT FOUND,SMALL SYM DO NOT CHECK 3-WRD TAB.
	IDX MRGLOC
	LAC* MRGLOC
	DAC NUMBR
	DZM CREL
	JMS CKPFV
	JMP TINDER	/CHECK FOR INDIRECT(E,G, LAC* ADDR)
SPSTF	JMS SEARCH	/SEARCH 3 WORD S/T
	LAC PS3END
	LAC PS3BEG
	LAC AD08	/PACKS
L2	2
	JMP SPSTC	/FOUND
	JMP NOTPST	/NOT FOUND
SPSTE	JMS SUB1	/SUBTRACT 1 FROM MRGLOC
	DAC MRGLOC	/FOR 2 WORD SYMBOLS
SPSTC	JMS CKPFV
	DZM CREL
SPSTB	JMS SYMVAL	/PICK UP SYMBOL VALUE
	.TITLE	IS IT A MEMORY REFERENCING INSTR?
/
/
/THE VALUE FROM THE PERM SYMBOL TABLE IS IN -NUMBR- AND THE AC.
/CHECK ITS VALUE.  IF ITS A MEM REF TURN A SWITCH ON.
/
TINDER	LAC CHRHLD
	SAD L52		/*
	JMP CKMRI	/CHECK FOR MEMORY REFERENCE INSTR
	JMP ARITHOP
CKMRI	DAC BYPASS	/BYPASS GETTING
	JMS GETCHR
	JMS CHRLKP	/CHECK FOR SPACE, TAB
	007774		/; OR CAR. RET.
	JMP CKOPCD	/FOUND
	JMS RPTEST	/)?
	JMP ARITHOP	/NO
/CHECK IF SYMBOL IS A MEMORY REFERENCE INSTRUCTION
/
CKOPCD	CLL
	LAC NUMBR
	TAD L157S	/(177777
	SZL
	JMP INDER	/NOT A MEMORY REFERENCE
	LAC NUMBR
	XOR L20000	/SET INDIRECT BIT
	JMP VAL155
INDER	SET ERRORS	/S TO FLAG WORD
	JMP ARITHOP
NOTPST	LAC MRGSAV	/RESTORE MERGING LOCATION
	DAC MRGLOC
	DZM BYPASS
	XCT PASSNO	/WHICH PASS
	JMP P1SP	/PASS 1
	LAC FNDSW	/WAS IT IN USER'S TABLE
	SZA		/NO
	JMP P2FND
	SET ERRORE	/E TO FLAG WORD
	DZM NUMBR
	JMP ENDFLD
P2FND	DZM FNDSW
	LAC* MRGSAV
	JMS GETREL	/PICK UP RELOCATION
	JMS MRGP1	/CHECK FOR UNDEFINED
	AND JMPLIT
	SZA
	JMP CKVT	/CHECK FOR VIRTUAL
SETUND	SET ERRORU
	JMP VAL15
CKVT	SPA
	JMP CKMD	/CHECK FOR MULTIPLE DEFINITION
	SET EXTSW	/SET EXT SWITCH
	JMP VAL15	/PICK UP VALUE
CKMD	JMS MRGP1
	AND LACLIT
	SZA
	SET ERRORD	/D TO FLAG WORD
VAL15	JMS SYMVAL	/PICK UP SYMBOL VALUE
	AND L57S	/MASK OUT CONTROL BITS
VAL155	DAC NUMBR
	JMP ARITHOP
/LOOK UP SYMBOL IN USER'S TABLE
/
USTLKP	0
	LAC AD08	/PACKS
	JMS SQOZE	/CONVERT SYMBOL TO RADIX 50
	LAC SYMARG
	JMS SRCUST	/SEARCH USER TABLE
	JMP* USTLKP	/FOUND
	IDX USTLKP
	JMP* USTLKP	/NOT FOUND
/PASS 1 SYMBOL PROCESSING
/
P1SP	LAC FNDSW	/FOUND IN USER'S TABLE
	SZA		/NO
	JMP P1FND	/YES
	SET NCD		/NOT COMPLETELY DEFINED
	JMS USTLKP	/SEARCH USER TABLE
	NOP
	JMS MERGE	/MERGE IN NEW SYMBOL
LAWM2	LAW -2		/GET TABLE ADDRESS
	TAD* L11	/OF MERGED SYMBOL
	DAC MRGLOC
	LAC VARSW	/IS PACKS A VARIABLE
	SZA		/NO
	JMP FLGVAR
	INC UNDCTR	/UPDATE UNDEFINED SYMBOL COUNT
	JMP ENDFLD
/THIS SYMBOL IS PART OF AN IF (PSEUDO-OP) STATEMENT. PUT ITS NUMERIC
/VALUE IN NUMBR, AND SET THE NCD SWITCH IF THE STATEMENT
/IS NOT FOUND. NOTE THAT A SYMBOL IS "AUTOMATICALLY" (ASSUMED) DEFINED
/WHEN (FOR .IF ONLY) IT IS ENTERED IN THE SYM TABLE.
/
IFEXP	DZM NUMBR
	JMS USTLKP	/LOOK UP SYMBOL
	JMP IFXPA	/FOUND
	SET NCD		/NOT FOUND
	JMP ARITHOP
IFXPA	LAC* MRGLOC
	SPA		/P/A
	JMP SPSTAP	/PICK UP 18 BITS
	JMP VAL15
/FLAG VARIABLE SYMBOL
FLGVAR	IDX MRGLOC	/SET BIT 0 OF WORDS
	JMS SETB0	/2 AND 3 OF ENTRY
	IDX MRGLOC	/TO VARIABLE
	JMS SETB0
	AND IOTLIT	/PUT PC IN WORD 3
	XOR PC		/FOR MULTIPLE DEFINITION
	DAC* MRGLOC	/ERROR PRINTOUTS
	INC VARCTR	/UPDATE VARIABLE COUNT
	DZM VARSW
	JMP ENDFLD
SETB0	0
	LAC* MRGLOC
	AND L357S
	XOR XCTLIT
	DAC* MRGLOC
	JMP* SETB0
/SYMBOL FOUND IN PASS 1
P1FND	DZM FNDSW	/RESET FOUND SWITCH
	LAC VARSW	/PACKS A VARIABLE
	SZA		/NO
	JMP P1VAR	/YES
	LAC* MRGSAV
	JMS GETREL	/GET RELOCATION
	JMS MRGP1	/IF SYMBOL IN TABLE
	AND XCTLIT	/IS NOT A VARIABLE
	SNA		/OR UNDEFINED, PICK
	JMP NOVAL	/UP ITS VALUE
	IDX MRGSAV
	LAC* MRGSAV
	AND XCTLIT
	SNA
	JMP VAL15	/PICK UP 15 BITS OF VALUE
NOVAL	SET NCD
	JMP ENDFLD
/VARIABLE ENCOUNTERED IN PASS 1 AND SYMBOL FOUND IN TABLE
P1VAR	ISZ MRGSAV
	DZM VARSW
	ISZ NCD
	LAC* MRGSAV
	AND JMPLIT
	SZA		/CHECK FOR UNDEFINED
	JMP P1EXT	/OR EXTERNAL
	JMS SUB1	/IF UNDEFINED, DECREMENT UNDEFINED COUNT
	DAC UNDCTR	/MARK SYMBOL AS A VARIABLE
	JMP FLGVAR
P1EXT	SAD LACLIT	/CHECK FOR EXTERNAL
	SKP
	JMP RDNTV	/CHECK FOR REDUNDANT VARIABLE
	JMS SUB1	/IF EXTERNAL, DECREMENT
	DAC EXTCTR	/EXTERNAL COUNT AND (SUB1 ARG)
	JMP FLGVAR	/MARK SYMBOL AS A VARIABLE
RDNTV	JMS MRGP1
	SPA
	JMP ENDFLD	/REDUNDANT VARIABLE
	AND L557S	/(577777
	XOR LACLIT	/SET MULTIPLE DEFINITION FLAG
	DAC* MRGSAV
	LAC AD08	/PACKS
	JMS MDER	/PRINT MULTIPLE DEFINITION
	JMP ENDFLD
	.TITLE BUILD OUTPUT VALUES
/
/
/END OF LINE (OR WORD) PROCESSING
/
ENDLNE	LAC NDIL	/ANY DATA IN LINE
	SNA		/YES IF ZERO.
	JMP DATAIN
	JMS CKSEMI
	JMP TAGCOM
	JMP SCNTAG
DATAIN	LAC CONDSW	/CONDITIONAL SECTION
	SNA		/YES
	JMP ENDLNA
	JMS SCNEND	/SCAN TO STATEMENT END
	DZM ERRORT	/TAG ERROR FALG MAY BE ON.
	DZM ERRORQ
	JMS CKSEMI	/;?
	SKP
	JMP SCNTAG	/NEXT TAG FIELD
	DZM STOPPER
	JMP TAGCOM+2
ENDLNA	LAC IFSW	/.IF SWITCH?
	SZA
	JMP IFRET	/RETURN TO .IF RTNE
	LAW -2		/IF AREL > 1
	TAD AREL	/FLAG AS POSSIBLE
	SPA		/RELOCATION ERROR
	JMP ARELOK
	LAC L1
	DAC AREL
	SET ERRORR	/R TO FLAGWORD
ARELOK	LAC ENDSW	/PASS 2 .END
	SNA		/YES
	JMP CKLOC
KON001	LAC FLDVAL	/SAVE END
	DAC ENDVAL
	JMP DACWD
CKLOC	LAC LOCSW	/.LOC
	SNA		/YES
	JMP CKFTXT	/NO
	LAC FLDVAL
	DAC PC		/REPLACES PC
	LAC AREL	/SET SUCCEEDING
	SZA		/INSTRUCTIONS TO SAME
	.ENDC
	.ENDC
	CLC		/RELOCATION AS .LOC OPERAND
	DAC SYMTYP
	JMP OUTPUT
	.EJECT
/CHECK FOR TEXT LINE
/
CKFTXT	LAC TEXTSW
	SNA
	JMP CKLFP
	LAC AD09	/TEXT LOCATION - TXTBF
	DAC TXTLOC
	LAC TXTBF
	DAC WRDVAL
	JMP CKFTG	/CHECK FOR TAG
CKLFP	LAC SZESW	/.SIZE
	SNA
	JMP CKLFP2
	DZM SZESW
	LAC SYMSAV
	SPA
	LAC L1
	DAC AREL
	LAC PRGSZE	/PICK UP PROG SIZE
	DAC WRDVAL
	DZM BITS	/0 = 15 BITS, -2 = 13 BITS
	JMP CKFTG	/CHECK FOR TAG
CKLFP2	JMS LL13	/13 BITS/12 BITS ASSUMED.
	LAC FLDSW
	SNA
	JMP CKLFP5
	LAC OPVAL
	SZA
	JMP WRDEVL	/COMBINE OPERATOR AND OPERAND AS 13-BIT RELOC.
	LAC NULOPF 	/IF THIS SWITCH IS ON, (.DSA) MAKE IT 15-BIT RELOC.
	SNA
	JMP WRDEVL
	DZM FLDSW
CKLFP5	DZM BITS	/FLDSW=0 15-BIT RELOC IF NO OPERAND.
CKLFPM	LAC FLDVAL
	JMP DACWD
	.TITLE FINAL OUTPUT WORD EVALUATOR.
/
/
/COMPUTE THE INSTRUCTION WORD VALUE BY COMBINING
/THE OP AND THE ADDRESS FIELD VALUES. THERE ARE MANY
/OD RESTRICTIONS THAT HAVE TO BE CHECKED
/IF THE OPERATOR IS A MEMORY REFERENCING INSTRUCTION.
/THE PDP-15 INSTRUCTIONS THAT TAKE IMMEDIATE
/NINE BIT OPERANDS ARE HANDLED FIRST.
/
WRDEVL=.
	.IFUND %PDP9
	LAC OPVAL	/OPERATION FIELD VALUE.
	DZM PCIMAG
	SAD AACI	/AAC?
	JMP STRIP9
	SAD AXRI	/AXR?
	JMP STRIP9
	SAD AXSI	/AXS?
	JMP STRIP9
	JMP NOT9OP	/NOT A 9-BIT OPERATOR
STRIP9	SET NINEOP	/STRIP LEFT MOST 9-BITS FROM
	LAC PCIMAG
	SZA
	SET ERRORL
	LAC AREL	/THE OPERAND VALUE BEFORE
	DAC ERRORR
	LAC L37S
	SKP
	.ENDC
NOT9OP	LAC L147S
	AND FLDVAL
	TAD OPVAL	/(NOT A 9-BIT OPERATOR).
DACWD	DAC WRDVAL
/THE OPERATOR AND OPERAND VALUES HAVE BEEN COMBINED
/AND ARE IN THE BUILDER WORD-WRDVAL-. MOST OF THE
/FOLLOWING CODE WILL DEAL WITH ERROR CHECKING. BEFORE
/THE ERROR CHECKING THOUGH, MAKE SURE THAT THERE IS
/AN OPERAND.
/
	LAC FLDSW	/FIELD SWITCH (0=OPERATOR
	SNA!CLL		/NOT 0=OPERAND.)
	JMP LITRLS	/NO ADDRESS VALUE.
	LAC OPVAL	/IF THE OP VALUE IS A 0,
	AND NOPLIT
	SZA		/ITS EITHER A CAL OR A USER
	JMP NOTCAL	/SYMBOL.
	.EJECT
/THE OP IS A CAL. INSURE THAT THE COMBINATION OF
/OPVAL AND FLDVAL DID NOT PRODUCE A NON-CAL
/VALUE.
/
	LAC WRDVAL
	AND NOPLIT
	SZA
	SET ERRORE
	LAC INDXSW
	DAC ERRORX
	LAC DIRASW	/BANK OR PAGE MODE?
	SZA
	JMP LITRLS	/BANK KEEP 13 BITS.
	LAC FLDVAL
	AND L47S	/PAGE..KEEP 12 BITS ONLY.
	TAD OPVAL
	DAC WRDVAL
	JMP LITRLS
/AT THIS POINT WE KNOW THERE IS NON 0 OPERATOR AND
/AN OPERAND.
/WE CAN DETERMINE WHETHER OR NOT THE OPERATOR IS A
/MEMORY REFERENCE BY ADDING 140000 TO IT. ANY INSTRUCTION
/GREATER THAN 60 WILL CAUSE AN OVERFLOW. IF THE
/INSTRUCTION THAT CAUSED THE OVERFLOW IS A LAW OR
/A NINE-BIT INSTRUCTION, ITS OK, BUT THE OPERAND
/MUST NOT BE RELOCATABLE OR USE THE INDEX REGISTER.
/
NOTCAL	TAD DZMLIT	/ADD 140000 TO OPVAL.
	SML		/NOT A MEMORY REF.
	JMP LITRET	/INSTN IS A MEM REF.
	.IFUND %PDP9
	LAC INDXSW	/CHECK FOR INDEX REGISTER.
	DAC ERRORX
	.ENDC
	LAC OPVAL	/LAW?
	SAD LAWLIT	/YES-CHECK OPERAND FOR POSSIBLE
	JMP CKFER	/ERRONEOUS RESULTS.
	AND NOPLIT	/EAE?
	SAD EAELIT
	JMP EAENEG	/YES..ACCEPT ANY OPERAND
	.IFUND %PDP9
	LAC NINEOP	/CHECK FOR LAW ON 9-BIT OP.
	SZA		/NO-CHECK FOR LAW
	JMP CKFER-1	/CHECK 9-BIT ADDRESS
	.ENDC
	JMP LITRLS
EAENEG	LAC FLDVAL	/ADD ALL 18 BIT OF OPERAND TO EPERATOR
	TAD OPVAL	/WHEN PROCESSING AN EAE OP.
	DAC WRDVAL
	AND NOPLIT
	SAD EAELIT	/WAS THE OPERATOR LOST?
	JMP LITRLS	/NO IT 640000.
	SET ERRORE	/YES ITS OTHER THAN AN EAE.
	JMP LITRLS
LITRET=.
	LAC K10000	/BIT 5
	JMS GETBOP	/GET PAGE BIT RESULT
	LAC INDXSW	/WAS THE INDEX REGISTER USED?
	SNA		/YES
	JMP NOUSEX	/NO
	LAC BPXRES	/IS THE PAGE BIT RESULT OK?
	SNA		/YES
	JMP PGOKX	/YES..MAKE SURE BIT IS ON.
	LAC BOPADR	/IF THE ADDR PAGE BIT IS ON ITS 
	SZA		/PAGE ERROR('B')
	SET ERRORB	/(LAC 0,X TO LAC 7777,X)=OK ANY PAGE.
PGOKX	LAC K10000	/TURN ON BIT 5 OF WRDVAL.
	JMS PAGBIT	/INDEX BIT IS ON
	JMP BNKTST+2	/WAS XORED WITH X.
NOUSEX	LAC DIRASW	/CURRENTLY PDP-15 MODE?
	SZA		/YES
	JMP BNKTST	/NO..CHECK FOR BANK ERROR
	LAC BOPPC
	SZA!CLA
	JMS PAGBIT	/IF PC BIT BIT 5 IS OFF TURN OFF ARG.
	LAC BPXRES	/IS THE PAGE BIT RESULT OK(0)?
	SZA
	JMS CKAUTO	/NO CHECK FOR LAC* 10 TO 17
	JMP BNKTST+2	/TEST ALL 3 ADDR BITS.
/IF THE PROGRAM IS RELOCATABLE THE BANK BIT CANNOT
/BE ON. IF ITS ABSOLUTE AND THE BANK BITS ARE ON, THE
/BANK BITS MUST EQUAL THE PC BANK BITS.
/
BNKTST	LAC L64Z	/BANK BITS 3 AND 4
	SKP
	LAC (70000
	.ENDC
	JMS GETBOP
	LAC BPXRES	/ARE BANK BITS OK?
	SNA
	JMP BIT012	/YES..CHECK BITS 0,1,2 LAST.
	LAC BOPADR	/NO...WERE THE ADDR BITS AT FAULT?
	SZA		/IF 0 IT MIGHT BO LAC 0,X OR
	JMP BNKERR	/LAC* 10 THRU 17.
	LAC INDXSW
	SNA
	JMS CKAUTO
BIT012	LAC IOTLIT	/CHECK BITS 0,1 AND 2.
	AND FLDVAL
	SZA
BNKERR	SET ERRORB
	JMP LITRLS
/INPUT TO THIS SUBROUTINE IS THE 'AND' AND 'XOR' VALUE
/FOR LOOKING AT CERTAIN BITS IN THE PC AND THE
/ADDRESS VALUE.
/
GETBOP	0
	DAC ANDXOR	/SAVE 'AND-XOR' VALUE
	AND PC
	DAC BOPPC	/SAVE BANK OR PAGE BITS OF PC
	LAC FLDVAL
	AND ANDXOR
	DAC BOPADR	/SAVE BANK OR PAGE BITS OF ADR VALUE.
	XOR BOPPC
	DAC BPXRES	/RESULT
	JMP* GETBOP
/INPUT TO THIS SUBROUTINE IS IN THE AC
/THIS ROUTINE PERFORMS AN OPERATION ON THE
/PAGE BIT OF WRDEVL. (CLEAR OR SET IT)
PAGBIT	0
	DAC ANDXOR	/SAVE VALUE TO ADD TO WRDVAL
	LAW 7777
	AND WRDVAL
	TAD ANDXOR	/SET PAGE BIT OR LEAVE IT 0.
	DAC WRDVAL
	JMP* PAGBIT
/THIS SUBROUTINE CHECKS FOR AN AUTOINDEX REG.
/
CKAUTO	0
	LAC OPVAL
	AND L20000	/INDIRECT BIT
	SNA
	JMP CKBERR
	LAC FLDVAL
	TAD L570S	/777770
	SPA
	JMP CKBERR
	LAC FLDVAL
	TAD (-17
	SZA!SMA
CKBERR	SET ERRORB
	JMP* CKAUTO
/ALL THE BITS (0-4(5)). IF ANY OF THE LOW ORDER
/BITS ARE ON, THEY BETTER ALL BE ON (NEGATIVE).
/
	LAW 17000	/NINE-BIT OP
/THE NINEBIT OPS AND THE LAW INSTRUCTION ARE SPECIAL CASES.
/THE USER MIGHT HAVE A PC OF 30000 AND A LAW 37777 WITH
/THE DESIRED RESULT BEING 777777. IF THE PC BITS MATCH ITS
/OK. IF THE PC BIT(S) ARE OFF AND THE ADDRESS BITS ARE
/ON ITS AN ERROR.
CKFER	DAC OUTFLG
	LAC L64Z	/BITS 3 AND 4 ONLY.
	JMS GETBOP
	LAC BOPADR	/IF ADDRESS BITS ARE OFF THE WORD IS OK.
	SNA
	JMP CKOKPC
	LAC BPXRES	/ARE PC AND ADDRESS PC BIT EQUAL?
	SZA		/YES DELETE ADDRESS PC BITS.
	JMP CKOKPC	/NO..GO THROUGH TEST TO PRODUCE .E. ERROR.
	LAC FLDVAL
	AND L147S	/KEEP BITS 5-17 ONLY.
	SKP
CKOKPC	LAC FLDVAL
	AND OUTFLG
	SAD OUTFLG
	JMP LITRLS	/0 ITS AN N-ERROR(NUMERIC VALUE ERROR)
	SZA		/
	SET ERRORE	/COMBINATION OF OPERATOR
	.TITLE LITERAL PROCESSOR
/
/LITERALS ARE PROCESSED  DIFFERENTLY FOR  PASS1 AND PASS2.
/A THREE WORD ENTRY IS REQUIRED IN THE RUST(RESIDENT UST)FOR 
/EVERY UNIQUE LITERAL.A LITERAL IS UNIQUE IF THE OCTAL VALUES ARE
/DIFFERENT,THE RELOCATION CODES ARE DIFF, OR IF ITS NOT COMPLETELY
/DEFINED.THE THREE WORDS ARE BUILT UP AT SQZOUT-SQZOUT+2.
/THEY ARE AS FOLLOWS:	WORD1	LITERAL COUNT
/			WORD2	-1 IF NOT COMP DEFINED.
/				OR(IF DEF) 0=NO RELOCATION
/					   1=REL TO 13(12)BITS
/					   2=REL TO 15 BITS
/			WORD3	OCTAL VALUE IF DEF.
/				PC IF NOT DEFINED
/IF A LITERAL IS NOT COMPLETELY DEFINED IT IS STORED WITH THE PC AS ITS
/VALUE.AN UNDEFINED SYMBOL USED IN A LITERAL WILL CAUSE A WORD TO BE 
/ALLOCATED  EVERY TIME ITS USED.HENCE LAC (A; LAC (A
/LAC (A (CR)  WILL CAUSE THREE WORDS TO BE SAVED . 
/FOR THIS REASON IT IS LIKELY THAT THE NUMBER OF LITERALS IN PASS1
/WILL NOT EQUAL THAT IN PASS2( THE SYM WOULD BE DEFINEDIN PASS2).
/
LITRLS	LAC LITSW	/IS THERE A LIT ON THIS LINE?
	SNA		/YES
	JMP CKXDSA	/NO
	DZM LITSW
	LAC LITCTR
	DAC SQZOUT
	LAC WRDVAL
	DAC SQZOUT+2	/PICK UP LITERAL VALUE
	DZM SQZOUT+1	/ASSUME NO RELOCATION
	LAC AREL	/GET RELOCATION
	SNA
	JMP TSTPAS
	ISZ SQZOUT+1	/SET LIT 13(OR 12)-BIT RELOCATABLE
	LAC BITS		/SHOULD IT BE 15-BIT REL?
	SMA
	ISZ SQZOUT+1	/REL 15 BITS
TSTPAS	XCT PASSNO
	SKP		/PASS1 
	JMP LPROC2	/GO TO PASS2 PROCESSING.
/PASS1 LITERAL PROCESSING.
KON002	LAC NCD		/IS THE LIT COMPLETELY DEFINED?
	SZA!CLC		/YES..USE THE OCTAL WORD VALUES.
	JMP NCDP1	/NO..INSERT PC AS WORD3
	LAC LITCTR	/IS IT THE FIRST ENTRY
	SZA		/YES
	JMP RDNCK	/NO, SEE IF IN TABLE
	JMP LITMRG
NCDP1	DAC SQZOUT+1	/-1 FOR NOT COMP DEFINED
	LAC PC		/REFERENCING LOCATION USED INSTEAD OF VALUE.
	DAC SQZOUT+2
LITMRG	JMS MLITER
	JMP CKFTG
/CHECK IF LITERAL IS ALREADY IN TABLE
/
RDNCK	JMS LITBEG	/SET AUTO 10 TO PNT TO WORD1
CKWRD2=.
	.IFDEF PAGPOS
	XCT EXPAGE
	JMS TSTXLT
	.ENDC
	LAC* 12		/CHECK WORD2 FIRST
	SAD SQZOUT+1
	JMP CKWRD3	/WORD2 OF BOTH ARE EQ. NOE TRY WORD3.
	IDX* L12	/NOT EQUAL ADJUST POINTER.
LTEND1	IDX* L12
	ISZ CTR		/HAS THE WHOLE TABLE BEEN SCANNED?
	JMP CKWRD2	/NO TRY THE NEXT ONE
	JMP LITMRG	/YES..MERGE IT IN
CKWRD3	LAC* 12
	SAD SQZOUT+2
	JMP CKFTG	/ITS FOUND, NO MORE PROC REQ IN PASS1.
	JMP LTEND1	/NOT EQ TEST FOR END
/MERGE THE LIT AT SQZOUT-SQZOUT+2 INTO RUST. USE THE SRCUST ROUTINE TO
/FIND A PLACE FOR IT. THIS SUBR. IS USED BY BOTH PASSES AND IS THE ONLY
/PLACE THE THE LITERAL COUNT IS EVER INCREMENTED.
/
MLITER	0
	LAC L2
	JMS SRCUST	/SET UP FOR MERGE.
NOPLIT	NOP
	JMS MERGE
	INC LITCTR
	JMS SUB1		/DON'T COUNT LITS AS USER SYMBOLS
	DAC USTSZE
	JMP* MLITER
LITBEG	0
	LAC LITCTR
	JMS TWOS
	DAC CTR
	LAC BEGUST
	DAC* L12
	JMP* LITBEG
	.TITLE PASS 2 LITERAL PROCESSING
/
/
LPROC2	LAC LITCTR
	SNA
	JMP LNOTIN
	JMS LITBEG	/SET TO BEGINNING OF TABLE
LITNXT=.
	.IFDEF PAGPOS
	XCT EXPAGE
	JMS TSTXLT
	.ENDC
	LAC* 12
	DAC LWORD2	/SAVE RELOC BITS OF THE LITERAL.
	RCL		/PUT DEFINED/UNDEFINED BIT IN LINK
	LAC* 12
	IDX* L12	/INC PTR TO WORD1 OF NEXT LIT
	DAC LWORD3
	SNL		/WAS THIS LIT DEF IN PASS1?
	JMP DEFYES	/YES..GO TEST WORD3 VALUE
	SAD PC		/NO.. TEST THE PC VALUE.
	JMP DEFNO	/THIS IS THE ONE.
LTEND2	ISZ CTR		/NOT FOUND YET ,HAS THE WHOLE TABLE BEEN CHECKED?
	JMP LITNXT	/NO..GET THE NEXT LIT.
/
/THE LITERAL IS NOT IN THE TABLE. PUT IT IN IF THE MAX HASN'T BEEN
/REACHED.
/
LNOTIN	LAC MAXLIT	/MAXIMUM NO OF LITS IN THIS SECTION.
	JMS TWOS
	TAD LITCTR	/SUB FROM PASS2 COUNT.
	SMA		/ITS OK IF NEG. GO AHEAD INSERT IT.
	JMP ERRLIT	/NO.. IT WON'T FIT FLAG IT.
	JMS MLITER	/MERGE IT IN
	JMP LPROC2	/START OVER WITH PASS2 CODE.
ERRLIT	SET ERRORL
	SET ERRORP	/LITERAL PHASE ERROR.
	DZM WRDVAL
	JMP CKFTG	/WIPE OUT THE ENTIRE WORD.
/AT DEFYES THE LIT WAS DEFINED IN PASS1(WORD2 POSITIVE).
/
DEFYES	SAD SQZOUT+2
	SKP		/WORD3 OF BOTH ARE EQUAL,CK REL BITS.
	JMP LTEND2
	.EJECT
	LAC LWORD2
	SAD SQZOUT+1
	JMP USELIT	/THE REL BITS ARE EQ  USE THIS LIT
	JMP LTEND2
/AT DEFNO A LITERAL IS IN THAT WAS NOT DEFINED IN PASS1.
/
DEFNO	JMS SETSQZ	/SET UP FOR MOVING IN DEFINED VALUES
	JMS MRGSYM
USELIT	JMS SETSQZ	/AC HAS LIT NUMBER.
	TAD LITLOC	/ADDED TO LITERAL STARTING
	DAC FLDVAL
	DAC WRDVAL	/LOCATION
	DZM AREL
	LAC SYMSAV	/LITERAL RELOCATABILITY
	SZA
	ISZ AREL
	DZM BITS	/15-BIT RELOCATION FOR ALL LITERALS.
	LAC OPSVSW	/IF NO OPERATOR WAS SAVED, GO TO THE
	SNA		/TAG PROCESSING AREA.
	JMP CKXDSA
	LAC NULOPF	/WAS IT (.DSA (LAC ADDR) OR (.DSA (ADDR))?
	SZA
	JMP CKXDSA
	JMS LL13	/RELOC TO 13 BITS.
	LAC OPSAV
	DAC OPVAL
	SET FLDSW
	.IFUND %PDP9
	DZM INDXSW
	SET PCIMAG	/USE AS FLAG FOR AAX (12
	JMP WRDEVL+2
	.ENDC
	.IFDEF %PDP9
	JMP WRDEVL
	.ENDC
SETSQZ	0
	LAW -3
	TAD* L12	/12 IS POINTING TO WORD1 OF NEXT LIT.
	DAC MRGLOC	/ADJUST TO THIS LIT
	LAC* MRGLOC	/USE  LIT COUNT VALUE TO
	DAC SQZOUT	/BUILD LITERAL LOCATION
	JMP* SETSQZ
	.EJECT
/
/THE LITERAL TABLE IS AT THE BOTTOM OF THE RESIDENT UST.
/ADJUST THE BOTTOM SO THAT THE LITERAL TABLE IS NO LONGER
/POINTED TO(EXIT WITH TRUE SYM PTR IN AC)
/
DROPLT	0
	LAC LITCTR
	RCL
	TAD LITCTR
	TAD BEGUST
	.IFDEF PAGPOS
	XCT EXPAGE
	JMP DRPLTX
	.ENDC
DROPLA	DAC BEGUST
	DZM LITCTR
	JMP* DROPLT
/IF THE INDEX REGISTER SWITCH IS ON, TURN ON BIT 5.
/THE INSTRUCTION MUST HAVE BEEN (.DSA ADDR,X) OR ((TAB) ADDR,X).
/USING THE INDEX REGISTER WITH THIS TYPE OF INSTRUCTION IS ILLEGAL
/AND USELESS. TURN ON BIT 5 FOR CONSISTENCY.
/
CKXDSA=.		/INDEX REGISTER SWITCH ON?
	.IFUND %PDP9
	LAC INDXSW
	SNA		/YES..ITS AN ERROR
	JMP CKFTG	/NO..CHECK THE TAG.
	LAC FLDSW	/DON'T FLAG IT IF NOT
	SZA		/OPERATOR FIELD.
	JMP CKFTG
	SET ERRORX
	LAC K10000	/TURN ON BIT 5.
	JMS PAGBIT
	.ENDC
	.TITLE CHECK FOR A TAG AND BUILD PRINTING IMAGES
/
/
/END OF LITERAL PROCESSING
/
CKFTG	LAC PACKT	/WAS THERE A TAG
	SZA		/NO
	JMP PRTGPA	/YES
	LAC PASW	/IS LINE A PARAMETER ASSIGNMENT ?
	SZA
FLAGPA	SET ERRORA	/A TO FLAG WORD
	JMP OUTPUT
	.IFUND %BFA
MODETR	0
	LAC BMODE
	SZA
	IDX MODETR
	JMP* MODETR
TMODE	0
	LAC BMODE	/TEST BINARY MODE
	SNA		/0=RELOCATABLE BINARY
	INC TMODE	/RETURN TO PC+1 IF REL
	LAC L40		/AND PC IF ABS-FULL.
	JMP* TMODE
	.ENDC
PCIMAG	0		/OUTPUT THE 5 CHAR PC IMAGE AND /CHAR TYPE
	LAW -5		/5 CHAR OCTAL PC.
	JMS MOVBIN
	LAC PC
	JMS PKBLNK	/1 SPACE BEFORE THE PC TYPE
	.IFUND %BFA
	JMS TMODE	/BUILD LOCATION TYPE.
	JMP TLOCR+1	/FULL OR ABS =3 SPACES.
	.ENDC
	LAC SYMTYP	/RELOC PROG WITH REL TAG = R.
	SPA
	JMP TLOCR
	LAC L101	/A
	SKP
TLOCR	LAC L122	/R
	JMS PACK57
	JMS PKBLNK
	JMP* PCIMAG	/BUILD OBJECT CODE.
	.EJECT
GOBJC	0
	LAC BSSW	/IF ITS THE BLOCK PSEUDO-OP, JUST THE TYPE
	SZA
	JMP GAD6SP
	LAW -6
	JMS MOVBIN
	LAC WRDVAL
	JMP GADTYP
GAD6SP	LAW -6		/SIX BLANKS INSTEAD OF TYPE.
	JMS SPACKS
GADTYP	JMS PKBLNK	/1 SPACE BEFORE ADDR. TYPE.
	.IFUND %BFA
	JMS TMODE
	JMP NABS+1
	.ENDC
	LAC EXTSW	/CHECK FOR VIRTUAL
	SNA
	JMP NNOEXT
	LAC L105	/E
	JMP NABS+1
NNOEXT	LAC AREL
	SZA
	JMP NABS
LL101	LAC L101	/A
	JMP NABS+1
NABS	LAC L122	/R
	JMS PACK57
	JMS PKBLNK
	JMP* GOBJC	/EXIT
	.EJECT
/INITIALIZE THE AREA TO RECEIVE THE OUTPUT LINE.
/THE TOP OF THIS ROUTINE ASSUMES THIS IS A SOURCE LINE.
/IF THE N SWITCH IS ON, OUTPUT THE FOUR CHARACTER DECIMAL
/SEQUENCE NUMBER AND A TAB CHARACTER. IF ITS OFF OUTPUT THE
/ERROR FLAGS.
/
SEQERF	0
	JMS P57INT	/INIT COUNTERS AND 5/7 POINTER.
	LAC EXPSW	/IF THIS IS A MACRO EXPANSION OR IF
	TAD STOPPER
	SZA		/THE MULTI WORD STOPPER SWITCH IS ON
	JMP OUTERB	/DON'T NUMBER THE LINE.
	INC OUTLCT	/OUTPUT SOURCE LINE COUNT.
	JMS BINDEC	/BINARY TO DECIMAL.
	LAC OUTLCT	/ARG TO BINDEC.
LAWM4	LAW -4
	JMS MOVEPK	/PACK THE DECIMAL #
	LAC AD511	/DECOUT+1=DONOR ADDRESS-1
	LAC PK57AD	/PRTBUF=RECEIVING ADDRESS(FROM P57INT)
	JMP OUTSPL	/SEQUENCE # IS OUT.
/THE 'N' SWITCH IS ON BUT THIS IS NOT A SOURCE LINE.
/PRINT 4 SPACES INSTEAD.
/
OUTERB	LAW -4
	JMS SPACKS
OUTSPL	JMS P57TAB	/CHAR OF DOUBLE WORD
/
/OUTPUT THE ERROR FLAGS.
/THIS ROUTINE MUST OUTPUT 4 CHARACTERS, WHETHER OR NOT
/4 ERRORS WERE PRODUCED. SPACES WILL FILL THE AREA IF NONE
/ARE ON OR NOT 4 ARE ON.
/
OUTERC	LAW EFLGN	/THE NUMBER OF FLAGS=ERRORX-ERRORA
	DAC CTR
	LAW -4		/PRINT FIVE CHARS (SPACES OR FLAGS).
	DAC CTRMX5
	LAC LL101	/FIRST ERROR FLAG IMAGE.
	DAC OUTFLG
	LAC EFLAGS	/POINTER TO ERRORA (TOP OF ERROR TABLE)
	DAC FLGPTR
ELUPE	LAC* FLGPTR
	SNA
	JMP NOFLGN
OUTFLG	XX
	JMS PACK57
	SET FLGSAV
	ISZ CTRMX5	/HAVE FOUR FLAGS BEEN PRINTED?
	SKP		/NO KEEP GOING
	JMP* SEQERF	/YES...EXIT.
NOFLGN	IDX OUTFLG
	IDX FLGPTR
	ISZ CTR
	JMP ELUPE
OUTSP5	LAC CTRMX5	/OUTPUT FILLER SPACES.
	JMS SPACKS
	JMP* SEQERF
OUT3EX	0
	.IFUND %BFA
	LAC RPTSW	/3 MORE CHRS TO PRINT LINE.
	SNA		/*R?
	JMP OUTGAS	/NO..TEST FOR *G.
	LAC STOPPER	/IF THE STOPPER IS OFF DON'T
	SNA		/OUTPUT THE *R THIS TIME.
	JMP OUTBLK	/OUTPUT BLANKS INSTEAD.
	JMS SPOEX
	LAC L122	/OUTPUT SPECIAL EXTERSION *R
	.ENDC
OUTGAS	LAC EXPSW
	SNA
	JMP OUTLAS
	JMS SPOEX
	LAC L107	/OUTPUT SPECIAL EXTENSION *G
OUTLAS	LAC LITSW	/IS THIS A LITERAL(END OF PASS2 PRINTOUT)?
	SNA		/YES..OUTPUT *L
	JMP OUTEAS
	JMS SPOEX
	LAC L114	/*L
OUTEAS	LAC EXLTSW	/TEST FOR EXTERNAL SYMBOL.
	SNA
	JMP OUTBLK	/OUTPUT BLANKS, NO EXTENSION
	JMS SPOEX
	LAC L105	/*E
OUTBLK	JMS SPACE2
/
/IF THE MULTI WORD STOPPER IS ON OUTPUT A CR INSTEAD
/OF THE LAST BLANK CHR.
/
OUTLST	LAC STOPPER
	SZA
	JMS P57K15	/THE BLANK AFTER THE CR WILL BE IGNORED
	JMS PKBLNK
	JMP* OUT3EX
SPOEX	0
	LAC L52		/OUTPUT AN ASTERISK
	JMS PACK57
	XCT* SPOEX
	JMS PACK57
	JMP OUTLST
	.TITLE ERRORS AND OBJECT CODE GENERATOR.
/
/
/ERROR FLAG TABLE
/
L101	101	/A
L102	102	/B
L104	104	/D
L105	105	/E
L106	106	/F
L111	111	/I
L114	114	/L
L115	115	/M
L116	116	/N
L120	120	/P
	121	/Q
L122	122	/R
L123	123	/S
L124	124	/-T- INSTEAD OF V.
L125	125	/U
	127	/W
ERTBL	130	/X
L117	117	/-O- INSTEAD OF F.
L103	103	/C
/
/
/ A NEGATIVE .LOC OR .BLOCK IS ILLEGAL.
/
OUTPUT	LAC BSSW	/.BLOCK SWITCH.
	TAD LOCSW	/.LOC SWITCH.
	SNA
	JMP NOTBLO
	LAC WRDVAL
	SMA
	JMP NOTBLO
	DZM BSSW	/CLEAR LOCSW AND BSSW
	DZM LOCSW
/
NOTBLO	LAC TSWCH	/TABLE OF CONTENT?
	SZA
	JMP T.OUT
	XCT PASSNO	/WHICH PASS1
	JMP SHRK
T.OUT	LAC AD222	/ARG TO SEQERF
	JMS SEQERF	/SEQUENCE # AND ERROR FLAGS.
/
/BUILD THE LOCATION IMAGE IF THIS IS NOT A PSEUDO-OP,
/PARAMETER ASSIGNMENT OR END.
	LAC PASW	/P/A
	TAD ENDSW
	SZA
	JMP PC7SP
	JMS PCIMAG	/5 CHAR PC, 1 SPACE BEFORE PC TYPE AND 1 AFTER.
	JMP PCLSP	/LAST SPACE AFTER PC TYPE
L570S=.
PC7SP	LAW -10
	JMS SPACKS	/OUTPUT 8 SPACES.
/BUILD THE OBJECT CODE IMAGES IF THIS LINE HAS ANY.
/
PCLSP=.
	LAC LOCSW	/BYPASS IF A MACRO CALL OR A LOC
	TAD MCLSW	/OUTPUT 8 SPACES INSTEAD.
	SZA
	JMP NOBJC	/NO OBJECT CODE, 8 SPACES.
	JMS GOBJC
	JMP OBJLST	/LAST BLANK AFTER OBJECT CODE TYPE.
NOBJC	LAW -11
	JMS SPACKS
/OUTPUT 3 MORE CHAR BEFORE THE SOURCE LINE.
/
OBJLST	JMS OUT3EX	/3 BLANKS,*G,*R,*L,*E
			/COMPUTE TOP OF BUFFER
/THE LINE IS NOW COMPLETE EXCEPT FOR
/USER SOURCE LINE IMAGE AND THE STOPPER
/COMPUTE THE OUTPUT BUFFER POINTER AND USE IT
/AS AN ARGUMENT TO THE PRINT SUBROUTINE.
SHRK	JMS SHRINK
	TAD MOD33B
/***
/TEST FOR TEXT, RPT, ETC.
/***
OUTPC	LAC ENDSW	/.END
	SZA
	JMP BKTEND
	LAC MCLSW	/MACRO CALL
	SZA
	JMP MCLH
	LAC BSSW	/WAS LINE .BLOCK
	SNA		/YES
	JMP INCPC2
	LAC PC		/ADD .BLOCK VALUE TO PC
	TAD WRDVAL
	DAC PC
	SET LASW
	JMS CKFLLB
	.IFUND %BFA
	JMS BLDBIN	/BUILD BINARY OUTPUT
	.ENDC
	DZM BSSW
	JMP CKMWD
INCPC2	LAC LOCSW	/CHECK FOR .LOC
	SNA
	JMP INCPC1
	ISZ LASW
	JMS CKFLLB	/LINK LOADER RTNE
	.IFUND %BFA
	JMS BLDBIN	/BUILD BINARY OUTPUT
	.ENDC
	DZM LOCSW
	JMP CKMWD
	.ENDC
	.ENDC
INCPC1	LAC PASW	/IS LINE A P/A
	SZA		/NO
	JMP CKMWD	/YES
INCBIN	JMS CKFLLB
	IFUNA JMS,BLDBIN
	ISZ PC		/UPDATE PC BY 1
	LAC TEXTSW	/TEXT SWITCH ON
	SNA		/YES
	.IFDEF %BFA
CKRPT=CKMWD
	.ENDC
	JMP CKRPT
	ISZ TXTCTR	/FINISHED OUTPUTTING IT
	SKP		/NO
	JMP TXTND
	ISZ TXTLOC	/UPDATE FOR NEXT TEXT WORD
	LAC* TXTLOC
	DAC WRDVAL
SETTER	SET STOPPER	/CR TO MULTI WORD STOPPER
	JMP OUTPUT	/OUTPUT IT
TXTND	DZM TEXTSW	/RESET SWITCH
	.IFUND %BFA
CKRPT=.
	LAC RPTSW	/REPEAT ON
	SNA		/YES
	JMP CKMWD	/NO
/THIS LINE IS PART OF A .REPT PSEUDO OP EXPANSION.
/IF THE 'G' SWITCH WAS USED, DO NOT PRINT THIS LINE.
/THE WRDVAL MUST BE OUTPUT TO THE BINARY FILE
/REGARDLESS OF THE SWITCH THAT WAS USED.
/
	LAC WRDVAL
	TAD RPTINC	/ADD INCREMENT TO
	DAC WRDVAL	/CURRENT VALUE
	ISZ RPTCTR	/FINISHED.REPT?
	JMP SETTER
RPTND	DZM RPTSW	/RESET SWITCH
	.ENDC
CKMWD	LAC PC
	CMA
	TAD CHVPC
	SMA
	JMP CKMWD1
	LAC PC		/CURRENT HIGH
	DAC CHVPC	/VALUE OF PC
CKMWD1	JMS CKSEMI	/CHECK FOR MULTIWORD LINE (;)?
	JMP NXTLNE	/NO..GET ANOTHER LINE.
	SET STOPPER	/SET MULTIWORD LINE STOPPER SWITCH
	JMP SCNTAG	/SCAN TAG FIELD
	.TITLE TAG PROCESSOR
/
/PROCESSING OF TAG OR PARAMETER ASSIGNMENT
/
/THE CHARACTER -X- CANNOT BE USED AS A DIRECT ASSIGNMENT
/OR AS A TAG.(TAG ERROR)
/
/
PRTGPA	LAC CONDSW	/IGNORE TAG IF IN UNSATISFIED
	SZA		/CONDITIONAL AREA.
	JMP OUTPUT
/
	LAC PACKT
	DZM TEMP00
	.IFUND %PDP9
	SAD XREG
	SKP
	JMP .+3		/OK CONTINUE PROCESSING TAG.
	SET ERRORT	/TAG ERROR.
	JMP OUTPUT	/IGNORE TAG.
	.ENDC
	LAC LOCVAR	/IS THIS A # TAG IN A LOCAL AREA?
	SNA		/IF SO DO NOT TURN ON TAGSW(FAKEOUT MERGE).
	SET TAGSW	/TURN ON TAG SWITCH
	LAC AD06	/PACKT
	JMS SQOZE	/TO SQOZED FORM
	LAC PASW	/IS IT A PARAMETER ASSIGNMENT
	SNA		/YES
	JMP PRCTAG	/NO, IT'S A TAG
/PARAMETER PROCESSING
/
	LAC WRDVAL	/STORE PARAM VALUE  FOR MERGE.
	DAC SQZOUT+2
	LAC SQZOUT	/TURN ON THE P/A BIT(BIT 0).
	AND L157S
	XOR XCTLIT
	DAC SQZOUT
	LAC AREL	/IF REL TURN ON BIT 1.
	SZA
	JMS LACSQZ	/YES..BIT 1 =1
	XCT PASSNO	/WHICH PASS 1
	SKP
	JMP TSTFOR	/
	LAC NCD		/IS P/A A FWD REF
	SNA		/YES
	JMP STLCL	/GO SET THE LOCAL BIT OF WORD2.
	DAC TEMP00
	DZM NCD
	JMP PWORD2
	.EJECT
LACSQZ	0		/SUBROUTINE TO TURN BIT 1 OF
	LAC SQZOUT	/SQZOUT ON OR OFF.
	XOR LACLIT
	DAC SQZOUT
	JMP* LACSQZ
TSTFOR	LAC ERRORF
	SZA
	JMP PWORD2
	JMP STLCL
/
/
/TAG PROCESSING
/A TAG IS IN. IT HAS BEEN CONVERTED TO RADIX 50 ALREADY. THE RADIX
/50 VALUE IS AT SQZOUT AND SQZOUT+1. STORE THE PC IN
/SQZOUT+2 TO COMPLETE THE SYMBOL (THAT IS, IT WILL HAVE A
/VALUE IN ALL THREE WORDS. TURN ON SOME OTHER BITS OF THE
/THREE WORD SET, THEN SEARCH THE USER SYMBOL TABLE
/
PRCTAG	LAC PC		/PC IS VALUE
	DAC SQZOUT+2	/FOR THE SYMBOL
	LAC SQZOUT
	AND L157S
	DAC SQZOUT	/SET ABS
	LAC SYMTYP
	SPA
	JMS LACSQZ
STLCL	LAC SQZOUT+1	/SET SYMBOL AS LOCAL
	AND L157S
	XOR XCTLIT
	DAC SQZOUT+1
/AS A RESUT OF SEARCHING THE USER SYMBOL TABLE THIS TAG IS
/EITHER FOUND OR NOT FOUND. IF ITS FOUND CHECK FOR PHASE
/ERRORS. IF ITS NOT FOUND, AND ITS NOT IN PASS 2 MERGE IT
/IN. IF ITS NOT FOUND AND IT IS PASS 2, ITS A PHASE ERROR
/(UNLESS OF COURSE THIS IS A LOCAL AREA (.LOCAL)).
/
PWORD2	LAC SYMARG
	JMS SRCUST	/SEARCH USER TABLE
	JMP TPAF	/SYMBOL IS FOUND
	XCT PASSNO
	JMP PASTG1
	XCT LOCALS	/LOCAL AREA?
	JMP PASTG1
PHASE	SET ERRORP	/P TO FLAG WORD, IGNORE IF PASS 1.
	JMP OUTPUT
PASTG1	JMS MERGE
	JMP OUTPUT
	.EJECT
/TAG OR P.A. FOUND
/
TPAF	JMS CKMAC	/IS TABLE ENTRY A MACRO
	JMP TPAF1	/NO
	SET ERRORX	/X TO FLAGWORD
	JMP OUTPUT
TPAF1	XCT PASSNO	/WHICH PASS
	SKP		/PASS 1
	JMP TPAFP2	/PASS 2
	LAC MRGLOC
	DAC MRGSAV
	JMS MRGP1	/GET 2ND WORD OF SYMBOL
	AND JMPLIT
	DAC TMP		/SAVE CONTROL BITS
	SZA
	JMP CKVRT	/CHECK FOR VIRTUAL
	LAC* MRGLOC
	SPA
	JMP INMRG
	JMS SUB1	/CHANGE TO LOCAL
	DAC UNDCTR
	JMP INMRG	/MERGE IN NEW VALUES
CKVRT	SPA
	JMP CKVART
	JMS SUB1	/VIRTUAL IN TABLE TO INTERNAL
	DAC EXTCTR
	LAC PASW	/D/A?
	SNA		/YES IF NON 0.
	JMP GLPAOK	/ITS OK CONTINUE.
	LAC TEMP00	/IS IT A FORWARD REF?IF YES TURN OFF
	SNA!CLA		/BIT 1 OF WORD2 AT SQZOUT.
GLPAOK	LAC LACLIT
	JMP MRGSCO
CKVART	JMS MRGP1	/IS ENTRY A VARIABLE
	SMA		/YES
	JMP MODCB	/NO
	LAC PASW	/IS SYMBOL A P.A.
	SZA		/NO
	JMP INMRG
	JMS SUB1	/SUBTRACT FROM VARIABLE COUNT
	DAC VARCTR	/SUB1 ARGUMENT
	LAC SQZOUT+2
	AND L57S
	XOR LACLIT	/SET MULTIPLE DEFINITION
	DAC SQZOUT+2
	LAC AD06	/PACKT
	JMS MDER	/PRINT ERROR
	JMP INMRG	/MERGE INTO SYMBOL TABLE
MODCB	LAC SQZOUT+1
	AND L157S
	XOR TMP
	DAC SQZOUT+1	/APPEND NEW CONTROL BITS
	LAC* MRGLOC	/IS TABLE SYMBOL A P/A
	SPA		/NO
	JMP INMRG	/YES
	LAC PASW	/IS CURRENT SYMBOL A P/A
	SZA		/NO
	JMP OUTPUT
	LAC* MRGSAV
	AND L557S	/(577777)
	XOR LACLIT
	DAC* MRGSAV	/FLAG SYMBOL AS A
	LAC AD06
	JMS MDER	/PRINT ERROR
	JMP OUTPUT	/MULTIPLE DEFINITION
	.TITLE TAG OR P.A. FOUND IN TABLE DURING PASS2
/
/
TPAFP2	LAC PASW	/IS CURRENT A P.A.
	SNA		/YES
	JMP CKVAR2
	LAC* MRGLOC	/IS TABLE ENTRY A PA
	SPA		/NO
	JMP MRGSMN	/YES, MERGE NEW VALUE
	JMP FLAGPA	/FLAG AS A P.A. ERROR
CKVAR2	JMS WRD3
	LAC* MRGLOC
	RAL		/CHECK FOR MULTIPLE
	SMA		/DEFINITION OF SYMBOL
	JMP CKPHSE
	SET ERRORM
	JMP OUTPUT
/CHECK PHASING
/
CKPHSE	LAC* MRGLOC
	AND L57S	/COMPARE PASS 1 (77777
	SAD PC		/AND PASS 2 VALUES
	JMP OUTPUT
	JMP PHASE	/BUILD PRINT IMAGE, P TO FLAG WORD
MRGSMN	LAC MRGLOC
	DAC TMP		/SAVE GLOBL
	IDX TMP		/INDICATOR
	LAC* TMP
	AND LACLIT
MRGSCO	XOR SQZOUT+1
	DAC SQZOUT+1
/MERGE IN NEW VALUES INTO SYMBOL TABLE
INMRG	JMS MRGSYM
	JMP OUTPUT
/CHECK SYMBOL TABLE ENTRY FOR MACRO
/
CKMAC	0
	LAC* MRGLOC
	SPA
	JMP* CKMAC	/PARAMETER ASSIGNMENT
	LAC MRGLOC
	TAD L2
	DAC TMP
	LAC* TMP
	AND JMSLIT
	SZA		/IS ENTRY A MACRO
	IDX CKMAC	/YES
	JMP* CKMAC	/NO
	.TITLE SOME PSEUDO-OP ROUTINES
/
/
.LST	LAC LSWCH	/RESET ALOPTN IF IT WAS
	DAC ALOPTN	/ORIGINALLY ON.
	DZM .NLSW
	JMP PRPOP
.NOLST	SET .NLSW	/SET SWITCH SO THAT PSEUDO-OP
	JMP PRPOP	/IS PRINTED BUT NOT SUBSEQUENT LINES.
.EJECT=.
	.IFUND %MACI
	.IFUND %BFA
	LAC ISWCH	/IGNORE EJECTS?
	SNA
	.ENDC
	.ENDC
	SET EJCTSW	/SET SWITCH
	JMP PRPOP
.OCT	SKP!CLA		/SET OCTAL RADIX
.DEC	CLC		/SET DECIMAL RADIX
	DAC RADIX
	JMP PRPOP
.LOC	SET LOCSW	/SET .LOC INDICATOR
	JMP SCNADR	/GET ITS VALUE
/NESTED .LOCAL PSEUDO-OPS DON'T MAKE SENSE ARE ILLEGAL.
.LOCAL	XCT LOCALS	/IF LOCAL SWITCH IS ALREADY ON, IGNORE
	JMP OUTERR	/THIS LINE. (NOP=LOCAL ON, SKP=OFF)
	LAC ENDUMT	/TOP OF MACRO TABLE.
	DAC TOPLUS
	DAC BOTLUS
	LAC NOPLIT	/TURN ON.
BLOCL	DAC LOCALS
	JMP PRPOP
/FLAG THIS LINE IF THE LOCAL SWITCH WAS NOT ON.
.NDLOC	XCT LOCALS	/NOP IF ON, SKIP IF OFF.
	SKP
	JMP OUTERR
	LAC SKPLIT	/TURN OFF.
	JMP BLOCL
.BLOCK	SET BSSW	/SET .BLOCK INDICATOR 
	JMP SCNOP	/GET ITS VALUE
.DSA	LAC FLDSW
	SNA
	SET NULOPF	/NULL OPFIELD
	JMP ENDFLD
.SIZE	SET SZESW	/SET SIZE SWITCH
	JMP ENDALL
	.TITLE 	.GLOBL , .EOT, .ENDC ROUTINES.
.GLOBL=.
	IFUNA JMS,TMODE,JMP,OUTERR
GETGLB	JMS ARGMNT
	JMP PRPOP
	JMP GLOBER	/NUMERICS ARE NOT ALLOWED.
	JMS USTLKP	/SEARCH USER TABLE
	JMP GBFTB	/FOUND
	XCT PASSNO
	SKP		/ITS OK PASS1.
	JMP GLOBEE	/E-ERROR NOT FOUND IN PASS2.
	LAC SQZOUT+1	/NOT FOUND
	XOR LACLIT
	DAC SQZOUT+1	/SET SYMBOL EXTERNAL
	JMS MERGE	/MERGE INTO TABLE
	INC EXTCTR	/UPDATE EXTERNAL COUNT
	JMP TGBEND
/THE GLOBL IS ALREADY IN THE UST.IF THE SYMBOL IS UNDEFINED
/SUB 1 FROM THE UNDCTR,BUT FIRST CHECK THE SPECIAL CONDITIONS.
GBFTB	LAC MRGLOC
	DAC TEMP01
	TAD L2
	DAC TEMP00
	LAC* MRGLOC	/DIRECT ASSIGNMENT?
	SPA
	JMP GLOBFF	/YES
	LAC* TEMP00	/IS IT A MACRO NAME?
	AND JMSLIT	/BIT 2 OF WORD 3
	SNA		/YES IF NON-0
	JMP GLOBOK
	SET ERRORX	/MACRO NAMES IN GLOBLS ARE NONSENSE!
	JMP TGBEND	/GO ON TO NEXT GLOBL SYMBOL
GLOBFF	IDX TEMP01	/IS IT A FORWARD REF?
	LAC* TEMP01
	AND JMPLIT
	SZA
	JMP GLOBEX	/DIR ASSIGN WITH EXTERNAL (ILLEGAL)
GLOBFX	SET ERRORF
	JMP TGBEND
GLOBEX	AND XCTLIT	/ERROR IF BIT 1 IS  ZERO
	SNA
	JMP GLOBFX	/ERROR BIT 0 IS OFF ITS A FOR REF.
	XCT PASSNO	/IF PASS1 ITS OK IF BIT 1 IS OFF.
	JMP GLOBOK	/PASS1.
	LAC* TEMP01	/IF PASS2 BIT 1 MUST BE ON OTHER-
	AND LACLIT	/WISE THERE WAS AN ERROR(F.REF.)
	SNA		/DURING PASS1
	JMP GLOBFX	/ERROR: FORWARD REF OR EXTERNAL D/A.
GLOBOK	XCT PASSNO
	SKP
	JMP TGBEND
	JMS TSTUND	/UNDEFINED?	
	SKP		/NO
	INC EXTCTR	/YES
GLBINT	LAC* MRGLOC
	AND L557S	/(577777)
	XOR LACLIT
	DAC* MRGLOC
TGBEND	JMS TKOM
	JMP GETGLB	/GET NEXT SYMBOL
GLOBER	SET ERRORS
	JMP TGBEND
GLOBEE	SET ERRORE
	JMP TGBEND
/TEST SYMBOL, IF UNDEFINED SUBTRACT 1 FROM
/COUNT.
TSTUND	0
	INC MRGLOC	/POINT TO WORD2
	LAC* MRGLOC
	AND JMPLIT
	SZA
	JMP* TSTUND
	INC TSTUND
	JMS SUB1	/SUB 1 FROM UND. COUNT.
	DAC UNDCTR
	JMP* TSTUND
.EOT	JMS PRTCOM
	SET EOTSW
	.IFUND %MACI
	LAC BNOPTN	/BINARY REQUESTED
	SZA		/NO
	JMS WAIT13	/.WAIT FOR BINARY OUTPUT DEVICE
	.ENDC
	.IFUND	RSX
	LAC MSGEOT
	JMS WRITE3
	.ENDC
	JMP NEWTAP
	.IFUND	RSX
EOTMSG	.ASCII	/ EOT/<15>
	.ENDC
LITNO	472360		/'NO'
.ENDC	LAC CONDSW	/ANY IFS OUTSTANDING
	SNA		/YES
	JMP PRPOP	/IGNORE
	ISZ IFCTR	/.IF COUNT SATISFIED
	JMP PRPOP	/NO
	JMS POPPR
	DZM CONDSW	/RESET CONDITIONAL SWITCH
	JMP CKMWD1
	.ENDC
	.TITLE		.LTORG PSEUDO-OP
/
/
	.IFUND %MACI
	.IFUND %BFA
.LTORG	LAW -7		/THE USER MAY HAVE AS MANY AS 8 LTORGS		
	TAD LORGCT	/.LTORG COUNT
	SMA!SZA
	JMP OUTERR	/MORE THAN 8 FLAG AND IGNORE IT
	INC LORGCT
	LAC PC		/COMPARE PC VALUES FOR PHASE ERRORS.
	DAC CKV15	/SAVE PASS2 PC FOR BUILDING NEW PC.
	XCT PASSNO
	JMP .LTPA1
	SAD* .LTGPT
	SKP
	SET ERRORP	/COMPAR PC
	JMS SCNEND
	JMS PRTCOM
	JMS OUTLIT	/OUTPUT THE LITERALS SO FAR
	IDX .LTGPT	/POINT TO PASS1 LIT COUNT.
	LAC* .LTGPT	/BUILD NEW PC WITH PASS1 LIT COUNT.
.LTCOM	TAD CKV15
	DAC PC
	IDX .LTGPT	/POINT TO WORD1 OF NEXT .LTORG.
	JMS SETLIT	/SET UP LITLOC,LITCTR
	JMS DROPLT	/DROP LITERAL TABLE.
	SET EXLTSW	/FORCE NEW LOAD ADDRESS.
	JMS TMODE
	JMP NOTREL
	JMS NEWLA
	SKP
NOTREL	JMS BLDBIN
	DZM EXLTSW
	JMP CKMWD
	.EJECT
/PASS 1 .LTORG PROCESSING
/
.LTPA1	DAC* .LTGPT	/SAVE THE PC (FOR PHASE CHECKING)
	IDX .LTGPT	/POINT TO WORD2(LITCNT).
	LAC LITCTR	/THE NUMBER OF LITERALS ENCOUNTERED
	DAC* .LTGPT	/SO FAR IN PASS 1
	SNA
	JMP .LTCOM
/
/IF THE T-SWITCH IS ON THE LITERAL TABLE HAS TO BE
/TAKEN INTO ACCOUNT OR THE PAGE NUMBERS WILL BE OFF
/IN THE TABLE OF CANTENTS LISTING.
/
	JMS TWOS	/2'S COMP.
	DAC P657
	LAC TSWCH	/WAS THE TABLE ASKED FOR?
	SNA		/YES IF NON 0.
	JMP END.TS	/NO ..PUT LIT CNT IN AC.
FAKLIT	ISZ LNCTR	/COUNT THE LITERALS.
	JMP INCP65	/NO OVERFLOW. COUNT LITS.
	ISZ PGCTR	/LINE COUNT OVERFLOWED.
	LAC LM66	/INCREM. THE PAGE CNT AND
	DAC LNCTR	/RESET THE LINE COUNT.
INCP65	ISZ P657	/HAVE ALL THE LITS BENN COUNTED?
	JMP FAKLIT	/NO KEEP LOOPING.
/
END.TS	LAC LITCTR
	JMP .LTCOM
SETLIT	0 
	LAC .LTGPT
	TAD L1
	DAC ADDER
	LAC* .LTGPT
	DAC LITLOC
	LAC* ADDER
	DAC MAXLIT
	JMP* SETLIT
	.ENDC
	.ENDC
	.TITLE		TEXT GENERATING(.ASCII,.SIXBT)
/
/
/THE MACRO-15 TEXT TYPES ARE 5/7 ASCII (.ASCII) OR STRIPPED SIXBIT
/CHARACTERS (.SIXBT). THE TYTYP SWITCH IS USED TO DETERMINE THE DATA
/TYPE; 0=SIXBT, NON 0=ASCII. THE FIRST LEGAL TEXT CHARACTER
/AFTER THE INITIAL TAB OR SPACE IS USED AS THE STRING DELIMITER,
/AND IS NOT PACKED.
/AFTER A STRING HAS BEEN DELIMITED, IF A SPACE, TAB, OR A CR IS
/ENCOUNTERED THE PROGRAM LEAVES TEXT MODE. CHARACTER STRINGS
/ARE ALWAYS TIED TOGETHER (I.E.  /ABC/'D'/K/ LOOKS LIKE
/'ABCDK'.
/
.ASCII	SET TXTYP	/SET TEXT TYPE FOR 5/7 ASCII
	LAC CMDPAK	/INSERT THE JMS PACK57 CALL.
	JMP TXTCOM	/JUMP TO THE TEXT HANDLING COMMON AREA.
.SIXBT	DZM TXTYP	/SET TEXT TYPE FOR STRIPPED SIXBIT TEXT.
	LAC SIXPA	/INSERT THE JMS PACK CALL.
TXTCOM	DAC PKXXX
	DZM BRKSW	/CLEAR PREV CHAR DELIMITER SWITCH.
	LAC AD09	/SET UP BUFFER POINTER FOR BOTH POINTERS.
	JMS P6INT	/ALWAYS POINTS TO THE TOP OF TXTBUF(SIXBT)
	JMS P57INT	/INITIALIZE 5/7 ASCII PACKER.
	LAC AD13	/CLEAR OUT THE TEXT BUFFER.(TXTBUF-1)
	JMS ZEROIT
	-32
	JMS CKSCR	/IF THE FIRST CHAR IS A CR OR ;
	JMP PRPOP	/DELIMIT THE TEXT MODE.
/USE THE SUBROUTINE CKV15 TO GET A TEXT CHAR AND TO DETERMINE
/WHETHER OR NOT THE CHAR WAS LEGAL TEXT OR A CR. A CR ALWAYS
/TERMINATES TEXT INPUT MODE. AN ILLEGAL CHAR IS IGNORED AND DOES
/NOT CHANGE CHAR COUNTERS, BUT DOES CAUSE THE 'S' FLAG
/TO BE OUTPUT.
/
TXTOP	JMS CKV15	/DO NOT RETURN IF CR.
	JMS CKSPTB
	JMP TXTOP
	SAD LEFTAB	/IF ITS A LEFT ANGLE BRACKET, TREAT
	JMP TXTRAW	/SUBSEQUENT CHARACTERS AS RAW NUMBERS.
	DAC DLMTR	/NO..SAVE IT AS A DELIMITER.
/GET MORE CHARACTERS AND COMPARE THEM TO THE DELIMITER. IF ITS
/EQUAL TURN ON THE PREV CHAR DELIMITER SWITCH AND RESET FOR
/RECEIVING MORE TEXT.
/
TXTLUP	DZM BRKSW	/ALWAYS TURN OFF SWITCH.
	JMS CKV15	/GET THE NEXT LEGAL TEXT CHAR.
	SAD DLMTR	/IS IT THE DELIMITER?
	JMP TXTDEL	/YES..TURN ON BRKSW.
PKXXX	XX		/PACK THE CHAR AND GET THE NEXT.
	JMP TXTLUP	/
	.EJECT
/A LEFT ANGLE BLACKET HAS BEEN ENCOUNTERED. RAW TEXT
/FOLLOWS. THE TEXT MUST BE NUMBERS IN THE RANGE 260-267
/OCTAL. IF IT IS OUTSIDE THIS RANGE, THE 'N' FLAG IS OUTPUT
/AND ERRONIOUS RESULTS ARE SURE TO FOLLOW. IN ANY CASE USE
/ONLY THE HIGH-ORDER 3 BITS.
/
TXTRAW	DZM ANGLVL	/ANGLE BLACKET EVALUATION.
	JMS CKV15
	SAD RITEAB	/RIGHT ANGLE BRACKET?
	JMP TXTRAB	/YES..STORE ANGLVL IN CHRHLD.
	JMS CKNUM	/IS IT IN THE RANGE 260-267 OCTAL?
	SKP		/YES..TEST FOR 261 OR 262.
	SET ERRORN
	AND L10
	SZA		/NO..ITS OK.
	SET ERRORN	/YES ITS 8 OR 9, FLAG THE LINE.
	LAC CHRHLD	/KEEP ONLY 3 BITS.
	AND L7
	DAC CHRHLD
/IF MORE THAN THREE NUMBERS ARE USED, ONLY THE RIGHT MOST
/THREE ARE CONSIDERED. THE RIGHT MOST BITS ARE ALWAYS
/ANDED OFF TO PREVENT A GARGAGE CHAR IF MORE THAN
/6 NUMBERS APPEAR BETWEEN ANGLE BLACKETS.
/
	LAC ANGLVL	/VALUE BUILT SO FAR
	RCL
	RTL
	AND L570S	/DROP RIGHT MOST BITS (IN CASE OF WRAPAROUND).
	XOR CHRHLD	/(777770)
	DAC ANGLVL
	JMP TXTRAW+1	/GET THE NEXT NUMBER.
TXTRAB	LAC ANGLVL
	DAC CHRHLD
	XCT PKXXX	/PACK THIS CHAR.
TXTDEL	SET BRKSW	/SET THE PREV CHAR DELIMITER SWITCH.
	LAC ADTXT	/FUDGE RETURN ADDRESS OF TEXT CHECKER.
	DAC CKV15	/(TXTOP+1)
	JMS GETCHR
	JMS CKSPTB
	JMP TXTDON
	JMP CKV15+2
	JMP TXTOP	/GET A NEW DELIMITER SET.
/THE TEXT LINE HAS BEEN DELIMITED. NO MORE TEXT EXITS ON
/THIS LINE. COMPUTE THE # OF BUFFER WORDS USED TO PREPARE
/FOR OUTPUTTING THEM. TAKE THE TOP OF THE BUFFER AND
/SUBTRACT THE LAST WORD USED IN THAT BUFFER FOR PACKING THE
/CHARS. IF THE MODE IS ASCII AND THE CHAR COUNT IS 0,
/THE BUFFER POINTER MAY BE ONE MORE THAN NECESSARY.
/
TXTDON	LAC TXTYP	/WHAT TYPE OF TEXT?
	SNA!CLA		/ASCII
	JMP TXTSIX	/SIXBT
	SAD CTR57	/IS 5/7 CTR 0?
	JMP TXTC0	/YES..IT MAY BE NECESSARY TO SUBTRACT.
TXTASC	JMS TXTGNM	/GET THE TEXT NUMBER.
	TAD PK57AD	/ARG1
	AND LAWM2	/ARG2
TXTSIX	JMS TXTGNM	/GET THE NUMBER OF SIXBIT WORDS
	TAD PKLOC	/AR1
	NOP		/AR2
TXTC0	LAC PK57AD	/HAVE ANY ASCII CHARACTERS
	SAD AD09	/BEEN PACKED?
	JMP TXTASC	/NO..SET UP 0 TEXT COUNT
	TAD LAWM1	/YES..SUBTRACT I FROM THE POINTER.
	DAC PK57AD
	JMP TXTASC
/TEXT SUBROUTINE TO GET A 5/7 ASCII TEXT INPUT CHARACTER
/AND EXAMINE IT FOR A CR AND TEXT VALIDITY. IF THE CHAR
/IS A CR THIS ROUTINE IS TERMINAL. IF THE CHAR IS INVALID
/TEXT THE 'S' FLAG IS OUTPUT AND THE CHAR IS IGNORED.
/
CKV15	0
	JMS GETCHR
	SAD L15
	JMP TXTDON	/TERMINATE IF CR.
	TAD LM40	/(-40
	SPA
	JMP NTVLD
	LAW -140
	TAD CHRHLD
	SPA
	JMP CKVLDA
NTVLD	SET ERRORS	/
	JMP CKV15+1	/GET NEXT CHAR.
CKVLDA	LAC CHRHLD
	JMP* CKV15
TXTGNM	0
	LAC AD13	/TXTBUF-1
	JMS TWOS
	XCT* TXTGNM
	JMS TWOS
	ISZ TXTGNM
	XCT* TXTGNM	/(NOP) OR (AND (777776)
	DAC TXTCTR
	DAC TEXTSW
	SNA		/ANY TEXT PACKED?
	JMP PRPOP	/NO..TREAT AS A COMMENT.
	JMP ENDALL	/YES..OUTPUT THE TEXT.
	.TITLE 	.IODEV  LINKING LOADER ROUTINE.
/
/
/***.IODEV***
/THE IODEV PSEUDO OP CAN ONLY BE USED IN A RELOCATABLE
/PROGRAM. IT IS FLAGGED (I) AND IGNORED OTHERWISE.
/THE ARGUMENTS MAY BE NUMERIC OR ALPHANUMERIC. IF ITS
/ALPHA THE SYMBOL MUST BE A DIRECT ASSIGNMENT.
/
.IODEV=.
	IFUNA JMS,TMODE,JMP,OUTERR
GETIOD	DZM OPRTR
	JMS ARGMNT
	JMP PRPOP	/NO ARGS.
	JMP IODOK	/NUMERIC ARGUMENT.
	JMS PSALPH	/ALPHA ARGUMENT.
	JMP IODEND	/SYMBOL NOT FOUND
IODOK	AND L37S
	JMS LL.OUT
	LAC L26
IODEND	JMS TKOM
	JMP GETIOD
/
/
/SYMBOLIC ARGUMENT EVALUATOR
/
PSALPH	0
	JMS USTLKP	/LOOK UP IN USER TABLE
	JMP PSAFND	/FOUND
	XCT PASSNO
	SKP
	JMP PSAERP
	JMS MERGE
	INC UNDCTR
	JMP PSAOK1
PSAERP	SET ERRORP
	SET ERRORA
	JMP* PSALPH	/SYMBOL NOT FOUND
PSAFND	LAC* MRGLOC
	SMA		/IS IT A DIRECT ASS?
	JMP PSAERP+1
	JMS WRD3
	LAC* MRGLOC
	DAC NUMBR
	JMS SETNUM
PSAOK1	INC PSALPH
	JMP* PSALPH
	.TITLE 	.REPT CODE GENERATOR.
/
/***.REPT***
/THE .REPT PSEUDO-OP CAN HAVE TWO ARGUMENTS. ANYTHING
/AFTER THE SECOND ARGUMENT THAT IS NOT A LINE DELIMITER
/WILL BE IGNORED AND WILL CAUSE A Q-ERROR.
/IF THE ARGUMENT IS A SYMBOL IT MUST BE A DIRECT
/ASSIGNMENT.
/
	.IFUND %BFA
.REPT	JMS .REPTA
	SPA		/IF FIRST ARG IN NEG THE
	JMP REPTER	/USER IS CONFUSED.
	DZM RPTINC	/CLEAR INCREMENT CONSTANT.
	LAC NUMBR
	SNA		/IF 0 IGNORE THE LINE.
	JMP PRPOP
	JMS TWOS
	DAC RPTCTR
.REPTC	SET RPTSW
	JMS .REPTA
	DAC RPTINC
	JMP PRPOP	/SCAN TO END OF LINE
REPTER	DAC RPTCTR
	SET ERRORQ
	JMP .REPTC
/
.REPTA	0
	JMS ARGMNT	/ARGUMENT SCANNER.
	JMP PRPOP	/NO ARGUMENTS.
	JMP* .REPTA	/NUMERIC ARGUMENT.
	JMS PSALPH	/ALPHA ARGUMENT
	CLA		/ALPHA ARG NOT FOUND
	JMP* .REPTA
	.ENDC
/IF THE ARGUMENT WAS PRECEDED BY A MINUS SIGN
/NEGATE THE NUMBER.
/
SETNUM	0
	LAC OPRTR
	SAD L55
	JMP SETNMA
	LAC NUMBR
	JMP* SETNUM
SETNMA	LAC NUMBR
	JMS TWOS
	DAC NUMBR
	JMP* SETNUM
TKOM	0
	LAC CHRHLD
	SAD KOMMA
	JMP* TKOM
	JMP PRPOP
	.TITLE 	*ARGMNT*--PSEUDO-OP ARGUMENT SCANNER.
/
/
/SUBROUTINE TO SCAN A LINE IN ORDER TO PICK UP ARGUMENTS.
/ARGUMENTS ARE SEPARATED BY COMMAS AND DELIMITED BY
/A SPACE, TAB, SEMICOLON OR CR. CURRENTLY CHRHLD HAS THE
/CHAR WHICH DELIMITED THE ARGUMENT TAKING PSEUDO-OP.
/CALLING SEQ:
/		JMS ARGMNT
/		JMP SOMEWHERE	/NO ARGUMENTS
/		JMP SOMEWHERELSE	/NUMERIC ARG
/					/SYMBOL IN ARG
ARGMNT	0
	JMS CKSCR	/WAS PSEUDO-OP DELIMITER A LINE DELIMITER.
	JMP* ARGMNT	/YES...EXIT, NO ARGUMENTS.
ARGMNA	JMS GETCHR	/IGNORE TABS AND SPACES.
	JMS CKSPTB
	JMP ARGMNA
	SET BYPASS	/SET FIRST CHAR-IN SWITCH.
ARGMNB	JMS CHRLKP	/TEST NEXT TEXT CHAR FOR LINE DELIMITER.
	027775
	JMP* ARGMNT	/YES..EXIT, NO ARGUMENTS.
ARGMOR	JMS CLEARS	/CLEARS SWITCHES
	JMS SYMCHR
	LAC LCOUNT	/ANY LEGAL CHARS?
	SZA		/NO
	JMP ARGMIN	/YES..CHECK FOR NUMERICS.
	JMS CHRLKP
	057776		/CHECK FOR + OR -
	SKP		/YES..SET OPERATOR.
	JMP ARGQES	/ARGUMENT ERROR, UNRECOGNIZABLE CHAR.
	DAC OPRTR
	JMP ARGMOR	/KEEP SCANNING
ARGQES	SAD L77		/CHECK CHAR FOR ? QUESTION MARK.
	.IFUND %BFA
	SKP
	JMP ARGSE	/ERROR
	LAC DFNSW	/MACRO DEFINITION SWITCH MUST BE ON
	SNA		/FOR THIS CHAR TO BE ACCEPTABLE.
	JMP ARGSE
	LAC XCTLIT
	DAC CSBSW	/SET CREATE SYMBOL SWITCH.
	JMP ARGMOR
	.ENDC
ARGSE	SET ERRORS	/FLAG THE LINE AND GET NEXT ARG.
	JMP ARGMOR
	.EJECT
/A STRING OF CHARACTERS HAVE BEEN PROCESSED AND ARE
/LIVING IN PACKS AND PACKS+1. THE STRING MAY BE ALPHA
/OR ALPHANUMERIC. IF THE FIRST CHAR IS NUMERIC THEY
/MUST ALL BE NUMERIC. IF THE STRING TERMINATOR IS AN
/ILLEGAL CHAR, FLAG THE LINE AND CONTINUE WITH THE
/LEGAL STUFF IN PACKS AND PACKS+1.
/
ARGMIN	JMS CHRLKP	/LEGAL TERMINATOR.
	007774
	JMP ARGTOK	/TERMINATOR OK.
	SAD KOMMA
	SKP
	SET ERRORS	/ILLEGAL CHAR TERMINATED STRING.
ARGTOK	LAC CHAR1	/IS IT A NUMERIC STRING?
	SNA		/YES..MAKE SURE ALL NUMBERS.
	JMP ARGALP	/ALPHA STRING. EXIT.
	LAC VARSW	/MAKE SURE VARIABLE SWITCH IS NOT ON.
	TAD ALPCIN
	SZA
	JMP ARGNER	/ERROR
	JMS NUMEVL	/CONVERT TO BINARY.
	JMS SETNUM
	JMP ARGALP+1	/NUMERIC ARG RETURN
ARGNER	SET ERRORN
	JMP ARGMNB	/STILL NO ARGUMENTS
ARGALP	IDX ARGMNT	/ALPHA RETUTN
	IDX ARGMNT	/NUMERIC RETURN/
	JMP* ARGMNT
	.TITLE 	.CBD--COMMON BLOCK DESCRIPTOR.
/
/
/THE MACRO ASSEMBLER PSEUDO-0- .CBD (COMMON BLOCK DEFINITION) ALLOWS
/THE ASSEMBLY LANGUAGE PROGRAMMER TO DECLARE A COMMON OF AN INDICATED
/NAME AND SIZE, AND TO SPECIFY A WORD TO BE SET TO ITS BASE ADDRESS.
/
/THE .CBD PSEUDO-OP TAKES A COMMON NAME AND ITS SIZE AS ARGUMENTS, 
/RESERVES ONE WORD OF CORE, AND OUTPUTS LOADER CODES AND PARAMETERS
/TO DIRECT THE TASK BUILDER (OR LINKING LOADER OR CHAIN) TO SET A 
/VECTOR TO THE FIRST ELEMENT OF THE INDICATED COMMON IN THE RESERVED
/WORD.  FOR EXAMPLE, THE STATEMENT
/			BASE .CBD ABCD 6
/
/WILL PROVIDE THE BASE ADDRESS OF COMMON/ABCD/ IN THE WORD LABELED BASE.
/
.CBD	JMS ARGMNT	/PSEUDO-OP ARGUMENT SCANNER.
	JMP OUTERR	/NO ARGUMENT AFTER .CBD
	JMP OUTERR	/NAME CANNOT START WITH A NUMBER.
/
/THE NAME IS AT PACKS AND PACKS+1.  maKE SURE THE NAME TERMINATOR
/IS LEGAL BEFORE OUTPUTTING ANY CODE.  LEGAL:(SPACE,TAB,COMMA).
/
	JMS CKSPTB	/SPACE ON TAB?
	JMP CDBOK	/TERMINATOR OK.
	SAD KOMMA
	SKP
	JMP OUTERR	/ILLEGAL TERMINATOR.
CDBOK	LAC AD08	/PTR TO PACKS.
	JMS NAMSQZ	/OUTPUT THE NAME
	JMS ARGMNT	/GET SIZE NEXT
	JMP CBDERR	/SIZE ARG REQUIRED.
	JMP CBDSIZ	/NUMERIC ARG FOR SIZE
	JMS PSALPH	/ALPHANUMERIC ARG FOR SIZE.
	CLA!SKP		/SYMBOL NOT FOUND, USE 0
CBDSIZ	LAC NUMBR	/'NUMBR' SET BY 'ARGMNT'
	JMS LL.OUT
	LAC L14		/LINK LOADER CODE.
	CLA
	JMS LL.OUT
	LAC L15
	LAC PC
	JMS LL.OUT
	LAC (16
	DZM WRDVAL
	DZM AREL	/NO RELOCATION
	JMP CKFTG
CBDERR	SET ERRORQ
	JMP PRPOP
	.TITLE 	ABSOLUTE LOADING (.ABS,.FULL).
/
/THE ABSOLUTE (INCLUDES .FULL(P)) PSUEDO-OPS CANNOT
/APPEAR ANYWHERE IN A PROGRAM OTHER THAN BEFORE
/ANY LOCATION PRODUCING CODE.  I.E., THE PSUEDO PC
/MUST BE ZERO WHEN THESE ARE ENCOUNTERED.
/
/IN ALL ERROR CASES, THESE PSUEDO-OPS ARE IGNORED
/
	.IFUND %BFA
.ABS=.
	LAC K10000		/PDP-9 MODE (13-BIT ADDRESSING)
	DAC PDP9SW
	SKP
.ABSP	DZM PDP9SW		/PDP-15 MODE (12-BIT ADDRESSING)
	.ENDC
	JMS CKPC0		/MAKE SURE THE PC IS 0
	LAC L1			/(0=PDP15 MODE, NOT 0=PDP9 MODE)
	DAC BMODE	/SET OUTPUT MODE TO .ABS(9) BINARY(1).
/
/THE POSITION OF THE .ABS(9) PSUEDO-OP IN THE PROGRAM
/HAS BEEN ACCEPTED.  IF THIS IS PASS 2 SCAN THE OPERAND
/FIELD FOR THE -NLD=OPTION.  IF ITS PASS1 IGNORE THE POSSIBLE
/OPTION AND GET THE NEXT LINE.
/IF IT IS PASS2 AND THEIR IS AN OPERAND AND
/IT DOES NOT EQUAL -NLD- ,FLAG THE LINE (S-ERROR)
/AND PUNCH THE LOADER AHEAD OF THE PROGRAM
/ANYWAY.
/
	XCT	PASSNO		/(SKP OR NOP)
	JMP PRPOP		/PASS1-IGNORE OPERAND
	.IFUND %MACI
	JMS ABSLOD
	.ENDC
	JMS ARGMNT		/SCAN THE OPERAND FIELD.
	JMP PNCHLD		/RETURN HERE IF NO OPERAND.
	JMP ABSERO
	LAC PACKS		/RETURN HERE AFTER ARG SCAN.
	TAD PACKS+1		/IF THE OPERAND IS NLD DO NOT
	SAD (161404		/PUNCH A LOADER.  IF ITS NOT
	JMP PRPOP		/FLAG THE LINE AND PUNCH
ABSERO	SET ERRORQ		/THE LOADER ANYWAY.
	JMP PNCHLD
.FULL=.
	SET PDP9SW		/PDP-9 MODE (13-BIT DIRECT ADDRESSING)
	SKP
.FULLP	DZM PDP9SW		/PDP-15 (12-BIT DIRECT ADDRESSING)
	JMS CKPC0		/MAKE SURE PC IS 0
	LAC L2			/PC IS OK.
	DAC BMODE		/SET OUTPUT MODE TO .FULL
	JMP PRPOP		/BINARY (2).
	.TITLE 	.EBREL,.DBREL LOADER PSEUDO-OPS.
/
/THESE TWO PSUEDO-OPS CAN BE USED ANYWHERE. 
/A WORD HAVING A L.LOADER CODE OF 31 TO BE OUTPUT
/THE RELOCATABLE BINARY PRODUCING SUBROUTINE.  THE
/.DBREL CAUSES A L.LOADER CODE OF 32 TO BE OUTPUT.
/THE CODES (31-13 BIT:32-12 BIT) TELL THE LINKING LOADER
/HOW TO RELOCATE OPERAND.  IN BOTH CASES THE DATA WORD
/IS IGNORED.
/THESE PSUEDO-OPS ALSO CAUSE A SOFTWARE SWITCH TO BE
/SET. (DIRASW).  THIS SWITCH IS LATER USED (IN ROUTINE WRDEVL)
/TO DETERMINE IS 13 BIT ADDRESSES SHOULD BE FLAGGED OR NOT.
/
.EBREL	SET PDP9SW		/PDP-9 MODE(13-BIT DIRECT ADDRESSING)
	LAC L31
	JMP LLSETM
.DBREL	DZM PDP9SW		/PDP-15 MODE(12-BIT DIRECT ADDRESSING)
	LAC L32
LLSETM	DAC LLCODE		/SET L.LOADER MODE
	JMP .RELOK		/(OUTPUT MODE:0=REL, 1=.ABS, 2=.FULL).
	.ENDC
OUTERR	SET ERRORI		/SET ERROR FLAG AND IGNORE
	JMP PRPOP		/THIS PSUEDO OP
	.IFUND %BFA
.RELOK	LAC PDP9SW		/SET THE DIRECT ADDRESSING
	DAC DIRASW		/SWITCH.
	DZM LLBWRD		/CLEAR THE LL DATA WORD
	JMS BLDLLB		/TELL L.LOADER TO START OR STOP
	JMP PRPOP		/RELOCATING 13-BIT ADDRESSES.
	.ENDC
/THE PSUEDO PROGRAM COUNTER MUST BE ZERO TO
/BE ACCEPTABLE BY ANY OF THE FOUR ABSOLUTE
/PSUEDO-OPS.  IF THE PC IS NOT 0 DON'T EVEN
/BOTHER TO RETURN, GO IMMEDIATELY TO THE PSUEDO-OP
/PRINT AND SCAN AREA.
/
CKPC0	0
	LAC PC			/IF THE PC IS NOT 0
	SZA			/DO NOT ACCEPT IT.
	JMP OUTERR
	DZM SYMTYP
	LAC PDP9SW		/PC IS OK, SET THE DIRECT
	DAC DIRASW		/ADDRESSING MODE SWITCH.
	.IFUND %MACI
	SZA
	JMP .+3
	LAC DBALIT
	SKP
	LAC EBALIT
	DAC LODMOD
	.ENDC
	.ENDC
	JMP* CKPC0
	.TITLE 	PUNCH THE .ABS LOADER.
/
/PUNCH THE .ABS LOADER
PNCHLD=.
	.IFUND %MACI
	LAC BNOPTN	/WAS A BINARY REQUESTED?
	SNA!CLC		/YES
	JMP PRPOP	/NO
	AND BBFSIZ	/IF THE OUTPUT BUFFER SIZE
	SMA		/INDICATES DECTAPE DO NOT PUNCH.
	JMP PRPOP
	.IFUND	RSX
	CAL+4765	/PUNCH LOADER DUMP MODE
	11
MOD27	BINLDR
	ENDLDR-BINLDR\777777+1	/2'S W/C
	CAL+3765
	11		/PUNCH HRI WORD
MOD28	HRMWD
	-6
	.ENDC
	.IFDEF	RSX
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL	WRDPMD	/WRITE DUMP MODE
	CAL	WRHRI	/WRITE HARDWARE READIN TAPE
	JMS	RSAUTO	/RESTORE AUTO XR'S
	.ENDC
	.ENDC
	JMP PRPOP	/PRINT PSEUDO OP
ABXEXT	.SIXBT /ABS/
	.ENDC
	.ENDC
	.IFDEF RSX
BBFSIZ	0
	.ENDC
	.TITLE		***.IF PSEUPD-OPS***
/
/
/*** .IF ***
/
.IFZER	LAC LSZA	/ZERO
	JMP IFA
.IFPNZ	LAC .IFK01	/POSITIVE AND NON ZERO
	JMP IFA
.IFPOZ	LAC LSPA	/POSITIVE OR ZERO
	JMP IFA
.IFNEG	LAC LSMA	/NEGATIVE
	JMP IFA
.IFNOZ	LAC LSZMA	/NEGATIVE OR ZERO
	JMP IFA
.IFNZR	LAC LSNA	/NON ZERO
	JMP IFA
.IFDEF	LAC LSZA	/DEFINED
	SKP
.IFUND	LAC LSNA	/UNDEFINED
	DAC CNDTN
	LAC KON002	/INIT TO PICK UP DEF IND
	JMP IFC-1
IFA	DAC CNDTN
	LAC KON001	/PICK UP VALUE
	DAC VALDEF
IFC	LAC CONDSW	/CONDITIONALIZED SECTION
	SNA!CLC		/YES
	JMP IFE
	TAD IFCTR	/UPDATE IF COUNTER
	DAC IFCTR
	JMS SCNEND
	DZM ERRORQ	/CLEAR FLAG WORD
	JMP PRPOP
IFE	SET IFSW
	JMP SCNADR	/GET EXPRESSION
/RETURN FROM EXPRESSION EVALUATION
/
IFRET	DZM IFSW
VALDEF	XX		/LAC FLDVAL OR NCD
CNDTN	XX		/SMA,SPA,SZA,ETC
	SKP!CLC		/CONDITION NOT SATISFIED
	JMP PRPOP
	DAC IFCTR
	SET CONDSW	/SET CONDITIONAL SWITCH
	JMP PRPOP
	.TITLE 	TITLE--PAGE HEADER BUILDER.
/
/
/THE TITLE PSEUDO-OP CAUSES A TOP OF FORM CHARACTER TO BE
/OUTPUT TO THE LISTING DEVICE.  THE PAGE COUNT IS INCREMENTED
/AND THE FIRST 40 CHARS ARE USED AS THE NEW TITLE.
/
TITLE=.
	.IFUND %BFA
	LAW -62		/PACH UP TO 50(10) CHARS.
	DAC TITCNT
	LAC ADTITX
	JMS P57INT
	JMS TSTC15	/IF THE .TITLE (DELIM) WAS A CR
	JMP TITDON	/TO THE END OF TITLE ROUTINE.
TITLUP	JMS GETCHR	/PACK THE CHARS UNTIL 40(10) HAVE BEEN
	SAD L15		/PACKED OR A CR IS ENCOUNTERED.
	JMP TITDON
	JMS PACK57
	ISZ TITCNT
	JMP TITLUP
/
/THE TITLE STRING HAS BEEN DELIMITED BY A ; , CR, OR 40 CHARS.
/MAKE SURE THAT A CR IS APPENDED TO THE LINE.
/
TITDON	JMS P57K15
	LAC TSWCH
	SZA
	JMP .+3
	XCT PASSNO
	JMP TAG.C2
	.ENDC
	SET TITLET
	JMS EJECT	/PRINT THE HEADER ETC.
	JMP TAG.C2	/TREAT THE .TITLE LINE AS A COMMENT LINE.
/SUBROUTINE TO TEST FOR CURRENT CHAR BEING A CR.
/
TSTC15	0
	LAC CHRHLD
	SAD L15
	JMP* TSTC15
	IDX TSTC15
	JMP* TSTC15
	.TITLE 	PRPOP---PSEUDO-OP ---PRINTER.
/
/
PRPOP	JMS POPPR 	/SCAN TO END OF LINE
/
/PRINT THE SEQUENCE NUMBER (IF 'N' SWITCH) AND THE ERRORS
/FOR THIS LINE.  SSSSB,EEEEE, RDBUF=2 TABS. . BEFORE CALLING
/PRINT MOVE THE DATA DOWN TO THE TOP OF RDBUF AND
/ADJUST THE PRINT BUFFER POINTER.  THE DATA IN THE
/PRINT BUFFER IS STORED AS FOLLOWS:  RDBUF-4, RDBUF-3=
/DECIMAL SEQUENCE NUMBER.  RDBUF-2, RDBUF-1=ERRORS.
/RDBUF, RDBUF+1=2 TABS AND 0 FILLER.
/
	LAC .NLSW	/.NOLST SWITCH?
	SZA		/YES
	DZM ALOPTN	/CLEAR LISTING SWITCH
PRPOPA	LAC EJCTSW
	SZA
	JMS EJECT
	DZM EJCTSW
	JMP CKMWD1	/TEST CR FOR GOING TO NEXT LINE
/
/SUBROUTINE TO PRINT A COMMENT LINE, OR A LINE THAT
/IS TREATED AS A COMMENT.E.G. MACRO DEFINITIONS.
/THE LINE MAY REQUIRE A SEQUENCE NUMBER. IF S0 THE 5/7
/PACKING SUBRIUTINES ARE UD;SED. THE CRITICAL POINTERS AND
/COUNTERS MUST BE SAVED SO THEY CAN BE RESTORED AFTER 
/THE 5/7 ROUTINE FOR PACKING AN OUTPUT LINE ARE FINISHED.
/
PRTCOM	0
	LAC TSWCH
	SZA
	JMP PRTSWH
	XCT PASSNO
	JMP* PRTCOM	/PASS1 DONT PRINT ANYTHING.
PRTSWH	LAC AD666
	JMS SEQERF
	JMS P57TAB	/2 TABS TO RDBUF
	JMS P57TAB
	LAW -5
	JMS SPACKS
	JMS OUT3EX
	JMS SHRINK
	TAD AD667
	JMP* PRTCOM
	SNA
POPPR	0
	JMS SCNEND
	JMS PRTCOM
	JMP* POPPR
	.TITLE	*.END*--END OF PASS CODE.
/
.END=.
	.IFUND %MACI
	.IFUND %BFA
	.IFUND	RSX
CAL6	XX		/CAL
	6
	.ENDC
	.ENDC
	.ENDC
	.IFDEF %BFA
CAL6	CAL+767
	6
	.ENDC		/MACROA IS ALWAYS -11
	.IFDEF	RSX
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL	CLOSCB	/CLOSE THE INPUT DEVICE
	JMS	RSAUTO	/RESTORE AUTOXR'S
	LAC	RDSRLN	/PICK UP THE LUN NUMBER
	JMS	DETHCB	/DETACH THE DEVICE
	.ENDC
	XCT PASSNO	/WHICH PASS
	SKP		/PASS 1
	JMP ENDPS2 	/PASS 2
	LAC SYMTYP 
	SMA
	JMP .+2
	LAC LACLIT
	DAC SYMSAV 	/SAVE LAST RELOCATION IND
	LAC CHVPC	/CURRENT HIGH VALUE OF PC
	DAC VARLOC 	/VARIABLES STARTING LOCATION
	TAD VARCTR
	DAC UNDLOC 	/UNDEFINES STARTING LOCATION
	TAD UNDCTR
	DAC EXTLOC 	/V.T. STARTING LOCATION
	DAC EXTLC1
	TAD EXTCTR
	.IFUND %MACI
	.IFUND %BFA
	DAC* .LTGPT	 /LITERALS STARTING LOCATION
	IDX .LTGPT	/POINT TO WORD2 OF .LTORG TABLE
	.ENDC
	.ENDC
	.IFDEF %MACI
	DAC LITLOC
	.ENDC
	.IFDEF %BFA
	DAC LITLOC
	.ENDC
	TAD LITCTR
	DAC PRGSZE 	/PROGRAM SIZE
	LAC LITCTR
	.IFUND %MACI
	IFUNA DAC*,.LTGPT
	.ENDC
	.IFDEF %MACI
	DAC MAXLIT
	.ENDC
	IFDEA DAC,MAXLIT
	JMS DROPLT
	DAC USTBEG
	LAC VARCTR 	/CHECK IF ANY VARIABLES,
	TAD UNDCTR 	/UNDEFINES OR EXTERNALS
	TAD EXTCTR 	/WERE ENCOUNTERED
	SNA
	JMP P1CMPL 	/PASS 1 COMPLETED
	LAC USTSZE 	/SYMBOL TABLE SIZE 
	JMS TWOS	/COUNT EQUALS NUMBER OF SYMBOLS
	DAC SZECTR
/COMPUTE VALUES FOR VARIABLES, UNDEFINES
/AND EXTERNALS
CVA	JMS SYM3
	JMS MACFST
	JMP CVE		/BYPASS P/A
	SKP		/NOT A MACRO
	JMP CVE		/BYPASS MACROS
	LAC* SWD2
	AND JMPLIT
	SZA 		/UNDEFINED
	JMP CVB
	LAC* SWD3
	AND IOTLIT
	XOR UNDLOC 	/UNDEFINED LOCATION VALUE
	DAC* SWD3
	.TITLE 	PRINT UNDEFINED SYMBOL IN PASS 1
/
/
	JMS UNSQZE	/UNSQOZE THE SYMBOL
	LAW -6
	JMS MOVEPK	/MOVE AND PACK CHARS FROM
	LAC AD16	/UNSQZV-1 TO THE
	LAC AD09	/TEXT BUFFER TO P57INT
	JMS PKBLNK	/SPACE (PACK IT 5/7)
	LAW -5
	JMS MOVBIN	/BINARY TO OCTAL
	LAC UNDLOC	/UNDLOC AS INPUT
	JMS P57K15	/CR
	JMS PRTSOH
MOD29	TXTBF-1
L3	3
	JMS SUB2	/RESTORE USTBEG: C(USTBEG)=C(USTOEG)-2
	DAC USTBEG 	/IN UNSQOZE ROUTINE
	INC UNDLOC
	JMP CVC
CVB	SPA 		/EXTERNAL
	JMP CVD
	LAC* SWD3
	AND IOTLIT
	XOR EXTLC1 	/EXTERNAL LOCATION VALUE
	DAC* SWD3
	ISZ EXTLC1
	JMP CVC
CVD	LAC* SWD3
	SMA 		/VARIABLE
	JMP CVE
	AND IOTLIT
	XOR VARLOC 	/VARIABLE LOCATION VALUE
	DAC* SWD3
	INC VARLOC
CVC	LAC* SWD1
	AND L557S	/(577777)
	XOR SYMSAV	/LAST REL IND
	DAC* SWD1
CVE	ISZ SZECTR
	SKP
	JMP P1CMPL 	/FINISHED VALUE COMPUTING
	.IFDEF PAGPOS
	XCT EXPAGE	/EXTRA PAGE?
	JMP PAGSYM	/YES
	.ENDC
PG0003	JMS USTB2
	INC USTBEG
	JMP CVA
	.TITLE 	*PICMPL*--END OF PASS1 CODE.
	.IFUND	RSX
P1CMPL	LAC P1MES
	JMS WRITE3
	.ENDC
	.IFDEF	RSX
P1CMPL	LAC	VERPNT	/PRINT PASS1 MESSAGE?
	SNA
	JMP	P3CMPL	/NO SKIP OVER IT
	LAC	P1MES	/YES ON OUTPUT TTY
	JMS	WRITE3
P3CMPL=.
	.ENDC
	.IFDEF %MACI
	JMP PASS2
	.ENDC
	.IFUND %MACI
	LAC AD37	/PASS2
	DAC POWA
	.IFUND %BFA
	LAC FSWCH
	SNA
	JMP TRY.11
	LAC BULK14
	SNA
	JMP WAITCP
	.ENDC
TRY.11	LAC EOTSW	/EOT ENCOUNTERED IN PROGRAM
	IFUNA SZA	/BFA ABBREV NOT DEFINED
	IFDEA SNA
	.IFUND %BFA
	JMP WAITCP	/WAIT FOR CONTROL P
	LAC BULK11	/IF BULK STORAGE DEVICE
	SZA
	.ENDC
	JMP* POWA	/CONTINUE, ELSE WAIT FOR
WAITCP=.
	.IFUND	RSX
	.IFDEF %DOS15
	LAC* (%BOSS
	SMA
	JMP WRCTP
	AND (757777	/GUARANTEE THIS TYPOUT.
	XOR L20000
	DAC* (%BOSS
	.ENDC
	.ENDC
WRCTP=.
	LAC CONTP	/WRITE ^P
	JMS WRITE3
	.IFUND RSX
	NOP
	JMP .-1		/WAIT FOR ^P
	.ENDC
	.IFDEF RSX
	CAL TTRDCB
	JMS WAITFR
	LAC	RDBUF+2	/PICK UP THE ANSWER
	AND	(774000) /IS IT A ^P?
	SAD	(100000)
	JMP* POWA
	JMP WAITCP
CNTPMS	.ASCII	/ MAC / 
	.ENDC
	.IFUND	RSX
PS1MSG	.ASCII	/^P/<175>
	.ENDC
	.LOC .-1
	.ENDC
L557S	577777
	.IFDEF	RSX
	ENDPS2-ENDPAS-1/2*1000+2
	0
	.ENDC
ENDPAS	.ASCII	/ END OF PASS 1/<15>
	.IFUND	RSX
WRNMES	.ASCII	<12>/PROG/<76>/4K/<15>
	.ENDC
/*****END OF PASS 2****
ENDPS2	SET ENDSW
	DZM ENDVAL
	DZM FLDVAL
	JMS TSTC15
	JMP ENDLNE
	JMP SCNADR+1 	/GET OPERAND VALUE
PREL	0
	SET STOPPER
	LAC AD222	/PRTBUF
	JMS SEQERF
	JMS PCIMAG	/PC IMAGE AND TYPE.
	JMS GOBJC	/OBJECT CODE - WRDVAL.
	JMS OUT3EX	/OUTPUT THE EXTENSION. *E
	JMS SHRINK
	TAD MOD33B
	JMP* PREL
	.TITLE  	*OUTLIT* OUTPUT LITERALS
/
/
OUTLIT	0
	LAC BEGUST
	DAC* L12
	LAC LITCTR
	SNA
	JMP* OUTLIT
	JMS TWOS
	DAC CTR1
	SET LITSW
	SET EXLTSW
	IFDEA LAC,L40
	IFUNA JMS,TMODE,JMS,BLDBIN
	DZM EXLTSW	/SO OUTPUT THE BIN BUFFER.
	SET LASW	/NEW LOAD-ADDR SWITCH.
NXLIT	DZM AREL	/ABS
	JMS LL13	/13 BITS REL
	.IFDEF PAGPOS
	XCT EXPAGE
	JMS TSTXLT
	.ENDC
	LAC* 12
	SZA
	ISZ AREL
	AND L1
	SNA
	DZM BITS	/15 BITS REL
	LAC* 12 	/GET LITERAL VALUE
	DAC WRDVAL
	JMS PREL	 /GO TO PRINT ROUTINE
	JMS CKFLLB
	IFUNA JMS,BLDBIN
	INC PC
	IDX* L12
	ISZ CTR1
	JMP NXLIT 	/GET NEXT LITERAL
	JMP* OUTLIT
	.TITLE 	*BKTEND*--RETURN FROM .END ADDR SCAN.
/
/
/RETURN FROM .END ADDRESS SCAN
/
BKTEND	DZM ENDSW
	LAC OUTLCT
	DAC LNSAVE	/SAVE FOR PASS3
	LAC ENDVAL
	SZA
	XOR JMPLIT 	/SET MINUS ADDRESS ALSO A JMP
	DAC ENDVAL
/PRINT AND OUTPUT EXTERNALS AND LITERALS
/
	LAC EXTLOC 	/CONTAINS START OF V.T.
	DAC WRDVAL
	DAC PC
	LAC EXTCTR 	/EXTERNAL COUNT
LSNA	SNA
	JMP LITOUT
	JMS TWOS
	DAC CTR1
	SET EXTSW	/SET EXTERNA SWITCH
	SET EXLTSW
	IFUNA JMS,TMODE,JMP,.+3
	JMS NEWLA	/OUTPUT NEW LOAD ADDRESS
	IFUNA SKP,,JMS,BLDBIN
NXEXT	JMS PREL	 /GO TO PRINT ROUTINE
	IFUNA JMS,TMODE,JMP,ABSEXT
	LAC PC
	DAC LLBWRD	/PC IS DATA WORD
	LAC K4		/ABS
	DAC LLCODE
	LAC SYMTYP
LSPA	SPA
	ISZ LLCODE	/REL 15
	JMS BLDLLB
	.IFUND %BFA
	SKP
ABSEXT	JMS BLDBIN	/BUILD BINARY OUTPUT
	.ENDC
	IDX PC
	IDX WRDVAL
	ISZ CTR1
	JMP NXEXT 	/GET NEXT EXTERNAL
	.IFUND %BFA
	JMS TMODE	/ABS OR REL
	JMP LITOUT-1	/ABS NO SYMBOLS
	.ENDC
	LAC L2
	JMS GIVS	/OUTPUT EXT SYMBOLS
	DZM EXLTSW
/LITERAL OUTPUTTING AT END OF PASS 2
	DZM EXTSW
LITOUT	JMS OUTLIT
	.TITLE 	PRINT SIZE AND ERROR LINE COUNT
/
/
/PRINT THE SIZE AND ERROR LINE COUNT MESSAGES BEFORE
/OUTPUTTING THE SYMBOL TABLE.  IF THE OUTPUT DEVICE
/BUFFER ASSIGNED TO -12 IS EQUAL TO THAT OF -3, ONLY
/PRINT THE MESSAGE ONCE BECAUSE THE OUTPUT IS TO THE
/SAME DEVICE.
/
RSTRIT=.
	DZM ESWCH
	.IFUND %BFA
	JMS TMODE	/DON'T CHECK THE SIZE IF ITS
	JMP SIZEOK	/A NON-RELOCATABLE PROGRAM.
	.ENDC
	LAC PRGSZE	/HIGHEST LOCATION USED.
	AND (70000
	SNA		/IS IT .GT. 4K??
	JMP SIZEOK	/NO SKIP WARNING.
	.IFUND	RSX
	LAC %%MODE	/NO ..IS IT A BANK MODE SYSTEM??
	SZA		/NO IF 0.
	JMP SIZEOK
	LAC MESWRN
	JMS WRITE3
	.IFUND %MACI
	LAC MOD3A+1	/CHECK IF SAME DEVICE.
	SAD L42
	JMP SIZEOK	/YES..SET UP LAST LINE BEFORE
	XCT SET1ST	/DON'T WRITE ON -12 IF NO LINES
	JMP SIZEOK	/HAVE BEEN WRITTEN YET.
	JMS PRTSOH	/SYMBOL TABLE OUTPUT.
MPMB02	WRNMES-1
L6	6
	.ENDC
	.ENDC
	.IFDEF %MACI
	LAC DSWCH
	SNA
	JMP SIZEOK
	JMS PRTSOH
	WRNMES-1
L6	6
	.ENDC
	JMS SUB1
	DAC ERLNCT	/WAS INCREMENTED AT PRTSOH
/BUILD THE LAST IMAGE LINE.
/THE SIZE (HIGHEST LOCATION) OF THE PROGRAM AND THE
/ERROR LINE COUNT ARE NEXT.
/
SIZEOK	LAC ADS0	/AREA FOR OCTAL SIZE IMAGE
	JMS P57INT
	LAW -5
	JMS MOVBIN
	LAC PRGSZE	/ARGUMENT TO BINOCT SUBROUTINE.
	LAC ERLNCT	/THE ERROR NUMBER IMAGE IS
	SZA		/NEXT. IF THE ARE NO ERRORS
	JMP ERRS1	/OUTPUT THE IMAGE  'NO'.
	LAC LITNO
	DAC ERNMBR
	DZM ERNMBR+1
	JMP ERRS2
ERRS1	JMS BINDEC	/DECIMAL ERROR LINE COUNT.
	LAC ERLNCT
	LAW -3
	JMS MOVEPK
	LAC AD24
	LAC AD38
ERRS2=.
	.IFDEF	RSX
	LAC	VERPNT	/CHECK TO SEE IF PRINTING IS REQUIRED
	SNA
	JMP	EROUTP	/NO DON'T PRINT ON TTY
	.ENDC
	LAC ERRPTR
	JMS WRITE3
	.IFUND %MACI
	.IFUND RSX
	LAC MOD3A+1	/TEST FOR SAME OUTPUT DEVICE.
	SAD L42
	JMP ERRS3
	.ENDC
	.IFDEF	RSX
	JMP	ERRS3
/
EROUTP=.
	.ENDC
	XCT SET1ST	/IS THIS THE FIRST LINE
	JMP ERRS3	/FOR DAT -12? IF YES IGNORE.
	JMS PRTSOH
MPMB04	ERRLIN-1
L175	175		/ALTMODE (USED AS CONSTANT)
	.ENDC
	.IFDEF %MACI
	LAC DSWCH
	SNA
	JMP ERRS3
	JMS PRTSOH
	ERRLIN-1
	.ENDC
ERRS3	SET ENDSW
	.IFUND %BFA
	LAC BNOPTN	/BINARY REQUESTED
	SNA		/YES
	.ENDC
	JMP ANPST
	.IFUND %BFA
	JMS MODETR
	JMP ANPST 	/REL
	JMS BLDBIN
	DZM ENDSW
	.IFUND %MACI
	JMS WAIT13	/WAIT FOR PUNCH
	.ENDC
	LAC BMODE
	SAD L1
	JMP ABSEND 	/ABS OUTPUT
	.IFUND %MACI
	LAC ENDVAL 	/FULL OUTPUT
	AND L147S	/13 BIT ADDRESS
	SZA
	JMP FULL1
	LAC HLTLIT
	SKP
FULL1	XOR JMPLIT
	DAC ENDVAL
	LAC AD17	/ENDVAL
	JMS UP6INT
	LAC AD34	/FULHRW+1
	DAC* L10	/OUTPUT AREA
	LAW -2
	DAC CTR
FULL2	JMS UNPACK	/PICK UP 6 BITS
	XOR L200
	DAC* 10
	ISZ CTR
	JMP FULL2
	JMS UNPACK
	XOR (300	/HRI WORD
	DAC* 10
	DZM PRVCHR
	JMS NULFRM
	.IFUND	RSX
	CAL+3765	/WRITE THE HRI WORD
	11
MOD31	FULHRW
	-6
	.ENDC
	.IFDEF	RSX
	JMS	SVAUTO	/SAVE AUOT XR'S
	CAL	WRFHW	/WRITE FULL HRM
	JMS	RSAUTO	/RESTORE AUTO XR'S
	.ENDC
	.ENDC
	.ENDC
	JMP ANPST
FULHRW	003500
ALPCIN	0		/USE AS TEMP STORAGE
LCOUNT	0
CHAR1	0
LKAHED	0
PRVCHR	0
/
	.IFUND %BFA
ABSEND	LAC ENDVAL
	SNA!CLC
	DAC ENDVAL
	.IFUND %MACI
	JMS NULFRM
	.IFUND	RSX
	CAL+4765	/PUNCH DUMP MODE
	11
MOD31A	ENDVAL
	.ENDC
	.IFDEF	RSX
	JMS	SVAUTO	/SAVE ATUO XR'S
	CAL	WRPDM	/PUNCH DUMP MODE
	JMS	RSAUTO	/RESTORE AUTO XR'S
	.ENDC
	.ENDC
	.IFDEF %MACI
	JMS DWRITE
	XCT ENDVAL
	.ENDC
	.IFUND	RSX
	-2
	.ENDC
	.ENDC 
	.TITLE 	SYM TABL OUTPUT ALPHA SEQ.
/
/ALPHA AND NUMERIC PRINTOUT OF SYMBOL TABLE
	.ENDC
ANPST	SET STOPPER	/CR IN MULTIWORD STOPPER
	JMS DROPLT
	SET STPSW
	LAC ALOPTN
	SNA
	DZM PGCTR
	LAC ASWCH
	DAC ALOPTN
	LAC PGCTR	/SAVE THE PAGE COUNT.
	DAC LCOUNT
	JMS GBST
	JMP ALFNXB
	JMS EJECT
	JMS INITLN
ALFNX=.
	.IFUND %BFA
	JMS TMODE
	JMP ALFNXA
	.ENDC
	JMS LLSTBL
	0
ALFNXA	JMS BPSMB 	/BUILD AND PRINT SYMBOL
	IDX USTBEG
	JMS CKEST 	/CHECK FOR END OF TABLE
	SKP 		/FOUND
	JMP ALFNX 	/GET NEXT SYMBOL
	JMS ENDSYM	/TEXT FOR LAST LINE
ALFNXB	LAC BNOPTN	/BINARY REQUESTED
	SNA		/YES
	JMP ALFNXD	/NO
	.IFUND %BFA
	JMS TMODE	/WHAT TYPE OUTPUT
	JMP ALFNXC
	.ENDC
	LAC ENDVAL	/.END VALUE
	AND L57S	/15 BIT
	JMS LL.OUT
	LAC L27		/END CODE
	.IFUND %MACI
ALFNXC	JMS WAIT13	/WAIT FOR BINARY
	.IFUND	RSX
	CAL+765		/CLOSE BINARY
	6
	.ENDC
	.ENDC
	.IFDEF RSX
	CAL CLOS13	/CLOSE BINARY FILE
	JMS WAIT13	/WAIT FOR EVENT VARIABLE ON CLOSE
	LAC	(DAT13)	/DETACH THE OUTPUT DEVICE
	JMS	DETHCB
	.ENDC
	.IFDEF %MACI
ALFNXC	JMS DCLOSE
	.ENDC
	.TITLE 	SYMBOL TAB. IN VALUE SEQ.
/NUMERIC PRINTOUT, VALUE SEQUENCE OF SYMBOL TABLE.
/SORT SYMBOL TABLE INTO VALUE SEQUENCE.
/PRINT MACROS AS THEY ARE ENCOUNTERED AND IGNORE THEM LATER.
ALFNXD	LAC	ASWCH
	SZA
	JMP	PNOC
	LAC	LCOUNT
	DAC	PGCTR
PNOC=.
	LAC	VSWCH
	SNA
	JMP	EOJ+1
	DAC	ALOPTN
	JMS	GBST
	JMP	EOJ+1
	JMS	EJECT
	JMS	INITLN
	DZM	NUMVAL
	LAC	BEGUST
	DAC	USTBEG
NUMNXH	JMS	SYM3
	JMS	MACFST
	JMP NUMNXJ	/P/A
	JMP NUMNXJ	/NOT A MACRO
	JMS BPSMB	/PRINT SYMBOL-MACRO
SKPLIT	SKP
NUMNXJ	JMS USTB2
NUMNXK	IDX USTBEG	/UPDATE TABLE POSITION
	JMS CKEST	/END OF TABLE
	SKP		/YES
	JMP NUMNXH	/GET NEXT SYMBOL
NUMNXF	LAC BEGUST 	/RESET TO BEGINNING
	DAC USTBEG 	/OF TABLE
	CLC
	DAC NXHVL 	/NEXT HIGHER VALUE
NUMNXB	JMS SYM3
	JMS MACFST 	/PICK UP THE SYMBOL AND TEST IT
	JMP NUMNXA	/P/A
	SKP		/NOT A MACRO.
	JMP NUMNXD	/BYPASS THIS MACRO.
	LAC TMP
	AND L57S
	DAC TMP
NUMNXA	LAC NUMVAL 	/COMPARE CURRENT NUMBER
	SAD TMP 	/AGAINST SYMBOL VALUE
	JMP NUMNXC
	JMS TRC 	/COMPARE SYMBOL VALUE
	LAC TMP 	/AGAINST NEXT HIGHER VALUE
	LAC NXHVL
	SKP 		/S/V < NXHVL
	JMP NUMNXD 	/S/V > NXHVL
	JMS TRC 	/COMPARE S/V AGAINST NUMVAL
	LAC TMP
	LAC NUMVAL
	JMP NUMNXD 	/S/V < NUMVAL
	LAC TMP 	/S/V > NUMVAL
	DAC NXHVL
NUMNXD	JMS USTB2	/UPDATE TABLE LOCATION
NUMNXG	IDX USTBEG
	JMS CKEST 	/END OF TABLE
	JMP NUMNXE 	/YES
	JMP NUMNXB 	/NO, GET NEXT
NUMNXC	JMS BPSMB 	/BUILD AND PRINT SYMBOL
	JMP NUMNXG
NUMNXE	LAC NXHVL 	/IF CURRENT VALUE
	SAD NUMVAL 	/=NEXT HIGHER VALUE
	JMP EOJ		/EXIT
	DAC NUMVAL
	JMP NUMNXF
MACFST	0
	LAC* SWD1
	SPA		/PA?
	JMP MACPA	/YES..EXIT
	ISZ MACFST
	LAC* SWD3	/MACRO?
	AND JMSLIT
	SZA
	ISZ MACFST	/YES
MACPA	LAC* SWD3
	DAC TMP
	JMP* MACFST
	.TITLE ***END OF ASSEMBLY.***
/
EOJ=.
	JMS ENDSYM
	.IFUND %MACI
	.IFUND %PTP
	LAC XSWCH	/WAS A CROSS REF REQUESTED?
	SZA		/NO..CLOSE THE LISTING
	JMP XSETUP	/YES SET IT UP AND LOAD IT.
	XCT SET1ST	/SHOULD -12 BE CLOSED?
	JMP NOCLOS	/NO IT WAS NEVER INIT(ED).
	.IFUND	RSX
	CAL+766		/CLOSE LISTING
	6
	.ENDC
	.IFDEF	RSX
	CAL	CLOS12	/CLOSE THE OUTPUT LISTING DEVICE
	LAC	(DAT12)	/DETACH IT
	JMS	DETHCB
	.ENDC
NOCLOS=.
	.ENDC
	.IFDEF %MACI
	LAC DSWCH
	SZA
	JMS DCLOSE
	.ENDC
/************ END OF ASSEMBLY ************
EOJ1	LAC BATCH	/MORE ASSEMBLES
	SZA		/NO
	JMP PASS1	/YES
	.IFUND %MACI
	.IFUND	RSX
L775	CAL+775
	6
EXIT	CAL
	15		/EXIT TO MONITOR
	.ENDC
	.ENDC
	.IFDEF	RSX
EXIT	LAC	(DAT2)	/DETACH ALL UNITS
	JMS	DETHCB
	LAC	(DAT3)
	JMS	DETHCB
	LAC	(DAT10)
	JMS	DETHCB
	LAC	(DAT11)
	JMS	DETHCB
	LAC	(DAT12)
	JMS	DETHCB
	LAC	(DAT13)
	JMS	DETHCB
	LAC	(DAT14)
	JMS	DETHCB
	CAL	L10	/EXIT THE TASK
	.ENDC
	.IFDEF %MACI
	JMP CTLC
	.ENDC
	.TITLE X-OPTION SETUP AND LOAD PASS3
XSETUP=.
	.IFUND RSX
	LAC BKP3ST
	DAC* L11
	AND L64Z	/(60000)
	DAC TMP
	.ENDC
	.IFUND %BFA
	LAC SAVEF	/DOES PASS3 HAVE TO CREF F-FILE?
	DAC FSWCH	/TURN OFF IF 0,ON IF 1.
	SNA
	JMP ONLY11	/NO ONLY DAT 11.
	LAC .SEK14	/YES MOVE IN DAT -14
	SKP
ONLY11	LAC .SEK11
	JMS SET10
	LAW -6
	JMS MOVAUT	/MOVE -14, AND -11 NAMES.
	.ENDC
	.IFDEF	%BFA
	LAC	ADFILE
	DAC*	L10
	LAW -6
	JMS	MOVAUT
	.ENDC
	LAC PTRFSW	/POINTER TO FSWCH-1
	JMS SET10
	LAW -17		/MOVE IN 15(10) ARGS
	JMS MOVAUT
	.IFUND RSX
	CAL+775
	12
	.ENDC
	.IFDEF	RSX
	JMS	WAITFR	/WAIT FOR TTY EVENT VARIABLE
	.ENDC
/ IF THE X OPTION WAS THE ONLY 'TY OUTPUT ASKED
/FOR ON DAT -12 AND THERE ARE NO ERROR LINES THE
/ NAME HAS NOT BEEN .ENTER(ED) YET FOR THIS FILE.
	XCT SET1ST	/NOP IF NO NAME .ENTER(ED).
	JMS NAME12
	.IFUND RSX
	CAL+766
	12
	.ENDC
	.IFDEF	RSX
	JMS	WAIT12	/WAIT FOR LISTING DEVICE TO FINISH
	.ENDC
	.EJECT
/LOAD PASS3
/
	.IFUND RSX
	.IFUND %DOS15
	.IFUND	BF
	LAC P3BLOK
	DAC 17637	/1ST BLOCK NO OF PASS3.
	LAC LPASS3	/CHANNEL ADDRESS -1.
	DAC 17640
	LAW -CREFWC
	DAC 17641
	LAC LP3ST
	DAC* L0
	JMP .DTBEG	/DONE..LOAD PASS3.
	.ENDC
	.ENDC
	.ENDC
	.IFDEF %DOS15
/
OVRLAY	CAL
	24
PAS3	CREF
	JMP PASS1
CREF	.SIXBT /CREF/
	.ENDC
	.ENDC
	.IFDEF	BF
	LAC	P3BLOK
	DAC	17772	/1ST BLOCK NO. OF PASS 3
	LAC	LPASS3	/CHANNEL ADDRESS -1
	TAD	L1
	DAC	17773
	LAW	-CREFWC	/SIZE OF PASS 3
	DAC	17774
	LAC	LP3ST
	AND L147S	/GET RID OF BANK BITS.
	XOR L650S	/BUILD JMP INSTR.
	DAC	17777
	LAC	L771
	DAC	17770
	LAC	L13
	DAC	17771
	LAC	L771
	DAC	17775
	LAC	L6
	DAC	17776
	JMP	17770
L771	771
L650S	600000	/USE TO BUILD JMP TO START ADDR.
	.ENDC
	.ENDC
	.ENDC
	.ENDC
	.TITLE .END MESSAGES AND UTILITIES.
	.IFDEF	RSX
	LRCR-ERRLIN+2/1000*2+2
	0
	.ENDC
ERRLIN	.ASCII <12><11><11>
	.ASCII	'SIZE='
PSIZEE	0;	0
	.ASCII	'     '
ERNMBR	0;	0
	.ASCII	/ ERROR LINES/<15>
	.LOC .-1
LRCR	510320
/SOME UTILITY ROUTINES.
/
SPACE2	0
	JMS PKBLNK
	JMS PKBLNK
	JMP* SPACE2
/PICK UP 3 SYMBOL WORDS
/
SYM3	0
	LAC USTBEG
	DAC SWD1
	TAD L1
	DAC SWD2
	TAD L1
	DAC SWD3
	JMP* SYM3
USTB2	0
	IDX USTBEG
	IDX USTBEG
	JMP* USTB2
/
P57K15	0
	LAC L15
	JMS PACK57
	JMP* P57K15
/
PKBLNK	0
	LAC L40
	JMS PACK57
	JMP* PKBLNK
	.TITLE BUILD AND PRINT SYMBOL IMAGES AND VALUES.
BPSMB	0
	JMS SYM3
	JMS UNSQZE 	/UNSQOZE THE SYMBOL
	LAW -6
	JMS PACKER
	LAC AD16		/UNSQZV-1
	JMS PKBLNK	/1 SPACE BEFORE LOCATION
	LAW -6		/IF SYMBOL IS A P/A
	DAC CTR		/PICK UP ALL 18 BITS.
	JMS MACFST	/ELSE ONLY 15 BITS
	JMP BPSMBB	/P/A.
	SKP		/NOT MAC OR PA.
	JMP BMACRO	/MACRO.
	ISZ CTR
	JMS PKBLNK	/PACK A BLNK
BPSMBB	LAC CTR
	JMS MOVBIN	/BINARY TO OCTAL
	LAC* SWD3
	JMS PKBLNK
	.IFUND %BFA
	JMS TMODE 	/BY PASS ADDRESS TYPE IF NON-RELOC ASSEMBLY.
	JMP BPACK	/ABSOLUTE.
	.ENDC
	LAC* SWD2
	AND JMPLIT 	/CHECK FOR VIRTUAL
.IFK01	SNA!SPA
	JMP BPNOTE 	/CHECK FOR A OR R, NOT E.
	LAC L105	/E, CR
	JMP BPACK
BPNOTE	LAC* SWD1	/CHECK FOR A OR R.
	AND LACLIT
	SNA
	JMP BPACK-1
	LAC L122	/R, CR
	JMP BPACK
	LAC L101
BPACK	JMS PACK57
BPABS	ISZ SCOUNT
	JMP .+3
	JMS OUTSYM
	JMP* BPSMB
	LAW -4
	JMS SPACKS
	JMP* BPSMB
BMACRO	JMS PKBLNK	/M/PACK MACRO
	LAC L115
CMDPAK	JMS PACK57
	LAC L101	/A
	JMS PACK57
	LAC L103	/C
	JMS PACK57
	LAC L122	/R
	JMS PACK57
	LAC L117
	JMS PACK57	/0
	JMS PKBLNK
	JMS PKBLNK
	JMP BPABS
/SUBROUTINE TO INITIALIZE THE PRTBUF LINE FOR OUTPUTTING
/MULTI SYMBOLS AT END OF PASS 2.
INITLN	0
CNTSYM	LAW -1		/-1, -4, OR ?
	DAC SCOUNT
	LAC AD222
	JMS P57INT
	JMP* INITLN
/A LINE OF SYMBOLS MAY HAVE BEEN BUILT. THIS SUBR. INSURES THAT
/THE LAST LINE IS PRINTED.
ENDSYM	0
	LAC SCOUNT
	SZA		/0 IF ALL SYMBOLS ARE OUTPUT
	JMS OUTSYM
	JMP* ENDSYM	/TERMINATE LINE
OUTSYM	0
	JMS P57K15	/TERMINATE THE LINE
	LAC AD333
	JMS PRINT	/PRINT IT
	JMS INITLN	/INITIALIZE THE NEXT LINE.
	JMP* OUTSYM
SCOUNT	0
/CHECK FOR END OF SYMBOL TABLE
CKEST	0
	LAC USTBEG 	/CHECK NEXT
	SAD USTEND	/FOR END
	JMP CKESTA 	/FOUND
	.IFDEF PAGPOS
	XCT EXPAGE
	JMP PAG006
	.ENDC
TBLOK	IDX CKEST
	JMP* CKEST
CKESTA=.
	.IFDEF PAGPOS
	XCT EXPAGE	/IS THERE AN EXTRA PAGE AVAILABLE?
	JMP PAG005	/YES..ADJUST USTBEG
	.ENDC
	JMP* CKEST
	.TITLE	RADIX 50 AND UTILITIES
/CONVERT RADIX 50 VALUE TO ASCII VALUE
/
ASCVAL	0
	DAC TMP
	SZA 		/SPACE
	JMP ASCVA
	LAC L40
	JMP ASCVD
ASCVA	TAD LM33
	SMA
	JMP ASCVB
	LAC TMP 	/A-Z
	XOR L100
	JMP ASCVD
ASCVB	LAC TMP
	TAD LM35
	SPA
	JMP ASCVC
	LAC TMP 	/0-9
	TAD L23
	JMP ASCVD
ASCVC	DAC TMP
	LAC L56 	/.
	ISZ TMP
	LAC L45 	/%
ASCVD	DAC* UNSQZL
	INC UNSQZL
	JMP* ASCVAL
UNSQZV	0		/USE AS TEMP
	0
	0
	0
	0
ABSADR	0
/UNSQOZING ROUTINE
/
UNSQZE	0
	LAC AD20	/UNSQZV
	DAC UNSQZL
	LAW -2
	DAC USQCTR
HALF2	LAC* USTBEG 	/SYMBOL
	AND L157S	 /MASK OUT
	DAC UNSQ	 /CONTROL BITS
	JMS DIVIDE 	/1'ST AND 4'TH CHARS
	LAC UNSQ 	/DIVIDEND
	LAC (3100 	/DIVISOR
	JMS ASCVAL 	/GET ASCII VALUE
	LAC DVD 	/REMAINDER SAVED
	DAC UNSQ
	JMS DIVIDE
	LAC UNSQ
	LAC LPAREN	/CONSTANT 50.
	JMS ASCVAL 	/2ND AND 5TH CHARS
	LAC DVD
	JMS ASCVAL 	/3RD AND 6TH CHARS
	INC USTBEG
	ISZ USQCTR
	JMP HALF2 	/GET 2ND HALF
	JMP* UNSQZE
/LOCATIONS TO BE INITIALIZED FOR PASS1 ONLY
/
BP1T=.
LITCTR	0		/LITERAL COUNTER
VARCTR	0		/VARIABLE COUNTER
EXTCTR	0		/EXTERNAL COUNTER
UNDCTR	0		/UNDEFINED COUNTER
BMODE	0		/BINARY NODE - 0=REL, 1=ABS, 2=FULL
	.IFUND %MACI
LTABLE	0
	.REPT 17
	0
	0		/EXTRA FOR IMPLIED .LTORG AT END
	0		/OF PASS1.
	.ENDC
	.TITLE WORDS TO BE CLEARED FOR PASSES 1 AND 2.
/
EP1T=.
/
/LOCATIONS TO BE INITIALIZED FOR PASS1 AND PASS2
BP12T=.
RASUPL	0		/REAL ARGUMENT SUPPLIED
CSBSW	0		/CREATE SYMBOL SWITCH
ERLNCT	0		/ERROR LINE COUNT
.NLSW	0	/.LST,.NOLST SWITCH.
RASW	0		/RETURN TO REAL ARGUMENTS
MCLCTR	0		/MACRO CALL LEVEL COUNTER
MCLSW	0		/MACRO CALL SWITCH
OUTLCT	0	/OUTPUT LINE COUNT
IFCTR	0
	.IFUND %MACI
LORGCT	0		/.LTORG COUNT
	.ENDC
LASW	0
FNDSW	0
EXPSW	0		/MACRO EXPANDING SWITCH
NOREST	0
DFNSW	0		/MACRO DEFINITION SWITCH
PC	0		/PROGRAM COUNTER
CHVPC	0		/CURRENT HIGH VALUE OF PROGRAM COUNTER
RPTSW	0		/REPEAT SWITCH
CONDSW	0		/CONDITIONAL ASSEMBLY SWITCH
RADIX	0		/RADIX +=OCTAL, -=DECIMAL
EP12T=.
/
/LOCATIONS TO BE INITIALIZED BEFORE
/EACH SOURCE STATEMENT IS ASSEMBLED
/
BST=.
PACKT	0;	0	/CONTAINS PACKED TAG
IFSW	0		/IF STATEMENT SWITCH
BYPASS	0		/BYPASS GETTING NEXT CHARACTER
PASW	0		/PARAMETER ASSIGNMENT
FLGSAV	0
FLDVAL	0		/ANY FIELD VALUE
PSEUDO	0
WRDVAL	0		/WORD VALUE
OPVAL	0		/OPERATION FIELD VALUE
AREL	0		/ACCUMULATED RELOCATION
CREL	0		/CURRENT RELOCATION
CHRNUM	0		/PACKING CHARACTER NUMBER
NCD	0		/NOT CURRENTLY DEFINED SYMBOL
LITSW	0		/LITERAL SWITCH
STPSW	0		/SYMBOL TABLE PRINT SWITCH
BRKSW	0		/BRACKETS IN TEXT SWITCH
BSSW	0		/.BLOCK SWITCH
ENDSW	0		/.END SWITCH
LOCVAR	0	/TAG IN LOCAL AREA MUST BE PUT IN RUST(FAKE OUT MERGE)
TITLET	0
NDIL	0
EXLTSW	0		/EXTERNAL OR LITERAL
EXTSW	0		/EXTERNAL SWITCH
FLDSW	0		/WHICH FIELD SWITCH
SZESW	0		/.SIZE SWITCH
NULOPF	0		/NULL OPERATION FIELD
OPSVSW	0		/OP SAVED SWITCH
EJCTSW	0		/.EJECT SWITCH
TEXTSW	0		/.TEXT SWITCH
VARSW	0		/VARIABLE ENCOUNTER
LOCSW	0		/.LOC SWITCH
	.IFUND %PDP9
NINEOP	0
INDXSW	0		/INDEX REGISTER SWITCH.
PDP9SW	0		/TEMP DIRECT ADDRESS SWITCH.
	.ENDC
EST=.
/
/INITIALIZE 5/7 UNPACKING TO BEGINNING OF LINE BUFFER
/
UPBLB	0
	LAC AD01	/RDBUF+2
	DAC UPKAD	/UNPACKING LOCATION
	LAC L1
	DAC PKNUM	/PACKING NUMBER
	.IFDEF %MACI
	LAC MSWCH
	SNA
	JMP* UPBLB
	LAC (DTIBUF+2
	DAC UPKAD
	.ENDC
	JMP* UPBLB
/
/LOCATION ZEROING SUBROUTINE
	.IFUND %MACI
/
/LAC (TABL-1
/JMS ZEROIT
/BEG-END		/TABLE SIZE
ZEROIT	0
	DAC* L10	/BEG-1 OF TABLE
	XCT* ZEROIT	/PICK UP LAW
	DAC CTR
	DZM* 10		/ZERO LOCATIONS
	ISZ CTR
	JMP .-2
	JMP* ZEROIT
	.ENDC
/INIT 5/7 UNPACKING, LOC IN AC AT ENTRY
USET57	0
	DAC UPKAD
	LAC L1
	DAC PKNUM
	JMP* USET57
/INITIALIZE FOR 5/7 PACKING
/
/LAC LOC
/JMS P57INT
/
P57INT	0
	DAC PK57AD	/LOCATION TO PACK
	DZM CTR57	/RESET COUNT
	JMP* P57INT
WRD3	0
	IDX MRGLOC
	IDX MRGLOC	/PICK UP WORD 3 OF S/T
	JMP* WRD3
GETREL	0
	RTL
	GLK
	DAC CREL	/PICK UP LOCATION
	JMP* GETREL
MRGP1	0
	INC MRGSAV
	LAC* MRGSAV	/UPDATE MERGE SAVE
	JMP* MRGP1
/SUBROUTINE TO PACK N BLANKS.
/
SPACKS	0
	DAC P57TAB
	JMS PKBLNK
	ISZ P57TAB
	JMP .-2
	JMP* SPACKS
P57TAB	0
	LAC L11
	JMS PACK57
	JMP* P57TAB
SET10	0
	TAD LAWM1
	DAC* L10
	JMP* SET10
SET11	0
	TAD LAWM3
	DAC* L11
	JMP* SET11
/INCREMENT AUTO INDEX IO TWICE INDIRECTLY.
INCL10	0
	IDX* L10
	IDX* L10
	JMP* INCL10
	.IFUND %MACI
/CONVERT TO TWO'S COMPLEMENT
/
TWOS	0
	CMA
	TAD L1
	JMP* TWOS
	.ENDC
/CHECK FOR 6 CHARACTERS PACKED
/
SIXP	0
	XX		/LAW -6 OR LAW -9(11)
	TAD CHRNUM	/6 CHARS PACKED
	SPA		/YES
SIXPA	JMS PACK	/NO - ADD1 TO RETURN
	JMP* SIXP
/THIS ROUTINE CHECKS CHRHLD FOR A-Z.
/CALLING SEQUENCE:
/JMS CKALF
/FOUND
/NOT FOUND
/
CKALF	0		/RETURN LOCATION
	LAW -133
	TAD CHRHLD
	SMA
	JMP NTALF	/>Z
	LAW -101
	TAD CHRHLD
	SMA		/<A
	JMP* CKALF	/FOUND EXIT
NTALF	IDX CKALF
	JMP* CKALF	/NOT FOUND EXIT
	.EJECT
/THIS ROUTINE CHECKS CHRHLD FOR 0-9.
/CALLING SEQUENCE:
/JMS CKNUM
/FOUND
/NOT FOUND
/
CKNUM	0		/RETURN LOCATION
	LAW -72
	TAD CHRHLD
LSMA	SMA
	JMP NTNUM	/>9
	LAW -60
	TAD CHRHLD
	SMA		/<0
	JMP* CKNUM	/FOUND EXIT
NTNUM	IDX CKNUM
	JMP* CKNUM	/NOT FOUND EXIT
P6INT	0
	DAC PKLOC
	DZM* PKLOC
	DZM CHRNUM
	DZM SIXCTR
	JMP* P6INT
/PACKING SUBROUTINE (THREE 6 BIT CHARS/WORD)
/PKLOC= LOCATION TO BE PACKED
/CHRNUM=CHARACTER NUMBER
/CHRHLD=CHARACTER TO BE PACKED
/
PACK	0
	LAC SIXCTR
	SAD L3
	SKP!CLA
	JMP OKSIX
	IDX PKLOC
	DZM* PKLOC	/CLEAR NEXT WORD
OKSIX	DAC SIXCTR
	TAD (JMP PKTBL
	DAC SIXDIS
	LAC CHRHLD
	AND L77
	CLL
SIXDIS	0
PKTBL	JMS LEFT6	/1ST LEFT 12 BITS
	JMS LEFT6	/2ND LEFT 6 BITS
	XOR* PKLOC	/3RD NO SHIFTS
	DAC* PKLOC
	INC CHRNUM	/UPDATE CHAR NUMBER
	INC SIXCTR
	JMP* PACK
	.EJECT
/NON-ALPHANUMERIC CHARACTER LOOKUP ROUTINE.
/ENTRY: CHAR IN CHRHLD
/JMS CHRLKP
/XXYYYY	XX=STARTING POSITION IN TABLE (1ST=0)
/FOUND	YYYY=NUMBER OF POSITIONS TO SCAN (2'S COMPL)
/NOT FOUND
/
CHRLKP	0
	LAC* CHRLKP
	AND L47S
	XOR (770000
	DAC CTRLK	/NUMBER OF POSITIONS TO SCAN
	LAC* CHRLKP
	JMS LEFT6
	RAL
	AND L77
	TAD (SAD SPCHRS-1
	DAC CHCMP
	IDX CHRLKP
	LAC CHRHLD
	ISZ .+1
CHCMP	XX		/FOUND
	JMP* CHRLKP	/YES
	ISZ CTRLK
	JMP CHCMP-1
	IDX CHRLKP
	JMP* CHRLKP	/NOT FOUND
/CHARACTER TABLE
/
L40=.
SPCHRS	40	/SPACE (0)
L11	11	/TAB (1)
L73	73	/; (2)
L15	15	/CR (3)
L57	57	/SLASH (4)
	53	/+ (5)
L55	55	/- (6)
L52	52	/* (7)
	46	/& (10)
L41	41	/! (11)
KBACK	134	/ (12)
L56	56	/. (13)
L45	45	/% (14)
L12	12	/LF (15)
L14	14	/FF (16)
L13	13	/VT (17)
L0	00	/NULL (20)
L177	177	/DELETE (21)
KOMMA	54	/COMMA(S)
/
/ROUTINE TO DETERMINE IF CHAR IS A SPACE OR TAB
/
CKSPTB	0
	JMS CHRLKP	/SPACE OR TAB?
	7776
	JMP* CKSPTB	/YES
	ISZ CKSPTB	/NO
	JMP* CKSPTB
/ROUTINE TO DETERMINE IF CHAR IS ; OR CR.
/
CKSCR	0
	JMS CHRLKP	/; OR CR?
	27776
	JMP* CKSCR	/YES
	IDX CKSCR	/NO
	JMP* CKSCR
UP6INT	0
	DAC UPKLOC
	DZM UPKCTR
	JMP* UP6INT
/UNPACKING ROUTINE FOR 6 BIT CHARS,
/3 CHARS/WORD.
/ENTRY:
/DZM UPKCTR
/LAC (INITIAL LOCATION TO UNPACK
/DAC UPKLOC
/JMS UNPACK
/UNPACKED CHAR IN UPKCHR
/
UNPACK	0
	LAC UPKCTR
	SAD L3
	SKP!CLA
	JMP OK6UNP
	IDX UPKLOC
	DAC UPKCTR
OK6UNP	TAD (JMP UPKTBL
	DAC .+2		/GET CHAR POSITION
	LAC* UPKLOC	/GET WORD
	0
UPKTBL	JMS RIGHT6	/1ST CHAR
	JMS RIGHT6	/2ND CHAR
	AND L77
	DAC UPKCHR	/UNPACKED WORD
	INC UPKCTR
	JMP* UNPACK	/EXIT
	.TITLE GET AN INPUT CHAR FRON LINE BUFF.
	.IFUND %MACI
/THIS ROUTINE UNPACKS CHARACTERS FROM 5/7 ASCII WORD
/PAIRS AND LEAVES THEM IN CHRHLD
GETCHR	0
	LAC PKNUM	/PKNUM=1,2,3,4 OR 5
	TAD (JMP JMPTBL-1
	DAC .+2
	LAC* UPKAD	/CONTAINS ADDR OF PACKED CHARS
	0		/JMP CHAR (1-5)
JMPTBL	JMP CHR1	/1ST
	JMP CHR2	/2ND
	JMP CHR3	/3RD
	JMP CHR4	/4TH
	JMP CHR5	/5TH
CHR1	JMS LEFT8
	JMP GETEND
CHR2	JMS RIGHT4	/ROTATE 4 RIGHT
	JMP GETEND
CHR3	RTL
	RAL		/ROTATE 3 LEFT
	AND L170
	DAC TMP		/SAVE LEFTMOST 4 BITS
	ISZ UPKAD
	LAC* UPKAD	/PICK UP NEXT WORD
	JMS LEFT4
	AND L7		/RIGHTMOST 3 BITS
	XOR TMP
	JMP GETEND+1
CHR4	JMS RIGHT8
	JMP GETEND
CHR5	RAR
	ISZ UPKAD	/UPDATE FOR NEXT 5/7 PAIR
	DZM PKNUM	/RESET CHAR NUMBER
GETEND	AND L177
	DAC CHRHLD	/UNPACKED 7 BIT CHAR
	ISZ PKNUM
	JMS CHRLKP	/CHECK FOR SPACE, TAB
	007773		/CR, ; OR /
	JMP* GETCHR
	JMS CHRLKP	/CHECK FOR LF, FF, VT, NULL
	157773		/OR DELETE
	JMP* GETCHR
	DZM NDIL	/RESET NO DATA IN LINE
	JMP* GETCHR
	.ENDC
/CHECK FOR # ON PERMANENT SYMBOL OR PSEUDO OP.
CKPFV	0
	LAC VARSW	/VAR SWITCH
	SZA
	SET ERRORS	/S TO FLAG WORD
	DZM VARSW
	JMP* CKPFV
	.TITLE MOVERS... AND END OF LINE SCANNER.
/
/
/ROUTINE TO SCAN TO END OF WORD OR LINE
/
SCNEND	0
	JMS CKSCR	/CHECK CURRENT CHARACTER FOR ; OR CR.
	JMP* SCNEND	/FOUND
	SAD L57
	JMP SCND4
SCND1	LAC CHRHLD
	DAC PRVCHR	/PREVIOUS CHARACTER
SCND3	JMS GETCHR	/GET NEXT CHAR
	JMS CKSCR	/CHECK FOR ; OR CR
	JMP* SCNEND	/FOUND
	JMS CKSPTB	/CHECK FOR SPACE OR TAB
	JMP SCND1	/FOUND
	SAD L57		/CHECK FOR /
	JMP SCND2	/FOUND
	SET ERRORQ	/Q TO ERROR FLAG WORD
	JMP SCND1
SCND2	LAC CHRHLD
	DAC TMP
	LAC PRVCHR
	DAC CHRHLD
	JMS CKSPTB	/CHECK PREVIOUS FOR SPACE OR TAB
	JMP SCND4	/FOUND
	LAC TMP
	JMP SCND1+1
SCND4	LAC L15		/CARRIAGE RETURN
	DAC CHRHLD
	JMP* SCNEND	/EXIT
/SUBROUTINES TO MOVE DATA.
/MOVER IS A SUBROUTINE TO MOVE DATA FROM ONE ADDRESS
/TO ANOTHER. THE ADDRESSES AND THE WORD COUNT ARE
/RECEIVED AS ARGUMENTS
/
MOVER	0
	DAC CTR		/SAVE THE WORD COUNTER
	XCT* MOVER	/GET THE DONOR ADDRESS-1
	DAC* L10
	IDX MOVER	/POINT TO RECEIVING ADDRESS.
	XCT* MOVER	/RECEIVER -1
	DAC* L11
	LAC CTR		/USE THE AUTO INDEX MOVER
	JMS MOVAUT
	JMP* MOVER
	.EJECT
	.IFUND %MACI
/MOVAUT IS A SUBROUTINE TO MOVE DATA FROM AUTO INDEX
/10 TO AUTO INDEX 11. ITS ONLY ARGUMENT IS
/THE WORD COUNT.
/
MOVAUT	0
	DAC CTR
	LAC* 10
	DAC* 11
	ISZ CTR		/DONE?
	JMP .-3		/NO LOOP AGAIN
	JMP* MOVAUT	/YES EXIT
	.ENDC
/MOVBIN IS SUBROUTINE WHICH CALLS THE
/BINARY TO OCTAL ROUTINE
/
MOVBIN	0
	DAC CTR
	JMS BNOCT
	XCT* MOVBIN
	JMS PACK57
	ISZ CTR
	JMP .-4
	IDX MOVBIN
	JMP* MOVBIN
MOVEPK	0
	DAC CTR
	XCT* MOVEPK
	DAC* L10
	IDX MOVEPK
	XCT* MOVEPK
	JMS P57INT
	LAC* 10
	JMS PACK57
	ISZ CTR
	JMP .-3
	IDX MOVEPK
	JMP* MOVEPK
PACKER	0
	DAC CTR
	XCT* PACKER
	DAC* L10
	LAC* 10
	JMS PACK57
	ISZ CTR
	JMP .-3
	JMP* PACKER
	.TITLE	MATH UTILITY ROUTINES
/CALLING SEQUENCE:
/	LAC MULTIPLIER
/	JMS MPY
/	LAC MULTIPLICAND
/	RETURN; LO ORD PROD IN AC, HI ORD PROD IN MP5.
/
MP1	0
MP2	0
MP3	0
MP5	0
MPY	0
	DZM MP5
	SNA
	JMP MPZ
	DAC MP1
	XCT* MPY
	SNA
	JMP MPZ
	DAC MP2
	LAW -22
	DAC MP3
MP4	LAC MP1
	RAR
	DAC MP1
	LAC MP5
	SZL!CLL
	TAD MP2
	RAR
	DAC MP5
	ISZ MP3
	JMP MP4
	LAC MP1
	RAR
MPZ	ISZ MPY
	JMP* MPY
/CALLING SEQUENCE:
/	JMS DIVIDE
/	LAC LOW ORDER DIVIDEND
/	LAC DIVISOR
/	RETURN	;QUOT. IN AC, REM. IN D#VD
/IF HIGH DIVIDEND IS GREATER OR EQUAL TO DIVISOR, NO DIVIDE TAKES
/PLACE AND LINK IS SET TO 1.  TIME = 368 CYCLES MAXIMUM
QUO=MPY
DIVIDE	0
	DZM DVD		/STORE HIGH ORDER DIVIDEND
	XCT* DIVIDE
	DAC QUO		/STORE LOW ORDER DIVIDEND
	ISZ DIVIDE
	XCT* DIVIDE	/FETCH DIVISOR
	JMS TWOS
	DAC DVS
	ISZ DIVIDE	/INCREMENT TO EXIT ADDRESS
	SNA		/DIVIDEND 0?
	JMP* DIVIDE	/YES -- EXIT WITH LINK = 1
	LAW -23		/SET UP COUNTER
	DAC DV1
	JMP DV2		/START DIVISION
DV3	LAC DVD		/FETCH DIVIDEND
	RAL		/ROTATE LEFT TO PICK UP NEXT BIT
	DAC DVD
	TAD DVS		/SUBTRACT DIVISOR FROM DIVIDEND
	SZL		/DIVIDEND GREATER THAN OR EQUAL TO DIVISOR
	DAC DVD		/YES
DV2	LAC QUO		/FETCH QUOTIEND
	RAL		/PICK UP QUOTIENT BIT FROM LINK
	DAC QUO
	ISZ DV1		/FINISHED?
	JMP DV3		/NO
	JMP* DIVIDE	/EXIT
/NUMBER EVALUATION ROUTINE
/
NUMEVL	0
	DZM NUMBR	/WHERE RESULTS WILL BE
	LAC CHRNUM
	SNA
	JMP* NUMEVL	/NUMBER IS 0
	TAD (-7
	SMA
	SET ERRORN
	LAC ARADD	/LAC (TAD NUMBER
	DAC OCTOUT
	LAC RADIX	/FIND RADIX
	SPA
	JMP CNVRSN	/DECIMAL
OCT	JMS INTUPN	/INITIALIZE UNPACKING RTNE
	JMS UNPACK	/GET A DIGIT
	TAD LM70	/CHECK FOR 8 OR 9
	SPA
	JMP SETOCT
	SET ERRORN	/N TO ERROR FLAG WORD
	JMP CNVRSN	/CONVERSION ROUTINE
SETOCT	ISZ CTR
	JMP OCT+1
	LAC NOPLIT	/INITIALIZE CONVERSION
	DAC OCTOUT	/ROUTINE FOR OCTAL
/6 BIT DECIMAL TO BINARY, OCTAL TO BINARY CONVERSION
/
CNVRSN	JMS INTUPN	/INITIALIZE UNPACKING RTNE
NXTDGT	JMS UNPACK	/GET A DIGIT
	AND L17		/NEED ONLY 4 BITS
	DAC UPKCHR
	CLL
	LAC NUMBR
	RTL		/X4
	SZL
	JMP OVA		/CHECK FOR OVERFLOW
OCTOUT	TAD NUMBR	/X5-NOP FOR OCT
	SZL
	JMP OVA
	RAL		/X10
	SZL
	JMP OVA
	TAD UPKCHR
	SZL
	JMP OVA
	DAC NUMBR
	ISZ CTR		/FINISHED WITH NUMBER
	JMP NXTDGT	/GET NEXT DIGIT
	JMP* NUMEVL
OVA	SET ERRORN	/N TO FLAG WORD
	JMP* NUMEVL
/INITIALIZE NUMERIC UNPACKING
/
INTUPN	0
	LAC CHRNUM
	JMS TWOS
	DAC CTR
	LAC AD08	/PACKS
	JMS UP6INT
	JMP* INTUPN
	.TITLE PACK FROM SIXBT TO MODIFIED RADIX 50.
/
/SQOZING SUBROUTINE
/LAC INPUT LOC
/JMS SQOZE
/OUTPUT IN SQZOUT AND SQZOUT+1
/
SQOZE	0
	JMS UP6INT	/INIT UNPACKING
	DZM SQZOUT	/INITIALIZE SQOZING AREA
	DZM SQZOUT+1
	DZM SQZOUT+2
	LAC AD32	/SQZOUT
	DAC SQZLOC
	LAW -6
	DAC CTR1
	LAW -3
	DAC CTR
SQZNXT	JMS UNPACK	/GET A CHARACTER
	DAC TMP
	LAC LPAREN	/CONSTANT 50
	JMS MPY		/MULTIPLY ACCUMULATED
	LAC* SQZLOC	/SQOZED VALUE BY 50 (8)
	DAC* SQZLOC
	LAC TMP		/CONVERT CHAR TO RADIX 50 (8)
	AND L40
	SNA
	JMP SQZACM	/A-Z
	LAC TMP
	AND K20
	SNA
	JMP NONAN	/.OR %
	LAW -23
	TAD TMP		/0-9
	DAC TMP
	JMP SQZACM
NONAN	LAC L33
	DAC TMP
	LAC UPKCHR	/UNPACKED CHAR
	SAD L56		/.
	INC TMP		/FOR %
SQZACM	LAC* SQZLOC
	TAD TMP		/ADD NEW CHAR INTO
	DAC* SQZLOC	/ACCUMULATED SQOZED VALUE
	ISZ CTR
	SKP
	INC SQZLOC	/UPDATE FOR NEW OUTPUT WORD
	ISZ CTR1	/CHECK FOR 6 CHARS PROCESSED
	JMP SQZNXT	/GET NEXT CHAR
	JMP* SQOZE
SQZOUT	0;	0;	0
	.TITLE PACK IN IOPS ASCII (5/7)
/
/
/5/7 ASCII PACKING SUBROUTINE
/DZM CTR57
/LAC (STLOC  -OUTPUT STARTING LOCATION
/DAC PK57AD
/INPUT IN AC
/
PACK57	0
	AND L177
	DAC TMP		/SAVE INPUT CHARACTER
	CLL
	LAC CTR57
	TAD (JMP .+4
	DAC .+2		/GET CHARACTER POSITION
	LAC TMP
	0
	JMP CH571	/1ST CHAR
	JMP CH572	/2ND CHAR
	JMP CH573	/3RD CHAR
	JMP CH574	/4TH CHAR
	JMP CH575	/5TH CHAR
CH571	JMS RIGHT8	/SHIFT AC RIGHT 8-BITS.
	DAC TMP
	LAC* PK57AD
	AND (3777
	JMP END57
CH572	JMS LEFT4	/SHIFT AC LEFT 4-BITS.
	DAC TMP
	LAW 14017
	AND* PK57AD
	JMP END57
CH573	JMS RIGHT3	/3 RIGHT
	AND L17
	DAC TMP1
	LAW 17760
	AND* PK57AD
	XOR TMP1
	DAC* PK57AD
	ISZ PK57AD
	LAC TMP		/GET 2ND HALF
	JMS RIGHT4
	AND IOTLIT
	DAC TMP
	LAC* PK57AD
	AND L57S
	JMP END57
CH574	JMS LEFT8
	DAC TMP
	LAC* PK57AD
	AND (700377
	JMP END57
CH575	RAL
	DAC TMP
	LAW 17400
	AND* PK57AD
	DZM CTR57	/RESET 5/7 COUNTER
	SKP
END57	ISZ CTR57	/SET COUNTER FOR NEXT
	XOR TMP		/MERGE CHARACTER
	DAC* PK57AD	/INTO 5/7 PAIR
	LAC CTR57
	SNA
	ISZ PK57AD
	JMP* PACK57	/EXIT
/BINARY TO OCTAL - 1 CHARACTER AT A TIME
/
/CTR=POSITION IN WORD (2'S COMPLEMENT)
/JMS BNOCT
/LAC BNLOC
/ON EXIT; CHAR IN AC
/
BNOCT	0
/ITS ILLEGAL FOR RSX AND BACKGROUND/FOREGROUND TO DO AN XCT TO AN XCT.
	.IFDEF BF
	LAC* BNOCT
	DAC TT2-1	/CLOBBER THE XCT INSTRUCTION.
	.ENDC
	.IFDEF	RSX
	LAC*	BNOCT
	DAC	TT2-1	/OVERLAY THE INSTRUCTION
	.ENDC
	LAC (JMP BN2
	TAD CTR
	DAC .+2		/GET CHARACTER POSITION
	XCT* BNOCT	/PICK UP INPUT WORD
TT2	0
	JMS RIGHT3	/BITS 0-2
	JMS RIGHT3	/BITS 3-5
	JMS RIGHT3	/BITS 6-8
	JMS RIGHT3	/BITS 9-11
	JMS RIGHT3	/BITS 12-14
	AND L7		/BITS 15-17
BN2	XOR L60
	INC BNOCT	/UPDATE FOR RETURN
	JMP* BNOCT
	.TITLE 	** GET SYMBOL VALUE FROM USER TABLE **
/
/ROUTINE TO PICK UP SYMBOL VALUE
/
SYMVAL	0
	LAC* MRGLOC
	RCL
	IDX MRGLOC
	LAC* MRGLOC
	AND JMPLIT
	IDX MRGLOC
	SZA
	JMP NOTFOR
/
	SNL
	JMP NOTFOR	/NOT A FORWARD REF.
	SET ERRORF
	SET NCD
/
NOTFOR	LAC* MRGLOC
	DAC NUMBR
	JMP* SYMVAL	/RETURN
	.TITLE TEXT PRINTING ROUTINES.
/
/IF THIS IS AN ERROR LINE ANS IF NO PRINTING HAS BEEN
/SPECIFIED IN THE COMMAND STRING ('L' OR 'N'), DO NOT
/SHRINK THE TEXT LINE. LEAVE IN THE DECIMAL LINE
/NUMBER.
/
SHRINK	0
	LAC ALOPTN	/L OR N?
	SZA		/NOT USED.TEST FOR ERRORS.
	JMP SHROK	/SHRINKINK OK.
SH.FLG	LAC FLGSAV	/ERROR FLAGS UP?
	SZA!CLA		/YES..IF NON 0.
	JMP NOSHRK	/DON'T SHRINK THE LINE.
SHROK	LAC NSWCH
	SNA!CLA
	LAC L2
NOSHRK	XCT* SHRINK
	JMS PRINT
	JMP* SHRINK
/
/BUFFER ADDRESS IS THE ARG TO THIS SUBROUTINE.
/PRINT LISTING SUBROUTINE AND OUTPUT L.L. BEGINNING CODES.
/IF THE CONDSW SWITCH IS SET, THIS LINE IS IN A CONDITIONALLY DEFINED
/AREA WHERE THE CONDITIONAL IS NOT SATISFIED AND NO OBJECT CODE
/IS PRODUCED.  IF THE 'C' PARAMETER WAS TYPED, THIS LINE WILL BE
/IGNORED AND THE PROGRAM EXITS.
/
PRINT	0
	DAC PRTXXX
	XCT PASSNO
	JMP NTFLN	/PASS1
	LAC FSTLNE	/FIRST LINE
	SMA		/YES
	JMP NTFLN
	DZM FSTLNE
	IFUNA JMS,TMODE,JMP,NTFLN
	LAC PRGSZE
	DAC LLBWRD	/OUTPUT PROG SIZE
	LAC SYMSAV
	SZA
	JMP PFLH4
	LAC LLBWRD
	XOR XCTLIT
	DAC LLBWRD
PFLH4	LAC L1
	DAC LLCODE
	JMS BLDLLB
	LAC L1		/INIT FOR INTERNAL
	JMS GIVS	/OUTPUT INTERNALS
	.IFUND %MACI
	IFUNA LAC,.SEK11
	.ENDC
	IFDEA LAC,AD02
	.IFDEF %MACI
	LAC AD02
	.ENDC
	JMS NAMSQZ
	JMP CODE33
NAMSQZ	0
	JMS SQOZE	/PUT PROG NAME IN RADIX 50
	LAC SQZOUT
	DAC LLBWRD	/DATA WORD
	LAC L7
	DAC LLCODE	/CODE
	LAC SQZOUT+1
	SNA		/4-6 CHARS
	JMP PFLH2	/1-3 CHARS
	LAC SQZOUT
	AND L157S
	XOR XCTLIT	/SET 4-6 CHARS IND
	DAC LLBWRD
PFLH2	JMS BLDLLB	/BUILD L/L BINARY
	LAC L10
	DAC LLCODE
	LAC SQZOUT+1
	DAC LLBWRD	/CHARS 4-6
	SZA
	JMS BLDLLB
	JMP* NAMSQZ
CODE33=.
	.IFDEF %DOS15
	.IFDEF	RSX
	LAC	.SEK11	/CHECK TO SEE IF AN EXTENSION WAS GIVEN
	TAD	L2
	DAC	AUTO10	/SAVE TEMP TO LOOK AT 3 WORD OF FILE NAME
	LAC*	AUTO10	/PICK UP EXTENSION
	SZA		/IS IT ZERO?
	JMP	CODE3A	/NO USE GIVEN EXTENSION
	LAC	(SRCEXT)	
	JMP	CODE3B	/YES -- USE SRC EXTENSION
CODE3A=.
	.ENDC
	LAC OSWCH	/WAS OMIT REQ?
	SZA
	JMP NEWLOD	/YES LEAVE IT OUT.
	LAC .SEK11	/ADDRESS OF NAME FROM -11.
	TAD L2		/POINT TO EXTENSION.
	.IFDEF	RSX
CODE3B=.
	.ENDC
	JMS SQOZE
	LAC SQZOUT
	JMS LL.OUT
	LAC L33
	.ENDC
/
NEWLOD	LAC XCTLIT
	JMS LL.OUT
	LAC L23
	SET LASW	/OUTPUT NEW LOAD ADDRESS SWITCH
NTFLN	LAC CONDSW	/UNDEFINED CONDITIONAL?
	SNA
	JMP NOTCON	/NOT UNDEF COND.
	LAC CSWCH
	SZA
	JMP* PRINT
NOTCON	LAC EXPSW	/IN MACRO EXPANSION
	IFUNA SNA,,JMP,TSTRPT
	IFDEA SZA
/THIS LINE IS PART OF MACRO-EXPANSION.
/IF THE GSWCH WAS NOT USED DO NOT PRINT THE LINE.
/
/IF THIS IS AN ERROR LINE IGNORE THE G-SWITCH.
/
	LAC FLGSAV	/ERROR FLAG.
	SZA
	JMP NOTEXP
TSTG	LAC GSWCH	/WAS 'G' PARAM TYPED?
LSZA	SZA		
	JMP* PRINT	/YES..EXIT
NOTEXP	ISZ LNCTR	/60 LINES PRINTED
	JMP .+3
	JMS EJECT	/PAGE EJECT ROUTINE
	ISZ LNCTR
	LAC CHRHLD
	XCT PASSNO
	JMP* PRINT	/PASS1
	DAC TMP
	LAC RDBUF+2
	JMS LEFT8	/ROTATE AC LEFT 8-BITS
	AND L177
	DAC CHRHLD
	JMS CHRLKP	/CHECK FIRST CHARACTER FOR
	157775		/LF. FF OR VT
	SKP		/FOUND
	JMP PRTLNE
	LAC RDBUF+2
	AND (3777
	DAC RDBUF+2	/NULL TO 1ST CHARACTER
/PRINT THE SOURCE LINE
/
PRTLNE	LAC TMP
	DAC CHRHLD
	LAC FLGSAV	/ANY ERRORS?
	DAC PRTLNB	/0 IF NO ERRORS
	DZM FLGSAV
	JMS PRTSOH	/PRINT SOURCE
PRTXXX	XX		/ADDRESS TO BE PRINTED(ARG TO SUB)
PRTLNB	0		/0=NORMAL, 1=ERROR LINE
	JMS PRTINT	/CLEAR OUTPUT AREA
	JMP* PRINT
	.IFUND %BFA
TSTRPT	LAC RPTSW
	SNA
	JMP NOTEXP
	LAC STOPPER
	SZA
	JMP TSTG
	JMP NOTEXP
	.ENDC
MOD33B	PRTBUF-1
	.TITLE PRINT MULT DEFINITIONS,PK SIXBT TO ASCII
MDER	0
	JMS UP6INT
	LAC AD09	/TXTBF
	JMS P57INT
	JMS P657	/SIXBT TO 5/7 ASCII
	JMS PKBLNK	/PACK A BLANK
	LAW -5
	JMS MOVBIN	/BINARY TO OCTAL (VALUE IN S/T)
	LAC* MRGSAV	/POINTER TO WORD 3 OF S/T
	LAC L73		/;
	JMS PACK57
	LAW -5
	JMS MOVBIN	/BINARY TO OCTAL
	LAC PC		/PC AS INPUT
	JMS P57K15
	JMS PRTSOH	/PRINT ERROR
MOD33C	TXTBF-1
EQSIGN	75		/= (CONSTANT)
	JMP* MDER
/SUBROUTINE TO PACK FROM .SIXBT TO 5/7 ASCII.
/THE BUFFER POINTERS AND COUNTERS ARE ALREADY SETUP BEFORE
/CALLING THIS ROUTINE.
P657	0
	LAW -6
	DAC EJECT
P657LP	JMS UNPACK	/TOP OF LOOP.
	SNA		/RELPACE 00 WITH BLANK
	LAC L40
	DAC UPKCHR
	TAD LM33
	SPA!CLA
	LAC L100
	XOR UPKCHR
	JMS PACK57
	ISZ EJECT
	JMP P657LP
	JMP* P657	/EXIT
CTR	0
	.TITLE *EJECT*--PAGE EJECT ROUTINE.
/
/
EJECT	0
	LAC PK57AD	/SAVE POINTERS TO
	DAC SVMCPT	/MACRO TABLE.
	LAC CTR57
	DAC SVMCCT
LM66	LAW -66
	DAC LNCTR
	ISZ PGCTR	/UPDATE PAGE COUNT
	XCT PASSNO	/WHAT PASS?
	JMP CPAGE	/PASS1
	JMS PRTSOH
MOD34	HOF-1
	0
CPAGE	JMS BINDEC	/CONVERT PAGE COUNT
	LAC PGCTR	/TO DECIMAL
	LAW -3
	JMS MOVEPK
	LAC AD24	/DECOUT+2
	LAC AD23	/P57INT
	XCT PASSNO
	JMP NOHEAD
	JMS PRTSOH	/PRINT HEADING
MOD34A	HDRLNE-1
	0
	JMS PRTSOH	/PRINT LF
MOD34B	LF-1
	0
	JMP TCNOT	/PASS2 IGNORE.
NOHEAD	LAW -4		/SET UP MOVER
	JMS MOVER
	LAC TCSTRT
	LAC TCPAGE
	LAC TITLET	/IS THIS A .TITLE?
	SNA		/YES
	JMP TCNOT	/NO IGNORE IT
	LAC TSWCH
	DAC TCPRT
	LAC ERLNCT
	DAC MDER
	JMS PRTSOH
TCMOD	PRNAIM+1
TCPRT	XX
	DZM TITLET
	LAC MDER
	DAC ERLNCT
TCNOT=.
	LAC SVMCPT	/RESTORE POINTERS TO
	DAC PK57AD	/MACRO TABLE.
	LAC SVMCCT
	DAC CTR57
	JMP* EJECT
/
/
/
/GET BEGINNING OF SYMBOL TABLE
/
GBST	0
	LAC BEGUST
	DAC USTBEG
	JMS CKEST
	JMP* GBST	/NO SYMBOLS RETURN
	IDX GBST
	JMP* GBST
/GET INTERNAL OR VIRTUAL SYMBOLS
/
GIVS	0
	DAC IOVS
	JMS GBST	/GET START OF S/T
	JMP* GIVS	/NO SYMBOLS
GIVSN	JMS LLSTBL
IOVS	0		/1=INTERNAL, 2=VIRTUAL
	ISZ USTBEG
	JMS USTB2
	JMS CKEST	/FINISHED
	JMP* GIVS	/YES
	JMP GIVSN	/NO
	.TITLE BINARY TO DECIMAL SUBROUTINE.
/
/BINARY TO DECIMAL SUBROUTINE
/
/JMS BINDEC
/LAC INPUT LOCATION
/OUTPUT IN DECOUT THRU DECOUT+5
/
BINDEC	0
	LAC L40
	.REPT 6,1
	DAC DECOUT
	XCT* BINDEC	/PICK UP INPUT
	DAC BNDVND	/SAVE AS DIVIDEND
	LAC AD31	/DECOUT+5
	DAC DECLOC
DVDREM	JMS DIVIDE	/DIVIDE BY 10 DECIMAL
	LAC BNDVND
	LAC L12
	DAC BNDVND
	LAC DVD
	XOR L60		/REMAINDER IS DECIMAL
	DAC* DECLOC	/DIGIT
	JMS SUB1	/DECLOC=DECLOC-1
	DAC DECLOC
	LAC BNDVND	/IF QUOTIENT IS 0
	SNA		/EXIT, ELSE MAKE
	JMP* BINDEC	/QUOTIENT NEW DIVIDEND
	JMP DVDREM
DECOUT	0
	0
	0
	0
	0
	0
/
	.TITLE PRTSOH-LAST LEVEL OF PRINT.
/
/JMS PRTSOH
/AREA-1 TO BE PRINTED
/0 OR 1; 0=NORMAL LINE, 1=ERROR LINE
/
PRTSOH	0
	LAC* PRTSOH
	DAC CLEARS	/AREA-1 TO BE MOVED
	IDX PRTSOH
	LAC* PRTSOH	/TYPE OF LINE
/0=NORMAL, 1=ERROR
/
	IDX PRTSOH	/UPDATE FOR RETURN
	SZA
	INC ERLNCT	/COUNT LINES.
	DAC FOREFG	/ERROR FLAG FOR ESWITCH.
	TAD ALOPTN	/LISTING OR S/T REQUESTED
	SNA		/YES
	JMP* PRTSOH	/NO, EXIT
	.IFUND %MACI
/
SET1ST	NOP		/NOP OR SKP
	JMS NAME12	/ITS SET TO NOP AT 'PASS1'.
	.IFUND RSX
PRTA	CAL+766		/WAIT FOR -12
	12
	.ENDC
	.IFDEF	RSX
	JMS	WAIT12	/WAIT FOR LISTING DEVICE
	.ENDC
	.ENDC
	LAC ESWCH	/E-SWITCH SPECIFIED?
	SNA		/YES WAIT FOR -3
	JMP FIXWPC	/NO GET WORD PAIR COUNT.
	.IFUND RSX
	.WAIT -3
	.ENDC
	.IFDEF	RSX
	JMS	WAITFR	/WAIT FOR OUTPUT TTY
	.ENDC
/
/COMPUTE WORD/PAIR COUNT OF LISTING LINE
/
FIXWPC	LAC L2		/ONE WORD FOR HEADER AND 1 FOR DATA.
	DAC PRTLIN
	LAW -5
	DAC TEMP00	/COUNT 5/7 PAIRS.
	LAC PK57AD	/SAVE 5/7 POINTERS
	DAC TEMP01
	LAC CTR57
	DAC TEMP02
	IDX CLEARS	/POINT TO DATA(WAS DATA-1)
	LAC CHRHLD
	DAC MP1
	LAC UPKAD	/SAVE UNPACKING VALUES
	DAC MP2
	LAC PKNUM
	DAC MP3
	LAC CLEARS
	JMS USET57
	LAC AD45
	JMS P57INT
PLOOPN	JMS GETCHR
	SAD L15	/CR?
	JMP LASTG	/YES ITS THE LAST CHAR.
	SNA		/NO..IS IT A NULL?
	JMP PLOOPN	/YES IGNORE IT
	JMS PACK57	/NO PACK IT
	ISZ TEMP00
	JMP PLOOPN
	INC PRTLIN
	LAW -5		/RESET COUNTER
	DAC TEMP00
	JMP PLOOPN
LASTG	JMS PACK57
	LAC PRTLIN
	RCL
	JMS LEFT8
	.IFDEF	RSX
	AAC	2	/RSX NEEDS DATA MODE HERE
	.ENDC
	DAC PRTLIN
	LAC MP2
	DAC UPKAD	/RESTORE UNPACKING VALUES
	LAC TEMP01
	DAC PK57AD
	LAC TEMP02
	DAC CTR57
	LAC MP3
	DAC PKNUM
	.IFDEF RSX
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL	WRTCBA	/WRITE PRTLIN
	JMS	RSAUTO	/RESTORE AUTO XR'S
	.ENDC
	.IFUND %MACI
	.IFUND RSX
PRTB	CAL+2766	/WRITE ON -12
	11
MOD37	PRTLIN
	-72
	.ENDC
	LAC ESWCH	/SHOULD THIS LINE GOTO -3 ALSO?
	SNA		/NO IF E-OPTION NOT TYPED.
	JMP PRLEEV	/EXIT FROM PRINTING ROUTINE.
	LAC FOREFG	/PRINT ONLY IF ITS AN ERROR LINE.
	SNA
	JMP PRLEEV
	LAC MOD37
	JMS WRITE3
	.ENDC
	.IFDEF %MACI
	LAC DSWCH
	SNA
	JMP TTYPRT
	JMS DWRITE
	PRTLIN
	JMP PRLEEV
TTYPRT	JMS TTYOUT
	PRTLIN
	.ENDC
PRLEEV	LAC MP1
	DAC CHRHLD
	JMP* PRTSOH
TEMP00	0
TEMP01	0
TEMP02	0
FOREFG	0	/SAVE ERROR INDICATOR.
	.IFDEF	RSX
MOD37	PRTLIN
	.ENDC
/
/ NAME12 IS CALLED TO INITIALIZE AND ENTER A NAME
/ TO DAT -12. ITS CALLED ONLY ONCE PER ASSEMBLY AND
/ NOT AT ALL IF THE A,X,N,V,T,OR L OPTIONS ARE
/ NOT SPECIFIED IN THE COMMAND STRING.(IF
/ THERE ARE ERRORS IN THE ASSEMBLY THIS SUBR
/ IS ALWAYS CALLED.).
/
NAME12	0
	LAC SKPLIT	/MAKE SURE WE DON'T COME
	DAC SET1ST	/HERE AGAIN FOR THIS ASSEMBLY.
	.IFUND RSX
	CAL+1766	/.INIT TO -12.
	1
MOD3A	PASS1P	/RESTART ADDRESS.
	0		/FILLED IN BY -12 HANDLER.
	LAC FILE	/1ST 3 CHARS OF NAME.
	DAC TEMP00
	LAC FILE+1
	DAC TEMP01
	LAC LSTEXT	/'LST' EXTENSION.
	DAC TEMP02
/
/NAME IS COMPLETE; DO THE .ENTER.
/
L766	CAL 766
	4
MOD4	TEMP00
	.ENDC
	.IFDEF RSX
	LAC	LSWCH	/IS THE LISTING DEVICE SPECIFIED?
	SNA
	JMP*	NAME12	/NO -- DON'T INIT IT
	LAC	(DAT12)	/ATTACH OUTPUT LISTING DEVICE
	JMS	ATACH
	LAC	(DAT12)	/SET UP THE ENTER FOR THE LISTING DEVICE
	DAC OUTNAM-1	/SET IT IN THE LUN OF THE ENTER
	LAC FILE	/SET THE FILE NAME IN THE CPB REQUEST
	DAC OUTNAM	/WORD 1
	LAC FILE+1	/WORD 2
	DAC OUTNAM+1
	LAC LSTEXT	/EXTENSION FOR THE FILENAME
	DAC OUTEXT
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL ENTCPB	/DO A .ENTER ON DAT12 THE LISTING DEVICE
	CAL	WFSK	/WAIT FOR THE ENTER
	JMS	RSAUTO	/RESTORE AUTOXR'S
	LAC	SKEV	/PICK UP THE EVENT VARIABLE
	SMA		/WAIT THE ENTER OK?
	JMP*	NAME12	/YES RETURN
	SAD	(-6)	/NO -- IS THIS FILE STRUCTURED?
	JMP*	NAME12	/NO MUST BE OK
	JMS	IOERR	/YES -- ERROR
	LAC	(DAT12)	/LUN OF THIS ERROR
	.ENDC
	.IFUND	RSX
	JMP* NAME12
	.ENDC
	.TITLE ALL INPUT EXCEPT -2 .
	.IFUND %MACI
/SOURCE INPUT DOUBLE BUFFERING
/
	.IFDEF	RSX
	DBLBUF-PARMES+2*1000/2+2	/RSX NEEDS HEADER
	0
	.ENDC
PARMES	.ASCII 'PARITY ERROR'<15>
DBLBUF	0
	.IFUND RSX
	.IFUND %BFA
	XX
	.ENDC
	.IFDEF %BFA
	CAL+767	/NO GUESSING ABOUT DAT SLOTS WITH MACROA
	.ENDC
	12
	.ENDC
	.IFDEF RSX
	JMS WAIT11
	.ENDC
/TEST THE FIRST HEADER FOR PARITY ERRORS.
/
	LAC SRCBUF
	AND L60
	SAD K20
	SKP
	JMP NOTPAR
	LAC PARITY
	JMS WRITE3
NOTPAR=.
	LAC SRCBUF
	AND L17
	SAD L6
	JMP .EOT+1
	SAD L5		/CONTROL D ENCOUNTERED
	JMP .EOT+1
	.IFDEF	RSX
	LAC	SRCBUF+2	/TEMP FIX FOR ^D UNDER RSX
	AND	(774000) /IS IT A ^D?
	SAD	(020000)
	JMP	.EOT+1	/YES .EOT CONDITION
	.ENDC
	LAW -44
	JMS MOVER
	LAC AD03	/SRCBUF-1
	LAC AD04	/RDBUF-1
	JMS RDSRC	/READ NEXT SOURCE LINE
	LAC RDLST
	AND IOTLIT
	XOR (6400	/CR IN
	DAC RDLST	/PSN 74
	JMS UPBLB	/RESET TO RDBUF+2
	JMP* DBLBUF
/READ SOURCE ASCII INPUT
/
RDSRC	0
	.IFUND RSX
	.IFUND %BFA
	XX
	.ENDC
	.IFDEF %BFA
	CAL+2767	/READ IN IOPS ASCII FROM THE INPUT SLOT
	.ENDC
	10
MOD38	SRCBUF
	-44
	.ENDC
	.IFDEF RSX
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL	RDSRCB
	JMS	RSAUTO	/RESTORE AUTO XR'S
	.ENDC
	JMP* RDSRC
	.ENDC
	.IFDEF RSX
	.TITLE RSX CAL PARAMETER BLOCKS
/
/
/
RDSRCB	002600	/READ INPUT SOURCE CODE
	EV11	/EVENT VARIABLE ADDRESS FOR DAT11 AND DAT14
RDSRLN	XX	/LUN SLOT EITHER DAT11OR DAT14
	2	/IOPS ASCII	/IOPS ASCII MODE
	SRCBUF	/SOURCE CODE BUFFER
	44	/BUFFER SIZE
/
/
WRTCB	002700
	WTFREV
WRTLUN	DAT3	/OUTPUT TTY 
	2
WRTBUF	XX
/
WRNMER	002700	/WRITE ERROR MESSAGE NAME ERROR
	WTFREV	/EVENT VARIABLE ADDRESS
	DAT3	/OUTPUT TTY
	3	/IMAGE ASCII
	NOTHER	/BUFFER POINTER
/
/
ATCHCB	002400
	0
ATLUN	XX
/
/
DETACH	002500	/DETACH REQUEST
	0
DETLUN	XX
/
/
TTRDCB	002600	/READ FROM TTY FOR ^P TO START PASS2
	WTFREV
	DAT2	/LUN
	RDBUF	/BUFFER ADDRESS
	33	/MAX WORD COUNT
/
/
HINFCB	003600	/HANDLER INFORMATION REQUEST
	SKEV	/EVENT VARIABLE ADDRESS
HIFLUN	XX	/LUN ASSIGNMENT
/
/
SEEKCB	003200	/SEEK REQUEST
	SKEV	/EVENT VARIABLE FOR SEEK
SEKLUN	XX
FILNM1	XX
FILNM2	XX
FILEXT	XX
/
/
CLOSCB	003400
	WTFREV
CLSLUN	XX
/
CLOS12	3400	/CLOSE LISTING DEVICE
	0	/EVENT VARIABLE ADDRESS
	DAT12	/LUN FOR LISTING
/
CLOS13	3400	/CLOSE OUTPUT BINARY DEVICE
	EV13	/EVENT VARIABLE ADDRESS
	DAT13
/
WRTCBA	2700	/WRITE
	EV12	/EVENT VARIABLE
	DAT12	/LISTING DEVICE
	2	/IOPS ASCII
	PRTLIN	/BUFFER ADDRESS
/
/
/
WTFREV	0
WTFOR	20	/WAIT FOR EVENT VARIABLE
	WTFREV	/EVENT VARIABLE ADDRESS
/
/
/
ENTCPB	3300
	SKEV	/EVENT VARIABLE FOR ENTER REQUEST
	DAT13	/LUN SLOT FOR BINARY OUTPUT
OUTNAM	XX
	XX
OUTEXT	XX
/
/
WAITFR	0
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL	WTFOR	/WAIT FOR AN EVENT VARIABLE ON THE TT
	JMS	RSAUTO	/RESTORE AUTO XR'S
	LAC	WTFREV
	SMA
	JMP* WAITFR
	JMS	IOERR	/I/O ERROR ON THE TTY ABORT
	LAC	(DAT3)	/LUN OF I/O ERROR
/
OVFLMS	2700	/PRINT CORE OVERFLOW MESSAGE
	WTFREV	/EVENT VARIABLE ADDRESS
	DAT3	/TTY OUTPUT DEVICE
	2	/IOPS ASCII
	TORC-2	/LINE BUFFER
/
WRDMP	2700	/WRITE DUMPMODE
	EV13	/OUTPUT DUMPMODE EVENT VARIABLE
	DAT13	/LUN
	4	/MODE 4 (DUMP NOT IMPLEMENTED)
	PTPBUF	/BUFFER ADDRESS
BLDBN3	0	/WORD COUNT IN TWO'S COMP
/
WRBLKN	2700	/WRITE BLANKS
	EV13	/EVENT VARIABLE ADDRESS
	DAT13	/LUN
	3	/IMAGE ASCII
	BLNKS	/LINE BUFFER
/
WRD13	2700	/WRITE BINARY
	EV13	/EVENT VARIABLE ADDRESS
	DAT13	/LUN
	0	/IOPS BINARY
	PTPBUF	/BUFFER ADDRESS
/
WAIT11	0		/WAIT FOR EVENT VARIABLE EV11
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL	WF11	/WAITFOR
	JMS	RSAUTO	/RESTORE AUTO XR'S
	LAC	EV11	/PICK UP THE EVENT VARIABLE
	SMA		/WAS IT LEGAL?
	JMP*	WAIT11	/YES RETURN
	JMS	IOERR	/NO I/O ERROR EXIT
	LAC	(DAT11)	/LUN OF I/O ERROR
/
WAIT12	0		/WAIT FOR EVENT VARIABLE EV12
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL	WF12	/WAIT FOR EVENT VARIABLE
	JMS	RSAUTO	/RESTORE AUTO XR'S
	LAC	EV12	/PICK UP THE EVENT VARIABLE
	SMA		/WAS IT LEGAL?
	JMP*	WAIT12	/YES -- RETURN
	JMS	IOERR	/NO I/O ERROR EXIT
	LAC	(DAT12)	/LUN OF I/O ERROR
/
HINFRQ	0		/HINF REQUEST TO SEE IF LUN IS FILE STRUCTURED
	DAC	HIFLUN	/SAVE THE LUN SLOT
	CAL	HINFCB	/DO A HINF
	CAL	WFSK	/WAIT FOR EVENT VARIABLE
	LAC	SKEV	/CHECK TO SEE IF FILE STRUCTURED
	SPA		/POSITIVE HINF OK
	JMP	IOERRA	/I/O ERROR UNKNOWN EVENT VARIABLE
	AND	L40000	/MASK FF FILE STRUCTURED BITS
	JMP*	HINFRQ	/RETURN TO CALLER
/
IOERRA	JMS	IOERR	/I/O ERROR ON HINF REQUEST
	LAC	HIFLUN	/I/O ERROR LUN
/
CRLF	0		/RETURN CARRAGE SUBROUTINE
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL	CRRTN	/RETURN THE CARRAGE
	CAL	WTFOR	/WAIT FOR EVENT VARIABLE
	JMS	RSAUTO	/RESTORE AUTO XR'S
	JMP*	CRLF	/RETURN
/
SVAUTO	0		/SAVE AUTO XR'S BECAUSE THEY ARE LOST DURING A CAL
	LAC*	L10
	DAC	AUTO10
	LAC*	L11
	DAC	AUTO11
	LAC*	L12
	DAC	AUTO12
	JMP*	SVAUTO	/RETURN
/
RSAUTO	0		/RESTORE AUTO XR'S
	LAC	AUTO10
	DAC*	L10
	LAC	AUTO11
	DAC*	L11
	LAC	AUTO12
	DAC*	L12
	JMP*	RSAUTO	/RETURN
CRRTN	2700	/RETURN CARRAGE
	WTFREV	/EVENT VARIABLE ADDRESS
	DAT3	/LUN
	2	/IOPS ASCII MODE
	CRLFM	/MESSAGE
CRLFM	2002	/HEADER
	0
	.ASCII	<15>	
/
/
EV11	1	/SET TO 1 FOR BUFFERER I/O
EV12	1	/SET TO 1 FOR BUFFERED I/O
WF11	20	/WAITFOR EV11
	EV11	/EVENT VARIABLE ADDRESS
WF12	20	/WAIT FOR EV12
	EV12	/WAIT FOR EV12
/
WFEV13	20	/WAIT FOR EVENT VARIABLE
	EV13	/EVENT VARIABLE ADDRESS
EV13	1	/EVENT VARIABLE FOR DAT13 OUTPUT
/
ATACH	0	/ATTACH TO A DEVICE LUN IN AC
	DAC	ATLUN	/STORE THE LUN NUMBER
	JMS	SVAUTO	/SAVE AUTOXR'S
	CAL	ATCHCB	/DO THE ATTACH REQUEST
	JMS	RSAUTO	/RESTORE AUTOXR'S
	JMP*	ATACH	/RETURN
/
DETHCB	0	/DETACH FROM A DEVICE
	DAC	DETLUN	/LUN IN AC SET IT IN LUN NUMBER
	JMS	SVAUTO	/SAVE AUTO XR'S
	CAL	DETACH	/DETACH FROM DEVICE
	JMS	RSAUTO	/RESTORE AUTOXR'S
	JMP*	DETHCB	/RETURN
/
WAITSK	0	/WAIT FOR A SEEK TO COMPLETE
	CAL	WFSK	/WAIT FOR
	LAC	SKEV	/PICK UP THE THE EVENT VARIABLE
	SMA		/WAS THE REQUEST OK?
	JMP*	WAITSK	/YES -- RETURN
	SAD	(-6)	/IS IT AN UNIMPLEMENTED FUNCTION?
	JMP*	WAITSK	/YES RETURN
	JMP	IOERRA	/NO I/O ERROR
/
/	I/O ERROR HAS OCCURRED OUTPUT TO USER
/		MAC-I/O ERROR LUN XX EVENT VARIABLE YYYYYY
/
IOERR	0
	TCA		/COMPLEMENT ERROR TO MAKE IT POSITIVE
	LMQ		/SAVE IT IN MQ
	LAW	-6	/DECODE 6 DIGITS
	DAC	PSWCH	/SAVE TEMPORARILY
	LAC	(IOER-1)	/SET UP MESSAGE POINTER
	DAC*	(X10)
	JMS	DECOD	/DECODE MQ
	LAC	(IOERL-1)	/SET UP TO DECODE THE LUN
	DAC*	(X10)
	LAW	-2
	DAC	PSWCH	/DECODE THE LUN NUMBER
	XCT*	IOERR	/PICK UP THE LUN SLOT
	LRS	6	/PUT IT IN MQ
	JMS	DECOD	/DECODE THE LUN
	CAL	WRIOER	/WRITE ERROR ON OUTPUT TTY
	CAL	WTFOR	/WAIT FOR MESSAGE TO COMPLETE
	JMP	EXIT	/EXIT MACRO
/
DECOD	0		/DECODE MQ EVENT VARIABLE AND LUN
	ECLA!LLS 3
	AAC	60	/ADD 60 TO NUMBER
	DAC*	X10	/STORE IN MESSAGE
	ISZ	PSWCH	/FINISHED?
	JMP	DECOD+1	/NO DECODE THE NEXT CHARACTER
	JMP*	DECOD	/YES RETURN
/
/
IOERMS	ERMSE-IOERMS+1/2*1000+3
	0
	115	/M
	101	/A
	103	/C
	055	/-
	111	/I
	057	//
	117	/O
	040	/SP
	105	/E
	122	/R
	122	/R
	117	/O
	122	/R
	040	/SP
	114	/L
	125	/U
	116	/N
	040	/SP
IOERL	0	/LUN XX
	0
	040	/SP
IOER	.BLOCK	6	/EVENT VARIABLE
	000	/NULL
	012	/LF
ERMSE	015	/CR
/
WRIOER	2700	/WRITE I/O ERROR MESSAGE
	WTFREV	/EVENT VARIABLE ADDRESS
	DAT3	/OUTPUT DEVICE
	3	/IMAGE ASCII
	IOERMS	/BUFFER ADDRESS
/
WFSK	20	/EVENT VARIABLE
	SKEV	/EVENT VARIABLE ADDRESS
/
SKEV	0	/EVENT VARIABLE FOR SEEK
/
PARDEF	27	/PARTITION DEFINITION CAL
	PARSIZ	/EVENT VARIABLE RETURNS LAST WORD OF PARTITON
PARSIZ	0	/PARTITION SIZE
/
REDPAR	37	/READ PARAMETERS FROM TDV
	PARSIZ	/EVENT VARIABLE ADDRESS
	PARBUF	/PARAMETER BUFFER
	40	/BUFFER SIZE (WORDS)
/
AUTO10	0	/AUTO XR 10 SAVE AND RESTORE AND TEMP STORAGE FOR CODE33
AUTO11	0
AUTO12	0	/SAVE AND RESTORE OF AUTO XR 12 FOR CAL'S
/
POISW	0	/1= EXIT ON CR OR ALTMODE
INITSW	0	/ONCE ONLY CODE SWITCH
PKNUMS	0	/BUFFER COUNT FOR COMMAND LINE
UPKADS	0	/BUFFER POINTER FOR COMMAND LINE
VERPNT	0	/PRINT VERSION SWITCH
PSWCHS	0	/PSWITCH SAVE
L6	6	/CONSTANT 6
/
WRDPMD	2700	/WRITE DUMP MODE
	EV13	/EVENT VARIABLE ADDRESS
	DAT13	/LUN
	4	/DUMP MODE
	BINLDR	/LINE BUFFER
	ENDLDR-BINLDR\777777+1
/
WRHRI	2700	/WRITE HARDWARE READIN
	EV13	/EVENT VARIABLE
	DAT13	/LUN
	3	/IMAGE ASCII
	HRMWD	/LINE BUFFER
/
WRPDM	2700
	EV13	/EVENT VARIABLE ADDRESS
	DAT13	/LUN
	4	/DUMP MODE
	ENDVAL	/LINE BUFFER
	-2	/WORD COUNT
/
WRFHW	2700
	EV13	/EVENT VARIABLE
	DAT13	/LUN
	3	/IMAGE ASCII
	FULHRW	/LINE BUFFER
/
PARBUF	.BLOCK	40	/PARAMETER BUFFER
	.ENDC
	.TITLE ADDRESS CONSTANTS
/ADDRESS CONSTANTS WHICH REQUIRE
/BANK BITS TO BE APPENDED
/
ADF=.
AD00	MODF
AD01	RDBUF+2
ADTXT	TXTOP+1	/FUDGE RETURN ADDRESS OF TEXT CHECKER(.SIXBT,ASCII)
AD02	FILE
ADFILE	FILE-1
BKP3ST	P3ARGS-1	/ADDRESS OF ARG RECEIVER FOR CREF.
PTRFSW	FSWCH		/ARGUMENT STRING PTR FOR CREF.
	.IFUND %MACI
AD03	SRCBUF-1
AD05	NEWTAP
	.ENDC
AD04	RDBUF-1
AD06	PACKT
AD08	PACKS
AD09	TXTBF
AD110	STOPPER-1	/POINT TO FLAG WORD.
AD13	TXTBF-1
AD143	HDRLNE+5
	.IFUND %BFA
ADTITX	TEXTT
	.ENDC
AD16	UNSQZV-1
ADPNAM	PRNAIM
AD17	ENDVAL
AD20	UNSQZV
AD23	PNMBR		/PAGE NUMBER
TCPAGE	PRNAIM+1
TCSTRT	PNMBR-1
AD24	DECOUT+2
AD25	BNADDR-1
	BNDATA-1
AD27	PTPBUF+1
ADBEG	ENDPP		/FOR OVERLAYING EXTRA PAGE CODE.
AD29	IOPHDR-1
AD30	PTPBUF-1
AD31	DECOUT+5
MESMAC	ID-2
MESCRT	LF-1
MESER	QMARK-2
	.IFUND %MACI
ADLITG	LTABLE
	.IFUND %BFA
ADST11	SET.11
ADFNDF	FNDFIL
MESNAM	NOTHERE-2
	.ENDC
PARITY	PARMES-2
	.IFUND	RSX
CONTP	PS1MSG-2
	.ENDC
	.IFDEF	RSX
CONTP	CNTPMS-2
	.ENDC
	.ENDC
ERRPTR	ERRLIN
	.IFUND	RSX
MSGEOT	EOTMSG-2
	.ENDC
P1MES	ENDPAS-2
	.IFUND	RSX
MESWRN	WRNMES-2
	.ENDC
ADS0	PSIZEE		/SIZE OF PROGRAM
AD32	SQZOUT
AD333	PRTBUF-1
AD34	FULHRW+1
AD36	PRTLIN+1
AD37	PASS2
AD38	ERNMBR
/	.IFDEF %PTP	/WHEN CREF IS IMPLEMENTED IN PAPER TAPE SYSTEMSTP
/MESSP3	P3MESS	/THESE THREE LINES SHOULD NOT BE COMMENTS.
/	.ENDC
AD39	RDLST
AD40	DECOUT-1
AD41	BP1T-1
EFLAGS	ERRORA
AD42	BP12T-1
AD43	BST-1
AD45	PRTLIN+2
TOP	ENDPP		/END OF EXTRA PAGE CODE.
	.IFUND %BF15A
	.IFUND %MACI
	.IFUND %PDP9
AD50	LODMOD+1
	.ENDC
	.ENDC
	.ENDC
LPASS3	CREFCA	/LOAD ADDRESS OF PASS3
LP3ST	CREFST	/START ADDRESS OF PASS3
AD511	DECOUT+1	/ADDR-1 OF DECIMAL SEQ IMAGES.
AD666	RDBUF-6		/
AD667	RDBUF-7
	.IFDEF %BFA
ADDTSK	DOTSEK
	.ENDC
AD222	PRTBUF
ADL=.
ADCT=ADL-ADF\777777+1
	.TITLE MACROI SOURCE INPUT ROUTINE.
	.IFDEF %MACI
RDSRC	0
	LAC PSWCH
	SNA
	JMP RDTAPI
	JMS TTYIN
	LAC TTCHR	/CONTROL D?
	SAD L4
	JMP .EOT
	JMP RDEXIT
RDTAPI	JMS DREAD
	LAC DTIBUF	/CHECK HEADER
	AND L17
	SAD L6
	JMP .EOT+1
	SAD L5
	JMP .EOT+1
	LAW -44
	JMS MOVER
	LAC LIBUF1
	LAC AD04
	LAC RDLST
	AND IOTLIT
	XOR (6400
	DAC RDLST
RDEXIT	JMS UPBLB
	JMP* RDSRC
	.ENDC
	.ENDC
	.TITLE CONSTANTS AND TEMP STORAGE.
/MACRO-15 CONSTANTS*********
LPAREN	50		/(
RPAREN	51		/)
VARAB	43		/#
L126	126		/V
L107	107		/G
LEFTAB	74		/<
RITEAB	76		/>
L170	170
L7	7
L60	60
L5	5
	.IFDEF RSX
%%MODE	1
LM33	-33
	.ENDC
	.IFDEF %MACI
L1000	1000
L400	400
L40000	40000
	.ENDC
L137	137
L377	377
L17	17
L47S	7777
L37S	777
L26	26
L77	77
L27	27
L110	110		/H
	.IFUND %MACI
L132	132		/Z
	.ENDC
L30	30
L33	33
L147S	17777
L347S	37777
L357S	377777
L64Z	60000
L3000	3000
L31	31
L32	32
L42	42
L23	23
L157S	177777
L10	10
K4	4
L4=K4
L100	100
CONCAT=L100
L20000	20000
L2000	2000
K10000	10000
K20	20
L200	200
L57S	77777
LM40	-40
LM70	-70
	.IFDEF %MACI
L175	175
LM35	-35
LM33	-33
	.ENDC
/MACRO-15 TEMP STORAGE
	.IFUND %PTP
	.IFUND	BF
	.IFUND	RSX
PACKS	LAC .DTBLK	/GET FIRST BLOCK NO OF MACRO.		/
	.ENDC
	.ENDC
	.IFDEF	%BF15
PACKS	LAC	(547
	.ENDC
	.IFDEF	%BF15A
PACKS	LAC	(660
	.ENDC
	.ENDC
	.IFDEF	RSX
PACKS	NOP	/SPACE REQUIRED BECAUSE PACKS IS A 2 WORD STORAGE
	.ENDC
	.IFDEF %PTP
PACKS	0
	.ENDC
	DAC FBLOCK
	.IFDEF	%BF15A
	LAC	(547
	.ENDC
OPRTR	TAD BSIZE	/THE NO OF BLOCKS IN MACRO
MRGSAV	DAC P3BLOK	/THE FIRST BLOCK OF CREF.
	.IFUND %PTP
	.IFUND	BF
	.IFUND	RSX
PRGSVE	LAC .DTWC	/GET SIZE OF MACRO(FROM BOOTSTRAP)
	.ENDC
	.ENDC
	.ENDC
	.IFDEF %PTP
PRGSVE	0
	.ENDC
	.IFDEF	BF
PRGSVE	LAC	ENDVAL
DVD	JMS	TWOS
	.ENDC
SYMSAV	DAC MSZE
UNDLOC	JMS .
EXTLOC LAC .-1
EXTLC1	AND L64Z
LITLOC	TAD SIXCTR
USTBEG	DAC MLOAD
SZECTR	JMP INITBB
	.IFUND RSX
SIXCTR	FIRST-1
	.ENDC
	.IFDEF RSX
SIXCTR	0
	.ENDC
BSIZE=.
BEGDEF	.MACRO
VARLOC	JMP INITBB
	.IFDEF BF
ENDVAL	17770-BFIRST
	.ENDC
	.IFUND BF
ENDVAL	0
DVD	0
	.ENDC
SETX=PACKS
NUMVAL	0
CTRLK	0
	.IFDEF	%BFA
BULK11	0
	.ENDC
	.IFDEF BF
	.IFUND %BMODE
%%MODE	0
	.ENDC
	.IFDEF %BMODE
%%MODE	1
	.ENDC
	.ENDC
/
/
	.IFDEF %MACI
	.IFUND %BMODE
%%MODE	0
	.ENDC
	.IFDEF %BMODE
%%MODE	1
	.ENDC
	.ENDC
/
/
UNSQZL	0
CHRHLD	0
WORDCT	0
MRGLOC	0
CMPLOC	0
TMPT	0
TMP	0
BEGRAL	0
BITS	0
PRGSZE	0
CT57SV	0
PK57SC	0
BEGDAL	0
LLWDCT	0
LLBWRD	0
LLCODE	0
LLBCDE	0
MACLOC	0
CHVDA	0
RANUM	0
BRKCTR	0
ENDUMT	0
DATYPE	0
SAVDA1	0
SAVDA	0
SVUPK	0
SVPKNM	0
CSBVAL	0
DFNCTR	0
MAXLIT	0	/MAXIMUM NO OF LIT IN THIS SECTION.
DIRASW	0	/ADDRESSING MODE(0=12 BIT) (NON0=13).
.LTGPT	0	/POINTER TO .LTORG TABLE.
BNKBTS	0
MACFFF	0
DECLOC	0
CTRMX5	0
TXTLOC	0
TXTCTR	0
PASSNO	0
PK57AD	0
CTR57	0
SAVEF	0
PKLOC	0
UPKCTR	0
TOPLUS	0
BOTLUS	0
UPKLOC	0
UPKCHR	0
UPKAD	0
PKNUM	0
NUMBR	0
PK57SV	0
CTR1	0
LNCTR	0
RPTCTR	0
RPTINC	0
BNDVND	0
TMP1	0
NOIN2	0
SYMTYP	0
FSTLNE	0
OPSAV	0
INCR	0
TMPI	0
SVMCPT	0
SVMCCT	0
SWD1	0
SWD2	0
SWD3	0
TAGSW	0
TT1	0
LOCALS	0		/.LOCAL SWITCH
TT3	0
L130=ERTBL		/X
ABSCNT=MP1
FIXCNT=MP2
DLMTR=MP3		/DELIMITER IN TEXT ROUTINES.
ANGLVL=MP5		/ANGLE BRACKET EXALUATOR
BPXRES=GBST
BOPPC=GIVS
BOPADR=IOVS
TXTYP=SRCUST
MDCTR=BOPADR
UNSQ=PRTINT
SQZLOC=TORC
NXHVL=TORC+1
CTRSPA=GIVS
LWORD2=PUSLL
LWORD3=LL13
FLGPTR=LKAHED
INC=ISZ
IDX=ISZ
SET=ISZ
DV1=NUMEVL
SYMBLS=TORC
ANDXOR=SUB1
DVS=INTUPN
TITCNT=GETRST
XLIT=K10000
	.IFDEF RSX
..SIZE	.SIZE 	/SIZE OF THE PARTITION
	.ENDC
	.IFDEF %PTP
	.END BANK*20000+17720
	.ENDC
	.ENDC
	.ENDC
	.ENDC
	.IFUND %MACI
	.END
	.ENDC
	.EOT
	.ENDC
