
%RBRKS	0
	LAC*	%T1
	SAD	%BRKIN
	LAC	%T2		/FETCH USER INSTRUCTION
	DAC*	%T1		/DEPOSIT FOR BREAK #1
	.IFUND %%OB
	LAC*	%T1+1
	SAD	%BRKIN
	LAC	%T2+1
	DAC*	%T1+1		/DEPOSIT FOR BREAK #2
	LAC*	%T1+2
	SAD	%BRKIN
	LAC	%T2+2
	DAC*	%T1+2		/DEPOSIT FOR BREAK #3
	LAC*	%T1+3
	SAD	%BRKIN
	LAC	%T2+3
	DAC*	%T1+3		/DEPOSIT FOR BREAK #4
	.ENDC
	JMP*	%RBRKS		/RETURN
	.ENDC
/
/BAD BREAKPOINT ENTRY. CAN'T FIND RETURN POINT.
/SHOULD NOT HAPPEN.
%BERR	JMS	%IORES		/IO RESET
	JMS	%CRLF
	LAW	%BERRM		/PRINT 'BAD BREAK ENTRY'
%REENA	JMS	%TYPMG
	JMS	%CRLF
%HALT	HLT
	JMP	%REST		/RESTART
%BERRM	.SIXBT	/BAD BREAK ENTRY@/
/RESET USER INSTRUCTION IN LOC. 1 IF PRESENT
/CONTENTS ARE=JMP* 2. AND 2 EQUALS %INT (ADDRESS OF ODT INT SUBR.)
%RLOC1	0
	LAC*	%LL02		/LOCATION 2
	SAD %JINT
	SKP
	JMP*	%RLOC1
	LAC	%LOC1
	DAC*	%LL01
	LAC	%LOC2
	DAC* %LL02
	JMP*	%RLOC1		/EXIT
