	.IFUND %RSX
	.SYSID <	.TITLE		MACRO >,<005>
	.ENDC
	.IFDEF %RSX
	.TITLE	MACRO XVM/RSX V1A004
	.ENDC
/ 
/ 
/
/
/COPYRIGHT (C) 1976
/DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
/
/THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY
/ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH
/THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS
/SOFTWARE, OR ANY OTHER COPIES THEREOF, MAY NOT BE PRO-
/VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON
/EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO
/THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE
/SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.
/
/THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE
/WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-
/MITMENT BY DIGITAL EQUIPMENT CORPORATION.
/
/DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
/OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.
	.EJECT
/
/MACRO ASSEMBLER FOR DIGITAL XVM (AND PDP-15).
/
/ ASSEMBLY WITH NO PARAMETERS CREATES THE VERSION OF MACRO THAT IS TO BE USED
/  AS THE SYSTEM PROGRAM 'MACRO'.
/ THE FOLLOWING ASSEMBLY PARAMETERS APPLY:
/	%BIN DEFINED TO OBTAIN A VERSION THAT RUNS WITH DDT (NOTE THAT CREF CANNNOT
/	   BE USED WITH THIS VERSION).
/	%PATCH CAN BE DEFINED TO CHANGE THE DEFAULT SIZE OF THE PATCH AREA.
/
/
/
/
/
/EDIT  #002	XX	20-SEP-72
/
/	084	SK	16-NOV-73	INCORPORATED ALL PATCHES TODATE
/	085	EK	16-JUL-74	CHANGED SIGNON NUMBER
/
/	086	JK	23-JUL-74	FIXED "$" HANDLING IN MACRO CALLS
/				AND GIVES ERROR N ON LONG NUMERIC STRINGS
/	087	JMW	19-DEC-74	REMOVED MACRO TABLE (TO GAIN SPACE) AND CONDITIONALS.
/	088	JMW	 2-JAN-75	CHANGED MACDEF NAME.
/	089	JMW	 9-APR-75	ADDED 'CORAL' PSEUDO-OPS:.CBC, .CBE, .CBS.
/	090	JMW	16-APR-75	SPR #846:  ALLOW .GLOBL DECLARATIONS AFTER
/					MACRO DEFINITIONS (BY OUTPUTING BEGINNING OF
/					BINARY FILE AT PASS 2 INITIALIZATION).
/ 091	25-APR-75 (RCHM)	FIX $ MACRO CONTINUATION PROBLEM.
/ 092	25-APR-75 (RCHM)	FIX DIVIDE BY 0 IN = STATEMENT DESCREPENCY.
/ 093	28-APR-75 (RCHM)	FIX .DEFIN PROBLEM.
/ 094	29-APR-75 (RCHM)	MORE PROBLEMS WITH .DEFIN. IT IS INCORRECTLY FILTERING
/				OUT @ SYMBOLS DURING MACRO DEFINITIONS.
/ 095	29-APR-75 (RCHM)	%BIN WILL FORCE MACDEF TO COME FROM .DAT 1.
/ 096	30-APR-75 (RCHM)	FURTHER WORK ON %BIN PROBLEM. TO SOLVE IT THE FOLLOWING
/				ITEMS WILL BE DONE:
/				1. THE MACRO ASSEMBLER WILL ONLY ASSEMBLE AS A
/				   BINARY FILE. %BIN WILL CHANGE THE MACDEF .DAT SLOT
/				   FROM -1 TO 1.
/				2. AN OFFSET TO BE SPECIFIED TO PATCH WILL BE
/				   GIVEN TO THE USER IN A VARIABLE CALLED "OFFSET".
/				3. THE BBI ROUTINES AND CONSTANTS WILL BE REMOVED FROM
/				   MACRO.
/ 097	22-MAY-75 (JMW)		FINISH BBI REMOVAL; PUT IN Y ERROR AND CHANGE C ERROR.
/ 098	 4-JUN-75 (JMW)		MORE OF 097, PUT IN XVM ID.
/ 099	11-JUN-75 (JMW)		CHANGE PSEUDO-OP DISPATCHING TO CATCH USAGE ERRORS
/				WITH BLOCK DATA, DISALLOW ANY TAGS IN BLOCKDATA AREAS;
/				CHANGE HAND-CODED I/O CALS TO SYSTEM MACROS.
/ 100	16/JUL/75 (JMW)		DON'T COUNT LINES IN .NOLST AREAS; MACRO PROCESSOR FIX;
/ 101	30-JUL-75 (JMW)		CORRECTION TO PSEUDO-OP DISPATCHING;
/				CHANGE SEQUENCE OF L.L. CODE FOR .CBS.
/ 102	07/AUG/75 (JMW)		DELETE X4K CODE, READ MACRO DEFINITION FILE
/				AFTER PARAMETERS FROM -10 TO AVOID EXCESSIVE DELAY.
/ 103	03/SEPT/75 (JMW)	GARBAGE COLLECT MACRO DEFINITION TABLE ON 'TABLE OVERFLOW'.
/ 103	04/SEPT/75 (JMW)	MORE OF 103.
/ 105	09-04-75 (RCHM)		MAKE THE MACRO TABLE VERIFIER A LOT SMARTER.
/ 106	10/SEPT/75 (JMW)	MORE GARBAGE COLLECT CORRECTIONS; PASS CREF AGRS AT '102";
/				INSURE TTY OUTPUT IF MACDEF NOT PRESENT & BOSS.
/ 107	10/SEPT/75 (JMW)	MORE OF 106.
/ 108	10-SEP-75 (RCHM)	INSERT CONDITIONALS FOR DIAGNOSTIC LOADER ASSEMBLY.
/ 109	11/SEPT/75 (JMW)	INSERT .CBDR FROM RSX MACRO.
/ 110	07/OCT/75 (JMW)		SURPRESS PRINTING OF TABLE CONTENTS ON -3 IF E SWITCH ON.
/ 111	16/OCT/75 (RKB)		DON'T PRINT 2 "SIZE" MESSAGES IF IN BOSS MODE.
/ 112	22/OCT/75 (JMW)		PUT IN RSX CONDITIONALIZATIONS (AGAIN!!).
/ 113	03/NOV/75 (JMW)		FINISH UP RSX CONDITIONALS.
/ 114	09/NOV/75 (JMW)		FORCE OUTPUT TO TTY IN BOSS ON E SWITCH.
/ 115	22/NOV/75 (JMW)		CORRECTION TO GARBAGE COLLECTION CODE.
/ 116	25/NOV/75 (JMW)		.WAIT AFTER 'E' OUTPUT.
/ 117	26/NOV/75 (JMW)		CORRECT A RSX ERROR MESSAGE.
/ 118	04/DEC/75 (JMW)		ANOTHER GARBAGE COLLECTOR FIX!
/ 119	17/DEC/75 (JMW)		2 RSX CORRECTIONS.
/ 120	30/DEC/75 (JMW)		ANOTHER RSX CORRECTION, TO ALLOW BATCHING, AS BEFORE.
/ 121	04-FEB-76 (RCHM)	CORRECT MINOR TYPEOUT ERROR WITH "R" SWITCH.
/ 122	12-FEB-76 (JMW)		ALLOW T AND L SWITCHES TOGETHER.
/ 123	03-MAR-76 (JMW)		NO BIN OUTPUT IF PROGRAM SIZE OF ZERO.
/ 124	25/MAR/76 (JMW)		ALLOW COMMENTS ON MACRO CALL LINES WITH NO ARGS.
/ 125	27/APR/76 (JMW)		DON'T FLAG INDEXED CAL'S IN RSX.
/ 126	05/MAY/76 (JMW)		DON'T ALLOW PAPERTAPE INPUT IN RSX;DELETE
/				SAVE/RESTORE AUTO INDEX REG ROUTINES.
/ 127	06/MAY/76 (JMW)		RSX: SIMULATE .END IF NONE.
/ 128	04-AUG-76 (RCHM)	FIX A PROBLEM WITH MACRO AND	/(128)
/				ITS CHECK FOR VALID DEVICES ON	/(128)
/				THE PARAMETER FILE LUN.		/(128)
/}
/
/
/THERE ARE SEVERAL ASSEMBLY PARAMETERS FOR MACRO:
/	1. NONE YIELDS THE STANDARD SYSTEM VERSION;
/	2. %PATCH CAN BE DEFINED TO A DESIRED PATCH SIZE (DEFAULT + 40);
/	3. %BIN YIELDS A VERSION TO BE RUN WITH DDT (CREF BECOMES A SUBROUTINE);
/	4. %DEBUG INCLUDES DEBUGGING CODE FOR VERIFICATION OF MACRO DEFINITION TABLE.
/	5. %DMACRO WILL INCLUDE THE ABS LOADER WHICH LOADS AT 17700 RATHER THAN 17720.
/	6. %RSX PRODUCES THE RSX VERSION OF MACRO.  NOTE THAT THERE ARE SEVERAL
/	    SUBCONDITIONALS HERE, PRIMARILY FOR .DAT SLOTS.
/
/
/
/
	.EBREL			/(RCHM-096)
	.IFDEF %BIN		/RELOCATABLE VERSION
	.IODEV 1,-10,-11,-12,-13,-14
	.GLOBL CREF		/(JMW:106)
	.ENDC
.SCOM=100
%BOSS=.SCOM+52
/
/
/
	.IFUND %BIN
	.IODEV -1,-10,-11,-12,-13,-14 /(RCHM-096)
	.ENDC
/
/ **
INC=ISZ			/ADD 1 TO A COUNTER.
IDX=ISZ			/INCREMENT WITH NO INTENT OF EVER GOING TO 0.
SET=ISZ			/SET A SWITCH TO NON-ZERO.
/
	.IFUND %PATCH
%PATCH=40		/(RCHM-096) DEFAULT PATCH AREA SIZE IS 40 WORDS.
	.ENDC
	.IFDEF %RSX
ECLA=641000
X10=10
/
/	DEFUALT LUN ASSIGNMENTS.
/
	.IFUND DAT2
DAT2=14
	.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
	.TITLE DEBUG MACRO FOR TABLE VERIFICATION.
/
/ SPECIAL DEBUGGING CODE WILL BE INCLUDED WITH MACRO IF THE PARAMETER  %DEBUG ID
/ DEFINED.  CURRENTLY THIS PARAMETER CAUSES:
/ 1.	MACRO TABLE VERIFICATION AFTER EACH MACRO DEFINITION (RCHM-105)
/ 2.	MACRO TABLE VERIFICATION AFTER EACH MACRO CALL (RCHM-105).
/ 3.	MACRO TABLE VERIFICATION BEFORE EACH GARBAGE COLLECT (RCHM-105).
/ 4.	MACRO TABLE VERIFICATION AFTER EACH GARBAGE COLLECT (RCHM-105)
/ 5.	MACRO TABLE VERIFICATION AT EACH MACRO CALL (RCHM-105).
/ 6.	MACRO TABLE VERIFICATION AFTER EACH SET OF REAL ARGUMENTS IS DEFINED (RCHM-105).
/
%TVCLL=0				/(RCHM-105) TVER CALL COUNTER.
	.DEFIN .TVERC			/(RCHM-105) CALL MACRO TABLE VERIFIER.
	.IFDEF %DEBUG			/(RCHM-105)
%TVCLL=%TVCLL+1			/(RCHM-105) BUMP CALL COUNT BY 1.
	JMS TVER		/(RCHM-105) CALL TABLE VERIFICATION ROUTINE.
	%TVCLL*1000
	.ENDC			/(RCHM-105) ALL DONE.
	.ENDM			/(RCHM-105) MACRO DEFINED.
	.TITLE CORE ALLOCATION BY MACRO
/
/	MOPBEG-1 IS TOP OF FREE CORE;
/	C(.SCOM+2) IS THE BOTTOM OF FREE CORE.
/
/
/	+---------------------------------------+ TOP: MOPBEG-1
/	+					+
/	+					+
/	+	USER SYMBOL TABLE (UST)		+
/	+	 (BUILT FROM TOP, DOWN)		+
/	+					+
/	+- - - - - - - - - - - - - - - - - - - -+
/	+					+
/	+	DUMMY SYMBOL TABLE*		+
/	+	(BUILT FROM TOP, DOWN)		+
/	+ - - - - - - - - - - - - - - - - - - - + MOVING BOTTOM OF UST
/	+					+   WHEN THE TOP AND BOTTOM MEET,
/	+					+   A GARBAGE COLLECT IS ATTEMPTED. IF NO
/	+					+   FREE CORE, "TABLE OVERFLOW" AND ASSEMBLY IS ABORTED.
/	+ - - - - - - - - - - - - - - - - - - - + MOVING TOP OF MACRO DEFINITION TABLE.
/	+	LOCAL SYMBOL TABLE (LUST)*	+
/	+	(BUILT BOTTOM, UP)		+
/	+					+
/	- - - - - - - - - - - - - - - - - - - - +
/	+					+
/	+	REAL ARGUMENT LIST FOR MACRO	+
/	+	EXPANSIONS**			+
/	+	(BUILT BOTTOM, UP)		+
/	+					+
/	+- - - - - - - - - - - - - - - - - - - -+
/	+					+
/	+	MACRO DEFINITONS		+
/	+	(BUILT BOTTOM, UP)		+
/	+					+
/	+---------------------------------------+ BOTTOM: C(.SCOM+102)
/
/		* DELETED AFTER USE.  THESE WILL ONLY BE SEEN IF A SNAPSHOT IS
/		   TAKEN WHILE THEY ARE ACTUALLY IN USE.
/		**DELETED AFTER USE, IF POSSIBLE.  THE REAL ARGUMENT LIST WILL
/		    BE DELETED IF THERE HAS BEEN NO INTERVENING .DEFIN.
	.TITLE USER SYMBOL TABLE DESCRIPTION.
