	.SYSID <	.TITLE DDT >,<000>
/
/COPYRIGHT (C) 1975
/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.
	.TITLE EDIT LEGEND
/
/EDIT #10 	8-26-71
/EDIT #11	4-18-74
/EDIT #12	7/14/74	EK	CHANGE SIGNON NUMBER
/ 113	20-MAY-75 (RCHM)	REMOVE ALL UNNECESSARY CONDITIONALS.
/ 114	20-MAY-75 (RCHM)	CONVERT JMS TWOCMA TO CMA!IAC.
/ 115	20-MAY-75 (RCHM)	FINISH REMOVING CONDITIONALS. ALL BANK AND
/				PAGE DESCREPENCIES WILL BE DETERMINED
/				ON THE FLY.
/ 116	21-MAY-75 (RCHM)	GENERAL CODE CLEANUP IN ADDITION TO EDIT
/				#115.
/ 117	21-MAY-75 (RCHM)	CODE TO PROTECT DDT FROM XVM WIDE ADDRESSING AND
/				TO MAKE SURE THAT THE WIDE ADDRESSING GETS USED PROPERLY.
/ 118	09-JUN-75 (RCHM)	COMPLETE XVM CHANGES.
/ 119	05-AUG-75 (RCHM)	FETCH MESSAGE HEADER DEPENDING ON PAGE OR BANK MODE.
/ 120	14-AUG-75 (RCHM)	SET UP RAD50 AND SIXBIT PRINTING ROUTINES.
/ 121	15-AUG-75 (RCHM)	SET UP RAD50 AND SIXBIT "SINGLE DISPLAYS"
/				? => 5/7 ASCII.
/				$? => SIXBIT
/				$$? => RAD50.
/ 122	26-SEP-75 (RCHM)	FIX RAD50 DISPLAY ROUTINE TO ALWAYS PRINT 3
/				CHARACTERS PER WORD.
/ 123	07-NOV-75 (RCHM)	MAKE HLT ONE OF THE KNOWN INSTRUCTIONS.
/ 124	07-NOV-75 (RCHM)	FIX AUTO INCREMENT 10 DISPLAY PROBLEM.
/ 125	07-NOV-75 (RCHM)	FIX TOO MANY SPACES FROM DDT PROBLEM.
/
/
	.TITLE DDT MACROS.
/+
/ MACRO: JMPB
/
/ USAGE: JUMP TO SPECIFIED ADDRESS IF BANK ADDRESSING IS ON.
/
/ EXAMPLE: JMPB ADDR
/-
	.DEFIN JMPB,A		/(RCHM-115) DEFINE JUMP ON BANK ADDRESSING.
	SBA			/(RCHM-115) IS BANK ADDRESSING ON?
	SKP			/(RCHM-115) NO.
	JMP A			/(RCHM-115) YES, GO TO SPECIFIED ADDRESS.
	.ENDM
/+
/ MACRO: JMPP
/
/ USAGE: JUMP TO SPECIFIED ADDRESS IF PAGE ADDRESSING IS ON.
/
/ EXAMPLE: JMPP ADDR
/-
	.DEFIN JMPP,A		/(RCHM-115) DEFINE JUMP ON PAGE ADDRESSING MACRO.
	SBA			/(RCHM-115) IS BANK ADDRESSING ON?
	JMP A			/(RCHM-115) NO, TAKE PAGE ADDRESSING JUMP.
	.ENDM
	.TITLE EQUATES AND ADDRES CONSTANTS.
.SCOM=100
RES=707742
LACQ=641002
LMQ=652000
SBA=707761			/(RCHM-115) SKIP ON BANK ADDRESSING IOT.
	.DBREL			/(RCHM-115) RESTRICT DDT TO 4K IN LENGTH.
	.TITLE SPECIAL DDT REGISTERS.
/SPECIAL DDT REGISTERS
TPA	0			/(RCHM-118) TOP OF DDT. HERE BECAUSE I WISH
				/ TO BE ABLE TO MODIFY IT DURING DEBUGGING.
ACH	RES			/AC - FIRST ADDRESS OF DDT
LKH	.SCOM+23			/LINK STORED IN BIT 17
MQH	0			/MQ STORED HERE IF EAE AVAILABLE
LRH	0		/LIMIT REGISTER STORED HERE
XH	0		/INDEX REGISTER STORED HERE
MKH	-1			/DEFAULT SEARCH MASK
LOH	.SCOM+6+620000		/LOWER LIMIT SEARCHES
HIH	LKH			/UPPER LIMIT SEARCHES
RGH	.BLOCK	4		/REGISTER TO BE TYPED OUT ON BREAK
INH	.BLOCK	4		/INSTRUCTION TO BE EXECUTED ON BREAK
	.BLOCK	4		/TRANSFER VECTOR STORAGE
PRH	-1			/PROCEED COUNT
LIM1	LIM1-1			/FIRST UNMODIFIABLE REGISTER IN DDT
TP	0			/(RCHM-118) TOP OF DDT +1 QUANTITY MADE MINUS.
/FLAGS WHICH HAVE INITIAL VALUES
MODE	JMS	INSPR		/MODE INSTRUCTION
AXH	17			/DDT AUTO-INDEX REGISTER
/
/POINTERS
/
TAB2P	TAB2			/BEGINNING OF Q# SYMBOL TABLE ENTRY (USED ONLY ON INPUT)
TAB4P	TAB4			/BEGINNING OF INST. MNEMONICS TABLE (USED ON OUTPUT)
TAB1P	TAB1			/BEGINNING OF ADDRESS TABLE (USED ON INPUT ONLY)
TAB3P	TAB3			/BEGINNING OF ADDRESS TABLE (USED ON OUTPUT ONLY)
TAB3M	PAH+1			/CURRENT END+1 OF DDT SYMBOL TABLE
TAB3M1	PAH+1			/FIRST MODIFIABLE SYMBOL TABLE ENTRY
TABMAX	FIRST			/ADDRESS+1 OF MAXIMUM DDT TABLE ENTRY
HEAD	PAH-1			/HEAD ADDRESS OF CURRENT PROGRAM SYMBOL TABLE ENTRIES
LOWSYM	STARE			/INITIALIZED TO FIRST ADDRESS OF USER SYMBOL TABLE
TOP	0		/INITIALIZED TO BE 2S COMP FIRST NON-EXISTENT MEMORY LOCATION
DATM3	.SCOM+23
	.TITLE DDT DATA REGISTERS.
/DATA REGISTERS
APIMSG	4311			/API
M3100	774700			/-50**2
	777730			/-50
DDTID	777777			/-1
LIMIT	-100			/LIMIT OF RELATIVE ADDRESSING
	.SYSID <	.ASCII ' DDT >,<000'<15>>	/(RCHM-121)
PAGEM	.ASCII ' DD'		/(RCHM-119)
	.LOC .-1		/(RCHM-119)
BANKM	.ASCII 'BDD'		/(RCHM-119)
	.LOC .-1		/(RCHM-119)
	.TITLE	DDT SYMBOL TABLE
/
TAB2	070130			/Q#
QH	0			/CONTENTS OF MOST RECENTLY OPENED STORAGE WORD
/MNEMONIC INSTRUCTION TABLE
TAB4	011364;	CAL
DACN	014453;	DAC
JMSN	040233;	JMS
DZMN	016435;	DZM
LACN	045453;	LAC
	114152;	XOR
ADDN	003344;	ADD
	076454;	TAD
XCTN	113214;	XCT
	035522;	ISZ
ANDN	004164;	AND
SADN	073354;	SAD
JMPN	040230;	JMP
EAEN	017555;	EAE
IOTN	035254;	IOT
	062100;	721000	/PAX
	062064;	722000	/PAL
AACN	003153;	723000	/AAC
	063701;	724000	/PXA
	.EJECT
AXSN	005023;	725000	/AXS
	063714;	726000	/PXL
	062741;	730000	/PLA
	062770;	731000	/PLX
	012270;	735000	/CLX
	412254
	070200;	736000	/CLLR
AXRN	005022;	737000	/AXR
	060122;	OPR
NOPN	054750;	NOP
	012311;	CMA
	012324;	CML
	070264;	RAL
	070272;	RAR
	034153;	IAC
	31764;	HLT		/(RCHM-123)
	074311;	SMA
SZAN	075321;	SZA
	074374;	SNL
SKPN	074210;	SKP
	074501;	SPA
SNAN	074361;	SNA
	075334;	SZL
	071654;	RTL
	071662;	RTR
	.EJECT
	475140
	003100;	742030	/SWHA
	012254;	CLL
	074754;	STL
	070404;	RCL
	070412;	RCR
	012241;	CLA
	012243;	CLC
	026653;	GLK
LAWN	045477;	LAW
/BEGINNING OF INPUT ADDRESS TABLE
TAB1	171700			/#
H	0			/RELOCATION FACTOR FOR CURRENT PROGRAM
	127400			/.
P	0			/ADDRESS OF MOST RECENTLY OPENED WORD
	073417			/SA#
SAH	0			/STARTING ADDRESS OF USER PROGRAM
	010527			/B1#
B1H	0			/ADDRESS OF BREAKPOINT 1
	010577			/B2#
B2H	0			/ADDRESS OF BREAKPOINT 2
	010647			/B3#
B3H	0			/ADDRESS OF BREAKPOINT 3
	010717			/B4#
B4H	0			/ADDRESS OF BREAKPOINT 4
	.EJECT
/BEGINNING OF OUTPUT ADDRESS SYMBOL TABLE
TAB3	006130			/A#
	ACH			/ADDRESS OF REGISTER IN DDT WHERE AC STORED
	077647			/(RCHM-118) TP#
	TPA			/(RCHM-118) TOP OF DDT.
	050430			/L#
LKH1	LKH			/ADDRESS OF REGISTER IN DDT WHERE LINK STORED
	052017			/MQ#
	MQH			/ADDRESS OF REGISTER IN DDT WHERE MQ STORED
	046767		/LR#
	LRH		/LIMIT REGISTER STORED IN THIS ADDRESS
	116030		/X#
	XH		/INDEX REGISTER STORED IN THIS ADDRESS
	053530			/M#
	MKH			/ADDRESS IN DDT OF DEFAULT SEARCH MASK
	046577		/LO#
	LOH		/LOWER LIMIT SEARCH OPERATIONS STORED IN THIS ADDRESS
	031617		/HI#
	HIH		/UPPER LIMIT SEARCH OPERATIONS STORED IN THIS ADDRESS
	073230			/R#
	RGH-1			/ADDRESS IN DDT CONTAINING REGISTER TO BE DISPLAYED ON BKPT1
	037130			/I#
	INH-1			/ADDRESS IN DDT CONTAINING INSTRUCTION TO BE EXECUTED ON BKPT1
	107630		/V#
	INH+3		/ADDRESS OF FIRST TRANS. VECTOR - 1 STORED HERE
	014330		/C#
	PRH			/ADDRESS IN DDT CONTAINING PROCEED COUNT
	265030			/P#'
PAH=.				/FIRST PATCH ADDRESS
	.SCOM+34
	.TITLE	DDT INITIALIZATION