/********** ($C).PROCEED CODE **********
/
/
%C	JMS	%SEEND		/SEEN $
	LAC	%N		/YES
	SNA			/BREAK IN PROGRESS
	JMP	%QUEST		/NO-ERROR
	LAC	%WORDS		/GET INPUT #
	SZA!CMA			/IF 0, GET A -1
	TAD	%LL01		/FORM 2'S COMP.
	.IFUND	%%OB
	DAC*	%TP3		/SET COUNT
	.ENDC
	.IFDEF	%%OB
	DAC	%T3
	.ENDC
%C1=.
	LAC*	%PC		/GET USER INSTRUCTION
	.IFUND	%%X
	ISZ	%SKPX		/WAS A SKIP EXECUTED WITH $X?
	.ENDC
	SKP				/NO
%C3	LAC	%LNOP		/YES -DO NOT EXECUTE USER INSTRUCTION
/
%XCTA	DAC %INSTX		/SAVE FOR EXECUTION
	.IFUND %%MULD
	LAC %LNOP		/INSERT NOP IN CASE OF OPR,IOT
	DAC %INSTX-1
	LAC %INSTX
	.ENDC
/
/EXAMINE INSTRUCTION FOR SPECIAL CASES.
/
	AND %LNOP
	DAC %SAV1		/SAVE OP-CODE
	SAD %LNOP
	JMP %C2		/OPERATE--GO EXECUTE.
	.IFUND	%%MULD
	SAD %LEAE
	JMP	%EAE		/ EAE CLASS
	.ENDC
	SNA
	JMP %CAL		/CAL
	SAD %LIOT
	JMP %IOT		/IOT CLASS
/
/	GET EFFECTIVE ADR. STORE IN %SAV2.
/
/THE INSTRUCTION IS A MEMORY REFERENCE.
/THIS PROGRAM MAY BE OPERATING IN EITHER PAGE OR BANK MODE.
/FOR THIS REASON, THE USERS EFFECTIVE ADDRESS MUST BE
/REFERENCED INDIRECTLY BY ODT15. IF THE USERS DIRECT
/ADDRESS IS POINTING TO ONE OF THE AUTO-INDEX REGISTERS,
/INCREMENT THE CONTENTS OF THAT REGISTER BEFORE DOING
/ANYTHING ELSE.
/
	LAC	%INSTX		/ALL 18-BITS OF USER INSTR.
	AND	%L347S		/DROP OFF LEFT-MOST 4 BITS AND
	TAD	%LLAC		/ADD THE OPERATOR 'LAC'.
	DAC	%AUTO		/IF THIS IS AN AUTOINDEX, IT WILL BE
	AND	%L147S		/INCREMENTED AT %AUTO (IF INDIRECT).
	DAC	%SAV2		/13-BITS OF USER ADDRESS.
	AND	%L47S
	DAC	%SAV4		/12-BITS.
%AUTO	XX
	LAC	%XMODE		/WHAT MODE?
	SZA			/0=PAGE MODE.
	JMP	%BMODE		/NON 0= BANK MODE.
/
/BEFORE TESTING FOR AN INDIRECT REFERENCE, DETERMINE WHETHER
/OR NOT THIS INSTRUCTION IS IN PAGE 0 OR 1.  IF ITS PAGE 1
/ADD 10000 TO THE DIRECT ADDRESS BEFORE PICKING UP THE
/INDIRECT ADDRESS.
/
/ID A $X COMMAND IS IN PROCESS , THE USER PC IS REALLY
/LIVING IN %PCS NOT PC. IF X USE PCS TO DETERMINE USER
/PAGE NUMBER WHEN DETERMINING ABSOLUTE EFFECTIVE ADDRESS.
/
	LAC %XIP	/EXECUTE ($X) IN PROCESS?
	SMA		/YES IF NEG.
	JMP %NOTEX	/NO..USE %PC FOR ADDRESS.
	LAC %PCS	/YES..USE BREAKPOINT ADDRESS
	SKP
%NOTEX	LAC %PC		/USER'S PC.
	AND %LPAGE		/PAGE BIT.
	TAD %SAV4		/ABSOLUTE DIRECT ADDRESS.
	DAC %SAV4
	LAC %AUTO
	AND	%INBIT		/INDIRECT BIT (20000).
	SNA
	JMP	%PNOTI		/NOT INDIRECT REF.
	LAC*	%SAV4		/GET ADDRESS POINTED TO BY
	DAC	%SAV4		/DIRECT ADDRESS.
%PNOTI	LAC	%AUTO		/IS THE PAGE BIT ON.
	AND	%LPAGE
	SZA
	PXA
	TAD	%SAV4
	JMP	%ADONE		/PAGE ADDRESS DONE.
/
/THE MEMORY REFERENCE IS IN BANK MODE.
/
%BMODE	LAC	%AUTO
	AND	%INBIT
	SNA
	JMP	%BNOTI
	LAC*	%SAV2
	JMP	%ADONE
%BNOTI	LAC	%SAV2
%ADONE	DAC %SAV4	/EFFECTIVE ADDRESS
/
/THE COMPLETED USER EFFECTIVE ADDRESS IS ALIVE AND WELL
/LIVING IN %INSTX. NOW BUILD AN INDIRECT REFERENCE
/TO THIS ADDRESS USING THE USER OPERATOR AND
/%INSTX AS THE ADDRESS.
/
	LAC %SAV1
	TAD %LINST		/(%SAV4+20000)
	DAC %INSTX
%EF1	LAC	%SAV1		/GET OP-CODE
	SAD	%LJMP
	JMP	%JMP		/ JMP
	SAD	%LJMS
	JMP	%JMS		/JMS
	SAD	%LXCT
	JMP	%XCT			/ XCT
/IF A NOGO, DON'T PRINT ANYTHING OR ALTER TTO STATUS.
%C2	ISZ	%NOGO
	SKP
	JMP	%C5		/NOGO-SKIP TO %C5.
%C11	JMS	%CRLF		/PRINT %CRLF FOR $C,$X,$G
	JMS	%DELY		/WAIT FOR FLAG.
	TCF			/CLEAR IT.
	JMS	%RLOC1		/RESTORE LOC.1
	LAC	%TTOST		/GET TTO STATUS
	AND	%L24Z
/
	SZA!CLA			/IF FLAG WAS OFF AT ENTRY,LEAVE OFF
	TLS			/IF ON AT ENTRY,PRINT'NULL' TO GE T FLAG ON.
	JMS	%DELY		/WAIT FOR BEFORE PROCEEDING!
/USER IS GETTING ALL INTERRUPTS NOW.
	.IFUND	%%OB
%C5	JMS	%BRKST		/INITIALIZE ENTRY TO %BRK.
	LAC*	%T1		/GET USER INSTRUCTION
	DAC	%T2		/SAVE.
	LAC*	%T1+1		/SAME FOR BREAK #2
	DAC	%T2+1
	LAC*	%T1+2		/SAME FOR BREAK #3
	DAC	%T2+2
	LAC*	%T1+3		/SAME FOR BREAK #4
	DAC	%T2+3
	.ENDC
	.IFDEF	%%OB
%C5	LAC*	%T1
	DAC	%T2
	.ENDC
/SIMULATE THE INSTRUCTION
/
	LAC %LINK
	RAR			/SET LINK
	LAC %AREG		/SET AC
	.IFUND %%MULD
	XX		/NOP IF OPR,IOT, NON MEM REF  OR NON EAE.
	.ENDC
%INSTX	XX			/ ,.ABSLOUTE USER ADDRESS(OPERAND ADDR.) IF MEM REF.
	SKP			/SKIP IF NORMAL
	ISZ	%PC		/EXTRA INC IF SKIP.
	ISZ	%PC			/NORMAL INC IF NO SKIP.
	DAC	%AREG		/SAVE AC,LINK
	GLK
	DAC	%LINK
/
/	WAS THIS AN $X EXECUTION OF A NON-JMP?
/
	.IFUND	%%X
	RAR			/RESTORE LINK
	LAC	%AREG		/AND AC
	DZM	%SKPX
	ISZ	%XIP
	SKP
/
	JMP*	%PC		/YES-GO TO %X1+OR-1
	DZM	%XIP
	.ENDC
	DZM	%N		/NO-RESET BREAK#
	.IFUND	%%OB
	DZM	%BRK		/AND RETURN ADR.
	.ENDC
	.IFUND	%%KU
	ISZ	%HFF		/PI,API OFF BECAUSE OF $K?
	.ENDC			/SKIP IF YES.
	JMS	%PIAPI		/KILL PI,API AND SAVE THEIR
				/STATUS IN % STAT1,%STAT2
	.IFUND	%%KU
	DZM	%HFF
	.ENDC
/
	LAC	%BRKIN		/SET BREAK INSTRUCTIONS
	DAC*	%T1
	.IFUND %%OB
	DAC*	%T1+1
	DAC*	%T1+2
	DAC*	%T1+3
	.ENDC
/
/PREPARE TO EXIT TO USER PROGRAM
/
	LAC %LBRK1
%AXD	DAC* %AXREG		/RESET AUTOINDEX
/SET THE HIGH ORDER BITS OF %PC SO THAT THE RES WILL SET
/THE LINK AND USER MODE BEFORE EXITING TO THE USER.
/
	JMS %PCSET
	TAD %XMODE
	DAC %PC
	LAC	%AREG		/AND AC
	ISZ	%STAT2		/WAS API NOT AT LEVEL 0?
	JMP	%C9		/YES-IS WAS NOT.
	ISZ	%STAT1		/NO-IT WAS. TEST PI.
	ION			/TURN ON PI
	RES
	JMP*	%PC		/EXIT
%C9	ISZ %STAT1		/SIMILAR EXIT WHEN API
	ION			/WAS NOT ORIGINALLY AT
	DBR			/LEVEL 0.
	JMP* %PC
/
/
%PCSET	0
	CLL
	LAC %LINK
	RTR
	TAD %PC
	JMP* %PCSET
/
/
/
%JMS	JMS %PCSET		/PUT LINK IN BIT 0 OF AC
	TAD %LL01		/FORM RETURN ADDR.
	DAC* %SAV4		/STORE AT EFFECTIVE ADR.
	LAC %SAV4		/GET EFFECTIVE ADR.
	JMP %C4
%CAL=.
	.IFUND	%%X
	LAC	%XIP		/IS $X IN PROGRESS?
	SPA
	JMP	%CALA		/YES-DON'T REMOVE THE BREAK.
	.ENDC
	LAW	%DUM		/NO-REMOVE THE CURRENT BREAK.
	.IFUND	%%OB
	DAC*	%TP1
	.ENDC
	.IFDEF	%%OB
	DAC	%T1
	.ENDC
%CALA	LAC	%PC		/GET ADR OF CAL
	SKP
%JMP	LAC %SAV4		/GET EFFECTIVE ADR.
	TAD %M1
%C4	DAC %PC		/SET PC.
	JMP %C3		/GO EXECUTE A NOP.
%XCT	LAC* %SAV4		/GET INSTRUCTION REFERENCED
	JMP %XCTA		/BY XCT AND GO EXECUTE IT.
/THE INSTRUCTION IS AN IOT.
/DECODE IT BEFORE EXECUTION SO THAT A DBA OR EBA IS NOT
/EXECUTED.
%IOT	LAC	%INSTX		/IT MAY BE MICROCODED.
	SAD	%LEBA
	JMP	%EBANK
	SAD	%LDBA
	SKP!CLA
	JMP %C2
	SKP
%EBANK	LAC	%LLAC		/(200000
	DAC	%XMODE
	JMP	%C3
	.IFUND	%%MULD
%EAE	LAC	%INSTX		/TEST FOR MUL OR DIV.
	AND	%L700
	SAD	%L300
	SKP			/DIV.
	SAD	%L100
	SKP			/MUL.
	JMP	%C2		/NOT MUL OR DIV.
	LAC	%INSTX		/MOVE THE MUL OR DIV.
	DAC	%INSTX-1
	ISZ	%PC		/INC PC.
	LAC*	%PC		/GET MUL OR DIV OPERAND.
	DAC	%INSTX		/STORE FOR EXECUTION.
	JMP	%C2		/GO EXECUTE.
	.ENDC
/********** ($G) GO TO USER PROGRAM
/NO ADR IMPLIES: USE START ADDRESS.
%G	JMS	%SEEND		/SEEN $?
	LAC	%WORDS		/YES-GET SAVED INPUT
	ISZ	%FRSCS		/WAS THERE ANY OCTAL INPUT?
	LAC %USTAD		/NO-GET ADR FROM %USTAD
	TAD %M1
	AND %L147S
	DAC %PC
	JMP %C3
	.IFUND	%%X
/********** ($X) EXECUTE A USER INSTRUCTION
%X	JMS	%SEEND		/SEEN $ ?
	ISZ	%FRSCS		/YES. ANY OCTAL INPUT
	JMP	%QUEST		/NO-ERROR
	LAC	%WORDS		/GET INPUT
	.ENDC
%X3	DAC	%X4		/SAVE FOR EXECUTION
	.IFUND	%%X
	AND	%LNOP		/SAVE OP-CODE
	SAD	%LJMP
	JMP	%X2		/SPECIAL CASE IF JMP
	LAC	%PC
	DAC	%PCS		/SAVE PC.
	CLC
	DAC	%XIP		/$X IN PROGRESS.
	.ENDC
%X2	LAC	%LX4		/SET PC TO ADR OF
	DAC	%PC		/INSTRUCTION TO EXECUTE.
	.IFUND	%%X
	DZM	%SKPX
	.ENDC
	JMP	%C1		/GO EXECUTE
/
/IF A JMS, OR ANY NON-SKIP,NON-CAL INSTRUCTION
/IS EXECUTED, CONTROL COMES TO %X1. THE PI AND API
/ARE NOT DISTURBED.
/IF A SKIP IS EXECUTED, CONTROL COMES TO %X1+1.
/IF A CAL IS EXECUTED, THE CAL IS PUT IN LOC
/%X1-1 AND CONTROL COMES TO %X1-1.
/
/
%X4	XX
	.IFUND	%%X
%X1	JMP	%X5		/NORMAL RETURN
	DAC	%AREG		/SKIP RETURN
	CLC
	JMP	%X6		/TURN ON %SKPX
%X5	DAC	%AREG
	CLA			/TURN OFF %SKPX
%X6	DAC	%SKPX
	GLK
	DAC	%LINK		/SAVE LINK
	LAC	%PCS
	DAC	%PC		/RESTORE PC
	JMS	%SETLO		/RESET LOW CORE FOR INTERCEPTS
	JMP	%ODT5		/GO FOR MORE INPUT.
	.ENDC
/
/%B	BREAKPOINT SPECIFICATIONS
/
/	THERE ARE 2 #'S AS INPUT. #A=ADR.#B=BREAK#.
/	SEE TABLE.  IS #A AND/OR #B SPECIFIED?
/	#A	* #B	* ACTION
/	******	********	********
/	YES	* YES	* SET BREAK #B AT LOC #A
/	YES	* NO	* SET BREAK #1 AT LOC #A
/	NO	* YES	* REMOVE BREAK #B
/	NO	* NO	* REMOVE ALL BREAKS
/
/
%B	JMS	%SEEND		/SEEN $ ?
	.IFUND	%%OB
	ISZ	%FRSCS		/YES. WAS #A SPECIFIED?
	JMP	%B1		/NO--DO A REMOVE.
	LAC	%LL01		/YES.
	ISZ	%FRSTC		/WAS # B SPECIFIED ?
	DAC	%WORD		/NO--ASSUME BREAK #1.
%B2	LAW	-5		/YES-TEST VALIDITY OF BREAK #.
	TAD	%WORD
	SMA
	JMP	%QUEST		/# TOO LARGE.
	TAD	%L4
	SPA
	JMP	%QUEST		/# TOO SMALL
	LAC	%WORD		/# IS OK.
	TAD	%LDT11		/FORM A DAC TO PROPER
	DAC	%SAV1		/ENTRY IN TABLE 1.
	TAD	%L4
	DAC	%SAV2		/AND IN TABLE 3.
	LAC	%WORDS		/GET ADDR OF BREAK.
	SAD	%LL01
	JMP	%QUEST		/CANNOT TRACE LOC. 1
	XCT	%SAV1		/STORE ADR IN TABLE 1.
	CLC
	XCT	%SAV2		/SET LOOP COUNT=-1
	JMP	%ODT0		/TO NEXT COMMAND
/
/	#A WAS NOT SPECIFIED. REMOVE BREAKPOINTS.
/
%B1	LAW	%DUM
	DAC	%WORDS		/GET DUMMY BREAK ADDR.
	ISZ	%FRSTC		/WAS #B SPECIFIED
	SKP			/SKIP IF NOT.
	JMP	%B2		/IF YES, GO REMOVE THE ONE SPECIFIED.
/	REMOVE ALL BREAKS.
	JMS	%NOBRK
	.ENDC
	.IFDEF	%%OB		/IF ONLY ONE BREAKPOINT--
	LAC	%WORDS		/GET INPUT #
	ISZ	%FRSCS
	LAW	%DUM		/OR DUMMY
	SAD	%LL01
	JMP	%QUEST		/ERROR IF=1
	DAC	%T1		/SET ADDRESS FOR BREAK
	CLC
	DAC	%T3		/SET CONTINUE COUNT.
	.ENDC
	JMP	%ODT0
/
/********** ($M) OPEN SEARCH MASK
/
	.IFUND	%%WM
%M	JMS	%SEEND
	LAW	%MASK		/GET ADR OF MASK
	JMP	%A1
/
/********* ($W)	WORD SEARC
/DOES NOT RESTORE LOC. 1 OR TURN OFF PI,API.
/
%W	JMS	%SEEND
	LAC	%LO
	DAC	%DUM		/SAVE LOW LIMIT FOR SEARCH.
	JMS	%CRLF
%WI	LAC*	%DUM		/GET DATA
	AND	%MASK		/MASK IT
	XOR	%WORDS		/COMPARE.
	SZA			/SKIP IF EQUAL
	JMP	%W2		/JUMP IF NOT EQUAL
	LAC	%DUM		/GET ADR OF MATCHING WORD
	JMS	%PRTAD		/PRINT ADDR
	LAW	257
	JMS	%OUT		/ AND A SLASH
	LAC*	%DUM		/GET UNMASKED WORD
	JMS	%PNUM		/PRINT CONTENTS
	JMS	%CRLF
%W2	LAC	%DUM		/GET POINTER
	ISZ	%DUM		/INC IT
	SAD	%HI		/DONE?
	JMP	%ODT01		/YES-PRINT CR,LF,LF AND START INPUT.
	JMP	%WI		/NO-GET NEXT WORD.
/
/********** ($I) INITIALIZE BUFFER
/
%I	JMS	%SEEND
	CLC
	TAD	%LO
	CMA
	TAD	%HI
	SPA			/ERROR IF
	JMP	%QUEST		/%LO< %HI
	LAC	%WORDS		/GET DATA
	JMS	%FILL		/FILL BUFFER
	LAC	%LO
	LAC	%HI
	JMP	%ODT01		/TO NEXT COMMAND.
	.ENDC
/
/%FILL	FILL AN AREA WITH A SPECIFIED VALUE.
/	CALL WITH:
/
/	LAC VALUE			/VALUE TO STORE
/	JMS %FILL
/	LAW FIRST			/FIRST ADDR TO FILL
/	LAW LAST			/LAST ADDR TO FILL
/
%FILL	0
	DAC	%SAV3		/SAVE VALUE
	XCT*	%FILL
	DAC	%SAV1		/SET FIRST ADDR
	ISZ	%FILL
	XCT*	%FILL
	DAC	%SAV2		/SET LAST ADDR
	SKP
%FILL1	ISZ	%SAV1		/INC STORE ADDR.
	LAC	%SAV3		/GET VALUE
	DAC*	%SAV1		/DEPOSIT
	LAC	%SAV1
	SAD	%SAV2		/DONE?
	JMP*	%FILL		/EXIT IF DONE
	JMP	%FILL1		/GO AGAIN
/%CRLF	PRINT A CR,LF
/
/
%SAV1=.
%CRLF	0
	LAW	%CR
	JMS	%OUT		/PRINT CR
	LAW	%LF
	JMS	%OUT		/PRINT LF
	CLC
	DAC	%SHUT		/RESET SHUT
	JMP*	%CRLF		/EXIT
/%OUT	OUTPUT CHARACTER FROM AC
/	INPUT AC HOLDS 8-BIT ASCII CHARACTER
/	OUTPUT AC HOLDS THE ASCII CHARACTER. SO DOES %CHARO.
%SAV2=.
	.EOT