/
/
/ALL ENTRIES IN THE MACRO SYMBOL TABLE ARE 54 BITS LONG.
/THE USER SYMBOLS ARE STORED DIRECTLY UNDER MACRO AND WORK DOWN TO LOW
/CORE. 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.
/ SYMBOLS ARE STORED IN ALPHABETIC SEQUENCE.
/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.
/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 MACRO DEFINITION TABLE DESCRIPTION
/
/THREE DIFFERENT KINDS OF ENTRIES ARE MADE IN THE MACRO DEFINITION TABLE:
/ MACRO DEFINITIONS, REAL ARGUMENT LISTS FOR MACRO EXPANSIONS AND THE 
/ .LOCAL SYMBOL TABLE (LUST).
/
/ 1. MACRO DEFINITIONS HAVE A MINIMUM OF 4 WORDS PER ENTRY, WITH THE FIRST 3 BEING CONTRO
/	WORD 1: SIZE OF ENTRY:	POSITIVE, NON-ZERO = AN ACTIVE, COMPLETE ENTRY
/				0 = PARTIAL DEFINITION (IE, ONE CURRENTY BEING ENTERED)
/				NEGATIVE = DISCARDED DEFINITION (2'S COMP SIZE).
/	WORDS 2-3; NAME, IN RADIX 50.
/	WORDS 4-N: THE DIFINITION, PACKED IN 5/7 ASCII, CHARACTER BY CHARACTER,
/			TERMINATED BY '177'.
/
 / 2. REAL ARGUMENT LISTS HAVE A MINIMUM OF 3 WORDS PER ENTRY, THE FIRST 2
/	BEING CONTROL WORDS.
/	WORD 1: SAME AS WORD 1 ABOVE.
/	WORD 2: ZERO;
/	WORDS 3-N: ARGUMENT LIST, PACKED IN 5/7 SSCII, TERMINATED BY '177'.
/
/ 3. THE LUST HAS 3 WORDS PER ENTRY, WITH 2 OVERHEAD CONTROL WORDS FOR THE ENTIRE TABLE:
/	WORD 1: SAME AS WORD 1, ABOVE.
/	WORD 2: ZERO;
/	WORDS 1-3 OF EACH ENTRY - SEE UST DESCRIPTION ABOVE.
/
/A SNAPSHOT OF THE MDT MIGHT REVEAL AN INTERMIX OF ACTIVE AND DISCARDED 
/DEFINITIONS AND DISCARDED R/A LISTS.  LUST ENTRIES ARE NEVER LEFT IN THE TABLE
/(IT IS ILLEGAL TO DO A .DEFIN WITHIN A .LOCAL AREA) AND THUS ARE ONLY SEEN ON
/TOP WHILE BEING USED.
/
/THE CONTROL WORDS ARE USED BY THE GARBAGE COLLECTOR.
	.TITLE ENTRY TO MACRO
/
/INITIAL CONTROL COMES HERE TO DETERMINE A 'BNK' OR 'PAG' SYSTEM,
/  AND TO SETUP THE CORRECT ID ('BMACRO' OR 'MACRO').
/THE FLOW OF CONTROL FROM HERE IS TO:
/	PASS1- PROGRAM IDENTIFICATION AND START/RESTART.
/
	.IFUND %RSX
/THE CODE FROM 'FIRST' TO 'MACEND' IS OVERLAYED AFTER USE.
/
FIRST	LAC* L104	/SCOM+4:BIT 1=PAGE/BNK BIT.
	AND L100	/BIT 11+1 FOR BANK MODE,
	SNA		/ 0 FOR PAGE MODE.
	JMP PASS1	/PAGE MODE - GO ON.
	INC BPMODE	/SET BNAK/PAGE MODE SWITCH.
	LAC ID		/CHANGE IDENTIFICATION FROM 
	AND (3777	/ (SPACE)MACRO TO BMACRO.
	TAD (410000
	DAC ID
	JMP PASS1		/(RCHM-096) GO BEGIN MACRO ASSEMBLER.
/
/ERROR MESSAGE CODE IN CASE THERE'S NO MACRO PARAMETER FILE.
/ DON'T EVEN WANT TO TRY TO CONTINUE IN THAT CASE, SO EXIT TO MONITOR.
/
MACMSG	.ASCII 'MACDEF MAC NOT PRESENT ON .DAT -1'<15>
NOMDEF	LAC* (%BOSS	/(JMW:106) WANT TO GO TO TTY, NOT LINE PRINTER,
	SMA		/(JMW:106) IF IN BOSS MODE.
	JMP NOMDF1	/(JMW:106)
	AND (757777	/(JMW:106)
	XOR L20000	/(JMW:106)
	DAC* (%BOSS	/(JMW:106)
NOMDF1	LAC (MACMSG-2
	JMS WRITE3	/PUT OUT ERROR MESSAGE (JUST BELOW).
	.WAIT -3
	JMP EXIT		/RETURN TO DOS.
MACEND=.-1
	.ENDC
	.IFDEF %RSX
	.GLOBL MACR15,FILNMS,SWITCH,PARBUF,IOERR,UPKADS,PKNUMS,INITSW,EXIT,TDVEV
/
MACR15	0		/RSX ENTRY POINT TO MACRO PROPER.
	LAC SWITCH	/MOVE IN THE PARAMETERS.
	JMS SET10
	LAC (BNOPTN-1
	DAC* L11
	LAW -25		/MOVE 25 WORDS.
	JMS MOVAUT
	LAC* INITSW	/COMMAND DECODING DONE?
	SZA
	JMP PASS1	/YES - GO RIGHT AHEAD.
	SET BATCH	/SET THE BATCH PROCESSING SWITCH.
	LAC PARBUF	/POINTER TO THE PARAMETER BUFFER.
	AAC 2
	DAC UPKAD
	LAC L1
	DAC PKNUM
DELLOP	JMS GETCHR	/GET A CHARACTER.
	LAC CHRHLD	/THE CHAR JUST UNPACKED.
	SAD (40		/SPACE?
	JMP CHRSPF	/YES - PROCESS COMMAND.
	SAD (15		/CARRIAGE RETURN?
	JMP CMDE	/YES - EXIT: COMMAND STRING TERMINATED.
	SAD (175	/ALT MODE?
	JMP CMDE	/YES - EXIT.
	JMP DELLOP	/LOOK AT THE NEXT CHAR.
CHRSPF	LAC UPKAD	/SAVE THE CHAR POINTER.
	DAC* UPKADS
	LAC PKNUM	/CHARACTER COUNT, TOO.
	DAC*  PKNUMS
	JMP PASS1
	.ENDC
	.TITLE SPECIAL TABLE FOR MACRO PSEUDO-OPS
/
MOPBEG	MOPBEG+1
	.SIXBT '.DEFIN'
	JMP NSTDFN
	.SIXBT '.ENDM'
	JMP .ENDM
	.SIXBT '.ETC'
	JMP .ETC
MOPEND	MOPEND
	.TITLE PSEUDO-OP DISPATCH TABLE.
/
/
/PSEUDO-OP TABLE **********
/
/THE TOP 3 BITS (0-2) ARE USED AS FLAGS:
/	BIT 0 SET - ILLEGAL IN .CBS AREAS. (JMW:099)
/	BIT 1 UNUSED
/	BIT 2 UNUSED
/
/
POPBEG	POPBEG+1
	.SIXBT /.ABS/
	ABS+400000		/PDP-15 ABSOLUTE MODE
	.SIXBT /.ABSP/
	ABSP+400000		/PDP-9 ABSOLUTE FORMAT
	.SIXBT /.ASCII/
	ASCII+400000
	.SIXBT /.BLOCK/
	BLOCK+400000
	.SIXBT /.CBC/
	CBC
	.SIXBT	/.CBD/
	CBD+400000
	.SIXBT /.CBDR/	/(JMW:109)
	CBDR+400000
	.SIXBT /.CBE/
	CBE
	.SIXBT /.CBS/
	CBS
	.SIXBT	/.DBREL/
	DBREL+400000
	.SIXBT /.DEC/
	DEC
	.SIXBT /.DEFIN/
	DEFIN
	.SIXBT	/.DSA/
	DSA+400000
	.SIXBT	/.EBREL/
	EBREL+400000
	.SIXBT /.EJECT/
	EJECT.
	.SIXBT /.END/
	END+400000
	.SIXBT /.ENDC/
ENDCOP	ENDC
	560517	/.EOT
	240000
	EOT+400000
	560625	/.FULL
	141400
	FULL+400000
	.SIXBT	/.FULLP/
	FULLP+400000	/PDP-15 FULL BINARY MODE
	.SIXBT	/.GLOBL
	GLOBL+400000
IFOP	.SIXBT /.IFDEF/
	IFDEF
	.SIXBT /.IFNEG/
	IFNEG
	.SIXBT /.IFNOZ/
	IFNOZ
	.SIXBT /.IFNZR/
	IFNZR
	.SIXBT /.IFPNZ/
	IFPNZ
	.SIXBT /.IFPOZ/
	IFPOZ
	.SIXBT /.IFUND/
	IFUND
	.SIXBT /.IFZER/
	IFZER
	.SIXBT /.IODEV/
	IODEV+400000
	.SIXBT	/.LOC/
	LOC+400000
	.SIXBT	/.LOCAL/
	LOCAL+400000
	.SIXBT	/.LST/	/TURN ON LIST SWITCH
	LST		/IF 'L' OPTION TYPED.
	.SIXBT	/.LTORG/
	LTORG+400000
	.SIXBT	/.NDLOC/
	NDLOC+400000
	.SIXBT	/.NOLST/	/TURN OFF LIST SWITCH
	NOLST
	.SIXBT	/.OCT/
	OCT.
	.SIXBT	/.REPT/
	REPT
	.SIXBT	/.SIXBT/
	SIXBT+400000
	.SIXBT	/.SIZE/
	SIZE+400000
	.SIXBT	/.TITLE/
	TITLE
POPEND	POPEND
	.TITLE  BUFFERS: INPUT, OUTPUT
/
/
/INITIALIZER PRINT AREA WITH SPACES
/
UNSQ=.		/TEMP STORAGE FOR 'UNSQZE ROUTINE.
PRTINT	0
	LAC (STOPPER-1	/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
ERRORC
ERRORD
ERRORE
ERRORF		/FORWARD REFERENCE.
ERRORI
ERRORL
ERRORM
ERRORN
ERRORP
ERRORQ
ERRORR
ERRORS
ERRORT
ERRORU
ERRORW
ERRORX
ERRORY
ERRNUM=.-1		/END OF ERROR FLAG TABLE.
/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-ERRNUM	/NEED # OF ERROR FLAGS.
CLRRD=.
TOPBFP=STOPPER-CLRRD
/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
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
HOF	060320	/FORM FEED,CARRIAGE RETURN.
/
PRTLIN	034500;	0	/PRINT BUFFER
	.BLOCK	70		/(RCHM-096) PRINT LINE BUFFER SIZE.
SRCBUF	.BLOCK 44
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
	RTL; RTL; RTL; RTL
	JMP* LEFT8
RIGHT8	0
	RTR; RTR; RTR; RTR
	JMP* RIGHT8
LEFT6	0
	RTL; RTL; RTL
	JMP* LEFT6
RIGHT6	0
	RTR; RTR; RTR
	JMP* RIGHT6
LEFT4	0
	RTL; RTL
	JMP* LEFT4
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
CLAC=641000		/(JMW:109)
DIVS=644323
FRDIV=650323
FRDIVS=654323
SLK=660000		/(JMW:109)
IDIV=653323
IDIVS=657323
LACQ=641002
LACS=641001
LLSS=660600
LRSS=660500
MULS=657122
NORM=640444
NORMS=660444
OAC=642000		/(JMW:109)
	.SIXBT	/ALSS/
	ALSS
	.SIXBT	/CLAC/
	CLAC
	.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
	.SIXBT	/AAC/
AACI	723000			/ADD (IMMEDIATE) TO AC
	.SIXBT	/ABS/
	644000
	.SIXBT	/ADD/
XREG	ADD
	.SIXBT /ALS/
	640700
	.SIXBT	/AND/
	AND
	.SIXBT	/AXR/
AXRI	737000			/ADD (IMMEDIATE) TO XR
	.SIXBT	/AXS/
AXSI	725000			/ADD (IMMEDIATE) TO XR AND SKIP IF .GF.LR
	.SIXBT	/CAF/
	CAF
	.SIXBT	/CAL/
	CAL
	.SIXBT	/CCL/
	CCL
	.SIXBT	/CLA/
	CLA
	.SIXBT	/CLC/
	CLC
	.SIXBT	/CLL/
	CLL
	.SIXBT	/CLQ/
	650000
	.SIXBT	/CLX/
	735000			/CLEAR XR
	.SIXBT	/CMA/
	CMA
	.SIXBT	/CML/
	CML
	.SIXBT	/CMQ/
	640004
	.SIXBT	/DAC/
	DAC
	.SIXBT	/DBA/
DBALIT	707762
	.SIXBT	/DBK/
	DBK
	.SIXBT	/DBR/
	DBR
	.SIXBT	/DIV/
	640323
	.SIXBT	/DZM/
DZMLIT	DZM
	.SIXBT	/EAE/
EAELIT	EAE
	.SIXBT	/EBA/
EBALIT	707764
	.SIXBT	/GLK/
	GLK
	.SIXBT	/GSM/
	664000
	.SIXBT	/HLT/
HLTLIT	HLT
	.SIXBT	/IAC/
	740030			/INCREMENT THE AC
	.SIXBT	/IOF/
	IOF
	.SIXBT	/ION/
	ION
	.SIXBT	/IOT/
IOTLIT	IOT
	.SIXBT	/ISA/
	ISA
	.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	/OAC/
	OAC
	.SIXBT	/OAS/
	OAS
	.SIXBT	/OMQ/
	640002
	.SIXBT	/OPR/
	OPR
	.SIXBT	/OSC/
	640001
	.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.
	.SIXBT	/RAL/
	RAL
	.SIXBT	/RAR/
	RAR
	.SIXBT	/RCL/
	RCL
	.SIXBT	/RCR/
	RCR
	.SIXBT	/RES/
	707742
	.SIXBT 'RPL'
	705512
	.SIXBT	/RTL/
	RTL
	.SIXBT	/RTR/
	RTR
	.SIXBT	/SAD/
	SAD
	.SIXBT	/SKP/
	SKP
	.SIXBT	/SLK/
	SLK
	.SIXBT	/SMA/
	SMA
	.SIXBT	/SML/
	SML
	.SIXBT	/SNA/
	SNA
	.SIXBT	/SNL/
	SNL
	.SIXBT	/SPA/
	SPA
	.SIXBT	/SPI/
	SPI
	.SIXBT	/SPL/
	SPL
	.SIXBT	/STL/
	STL
	.SIXBT	/SZA/
	SZA
	.SIXBT	/SZL/
	SZL
	.SIXBT	/TAD/
TADLIT	TAD
	.SIXBT	/TCA/
	740031			/2'S COMP AC
	.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	TCA		/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
	TCA		/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	LAC MOVMRG
	AAC -1
	DAC MOVMRG
	LAC SEARCH
	AAC -1
	DAC SEARCH
	LAC* MOVMRG
	DAC* SEARCH
	ISZ CTR		/FINISHED MOVING?
	JMP MOVLUP	/NO .. LOOP AGAIN.
	JMP* MOVEUP	/YES .. EXIT
/SUBROUTINE TO MERGE A SYMBOL AND ITS VALUE INTO THE UST.
/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 NOXMRG
	LAC TAGSW	/IS THIS A TAG?
	SNA		/YES ... MERGE IT
	JMP NOXMRG
/MERGE THE SYMBOL INTO THE LOCAL TABLE.
/
	LAC TOPLUS
	JMS TABORT	/ABORT ASSEMBLY IF OVERFLOW.
	JMS MOVEUP
	LAC TOPLUS
	LAC MRGLOC
	LAC TOPLUS
	AAC 3
	DAC TOPLUS
	JMS MRGSYM	/NOW MERGE INTO LOCAL TABLE
	LAC* LOCLSV	/(JMW:103) UPDATE # WORDS USED BY LUST (FOR GARBAGE COLLECTOR).
	AAC 3		/(JMW:103)
	DAC* LOCLSV	/(JMW:103)
	JMP* MERGE
/MERGE THE SYMBOL INTO THE BOTTOM SECTION
/
NOXMRG	JMS MOVMRG
	LAC MRGLOC
	LAC BEGUST
	LAC CMPLOC
	LAC BEGUST
	AAC -3		/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
	TCA
	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
	AAC 3
	CMA
	TAD BEGUST	/BEGINNING OF SYMBOL TABLE.
	SMA		/(JMW:103)
	JMP* TABORT	/(JMW:103)NO OVERLAP - OK.
	LAC HOLES	/(JMW:103) ANY UNUSED SPACE IN MACRO DEFIN TABLE?
	SNA		/(JMW:103)
	JMP STOVA	/(JMW:103) NO - REALLY A TABLE OVERFLOW.
	LAC DFNSW	/(JMW:106) MUST SEND OPPOSITE OF THIS, TO GET
	SNA!CLA		/(JMW:106) CORRENT LIMITS OF UST.
	CLC		/(JMW:106)
	JMS COMPAT	/(JMW:103) GARBAGE COLLECT MACRO DEFIN TABLE.
	JMP* TABORT	/(JMW:103) NOW THERE'S ROOM.
/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
/
/MACRO DEFINITIONS ARE STORED AT THE BOTTOM OF CORE (.SCOM+2)
/AND ARE BUILT UPWARDS TOWARD THE UST.  THE INVERSE IS TRUE
/FOR SYMBOLS, WHICH ARE STORED AT THE TOP OF CORE (.SCOM+3)
/AND ARE BUILT DOWNWARD TOWARD THE MACRO DEFINITIONS.
/WHEN BOTH TABLES MEET, THE ASSEMBLY TERMINATES.
/
TXTYP=.		/TEXT TYPE SWITCH OFR .ASCII, .SIXBT ROUTINES.
SRCUST	0
	DAC SRCUS1	/STORE INPUT ARG.
	JMS SEARCH	/SEARCH SYMBOL TABLE.
	LAC USTEND
	LAC BEGUST
	LAC SQZOTP	/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.
SRCNOT	IDX SRCUST
	JMP* SRCUST
SRCLOC	LAC MRGLOC	/SEARCH THE LOCAL TABLE
	DAC SRCUS1
	JMS SEARCH
	LAC TOPLUS	/TOP OF LOC
	LAC BOTLUS
	LAC SQZOTP
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 SRCNOT.
/THE SYMBOL WILL LATER BE MERGED INTO THE LOCAL-UST
/
	LAC TAGSW	/IS THIS A TAG?
	SZA
	JMP SRCNOT	/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 SRCNOT
	.TITLE 	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	/
/		BIT 0=0: COMPARE 18 BITS; =1: COMPARE 16 BITS.
/		BITS 15-17 =2: TABLE HAS 2 WORD ENTRIES, COMPARE WORD 1; -3: 3 WORD ENTRIES,
/			COMPARE WORDS 1 &2.
/	FOUND		/RETURN HERE IF SYMBOL FOUND.
/	NOT FOUND
/
SEARCH	0
	XCT* SEARCH	/TOP OF TABLE.
	DAC HILIM
	IDX SEARCH
	XCT* SEARCH
	DAC LOLIM	/BOTTOM OF TABLE.
	IDX SEARCH
	XCT* SEARCH	/LOCATION OF SYMBOL
	DAC CMPLOC	/TO COMPARE TABLE WITH
	IDX SEARCH
	LAC* SEARCH	/PICK UP CONTROL WORD
	RAL
	LAC NOPLIT	/CHECK ALL 18 BITS
	SZL
	LAC .+4		/CHECK LO ORDER 16 BITS
	DAC MSK2
	DAC MSK2A
	LAC* SEARCH
	AND L157S
	DAC INCR
	ISZ INCR	/2 OR 3
	TCA
	DAC WORDCT
	IDX SEARCH	/FOUND EXIT
	LAC HILIM	/FIRST ENTRY?
	SAD LOLIM
	JMP NTFND1	/YES..SET MRGLOC.
SPLIT	LAC HILIM	/SPLIT TABLE LIMITS.
	TAD LOLIM
	RCR		/DIVIDE BY 2
	SZL		/ADJUST BY -1
	AAC -1
	DAC MRGLOC	/MERGING LOCATION
	LAC WORDCT	/LENGTH 2 SYMBOL
	AAC 1
	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
	AAC -1
	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	/>
	LAC MRGLOC	/ITEM < TABLE
	SAD LOLIM	/END OF SPLITTING
	JMP NTFND2	/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 NTFND1
	DAC LOLIM	/SET NEW LOW LIMIT
	JMP SPLIT
NTFND	TAD INCR	/2 OR 3
NTFND1	DAC MRGLOC
NTFND2	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
/SYMBOL TABLE OVERFLOW
/
STOVA	LAC ERTAB
	DAC TORC	/TABLE
	LAC ERTAB+1
STOVB	DAC TORC+1
	.IFUND %RSX
	.WRITE -3,2,PRTOVA,27
PRTOVA=.-1
	JMP PASS1	/RETURN TO COMMAND STRING
	.ENDC
	.IFDEF %RSX
	CAL OVFLMS	/PRINT 'CORE OVERFLOW' MESSAGE.
	JMS WAITFR	/WAIT FOR IT TO FINISH.
	JMP* EXIT	/LEAVE.
	BINLDR-TORC+1/2*1000+2	/HEADER WORD FOR OVERFLOW MESSAGE.
	0
	.ENDC
SQZLOC=.
TORC	0		/TABLE OR CALL
NXHVL=.		/NEXT HIGHER VALUE FOR OUTPUT OF SYMS IN VALUE SEQ..
	0
	.ASCII	/ OVERFLOW/<15>
	.TITLE .ABS(P) BINARY LOADER.
	.NOLST			/(RCHM-108)
	.IFUND %DMACRO	/(RCHM-108)
	.LST
/
/
/***ABSOLUTE BINARY LOADER ***
/
CLOF=700004
RRB=700112
RSB=700144
RSF=700101
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=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=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=17747
	DAC LDWDCT
	ISZ LDWDCT
	JMP LDWAIT	/EXECUTE START ADDRESS
	HLT		/NO ADDRESS ON .END STATEMENT
LDREAD=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=17763
	JMS LDREAD	/PASS OVER LAST FRAME (PDP-9
	JMP* LDSTAD	/COMPATABILITY).
ENDLDR=.
HRMWD	003500;	0	/HEADER
	261;	277	/HRM START
	320;	0
LDCKSM=17775
LDSTAD=17776
LDWDCT=17777
/
/*** END OF LOADER ***
/
/
	.NOLST			/(RCHM-108)
	.ENDC			/(RCHM-108)
	.IFDEF %DMACRO		/(RCHM-108) MUST PUT IN CONDITIONAL FOR DISGNOSTIC
	.LST
				/(RCHM-108) MACRO ASSEMBLER.
/***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
	.NOLST
	.ENDC
	.LST
/SUBROUTINE TO TURN THE PAGE BIT OF THE .ABS,.ABSP
/LOADER ON OR OFF.
/
ABSLOD	0
	LAC (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
	.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
	TCA
	DAC BNWDCT	/MAKE 2'S COMPLEMENT
	TAD BNCKSM	/ADD IT TO CHECKSUM
	TCA
	DAC BNCKSM	/2'S COMPLEMENT CHECKSUM
	JMS WAIT13	/WAIT FOR PUNCH
	LAC (LAC BNADDP
	DAC BLDBN5
	LAC BMODE	/WHAT MODE
	SAD L2		/.FULL
	JMP BLDBN4
	LAC WDCSAV	/UPDATE WORD COUNT BY 3
	AAC 3
	DAC WDCSAV	/FOR .ABS
	SKP
BLDBN4	ISZ BLDBN5	/AD26 NOT AD25
	LAC WDCSAV	/WORD COUNT
	TCA
	DAC BLDBN3
	JMS MOVER
BLDBN5	XX		/LAC BNADDP (LAC (BNADDR-1)) OR LAC BNADDP+1 (LAC (BNDATA-1)).
	LAC (PTPBUF+1
	DZM BNWDCT
	JMS NULFRM
	.IFUND %RSX
	.WRITE -13,4,PTPBUF+2,56	/WRITE DUMP MODE.
BLDBN3=.-1		/CONTAINS W/C IN 2'S
	.ENDC
	.IFDEF %RSX
	CAL WRDMP	/WRITE DUMP MODE.
	.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
	AAC 1
	DAC BNWDCT	/UPDATE WORD COUNT
	SAD L31		/CHECK IF FILLED UP
	JMP BLDBN2	/OUTPUT IT
	JMP* BLDBIN	/EXIT
NULFRM	0
	LAC BBFSIZ
	SMA
	JMP* NULFRM
	.IFUND %RSX
	.WRITE -13,3,BLNKS,4
	.ENDC
	.IFDEF %RSX
	CAL WRBLKN	/WRITE BLANKS.
	.ENDC
	JMP* NULFRM
BLNKS	002500;	0
	0;	0
	.TITLE 	PUNCH BUFFER.
/
PTPBUF	000500;	0	/PUNCH BUFFER
BNADDR=.+34
BNWDCT=.+35
BNCKSM=.+36
BNDATA=.+37
	.BLOCK 70
	.TITLE 	BUILD L.L. BINARY OUTPUT
/
/BUILD LINKING LOADER BINARY OUTPUT
/
IOPHDR=BNADDR
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
	JMS WAIT13	/WAIT FOR BINARY DEVICE
	LAW -32
	JMS MOVER
	LAC (IOPHDR-1
	LAC (PTPBUF-1
	LAC L1
	DAC LLWDCT	/RESET COUNT
	.IFUND %RSX
	.WRITE -13,0,PTPBUF,26	/WRITE IOPS BINARY.
	.ENDC
	.IFDEF %RSX
	CAL WRD13	/WRITE IOPS BINARY.
	.ENDC
	JMP* BLDLLB
/
/CHECK FOR L/L BINARY
/
CKFLLB	0
	JMS TMODE
	JMP* CKFLLB
	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
/
/SUBROUTINE TO CONVERT A NAME TO RADIX 50 AND OUTPUT IT TO THE BINARY FILE.
/
NAMSQZ	0
	JMS SQOZE	/PUT THE PROGRAM NAME INTO RADIX 50.
	LAC SQZOUT
	DAC LLBWRD
	LAC L7
	DAC LLCODE	/L/L CODE.
	LAC SQZOUT+1
	SNA		/4-6 CHARS IN NAME.
	JMP PFLH2	/ONLY 1-3 CHARS IN NAME.
	LAC SQZOUT
	AND L157S
	XOR XCTLIT	/SET 4-6 CHAR INDICATOR.
	DAC LLBWRD
PFLH2	JMS BLDLLB	/BUILD L/L BINARY, CHARS 1-3.
	LAC L10
	DAC LLCODE
	LAC SQZOUT+1
	DAC LLBWRD
	SZA
	JMS BLDLLB	/CHARS 4-6.
	JMP* NAMSQZ
	.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 (23		/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
/
LWORD2=.		/TEMP FOR LITERAL PROCESSOR.
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.
LWORD3=.		/TEMP FOR LITERAL PROCESSOR.
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
	.TITLE MACALL---MACRO CALL ,SETUP FOR EXPANSIONS.
/
/
/AT MACALL A SYMBOL IS IN THE OPERATOR FIELD AND IS A MACRO 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 DEFINED IN
/PASS2.
/THE FIRST DECISION MADE AT MACALL IS TO SEE IF 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 MULTI-
/LEVEL MACRO PROCESSING IS ALLOWED POINTERS MUST BE SVED FOR EACH
/LEVEL.THIS IS DONE EVERYTIME AN INSTRUCTION IS BUILT USING 'MCLCTR'.
/
/*** MACRO CALL PROCESSING
/
MACALL	LAC ENDUMT	/(JMW:107) BE SURE HAVE ROOM FOR ENTRY.
	JMS TABORT	/(JMW:107)
	.IFDEF %DEBUG	/(JMW:107)
	IDX MC.CAL	/(JMW:107)
	.ENDC
	ISZ GRASW	/(JMW:104) INDICATE PACKING REAL ARGS INTO DEFIN TABLE.
	JMS WRD3	/(JMW:104)
	LAC* MRGLOC	/ STARTING LOC. OF MACRO DEFINITION.
	AND L57S	/(JMW:103) MUST HAVE ONLY ADDRESS.
	AAC 3		/(JMW:103) FIRST 3 WORDS ARE CONTROL WORDS.
	DAC MACLOC
	.TVERC		/(JMW:107)
	LAC MCLCTR	/SUBTRACT 1 FROM THE CALL LEVEL.
	AAC -1
	DAC MCLCTR	/READY FOR NEXT LEVEL.
	SAD LAWM4
	JMP ICOVA	/TOO MANY IMBEDDED CALLS
	TAD (DAC BEGRL1+1
	DAC MACAL1	/GET BEGINNING OF R/A
	LAC ENDUMT	/(JMW:103)
	DAC BEGDEF	/(JMW:103)
	AAC 2		/(JMW:103) SKIP CONTROL WORDS.
MACAL1	XX		/BEGRL1, BEGRL2 OR BEGRL3
	JMS P57INT
	AAC -2		/(JMW:115)
	DAC TMP		/(JMW:115)
	DZM* TMP	/(JMW:115) WORD 1 SET TO PARTIAL ENTRY.
	IDX TMP		/(JMW:115)
	DZM* TMP	/(JMW:115) WORD 2=0 FLAGS R/A TO GARBAGE COLLECTOR.
	SET PATLSW	/(JMW:106) INDICATE HAVE PARTIAL ENTRY.
	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
	SAD L57		/(JMW:124) SLASH?
	JMP MCLE	/(JMW:124) YES - NO ARGUMENTS.
	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 <
	LAC BRKCTR	/UPDATE COUNT FOR BALANCING
	AAC -1
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 -- "$" MEANS CONTINUATION OF MACRO CALL
	LAC MCLCTR
	TAD L1		/BYPASS READ ON IMBEDDED CALLS
	SMA
	JMS DBLBUF	/GET NEXT SOURCE LINE
	JMS PRTINT		/(RCHM-091) CLEAR FLAGS AND PRINT BUFFER.
	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 MACSIZ	/(JMW:103) # WORDS PACKED.
	AAC 2		/(JMW:103) ADD 2 CONTROL WORDS.
	DAC* BEGDEF	/(JMW:103) PUT SIZE IN FIRST WORD.
	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 EXPANSION TAKES 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 THE INPUT LINE IS PROCESSED).
/SO WE ARE UNPACKING IN 5/7 FROM THE MACRO DEF. AND PACKING
/IN 5/7 INTO RDBUF+2. WHEN FINISHED THE LINE WILL LOOK LIKE A NORMAL
/INPUT LINE TO THE REST OF MACRO-15.
/
EXPMAC	DZM PATLSW	/(JMW:107)
	.TVERC		/(RCHM-105)
	LAC MACLOC	/(RCHM-105) START OF TABLE VERIFICATION.
	DZM GRASW	/(JMW:104)
	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
/
	LAC (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
	AAC -3		/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
	SNA		/(JMW:103)
	JMP EXPMB1	/(JMW:103)
	JMS GETRAL	/(JMW:103) DEFIN ENTERED IN TABLE DURING EXPANSION
	AAC -2
	DAC TMP		/(JMW:103) SO MUST MARK THE R/A AS GARBAGE.
	LAC* TMP	/(JMP:103) DO THAT BE MAKING SIZE MINUS.
	TCA		/(JMW:103)
	DAC* TMP	/(JMW:103)
	IDX HOLES	/(JMW:103) INDICATE UNUSED SPACE FOR GARBAGE COLLECTION.
	JMP EXPMB2	/(JMW:103)
EXPMB1	JMS GETRAL	/NO DEFIN - RESET FOR NEXT
	AAC -2		/(RCHM-105) REMEMBER TO ACCOUNT FOR THE CONTROL WORDS.
	DAC ENDUMT	/ DEFINITION OR R/A LIST.
EXPMB2	LAC MCLCTR
	TAD (LAC CSNL1+1
	DAC EXPMJ
	LAC MCLCTR
	TAD (DAC CSNL1+1
	DAC EXPMK	/UPDATE BASE FOR CREATED SYMBOLS.
EXPMJ	XX		/CSNL1, CSNL2, CSNL3
	TAD CHVDA	/CURRENT HIGH VALUE OF D/A
	AAC 1
EXPMK	XX		/CSNL1, CSNL2, CSNL3
	LAC MCLCTR
	TAD (LAC CHVDA1+1
	DAC .+1
	XX
	DAC CHVDA
	JMS RSTRDX	/RESTORE PRE-EXPANSION RADIX
	.TVERC			/(RCHM-105) CALL TABLE VERIFICATION.
	JMP NXTLNE	/GET NEXT LINE
EXPMC	JMS GETCHR	/PICK UP D/A NUMBER
	DAC SAVDA1
	TCA
	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 (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 (LAC CSNL1+1
	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 (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
	.TITLE 	.DEFIN A USER MACRO.
/
/
/MACRO DEFINITION PROCESSOR.
/THE .DEFIN PSEUDO-OP PACKS A MACRO DEFINITION INTO LOW CORE.
/ AS OF EDIT 103, THE TABLE LOOKS LIKE SO (LOGICALLY):
/	WORD 1:	SIZE (IN WORDS) OF DEFINITION:	+ IF ACTIVE+
/						-IF DISCARDED.
/	WORDS 2,3:	NAME IN RADIX 50.
/	WORDS 4-N:	DEFINITION (IN ACSII, PACKED CHAR BY CHAR)
/			TERMINATED BY '177'.
/THE DUMMY ARGUMENTS ARE STORED JUST BELOW THE USERS
/SYMBOL TABLE AND ARE DELETED AFTER USE.  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	.TVERC			/(RCHM-105) VERIFY TABLE.
	.IFDEF %DEBUG		/(RCHM-105)
	IDX MC.DEF		/(RCHM-105) COUNT NUMBER OF .DEFINS OCCURING.
	.ENDC
	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 DFNB0	/(JMW:103) YES
	LAC* TMP	/IS IT A VARIABLE
	SMA		/YES
	JMP DFNC
	LAC VARCTR	/SUBTRACT 1 FROM VARIABLE COUNT
	AAC -1
	DAC VARCTR
	JMP DFNB
DFNC	JMS TSTUND	/UNDEFINED?
	SPA		/RETURN HERE IF DEFINED, IS IT LOCAL?
	JMP DFNB
	LAC EXTCTR	/CHANGE EXTERNAL COUNT
	AAC -1
	DAC EXTCTR
	JMP DFNB
DFNA	XCT PASSNO
	SET ERRORP	/P TO FLAG WORD
	JMS MERGE	/MERGE MACRO NAME INTO S/T
	LAC* L11	/POINTER OF WD3 OF THIS ENTRY IN S/T.
	DAC TMP
	JMP DFNB	/(JMW:103)
DFNB0	SET REDFN	/(JMW:103) REDEFINING - WILL NEED TO GARBAGE SPACE.
DFNB	LAC TMP		/(JMW:103) ADDRESS OF ADDR POINTER IN S/T ENTRY.
	DAC DEFPNT	/(JMW:103) NEED IT LATER.
	LAC USTEND	/(JMW:103) MOVED 7 INSTRUCTIONS TO HERE BECAUSE
	DAC TT3		/(JMW:103) THESE MUST BE SET BEFORE CALLING THE
	LAC USTSZE	/(JMW:103) GARBAGE COLLECTOR.
	DAC TT1		/(JMW:103)
	LAC BEGUST	/(JMW:103)
	DAC TT2		/(JMW:103)
	DAC USTEND	/(JMW:103)
	SET DFNSW
	DZM USTSZE
	LAC SQZOUT	/(JMW:107) MUST SAVE NAME
	DAC DFNAM1	/(JMW:107) TO PUT INTO MACRO DEFINITION.
	LAC SQZOUT+1	/(JMW:107)
	DAC DFNAM2	/(JMW:107)
	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 TKOM	/ANY MORE DUMMIES? (NO RETURN IF TERMINATOR.)
	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
/
DFNAM1	0		/(JMW:107)
DFNAM2	0		/(JMW:107)
/
PKMCDF	LAC DFNAM1		/(JMW:107) NON-ZERO IF NEED TO SET UP NAME.
	SNA			/(JMW:107)
	JMP PKMCD1		/(JMW:107)
	LAC ENDUMT	/(JMW:103) NEXT FREE LOCATION FOR MACRO DEFIN TABLE.
	JMS TABORT	/(JMW:103) MAKE SURE THERE'S ENOUGH ROOM.
	LAC ENDUMT	/(JMW:103) NOW SET UP POINTERS.
	DAC BEGDEF	/(JMW:103)
	DAC TMP		/(JMW:103)
	DZM* TMP	/(JMW*103) MUST BE 0 FOR GARBAGE COLLECTOR.
	AAC 3		/(JMW:103)
	JMS P57INT	/(JMW:103)
	ISZ TMP		/(JMW:103)
	LAC DFNAM1	/(JMW:103) FIRST WORD OF MACRO NAME.
	DAC* TMP	/(JMW:103)
	IDX TMP		/(JMW:103)
	LAC DFNAM2	/(JMW:103)
	DAC* TMP	/(JMW:103) WORD 2 OF NAME.
	DZM DFNAM1	/(JMW:107) FLAG DONE WITH NAME.
	SET PATLSW	/(JMW:106) INDICATE HAVE PARTIAL ENTRY.
	SKP		/(JMW:107)
PKMCD1	JMS PUTRST	/RESTORE 5/7 POINTERS.
PKMCD2	SET NDIL	/NO DATA IN LINE IND
PKMDJ	JMS CLEARS	/VARIABLE SWITCH
PKMDJ2	JMS GETCHR		/(RCHM-094) GET NEXT DEFINITION CHAR
	JMS LEGAL	/IS THIS A LEGAL SYMBOL CHARACTER?
	SKP		/NO..
	JMP PKMDA
	LAC CONCSW		/(RCHM-094) WAS THE LAST CHARACTER A @ SIGN.
	SNA			/(RCHM-094)
	JMP PKMDJ1		/(RCHM-094) NO, CONTINUE.
	LAC CONCAT		/(RCHM-094) YES, PACK IT IN BUFFER.
	JMS PAKRAM		/(RCHM-094)
	DZM CONCSW		/(RCHM-094) CLEAR CONCATENATION SWITCH.
PKMDJ1	LAC CHRHLD		/(RCHM-094) FETCH CURRENT CHARACTER.
	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.
	LAW -6			/(RCHM-093) CHECK TO SEE IF 6 CHARACTERS HAVE BEEN
	TAD CHRNUM		/(RCHM-093)  PLACED IN PACKS.
	SMA			/(RCHM-093) MORE CHARACTERS TO GO YET.
	JMP PKMDD1		/(RCHM-093) 6 CHARACTERS FOUND, QUIT.
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
PKMDD1	JMS GETCHR		/(RCHM-093) SET UP CHRHLD FOR RETURN.
PKMDD	JMS SEARCH	/SEARCH FOR .DEFIN,
	LAC MOPEND		/.ENDM OR .ETC
	LAC MOPBEG
	LAC PACKSP	/ 'LAC (PACKS'
	2
	SKP		/FOUND
	JMP PKMDG	/NOT FOUND, PACK IT 5/7
	JMS WRD3
	XCT* MRGLOC	/SWITCH TO APPROPRIATE ROUTINE
/
/.DEFIN WITHIN A .DEFIN.
/
NSTDFN	LAC DFNCTR
	AAC -1
	DAC DFNCTR	/ADD -1 TO COUNTER
/+
/ SYMBOL IN PACKS HAS NOT BEEN IDENTIFIED AS A FORMAL PARAMETER. FIRST
/ INSERT AN @ SIGN IF NECESSARY BEFORE PROCESSING THE CHARACTERS FROM PACK
/ INTO THE MACRO DEFINITION AREA.
/-
NSTDA	LAC CONCSW		/(RCHM-094) WAS AN @ BEFORE THIS VARIABLE?
	SNA			/(RCHM-094)
	JMP NSTDA1		/(RCHM-094) NO, PREPARE FOR 6 TO 7 BIT CONVERSION.
	LAC CONCAT		/(RCHM-094) FETCH AN @ SIGN.
	JMS PAKRAM		/(RCHM-094) PUT IT IN MACRO DEFINITION AREA.
	DZM CONCSW		/(RCHM-094) CLEAR CONCSW IN CASE NEXT TRY FAILS ALSO.
NSTDA1	JMS INTUPN		/(RCHM-094) PREPARE FOR 6 TO 7 BIT CONVERSION.
PKMDE	JMS UNPACK	/UNPACK 6-BIT CHAR
	AAC -33		/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 PKMDB1		/(RCHM-093) GO SCAN FOR TERMINAL CHARACTER.
	DZM VARSW
	LAC VARAB	/#
	JMS PAKRAM
PKMDB1	LAC CHRHLD		/(RCHM-093) FETCH CHARACTER TO TEST.
	JMS LEGAL		/(RCHM-093) IS THIS A LEGAL CHARACTER?
	JMP PKMDB2		/(RCHM-093) NO, TERMINATOR FOUND.
	LAC CHRHLD		/(RCHM-093) FETCH CHARACTER AGAIN IN CASE NUMERIC.
	JMS PAKRAM		/(RCHM-093) OTHERWISE LOOP UNTIL TERMINAL FOUND.
	JMS GETCHR		/(RCHM-093) FETCH NEXT CHARACTER.
	JMP PKMDB1		/(RCHM-093)
PKMDB	LAC CHRHLD	/PACK CURRENT CHARACTER
PKMDB2	SAD CONCAT		/(RCHM-094) IS THIS A CONCANT OPERATOR?
	SKP			/(RCHM-094) YES, SET SWITCH AND FETCH NEXT CHARACTER.
	JMP PKMDB3		/(RCHM-094) NO, STICK CHARACTER IN BUFFER.
	ISZ CONCSW		/(RCHM-094) SET CONCAT OPERATOR SWITCH.
PKMDB4	LAC PACKSP		/(RCHM-094,100) PACKS AND P6BIT ROUTINE MUST BE INITIALIZED
	JMS P6INT		/(RCHM-094) BEFORE GETTING NEXT SYMBOL.
	DZM PACKS+1		/(RCHM-094) OTHERWISE CHARACTERS FROM LAST SYMBOL ARE
				/(RCHM-094)  RETAINED.
	JMP PKMDJ2		/(RCHM-094) FETCH NEXT CHARACTER WITHOUT CLEARING FLAGS.
PKMDB3	JMS PAKRAM		/(RCHM-094) PLACE CHARACTER IN MACRO DEFINITION AREA.
	JMS TSTC15
	JMP PKMDH
	SAD L73		/;
	JMP PKMCD2
	JMS CKSPTB	/SPACE OR TAB
	JMP PKMCD2	/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
/+
/ THE PARAMETER AND FLAGS HAVE BEEN PLACED IN THE MACRO DEFINITION FILE PROPERLY.
/ WE MUST NOW CHECK TO SEE IF THE CHARACTER FOLOWING THE PARAMETER WAS AN @ SIGN.
/-
	LAC CHRHLD		/(RCHM-094) FETCH NEXT CHARACTER TO BE PROCESSED.
	SAD CONCAT		/(RCHM-094) IS IT AN @ SIGN?
	SKP			/(RCHM-094,103) YES, GET NEXT CHARACTER FOR PROCESSING.
	JMP PKMDK		/BEGIN PROCESSING NEXT SYMBOL.
	DZM CONCSW		/(RCHM:103)
	JMP PKMDB4		/(RCHM:103)
/
/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 %RSX
	LAC DBLBUF+1	/CHECK THE .WAIT CAL.
	SAD L764	/-14 DAT SLOT?
	.ENDC
	.IFDEF %RSX
	LAC RDSRLN	/CHECK THE AUX. INPUT LUN.
	SAD (DAT14	/EQUIVALENT TO .DAT -14?
	.ENDC
	JMP FFFYES	/YES  GO CHECK Z-SWITCH.
FFFNO	LAC SIXP	/RESTORE WORD AND EXIT.
	JMP MACBT0+1
FFFYES	LAC ZSWCH
	SZA
	JMP FFFNO
	LAC SIXP
	JMP MACBT0
/
/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 PROCESSOR
/*** .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 UST.
	LAC TT2
	DAC BEGUST	/RESET BOTTOM OF U/S TABLE.
	LAC TT1
	DAC USTSZE	/RESET U/S COUNT.
	LAC MACSIZ	/(JMW:103) SIZE OF THIS MACRO DEFIN GOES
	AAC 3		/(JMW:103)
	DAC* BEGDEF	/(JMW:103) INTO THE DEFINITION.
	LAC REDFN	/(JMW:103) IF REDEFINING A MACRO, MUST
	DZM REDFN	/(JMW:103) MARK THE OLD DEFINITION AS GARBAGE.
	SNA		/(JMW:103)
	JMP .ENDM1	/(JMW:103)
	LAC* DEFPNT	/(JMW:103) WORD 3 OF S/T ENTRY.
	DAC TMP		/(JMW:103)
	LAC* TMP		/(JMW:103) OLD SIZE.
	TCA		/(JMW:103)
	DAC* TMP	/(JMW:103) TWO'S COMP FLAGS GARBAGE.
	IDX HOLES	/(JMW:103) INDICATE THAT THERE IS GARBAGE.
.ENDM1	LAC BEGDEF	/(JMW:103) PUT THE ADDRESS OF THE DEFIN
	XOR JMSLIT	/(JMW:103) INTO THE S/T, SETTING THE MACRO BIT.
	XCT PASSNO	/(JMW:103) ON PASS1, MAY NEED TO FUDGE FOR 'F' FILE.
	JMP TSTFFF	/(JMW:103)
MACBT0	XOR XCTLIT	/(JMW:103) DEFIN ENCOUNTERED IN PASS 2.
	DAC* DEFPNT	/(JMW:103) PUT ALL THAT INTO S/T.
	LAC EXPSW
	SZA
	JMP .ENDM2	/(JMW:106) WANT TO ZERO PARTIAL ENTRY SWITCH, BUT ONLY IF
	DZM PATLSW	/(JMW:106)  NO EXPANDING A MACRO.
	SKP		/(JMW:106)
.ENDM2	ISZ NOREST	/FLAG DEFIN IN TO EXPANSION ROUTINE.
	.TVERC			/(RCHM-105) CALL TABLE VERIFICATION.
	JMP PRPOP
	.NOLST
	.IFDEF %DEBUG		/(RCHM-105) DEFINE TABLE VERIFIER?
	.LST
	.TITLE 	DEBUG: TABLE VERIFICATION ROUTINE.
/
/ IF NO ERROR THIS ROUTINE PROCEEDS NORMALLY.
/ IF AN ERROR OCCURS THEN THE MACHINE HALTS AND THE AC HAS THE FOLLOWING PATTERN:
/
/	XXXYYY
/
/ WHERE XXX IS THE CALL NUMBER (THE NUMBER OF OCCURANCES OF .TVERC)
/ AND
/ YYY IS THE ERROR CODE.
/
/ THE FOLLOWING ERROR CODES ARE DEFINED:
/
/ 1	MACRO NOT FOUND IN SYMBOL TABLE.
/ 2	MACRO FOUND IN SYMBOL TABLE BUT DOESN'T POINT TO THE CURRENT
/	TABLE ENTRY.
/ 3	SYMBOL TABLE ENTRY LOCATED IS NOT FLAGED AS A MACRO ENTRY.
/ 4	NEXT ENTRY IN MACRO TABLE IS ABOVE THE END OF THE UMT.
/ 5	REAL ARGUMENT ENTRY DETECTED BUT DOES NOT CORRESPOND TO
/	ANY EXISTING REAL ARGUMENT ENTRIES (BEGRAL1 THRU 3)
/ 6	AN ENTRY WITH A WORD COUNT OF 0 WAS ENCOUNTERED WITHIN THE
/	MACRO TABLE (PARTIAL ENTRIES DO NOT QUALIFY)
/
TVER	0
	LAC MACTBL	/START OF MACRO DEFINITION TABLE.
	SKP
TVER10	LAC MCTNEW		/NEW TABLE POINTER.
	DAC MCTBEG
	SAD ENDUMT		/DONE WITH TABLE.
	JMP TVER99		/ YES, TABLE MUST BE GOOD
	LAC* MCTBEG		/ FETCH COUNT.
	SPA!CMA!IAC		/SHOULD WE IGNORE IT?
	JMP TVER41		/YES.
	SZA			/ENTRY SHOULD BE NON-ZERO.
	JMP TVER20		/IT IS.
	LAC (6)			/ZERO WORD COUNT ENCOUNTERED.
	JMS TVERH		/HALT.
TVER20	LAC MCTBEG		/PREPARE TO SCAN SYMBOL TABLE.
	AAC 1			/POINT TO NAME.
	DAC MCTNPT		/SET UP NAME POINTER.
	LAC* MCTNPT		/CHECK FOR R/A
	SNA			/ MUST BE NON-ZERO.
	JMP TVER70
	LAC GCVSW		/CHECK GARBAGE COLLECT IN PROGRESS SWITCH.
	SNA			/ON?
	JMP TVER25		/NO.
	JMS SEARCH		/SCAN SYMBOL TABLE.
	LAC GABEND		/LAST LOCATION.
	LAC GABBEG		/FIRST LOC.
	LAC MCTNPT		/ADDRESS OF NAME.
	400002			/MAGIC
	JMP TVER27		/FOUND
	JMP TVER26		/NOT FOUND.
TVER25	JMS SEARCH		/SEARCH SYMBOL TABLE.
	LAC USTEND
	LAC BEGUST
	LAC MCTNPT
	400002
	JMP TVER27		/FOUND.
TVER26	CLA!IAC			/SET UP NUMBER
	JMS TVERH	/HALT WITH NUMBERS.
TVER27	JMS WRD3		/ADVANC WORD TO POINTER.
	LAC* MRGLOC		/FETCH POINTER.
	AND (77777		/ EXTRACT ADDRESS.
	SAD MCTBEG		/ CHECK FOR THE SAME.
	JMP TVER30		/ GO GET NEXT TEST.
	LAC (2)		/ SECOND ERROR
	JMS TVERH
TVER30	LAC* MRGLOC		/ FETCH SYMBOL TAABLE BITS.
	AND JMSLIT		/ EXTRACT MACRO FLAG.
	SZA			/ MACRO?
	JMP TVER40		/ CONTINUE TEST.
	LAC (3)			/HALT NUMBER
	JMS TVERH
TVER40	LAC* MCTBEG		/FETCH NEXT NUMBER.
TVER41	TAD MCTBEG		/UPDATE.
	DAC MCTNEW		/SET UP FOR TEST.
TVER50	TCA			/ MAKE NEGATIVE.
	TAD ENDUMT		/ CHECK FOR MISSED THE END.
	SMA
	JMP TVER60
	LAC (4)
	JMS TVERH
TVER60	LAC MCTBEG		/SAVE POINTER TO CURRENT ENTRY.
	DAC MCTLST		/IN CASE NEXT ONE SCREWS UP.
	JMP TVER10
/
/ A REAL ARGUMENT LIST OF SOME KIND HAS BEEN DETECTED. CHECK THE REAL
/ ARGUMENT LIST FOR IT. IF IT DOESN'T APPEAR, HALT.
/
TVER70	LAC MCLCTR		/SAVE THE CURRENT LEVEL COUNTER.
	SMA			/ARE WE IN A MACRO WITH ARGUMENTS?
	JMP TVER90		/NO, MUST BE ERROR, OTHERWISE THIS WOULDN'T BE HERE.
	DAC MC.TMP		/SAVE FOR LATER.
TVER80	JMS GETRAL		/FETCH ADDRESS OF REAL ARGUMENT LIST.
	AAC -2			/CALCULATE REAL BEGINNING.
	SAD MCTBEG		/IS THIS THE ONE?
	JMP TVR100		/YES, GOOD ENTRY, CONTINUE WITH TABLE.
	ISZ MCLCTR		/MORE TO GO?
	JMP TVER80		/YES.
TVER90	LAC (5)			/NO, ERROR. REAL ARG LIST NOT ACCOUNTED FOR.
	JMS TVERH		/GO HALT.
TVR100	LAC MC.TMP		/RESTORE MCLCTR
	DAC MCLCTR
	JMP TVER40		/GO GET NEXT ENTRY.
TVER99	ISZ TVER		/MOVE PAST CALL NUMBER.
	JMP* TVER
TVERH	XX
	XOR* TVER
	HLT
	JMP* TVERH
MCTBEG
MCTNEW
MCTNPT
MCTLST
GCVSW
MC.CAL
MC.DEF
MC.GC
MC.TMP
	.ENDC			/(RCHM-105)
	.LST
	.TITLE 	.ETC PROCESSOR, PACKERS
/*** .ETC ***
/
.ETC	LAC DFNCTR	/IS .ETC ASSOCIATED
	AAC 1		/WITH HIGHEST LEVEL .DEFIN?
	SZA		/YES
	JMP NSTDA
	LAC ENDUMT
	JMS P57INT
	JMP DFNF	/SCAN FOR MORE D/A'S
/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
/
/REAL ARGUMENT AND MACRO
/DEFINITION PACKING ROUTINE
/
PAKRAM	0
	DAC GETDEF
	LAC PK57AD	/TEST FOR OVERFLOW
	AAC 1
PKPGA	SAD BEGUST
	JMS TBLSPC	/(JMW:103) MAY HAVE AN OVERFLOW.
PKPGB	LAC GETDEF
	JMS PACK57	/5/7 PACKING
	JMP* PAKRAM
/
/SEE IF ANY UNUSED AREA IN MACRO DEFIN TABLE.  IF SO (HOLES IS NON-ZERO),
/GO COLLECT IT.  THIS ROUTINE ASSUMES THAT 'PK57AD' IS THE END OF THE TABLE;
/THAT IS, ACTIVITY IS CURRENT IN THE MACRO DEFIN TABLE ITSELF, RATHER THAN THE S/T.
/
TBLSPC	0		/(JMW:103)
	LAC HOLES	/(JMW:103) ANY FREE AREA IN MACRO DEFIN TABLE?
	SNA		/(JMW:103)
	JMP STOVA	/(JMW:103) NO - TABLE OVERFLOW: QUIT.
	LAC GRASW	/(JMW:104) IF DOING REAL ARGS, S/T POINTERS NOT IN TEMP LOCS.
	JMS COMPAT	/(JMW:103)
	JMP* TBLSPC	/(JMW:103)
/
/ROUTINE TO GET CHARACTERS FROM MACRO
/DEFINITION IN SYMBOL TABLE AND PACK
/INTO SOURCE INPUT AREA
/
GETDEF	0
	LAC PK57AD
	SAD (RDLST
	JMP .+4		/LINE OVERFLOW
	LAC CHRHLD
	JMS PACK57
	JMP* GETDEF
	SET ERRORW	/W TO FLAG WORD
	JMP* GETDEF
/
/WORDS THAT MUST BE SAVED FROM LEVEL TO LEVEL.  THERE ARE 3
/OF EACH, ONE FOR EACH LEVEL.  THEY ARE ACCESSED BY THE INDEX 'MCLCTR', WHICH IS
/ -1,-2 OR -3, DEPENDING ON THE LEVEL.
/
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	15530		/CREATE SYMBOL BASE -L3
CSNL2	7646		/CSB -L2
CSNL1	0		/CSB -L1
SVUPK3	0		/UNPACKING SAVE -L3
SVUPK2	0		/LEVEL 2
SVUPK1	0		/LEVEL 1
SVPKN3	0		/PACKING VALUE - "PKNUM"
SVPKN2	0
SVPKN1	0
RDXSV3	0		/RADIX SAVE -L3
RDXSV2	0		/RADIX SAVE -L2
RDXSV1	0		/RADIX SAVE -L1
	.EJECT
/
/SAVE UNPACKING VALUES
/
GETSAV	0
	LAC MCLCTR
	TAD (DAC SVUPK1+1
	DAC .+2
	LAC UPKAD
	XX
	LAC MCLCTR
	TAD (DAC SVPKN1+1
	DAC .+2
	LAC PKNUM
	XX
	JMP* GETSAV
/
/RESTORE UNPACKING VALUES
/
TITCNT=.		/TEMP FOR TITLE ROUTINE.
GETRST	0
	LAC MCLCTR
	TAD (LAC SVUPK1+1
	DAC .+1
	XX
	DAC UPKAD
	LAC MCLCTR
	TAD (LAC SVPKN1+1
	DAC .+1
	XX
	DAC PKNUM
	JMP* GETRST
/
/SAVE MACRO PACKING (5/7 PACKING ROUTINE).
/
PUTSAV	0
	LAC CTR57
	DAC CT57SV
	LAC PK57AD
	DAC PK57SV
	LAC MACSIZ	/(JMW:103)
	DAC SIZESV	/(JMW:103)
	JMP* PUTSAV
/
/RESTORE MACRO PACKING (5/7 PACKING ROUTINE).
/
PUTRST	0
	LAC CT57SV
	DAC CTR57
	LAC PK57SV
	DAC PK57AD
	LAC SIZESV	/(JMW:103)
	DAC MACSIZ	/(JMW*103)
	JMP* PUTRST
/
PK57SV	0
CT57SV	0
SIZESV	0		/(JMW:103)
/
/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
	XX
	DAC RADIX
	ISZ MCLCTR	/SWITCH TO NEXT LEVEL
	SKP
	DZM EXPSW	/RESET EXPANDING
	DZM PATLSW	/(JMW:106) NO MORE PARTIAL ENTRY.
	JMP* RSTRDX
/
/GET START OF ASSOCIATED REAL ARGUMENTS
/
GETRAL	0
	LAC MCLCTR
	TAD (LAC BEGRL1+1
	DAC .+1
USQCTR	XX
	JMP* GETRAL
	.TITLE 	MACRO DEFIN TABLE GARBAGE COLLECTOR
/
/ROUTINE TO GARBAGE COLLECT THE MACRO DEFINITION TABLE.  THIS ROUTINE IS CALLED
/UNDER 2 INSTANCES: (1) THERE IS A SYMBOL TABLE OVERFLOW (INCLUDES DUMMY TABLE
/AND LOCALS); AND (2) MACRO DEFINITION TABLE OVERFLOW (INCLUDES REAL ARGS). 
/ONLY GET HERE IF 'HOLES' IS NON-ZERO, INDICATING THAT THERE IS UNUSED SPACE IN 
/THE DEFIN TABLE.  AS EACH USED ENTRY (WORD 1=SIZE=+) IS ENCOUNTERED, IT IS MOVED 
/(IF NECESSARY) TIGHT UP AGAINST THE PREVIOUS ENTRY.  THE SYMBOL TABLE ENTRY IS ADJUSTED 
/(WORD3: POINTER TO THE DEFINITION IN THE TABLE) AS THE MOVE IS DONE, AS ARE THE SAVED
/POINTERS FOR ALL INVOLVED EXPANSIONS (LEVELS 1-3 OF BEGRL1 & SVUPK1) IF
/'EXPSW' IS NON-ZERO.  UNUSED ENTRIES (WORD 1 = TWO'S COMP OF SIZE)
/ARE SIMPLY SKIPPED OVER.  IF THE COLLECT IS BEING DONE BECAUSE SPACE RAN OUT WHILE
/DOING A MACRO DEFIN TABLE ENTRY, THE LAST MOVE WILL BE OF A PARTIAL ENTRY (WORD 1=0).
/
/EDIT 103  GOES FROM HERE TO 'FILE', EXCLUSIVE.
/
/ENTRY:	AC=0 IF REAL VALUES OF 'USTEND' AND BEGUST" IN TT2 & TT3.
/	AC+ NON-ZERO IF USTEND AND BEGUST REAL.
/
COMPAT	0
	SNA		/NEED SAVED VALUES.
	JMP COMPT1
	LAC USTEND
	DAC GABEND
	LAC BEGUST
	JMP COMPT2
COMPT1	LAC TT3
	DAC GABEND
	LAC TT2
COMPT2	DAC GABBEG
	LAC MRGLOC
	DAC SAVMRG
	LAC CMPLOC
	DAC SAVCMP
	.IFDEF %DEBUG		/(RCHM-105) SET UP IN GARBAGE COLLECTER SWITCH.
	IDX MC.GC		/(RCHM-105) COUNT NUMBER OF GARBAGE COLLECTS.
	SET GCVSW		/(RCHM-105)
	.ENDC			/(RCHM-105(
	.TVERC			/(RCHM-105) CALL TABLE VERIFY.
	LAC MACTBL	/START OF TABLE.
	DAC MACTO
	DAC MACFRM
	DAC TMACTO
	DAC TMACFM
	LAC PATLSW		/NON-ZERO IF PARTIAL ENTRY IN TABLE.
	SZA
	JMP .+3
	LAC ENDUMT	/END WHEN NO PARTIAL ENTRY.
	SKP
	LAC PK57AD
	DAC ENDTBL
MAINLP	LAC* MACFRM	/MINUS: DISCARD; 0:PARTIAL; OTHERWISE,
	SPA		/KEEP AND PERHAPS MOVE.
	JMP DISCAD
	SNA
	JMP PARTAL
	LAC MACTO	/IS THERE A HOLE HERE?
	SAD MACFRM	/NO, IF THE SAME.
	JMP UPPNT
	LAC* MACFRM	/GET SIZE OF THE ENTRY.
	TCA
	DAC TMP
SUBLP1	LAC* MACFRM	/MOVE THIS ENTRY DOWN.
	DAC* MACTO
	IDX MACTO
	IDX MACFRM
	ISZ TMP		/MORE WORDS TO MOVE?
	JMP SUBLP1	/YES.
	LAC TMACTO	/NOW MUST UPDATE S/T ENTRY.
	AAC 1
	DAC TMP
	LAC* TMP	/IF NOT DEFIN ENTRY, NO NEED TO GO TO S/T.
	SNA
	JMP SUBLP2
	LAC TMP
	JMS GABSRC	/FIND ENTRY IN SYMBOL TABLE.
	JMP SUBLP2	/NOT FOUND - PROBABLE EMPTY UST.
	DAC TMP		/(JMW:118)
	AND (77777	/(JMW:118) IF STORING REAL ARGS,
	AAC 3		/(JMW:118)  MUST UPDATE POINTER
	SAD MACLOC	/(JMW:118)  TO DEFINITION.
	SKP		/(JMW:118)
	JMP NOMATC	/(JMW:118)
	LAC TMACTO	/(JMW:118) NEW ADDRESS OF DEFINITION.
	AAC 3		/(JMW:118) SKIP CONTROL WORDS.
	DAC MACLOC	/(JMW:118)
NOMATC	LAC TMP		/(JMW:118)
	AND (700000
	XOR TMACTO
	DAC* MRGLOC
SUBLP2	JMS CHKEXP	/UPDATE EXPANSION POINTERS, IF NECESSARY.
	LAC MACFRM	/AT END OF TABLE?
	DAC TMACFM
UPDATE	TCA
	TAD ENDTBL
	SPA!SNA
	JMP LOPDNE
	LAC MACTO
	DAC TMACTO
	JMP MAINLP	/LOOK AT THE NEXT ONE.
LOPDN1	JMS CHKEXP	/SEE IF EXPANSIONS NEED ADJUSTING.
LOPDNE	DZM HOLES	/NO MORE UNUSED ENTRIES.
	LAC LOCLSV	/IF LUST, TMACTO HAS CORRECT NEW END OF TABLE.
	SZA
	JMP LOPDN2
	LAC PATLSW
	SNA
	JMP LOPDN3	/NOT A PARTIAL ENTRY.
	LAC MACTO	/MUST RESET THE PACKING ROUTINE POINTER, TOO.
	DAC PK57AD
LOPDN2	LAC TMACTO	/NOW RESET ENDUMT.
	SKP
LOPDN3	LAC MACTO
	DAC ENDUMT	/NEW END OF MACRO DEFIN TABLE.
	.TVERC			/(RCHM-105) CALL TABLE VERIFY.
	.IFDEF %DEBUG		/(RCHM-105) CLEAR IN GARBAGE COLLECTER SWITCH.
	DZM GCVSW		/(RCHM-105)
	.ENDC			/(RCHM-105)
	LAC SAVMRG
	DAC MRGLOC
	LAC SAVCMP
	DAC CMPLOC
	JMP* COMPAT	/DONE.
UPPNT	LAC* MACFRM	/NO HOLE- JUST UPDATE POINTERS.
	TAD MACFRM
	DAC MACTO
	DAC TMACTO
UPPNT1	DAC MACFRM
	DAC TMACFM
	JMP UPDATE
DISCAD	LAC* MACFRM	/SKIP OVER THIS NO LONGER USED ENTRY.
	TCA
	TAD MACFRM
	JMP UPPNT1
PARTAL	LAC MACTO
	DAC BEGDEF	/NEW STARTING LOCATION OF THIS DEFENITION.
	LAC MACFRM
	DAC TMACFM
PARTL1	LAC* MACFRM
	DAC* MACTO
	LAC MACFRM
	SAD ENDTBL
	JMP LOPDN1	/AT END OF TABLE - DONE.
	IDX MACFRM
	IDX MACTO
	JMP PARTL1
/
/ROUTINE TO SEARCH SYMBOL TABLE FOR DEFIN JUST RELOCATED.
/
/ENTRY:	AC= ADDRESS OF NAME.
/EXIT:	AC=ADDRESS OF DEFIN.
/	MRGLOC= ADDRESS OF WORD 3 IN S/T.
/ RETURN:	LOC = NOT FOUNG;
/		LOC+1= FOUND.
/
GABSRC	0
	DAC TMP
	JMS SEARCH	/GO FIND IT.
	LAC GABEND
	LAC GABBEG
	LAC TMP
	400002	/LOOK AT 2 WORDS, LOW 16 BITS ONLY.
	SKP		/GOT IT.
	JMP* GABSRC	/NOT FOUND.
	JMS WRD3
	LAC* MRGLOC
	IDX GABSRC	/INDEX TO CORRECT EXIT.
	JMP* GABSRC
/
/ROUTINE TO UPDATE THE MACRO EXPANSION POINTERS IF CURRENTLY EXPANDING ANY  
/ MACROS: 'EXPSW = NON-ZERO.  "MCLCTR" CONTAINS THE NUMBER OF LEVELS TO .
/ CONSIDER (-1, -2 OR -3); OR TO UPDATE THE LUST POINTERS IF .LOCAL ON.
/
CHKEXP	0
	LAC EXPSW
	TAD GRASW	/(JMW:118) 
	SNA
	JMP CHKLCL	/PLAYING WITH LUST?
	LAC MCLCTR	/MUST SAVE THIS SO CAN RESTORE AS LEAVING.
	DAC TMP
CHKEX1	JMS GETRAL	/GET ADDR OF REAL ARG LIST.
	AAC -2
	SAD TMACFM
	JMP CHKEX2	/UPDATE 'BEGRL1 (OR 2 OR 3).
	LAC MCLCTR	/NOW LOOK AT ADDR OF CURRENT DEFINITION THAT IS BEING
	TAD (TAD SVUPK1+1
	DAC CHKLM1	/ UNPACKED BY THIS DEFINITION.
	AND L57S	/CHANGE THE 'TAD' TO A 'DAC'.
	DAC CHKLM3
	JMS CHKLMS
	LAC (TAD PK57AD	/MAY BE PACKING DUMMY ARGS.
	DAC CHKLM1
	AND L57S
	DAC CHKLM3
	JMS CHKLMS
	LAC (TAD PK57SV
	DAC CHKLM1
	AND L57S
	DAC CHKLM3
	JMS CHKLMS
CHKEND	ISZ MCLCTR	/DONE?
	JMP CHKEX1	/NO - GO AROUND FOR THE NEXT LEVEL.
	LAC TMP	/MUST RESTORE MCLCTR.
	DAC MCLCTR
	LAC (TAD SVUPK
	DAC CHKLM1
	AND L57S
	DAC CHKLM3
	JMS CHKLMS
CHKLCL	LAC LOCLSV	/DEALING WITH LUST?
	SNA		/YES, IF NON-ZERO.
	JMP* CHKEXP	/DONE.
	SAD TMACFM
	SKP
	JMP* CHKEXP
	LAC TMACTO
	DAC LOCLSV	/UPDATE START OF LUST (INC. CONTROL WORDS)
	AAC 2
	DAC BOTLUS	/ AND WITHOUT CONTROL WORDS.
	LAC TOPLUS	/NOW MUST ADJUST TOP OF LUST.
	TCA
	TAD TMACFM
	TCA		/NOW HAVE NUMBER OF WORDS FROM BOTTOM.
	TAD TMACTO	/ADD TO NEW BOTTOM FOR CURRENT TOP.
	DAC TOPLUS
	JMP* CHKEXP
CHKEX2	LAC MCLCTR	/GET THE RIGHT LEVEL
	TAD (DAC BEGRL1+1
	DAC CHKEX3	/ AND UPDATE THE REAL ARGUMENT POINTER.
	LAC TMACTO
	AAC 2		/ADJUSTMENT FOR CONTROL WORDS.
CHKEX3	XX
	JMP CHKEND
/
/
CHKLMS	0
	LAC TMACFM	/SEE IF WITHIN LIMITS.
	TCA
CHKLM1	XX
	SPA		/ONLY WANT TO CONSIDER IF POSSIBLY WITHIN RANGE.
	JMP* CHKLMS
	DAC GABSRC	/TEMP - # WORDS IF WITHIN RANGE.
	LAC MACFRM
	TCA
	TAD TMACFM
	TAD GABSRC
	SZA!SMA
	JMP* CHKLMS	/NOT WITHING LIMITS.
	LAC TMACTO
	TAD GABSRC	/UPDATE POINTER.
CHKLM3	XX
	JMP* CHKLMS
/
/
DEFPNT	0	/POINTER TO 3RD WORDS IN S/T FOR .DEFIN IN PROCESS.
MACTO	0	/WHEN GARBAGE COLLECTING, THE 'TO' ADDRESS.
MACFRM	0	/ "      "        "       THE 'FROM' ADDRESS.
TMACTO	0	/ORIGINAL ENTRY 'TO' FOR S/T SEARCH.
TMACFM	0	/ORIGINAL ENTRY 'FROM' FOR POINTER UPDATES.
ENDTBL	0	/END OF MACRO DEFIN TABLE FOR COLLECT.
GABEND	0	/"USTEND"
GABBEG	0	/"BEGUST"
MACSIZ	0	/# WORDS IN MACRO DEFIN. OR IN R/A ENTRY.
REDFN	0	/NON-0 IF REDEFING A MACRO.
SAVMRG	0
SAVCMP	0
	.TITLE COMMAND STRING PROCESSOR.
FILE	0		/NAME 1
	0
NAME1X	0		/NAME 1 EXTENSION
	0		/NAME 2
	0
NAME2X	0		/NAME 2 EXTENSION.
	0		/NAME 3
	0
NAME3X	0		/NAME 3 EXTENSION.
	.IFUND %RSX
OUTNAM	0
	0
OUTEXT	0
	.ENDC
BNOPTN	0		/BINARY OPTION.
OSWCH	0		/OMIT 33 L.L. CODE.
TSWCH	0		/TABLE OF CONTENTS (-1 IF ON).
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.
PSWCH	0		/PARAMETER ASSIGNMENT OPTION
HSWCH	0		/PRINT SYMBOLS HORIZONTALLY.
ISWCH	0		/IGNORE .EJECTS
ZSWCH	0	/PROCESS F FILE TWICE.
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)
/
/THE FOLLOWING SEQUENCE OF WORDS CANNOT BE CHANGED. THEY ARE ARGUMENTS TO
/PASS3 AND ARE PASSED AT XSETUP.
/
FSWCH	0	/ON IF A FILE FROM -14 MUST BE PASSED (Z SWITCH, NOT F SWITCH)
BATCH	0	/ASSEMBLE 'N' PROGS OR GO TO MONITOR.
	.IFDEF %RSX
VERPNT	0	/IDENTIFY SWITCH.
PARSIZ	0		/PARTITION SIZE.
	.ENDC
USTSZE	0	/NO OF USER SYMBOLS.
USTEND	0	/TOP OF USER SYMBOL TABLE.
BEGUST	0	/BOTTOM OF USER SYMBOL TABLE.
LNSAVE	0	/MAX LINE COUNT.
PGCTR	0
EOTSW	0
	.EJECT
/SOME I/O ROUTINES.
/
	.IFUND %RSX
WAIT13	0
	.WAIT -13		/WAIT FOR BINARIES TO STOP.
	JMP* WAIT13	/EXIT
	.ENDC
	.IFDEF %RSX
WAIT13	0
	CAL WFEV13	/WAIT FOR EVENT VARIABLE.
	LAC EV13	/PICK UP EVENT VARIABLE.
	SMA		/WAS THERE AN ERROR?
	JMP* WAIT13	/NO - RETURN, I/O FINISHED.
IOER13	JMS* IOERR	/(JMW:126)YES - PRINT I/O ERROR.
	LAC (DAT13	/ERROR ON LUN - .DAT 13.
MES.3=WRTBUF
	.ENDC
/
WRITE3	0
	DAC MES.3
	.IFUND %RSX
	.WRITE -3,2,MES.3,4
MES.3=.-2
BULK14=.-1
	.ENDC
	.IFDEF %RSX
	CAL WRTCB
	JMS WAITFR
	.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 AT PASS1.
/
.SEK11	0	/ADDRESS OF -11 NAME.
.SEK14	0	/ADDRESS OF -14 NAME.
PASS1P=.
	.IFUND %RSX
	.CLOSE -3
	.ENDC
	LAC CTLP
	SZA
	JMP* CTLP
	.TITLE 	IDENTIFICATION AND RESTART (START).
/
PASS1=.
	.IFUND %RSX
	.INIT -3,1,PASS1P
POWA=.-1
CTLP=.-1
	DZM CTLP	/CONTROL P TO PASS1.
	.ENDC
	.IFDEF %RSX
	LAC (DAT11	/ATTACH INPUT DEVIDE.
	JMS ATACH
	LAC (DAT10	/DETACH OTHERS.
	JMS DETHCB
	LAC (DAT12
	JMS DETHCB
	LAC (DAT13
	JMS DETHCB
	LAC (DAT14
	JMS DETHCB	/LUNS 10,12,13,14 NOW RELEASED.
	.ENDC		/MAY NOT NEED THEM, SO DON'T TIE UP UNNECESSARILY.
CMDSTP	LAC (FILE-1
	JMS ZEROIT
	.IFUND %RSX
	FILE-USTEND
	.ENDC
	.IFDEF %RSX
	FILE-NAME3X
	DZM USTSZE	/CLEAR USER SIZE AND END.
	DZM USTEND
	SET POISW	/SET EXIT ON CR - ALTMODE SWITCH.
	LAC* UPKADS	/RESET POINTERS TO COMMAND BUFFER.
	DAC UPKAD
	LAC* PKNUMS	/ALSO THE CHAR POINTER.
	DAC PKNUM
	LAC* INITSW	/CHECK THE FIRST TIME SWITCH.
	SZA		/SET?
	JMP CMDNAM	/YES - GO LOOK FOR A NAME ONLY.
	.ENDC
	SET HSWCH
	.IFUND %RSX
/
/IN BOSS-15 MODE DO NOT PRINT 'MACRO-VNN' OR (>).
/
	LAC* (%BOSS
	SPA
	JMP BOSSIN	/SKIP OVER TYPING.
/
	LAC (ID-2
	JMS WRITE3	/IDENTIFY THE PROG 'MACRO '.
BOSSIN	LAC NOPLIT	/SET THE MACRO DEFINITION SWITCH.
	DAC MACSW
	LAC MACNMP	/GO DO AN FSTAT ON 'MACDEF MAC' ON .DAT-1
	JMS TST.FS	/ SO KNOW THAT IT'S THERE BEFORE GOING ANY FURTHER.
	.IFUND %BIN
	777
	.ENDC
	.IFDEF %BIN
	001
	.ENDC
	LAC SKPLIT
	DAC MACSW
	LAC* (%BOSS
	SPA
	JMP NOCART	/DON'T OUTPUT THE > BECAUSE IT'S BOSS.
	LAC (LF-1
	JMS WRITE3
NOCART=.
	JMS UPBLB	/INIT 5/7 PACKING.
	.ENDC
	.TITLE 	COMMAND STRING PROCESSOR
/
	.IFUND %RSX
	.READ -2,2,RDBUF,27	/.READ KEYBOARD
	.WAIT -2
	.ENDC
/
CMDA	JMS GETCHR	/GET A CHARACTER
	SAD L137	/LEFT ARROW
	.IFUND %RSX
	JMP CMDNAM	/GET FILE NAME.
	.ENDC
	.IFDEF %RSX
	JMP CMDNAR	/SAVE PARAMETERS BEFORE GETTING FILE NAMES.
	.ENDC
/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 %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
	SAD L106
	SET FSWCH	/F?
	SAD L111	/I?
	SET ISWCH
	SAD L110	/H?
	DZM HSWCH
	SAD L120	/P?
	SET PSWCH
	SAD L132	/Z?
	SET ZSWCH
	SAD L123	/S?
	SKP
	JMP .+3
	SET ASWCH
	SET VSWCH
	SAD L126	/V?
	SET VSWCH
	.IFUND %BIN 	/CREF CANNOT BE USED WITH THE DDT VERSION.
	SAD L130		/X?
	SET XSWCH
	.ENDC
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.
/
	.IFDEF %RSX
CMDNAR	LAC (BNOPTN-1	/SAVE ALL SWITCHES.
	DAC* L10
	LAC SWITCH
	AAC -1
	DAC* L11
	LAW -24		/(JMW:113)
	JMS MOVAUT
	.ENDC
CMDNAM=.
	.IFDEF %RSX
	LAC VERPNT	/TITLE WANTED? 
	SNA
	JMP NOTIT	/NO, DON'T PRINT IT.
	LAC (ID-2	/YES - PRINT IT ON TTY.
	JMS WRITE3
NOTIT=.
	.ENDC
	LAC XSWCH	/IF X AND L ARE USED FORCE 'N'.
	DZM SAVEF
	SNA
	JMP .+4
	LAC ALOPTN
	SZA
	SET NSWCH
	.IFDEF %RSX
	DZM POISW	/SET NO EXIT ON CR - ALTMODE SWITCH.
	LAC TSWCH	/SEE IF NEED TO ATTACH.
	SNA
	JMP .+3		/NO - DON'T ATTACH.
	LAC (DAT12	/YES - ATTACH OUTPUT LISTING DEVICE.
	JMS ATACH
	.ENDC
	.IFUND %RSX
	LAW -3
	DAC FLDSW
	.ENDC
	.IFDEF %RSX		/(JMW:120) THE % HAD BEEN LEFT OUT AND BATCHING DIDN'T WORK.
	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
	JMS HINFRQ	/ FILE STRUCTURED.
	AND L40000	/(JMW:126)
	SZA		/0= NON DIRECTORIED.
	IDX FLDSW	/FILE STRUCTURED - COUNT THE FILE.
NPSW	LAC FSWCH	/AUX INPUT?
	SNA
	JMP NFSW	/NO - DON'T COUNT IT.
	LAC (DAT14
	JMS HINFRQ	/FILE STRUCTURED?
	AND L40000	/(JMW:126)
	SZA		/0=NON DIRECTORIED.
	IDX 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 (FILE	/FILE, +1, +2
NXTNAM=.
	DAC PACKER
	JMS P6INT
NXTCHR	JMS GETCMD
	SAD L40
	JMP NXTCHR		/IGNORE LEADING BLANKS/
	.IFUND %RSX		/(JMW:119) SINCE RSX CAN BATCH ASSEMBLIES,
	SAD	COMMA		/V7C,V7D PATCH
	JMP	NXTCHR		/IGNORE COMMAS IN BOSS  MODE
	.ENDC			/(JMW:119)  NEED THE COMMAS.
	DZM PRVCHR	/PSEUDO COUNTER FOR SPACES.
	SKP
CMDSUB	JMS GETCMD	/GET A CHAR AND RETURN IF NOT DELIMITED.
	SAD L40
	JMP CMDEXT
	SAD KOMMA
	JMP NAMDUN
	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.
	LAC PACKER	/SET ADDRESS FOR EXTENSION.
	AAC 2
	JMS	P6INT
	JMP	CMDSUB	/THIS TRIGGERS THE DOUBLE SPACE THING
GETCMD	0
	JMS GETCHR
	SAD L15
	JMP CMD15
	SAD L175
	JMP CMD175
	JMP* GETCMD
/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
	AAC 3
	JMP NXTNAM
	.IFUND %RSX
PASALL	JMS GETCMD	/LOOP UNTIL CR OR ALT.
	JMP .-1
	.ENDC
	.IFDEF %RSX
PASALL	SKP
	.ENDC
CMD175=.
	.IFDEF %RSX
CMD15	DZM BATCH	/INDICATE THAT COMMAND STRING IS NOW CONPLETE.
	LAC POISW	/EXIT?
	SZA
	JMP* EXIT
	LAC PKNUM	/SAVE THE CHAR POINTERS.
	DAC* PKNUMS
	LAC UPKAD
	DAC* UPKADS
	.ENDC
	.IFUND %RSX
	.CLOSE -3
	SKP!CLA
CMD15	CLC
	DAC BATCH
	.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
	.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.
/
	LAC PSWCH	/WAS THE P TYPED? (-10 INPUT)
	SNA		/YES .. DO AN .FSTAT.
	JMP TRYF	/NO .. TRY THE F SWITCH.
	LAC (FILE
	JMS TST.FS
	.IFUND %RSX
L770	CAL+770		/CAL -10
	.ENDC
	.IFDEF %RSX
	DAT10
	.ENDC
TRYF	TAD (FILE	/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
	.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
	.ENDC
	DAC BULK11	/REMEMBER AT ^P.
	JMP PASS1A
	.IFDEF %RSX
BULK11	0		/RESULT OF .FSTAT ON -11.
BULK14	0
	.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
	AAC 2
	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 (3000	/BUILD AN FSTAT
	DAC CAL2
	LAC* .FSTNM
	SNA
	JMP NAMERR
CAL1	.INIT 1,0,PASS1P	/(JMW:099) WORD 1 OF CAL ALTERED.
FOUND=.-1			/USE AS TEMP STORAGE.
BULK11=FOUND
EXTPTR=FOUND
CAL2	.FSTAT 1,.FSTNM		/(JMW:099) WORDS 1,3 ALTERED.
.FSTNM=.-1
	DAC FOUND	/0=NOT FOUND, NON0=FOUND.
CAL3	.CLOSE -1		/(JMW:099) WORD 1 ALTERED.
	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
	.IFDEF %RSX
	AAC -1
	DAC* L10
	JMS STSKFL	/SET THE FILE NAME INTO THE SKKE CPB.
	SNA
	LAC SRCEXT	/USE SRC FOR DEFAULT EXTENSION.
	DAC FILEXT
	LAC* TST.FS
	IDX TST.FS
	DAC HIFLUN	/NOW SET THE LUN.
	DAC SEKLUN
	DAC CLSLUN
	CAL HINFCB
	JMS WAITSK
	LAC SKEV	/FILE ORIENTED?
	AND L40000
	SNA
	JMP* TST.FS	/NO - EXIT WITHOUT SEEKING.
	CAL SEEKCB	/TERMINAL ERROR IF FILE NO THERE.
	CAL WFSK	/WAIT FOR SEEK TO COMPLETE.
	LAC SKEV	/GET THE EVENT VARIABLE.
	SPA		/FILE FOUND?
	JMP SKERR	/CHECK 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	/FILE NOT FOUND?
	JMP NAMERR	/YES - NAME ERROR.
	JMP IOERRA	/(JMW:126)NO - 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
/ERROR MESSAGE OUTPUT
/
CMDE	LAC (QMARK-2
	JMS WRITE3
	.IFUND %RSX
	JMP TSTBOS
	.ENDC
	.IFDEF %RSX
	LAC (2		/FORCE TVD TO BE CALLED.
	DAC* TDVEV
	JMP* EXIT
QMARK1	QMARKS-QMARK1/2*1000+2
	0
QMARK	.ASCII	'MAC-SYNTAX ERR'<15>
QMARKS=.
	.ENDC
	JMP CMDSTP
	.IFUND %RSX
NAMERR	XCT MACSW	/SKP IF NOT READING A MACRO DEF. FILE.
	JMP NOMDEF	/OUTPUT DIFFERENT ERROR MSG.
	LAC (NOTHERE-2
	JMS WRITE3
/
/ALL ERRORS ARE FATAL ON BOSS-15 MODE.
/
TSTBOS	LAC* (%BOSS
	SPA
	JMP CLOSE3
	JMP CMDSTP
QMARK	374320		/QUESTION MARK <15>
NOTHERE	.ASCII 'NAME ERROR'<15>
	.LOC .-1
	.ENDC
	.IFDEF %RSX
NAMERR	LAC (NTMES-1	/PRINT NAME ERROR IN IMAGE.
	DAC* (X10	/SET UP TO INSERT MESSAGE.
	LAC FILNM1	/FIRST HALF OF THE FILE NAME.
	JMS DECNAM	/DECODE THE NAME.
	LAC FILNM2	/SECOND HALF.
	JMS DECNAM
	ISZ* (X10	/ISERT A SPACE.
	LAC FILEXT	/THE EXTENSION.
	JMS DECNAM
	CAL WRNMER	/WRITE NAME ERROR
	JMS WAITFR	/WAIT FOR EVENT VARIABLE.
	LAC (2
	DAC* TDVEV	/FORCE TDV TO BE CALLED.
	JMP* EXIT	/EXIT MACRO - FATAL ERROR.
/
/DECNAL	- DECODES SIXBIT TO IMAGE ASCII.
/
DECNAM	0
	LMQ	/SAVE THE NAME IN THE MQ.
	LAW -3		/SET UP TO DO 3 CHARS.
	DAC TMP		/SAVE THE COUNT.
DELLPN	ECLA!LLS 6	/PICK UP THE FIRST 6 BITS. 
	DAC PSWCH
	AND (40		/CONVERT TO 7 BITS.
	SNA!CLA		/ADD BIT 11 IF LETTER.
	AAC 100
	TAD PSWCH	/ADD IN THE VALUE.
	SAD (100	/NULL?
	AAC -40		/YES - MAKE IT A SPACE.
	DAC* X10	/STORE IT IN THE MESSAGE.
	ISZ TMP
	JMP DELLPN	/DO ANOTHER CHAR.
	JMP* DECNAM
/
NOTHER	NTERND-NOTHER/2*1000+3
	0
	115		/M
	101		/A
	103		/C
	055		/-
	116		/N
	101		/A
	115		/M
	105		/E
	040		/SPACE
	105		/E
	122		/R
	122		/R
	117		/O
	122		/R
	040		/SPACE
	.REPT 12
NTMES	040		/SPACE - FILE NAME.
	015		/CR
	012		/LF
	000		/NULL
NTERND=.
	LFEND-LF+1/2*1000+2
	0
	.ENDC
LF	050320		/(JMW:099) MOVED HERE TO INSURE THAT 2 PRECEDING WORDS
	373720		/ARE ALWAYS NON-ZERO (FOR WPC).   >ALT MODE.
	.IFDEF %RSX
LFEND=.
	.ENDC
	.IFUND %RSX
	.NOLST			/(RCHM-108)
	.IFUND %DMACRO		/(RCHM-108)
	.LST			/(RCHM-108)
ID	.SYSID <	.ASCII ' MACRO >,<005'<15>> 
	.NOLST			/(RCHM-108)
	.ENDC
	.IFDEF %DMACRO		/(RCHM-108)
	.LST			/(RCHM-108)
ID	.SYSID <	.ASCII ' MACRO-D >,<005'<15>> 
	.NOLST
	.ENDC			/(RCHM-108)
	.LST			/(RCHM-108)
	.ENDC
	.IFDEF %RSX
	PASS1A-ID+1/2*1000+2
	0
ID	.ASCII "MACRO XVM/RSX V1A005"<15>
	.ENDC
	.TITLE INITIALIZATION: PASS1
/
/
PASS1A	LAC NOPLIT	/SET PASS 1
	DAC PASSNO
	DAC SET1ST	/FOR USING DAT SLOT -12.
	.IFUND %RSX
	LAC* L102	/(.SCOM+2
	.ENDC
	.IFDEF %RSX
	LAC ..SIZE	/PICK UP END OF MACRO.
	.ENDC
	DAC ENDUMT
	DAC MACTBL	/KEPT CONSTANT FOR LATER USE.
	LAC (BP1T-1
	JMS ZEROIT	/ZERO SWITCHES
	BP1T-EP1T
	.IFUND %RSX
	.IFUND %BIN	/(JMW:109)
	LAC (MACEND	/OVERLAY SOME OF MACRO DEF. FILE PROCESSOR.
	.ENDC
	.IFDEF %BIN	/(JMW:109) IF RUNNING WITH DDT, DON'T OVERLAY
	LAC* L103	/(JMW:109) MACRO SO CAN RESTART EASIER AFTER CTRL T.
	.ENDC
	.ENDC
	.IFDEF %RSX
	LAC* INITSW	/DO PREALLOCATION ONLY ONCE.
	SZA
	JMP PARSID
	ISZ* INITSW	/SET INIT SWITCH TO PREVENT READING SWITCHES, ETC.
	LAC BNOPTN	/CHECK FOR BINARY OUTPUT.
	SNA
	JMP NOBINP	/NO BINARY.
	CAL PREA13	/PREALLOCATE LUN 13.
	LAC (DAT13	/SET UP IN CASE OF I/O ERROR.
	DAC HIFLUN
	JMS WAITSK	/WAIT FOR EVENT VARIABLE.
NOBINP	LAC XSWCH	/CHECK FOR LISTING DEVIDE.
	TAD ALOPTN
	TAD TSWCH
	SNA
	JMP PARSID	/NO - DON'T PREALLOCATE.
	CAL PREA12
	LAC (DAT12
	DAC HIFLUN	/SET UP IN CASE OF I/O ERROR.
	JMS WAITSK	/WAIT FOR EVENT VARIABLE.
PARSID	CAL PARDEF	/FIND THE DEFINITION OF THE PARTITION BLOCK.
	LAC PARSIZ
	.ENDC
	DAC USTEND
	DAC BEGUST
	JMP READ1
	.TITLE 	ENTRY AND INITIALIZATION: PASS2
/
/
PASS2=.
	DZM CTLP	/SET CONTRL P TO PASS 1
	LAC LSWCH
	DAC ALOPTN
	LAC SKPLIT
	DAC PASSNO	/SET PASS 2 SWITCH
	LAC BNOPTN	/BINARY REQUESTED?
	SNA		/YES
	JMP READ1	/NO
	LAC PRGSZE	/(JMW:123) IF PROGRAM SIZE = 0, NO
	DAC BNOPTN	/(JMW:123)  NEED FOR ANY BINARY OUTPUT.
	SNA		/(JMW:123)
	JMP READ1	/(JMW:123)
	.IFUND %RSX
	.INIT -13,1,PASS1P	/.INIT BINARY OUTPUT DEVICE
BBFSIZ=.-1
	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
	.IFDEF %RSX
	LAC (DAT13	/FILE STRUCTURED?
	JMS HINFRQ	/(JMW:126) SEE IF FILE STRUCTURED.
	AND L40000
	SNA!CLA
	AAC -1		/SUBTRACT 1 SO FILE STRUCTURED =0.
	DAC BBFSIZ	/SET IT IN BUFFER SIZE POINTER.
	.ENDC
	LAC BMODE
	SZA!CLL
	CML
	LAC ABXEXT
	SNL
	LAC BINEXT	/BINARY
	DAC OUTEXT
	.IFUND %RSX
	.ENTER -13,OUTNAM	/.ENTER BINARY OUTPUT DEVICE.
	.ENDC
	.IFDEF %RSX
	LAC (DAT13	/ATTACH OUTPUT BINARY DEVICE.
	DAC OUTNAM-1	/SAVE IT IN THE LUN SLOT.
	JMS ATACH
	CAL ENTCPB	/DO AN ENTER ON -13.
	CAL WFSK	/WAIT FOR THE ENTER TO COMPLETE.
	LAC SKEV
	SMA		/IS IT LEGAL?
	JMP ENTOK	/YES - CONTINUE.
	SAD (-6		/NON-FILE STRUCTURED DEVICE?
	JMP ENTOK	/YES - MUST BE OK.
	JMP IOER13	/(JMW:126)NO - I/O ERROR.
/
ENTOK=.
	.ENDC
	DZM LLBCDE
	LAC L1
	DAC LLWDCT
	DZM BNADDR	/BINARY OUTPUT ADDRESS
	DZM BNWDCT	/BINARY OUTPUT WORD COUNT
	DZM BNCKSM	/BINARY OUTPUT CHECKSUM
	.EJECT
/
/	NOW OUTPUT THE INITIAL INFORMATION ON THE BINARY TAPE.
/	EDIT 090* CODE FROM HERE TO READ1 WAS MOVED FROM THE ROUTINE "PRINT".
/	THE OUTPUT IS DONE HERE TO AVOID SYMBOL TABLE POINTER CONFLICTS THAT EXISTED
/	BEFORE, DEPENDING ON WHAT KIND OF LINE THE FIRST LINE OF THE PROGRAM WAS
/	(THIS INFO WAS NOT OUTPUT BEFORE UNTIL THAT LINE HAD BEEN PROCESSED).
/
	JMS TMODE	/RELOCATABLE PROGRAM?
	JMP READ1	/NO - DON'T BOTHER.
	LAC PRGSZE	/OUTPUT PROGRAM SIZE.
	DAC LLBWRD
	LAC SYMSAV
	SZA
	JMP PFLH4
	LAC LLBWRD
	XOR XCTLIT
	DAC LLBWRD
PFLH4	LAC L1
	DAC LLCODE
	JMS BLDLLB
	LAC L1		/INIT FOR INTERNAL .GLOBLS.
	JMS GIVS	/OUTPUT THE INTERNALS.
	LAC .SEK11	/GET PROGRAM NAME.
	JMS NAMSQZ	/PUT IT INTO RADIX 50.
	.IFDEF %RSX
	LAC .SEK11	/SEE IF AN EXTENSION WAS GIVEN.
	AAC 2
	DAC AUTO10	/SAVE TEMP TO LOOK AT 3 WORD OF FILE NAME.
	LAC* AUTO10	/PICK UP EXTENSION.
	SZA		/IF 0, USE 'SRC'.
	JMP CODE3A	/USE GIVEN EXTENSION.
	LAC (SRCEXT
	JMP CODE3B
CODE3A=.
	.ENDC
	LAC OSWCH	/WANT TO OMIT THE EXTENSION?
	SZA
	JMP NEWLOD	/YES- LEAVE IT OUT.
	LAC .SEK11	/ADDRESS OF NAME FROM .DAT -11.
	AAC 2		/NOW POINT TO EXTENSION.
	.IFDEF %RSX
CODE3B=.
	.ENDC
	JMS SQOZE
	LAC SQZOUT
	JMS LL.OUT
	LAC L33
NEWLOD	LAC XCTLIT
	JMS LL.OUT
	LAC (23
	SET LASW	/OUTPUT NEW LOAD ADDRESS SWITCH.
	.TITLE 	INITIALIZE FOR BOTH PASSES
/
/
READ1	.TVERC			/(RCHM-105) VERIFY TABLE BEFORE EACH PASS.
	.IFDEF %DEBUG		/(RCHM-105)
	DZM MC.CAL		/(RCHM-105) CLEAR ENTRY COUNTERS FOR INFO.
	DZM MC.DEF		/(RCHM-105)
	DZM MC.GC		/(RCHM-105)
	.ENDC			/(RCHM-105)
	LAC (LTABLE	/RESET POINTER TO .LTORG TABLE
	DAC .LTGPT	/TO WORD1 TO GET FIRST LITLOC AREA.
	JMS SETLIT	/SET THE LITERAL COUNTER-POINTER.
	LAC BPMODE
	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
	LAC (BP12T-1
	JMS ZEROIT
	BP12T-EP12T
FNDFIL	LAC PSWCH	/P-OPTION SPECIFIED?
	SNA
	.IFUND %RSX
	JMP SET.M1	/(JMW:102) GO GET THE MAC DEFIN. FILE.
	.ENDC
	.IFDEF %RSX
	JMP SET.14
	.ENDC
	DZM PSWCH
	.IFDEF %RSX
	LAC (DAT10	/DO A HINF TO SEE IF TTY.
	JMS HINFRQ
	DAC TMP		/(JMW:126) CAN ONLY BE TTY OR
	AND L40000	/(JMW:126) FILE STRUCTURED.
	SZA		/(JMW:126)
	JMP RSX.10	/(JMW:126) OK- FILE STRUCTURED.
	LAC TMP		/(JMW:126)
	AND (77		/MASK OFF DEVICE BIT.
	SAD L1		/TTY?
	SKP		/(JMW:126) YES - OK.
	SAD (21)	/ NO, IS IT THE BATCH DEVICE?		/(128)
	SKP		/ YES, OK CONTINUE.			/(128)
	JMP IOERRA	/(JMW:126) NO - NOT ALLOWED.
	JMS PROMPT	/ISSUE PROMPTING MESSAGE,
RSX.10=.		/(JMW:126)
	.ENDC
	LAC (FILE	/FIRST NAME FOR -10
	JMS SETINP	/TERMINAL SUBR.
	.IFDEF %RSX
	LAC (DAT10	/.DAT -10 SETUP.
	.ENDC
	.IFUND %RSX
	LAC L770
SET.M1	.TVERC			/(RCHM-105) VERIFY TABLE BEFORE EACH .DAT -1 READ.
	LAC NOPLIT		/(JMW-102) MOVED FROM HERE TO SET.14 AFTER P-SWITCH.
			/TO AVOID EXCESSIVE VISUAL DELAY.
	DAC MACSW	/SET THE READING MACRO DEFIN. FILE SWITCH.
	LAC MACNMP	/'LAC (MACNAM'
	JMS SETINP	/READ THE FILE.
	.IFUND %BIN
	LAC L37S	/(777 - .DAT-1 IF SYSTEM VERSION.
	.ENDC
	.IFDEF %BIN
	LAC L1		/(RCHM:096) .DAT 1 FOR DDT VERSION.
	.ENDC
	.ENDC
SET.14	LAC FSWCH	/F-OPTION?
	SNA
	JMP SET.11
	DZM FSWCH
	.IFDEF %RSX	/(JMW:126) ONLY DIRECTORIED DEVICES ALLOWED.
	LAC (DAT14	/(JMW:126)
	JMS HINFRQ	/(JMW:126)
	AND L40000	/(JMW:126) FILE STRUCTURED?
	SNA		/(JMW:126) YES - OK.
	JMP IOERRA	/(JMW:126)
	.ENDC		/(JMW:126)
	LAC .SEK14	/ADDRESS OF -14 NAME.
	JMS SETINP
	.IFUND %RSX
	LAC L764
	.ENDC
	.IFDEF %RSX
	LAC (DAT14	/.DAT -14 SETUP.
	.ENDC
SET.11=.			/(JMW:126)
	.IFDEF %RSX	/(JMW:126) ONLY DIRECTORIED DEVICES ALLOWED.
	LAC (DAT11	/(JMW:126)
	JMS HINFRQ	/(JMW:126) SEE IF FILE STRUCTURED.
	AND L40000	/(JMW:126)
	SNA		/(JMW:126) NON-ZERO - OK.
	JMP IOERRA	/(JMW:126)
	.ENDC		/(JMW:126)
	LAC .SEK11	/(JMW:126)NAME ADDRESS.
	JMS SETINP
	.IFUND %RSX
	LAC L767	/CAL -11
	.ENDC
	.IFDEF %RSX
	LAC (DAT11	/.DAT -11 SETUP.
	.ENDC
	.EJECT
/
/CALLING SEQUENCE:
/	(AC=ADDRESS OF FILE NAME)
/	JMS SETINP
/	X		/LAC OF .DAT SLOT #.
/    ** NO RETURN **
/
SETINP	0
	.IFUND %RSX
	DAC SEEKAD	/SAVE NAME ADDRESS.
	.ENDC
	.IFDEF %RSX
	AAC -1
	DAC* L10
	IAC		/RESET POINTER TO FILE NAME.
	.ENDC
	JMS UP6INT
	LAC (PRNAIM
	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
	LAC (64000
	DAC TEXTT
	.IFDEF %RSX
	JMS STSKFL
	SNA		/FILE NAME SPECIFIED?
	LAC SRCEXT	/NO - USE 'SRC' EXTENSION.
	DAC FILEXT
	XCT* SETINP
	DAC CLSLUN
	DAC RDSRLN
	DAC SEKLUN
	JMS ATACH	/ATTACH DEVICE.
	CAL SEEKCB
	JMS WAITSK
	JMP NEWTP1
//
/PROMPT PRINTS PROMPTING MESSAGE FOR PASS 1 PARAMETERS.
/
PROMPT	0
	LAC (DAT10	/ATTACH DEVICE FIRST.
	JMS ATACH
	CAL WRPROM	/WRITE PARAMETER MESSAGE.
	JMP* PROMPT
	.ENDC
	.IFUND %RSX
	XCT* SETINP
	DAC CAL4
	DAC CAL5
	DAC NEWTAP
	DAC CAL6
	DAC DBLBUF+1
	TAD L2000	/READ IN ASCII MODE.
	DAC RDSRC+1
CAL4	.INIT -1,1,PASS1P	/(JMW:099) WORD 1 ALTERED.
CAL5	.SEEK -1,SEEKAD		/(JMW:099) WORDS 1,3 ALTERED.
SEEKAD=.-1
	JMP NEWTP1
MACNAM	.SIXBT /MACDEFMAC/
	.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 %RSX
	.CLOSE -1		/(JMW:099) WORD 1 ALTERED.
	LAC NEWTAP	/WAS THE LAST FILE FROM -10?
	SAD L770
	JMP PREV10
	SAD L764	/WAS IT FROM -14?
	JMP PREV14
	.IFUND %BIN
	SAD L37S	/WAS IT FROM -1?
	.ENDC
	.IFDEF %BIN
	SAD L1			/(RCHM-096) WAS IT FROM 1?
	.ENDC
	JMP PREVM1
	.ENDC
	.IFDEF %RSX
	CAL CLOSCB	/CLOSE LUN SLOTS BECAUSE EOT WAS FOUND.
	LAC CLSLUN	/DETACH THE DEVICE.
	JMS DETHCB
	LAC CLSLUN
	SAD (DAT10	/PARAMETER FILE?
	JMP PREV10	/YES.
	JMP PREV14	/(JMW:126) MUST BE MAIN FILE (Z SWITCH)..
	.ENDC
/
/THE FILE JUST DELIMITED WAS FROM -11. PRINT THE ^P STUFF AND
/WAIT FOR THE OPERATOR TO RESPOND.
/
	.IFUND %RSX	/(JMW:126)
	LAC (SET.11
	.ENDC		/(JMW:126)
SETWAT	DAC POWA
	JMP WAITCP
/
/THE FILE JUST READ WAS FROM -10.  TURN OFF THE EOTSW AND GO GET THE
/ MACRO DEFINITION FILE.
/
PREV10	DZM EOTSW
	DZM PGCTR
	.IFUND %RSX
	JMP SET.M1	/(JMW:102) READ -10 BEFORE -1.
/
/JUST READ IN THE MACRO DEFINITION FILE (.DAT -1 OR +1).
/CLEAR THE EOT SWITCH AND SET THE MACRO TABLE POINTER, IF PASS 1.
/ TEST TO SEE WHAT FILE IS NEXT AND FROM WHAT TYPE OF DEVICE.
/
PREVM1	.TVERC			/(RCHM-105) VERIFY AFTER EACH MACDEF FILE.
	DZM EOTSW		/(RCHM-105) CLEAR EOF SWITCH.
	DZM PGCTR
	LAC SKPLIT	/RESET THE READING MACRO DEF. FILE TO NOT.
	DAC MACSW
	.ENDC
	LAC FSWCH	/IS THE NEXT FILE FROM -14?
	SNA
	JMP NXT.11	/NO, IT'S FROM -11.
	.IFUND %RSX	/(JMW:126) IF RSX, MUST BE BULKY.
	LAC BULK14	/YES..IS -14 BULKY?
	SZA
	JMP SET.14	/YES DON'T WAIT.
	LAC (SET.14
	JMP SETWAT
	.ENDC		/(JMW:126)
	.IFDEF %RSX	/(JMW:126) 
	JMP SET.14	/(JMW:126)
	.ENDC		/(JMW:126)
/
/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
/
/THE NEXT FILE IS FROM -11.
/
NXT.11=.		/(JMW:126)
	.IFUND %RSX	/(JMW:126)
	LAC BULK11	/(JMW:126)
	SZA
	JMP SET.11
	LAC (SET.11
	JMP SETWAT
	.ENDC		/(JMW:126)
	.IFDEF %RSX
	JMP SET.11	/(JMW:126) CAN ONLY BE FILE STRUCTURED.
POWA	0
CTLP	0
	.ENDC
/
/
NEWTP1	DZM CTLP	/SET ^P TO PASS 1
	JMS RDSRC
/
/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
	JMS DBLBUF	/GET NEXT SOURCE LINE
	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 (BST-1
	DZM TAGSW
	JMS ZEROIT	/CLEAR LINE SWITCHES
	BST-EST
	SET NDIL	/NO DATA IN LINE SWITCH.
	LAC DFNSW	/IF THIS IS WITHIN A MACRO DEFINITION
	SZA
	JMP PKMCDF	/AREA, RETURN TO MACRO DEFIN ROUTINE.
	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
	SZA
	DAC ERRORT
	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
	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 PACKSP	/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
	DZM CONCSW		/(RCHM-094) INDICATE NO CONCAT OPERATOR SEEN.
	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
/<086>		CHECK FOR NUMERIC STRINGS WITH >6 DIGITS
SYMSTO	LAC CHAR1
	SNA		/CHECK FOR NUMERIC STRING
	JMP .+4		/NO -- PACK IT
	LAC CHRNUM
	SAD L6		/6 DIGITS ALREADY?
	SET ERRORN	/YES -- ERROR N
/
	JMS SIXP	/SIXBT PACKING
	JMP SYMGET
SYMVAR	SET VARSW
	JMP SYMGET
/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

/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
	TCA
	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
	JMS MODETR	/WHAT OUPUT MODE
	JMP ACCREL	/REL
/
/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
	TCA
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.
	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
/
/*******************************
/*                             *
/*   PSEUDO-OP TABLE           *
/*                             *
/*******************************
/
	JMS SEARCH	/SEARCH PSEUDO-OP TABLE
	LAC POPEND
	LAC POPBEG	/CALLING SEQUENCE
	LAC PACKSP	/'LAC (PACKS'
	2		/
	SKP		/FOUND
	JMP CNVIT	/NOT FOUND
/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?
	SZA		/NO.
	JMP NOPSUO
POPIT	LAC* MRGLOC		/(JMW:099)GET TRANSFER ADDRESS FOR THIS PSEUDO-OP.
	DAC MRGLOC		/(JMW:099)
	SMA			/(JMW:099)BIT 0=1 INDICATES ILLEGAL FOR .CBS.
	JMP POPIT1		/(JMW:099)
	LAC CBSTCH		/(JMW:099)NON-ZERO IF IN .CBS.
	SZA		/(JMW:099)
	JMP OUTERR		/(JMW:099) SET I ERROR AND IGNORE.
POPIT1	LAC MRGLOC		/(JMW:099)
	AND (77777		/(JMW:099)WANT ADDRESS ONLY.
	DAC MRGLOC		/(JMW:099)
	JMP* MRGLOC		/(JMW:099)DISPATCH.
NOPSUO	LAC* MRGLOC
	SAD ENDCOP	/.ENDC
	JMP POPIT	/(JMW:099)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
	SKP		/FOUND
	JMP SPST	/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
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.
	LAC MRGLOC
	AAC -2		/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=.
	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  .
SPSTNX	LAC FLDSW	/IF OP FIELD
	SZA		/SEARCH PERMANENT SYMBOL TABLE
	JMP NOTPST	/BYPASS SEARCH
	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 PACKSP	/'LAC (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 PACKSP	/'LAC (PACKS'
L2	2
	JMP SPSTC	/FOUND
	JMP NOTPST	/NOT FOUND
	LAC MRGLOC
	AAC -1
	DAC MRGLOC	/SUBTRACT 1 FOR 2 WORD SYMBOLS.
SPSTC	JMS CKPFV
	DZM CREL
SPSTB	JMS SYMVAL	/PICK UP SYMBOL VALUE
	.TITLE	CHECK FOR MEMORY REFERENCE INSTRUCTION
/
/
/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
	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 PACKSP	/'LAC (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
	LAC UNDCTR	/IF UNDEFINED, DECREMENT UNDEFINED COUNT
	AAC -1
	DAC UNDCTR	/MARK SYMBOL AS A VARIABLE
	JMP FLGVAR
P1EXT	SAD LACLIT	/CHECK FOR EXTERNAL
	SKP
	JMP RDNTV	/CHECK FOR REDUNDANT VARIABLE
	LAC EXTCTR	/IF EXTERNAL, DECREMENT
	AAC -1
	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 PACKSP	/'LAC (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
	CLC		/RELOCATION AS .LOC OPERAND
	DAC SYMTYP
	JMP OUTPUT
	.EJECT
/CHECK FOR TEXT LINE
/
CKFTXT	LAC TEXTSW
	SNA
	JMP CKLFP
	LAC (TXTBF	/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.
	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=.
	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
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
	.IFUND %RSX		/(JMW:125) RSX ALLOWS INDEXED CALS.
	LAC INDXSW
	DAC ERRORX
	.ENDC			/(JMW:125)
	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.
	LAC INDXSW	/CHECK FOR INDEX REGISTER.
	DAC ERRORX
	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
	LAC NINEOP	/CHECK FOR LAW ON 9-BIT OP.
	SZA		/NO-CHECK FOR LAW
	JMP CKFER-1	/CHECK 9-BIT ADDRESS
	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
	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
ANDXOR	0
/
/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
	AAC -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=.
	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
	LAC USTSZE		/DON'T COUNT LITS AS USER SYMBOLS
	AAC -1
	DAC USTSZE
	JMP* MLITER
LITBEG	0
	LAC LITCTR
	TCA
	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=.
	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.
	TCA
	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
	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
	DZM INDXSW
	SET PCIMAG	/USE AS FLAG FOR AAX (12
	JMP WRDEVL+2
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
	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?
	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
	.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
/
/
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
/
/
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
	JMS TMODE	/BUILD LOCATION TYPE.
	JMP TLOCR+1	/FULL OR ABS =3 SPACES.
	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.
	JMS TMODE
	JMP NABS+1
	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 (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.
/
	LAW EFLGN	/THE NUMBER OF FLAGS.
	DAC CTR
	LAW -4		/PRINT FIVE CHARS (SPACES OR FLAGS).
	DAC CTRMX5
	LAC LL101	/FIRST ERROR FLAG IMAGE.
	DAC OUTFLG
	LAC (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
	LAC CTRMX5	/OUTPUT FILLER SPACES.
	JMS SPACKS
	JMP* SEQERF
OUT3EX	0
	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
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
L103	103	/C
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.
	125	/U
	127	/W
L130	130	/X
	131	/Y
L117	117	/-O- INSTEAD OF F.
/
/
/ 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=.
	.IFUND %RSX
	XCT MACSW	/DON'T COUNT LINES IF READING MACRO
	JMP SHRK	/ DEFINITION FILE.
	.ENDC
	LAC TSWCH	/TABLE OF CONTENT?
	SZA
	JMP T.OUT
	XCT PASSNO	/WHICH PASS1
	JMP SHRK
T.OUT	LAC (PRTBUF	/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.
/***
	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
	JMS BLDBIN	/BUILD BINARY OUTPUT
	DZM BSSW
	JMP CKMWD
INCPC2	LAC LOCSW	/CHECK FOR .LOC
	SNA
	JMP INCPC1
	ISZ LASW
	JMS CKFLLB	/LINK LOADER RTNE
	JMS BLDBIN	/BUILD BINARY OUTPUT
	DZM LOCSW
	JMP CKMWD
INCPC1	LAC PASW	/IS LINE A P/A
	SZA		/NO
	JMP CKMWD	/YES
	JMS CKFLLB
	JMS BLDBIN
	ISZ PC		/UPDATE PC BY 1
	LAC TEXTSW	/TEXT SWITCH ON
	SNA		/YES
	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
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
	DZM RPTSW	/RESET SWITCH
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
	SAD XREG
	SKP
	JMP NXTCK1	/OK CONTINUE PROCESSING TAG.
TAGERR	SET ERRORT	/TAG ERROR.
	JMP OUTPUT	/IGNORE TAG.
NXTCK1	LAC CBSTCH	/(JMW:099) TAGS AND PARAMETER ASSIGNMENTS NOT ALLOWED
	SZA		/(JMW:099) IN BLOCK DATA COMMON DECLARATIONS.
	JMP TAGERR	/(JMW:099)
	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 PACKTP	/'LAC (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
	LAC UNDCTR	/CHANGE TO LOCAL
	AAC -1
	DAC UNDCTR
	JMP INMRG	/MERGE IN NEW VALUES
CKVRT	SPA
	JMP CKVART
	LAC EXTCTR	/VIRTUAL IN TABLE TO INTERNAL
	AAC -1
	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
	LAC VARCTR	/SUBTRACT FROM VARIABLE COUNT
	AAC -1
	DAC VARCTR
	LAC SQZOUT+2
	AND L57S
	XOR LACLIT	/SET MULTIPLE DEFINITION
	DAC SQZOUT+2
	LAC PACKTP	/'LAC (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 PACKTP	/'LAC (PACKT'
	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
	AAC 2
	DAC TMP
	LAC* TMP
	AND JMSLIT
	SZA		/IS ENTRY A MACRO
	IDX CKMAC	/YES
	JMP* CKMAC	/NO
	.TITLE PSEUDO-OP ROUTINES
	.TITLE 	LST,NILST,OCT,DEC,LOC,LOCAL,BLOCK,DSA,SIZE
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.=.
	LAC ISWCH	/IGNORE EJECTS?
	SNA
	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.
	JMS TABORT	/(JMW:103) BE SURE ROOM FOR AT LEAST CONTROL WORDS.
	LAC ENDUMT
	DAC LOCLSV	/(JMW:103)NEED TRUE START FOR GARBAGE COLLECTOR.
	AAC 1		/(JMW:103)
	DAC TMP		/(JMW:103)
	AAC 1		/(JMW:103)
	DZM* LOCLSV	/(JMW:103)WILL BE COUNT OF TOTAL WORDS IN LUST.
	DZM* TMP	/(JMW:103)TREATED SAME AS R/A BY GARBAGE COLLECTOR.
	DAC TOPLUS
	DAC BOTLUS
	SET PATLSW	/(JMW:106)
	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
	DZM LOCLSV	/(JMW:103)
	DZM PATLSW	/(JMW:106)
	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
GLOBL=.
	JMS TMODE	/RELOCATABLE BINARY?
	JMP OUTERR	/NO - ERROR.
GETGLB	JMS ARGMNT
	JMP PRPOP	/NO ARGUMENT - IGNORE.
	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
	AAC 2
	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
	LAC* MRGLOC
	AND L557S	/(577777)
	XOR LACLIT
	DAC* MRGLOC
TGBEND	JMS TKOM		/IF NO COMMA, DONE.
	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
	LAC UNDCTR	/SUB 1 FROM UND. COUNT.
	AAC -1
	DAC UNDCTR
	JMP* TSTUND
	.TITLE		.EOT, .ENDC
EOT	JMS PRTCOM
	SET EOTSW
	LAC BNOPTN	/BINARY REQUESTED
	SZA		/NO
	JMS WAIT13	/.WAIT FOR BINARY OUTPUT DEVICE.
	.IFUND %RSX
	XCT MACSW	/DON'T PRINT AN EOT ON TTY IF READING MACRO
	JMP NEWTAP	/ DEF. FILE
	LAC NEWTAP	/ OR IF INPUT IS FROM -14 BULKY.
	SAD L764
	SKP
	JMP EOTOUT
	LAC BULK14
	SZA
	JMP NEWTAP
EOTOUT	LAC (EOTMSG-2
	JMS WRITE3
	.ENDC
	JMP NEWTAP
	.IFUND %RSX
EOTMSG	.ASCII	/ EOT/<15>
	.ENDC
LITNO	472360		/'NO'
/
ENDC	LAC CNTIFS	/COUNT OF .IFS OUTSTANDING.
	SNA
	JMP CNTEND	/THIS .ENDC HAS NO CORRESPONDING .IF.
	CLC
	TAD CNTIFS	/SUBTRACT ONE FOR COUNT
	DAC CNTIFS
	LAC CONDSW	/ANY UNSATISFIED IFS OUTSTANDING?
	SNA		/YES
	JMP PRPOP	/IGNORE.
	ISZ IFCTR	/.IF COUNT SATISFIED
	JMP PRPOP	/NO
	JMS POPPR
	DZM CONDSW	/RESET CONDITIONAL SWITCH
	JMP CKMWD1
CNTEND	SET ERRORC	/SET C ERROR ON LINE,
	JMP PRPOP	/AND IGNORE LINE.
	.TITLE		.LTORG PSEUDO-OP
/
/
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.
/
	TCA
	DAC P657
	LAC TSWCH	/WAS THE TABLE ASKED FOR?
	SNA		/YES IF NON 0.
	JMP END.TS	/NO ..PUT LIT CNT IN AC.
	LAC .NLSW	/(JMW:100) .NOLST ON?
	SZA		/(JMW:100)
	JMP END.TS	/(JMW:100) YES - DON'T COUNT.
FAKLIT	ISZ LNCTR	/COUNT THE LITERALS.
	JMP INCP65	/NO OVERFLOW. COUNT LITS.
	ISZ PGCTR	/LINE COUNT OVERFLOWED.
	LAC LM65	/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
	AAC 1
	DAC TMPI
	LAC* .LTGPT
	DAC LITLOC
	LAC* TMPI
	DAC MAXLIT
	JMP* SETLIT
	.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 (TXTBF	/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 (TXTBF-1	/CLEAR OUT THE TEXT BUFFER.
	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 (TXTOP+1	/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 (TXTBF	/BEEN PACKED?
	JMP TXTASC	/NO..SET UP 0 TEXT COUNT
	AAC -1
	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.
	AAC -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 (TXTBF-1
	TCA
	XCT* TXTGNM
	TCA
	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=.
	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 (26
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.
/
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
	TCA
	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
/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
	TCA
	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
/ON EXIT: IF NUMERIC: BINARY NUMBER IN AC & "NUMBR";
/	IF ALPHA: ALPHA STRING IN "PACKS" AND "PACKS+1".
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.
	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
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		.CBC- INITIALIZE BLOCK COMMON DATA
/
/
/THE MACRO ASSEMBLER PSUEDO-OP .CBC (INITIALIZE BLOCK COMMON DATA) ALLOWS
/ THE USER TO INITIALIZE DATA WITHIN A BLOCK COMMON AREA.  IT
/ IS VALID ONLY IF THE .CBE. PSEUDO-OP HAS BEEN GIVEN.
/
/FORMAT:	.CBC ADDR,VALUE
/			  WHERE ADDR AND VALUE ARE ANY ABSOLUTE EXPRESSIONS.
/
/THE LOCATION AT RELATIVE OFFSET ADDR IN THE COMMON BLOCK IDENTIFIED BY THE PREDEEDING
/ .CBS PSEUDO-OP IS INITIALIZED TO VALUE.  A SYMBOL IN THE LABEL FIELD IS
/ MEANINGLESS AND WILL CAUSE THE LINE TO BE IGNORED AND AN ERROR GENERATED.
/
	/
CBC	LAC PACKT		/TAG ON LINE?
	SNA!CLA			/YES IF NON-ZERO - ILLEGAL.
	LAC CBSTCH		/ILLEGAL IF NO .CBS RECEIVED.
	SNA
	JMP OUTERR		/IGNORE LINE.
	JMS ARGMNT		/GET THE ADDRESS.
	JMP OUTERR		/NO ARGS - ILLEGAL.
	SKP			/GOT A NUMERIC ARG.
	JMP OUTERR		/NO SYMBOLS ALLOWED.
	DAC CKPC0		/TEMP STORE OF OFFSET.
	JMS CKSPTB		/CHECK FOR LEGAL DELIMITER.
	JMP CBCOK		/SPACE OR TAB.
	SAD KOMMA		/COMMA LEGAL, TOO.
	SKP
	JMP OUTERR		/ILLEGAL DELIMINATOR.
CBCOK	JMS ARGMNT		/NOW GET THE VALUE.
	JMP OUTERR
	JMP CBCOUT		/NUMERIC
	JMS PSALPH		/ALPHA - GET NUMERIC.
	DZM NUMBR		/UNDEFINED - USE ZERO.
CBCOUT	LAC CKPC0		/OUTPUT OFFSET.
	JMS LL.OUT
	LAC L2			/LOADER CODE OF 2.
	LAC NUMBR
	JMS LL.OUT
	LAC (4
	JMP PRPOP
	.TITLE 	.CBD,.CBDR: 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 PACKSP	/'LAC (PACKS'
	JMS NAMSQZ	/OUTPUT THE NAME
	JMS ARGMNT	/GET SIZE NEXT
	JMP OUTERR	/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
CDBROT	JMS LL.OUT
	LAC L15
	LAC PC
	JMS LL.OUT
	LAC (16
	DZM WRDVAL
	DZM AREL	/NO RELOCATION
	JMP CKFTG
/
/EDIT 109 - INSERT CBDR CODE.
/
/THE MACRO PSEUDO-OP .CBDR (COMMON BLOCK DEFINITION RELATIVE) ALLOWS THE PROGRAMMER
/ TO DECLARE A VECTOR TO A LOCATION IN COMMON OTHER THAN THE COMMON BASE.
/
/THE .CBDR PSEUDO-OP TAKES AN OFFSET AS AN ARGUMENT, RESERVES ONE WORD OF CORE,
/ AND OUTPUTS LOADER CODES AND PARAMETERS WHICH DIRECT THE LOADER TO SET A VECTOR TO THE
/ BASE+OFFSET WORD OF THE LAST COMMON DEFINED IN A .CBD PSEUDO-OP.
/ FOR EXAMPLE, THE STATEMENTS:
/		BASE	.CBD ABCD 6
/		ABCD5	.CBDR 4
/		XYZ3	.CBD XYZ 5 
/
/ WILL PROVIDE THE BASE ADDRESS OF COMMON /ABCD/ IN THE WORD LABELED 'BASE', WILL
/ PROVIDE THE ADDRESS OF WORD 5 OF COMMON /ABCD/ (BASE ADDRESS + 4) IN THE WORD LABELED
/ ABCD5, AND WILL PROVIDE THE ADDRESS OF WORD 3 OF COMMON /XYZ/ IN THE WORD
/ LABELED 'XYZ3'.
/
/NOTE THAT .CBDR IS RELATIVE TO THE LAST COMMON DEFINITION, AND THAT NO INTERVENING
/ .CBD PSEUDO-OPS ARE ALLOWED.  ANY OTHER MACRO INSTRUCTIONS OR PSEUDO-OPS MAY
/ INTERVENE.
/
/IF THE OFFSET IS MISSING, ZERO IS ASSUMED.
/
CBDR	JMS ARGMNT	/GET OFFSET, IF ANY.
	JMP CBDR1	/NO OFFSET - ASSUME 0.
	JMP CBDR2	/NUMERIC ARG.
	JMS PSALPH	/ALPHA ARG - GET VALUE.
CBDR1	CLA!SKP		/SYMBOL NOT FOUND - ASSUME 0.
CBDR2	LAC NUMBR
	JMP CDBROT
	.TITLE		.CBE - LEAVE BLOCK DATA INITIALIZATION MODE
/
/
/.CBE TAKES THE ASSEMBLER OUT OF BLOCK DATA INITIALIZATION MODE AND RETURNS IT 
/ TO NORMAL OPERATION.
/
/FORMAT:	.CBE
/
/
CBE	LAC CBSTCH	/MUST BE IN BLOCK DATA INITIALIZATION CODE TO LEAVE IT!!
	DZM CBSTCH	/(JMW:099) INDICATE HAVE END.
	SNA!CLA		/NOTE THAT AC MUST BE 0 FOR 'LL.OUT'.
	JMP CNTEND	/SET C ERROR AND IGNORE.
	JMS LL.OUT	/FIRST WORD: CODE 7, 0.
	LAC L7
	LAC (310000	/SECOND WORD: CODE 34, 310000.
	JMS LL.OUT
	LAC (34
	LAC PC		/THIRD WORD: CODE 2,PC.
	JMS LL.OUT
	LAC L2
	JMP PRPOP
	.TITLE		.CBS - ENTER BLOCK DATA INITIALIZATIN MODE.
/
/
/THIS PSEUDO-OP PLACES THE ASSEMBLER IN COMMON BLOCK INITIALIZATION MODE, ENABLING
/ SELECTED PORTIONS OF THE IDENTIFIED COMMON BLOCK TO BE INITIALIZED.
/
/FORMAT:	.CBS NAME(,SIZE)
/		WHERE 'NAME' IS THE COMMON NAME;
/	(OPTIONAL) 'SIZE' IS THE MINIMUM SIZE OF THE BLOCK.
/
/
CBS	LAC PACKT		/TAG??  ILLEGAL.
	TAD CBSTCH		/CAN'T NEST THESE THINGS.
	SZA			/NO -OK TO GO ON.
	JMP OUTERR		/YES -ILLEGAL.
	JMS ARGMNT
	JMP OUTERR		/NO ARG - ILLEGAL.
	JMP OUTERR		/NUMERIC ARG NOT ALLOWED.
	JMS CKSPTB		/TERMINATED WITH SPACE IR TAB.
	JMP CDSOK		/YES.
	SAD KOMMA		/COMMA OK TOO
	JMP CDSOK
	JMS CKSCR		/NOT NECESSARY TO SPECIFY SIZE.
	SKP
	JMP OUTERR
CDSOK	LAC PACKSP		/OUTPUT COMMON NAME.('LAC (PACKS')
	JMS NAMSQZ
	JMS ARGMNT		/GET SIZE, IF ANY.
	JMP CDS1		/(JMW;100) NO SIZE GIVEN.
	JMP CDW1		/(JMW:100) NUMERIC ARG (NUMBER IN AC).
	JMS PSALPH		/ALPHA
	JMP CDS1		/(JMW:100) NOT FOUND - DON'T OUTPUT FIRST WORD.
CDW1	JMS LL.OUT		/(JMW:100) WORD 1: SIZE (IN AC NOW), CODE 1.
	LAC L1
CDS1	LAC (100422		/WORD 2: CODE 34, 100422 (POTENTIALLY WORD 1).
	JMS LL.OUT
	LAC (34
	SET CBSTCH		/INDICATE .CBS HAS BEEN RECEIVED.
	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
/
ABS=.
	LAC K10000		/PDP-9 MODE (13-BIT ADDRESSING)
	DAC PDP9SW
	SKP
ABSP	DZM PDP9SW		/PDP-15 MODE (12-BIT ADDRESSING)
	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
	JMS ABSLOD
	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).
OUTERR	SET ERRORI		/SET I ERROR FLAG.
	JMS SCNEND		/IGNORE REST OF LINE, IF ANY.
	DZM ERRORQ		/MAY HAVE BEEN SET - NOT RELEVANT HERE.
	JMP PRPOP		/IGNORE THIS PSUEDO OP.
.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.
/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.
	SZA
	JMP .+3
	LAC DBALIT
	SKP
	LAC EBALIT
	DAC LODMOD
	JMP* CKPC0
	.TITLE 	PUNCH THE .ABS LOADER.
/
/PUNCH THE .ABS LOADER
PNCHLD=.
	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
	.WRITE -13,4,BINLDR,0
	.LOC .-1
	ENDLDR-BINLDR\777777+1
	.WRITE -13,3,HRMWD,6
	.ENDC
	.IFDEF %RSX
	CAL WRDPMD	/WRITE DUMP MODE.
	CAL WRHRI	/WRITE HRM.
	.ENDC
	JMP PRPOP	/PRINT PSEUDO OP.
ABXEXT	.SIXBT /ABS/
	.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		/(JMW:098) CHANGE LOCATION OF 'IFC'
IFA	DAC CNDTN
	LAC KON001	/PICK UP VALUE
IFC	DAC VALDEF
	SET CNTIFS	/COUNT IF FOR LATER .ENDC MATCH.
	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=.
	LAW -62		/PACH UP TO 50(10) CHARS.
	DAC TITCNT
	LAC (TEXTT
	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
	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		/IF SET, JUST OUTPUT ".NOLST" BUT
	SZA			/ DON'T WANT TO OUTPUT SUBSEQUENT LINES.
	DZM ALOPTN		/THE LISTING SWITCH.
	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=.
	.IFUND %RSX
	XCT MACSW	/PROCESSING MACRO DEFINITION FILE?
	JMP* PRTCOM	/YES - LEAVE.
	.ENDC
	LAC (RDBUF-6		/POINT PACK ROUTINES TO RDBUF-6.
	JMS SEQERF
	JMS P57TAB	/2 TABS TO RDBUF
	JMS P57TAB
	LAW -5
	JMS SPACKS
	JMS OUT3EX
	JMS SHRINK
	TAD (RDBUF-7
	JMP* PRTCOM
POPPR	0
	JMS SCNEND
	JMS PRTCOM
	JMP* POPPR
	.TITLE		*.END*--END OF PASS CODE.
/
END=.
	.IFUND %RSX
CAL6	.CLOSE -1		/(JMW:099) WORD 1 ALTERED.
	.ENDC
	.IFDEF %RSX
	CAL CLOSCB	/CLOSE INPUT DEVICE.
	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 
	SPA
	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
	DAC* .LTGPT	 /LITERALS STARTING LOCATION
	IDX .LTGPT	/POINT TO WORD2 OF .LTORG TABLE
	TAD LITCTR
	DAC PRGSZE 	/PROGRAM SIZE
	LAC LITCTR
	DAC* .LTGPT
	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 
	TCA		/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 UNSQZP	/UNSQZV-1 TO THE
	LAC (TXTBF	/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
	TXTBF-1
L3	3
	LAC USTBEG	/RESTORE USTBEG: C(USTBEG)=C(USTOEG)-2
	AAC -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
	JMS USTB2
	INC USTBEG
	JMP CVA
	.TITLE 	*P1CMPL*--END OF PASS1 CODE.
/
P1CMPL=.
	.IFDEF %RSX
	LAC VERPNT	/PRINT PASS 1 MESSAGE?
	SNA
	JMP P3CMPL	/NO.
	.ENDC
	LAC (ENDPAS-2
	JMS WRITE3
	.IFDEF %RSX
P3CMPL=.
	.ENDC
	LAC (PASS2
	DAC POWA
	.IFUND %RSX		/(JMW:126) ONLY BULKY IN RSX.
	LAC FSWCH	/ONLY SET HERE IF Z SWITCH SPECIFIED.
	SNA
	JMP TRY.11
	LAC BULK14
	SNA
	JMP WAITCP
TRY.11	LAC EOTSW	/EOT ENCOUNTERED IN PROGRAM
	SZA
	JMP WAITCP	/WAIT FOR CONTROL P
	LAC BULK11	/IF BULK STORAGE DEVICE
	SZA
	.ENDC			/(JMW:126)
	JMP* POWA	/CONTINUE, ELSE WAIT FOR
WAITCP=.
	.IFUND %RSX
	LAC* (%BOSS
	SMA
	JMP WRCTP
	AND (757777	/GUARANTEE THIS TYPOUT.
	XOR L20000
	DAC* (%BOSS
	.ENDC
WRCTP=.
	.IFUND %RSX		/(JMW:126)
	LAC (PS1MSG-2	/WRITE ^P
	JMS WRITE3
	NOP
	JMP .-1		/WAIT FOR ^P
	.ENDC
	.IFDEF %RSX
	CAL TTRDCB
	JMS WAITFR
	LAC RDBUF+2	/PICK UP THE ANSWER.
	AND (774000
	SAD (20000	/CTRL D?
	JMP* EXIT	/YES.
	JMP WAITCP
	.ENDC
	.IFUND %RSX
PS1MSG	.ASCII	/^P/<175>
	.LOC .-1
	.ENDC
L557S	577777
	.IFDEF %RSX
	ENDPS2-ENDPAS+2/2*1000+2
	0
ENDPAS	.ASCII /MAC-END OF PASS 1/<15>
	.ENDC
	.IFUND %RSX
ENDPAS	.ASCII	/ END OF PASS 1/<15>
WRNMES	.ASCII	<12>/PROG/<76>/4K/<15>
	.ENDC
/*****END OF PASS 2****
ENDPS2	SET ENDSW
	DZM ENDVAL
	DZM FLDVAL
	LAC CBSTCH		/LOOKING FOR ERROR IN MISMATCH OF:
	TAD CNTIFS		/.CBS,.CBE; .IF,.ENDC;
	TAD DFNCTR		/.DEFIN,.ENDM.
	SZA
	SET ERRORY
	JMS TSTC15
	JMP ENDLNE
	JMP SCNADR+1 	/GET OPERAND VALUE
PREL	0
	SET STOPPER
	LAC (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
	TCA
	DAC CTR1
	SET LITSW
	SET EXLTSW
	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
	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
	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
	TCA
	DAC CTR1
	SET EXTSW	/SET EXTERNA SWITCH
	SET EXLTSW
	JMS TMODE
	JMP .+3
	JMS NEWLA	/OUTPUT NEW LOAD ADDRESS
	SKP
	JMS BLDBIN
NXEXT	JMS PREL	 /GO TO PRINT ROUTINE
	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
	SKP
ABSEXT	JMS BLDBIN	/BUILD BINARY OUTPUT
	IDX PC
	IDX WRDVAL
	ISZ CTR1
	JMP NXEXT 	/GET NEXT EXTERNAL
	JMS TMODE	/ABS OR REL
	JMP LITOUT-1	/ABS NO SYMBOLS
	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.
/
	DZM ESWCH
	.IFUND %RSX
	JMS TMODE	/DON'T CHECK THE SIZE IF ITS
	JMP SIZEOK	/A NON-RELOCATABLE PROGRAM.
	LAC PRGSZE	/HIGHEST LOCATION USED.
	AND (70000
	SNA		/IS IT .GT. 4K??
	JMP SIZEOK	/NO SKIP WARNING.
	LAC BPMODE	/NO ..IS IT A BANK MODE SYSTEM??
	SZA		/NO IF 0.
	JMP SIZEOK
	LAC (WRNMES-2
	JMS WRITE3
	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.
	WRNMES-1
L6	6
	LAC ERLNCT
	AAC -1
	DAC ERLNCT	/WAS INCREMENTED AT PRTSOH.
	.ENDC
/BUILD THE LAST IMAGE LINE.
/THE SIZE (HIGHEST LOCATION) OF THE PROGRAM AND THE
/ERROR LINE COUNT ARE NEXT.
/
SIZEOK	LAC (PSIZEE	/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 DECO2P	/'LAC (DECOUT+2'
	LAC (ERNMBR
ERRS2=.
	.IFDEF %RSX
	LAC VERPNT	/NEED TO PRINT?
	SNA
	JMP EROUTP	/NO - NO OUTPUT TO TTY.
	.ENDC
	LAC (ERRLIN
	JMS WRITE3
	.IFUND %RSX
	LAC* (%BOSS)	/(RKB-111) IF IN BOSS MODE,
	SPA		/(RKB-111)  SECOND MESSAGE ON THE PRINTER.
	JMP ERRS3	/(RKB-111)
	LAC MOD3A+1	/TEST FOR SAME OUTPUT DEVICE.
	SAD L42
	.ENDC
	JMP ERRS3
EROUTP=.
	XCT SET1ST	/IS THIS THE FIRST LINE
	JMP ERRS3	/FOR DAT -12? IF YES IGNORE.
	JMS PRTSOH
	ERRLIN-1
L175	175		/ALTMODE (USED AS CONSTANT)
ERRS3	SET ENDSW
	LAC BNOPTN	/BINARY REQUESTED
	SNA		/YES
	JMP ANPST
	JMS MODETR
	JMP ANPST 	/REL
	JMS BLDBIN
	DZM ENDSW
	JMS WAIT13	/WAIT FOR PUNCH
	LAC BMODE
	SAD L1
	JMP ABSEND 	/ABS OUTPUT
	LAC ENDVAL 	/FULL OUTPUT
	AND L147S	/13 BIT ADDRESS
	SZA
	JMP FULL1
	LAC HLTLIT
	SKP
FULL1	XOR JMPLIT
	DAC ENDVAL
	LAC (ENDVAL
	JMS UP6INT
	LAC (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
	.WRITE -13,3,FULHRW,6	/(JMW:099) WRITE THE HRI WORD.
	.ENDC
	.IFDEF %RSX
	CAL WRFHW	/WRITE FULL HRM.
	.ENDC
	JMP ANPST
FULHRW	003500
ALPCIN	0		/USE AS TEMP STORAGE
LCOUNT	0
CHAR1	0
FLGPTR=.		/TEMP FOR ERROR FLAG OUTPUT ROUTINE.
LKAHED	0
PRVCHR	0
/
ABSEND	LAC ENDVAL
	SNA!CLC
	DAC ENDVAL
	JMS NULFRM
	.IFUND %RSX
	.WRITE -13,4,ENDVAL,2	/(JMW:099) PUNCH DUMP MODE.
	.ENDC
	.IFDEF %RSX
	CAL WRPDM	/PUNCH DUMP MODE.
	.ENDC
	.TITLE 	SYM TABL OUTPUT ALPHA SEQ.
/
/ALPHA AND NUMERIC PRINTOUT OF SYMBOL TABLE
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=.
	JMS TMODE
	JMP ALFNXA
	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
	JMS TMODE	/WHAT TYPE OUTPUT
	JMP ALFNXC
	LAC ENDVAL	/.END VALUE
	AND L57S	/15 BIT
	JMS LL.OUT
	LAC L27		/END CODE
ALFNXC	JMS WAIT13	/WAIT FOR BINARY.
	.IFUND %RSX
	.CLOSE -13	/(JMW:099) CLOSE BINARY.
	.ENDC
	.IFDEF %RSX
	CAL CLOS13	/CLOSE BINARY FILE.
	JMS WAIT13
	LAC (DAT13
	JMS DETHCB	/DETACH THE OUTPUT DEVICE.
	.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
	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
	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
	.CLOSE -12	/(JMW:099) CLOSE LISTING.
	.ENDC
	.IFDEF %RSX
	CAL CLOS12	/CLOSE THE OUTPUT LISTING DEVICE.
	LAC (DAT12
	JMS DETHCB	/DETACH IT.
	.ENDC
NOCLOS=.
/************ END OF ASSEMBLY ************
	LAC BATCH	/MORE ASSEMBLES
	SZA		/NO.
	.IFUND %RSX
	JMP PASS1	/YES.
	.ENDC
	.IFDEF %RSX
	JMP MACR15+1
	JMP* EXIT
	.ENDC
	.IFUND %RSX
CLOSE3	.CLOSE -3	/(JMW:099)
EXIT	.EXIT	/(JMW:099)
	.ENDC
	.TITLE 	CREF SETUP AND LOAD
XSETUP=.
	.IFUND %RSX
	LAC MACTBL	/(JMW:106) PASS ARGS AT BOTTOM OF FREE CORE.
	DAC* L11
	AND L64Z	/(60000)
	DAC TMP
	LAC SAVEF	/DOES PASS3 HAVE TO CREF Z-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.
	LAC (FSWCH
	JMS SET10
	LAW -10		/MOVE IN 10(8) ARGS
	JMS MOVAUT
	.WAIT -3
	.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
	.WAIT -12
	.IFUND %BIN
/OVERLAY CAL TO BRING IN CREF.
/
/
	.OVRLA CREF
	JMP PASS1
CREF	.SIXBT /CREF/
	.ENDC
	.IFDEF %BIN	/(JMW:106) MAKE CREF A SUBROUTINE FOR MACRO UNDER DDT.
	JMS* CREF	/(JMW:106)
	JMP PASS1	/)JMW:106)
	.ENDC
	.ENDC
	.IFDEF %RSX
	JMS WAIT12	/WAIT FOR LISTING DEVICE.
	LAC FILNMS	/MOVE THE FILE NAMES FOR CREF INTO THE RESIDENT AREA.
	AAC -1
	DAC* L11
	LAC .SEK14	/MOVE BOTH NAMES.
	JMS SET10
	LAW -6
	JMS MOVAUT
	LAC (FSWCH	/MOVE THE REST OF THE PARAMETERS.
	JMS SET10
	LAW -12		/(JMW:113)
	JMS MOVAUT
	JMP* MACR15	/RETURN TO RESIDENT CODE TO DISPATCH TO CREF.
	.ENDC
	.TITLE	.END MESSAGES AND UTILITIES
	.IFDEF %RSX
	LRCR-ERRLIN+2/1000*2+2	/(JMW:119)
	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
	AAC 1
	DAC SWD2
	AAC 1
	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 UNSQZP	/'LAC (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
	JMS TMODE 	/BY PASS ADDRESS TYPE IF NON-RELOC ASSEMBLY.
	JMP BPACK	/ABSOLUTE.
	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 (PRTBUF
	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 (PRTBUF-1
	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
	SKP		/FOUND.
	IDX CKEST
	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	AAC -33
	SMA
	JMP ASCVB
	LAC TMP 	/A-Z
	XOR L100
	JMP ASCVD
ASCVB	LAC TMP
	AAC -35
	SPA
	JMP ASCVC
	LAC TMP 	/0-9
	AAC 23
	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 (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
LTABLE	0
	.REPT 17
	0
	0		/EXTRA FOR IMPLIED .LTORG AT END
	0		/OF PASS1.
	.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
CNTIFS	0		/COUNT OF .IFS FOR MATCH WITH .ENDCS.
LORGCT	0		/.LTORG COUNT
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
CBSTCH	0		/NON-ZERO IF IN .CBS BLOCK.
HOLES	0		/(JMW:103) NON-ZERO IF UNUSED ROON IN MACRO DEFIN TABLE.
LOCLSV	0		/(JMW:103) ADDR OF 1ST ENTRY IN LUST.
PATLSW	0		/(JMW:106) NON-ZERO IF BUILDING ENTRIES IN MACRO DEFIN TABLE.
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
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 (I.E. FOUND #).
LOCSW	0		/.LOC SWITCH
NINEOP	0
INDXSW	0		/INDEX REGISTER SWITCH.
PDP9SW	0		/TEMP DIRECT ADDRESS SWITCH.
CONCSW	0			/(RCHM-094) (CONC)ENATION OPERATOR (SW)ITCH.
				/(RCHM-094)  0 => NO CONCENTATION OPERATOR SEEN.
				/(RCHM-094)  NON-0 => CONCENATION OPERATOR SEEN.
EST=.
	.TITLE SOME UTILITY SUBROUTINES
/
/INITIALIZE 5/7 UNPACKING TO BEGINNING OF LINE BUFFER
/
UPBLB	0
	LAC (RDBUF+2
	DAC UPKAD	/UNPACKING LOCATION
	LAC L1
	DAC PKNUM	/PACKING NUMBER
	JMP* UPBLB
/
/LOCATION ZEROING SUBROUTINE
/
/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
/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
	DZM MACSIZ	/(JMW:103) ENTRY OF THIS MACRO DEFIN=0.
	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
	AAC -1
	DAC* L10
	JMP* SET10
/
/
SET11	0
	AAC -3
	DAC* L11
	JMP* SET11
/
/INCREMENT AUTO INDEX IO TWICE INDIRECTLY.
INCL10	0
	IDX* L10
	IDX* L10
	JMP* INCL10
/
/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
/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)
	41	/! (11)
	134	/ (12)
L56	56	/. (13)
L45	45	/% (14)
L12	12	/LF (15)
L14	14	/FF (16)
	13	/VT (17)
	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.
/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
/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
	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
/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
/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.
/
ABSCNT=.		/
MP1	0
MP2	0
DLMTR=.		/DELIMITER IN TEXT ROUTINES.
MP3	0
ANGLVL=.		/ANGLE BRACKET EVALUATOR.
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
	TCA
	DAC DVS
	ISZ DIVIDE	/INCREMENT TO EXIT ADDRESS
	SNA!CMA			/(RCHM-092) A/0 IS EQUIVALENT TO A/1 (SEE MANUAL).
	DAC DVS			/(RCHM-092) SET UP FOR DIVISION BY 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
/
DV1=.		/TEMP FOR 'DIVIDE' ROUTINE.
NUMEVL	0
	DZM NUMBR	/WHERE RESULTS WILL BE
	LAC CHRNUM
	SNA
	JMP* NUMEVL	/NUMBER IS 0
	AAC -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
	AAC -70		/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
/
DVS=.		/TEMP FOR 'DIVIDE' ROUTINE.
INTUPN	0
	LAC CHRNUM
	TCA
	DAC CTR
	LAC PACKSP	/'LAC (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 SQZOTP	/'LAC (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
	IDX MACSIZ	/(JMW:103) NEED TO KNOW # WORDS IF MACRO DEFIN.
	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
	IDX MACSIZ	/(JMW:103)
	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
	LAC* BNOCT	/LOCATION OF CHAR.
	DAC TT2-1
	LAC (JMP BN2
	TAD CTR
	DAC TT2		/GET CHARACTER POSITION
	XX		/PICK UP THE 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.
	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
	LAC CONDSW	/UNDEFINED CONDITIONAL?
	SNA
	JMP NOTCON	/NOT UNDEF COND.
	LAC CSWCH
	SZA
	JMP* PRINT
NOTCON	LAC EXPSW	/IN MACRO EXPANSION
	SNA
	JMP TSTRPT
/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	LAC .NLSW	/(JMW:100) .NOLST ON?
	SZA		/(JMW:100)
	JMP SKIPFF	/(JMW:100) YES - DON'T COUNT LINE FOR FF.
	ISZ LNCTR	/60 LINES PRINTED
	JMP SKIPFF	/(JMW:100)
	JMS EJECT	/PAGE EJECT ROUTINE
	ISZ LNCTR
SKIPFF	LAC CHRHLD	/(JMW:100)
	XCT PASSNO
	JMP* PRINT	/PASS1
	.IFUND %RSX
	XCT MACSW	/PROCESSING THE MACRO FILE?
	JMP* PRINT	/YES.
	.ENDC
	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
TSTRPT	LAC RPTSW
	SNA
	JMP NOTEXP
	LAC STOPPER
	SZA
	JMP TSTG
	JMP NOTEXP
MOD33B	PRTBUF-1
	.TITLE PRINT MULT DEFINITIONS,PK SIXBT TO ASCII
MDER	0
	JMS UP6INT
	LAC (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
	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
	AAC -33
	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
LM65	LAW -65
	DAC LNCTR
	ISZ PGCTR	/UPDATE PAGE COUNT
	XCT PASSNO	/WHAT PASS?
	JMP CPAGE	/PASS1
	JMS PRTSOH
	HOF-1
	0
CPAGE	JMS BINDEC	/CONVERT PAGE COUNT
	LAC PGCTR	/TO DECIMAL
	LAW -3
	JMS MOVEPK
	LAC DECO2P	/'LAC (DECOUT+2'
	LAC (PNMBR	/P57INT
	XCT PASSNO
	JMP NOHEAD
	JMS PRTSOH	/PRINT HEADING
	HDRLNE-1
	0
	JMS PRTSOH	/PRINT LF
	LF-1
	0
	JMP TCNOT	/PASS2 IGNORE.
NOHEAD	LAW -4		/SET UP MOVER
	JMS MOVER
	LAC (PNMBR-1
	LAC (PRNAIM+1
	LAC TITLET	/IS THIS A .TITLE?
	SNA		/YES
	JMP TCNOT	/NO IGNORE IT
	LAC TSWCH
	SZA		/(122:JMW) PASS -# TO PRINT ROUTINE IF WANT TABLE
	LAW		/(122:JMW) OF CONTENTS.
	DAC TCPRT
	LAC ERLNCT
	DAC MDER
	JMS PRTSOH
	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
/
BPXRES=.		/BNK/PAGE BITS FOR ADDR VALUE FOR OUTPUT.
GBST	0
	LAC BEGUST
	DAC USTBEG
	JMS CKEST
	JMP* GBST	/NO SYMBOLS RETURN
	IDX GBST
	JMP* GBST
/GET INTERNAL OR VIRTUAL SYMBOLS
/
BOPPC=.		/BNK/PAGE BITS OF PC.
GIVS	0
	DAC IOVS
	JMS GBST	/GET START OF S/T
	JMP* GIVS	/NO SYMBOLS
GIVSN	JMS LLSTBL
/
/
BOPADR=.		/BNK/PAGE ADDR BITS.
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 (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
	LAC DECLOC	/DECLOC=DECLOC-1
	AAC -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.
/
/CALLING SEQUENCE:
/  JMS PRTSOH
/  AREA-1 TO BE PRINTED
/  LINE TYPE: 0=NORMAL LINE; +NON-ZERO=ERROR LINE; -1=TABLE OF CONTENTS LINE.
/
PRTSOH	0
	LAC* PRTSOH
	DAC CLEARS	/AREA-1 TO BE MOVED
	IDX PRTSOH
	LAC* PRTSOH	/TYPE OF LINE
	IDX PRTSOH	/UPDATE FOR RETURN.
	SZA
	INC ERLNCT	/COUNT LINES.
	DAC FOREFG	/ERROR FLAG FOR ESWITCH.
	.IFDEF %RSX
	LAC ESWCH	/DON'T OUTPUT UNLESS REQUESTED.
	.ENDC
	TAD ALOPTN	/LISTING OR S/T REQUESTED
	SNA		/YES
	JMP* PRTSOH	/NO, EXIT
	.IFUND %RSX
	XCT MACSW	/PROCESS THE MACRO DEF. FILE?
	JMP* PRTSOH	/YES - DON'T PRINT IT.
	.ENDC
SET1ST	NOP		/NOP OR SKP.
	JMS NAME12	/ITS SET TO NOP AT 'PASS1'.
	.IFUND %RSX
	.WAIT -12
	.ENDC
	.IFDEF %RSX
	JMS WAIT12	/WAIT FOR LISTING DEVICE.
	.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 (PRTLIN+2
	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
	DAC PRTLIN
	LAC MP2
	DAC UPKAD	/RESTORE UNPACKING VALUES
	LAC TEMP01
	DAC PK57AD
	LAC TEMP02
	DAC CTR57
	LAC MP3
	DAC PKNUM
	.IFDEF %RSX
	LAC ALOPTN	/DON'T OUTPUT TO .DAT -12 UNLESS NECESSARY.
	SNA
	JMP PRESWO	/OUTPUT TO TTY FOR E OPTION.
	CAL WRTCBA	/WRITE PRTLIN
	.ENDC
	.IFUND %RSX
	.WRITE -12,2,PRTLIN,58	/(JMW:099)
MOD37=.-2
	.ENDC
	LAC ESWCH	/SHOULD THIS LINE GOTO -3 ALSO?
	SNA		/NO IF E-OPTION NOT TYPED.
	JMP PRLEEV	/EXIT FROM PRINTING ROUTINE.
	.IFDEF %RSX
PRESWO=.
	.ENDC
	LAC FOREFG	/PRINT ONLY IF ITS AN ERROR LINE.
	SNA!SPA		/(110:JMW) -1 IF DOING TABLE OF CONTENTS.
	JMP PRLEEV
	.IFUND %RSX
	LAC* (%BOSS	/(JMW:114) IF IN BOSS MODE, FORCE OUTPUT TO TTY.
	SMA
	JMP LINE2
	AND (757777	/(JMW:114)
	XOR L20000	/(JMW:114)
	DAC* (%BOSS	/(JMW:114)
LINE2=.			/(JMW:114)
	.ENDC
	LAC MOD37
	JMS WRITE3
	.IFUND %RSX
	.WAIT -3	/(JMW:116)  MUST WAIT FOR BOSS.
	.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
	.INIT -12,1,PASS1P	/(JMW:099)
MOD3A=.-2
	LAC OUTNAM	/1ST 3 CHARS OF NAME. V7E PATCH
	DAC TEMP00
	LAC OUTNAM+1		/V7E PATCH
	DAC TEMP01
	LAC LSTEXT	/'LST' EXTENSION.
	DAC TEMP02
/
/NAME IS COMPLETE; DO THE .ENTER.
/
	.ENTER -12,TEMP00	/(JMW:099)
	JMP* NAME12
	.ENDC
	.IFDEF %RSX
	LAC LSWCH	/IS THE LISTING DEVICE SPECIFIED?
	SNA
	JMP* NAME12	/NO, DON'T INIT IT.
	LAC (DAT12	/ATTACH LISTING DEVICE.
	JMS ATACH
	LAC (DAT12	/SET UP THE .ENTER FOR THE LISTING DEVICE.
	DAC OUTNAM-1	/LUN OF THE .ENTER.
	LAC FILE	/SET THE FILE NAME IN THE CPB REQUEST.
	DAC OUTNAM
	LAC FILE+1
	DAC OUTNAM+1
	LAC LSTEXT	/EXTENSION FOR THE FILE NAME.
	DAC OUTEXT
	CAL ENTCPB	/.ENTER ON -12.
	CAL WRFF	/WRITE A FF.
	CAL WFSK	/WAIT FOR THE .ENTER.
	LAC SKEV	/GET THE EVENT VARIABLE.
	SMA
	JMP* NAME12	/ENTER OK - RETURN.
	SAD (-6		/NOT OK - DEVICE FILE STRUCTURED?
	JMP* NAME12	/NO - MUIST BE OK.
	JMS* IOERR	/YES - ERROR.
	LAC (DAT12	/LUN OF THIS ERROR.
	.ENDC
	.TITLE ALL INPUT EXCEPT -2 .
/SOURCE INPUT DOUBLE BUFFERING
/
	.IFDEF %RSX
	DBLBUF-PARMES+2*1000/2+2
	0
	.ENDC
PARMES	.ASCII 'PARITY ERROR'<15>
DBLBUF	0
	.IFUND %RSX
	XX
	12
	.ENDC
	.IFDEF %RSX
	JMS WAIT11
	.ENDC
/TEST THE FIRST HEADER FOR PARITY ERRORS.
/
	LAC SRCBUF
	AND L60
	SAD K20
	SKP
	JMP NOTPAR
	LAC (PARMES-2
	JMS WRITE3
NOTPAR=.
	.IFUND %RSX	/(JMW:126)
	LAC SRCBUF
	AND L17
	SAD L6		/EOM.
	JMP EOT+1
	SAD L5		/EOT.
	JMP EOT+1
	.ENDC
	.IFDEF %RSX
	LAC RDSRLN	/CHECK FOR CTRL D IF INPUT DAT 10.
	SAD (DAT10
	SKP
	JMP NOTD10	/(JMW:126) NOT 10, LOOK FOR EOT.
	LAC SRCBUF+2
	AND (774000
	SAD (20000	/CTRL D?
	JMP EOT+1	/YES.
NOTD10	LAC SRCBUF	/(JMW:126)
	AND L17		/(JMW:126)
	SAD L6		/(JMW:126) EOM.
	SKP		/(JMW:126)
	SAD L5		/(JMW:126) EOF.
	SKP		/(JMW:126)
	JMP NOEOTF	/(JMW:126) NOT EOT - GO ON.
	LAC RDSRLN	/(JMW:126) IF MAIN FILE, SIMULATE .END.
	SAD (DAT11	/(JMW:126)
	SKP		/(JMW:127)
	JMP EOT+1	/(JMW:126)
	LAC (64000	/(JMW:127) INSERT A BLANK LINE
	DAC SRCBUF+2	/(JMW:127)  WHERE END SHOULD BE,
	SET ERRORQ	/(JMW:127)  AND FLAG THE LINE.
	JMP END		/(JMW:127)
NOEOTF=.
	.ENDC
	LAW -44
	JMS MOVER
	LAC (SRCBUF-1
	LAC (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
	.READ -11,2,SRCBUF,36	/(JMW:099) WORD 1 ALTERED.
	.ENDC
	.IFDEF %RSX
	CAL RDSRCB
	.ENDC
	JMP* RDSRC
	.TITLE ADDRESS CONSTANTS
/
/THIS TABLE OF ADDRESS CONSTANTS IS NECESSARY ONLY BECAUSE THE MACRO ASSEMBLER HAS A BUG 
/WAY IT ALLOCATES LITERALS.  IF AND WHEN THAT BUF IS FIXED, THIS TABLE SHOULD BE ELIMINAT
/LITERALS USED IN THE CODE (THE COMMENTS SHOW JUST WHAT EACH INSTRUCTION SHOULD BE).
/
BNADDP	BNADDR-1	/NOTE THAT THESE TWO ARE A PAIR - THE SECOND ONE IS DETERMINED
	BNDATA-1	/IN LINE BY ADDING 1 TO 'BNADDP' -- SO BE CAREFUL!!
SQZOTP	SQZOUT
	.IFUND %RSX
MACNMP	MACNAM
	.ENDC
PACKTP	PACKT
PACKSP	PACKS
UNSQZP	UNSQZV-1
DECO2P	DECOUT+2
	.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
/
WRFF	2700	/WRITE FORM FEED WHEN DAT12 IS
	0	/OPENED
	DAT12
	2	/IOPS ASCII
	HOFF	/BUFFER ADDRESS
/
HOFF	2002	/HEADER
	0
	.ASCII	//<14><15>
/
ATCHCB	002400
	0
ATLUN	XX
/
/
DETACH	002500	/DETACH REQUEST
	0
DETLUN	XX
/
PREA13	2300	/PREALLOCATE LUN'S
	SKEV	/EVENT VAIRABLE
	DAT13
/
PREA12	2300
	SKEV
	DAT12
/
/
TTRDCB	002600	/READ FROM TTY FOR ^P TO START PASS2
	WTFREV
	DAT2	/LUN
	2	/MODE IOPS ASCII
	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
	CAL	WTFOR	/WAIT FOR AN EVENT VARIABLE ON THE TT
	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
	CAL	WF11	/WAITFOR
	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
	CAL	WF12	/WAIT FOR EVENT VARIABLE
	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 GET LUN INFORMATION.
	DAC	HIFLUN	/SAVE THE LUN SLOT
	CAL	HINFCB	/DO A HINF
	CAL	WFSK	/WAIT FOR EVENT VARIABLE.
	LAC	SKEV	/GET LUN INFORMATION.
	SMA		/(JMW:126)POSITIVE HINF OK.
	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
	CAL	CRRTN	/RETURN THE CARRAGE
	CAL	WTFOR	/WAIT FOR EVENT VARIABLE
	JMP*	CRLF	/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
	CAL	ATCHCB	/DO THE ATTACH REQUEST
	JMP*	ATACH	/RETURN
/
DETHCB	0	/DETACH FROM A DEVICE
	DAC	DETLUN	/LUN IN AC SET IT IN LUN NUMBER
	CAL	DETACH	/DETACH FROM DEVICE
	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
/
WRPROM	2700	/WRITE PROMPTING MESSAGE
	0	/EVENT VARIABLE -- NONE
	DAT10	/LUN
	2	/DATA MODE -- IOPS ASCII
	PRNMSG	/BUFFER ADDRESS
/
PRNMSG	PRMSGE-PRNMSG/2*1000+2	/HEADER
	0
	.ASCII	'MAC-INPUT PARAMETER DEFINITIONS'<15>
PRMSGE=.
/
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
/
/
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
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
/
	.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		/>
COMMA	54		/,
L170	170
L7	7
L60	60
L5	5
L137	137
L17	17
L47S	7777
L37S	777
L77	77
L27	27
L110	110		/H
L132	132		/Z
L30	30
L33	33
L147S	17777
L347S	37777
L357S	377777
L64Z	60000
L31	31
L32	32
L42	42
L157S	177777
L10	10
K4	4
L100	100
CONCAT=L100
L20000	20000
L2000	2000
K10000	10000
K20	20
L200	200
L57S	77777
/MACRO-15 TEMP STORAGE
MACTBL	0		/BOTTOM OF FREE CORE.
PACKS	0
	0
OPRTR	0
MRGSAV	0
TMP1	0
SYMSAV	0
UNDLOC	0
EXTLOC	0
EXTLC1	0
LITLOC	0
USTBEG	0
SZECTR	0
SIXCTR	0
BEGDEF	0
BPMODE	0	/0=PAGE MODE, 1=BNAK MODE.
VARLOC	0	/VARIABLE'S LOCATION VALUE.
ENDVAL	0
DVD	0
NUMVAL	0
CTRLK	0
/
/
UNSQZL	0
CHRHLD	0
WORDCT	0
MRGLOC	0
CMPLOC	0
TMPT	0
TMP	0
BITS	0
PRGSZE	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.
GRASW	0		/(JMW:104)
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
CTR1	0
LNCTR	0
RPTCTR	0
RPTINC	0
BNDVND	0
	.IFUND %RSX
MACSW	0	/NOP=MESSING WITH MACRO DEF. FILE; SKP OTHERWISE.
	.ENDC
SYMTYP	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
	.LTORG			/(RCHM-096) GET LITERALS BEFORE .END.
PATCH	.BLOCK %PATCH		/(JMW: 097) SET UP PATCH AREA.
	.IFDEF %RSX
..SIZE	.SIZE		/SIZE OF THE PARTITION.
	.ENDC
	.END