/
/OVERLAID BY SYMBOL TABLE
/
START	JMS	CRLF		/(RCHM-116) PRINT INITIAL CR-LF PAIR BEFORE ANYTHING.
	LAW	-3
	TAD*	DATM3		/ CALCULATE THE ADDRESS OF .DAT -3.
	DAC	DATM3		/ SET UP THE NECESSARY POINTER.
	LAC*	SHOT3		/SET UP SA#
	AND (77777
	DAC	SAH
	LAC	LOWSYM
	DAC*	SHOT3
	LAC* (.SCOM+0)		/(RCHM-118) FETCH BOOT ADDRESS.
	AND	(70000		/(RCHM-115) DDT IS LESS THAN 4K IN LENGTH.
				/(RCHM-115)  THEREFORE, YOU MAY ALLWAYS EXTRACT THE PAGE AND
				/(RCHM-115)  AND BANK BITS WHEN WORKING WITH THE NEXM CALCULATION.
	XOR	(7777
	CMA			/ CONVERT TO NEGATIVE NUMBER.
	DAC TP			/(RCHM-118) SET UP TOP OF DDT.
	LAC* (.SCOM+77)		/(RCHM-118) FETCH LAST ADDRESS OF HIGH MEMORY.
	CMA!SPA			/(RCHM-118) CONVERT TO -ADDRESS+1
	LAC TP			/(RCHM-118) NO, USE THE TOP OF DDT.
	DAC TOP			/(RCHM-118) SET UP INVALID ADDRESS CALCULATIONS.
	LAC TP			/(RCHM-118) SET UP DISPLAY OF TOP ADDRESS OF DDT.
	CMA			/(RCHM-118) -ADDRESS +1
	DAC TPA			/(RCHM-118) SET UP DISPLAY.
	LAC*	SHOT1		/.SCOM+1 POINTS TO BEGINNING OF LOADER SYMBOL TABLE
	AND	(77777		/TRIM EXTRANEOUS BITS
	DAC	PAH
	DAC	LOWSYM
	.TITLE INITIAL SYMBOL TABLE COMPACTION.
/
/COMPACTING THE SYMBOL TABLE
/
	LAC*	TAB		/LOADER PASSES HIGH ADDR OF ITS SYMBOL TABLE
	DAC	SHOT3		/IN .SCOM+11.
UGLOOP	LAC	SHOT3		/POINTER TO BEG. OF NEXT SYMBOL
	SAD*	SHOT2		/IS THIS THE END OF THE SYMBOL TABLE?
	JMP	BALGO		/YES
	LAC*	SHOT3		/TEMPORARILY STORE VALUE OF
	DAC	SHOT1		/NEXT SYMBOL
	ISZ	SHOT3
	AND	IOTN+1		/700000
	SAD	ADDN+1		/300000
	JMP	COMBAT		/COMMON BLOCK
	SAD	JMPN+1		/600000
	JMP	FILNM		/FILE NAME
	SAD	XCTN+1		/400000
	JMP	VCOM		/VARIABLE IN COMMON
ADSYM	JMS	ADDSYM		/ADD TO SYMBOL TABLE
	SPA
	JMS	ADDSYM
	LAC	SHOT1
	AND	(77777		/CLEAN ADDRESS
	DAC*	PAH		/ADDRESS FOLLOWS SYMBOL
	ISZ	PAH
	JMP	UGLOOP
COMBAT	JMS	IGNORE		/COMMON BLOCKS ARE DELETED
	ISZ	SHOT3		/COMMON BLOCKS TAKE UP 2 MORE WORDS
	ISZ	SHOT3
	JMP	UGLOOP
VCOM	JMS	IGNORE		/IGNORE COMMON VARIABLE ENTRIES
	JMP	UGLOOP
FILNM	LAC*	SHOT3		/MARK FILE NAME
	XOR	LACN+1		/200000
	DAC*	SHOT3
	JMP	ADSYM
	.EJECT
/IGNORE THIS SYMBOL
IGNORE	0
	LAC*	SHOT3
	SPA
	ISZ	SHOT3		/BIT 0=1 FOR BOL
	ISZ	SHOT3
	JMP*	IGNORE
/COPY THIS SYMBOL INTO COMPRESSED TABLE
ADDSYM	0
	LAC*	SHOT3
	DAC*	PAH
	ISZ	SHOT3		/INCREMENT FOR NEXT ELEMENT
	ISZ	PAH
	JMP*	ADDSYM
/COME HERE ON COMPLETION OF INITIALIZATION OF SYMBOL TABLE
BALGO	LAC	PAH		/(RCHM-116) COMPLETE SETUP OF DDT.
	DAC	LOH		/INITIALIZE LO# AND HEADER
	DAC	H		/RELOCATION FACTOR
	DAC*	SHOT2		/RESTORE .SCOM+2
	CMA!IAC			/(RCHM-114) IS SYMBOL TABLE ABLE TO FIT IN CORE.
	TAD* (.SCOM+3)		/(RCHM-116) ADD IN HIGH MEMORY.
	SMA			/NO
	LAC* (.SCOM+10		/SIZE OF BUSY TABLE.
	DAC ADDSYM		/TEMP STORAGE.
	LAW -1
	TAD* (.SCOM+62		/ADDRESS OF BUSY TABLE.
	DAC* (10
	DZM* 10			/CLEAR THE BUSY TABLE.
	ISZ ADDSYM
	JMP .-2
	JMP	STARE		/YES
	.LTORG			/(RCHM-116) REUSE THE LITERAL SPACE AT THIS POINT.
	.TITLE	VARIABLES WHICH OVERLAY DDT INITIALIZATION
/
/
/
A=.-37				/(RCHM-125) LEAVE ROOM FOR ALTF2 AND ALTF3
				/(RCHM-125) AS WELL AS B.SUPR.
FIRST=A				/FIRST ARGUMENT OF 2
ARG=A+1				/MOST RECENT ARGUMENT
UMIF=A+2			/UNARY MINUS FLAG
SYM=A+3				/SYM HOLDER
BOL=A+4				/BOL HOLDER
NUM=A+5				/NUMERICAL ARGUMENT HOLDER
MODF=A+6			/-1 MEANS REGISTER MAY BE MODIFIED
SYMT=A+7			/TEMPORARY FOR SYM
BOLT=A+10			/TEMPORARY FOR BOL
TRIAL=A+11			/VALUE OF SYMT BOLT
BEST=A+12			/BEST VALUE SO FAR
NECES=A+13			/TEST WORD FOR OPERATE INSTRUCTION OUTPUT
QUOTF=A+14			/-1 MEANS SYMBOL IS ADDRESS
CHA=A+15			/POINTER FOR POSITION OF CHARACTER IN SYMBOL
VALUE=A+16		/THAT WHICH IS TO BE OUTPUT
B1I=A+17			/BKPT 1 INSTRUCTION
B2I=A+20			/BKPT 2 INSTRUCTION
B3I=A+21			/BKPT 3 INSTRUCTION
B4I=A+22			/BKPT 4 INSTRUCTION
BPNO=A+23			/BREAKPOINT NUMBER-1
BPHOLD=A+24			/ADDRESS OF BREAKPOINT
PFLG=A+25			/PROCEED FLAG
DIFF=A+26			/ABSOLUTE DIFFERENCE BETWEEN VALUE AND TRIAL
PCS=A+27			/PROGRAM COUNTER SAVED ON BREAK
CT=A+30				/CONTROL T FLAG
SPACF=A+31			/NORMALLY-1 BUT SET TO 17777 WHEN SPACE HAS OCCURED
TABP=A+32			/POINTER TO SYMBOL LOCATION IN TABLE
CUR=A+33			/CURRENT REGISTER
ALTF2=A+34			/(RCHM-120) SECOND ALTFLAG.
ALTF3=A+35			/(RCHM-120) THIRD ALTFLAG.
B.SUPR=A+36			/(RCHM-125) BLANK SUPPRESSION SWITCH.
				/(RCHM-125) SKP => DELETE OR SUPPRESS BLANKS.
				/(RCHM-125) CURRENTLY USED ONLY BY THE RAD50
				/(RCHM-125) OUTPUT ROUTINE.
	.TITLE	DDT COMMAND DECODER
/
/IOPS ERRORS AND OTHER SERIOUS ERRORS RETURN HERE
STARE	ION			/(RCHM-119) TURN PI ON
	LAC BANKM		/(RCHM-119) FETCH BANK MODE HEADER.
	SBA			/(RCHM-119) IN BANK MODE?
	LAC PAGEM		/(RCHM-119) NO, IN PAGE MODE.
	DAC DDTID+2		/(RCHM-119) SET UP MESSAGE.
	JMS	CRLF		/GIVE CR LF
	JMS	PASC		/WRITE DDT V??
	DDTID
	LAC	SAH
	JMS	PADJ
CNTRLT	JMS	INFUJ
	CLC
	DAC	CT
/COMMANDS RETURN HERE ON COMPLETION
LLQ	JMS	CRLF		/TYPE CR LF
	LAW	76		/TYPE >
	JMS	TYO
	LAC SKPN+1		/(RCHM-125) FETCH SKP INSTRUCTION.
	DAC B.SUPR		/(RCHM-125) SUPPRESS BLANKS.
LLR	DZM	FIRST		/FIRST ARG. SET TO 0
	LAC	NOPN+1
	DAC	FARGF		/FIRST ARG. NOT PRESENT YET
LLP	DZM	ARG		/CURRENT ARG. SET TO 0
	LAC	NOPN+1
	DAC	ARGF		/CURRENT ARG. NULL SO FAR
	CLC
	DAC	SPACF		/SPACE HAS NOT OCCURRED YET
	LAC	OPSP		/INITIALLY + OPERATOR ASSUMED
LLO	DAC	EVEN		/SET OPERATOR BRANCH
	LAC	SKPN+1
	DAC	ALTF		/ALT MODE NOT LAST CHARACTER
	DAC ALTF2		/(RCHM-120) CLEAR 2ND ALT FLAG.
	DAC ALTF3		/(RCHM-120) CLEAR 3RD ALT FLAG.
	DZM	UMIF		/UNARY MINUS NOT SEEN YET
	DZM	SYM		/NO SYM BOL YET
	DZM	SYMT
	DZM	BOL
	LAC	NOPN+1
	DAC	DATF		/NO. CHAR. IN SYLLLABLE YET
	DAC	LETF		/NO LETTER IN SYLLABLE YET
	DZM	NUM		/NUMBER IS 0 SO FAR
	LAC	(LDIST		/FIRST CHAR. IN SYMBOL
	DAC	CHA
	DZM	QUOTF		/SYLLABLE IS NOT NECESSARILY AN ADDRESS SYMBOL
LL	JMS	TYI		/FETCH NEXT CHARACTER
	.EJECT
	LAW	-140		/CALCULATE DISPATCH ADDRESS
	TAD	CH		/SYMBOL (7 BIT ASCII) IN CH
	SAD	(37
	JMP	RUB		/177 = RUB-OUT
	SAD	(35
	JMP	ALT		/175 = ALT MODE
	SMA!CLL
	JMP	ERR		/OTHER CHAR. ABOVE 137 ILLEGAL
	TAD	(140-12
	SPA!CLL
	JMP	ERR		/CHAR. BELOW 12 ILLEGAL
	SZA			/(12) LINE FEED
	SAD	(3		/(15) CHAR. RET
	JMP	FIR		/FIRST AND FOURTH ENTRIES IN DISPATCH TABLE AND SKIP IN BETWEEN
	SAD	(13
	JMP	RUB		/25 IS ^U TREAT LIKE RUB-OUT
	SAD	(21
	JMP	ALT		/33 ESC TREAT AS ALT MODE
	TAD	(-26
	SPA!CLL
	JMP	ERR		/OTHER CHAR. BELOW 40 ILLEGAL
	TAD	(4		/START WITH 5TH DISPATCH ENTRY
FIR	TAD	(DTB
	DAC	TYI
	LAC*	TYI		/FETCH DISPATCH ENTRY
	SAD	NUMBER
	JMP	DIGIT		/OCTAL DIGIT
	LMQ			/(RCHM-117) SAVE DISPATCH TABLE ENTRY IN MQ.
	AND (77777)		/(RCHM-117) CLEAR MULTIPLEXED BITS IN CASE WIDE IS ON.
	DAC TYI			/(RCHM-117) SET UP DISPATCH.
	LACQ			/(RCHM-117) FETCH DISPATCH TABLE ENTRY.
	SMA!RAL
	JMP	LETTER		/LETTER ENTRIES POSITIVE
LEVEL	SPA
	JMS	EVAL		/BIT 1=1 MEANS SYLLABLE TERM.
	JMP*	TYI		/DISPATCH TO COMMAND HANDLER
	.EJECT
LETTER	XCT	ALTF
	JMP	LEVEL		/LETTERS PRECEDED BY ALT MODE ($) ARE COMMANDS
	LAC	SKPN+1
	DAC	LETF		/LETTER HAS OCCURRED
SYMQ	LAC	SKPN+1
	DAC	DATF		/ARGUMENT EXISTS
	LAC	CH		/TRANSLATE ASCII TO SQOZE
	SAD	(43
	LAW	47		/#
	SAD	(45
	LAW	33		/%
	SAD	(56
	LAW	34		/.
	AND	(77
	SAD	CH
	TAD	(-23		/NUMBERS
	ISZ	CHA
LDIST	JMP*	CHA
	JMP	C1		/FIRST ALPHANUMERIC
	JMP	C1+1		/SECOND "
	JMP	C1+2		/THIRD "
	JMP	C2		/FOURTH "
	JMP	C2+1		/FIFTH  "
	JMP	C2+2		/SIXTH  "
	CLC			/IGNORE BEYOND SIX
	TAD	CHA
	DAC	CHA
	JMP	LL
C1	JMS	M50
	JMS	M50
	TAD	SYM
	DAC	SYM
	JMP	LL
C2	JMS	M50
	JMS	M50
	TAD	BOL
	DAC	BOL
	JMP	LL
/MULTIPLY AC BY 50 OCTAL
M50	0
	RCL
	RTL
	DAC	CH
	RTL
	TAD	CH
	JMP*	M50
	.EJECT
/NUMBERS COME HERE
DIGIT	TAD	CH
ALTF	XX			/HAS ALT MODE OCCURRED?
	JMP	BPT		/YES, MANIPULATE BREAKPOINTS
	DAC	SHOT		/NO, ADD TO NUM
	LAC	NUM
	RCL			/MULTIPLY BY 8
	RTL
	AND (777770)		/(RCHM-116) PREPARE SPACE FOR THE NEXT DIGIT.
	TAD	SHOT		/ADD DIGIT
	DAC	NUM		/STORE
	JMP	SYMQ		/NOW TREAT AS SYMBOL CONSTITUENT
	.TITLE	BREAKPOINT COMMAND HANDLER
/
/BREAKPOINT COMMAND HANDLER
BPT	SNA
	JMP	D0		/SET AUTO-INDEX REGISTER
	TAD	MINUS		/TAD (-1
	AND	(3		/CLEAN OFF BPT #
	TAD	(DAC RGH
	DAC	BPT2		/SET UP DAC REG TO BE PRT. ON BREAK
	TAD	(4
	DAC	BPT1		/SET UP DAC REG. CON. COND.EX. IN.
	JMS	EVAL
	XCT	ARGF
	LAC	TAB3+1		/LAC (ACH
BPT2	XX
	LAC	FIRST
	AND	(1
	XCT	FARGF
	LAC	NOPN+1		/N=NULL _ NOP
	SNA
	LAC	SKPN+1		/N=0 _ SKP
	SMA
	LAC	(JMP BPR2+3	/N=1 _ JMP .+3
BPT1	XX
	JMP LLQ
DB	SZA			/$B - SET BREAKPOINT
	JMP	DB6
	XCT	FARGF
	XCT	ARGF
	SKP
	JMP	CBPT		/0$B - CLEARS ALL BREAKPOINTS
DB6	XCT	FARGF
	JMP	DB2		/K$B - GET NEXT AVAILABLE BREAKPOINT
	LAC FIRST
	TAD MINUS		/TAD (-1
DB3	AND	(3		/CLEAN OFF BKPT #
	DAC	SHOT
	RCL
	TAD	(DAC B1H
	DAC BPSTR
	LAC	SHOT
	TAD	(DAC RGH
	DAC	DB4
	TAD	(4
	DAC	DB5
	.EJECT
	LAC ARG
DATF	XX
	LAC	P		/DEFAULT BKPT INST. IS LAST OPENED ADDRESS (.)
	SNA
	JMP	BPSTR		/0 MEANS CLEAR BREAKPOINT
	JMS	ADRES		/TEST IF ADDRESS IS LEGAL
	JMS	MEMPRT		/ILLEGAL ADDRESS
BPSTR	XX			/STORE ADDRESS IN BREAKPOINT REGISTER
	LAC	NOPN+1	/INITIALLY SET TO DECREMENT PROCEED COUNT
DB5	XX
	LAC	TAB3+1		/INITIALLY SET TO TYPE AC ON BREAK
DB4	XX
	JMP	LLQ
DB2	CLA			/LOOK FOR FIRST FREE BKPT
	SAD	B1H
	LAW	61
	SAD	B2H
	LAW	62
	SAD	B3H
	LAW	63
	SAD	B4H
	LAW	64
	SMA
	JMP	ERR		/NO FREE BPT
	JMS	TYO		/TYPE BKPT NO. FOUND
	LAC	SHOT3
	JMP	DB3-1
CBPT	DZM	B1H		/CLEAR BREAKPOINTS
	DZM	B2H
	DZM	B3H
	DZM	B4H
	JMP	LLQ
	.TITLE	EXPRESSION EVALUATOR
/
/EVALUATE EXPRESSIONS TYPED IN
EVAL	0
	LAC	ARG		/0 IS VALUE OF NULL EXPRESSION
	XCT	DATF
	JMP*	EVAL		/OMIT EVALUATION OF NULL SYLLABLE
	LAC	SKPN+1		/ARGUMENT EXISTS (NON NULL)
	DAC	ARGF
LETF	XX			/SKIP IF LETTER HAS OCCURRED IN SYL.
	JMP	NUMB		/SYLLABLE IS OCTAL NUMBER
	LAC	SPACF
	SMA!CLC
	DAC	QUOTF		/NEVER SEARCH INST. MNEMONICS AFTER SPACE HAS OCCURRED
	LAC	TAB1P
	ISZ	QUOTF
EVAL1	LAC	TAB2P		/SEARCH INSTRUCTION MNEMONICS
	DAC	TAB		/TAB CONTAINS STARTING ADDRESS OF SYMBOL TABLE SEARCH
	LAC	NOPN+1		/HEADER TABLE HAS NOT BEEN SEARCHED
	DAC	SEFLG
SCAN	JMS	GETSYM		/GET NEXT SYMBOL
	JMP	LOSE		/END OF TABLE REACHED
	LAC	SYMT
	XOR	SYM
	AND	(377777
	SZA
	JMP	SCAN		/SYM NOT = SYMT
	LAC	BOLT
	XOR	BOL
	AND	(377777
	SZA
	JMP	SCAN		/BOL NOT = BOLT
	LAC	TRIAL		/SYMBOL FOUND
	DAC	NUM		/VALUE IN NUM
NUMB	LAC	NUM
	TAD	UMIF		/IF UMIF = 0 NOTHING HAPPENS
	XOR	UMIF		/IF UMIF = -1 FORM 2S COMP. OF NUM
EVEN	TAD	ARG		/COMBINE WITH ARG
SPAC	XOR	ARG		/IF SPACF = -1 NOTHING HAPPENS
	AND	SPACF		/IF SPACE = 17777 ONLY ADDRESS PART OF ARG CHANGES
SPAC1	XOR	ARG		/USED AS LITERAL
	DAC	ARG
	LAC	SYMT
	SAD	AACN
	JMP	REG1
	SAD	AXSN
	JMP	REG1
	SAD	AXRN
	JMP	REG1
	SAD	LAWN
	JMP	REG3
	.EJECT
REG2	LAC	ARG
	JMP*	EVAL
REG1	LAC	SPACF
	SPA
	AND	(777
REG4	DAC	SPACF
	JMP	REG2
REG3	LAC	SPACF
	SPA
	LAC	(17777
	JMP	REG4
LOSE	LAW	125		/SYLLABLE UNDEFINED-TYPE U
	JMP	RUB+1
OPMI	TAD	MINUS		/SUBTRACT (-)
	CMA
OPSP	TAD	ARG		/USED AS LITERAL
	JMP	SPAC
OPOR	AND	ARG		/INCLUSIVE OR (!)
	XOR	NUM
	XOR	ARG
	JMP	SPAC
RUB	LAW	100		/@ RUBOUT STARTS OVER
	JMS	TYO
	JMS	TAB
	JMP	LLQ+1
MEMPRT	0
ALTERF	SKP
	JMP*	MEMPRT
ERR	LAW	77		/GENERAL ERROR-TYPE ? AND
	JMS	TYO		/START OVER
	JMP	LLQ
SPACE	LAC SPACF		/(RCHM-115) HAS A SPACE BEEN DETECTED YET?
	SMA			/(RCHM-115) NO.
	JMP LLO-2		/(RCHM-115) YES.
	LAC (17777)		/(RCHM-115) FETCH BANK MASK INITIALLY.
	SBA			/(RCHM-115) ARE WE RUNNING IN BANK MODE?
	LAC (7777)		/(RCHM-115) NO, FETCH PAGE MASK.
	JMP	LLO-2
	.EJECT
MINUS	LAW	-1		/-OCCURED IN EXPRESSION USED AS LITERAL
	DAC	UMIF
	XCT	DATF
	JMP	LL		/UNARY MINUS
	LAC	(JMP OPMI	/ORDINARY MINUS
	JMP	LLO
CLAM	LAC	(JMP OPOR	/INCLUSIVE OR (!) HAS OCCURED IN EXPRESSION
	JMP	LLO
BKSLS	LAC	SPAC1		/EXCLUSIVE OR (BACKSLASH) HAS OCCURRED IN EXPRESSION
	JMP	LLO
COMMA	JMPB ERR		/(RCHM-115) IF BANK ADDRESSING, THIS IS ILLEGAL.
	LAC ARG			/(RCHM-115) FETCH CURRENT ARGUMENT.
	XOR	(10000
	DAC	ARG
	JMS	TYI
	LAC	CH
	SAD	(130
	JMP	LL		/IGNORE POSSIBLE FOLLOWING X
	JMP	LL+1
AMPER	LAC	OPOR		/AND (&) HAS OCCURED IN EXPRESSION
	JMP	LLO
SEMI	DAC	FIRST		/SEMICOLON MEANS SECOND ARG. COMING
	LAC	SKPN+1		/SET FIRST ARGUMENT PRESENT FLAG
	JMP	LLP-1
ALT	LAW	44		/ALT MODE ECHOES $
	JMS	TYO
DOLL	LAC	NOPN+1		/$ HAS OCCURED
	XCT ALTF2		/(RCHM-120) HAS $$$ OCCURED?
	DAC ALTF3		/(RCHM-120) YES.
	XCT ALTF		/(RCHM-120) HAS $$ OCCURED?
	DAC ALTF2		/(RCHM-120) YES.
	DAC	ALTF		/SET ALT MODE FLAG
	JMP	LL
INDIRE	LAC	ARG		/ADD INDIRECT BIT (*)
	XOR	(20000
	DAC	ARG
	JMP	LLO-1
DQUOTE	CLC			/"MEANS SKIP SEARCHING INSTRUCTION TABLE
	DAC	QUOTF
	JMP	LL
APO	LAC	SYM		/FILE NAME (')
	XOR	LACN+1		/SET FLAG BIT (200000)
	DAC	SYM
	JMP	LL
	.TITLE	GETSYM (GET NEXT SYMBOL FROM SYMBOL TABLE)
/
/GET NEXT SYMBOL FROM SYMBOL TABLE
GETSYM	0
	LAC	TAB
	SAD	PAH
	JMP	GET3		/END OF USER SYMBOL TABLE REACHED
	SAD	TAB3M
	JMP	GET4		/END OF DDT SYMBOL TABLE REACHED
SEFLG	XX			/SKIP IF HEAD TABLE IS BEING SEARCHED
	JMP	GET1		/FETCH NEXT SYMBOL
	LAC*	TAB
	RAL
	SMA
	JMP	GET1		/FETCH NEXT SYMBOL
GET2	LAC	LOWSYM		/FINISHED SEARCHING HEAD TABLE
	DAC	TAB		/SEARCH WHOLE USER TABLE NEXT
	LAC	NOPN+1		/RESET SEARCH HEAD TABLE FLAG
	DAC	SEFLG
	JMP	GETSYM+1
GET1	LAC	TAB		/SET UP POINTER TO BEGINNING OF NEXT SYMBOL ENTRY
	DAC	TABP
	LAC*	TAB
	DAC	SYMT
	ISZ	TAB
	SMA!CLA			/BIT 0=1 INDICATES 6 LETTER SYMBOL
	JMP	.+3
	LAC*	TAB
	ISZ	TAB
	DAC	BOLT		/BOLT IS 0 IF ONLY 3 LETTER SYMBOL
	LAC*	TAB
	DAC	TRIAL		/VALUE OF SYMBOL IN TRIAL
	ISZ	TAB
	ISZ	GETSYM		/SKIPS ON FINDING A SYMBOL
	JMP*	GETSYM
GET3	XCT	SEFLG		/NO MORE SYMBOLS?
	JMP*	GETSYM		/YES
	JMP	GET2		/NO,ONLY SEARCHING HEADER TABLE
GET4	XCT	SEFLG
	SKP			/END OF INSTRUCTION TABLE REACHED
	JMP	GET2		/END OF HEADER TABLE REACHED
	LAC	HEAD		/SEARCH CURRENT HEAD TABLE FIRST
	DAC	TAB
	LAC	SKPN+1		/SET FLAG TO INDICATE SEARCHING
	DAC	SEFLG		/HEAD TABLE
	JMP	GET1		/HEAD TABLE ALWAYS HAS AT LEAST 1 MEMBER
	.TITLE	DDT COMMAND DECODER DISPATCH TABLE
/
/DISPATCH TABLE
DTB	JMP+LINEF		/(12) LINE FEED
/ THIS REPRESENTS A 2 WORD HOLE IN DISPATCH TABLE
SUP	1			/ZERO SUPRESSION WHEN NON-ZERO
XCTF	0			/EXECUTE FLAG
	JMP+RETURN		/(15) CR
	JMP+SPACE		/(40) SPACE
	JMP+CLAM		/(41) !
	XCT+DQUOTE		/(42) "
	ERR			/(43) # TREAT LIKE LETTER
	XCT+DOLL		/(44) $
	ERR			/(45) % TREAT LIKE LETTER
	JMP+AMPER		/(46) &
	XCT+APO			/(47) '
	JMP+SEMI		/(50) (
	XCT+CLOSEP		/(51) )
	JMP+INDIRE		/(52) *
	JMP+LLO-1		/(53) +
	XCT+COMMA		/(54) ,
	JMP+MINUS		/(55)-
	ERR			/(56) . TREAT LIKE LETTER
	JMP+SLASH		/(57) /
NUMBER	-60			/(60) 0
	-60			/(61) 1
	-60			/ (62) 2
	-60			/(63) 3
	-60			/(64) 4
	-60			/(65) 5
	-60			/(66) 6
	-60			/(67) 7
	ERR			/(70) 8 TREAT LIKE LETTER
	ERR			/(71) 9 TREAT LIKE LETTER
	JMP+COLON		/(72) :
	JMP+SEMI		/(73) ;
	JMP+LT			/(74) <
	JMP+EQUAL		/(75) =
	XCT+ERR			/(76) >
	JMP+QUES			/(77) ?
	XCT+DAT			/(100) @
	DA			/(101) A
	LAC+DB			/(102) B
	.EJECT
	ERR			/(103) C
	ERR			/(104) D
	LAC+ADRS		/(105) E
	DF			/(106) F
	LAC+GO			/(107) G
	LAC+DH			/(110) H
	ERR			/(111) I
	LAC+DJ			/(112) J
	LAC+DK			/(113) K
	LAC+DL			/(114) L
	LAC+DM			/(115) M
	LAC+NOT			/(116) N
	LAC+DO1			/(117) O
	LAC+REGO		/(120) P
	ERR			/(121) Q
	DR			/(122) R
	DS			/(123) S
	DT			/(124) T
	LAC+DU			/(125) U
	DV			/(126) V
	LAC+WORD		/(127) W
	LAC+DO			/(130) X
	LAC+DY			/(131) Y
	LAC+DZ			/(132) Z
	JMP+OBRAK		/(133) [
	JMP+BKSLS		/(134) \
	JMP+CBRAK		/(135) ]
	JMP+UPAR		/(136) ^
	JMP+BAKAR		/(137) _
	.TITLE	^T AND BREAKPOINT HANDLER
/
/^T RETURNS HERE
STARET	ISZ	SUP		/MAKE SURE ZERO SUPRESSION IS ON
	ISZ	INFUJ		/ARE WE IN DDT
	JMP	LLQ		/ABORTED A DDT FUNCTION
	LAC* (117		/117 CONTAINS AC
	DAC ACH
	LAC* (116		/116 CONTAINS PC
	JMP	CNTRLT
/BREAKPOINTS COME HERE
BPRET1	0
	DAC	ACH	/SAVE AC
	LAC	BPRET1
	JMS	INFUJ	/REMOVE BREAKPOINTS
	CLC
	TAD	P
	DAC	BPHOLD	/ADDRESS OF BREAKPOINT STORED BPHOLD
	DAC	P	/.=ADDRESS OF BREAKPOINT
	DAC	CUR
	SAD	B1H	/COMPUTE BKPT #-1
	LAW
	SAD	B2H
	LAW	1
	SAD	B3H
	LAW	2
	SAD	B4H
	LAW	3
	SMA
	JMP	STARE	/NOT LEGAL BKPT
	AND	(3
	DAC	BPNO	/BKPT #-1 STORED BPNO
	TAD	(XCT INH	/COMPUTE INST. TO BE EXECUTED ON BREAK
	DAC	BPR2
	JMS	RESET	/RESTORE AC AND LINK
BPR2	XX		/EXECUTE INSTRUTION
	ISZ	PRH	/NOP MEANS TEST PROCEED COUNT
	JMP	PROGO	/SKP MEANS ALWAYS PROCEED
	IORS		/BREAK ON DOUBLE SKIP OR 0 PROCEED COUNT
	SMA
	JMP	STARE	/REINITIALIZE DDT IF PI OFF
	705512		/READ API STATUS
	DAC	SHOT1
	SMA
	JMP	SAFE	/API OFF
	AND	(377
	SNA
	JMP	SAFE
	LAW	17770	/API ERROR
	DAC	SHOT2
BPR3	DBK		/RETURN TO MAIN STREAM
	ISZ	SHOT2
	JMP	BPR3
	XCT*	(.SCOM+35	/CLEAR OUT TELETYPE BUSY FLAGS
	ION
	JMS	CRLF
	LAC	APIMSG	/TYPE ERROR MESSAGE
	JMS	SQPR
	JMS	TAB	/TYPE TAB
	LAC	SHOT1
	JMS	OINSPR	/DISPLAY API STATUS REGISTER
	JMS	CRLF
	JMP	.+3
SAFE	CLC
	DAC	PFLG	/ENABLE PROCEED FLAG
	LAC	BPNO
	TAD	(LAC RGH
	DAC	BPR1
	LAC	BPNO	/CALCULATE BKPT #
	TAD	(1
	JMS	OADRPR	/TYPE BKPT #
BPR1	XX
	SNA
	JMP	LLQ	/IF REGISTER TO BE TYPE IS 0 OMIT TYPING IT
	JMS	PADJ	/ADJUST HEADER
	JMS	TAB	/PRINT TAB
	JMS LACIP		/(RCHM-117) PERFORM INDIRECTION THROUGH AI 10.
	DAC	QH	/MAKE Q#=CONTENTS OF .
	XCT	OUTMOD	/PRINT REGISTER IN CURRENT MODE
	JMP	LLQ
	.TITLE	$P - PROCEED FROM BREAKPOINT
/
REGO	LAC	ARG	/$P - PROCEED
	SZA!SMA!CMA	/PROCEED COUNT MAY NEVER BE MINUS
	XCT	ARGF
	LAW	-2	/DEFAULT PROCEED COUNT IS 1
	TAD	(1
	DAC	PRH	/SET PROCEED COUNT
	ISZ	CT
	SKP
	JMP	GOX	/^T HAS OCCURRED OR DDT HAS BEEN INITIALIZED
	ISZ	PFLG
	JMP	ERR	/MAY NOT GIVE $P AFTER API ERROR
	JMS	CRLF
PROGO	LAC	PROOF+3	/PREINITIALIZE INST. FOLLOWING BKPT. INST.
	DAC	PROOF+1
	LAC	BPRET1	/SET UP PROGRAM COUNTER
	DAC	NUM
	LAC	BPHOLD	/SET UP EFFECTIVE ADDRESS OF BKPT.INST.
	DAC	FIRST
	LAC*	BPHOLD
PROGO1	DAC	PROOF	/DEPOSIT INST. TO BE EXECUTED OUT OF PLACE
	AND	(770000
	SAD	(710000		/FLOATING HARDWARE INSTRUCTION?
	JMP	FLPFIX		/YES
	AND	NOPN+1	/740000
	SZA
	SAD	XCTN+1
	JMP	CFIX	/CAL OR XCT INST.
	SAD	EAEN+1
	JMP	EFIX	/EAE INST.
	AND	IOTN+1	/700000
	SAD	IOTN+1
	JMP	PROOF-1	/LAW, OPR, OR IOT INST.
	LAC	PROOF	/ADDRESS INSTRUCTION
	JMS	REFAD	/COMPUTE ADDRESS REFERRED TO IN INST.
	LAC	FIRST	/XCT IN REFAD
	DAC	SHOT3	/DEPOSIT ADDRESS REFERRED TO
	LAC	PROOF
	AND	(20000
	SNA
	JMP	PROGO2	/DIRECT INSTRUCTION
	.EJECT
	LAC	SHOT3	/INDIRECT REFERENCE
	AND	(77770	/IS ADDRESS THAT OF INDEX REG
	XOR	(10
	SNA
	ISZ*	SHOT3	/YES, INCREMENT IT
	LAC*	SHOT3	/MAKE REFERENCE DIRECT
	DAC	SHOT3
PROGO2	LAC	PROOF
	AND	NOPN+1	/740000
	SAD	JMSN+1
	JMP	JFIX	/JMS INSTRUCTION
BPMEMA	XOR	(20000 SHOT3
	JMPB BPMEM1		/(RCHM-115) IF BANK ADDRESSING, DON'T WORRY ABOUT X REGISTER
	XOR	PROOF
	AND	(767777
	XOR	PROOF
BPMEM1	DAC	PROOF		/(RCHM-115) INSTRUCTION IS COMPLETE.
	JMS	OUTFUJ
PROOF	XX		/INSTRUCTION TO BE EXECUTED OUT OF PLACE
	JMP*	NUM	/INITIALIZED
	ISZ	NUM	/SKIP NEXT INSTRUCTION
	JMP*	NUM	/USED AS LITERAL
EFIX	LAC	(500	/EAE INSTRUCTION
	AND	PROOF
	SAD	(100
	SKP
	JMP	PROOF-1	/NON MEMORY REFERENCE EAE
FLPFIX	ISZ	XCTF
	SKP
	JMP	ERR	/USER MAY NOT EXECUTE MEMORY
			  /REFERENCE EAE INST.
	LAC*	BPRET1	/FETCH SRG. OF EAE INSTRUCTION
	DAC	PROOF+1
	JMP	PROOF-1
CFIX	ISZ	XCTF	/CAL OR XCT COMMAND
	SKP
	JMP	ERR	/USER MAY NOT EXECUTE A XCT OR CAL INSTRUCTION
	JMS	OUTFUJ	/RESTORE BREAKPOINTS
	LAC	PROOF	/REMOVE CURRENT BKPT
	DAC*	BPHOLD
	JMS	RESET	/RESET AC, LINK
	JMP*	BPHOLD	/XCT.INST. IN PLACE
	.EJECT
JFIX	JMPB JFIXA		/(RCHM-115) IF BANK MODE, DON'T WORRY ABOUT XR.
	LAC JFIXI		/(RCHM-115) FETCH SETUP OF JMS INSTRUCTION.
	XOR	PROOF
	AND	(767777
	XOR	PROOF
	DAC	JFIXI
	JMS	RESET
JFIXA	LAC	LKH		/(RCHM-115) COMPUTE JMS DEPOSIT
	RTR
	XOR	NUM	/LINK STATUS MERGED WITH PC
	AND	XCTN+1	/400000
	XOR	NUM
JFIXI	DAC*	SHOT3	/DEPOSIT IN SHOT3 ADDRESS
	ISZ	SHOT3	/POINT TO NEXT ADDRESS
	LAC	JMPN+1	/JMP TO ADDRESS +1
	JMP	BPMEMA
	.TITLE	$X AND $G
/
/EXECUTE INSTRUCTION
DO	LAC	PROOF+3	/PREINITIALIZE INST. FOLLOWING BKPT. INST.
	DAC	PROOF+1
	LAC	(XDONE	/SET PC FOR NEXT INST. FOLLOWING BKPT. INST.
	DAC	NUM
	LAC	P	/SET INST. EFFECTIVE ADDRESS
	DAC	FIRST	/AS .
	CLC
	DAC	XCTF	/SET XCT FLAG
	JMS	CRLF
	LAC	ARG
	XCT	ARGF
	JMS LACIP		/(RCHM-117) FETCH DEFAULT INSTRUCTION TO BE EXECUTED.
	JMP	PROGO1
XDONE	DZM	NUM	/INST. EXECUTED DID NOT SKIP IF RETURN COMES HERE
	JMP	.+4	/EXTRA CR FOR SKIP OF 1
	JMP	STARE	/SKIP OF 2 IS ILLEGAL
	JMP	STARE	/3 ILLEGAL
	JMP	STARE	/4 ILLEGAL
	DAC	ACH	/SAVE AC
	LAC	PCS
	JMS	INFUJ	/REMOVE BREAKPOINTS
	LAC	NUM
	SZA
	JMS	CRLF	/EXTRA CR FOR SKIP
	JMP	LLQ
/START PROGRAM $G
GO= .
ARGF	XX		/SKIP IF ARG. EXISTS
	LAC	SAH	/DEFAULT ADDRESS IS SA#
FARGF	XX		/SKIP IF FIRST ARGUMENT EXISTS
	SKP
	DAC	SAH	/CHANGE SA# IF FIRST ARG. EXISTS
	DAC	PCS
GOX	CLC
	DAC	PRH
	DAC	CT
	LAC	PCS
	JMS	ADRES	/MUST START PROGRAM IN LEGAL
	JMS	MEMPRT	/ADDRESS
	JMS	CRLF
	JMS	OUTFUJ	/RESTORE BREAKPOINTS AND AC, LINK
	JMP*	PCS	/START PROGRAM
	.TITLE	INFUJ  (SAVE USERS MACHINE CONDITIONS)
/
/SAVE USERS MACHINE CONDITIONS
INFUJ	0
	SAD	PCS
	SKP
	DZM	CT
	DAC	PCS	/SAVE PC
	AND	(77777	/TRIM OFF FLAGS
	DAC	P	/MAKE PCS= .
	DAC	CUR
	GLK
	DAC	LKH	/SAVE LINK
	LACQ			/(RCHM-116) SAVE MQ
	DAC	MQH
	724000			/PXA
	DAC	XH
	730000			/PLA
	DAC	LRH
	LAC	B1I	/PUT BACK BREAKPOINT INSTRUCTIONS
	DAC*	B1H
	LAC	B2I
	DAC*	B2H
	LAC	B3I
	DAC*	B3H
	LAC	B4I
	DAC*	B4H
	LAC	NOPN+1	/CLOSE ANY OPEN REGISTER
	DAC	OPENF
	DZM	XCTF	/MAKE SURE XCT FLAG IS OFF
	JMP*	INFUJ
	.TITLE	OUTFUJ (RESTORE USERS MACHINE CONDITIONS)
/
/RESET ACTIVE REGISTERS
RESET	0
	LAC	XH		/RESTORE INDEX REGISTER
	721000			/PAX
	LAC	LRH
	722000			/PAL
	LAC	MQH
	LMQ			/(RCHM-116) RESTORE MQ REGISTER
	LAC	LKH
	RAR
	LAC	ACH
	JMP*	RESET
/RESTORE USER'S MACHINE CONDITIONS AND PLACE BKPTS
OUTFUJ	0
	LAC*	B1H	/STORE BKPT. INSTRUCTIONS
	DAC	B1I
	LAC*	B2H
	DAC	B2I
	LAC*	B3H
	DAC	B3I
	LAC*	B4H
	DAC	B4I
	LAC	(BPRET1-1	/INITIALIZE BREAKPOINT AUTO-INDEX REGISTER
	DAC*	AXH
	LAC	AXH	/SET BREAKPOINTS
	XOR	(JMS*
	DAC*	B1H
	DAC*	B2H
	DAC*	B3H
	DAC*	B4H
	CLC
	DAC	INFUJ
	JMS	RESET	/RESTORE AC, LINK
	JMP*	OUTFUJ
	.TITLE	REGISTER EXAMINATION
/
/REGISTER EXAMINATION
CBRAK	LAC	BAKAR+1	/]- FORCE OUTPUT TO BE SYMBOLIC
	SKP
OBRAK	LAC	EQUAL+1	/[- FORCE OUTPUTTO BE OCTAL
	DAC	OUTMOD
	XCT	ALTF
	DAC	MODE	/WITH ALT MODE CHANGES PERMANENT MODE
SLASH	LAC	ARG
	XCT	ARGF
	LAC	P	/DEFAULT REG. IS 0
SLASH1	DAC	CUR	/MAKE REG. CURRENT
	JMP	OREG
DY	JMS	DAZ	/$Y
	JMP	SLASH1
DZ	JMS	DAZ	/$Z
	JMP	OREG
DJ	JMS	CRLF	/$J
	JMS	CREG	/CLOSE REG. IF OPEN (AND MODIFY)
LACQH	LAC	QH	/USED AS LITERAL
	AND	(77777	/GET ADDRESS PART (15 BITS)
	JMP	SLASH1
/SUBROUTINE TO CLOSE REGISTER AND COMPUTE EFFECTIVE ADDRESS
DAZ	0
	JMS	CRLF
	JMS	CREG	/CLOSE AND OPTIONALLY MODIFY REGISTER
			  /IF ONE IS OPEN
	LAC	QH	/ASSUME REGISTER CONTAINS ADDR. INST.
	JMS	REFAD	/COMPUTE ADDRESS REFERRED TO
	LAC	P	/EXECUTED IN REFAD
	JMP*	DAZ
	.EJECT
LINEF	LAW	15	/TYPE CR (LINE FEED TYPED)
	JMS	TYO
	CLA		/JIGGLE TT TO WAIT FOR CR COMP.
	JMS	TYO
	JMP	LINE
UPAR	JMS	CRLF	/^ TYPED
	CLC!SKP		/DECREMENT CUR BY 1
LINE	LAC	(1	/INCREMENT CUR BY 1
	TAD	CUR
	DAC	CUR
	JMS	CREG	/CLOSE AND OPTIONALLY MODIFY ANY OPEN REGISTER
	LAC	CUR
	JMS	PADJ	/ADJUST HEADER (CUR=.)
	XCT	AMOD	/TYPE ADDRESS
	JMP	LINE1
/+
/ OPEN REGISTER. DO NOT AND OFF ADDRESS BITS. USER IS RESPONSIBLE FOR PROPER ADDRESSING.
/-
OREG	JMS PADJ		/(RCHM-117) FIND CLOSEST FILE NAME.
LINE1	LAC	SKPN+1	/OPEN REGISTER
	DAC	OPENF
	JMS LACIP		/(RCHM-117) SET UP CONTENTS OF OPEN REGISTER.
	DAC	QH	/Q#=CONTENTS OF OPEN REGISTER
	JMS	TAB
	LAC	QH	/MODIFIED BY TYPE IN MODE
OUTMOD	JMS	INSPR
	JMS	TAB
LINE2	LAC	MODE	/GO BACK TO PERMANENT MODE
	DAC	OUTMOD
	JMP	LLR
LT	LAC	(JMP LINE2 /< - TYPE IN MODE
	DAC	OUTMOD-1 /OMIT PRINTING OF REG CONTENTS
	JMP	SLASH
RETURN	JMS	CREG	/CLOSE ANY OPEN REGISTER
	LAC	LACQH	/LEAVE TYPE IN MODE
	DAC	OUTMOD-1
	JMP	LLQ+1
	.TITLE PERFORM INDIRECTION THROUGH . (POINT)
/+
/ ROUTINE NAME: LACIP
/
/ FUNCTION: FETCH VARIABLE THROUGH . USING AUTO INCREMENT REGISTER 10.
/
/ THIS IS NECESSARY IN CASE THE USER WISHES TO EXAMINE EXTENDED MEMORY AND IS NOT
/ IN WIDE ADDRESSING MODE.
/-
LACIP	XX			/(RCHM-117) ENTRY POINT.
	LAC P			/(RCHM-124) FETCH . TO BE FETCHED.
	SAD (10)		/(RCHM-124) AR10?
	JMP LACIP1		/(RCHM-124) YES, GO FETCH IT.
	LAC* (10)		/(RCHM-117) SAVE AUTO INCREMENT REGISTER 10
	DAC SAVE10		/(RCHM-117) IN A SPARE REGISTER.
	LAC P			/(RCHM-117) FETCH THE CONTENTS OF P.
	AAC -1			/(RCHM-117) PERPARE FOR USE BY THE AUTO INCREMENT HARDWARE.
	DAC* (10)		/(RCHM-117) SET UP AIR 10.
	LAC* 10			/(RCHM-117) PERFORM OPERATION.
	LMQ			/(RCHM-117) STUFF IT IN THE MQ TEMPORARILY.
	LAC SAVE10		/(RCHM-117) RESTORE AIR 10.
	DAC* (10)		/(RCHM-117)
	LACQ			/(RCHM-117) RESTORE VALUE.
	JMP* LACIP		/(RCHM-117) RETURN TO USER.
LACIP1	LAC* (10)		/(RCHM-124) FETCH AR10 CONTENTS.
	JMP* LACIP		/(RCHM-124) RETURN.
	.EJECT
/+
/ ROUTINE NAME: DACIP
/
/ FUNCTION: STORE VARIABLE THROUGH . USING AUTO INCREMENT REGISTER 10.
/
/ THIS IS NECESSARY IN CASE THE USER WISHES TO EXAMINE EXTENDED MEMORY AND IS NOT
/ IN WIDE ADDRESSING MODE.
/-
DACIP	XX			/(RCHM-117) ENTRY POINT.
	LMQ			/(RCHM-117) SAVE CONTENTS TO BE STORED.
	LAC P			/(RCHM-124) FETCH . TO BE MODIFIED.
	SAD (10)		/(RCHM-124) AR10?
	JMP DACIP1		/(RCHM-124) YES.
	LAC* (10)		/(RCHM-117) SAVE AIR 10.
	DAC SAVE10		/(RCHM-117)
	LAC P			/(RCHM-117) FETCH ADDRESS TO BE EXAMINED.
	AAC -1			/(RCHM-117) SET UP FOR USE BY AIR HARDWARE.
	DAC* (10)		/(RCHM-117) SET UP AIR 10.
	LACQ			/(RCHM-117) FETCH QUANTITY TO BE STORED.
	DAC* 10			/(RCHM-117) PERFORM OPERATION.
	LAC SAVE10		/(RCHM-117) RESTORE AIR 10.
	DAC* (10)		/(RCHM-117)
	LACQ			/(RCHM-117) RESTORE INITIAL VALUE OF AC.
	JMP* DACIP		/(RCHM-117) RETURN TO USER.
DACIP1	LACQ			/(RCHM-124) FETCH ITEM TO BE DACED.
	DAC* (10)		/(RCHM-124) SET UP AR10.
	JMP* DACIP		/(RCHM-124) RETURN.
SAVE10	XX			/(RCHM-117)
	.TITLE MORE REGISTER EXAMINATION CODE.
/SUBROUTINE TO CLOSE AND OPTIONALLY MODIFY OPEN REG.
CREG	0
	XCT	ARGF	/IS CHANGE REQUESTED
	JMP	CREW	/NO, CLOSE REG. UNCHANGED
	LAC	ARG	/YES
	DAC	QH	/UPDATE Q#
OPENF	NOP		/SKIP IF REG. IS OPEN
	JMP*	CREG
	ISZ	MODF	/IS REGISTER LEGAL TO MODIFY
	JMP	CREW1	/NO, CLOSE REG. AND GIVE?
	JMS DACIP		/(RCHM-117) YES, MODIFY REGISTER.
CREW	LAC	NOPN+1	/CLOSE REGISTER
	DAC	OPENF
	JMP*	CREG
CREW1	LAC	NOPN+1	/TRIED TO MODIFY ILLEGAL ADDRESS
	DAC	OPENF
	JMS	MEMPRT
	LAC	QH
	JMP	CREW-1
/ADJUST HEADER
PADJ	0
	DAC	P	/UPDATE P
	JMS	ADRES	/TEST LEGAL ADDRESS
	NOP
	LAC	(JMP PADJT	/ADJUST PROGRAM HEADER
	JMS	SEARCH	/SEARCH SYMBOL TABLE
	LAC	TAB3P	/XCT IN SEARCH
	LAC	P	/EXIT P IN AC
	JMP*	PADJ
	.EJECT
/ADJUST HEADER SIFTER
PADJT	LAC	SYMT
	RAL
	SMA
	JMP	SEAGIN	/NOT FILE NAME
	LAC	TRIAL
	CMA!IAC	/(RCHM-114) 
	TAD	P
	SPA
	JMP	SEAGIN	/NOT < OR = P
	DAC	ADRES
	CMA!IAC	/(RCHM-114) 
	TAD	DIFF
	SPA
	JMP	SEAGIN	/NOT CLOSER
	LAC	ADRES	/UPDATE TRIAL HEADER
	DAC	DIFF
	LAC	TRIAL
	DAC	H
	LAC	TABP
	DAC	HEAD
	JMP	SEAGIN
/CALCULATE ADDRESS REFERRED TO
/	LAC	INST	/AC INSTRUCTION REFERRING TO ADDRESS
/	JMS	REFAD
/	LAC	(INST
/DESTROYS PREVIOUS CONTENTS OF PRINT
/LEAVES EFFECTIVE ADDRESS REFERRED TO IN AC
REFAD	0
	AND	(37777	/PEEL OFF INST. OP CODE
	DAC	PRINT
	AND (77770)		/(RCHM-115) EXTRACT INDEX, INDIRECT AND AR ADDRESS.
	SBA			/(RCHM-115) IS THIS RUNNING IN PAGE MODE?
	AND (67770)		/(RCHM-115) YES, REMOVE POSSIBLE XR BIT.
	XOR	(20010
	SZA		/SKIP IF AUTO-INCREMENT REGISTER REFERRED TO
	XCT*	REFAD	/LOAD BANK BITS INTO AC
	ISZ	REFAD	/SKIP OVER ARG. ON RETURN
	XOR	PRINT	/SPLICE BANK BITS INTO ADDRESS
	AND (70000)		/(RCHM-115) EXTRACT BANK AND PAGE BITS FROM ADDRESS.
	SBA			/(RCHM-115) IS THIS RUNNING IN BANK MODE?
	SKP			/(RCHM-115) NO, RETAIN PAGE BITS.
	AND (60000)		/(RCHM-115) OTHERWISE EXTRACT ONLY BANK BITS.
	XOR	PRINT
	JMP*	REFAD
	.TITLE ADDRESS TEST ROUTINE.
ADRES	0
	DAC	SHOT		/ SAVE ADDRESS TO BE TESTED.
	TAD	TOP		/ WILL THIS ADDRESS LEAD TO NEXM?
	SMA			/ SKIP IF NOT.
	JMP	ERR		/ YES IT WILL, DO NOT ALLOW.
	LAC	SHOT		/ FETCH ADDRESS TO BE TESTED.
	CMA			/ CONVERT TO -ADDRESS-1.
	TAD	PAH		/ CHECK IF TRYING TO ACCESS THE MONITOR.
	SPA
	JMP	ADRES1		/ADDRESS IS ABOVE PATCH AREA BEG.
	LAC	SHOT		/ADDRESS IS BELOW PATCH AREA
	AND	(77770		/ SEE IF THE ADDRESS BEING ACCESSED IS AN AUTO INCREMENT.
	SAD	(10		/ IS IT?
	JMP	ADRES4	/ADDRESS IS INDEX REG.; IT MAY BE MODIFIED BUT OTHERWISE ILLEGAL
ADRES2	DZM	MODF	/ILLEGAL ADDRESS MAY NOT BE MODIFIED
	JMP	ADRES3
ADRES1	LAC	LIM1		/ SEE IF ACCESSING WITHIN DDT.
	CMA
	TAD	SHOT		/ CHECK ADDRESS.
	SPA			/(RCHM-118) IS HE WITHIN DDT?
	JMP	ADRES0		/(RCHM-118) YES, DO NOT ALLOW MODIFICATION.
	LAC SHOT		/(RCHM-118) FETCH ADDRESS BEING SOUGHT.
	TAD TP			/(RCHM-118) SUBTRACT THE TOP OF DDT.
	SPA			/(RCHM-118) IS HE ABOVE DDT?
	JMP ADRES2		/(RCHM-118) NO, DO NOT ALLOW MODIFICATION.
ADRES0	ISZ	ADRES		/(RCHM-118) SKIP ON RETURN IF ADDRESS IS LEGAL
ADRES4	CLC		/ADDRESS MODIFIABLE
	DAC	MODF
ADRES3	LAC	SHOT	/EXIT WITH ADDRESS IN AC
	JMP*	ADRES
	.TITLE	RETYPE COMMAND ROUTINES AND MODE CHANGING ROUTINES
/
/TYPE OUT ROUTINES
BAKAR	JMS	PRINT	/PRINT AS SYMBOLIC INSTRUCTION(LEFT ARROW)
	JMS	INSPR
EQUAL	JMS	PRINT	/PRINT AS UNSIGNED OCTAL NUMBER (=)
	JMS	OINSPR
COLON	JMS	PRINT	/PRINT AS TRANSFER VECTOR IN CURRENT ADDRESS MODE (:)
AMOD	JMS	ADRPR	/CURRENT ADDRESS MODE INST.
/
/ PRINT THE CONTENTS OF Q# AS A CHARACTER STRING. THE ONLY ROUTINE WHICH
/ DOES NOT DOO THIS IS ?. ALL OTHER ROUTINES ARE CAPABLE OF PROCESSING
/ ONLY A SINGLE WORD AT A TIME ANYWAY.
/
QUES	XCT ALTF2		/(RCHM-121) RAD 50 OUTPUT?
	JMP QUES1		/(RCHM-121) YES.
	XCT ALTF		/(RCHM-121) SIXBIT OUTPUT?
	JMP QUES2		/(RCHM-121) YES.
	JMS PRINT		/(RCHM-121) 5/7 ASCII.
LJMS57	JMS P57			/(RCHM-121) PRINT 5/7 ASCII.
QUES1	JMS PRINT		/(RCHM-121) RAD50 OUTPUT.
	JMS SQPR		/(RCHM-121) PRINT RAD50.
QUES2	JMS PRINT		/(RCHM-121) SIXBIT OUTPUT.
	JMS SIXBIT		/(RCHM-121) PRINT SIXBIT.
/PRINT AC OR Q# IN SPECIFIED MODE
PRINT	0
	XCT	ARGF
	LAC	QH
	DAC	QH	/UPDATE Q#
	LAC NOPN+1		/(RCHM-125) REMOVE BLANK SUPPRESSION FOR
	DAC B.SUPR		/(RCHM-125) THIS CYCLE OF PRINTING.
	LAC QH			/(RCHM-125) FETCH ITEM TO BE PRINTED.
	XCT*	PRINT	/PRINT
	JMS	TAB	/TAB
	JMP	LLQ+1
/CHANGE INSTRUCTION PRINT MODE
DO1	LAC	EQUAL+1		/$O - PRINT INST. AS OCTAL NUMBER
	SKP
DS	LAC	BAKAR+1		/$S - PRINT INST. SYMBOLIC
	XCT ALTF2		/(RCHM-120) $$S - PRINT SIXBIT.
	LAC (JMS SIXBIT)	/(RCHM-120) FETCH SWITCH.
	SKP
DT	LAC LJMS57		/(RCHM-121) $T - PRINT AS 5/7 PACKED ASCII.
	SKP
DV	LAC	AMOD		/$V - PRINT AS TRANSFER VECTOR
DV1	DAC MODE		/(RCHM-120) CHANGE PERMANENT MODE.
	DAC	OUTMOD
	JMP	LLQ
/CHANGE ADDRESS PRINT MODE
DR	LAC (JMS ADRPR)		/$R - PRINT ADDRESS RELATIVE SYMBOLIC
	XCT ALTF2		/(RCHM-120) DID $$R OCCUR?
	SKP			/(RCHM-120) YES.
	JMP DF1			/(RCHM-120) NO.
	LAC (JMS SQPR)		/(RCHM-120) FETCH JMS TO OUTPUT ROUTINE.
	JMP DV1			/(RCHM-120) SET UP OUTPUT MODE.
DA	LAC	AHA+3		/$A - PRINT ADDRESS IN ABSOLUTE OCTAL
	SKP
DF	LAC	ADRPR1+1		/$F - PRINT ADDRESS IN RELOCATABLE FLOATING ADDRESSES
DF1	DAC AMOD		/(RCHM-120) SET UP ADDRESS OUTPUT MODE.
	JMP	LLQ
/CHANGE PROTECT MODE
DAT	LAC	SKPN+1
	XCT	ALTF
	LAC	NOPN+1
	DAC	ALTERF
	JMP	LLQ
	.TITLE	SYMBOLIC INSTRUCTION PRINT
/
/SYMBOLIC INSTRUCTION PRINT ROUTINE
/INSTRUCTION IN AC
INSPR	0
	DAC	VALUE	/INST. IN VALUE
	AND	(777000
	DAC	PRINT
	AND	NOPN+1	/740000
	DAC	NUM	/OP CODE IN NUM
	SAD	NOPN+1
	JMP	SPOPR	/OPR OR LAW INSTRUCTION
	SNA
	JMP	SCAL	/CAL INSTRUCTION
	SAD	DACN+1
	JMP	ADINST	/LAC INSTRUCTION
	LAC	(SAD VALUE	/LOOK FOR EXACT MATCH IN DDT SYMBOL TABLE
	JMS	SEARCH
	LAC	TAB4P	/DO NOT INCLUDE Q#
	LAC	(SYMT	/EXACT MATCH FOUND
	JMS	TYPEM	/TYPE MNEMONIC
	JMP*	INSPR	/EXIT
NOLUCK	LAC	NUM	/EXACT MATCH NOT FOUND
	SAD	IOTN+1
	JMP	SIOT	/IOT INST.
	SAD	EAEN+1
	JMP	SEAE	/EAE INST.
ADINST	LAC	(SAD NUM	/ONLY POSSIBILITY LEFT IS ADDRESS INSTRUCTION
	JMS	SEARCH	/SEARCH FOR ONLY OP CODE MATCH
	LAC	TAB4P	/DO NOT LOOK AT Q# ENTRY
	LAC	(SYMT	/TYPE OP CODE MNEMONIC
	JMS	TYPEM
	LAC	VALUE
	AND	(20000
	SNA
	JMP	SYMPR1	/INDIRECT BIT MISSING
	LAW	52	/*
	JMS	TYO
SYMPR1	LAW	40	/SPACE
	JMS	TYO
	LAC	VALUE	/CALCULATE ADDRESS REFERRED TO
	JMS	REFAD
	LAC	P	/XCT IN REFAD
	XCT	AMOD	/TYPE ADDRESS IN CURRENT MODE
	.EJECT
	JMPB EINSPR		/(RCHM-115) WER ARE ALL DONE IF RUNNING IN BANK MODE.
	LAC	PRINT
	AND	(10000
	SNA
	JMP*	INSPR
	LAW	54	/,
	JMS	TYO
	LAW	130	/X
	JMS	TYO
EINSPR	JMP*	INSPR		/(RCHM-115) RETURN TO CALLER.
SIOT	LAC	PRINT
	SAD	AACN+1
	LAC	AACN
	SAD	AXSN+1
	LAC	AXSN
	SAD	AXRN+1
	LAC	AXRN
	SPA
	JMP	SIOT1
	JMS	SQPR
	LAC	VALUE
	AND	(777
	DAC	VALUE
	AND	(400
	SZA
	LAW	17000
	XOR	VALUE
	DAC	VALUE
	SPA
	JMP	SPLAW1
	SNA
	JMP*	INSPR
	LAW	40
	JMP	SCAL-1
SIOT1	LAC	IOTN
	SKP
SEAE	LAC	EAEN	/OR EAE +
	JMS	SQPR
	LAC	VALUE	/TRIM OFF OP CODE
	AND	(37777
SYMPR2	DAC	VALUE
	SNA		/QUIT IF REMAINDER 0
	JMP*	INSPR
	LAW	53	/+
	JMS	TYO
SCAL	LAC	VALUE	/PRINT VALUE IN OCTAL WITH 0 SUPPRESSION
	JMS	OADRPR
	JMP*	INSPR
	.EJECT
SPOPR	LAW		/OPR OR LAW INSTRUCTION
	AND	VALUE
	SAD	.-2
	JMP	SPLAW	/LAW INSTRUCTION
	DZM	TYI	/OPR INSTRUCTION - OMIT FIRST!
CM1	LAW	-1	/ALL BITS MUST MATCH IN RESULT
	DAC	NECES
SPRAY	LAC	(JMP STOPR	/SEARCH FOR CONSTITUENT ORR'S
	JMS	SEARCH
	LAC	TAB4P	/DO NOT INCLUDE Q#
	LAC	DIFF
	SAD	(377777
	JMP	SPLAT	/NO LUCK THIS TIME
	LAC	BEST
	CMA
	AND	NECES
	DAC	NECES	/REDUCE BITS NEEDED
	LAC	TYI	/INITIALLY 0
	SZA
	JMS	TYO	/TYPE!
	LAW	41	/SET UP FOR NEXT TIME
	DAC	TYI
	LAC	(SYM	/TYPE MNEMONIC FOUND
	JMS	TYPEM
	JMP	SPRAY
SPLAT	LAC	NECES
	AND	VALUE
	JMP	SYMPR2
SPLAW	LAC	LAWN	/TYPE LAW
	JMS	SQPR
SPLAW1	LAW	40	/SPACE
	JMS	TYO
	LAW	55	/-
	JMS	TYO
	LAC	VALUE
	CMA!IAC	/(RCHM-114) 
	JMP	SCAL+1
	.EJECT
/TO SEARCH FOR CLOSEST SYMBOL IN VALUE
SEARCH	0
	DAC	SEATES	/DEPOSIT TEST SWITCH
	LAC	(377777
	DAC	DIFF	/GOODNESS OF FIT SET TO POOREST
	XCT*	SEARCH	/FETCH POINTER TO FIRST SYMBOL ENTRY
	ISZ	SEARCH	/SKIP OVER ARGUMENT ON EXIT
	DAC	TAB
	LAC	NOPN+1	/INITIALIZE SEARCH FLAG
	DAC	SEFLG
SEAGIN	JMS	GETSYM	/FETCH NEXT SYMBOL
	JMP*	SEARCH	/END OF TABLE REACHED
SEATES	SAD	VALUE	/MODIFIED SWITCH
	JMP*	SEARCH	/RETURN WITH MATCH
	LAC	TAB	/IS DDT SYMBOL TABLE DONE
	SAD	TAB3M
	JMP	NOLUCK	/YES
	JMP	SEAGIN	/NO, TRY NEXT ENTRY
	.TITLE	ROUTINES FOR OUTPUT OF MICRO-CODED OPERATE INSTRUCTIONS
/
/OPERATE TEST SEQUENCE
STOPR	AND	VALUE
	SAD	TRIAL
	CMA!SKP
	JMP	SEAGIN	/VALUE DOES NOT CONTAIN AT LEAST ALL THE 1'S THAT TRIAL DOES
	AND	NUM
	SZA!CLL
	JMP	SEAGIN	/TRIAL NOT OPR INSTRUCTION
	LAC	TRIAL
	CMA!IAC	/(RCHM-114) 
	TAD	VALUE
	DAC	CH
	LAC	NECES
	AND	TRIAL
	SNA
	JMP	SEAGIN	/NO NEW BITS MATCH
SEAOK	LAC	CH	/IS THIS A BETTER MATCH
	SMA
	CMA!IAC	/(RCHM-114) 
	TAD	DIFF
	SPA
	JMP	SEAGIN	/NOT BETTER MATCH
	SZA
	JMP	SEAOK1
	LAC	SYMT
	AND	LACN+1
	SZA
	JMP	SEAGIN
SEAOK1	LAC	SYMT	/SAVE BETTER MATCH
	DAC	SYM
	LAC	BOLT
	DAC	BOL
	LAC	TRIAL
	DAC	BEST
	LAC	CH
	SPA
	CMA!IAC	/(RCHM-114) 
	DAC	DIFF	/ABSOLUTE DIFFERENCE
	JMP	SEAGIN
	.TITLE	ADDRESS OUTPUT ROUTINES
/
/SYMBOLIC ADDRESS PRINT
ADRPR	0
	DAC HABITS		/(RCHM-117) SAVE FOR LATER.
	AND	(77777	/TRIM OFF EXTRA BITS
	DAC	VALUE
	LAC	(JMP ADR1	/SEARCH FOR CLOSET ADDRESS
	JMS	SEARCH
	LAC	TAB3P	/OMIT SPECIAL ADDRESSES ON OUTPUT
	LAC	DIFF
	SAD	(377777
	JMP	ADRPR1	/NO ADDRESS WITHIN 100 OCTAL
	JMS HBT			/(RCHM-117) PRINT HIGH BITS IF NECESSARY.
	LAC	(SYM	/TYPE ADDRESS MNEMONIC
	JMS	TYPEM
	LAC	BEST	/DIFFERENCE IN BEST
	SNA!RAL		/SAVE SIGN IN LINK
	JMP*	ADRPR	/EXACT MATCH
	LAW	53	/+
	SZL
	LAW	55	/-
	JMS	TYO
	LAC	DIFF	/ABSOLUTE DIFFERENCE IN DIFF
	JMS	OADRPR	/PRINT IN OCTAL WITH 0 SUP.
	JMP*	ADRPR
ADRPR1	LAC HABITS		/(RCHM-117) FETCH ORIGINAL ARGUMENT.
	JMS	RADRPR	/TYPE RELATIVE ADDRESS
	JMP*	ADRPR
/ADDRESS TEST ROUTINE
ADR1	SPA
	JMP	SEAGIN	/ADDRESS MUST BE POSITIVE
	CMA!IAC	/(RCHM-114) 
	TAD	VALUE
	DAC	TRIAL	/VALUE AND SIGN OF MISMATCH
	DAC	CH
	SPA
	CMA!IAC	/(RCHM-114) 
	TAD	LIMIT	/CHECK DISTANCE
	SMA
	JMP	SEAGIN	/TOO DISTANT
	JMP	SEAOK	/WITHIN RANGE
	.EJECT
/RELATIVE ADDRESS PRINT
RADRPR	0
	DAC HABITS		/(RCHM-117) SAVE FOR LATER.
	JMS HBT			/(RCHM-117) PRINT HIGH ORDER BITS IF NECESSARY.
	LAC HABITS		/(RCHM-117) FETCH ORIGINAL ARGUMENT.
	AND	(77777	/TRIM EXCESS BITS
	DAC	VALUE
	LAC	H	/COMPUTE RELATIVE ADDRESS
	CMA!IAC	/(RCHM-114) 
	TAD	VALUE
	SPA
	JMP	RADR1	/PRINT NEG. RELATIVE ADDRESS IN OCTAL
	DAC	VALUE
	LAW	43	/#
	JMS	TYO
	LAW	53	/+
	JMS	TYO
RADR1	LAC	VALUE
	JMS	OADRPR
	JMP*	RADRPR
/OCTAL PRINT WITH 0 SUPPRESSION
OADRPR	0
	DAC	VALUE
	LAW	-6	/6 OCTAL DIGITS
	DAC OCC			/(RCHM-114) SET UP CHARACTER COUNTER.
TYPE61	LAC	VALUE	/WORD IN VALUE
	RTL
	RAL
	DAC	VALUE
	RAL
	AND	(7
	SNA
	JMP	.+3
	DZM	SUP	/NONZERO DIGIT
	SKP		/ALWAYS TYPE
	SAD	SUP	/TYPE 0?
	JMP	TYPE62	/TYPE DIGIT
	LAW	17777	/IGNORE ALL BUT FINAL 0
	SAD OCC			/(RCHM-114) LAST DIGIT YET?
	SKP!CLA		/TYPE FINAL 0
	JMP	.+3
TYPE62	XOR	(60	/SET UP ASCII
	JMS	TYO
	ISZ OCC			/(RCHM-114) DONE WITH 6 DIGITS YET?
	JMP	TYPE61	/NO, GO BACK
	ISZ	SUP	/NEXT NUMBE 0 SUPPRESSED
	JMP*	OADRPR
OCC	0			/(RCHM-114) (O)CTAL (C)HARACTER (C)OUNTER.
/OCTAL PRINT WITHOUT 0 SUPPRESSION
OINSPR	0
	DZM	SUP
	JMS	OADRPR
	JMP*	OINSPR
	.TITLE HIGH ORDER ADDRESS BITS PRINT ROUTINE.
/+
/ PRINT THE CONSTRUCT N00000+ IF ANY BITS ARE SET IN THE HIGH BITS OF THE ARGUMENT
/ WORD.
/-
HBT	XX			/(RCHM-117) ENTRY POINT.
	LAC HABITS		/(RCHM-117) FETCH ARGUEMENT.
	AND (700000)		/(RCHM-117) SEE IF WE ARE TO PRINT ANYTHING.
	SNA			/(RCHM-117) YES, PRINT FLAG WORD.
	JMP* HBT		/(RCHM-117) LEAVE.
	JMS OADRPR		/(RCHM-117) PRINT OCTAL VALUE.
	LAW 53			/(RCHM-117) FETCH '+'
	JMS TYO			/(RCHM-117) PRINT IT.
	JMP* HBT		/(RCHM-117) ALL DONE, LEAVE.
HABITS	XX			/(RCHM-117) (H)IGH (A)DDRESS (BITS).
	.TITLE	WORD SEARCH PROCESSOR
/
/SEARCHES
WORD	LAC	SZAN+1	/$W - SEARCH FOR EQUAL WORDS
	SKP
NOT	LAC	SNAN+1	/$N - SEARCH FOR UNEQUAL WORDS
	DAC	TEST
	JMS	WHAT
	XOR	ARG
WHO	AND	FIRST	/MASK IN FIRST ARGUMENT
TEST	SZA
	JMP	WHY
AHA	JMS	CRLF	/FOUND QUALIFIED REGISTER
	LAC	CREG
	DAC	P
	JMS	OADRPR	/PRINT ADDRESS IN OCTAL
	JMS	TAB
	LAC*	CREG
	XCT	OUTMOD	/PRINT CONTENTS IN CURRENT MODE
WHY	ISZ	CREG	/MOVE TO NEXT ADDRESS
	ISZ	DAZ	/ARE WE THROUGH?
	JMP	OHO	/NO
	JMP	LLQ	/YES
/PRINT . AND .+1 AS 5/7 PACKED ASCII
P571	0
	0
	.ASCII <175>
	.LOC	.-1
P57	0
	JMS LACIP		/(RCHM-117) PICK UP FIRST WORD OF PAIR.
	DAC	P571
	ISZ	P
	JMS LACIP		/(RCHM-117) PICK UP SECOND WORD OF PAIR.
	DAC	P571+1
	JMS	PASC		/PRINT WORD PAIR
	P571-2
	JMP*	P57
	.EJECT
/SET UP SEARCH
WHAT	0
	LAC	LOH
	DAC	CREG
	LAC	HIH
	JMS	ADRES
	NOP
	CMA
	TAD	LOH
	DAC	DAZ
	SMA
	JMP	ERR	/LO > HI
	LAC	MKH	/M# IS DEFAULT MASK
	XCT	FARGF
	DAC	FIRST
OHO	LAC*	CREG	/FETCH CONTENTS OF NEXT REGISTER
	JMP*	WHAT	/RETURN TO TEST ROUTINE
	.EJECT
ADRS	LAC	SZAN+1	/$ E-EFFECTIVE ADDRESS SEARCH
	DAC	TEST
	JMS	WHAT
	AND	NOPN+1	/CHECK IF REGISTER CONTAINS AN
	SPA!SNA		/ADDRESS INSTRUCTION
	TAD	SADN+1	/540000
	SPA
	JMP	WHY	/NOT ADDRESS INSTRUCTION
	LAC*	CREG	/CALCULATE ADDRESS REFERRED TO DIRECTLY
	JMS	REFAD
	LAC	CREG	/XCT IN REFAD
	DAC	SHOT3
	JMPB ADRSA		/(RCHM-115) FORGET XR IF BANK MODE.
	LAC*	CREG
	AND	(30000
	XOR	(10000
	SNA!CLA
	LAC	XH
	TAD	SHOT3
ADRSA	XOR	ARG		/(RCHM-115) COMPLETE ADDRESS CALCULATION.
	AND	(77777
	AND	FIRST	/MASK BEFORE CHECKING
	SNA
	JMP	AHA	/MATCH
	LAC*	CREG	/IS INST. INDIRECT REFERENCE
	AND	(20000
	SNA
	JMP	WHY	/NO, TRY NEXT REGISTER
	LAC	SHOT3	/YES, IS REGISTER INDEX REG.
	AND	(77770
	XOR	(10
	SNA!CLA
	TAD	(1	/YES, ADD 1
	TAD*	SHOT3
	JMPB ADRSB		/(RCHM-115) FORGET XR IF BANK MODE.
	DAC	SHOT3
	LAC*	CREG
	AND	(10000
	SZA
	LAC	XH
	TAD	SHOT3
ADRSB	XOR ARG			/(RCHM-115) REGISTER IS SAME.
	AND	(77777
	JMP	WHO
	.EJECT
/SET SEARCH LIMITS
DL	XCT	ARGF	/$L
	LAC	LKH1	/2ND REG. OF DDT IS DEFAULT UPPER LIMIT
	DAC	HIH
	LAC	FIRST
	XCT	FARGF
	LAC	PAH	/1ST REG. OF PATCH AREA IS DEFAULT
			/LOWER LIMIT
	DAC	LOH
	JMP	LLQ
/INITIALIZE MEMORY TO A CONSTANT
DM	JMS	WHAT	/$M
	LAC	CREG
	JMS	ADRES
	JMP	.+3	/ADDRESS MUST BE LEGAL
	LAC	ARG
	DAC*	CREG
	JMP	WHY
	.TITLE	SYMBOL TABLE MANIPULATION ROUTINES
/
/DEFINING A SYMBOL
CLOSEP	XCT	LETF	/)
	JMP	ERR	/SYMBOL IS ILLEGAL
	LAC	P	/. IS DEFAULT VALUE FOR SYMBOL
	XCT	FARGF
	DAC	FIRST
	LAC	(JMP NEWSYM
	DAC	SCAN+1	/INTERCEPT ERROR ON SYMBOL NOT FOUND
	JMS	EVAL
	LAC	TABP	/SYMBOL FOUND
	CMA
	TAD	TAB3M1
	SPA!CLC
	JMP	CLOSE1	/OBJECT TIME SYMBOLS MAY BE REDEFINED
	LAW	130	/X-SYMBOL MAY NOT BE REDEFINED
	JMS	TYO
	JMP	CLOSE2
CLOSE1	TAD	TAB
	DAC	TAB
	LAC	FIRST
	DAC*	TAB	/REDEFINE SYMBOL
	JMP	CLOSE2
NEWSYM	LAC	TAB3M	/SYMBOL NOT FOUND
	DAC	TAB
	LAC	BOL
	SZA!CLA!STL
	RAR		/PUT 1 IN SIGN BIT
	XOR	SYM
	JMS	QUASH
	LAC	BOL
	SZA
	JMS	QUASH
	LAC	FIRST
	JMS	QUASH
	LAC	TAB	/INCLUDE NEW ENTRY IN DDT SYMBOL TABLE
	DAC	TAB3M
CLOSE2	LAC	(JMP LOSE	/REPLACE ERROR JUMP
	DAC	SCAN+1
	JMP	LLQ
	.EJECT
/ADD TO SYMBOL TABLE
QUASH	003340
	DAC*	TAB
	ISZ	TAB
	LAC	TAB
	SAD	TABMAX
	SKP
	JMP*	QUASH
	LAW	117	/O - OVERFLOW
	JMS	TYO
	JMP	CLOSE2
/KILL SYMBOLS $K
DKAY	LAC	TAB3M1
	DAC	TAB3M
	LAC	PAH
	JMP	DK1
DK	XCT	ARGF
	JMP	DKAY
	SZA
	JMP	ERR	/ARGUMENT MUST BE 0
	LAC	LOWSYM	/SET MAXIMUM+1 OF TABLE TO
			/BEGINNING
	DAC	PAH
DK1	DAC	H	/ALSO RELOCATION FACTOR
	LAC	(PAH-1	/INITIALIZE HEADER
	DAC	HEAD
	LAC	P
	JMS	PADJ
	JMP	LLQ
/MISCELLANEOUS COMMANDS
DH	XCT	ARGF	/$H-MAKE HEADER CURRENT
	LAC	SAH		/STARTING ADDRESS OF PROGRAM IS DEFAULT HEADER ARG
	JMS	PADJ
	JMP	LLQ
DU	DAC	ACH	/$U - RESET AC AND LINK
	LAC	FIRST
	DAC	LKH
	JMP	LLQ
D0	JMS	EVAL		/$0 - SET UP AUTO-INDEX REG. USED BY DDT
	XCT	ARGF
	LAC	(7	/DEFAULT REGISTER IS 17
	AND	(7
	XOR	(10
	DAC	AXH
	JMP	LLQ
	.TITLE	TELETYPE I/O ROUTINES
/
/TYPING ROUTINES
TYI	.SCOM+3		/READ ONE CHARACTER
	CAL	3776	/.READ
	10
	SHOT		/INPUT BUFFER
	-3		/READ 1 CHARACTER
	.WAIT	-2
	JMP*	TYI
/INPUT BUFFER
SHOT	-1
SHOT1	.SCOM+1		/POINTS TO ADDRESS OF FIRST WORD OF SYMBOL TABLE
CH	130357		/TYPED CHARACTER
TYO	055170		/TYPE CHARACTER IN RIGHT
	DAC	SHOT3	/JUSTIFIED 7 BIT ASCII
	CAL	3775	/.WRITE
	11
	BLOTCH		/OUTPUT BUFFER
	-3
	.WAIT	-3	/WAIT FOR COMPLETION
	JMP*	TYO
BLOTCH	2005		/OUTPUT BUFFER HEADER WORD
SHOT2	.SCOM+2		/POINTS ADDR. +1 OF SYMBOL WORD TABLE END
SHOT3	.SCOM+6		/POINTS USER STARTING ADDRESS CHANGED TO DDT STARTING ADDRESS
	377		/RUBOUT- IGNORED BY TTY HANDLERS
	.EJECT
TAB	.SCOM+11		/TYPE TAB
	LAW	11
	JMS	TYO
	JMP*	TAB
CRLF	0		/TYPE CAR. RET. OR LINE FEED
	CAL	775		/.INIT TT
	1
	XCT+STARET		/^T ADDRESS
	0
	.WAIT	-3
	JMP*	CRLF
	.EJECT
/
/	ROUTINE TO PRINT THE TEST STRING POINTED TO BY THE ARGUMENT
/
PASC	0
	LAC*	PASC		/FETCH TRANSFER VECTOR
	ISZ	PASC		/BUMP TO RETURN
	DAC	.+3		/PUT INTO CAL
	-3&777+2000		/.WRITE IOPS .ASCII -3
	11
	XX
	-46
	.WAIT	-3		/.WAIT FOR COMPLETION
	JMP*	PASC
	.TITLE	RADIX 50 TRANSLATION AND OUTPUT ROUTINE
/
/TYPE MESSAGE IN RADIX 50
TYPEM	0
	DZM	SPACF	/FILE NAME FALG
	DAC	SUP	/ADDRESS OF MESSAGE
TYPEM1	LAC*	SUP
	JMS	SQPR	/PRINT 3 SQOZE
	LAC*	SUP	
	ISZ	SUP	/INCREMENT POINTER
	RAL
	SPA!CLC
	DAC	SPACF	/BIT 1=1 INDICATES FILE NAME
	SZL		/BIT 0=1 INDICATES CONTINUATION
	JMP	TYPEM1
	LAW	47	/' MEANS FILE NAME
	ISZ	SPACF
	SKP
	JMS	TYO	/TYPE FINAL ' FOR FILE NAME
	JMP*	TYPEM
	.EJECT
/OUTPUT 3 CHARACTERS FROM RADIX 50
SQPR	0
	AND	(177777	/TRIM OFF TOP 2 FLAG BITS
	DAC	OADRPR
	LAW	-3	/PRINT 3
	DAC	RADRPR
	LAC	(M3100	/ADDRESS OF CONVERSION RADIX CONSTANTS
	DAC	OINSPR
SQPR1	LAC	OADRPR	/SIMULATED DIVIDE
	DZM	CHA	/QUOTIENT
	TAD*	OINSPR	/DIVISOR
	SPA
	JMP	SQPR2
	ISZ	CHA
	DAC	OADRPR	/REMAINDER
	JMP	SQPR1+2
SQPR2	LAC	CHA	/PRINT SQOZE
	SZA			/(RCHM-125) BLANK?
	JMP SQPR2A		/(RCHM-125) NO.
	LAW -40			/(RCHM-125) FETCH MAGIC CODE JUST IN CASE.
	XCT B.SUPR		/(RCHM-125) SUPPRESS BLANK?
	SKP			/(RCHM-125) NO.
	JMP SQPR3		/(RCHM-125) YES.
SQPR2A	TAD	(-34		/(RCHM-125) TRANSLATE TO ASCII
	SNA!CMA
	LAW		/.(56)
	SNA!CMA
	LAW	111	/%(45)
	SMA
	TAD	(-55	/NUMBERS AND.
	TAD	(134
	SAD	(72
	LAW	243	/#43
	JMS	TYO
SQPR3	ISZ	OINSPR	/NEW DIVISOR
	ISZ	RADRPR	/THROUGH?
	JMP	SQPR1	/NO
	JMP*	SQPR	/YES
	.TITLE (RCHM-120) OUTPUT 3 CHARACTERS AS 6BIT.
/
SIXBIT	XX			/(RCHM-120)
	LMQ			/(RCHM-120) SAVE IN MQ.
	LAW -3			/(RCHM-120) FETCH CHARACTER COUNT.
	DAC RADRPR		/(RCHM-120) SET UP LOOP COUNT.
SIXBT1	CLA			/(RCHM-120) CLEAR AC.
	LLS 6			/(RCHM-120) FETCH CHARACTER.
	XOR (40)		/(RCHM-120) CONVERT TO 7 BIT.
	TAD (40)		/(RCHM-120)
	JMS TYO			/(RCHM-120) PRINT CHARACTER.
	ISZ RADRPR		/(RCHM-120) DONE YET?
	JMP SIXBT1		/(RCHM-120) NOT YET.
	JMP* SIXBIT		/(RCHM-120)
	.END START
