
	.TITLE ODT15A
/COPYRIGHT 1969, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
/USER MUST SUPPLY THE .LOC
/GENERAL PARAMETERS
/
	.IFUND	%AUTOX
%AUTOX=17		/ASSUMED AUTO INDEX #.
	.ENDC
%CR=215
%LF=212
%BLNK=240
	.IFUND	%%DFT
%%FS=1			/DEFINE %%FS IF DUMP AVAILABLE
	.ENDC
%TIMO=-202200		/200 MS AT 3 CYCLES
%TOVAL=%TIMO
/
/	IOT DEFINITIONS
/
/
KRB=700312
KSF=700301
KRS=700322
TCF=700402
TLS=700406
TSF=700401
PXA=724000
RES=707742
EBA=707764
DBA=707762
PSA=700204
PSF=700201
IOT=700000
IORS=700314
CAF=703302
IOF=700002
ION=700042
DBK=703304
DBR=703344
SPI=705501
ISA=705504
PCF=700202
PSB=700244
EAE=640000
RPL=705512
KRBN=KRB
/
	.IFDEF %%BANK
%MODE=EBA	/ODT WILL RUN IN BANK MODE
	.ENDC
	.IFUND %%BANK
%MODE=DBA	/ODT WILL RUN IN PAGE MODE
	.ENDC
/
/	ODT15
/
/BEGIN
%ODT	%MODE			/EBA OR DBA
	JMS %IORES		/IO RESET AND CLA
	JMS %FILL		/GENERAL CLEAR.
	LAW %MASK
	LAW %USTAD
	DZM %AREG
	DZM %LINK
	.IFUND	%%V
	LAC	%LAUTO		/(%AUTOX
	DAC	%VREG		/SET FOR AUTOINDEX %AUTOX
	.ENDC
	LAW	%DUM
	.IFUND %%OB
	DAC	%TP1
	JMS	%NOBRK		/REMOVE ALL BREAKPOINT ADDRESSES.
	.ENDC
	.IFDEF	%%OB		/ONE BREAK ONLY
	DAC	%T1
	.ENDC
/
/RESTART POINT
/
%REST	%MODE			/EBA OR DBA
	JMS	%IORES		/IO RESET.ALSO CLEARS AC.
	JMS	%FILL		/CLEAR
	LAW	%N
	LAW	%NOGO
	JMS	%RLOC1		/RESET LOC.1
/RESET THE EXECUTE MODE TO WHATEVER ODT WAS ASSEMBLED AS.
/
	LAC %AMODE
	DAC %XMODE
	LAC %LBRK1
	XCT %AXD		/SET AUTO INDEX
	JMS %RBRKS               /REMOVE ALL BREAKS
/
/ COMMAND DECODE
/
%ODT01	JMS	%CRLF		/PRINT CR,LF
%ODT0	JMS	%CRLF		/ CR,LF
%ODT1	DZM	%DOL		/NO $
	.IFUND	%%V
%VI	LAW	-20		/TEST IF NEW VALUE
	TAD	%VREG		/IN RANGE OF 10-17.
	SMA
	JMP	%V2			/ERROR--TOO BIG.
	TAD	%L10
	SPA
	JMP	%V2		/ERROR--TOO SMALL.
	TAD	%L10		/OK--UPDATE AUTOINDEX
	DAC %AXREG		/DAC X
	XOR %JMSI		/JMS* X
	DAC %BRKIN
	.ENDC
	.ENDC
	.IFUND	%%DFT
	DZM	%SEMI		/NO ;
	.ENDC
%ODT2	DZM	%WORD		/0 TO INPUT #
	DZM	%FRSTC		/0 TO FIRST CHAR FLAG
	LAW	-7		/GET A -7.
	DAC	%TOTE		/SET CHARACTER COUNT.
/ START INPUT.
%ODT3=.
/	INPUT A CHARACTER FROM KEYBOARD.
/
%INPT3	KSF			/SKIP ON FLAG.
	JMP	%INPT2
	KRB			/READ
%INPT4	DZM	%TTIF		/CLEAR PROG TTI FLAG
	AND	%C177		/SAVE 7 BITS
	SNA
	JMP	%ODT3		/IGNORE NULL'S.
	SAD	%C177
	JMP	%ODT3		/IGNORE RUBOUT
	SAD	%L175
	JMP	%STDL
	SAD	%L176
	SKP
	SAD	%L33
%STDL	LAC	%L44		/CHANGE ALT-MODE TO $.
	SAD	%L25
	JMP	%QUEST		/^U EXIT
	DAC %CHARI
/	SEARCH COMMAND TABLE
	LAW	%TAB1		/POINTER TO TABLE OF
	DAC	%SAV1		/LEGAL COMMANDS.
%ODT4	LAC*	%SAV1		/GET A COMMAND CHAR.
	AND	%C177
	SAD	%CHARI		/COMPARE TO INPUT.
	JMP	%ODT6		/EQUAL-GO TO HANDLER.
	ISZ	%SAV1		/UPDATE POINTER
	SAD	%C177		/IS THIS LAST TABLE ENTRY?
	JMP	%ODT7		/YES
	JMP	%ODT4		/NO,TRY AGAIN.
%ODT6	LAC*	%SAV1
	RCR
	RTR
	RTR
	RTR
	AND	%L3777		/GET ADR FROM TABLE
	TAD	%LODT		/ADD ON BASE ADR AND STORE THE
	DAC	%SAV1		/ADR OF HANDLER.
	JMP*	%SAV1		/GO!
/	REDUCE ASCII TO NUMERIC, IF POSSIBLE
%ODT7	LAW	-70
	TAD	%CHARI
	SMA
	JMP	%QUEST		/NOT OCTAL
	TAD	%L10
	SPA
	JMP	%QUEST		/NOT OCTAL
	DAC	%SAV1		/SAVE OCTAL#
	LAC	%WORD		/GET ACCUMULATED INPUT
	RCL
	RTL			/MULT BY 8
	TAD	%SAV1
	DAC	%WORD		/SAVE ACCUMULATED VALUE
	CLC
	DAC	%FRSTC		/INDICATE OCTAL INPUT SEEN
	ISZ	%TOTE		/IS THIS 7-TH CHAR
	JMP	%ODT3		/NO, GO GET MORE
%QUEST	LAW	277		/YES, ERROR
	JMS	%OUT		/PRINT ?
%ODT5	KRB			/TURN OFF FLAG IF ON.
	DZM	%TTIF		/CLEAR PROG TTI FLAG
	JMP	%ODT0		/GO PRINT CR LF AND START INPUT.
	.IFUND	%%V
/BAD AUTOINDEX #
%V2	LAC	%PCS
	DAC	%VREG		/RESET %VREG
	JMP	%QUEST
	.ENDC
%INPT2	LAC	%TTIF		/IS PROG TTI FLAG ON?
	SMA
	JMP	%INPT3		/NO-TRY KSF
	LAC	%CHARI		/GET INPUT CHARACTER
	JMP	%INPT4		/GO TEST IT
/
/	COMMAND TABLE
/
%TAB1	%SLSH-%ODT*200+57		/%SLSH-SLASH
	%CAR-%ODT*200+15		/%CAR-CARRAIGE RET
	%LNF-%ODT*200+12		/%LNF-LINE FEED
	%DOLAR-%ODT*200+44		/%DOLAR-DOLLAR SIGN
	%B-%ODT*200+102			/%B-BREAKPOINT
	%C-%ODT*200+103			/%C-CONTINUE
	%UPARO-%ODT*200+136		/%UPARO-UP A ROW
	%LEFTA-%ODT*200+137		/%LEFTA-LEFT ARROW
	%A-%ODT*200+101			/%A-OPEN AC
	%G-%ODT*200+107			/%G-GO
	.IFUND	%%X
	%X-%ODT*200+130			/%X-EXECUTE
	.ENDC
	.IFUND	%%KU
	%K-%ODT*200+113			/%K-KILL PI,API AT BREAK
	%U-%ODT*200+125			/%U-ALLOW SAME.
	.ENDC
	.IFDEF	%%FS
	%H-%ODT*200+110			/%H-USE FAST PUNCH
	%L-%ODT*200+114			/%L-USE SLOW PUNCH
	.ENDC
	.IFUND	%%V
	%V-%ODT*200+126			/%V-VARY THE AUTOINDEX
	.ENDC
	.IFUND	%%J
	%J-%ODT*200+112			/%J-DISPLAY PI,API STATUS
	.ENDC
	.IFUND	%%DFT
	%D-%ODT*200+104			/%D-DUMP
	%F-%ODT*200+106			/%F-FEED
	%T-%ODT*200+124			/%T-TERMINATE DUMP
	%SEMIC-%ODT*200+73		/%SEMIC-;FOR $D.
	.ENDC
	.IFUND	%%WM
	%W-%ODT*200+127			/%W-WORD SEARCH
	%M-%ODT*200+115			/%M-OPEN MASK
	%I-%ODT*200+111			/INITIALIZE BUFFERS
	.ENDC
	%Z-%ODT*200+132			/%Z-USER START ADDR.
	.IFUND	%%OB
	%Y-%ODT*200+131			/%Y-REENTRANT PC LIST
	.ENDC
%C177	177			/END OF TABLE
/COMMAND HANDLERS
/
/
/********** (SLASH)	OPEN A REGISTER
%SLSH	ISZ	%FRSTC		/WAS THERE AN OCTAL DIGIT?
	JMP	%SLSH1		/NO-OPEN LAST REFERENCED.
	LAC	%WORD		/GET INPUT
%SLSH2	DAC	%CAD		/SAVE AS CURRENT ADDR.
%SLSH1	LAC*	%CAD		/GET CONTENTS
	JMS	%PNUM		/PRINT
	DZM	%SHUT		/INDICATE OPEN REGISTER
	JMP	%ODT1
/%CRL	HANDLES MODIFICATION AND CLOSING OF
/	OPEN REGISTERS.
%CRL	0
	ISZ	%FRSTC		/ANY OCTAL DATA?
	JMP*	%CRL		/NO-RETURN
	LAC	%WORD		/YES-GET INPUT#
	ISZ	%SHUT		/TEST IF ANY OPEN REGISTER?
	DAC*	%CAD		/YES-MODIFY CURRENT ADR.
	JMP*	%CRL		/RETURN
/********** (CARRIAGE RETURN) CLOSE ANY OPEN REGISTER.
%CAR	JMS	%CRL
	JMP	%ODT0
/**********(LINE FEED) HANDLER. OPEN NEXT.
%LNF	LAW	%CR
	JMS	%OUT		/PRINT A CR.
	JMS	%OUT
	JMS	%CRL		/CLOSE ANY OPEN.
	LAC	%LL01
	TAD	%CAD		/ADD 1 TO CURRENT ADR.
%LNF1	AND	%LM4K		/WRAP AT 4K.
	DAC	%CAD		/SET NEW CURRENT ADDRRESS
	JMS	%PRTAD		/PRINT ADDRESS
	LAW	257		/ASCII SLASH
	JMS	%OUT		/PRINT A /
	JMP	%SLSH1		/GO PRINT CONTENTS
/********** (UP-ARROW) HANDLER. OPEN PREVIOUS
%UPARO	JMS	%CRL		/CLOSE
	JMS	%CRLF		/PRINT CR,LF
%M1	LAW	-1		/DECREMENT CURRENT ADR.
	JMP	%LNF1-1		/GO PRINT ADDR AND CONTENTS.
/**********(LEFT-ARROW) HANDLER.OPIN INDIRECT
%LEFTA	JMS	%CRL		/CLOSE.
	JMS	%CRLF		/PRINT CR,LF
	LAC*	%CAD		/GET CONTENTS
	JMP	%LNF1		/PRINT ADDR AND CONTENTS.
/********** ($HANDLER)
%DOLAR	LAC	%DOL		/GET $ FLAG.
	SZA!CLC
	JMP	%QUEST		/ERROR IF ALREADY SEEN $
	DAC	%DOL		/SET $ FLAG
/
/PREPARE TO SAVE PRESENT VALUES IN CASE OF MORE INPUT.
/
	LAC	%WORD
	DAC	%WORDS		/SAVE INPUT #
	LAC	%FRSTC
	DAC	%FRSCS		/SAVE FIRST CHAR FLAG.
	JMP	%ODT2		/GO DO MORE INPUT.
/**********(;)	SEMICOLON HANDLER FOR $D COMMAND
	.IFUND	%%DFT		/;HANDLER ONLY IF DUMP AVAILABLE.
%SEMIC	LAC	%DOL
	SZA
	JMP	%QUEST		/ERROR IF SEEN $
	LAC	%SEMI
	SZA!CLC
	JMP	%QUEST		/ERROR IF SEEN;
	DAC	%SEMI		/SET;FLAG
/
/	SAVE PRESENT DATA
/
	LAC	%WORD
	DAC	%WORDT		/SAVE INPUT #
	LAC	%FRSTC
	DAC	%FRSCT		/SAVE FIRST CHAR FLAG.
	JMP	%ODT2		/GO GET MORE INPUT
	.ENDC
/********** ($A) OPEN AC REGISTER
%A	JMS	%SEEND		/SEEN $ ?
	LAW	%AREG		/YES-GET ADR OF AC REG.
%A1	AND	%LM4K		/SAVE 4K PART.
	JMP	%SLSH2		/PRINT CONTENTS
/********** ($Z)OPEN USER START ADDRESS.
%Z	JMS	%SEEND		/SEEN $ ?
	LAW	%USTAD		/YES-GET ADR OF USE START ADDR.
	JMP	%A1
	.IFUND	%%OB
/********** ($Y) OPEN REENTRANT PC LIST
%Y	JMS	%SEEND
	LAW	%BRK		/GET ADR OF PC LIST
	JMP	%A1
	.ENDC
/********** ($K) $K HANDLER
/	$K MEANS KILL PI,API AT BREAKS.
	.IFUND	%%KU
%K	JMS	%SEEND		/SEEN$ LEAVES -1 IN AC.
%H1	DAC	%HF		/SET $K FLAG
	JMP	%ODT0
/********** ($U) $U HANDLER
/	ALLOW PI,API DURING BREAKS
%U	JMS	%SEEND		/SEEN $
	CLA			/YES
	JMP	%H1		/CLEAR $H FLAG
	.ENDC
/********** ($J) DISPLAY PI,API STATUS REGISTERS
/
/
	.IFUND	%%J
%J	JMS	%SEEND
	JMS	%CRLF
	LAW	%PISLM		/PRINT 'PI/'
	JMS	%TYPMG
	IORS
	JMS	%PNUM		/PRINT IORS WORD
	JMS	%CRLF
	LAW	101
	JMS	%OUT		/PRINT A
	LAW	%PISLM		/PI/
	JMS	%TYPMG
	RPL
	JMS	%PNUM		/PRINT API STATUS
	JMP	%ODT01		/PRINT CR,LF,LF,
%PISLM	.SIXBT	'PI/@'
	.ENDC
/********** ($V) VARY THE AUTOINDEX NUMBER.
/
/
	.IFUND	%%V
%V	JMS	%SEEND		/SEEN $ ?
	LAC	%VREG
	DAC	%PCS		/SAVE CURRENT INDEX #.
	LAW	%VREG
	JMP	%A1		/GO PRINT CURRENT INDEX #.
	.ENDC
/%BRK	ENTRY FOR ALL BREAKPOINTS.
/
/ODT15 CAN'T ALLOW MORE THAN ONE BREAK TO BE ACTIVE AT
/A TIME. TO DETECT MULTIPLE ENTRIES INTO %BRK,
/THE FOLLOWING TECHNIQUE IS USED:
/
/THE BREAKPOINT INSTRUCTION IS JMS* X WHERE X
/IS ONE OF THE AUTOINDEX REGISTER.  NOTE THE CODING
/AT %BRK.  THE FIRST ENTRY IS AT %BRK+1 WITH THE
/PC AT %BRK+0.  THE AUTOINDEX IS NOT RESET UNTIL
/A $C OR $G COMMAND.  THUS, A REENTRANCY BEFORE
/THIS TIME CAUSES AND ENTRY AT %BRK+2 WITH THE
/PC AT %BRK+1.  ON THIS ENTRY, THE PI AND API
/ARE DISABLED AND CONTROL GOES TO %REENT.
/
/
%BRK	0
	%MODE			/ODT MODE (EBA OR DBA)
	.IFUND %%OB
%BRKA	XX			/(JMP % BRK1 OR IOF)
	IOF			/
	ISA+10			/ /
	IOF			/ / / REENTRANCIES COME HERE.
	ISA+10			/ /
%BRKB	IOF			/
/%REENT	BREAKPOINT REENTRANCY
/
/	PRINT MESSAGE AND GO FOR COMMAND INPUT
/
/
%REENT	%MODE			/ODT MODE (EBA OR DBA)
	JMS %CRLF
	LAC %REENT
	DAC %BRK+1
	LAW %RENTM	/REENTRANCY MESSAGE.
	JMP %REENA		/RESTART
%RENTM	.SIXBT	/ODT REENTERED@/
	.ENDC
/
%BRK1	DAC	%AREG		/SAVE USER'S AC
/RESTORE USER'S INSTRUCTIONS AT BREAKS.
	.IFUND	%%OB
	LAC	%BRKB		/IOF
	DAC	%BRKA
	.ENDC
	JMS	%RBRKS
	LAC	%BRK		/GET USER MODE. (BIT 1 AT ENTRY)
	AND	%LLAC
	DAC	%XMODE
	GLK
	DAC	%LINK		/SAVE USER'S LINK
/
/DETERMINE WHICH BREAK THIS IS AND SET PROPER
/PARAMETERS AND POINTERS.
/
	DZM	%NOGO
	DZM	%N		/RESET # OF ACTIVE BREAK.
	CLC
	TAD %BRK		/CALC ADR OF THIS BREAK.
	AND %L147S
	DAC %PC		/USE ONLY 13 BITS FROM ENTRY POINT.
	SAD	%T1		/TEST FOR ADR IN TABLE 1:
	.IFUND	%%OB
	LAW	-7		/#1
	SAD	%T1+1
	LAW	-6		/#2
	SAD	%T1+2
	LAW	-5		/#3
	SAD	%T1+3
	LAW	-4		/#4
	SMA
	.ENDC
	.IFDEF	%%OB
	SKP
	.ENDC
	JMP	%BERR		/BREAK ENTRY ERROR---
	.IFUND	%%OB
	TAD	%L10		/SET UP
	DAC	%N		/%N
	TAD	%T1M1
	DAC	%TP1		/%T1 POINTER
	TAD	%L4
	DAC	%TP3		/%T3 POINTER.
/
/TEST LOOP COUNT FOR THIS BREAKPOINT.
/
	CLC
	ISZ*	%TP3		/TEST LOOP COUNT
	JMP	%BRK2		/NOT COUNTED DOWN. A NO-GO!
	DAC*	%TP3		/RESET COUNT TO -1.
	.ENDC
	.IFDEF	%%OB		/ONLY ONE BREAKPOINT--
	ISZ	%N		/SET %N=1
	CLC
	ISZ	%T3		/IS LOOP COUNT COUNTED DOWN?
	JMP	%BRK2		/NO.
	DAC	%T3		/YES-RESET TO -1.
	.ENDC
	.IFUND	%%KU		/CONDITIONAL ON $K,$U COMMANDS.
	LAC	%HF		
	SNA			/SKIP IF $K.
	JMP	%BRK3		/CONTINUE IF $U.
/
	JMS	%PIAPI		/DISABLE PI;RAISE API TO
				/LEVEL 0. SETS:
				/%STAT1=-1 IF PI ALREADY OFF
				/%STAT2=-1 IF API ALREADY AT
				/ LEVEL 0 OR IF OFF.
	CLC
	DAC	%HFF		/INDICATE $K WAS SET AT BREAK.
	.ENDC
%BRK3	JMS	%DELY		/WAIT A WHILE FOR TTY.
	JMS	%SETLO
	IORS
	DAC	%TTOST		/SAVE TTO STATUS
	DZM	%TTOF		/CLEAR THE PROG. TTO FLAG
/
/PRINT BREAKPOINT INFO.
/
	JMS	%CRLF		/PRINT CR,LF
	LAW	%DOLBM		/ $B
	JMS	%TYPMG
	.IFUND	%%OB
	LAW	260		/CONVERT %N
	TAD	%N		/ TO ASCII
	JMS	%OUT		/PRINT N
	.ENDC
	LAW	%BLNK		/ BLANK, BLANK
	JMS	%OUT
	JMS	%OUT
	LAC	%PC		/GET ADR OF BREAK
	JMS	%PRTAD		/ PRINT IT.
	JMP	%ODT5		/GO PRINT CR,LF AND
				/START LOOKING FOR INPUT.
/
/SET %NOGO TO INDICATE THE COUNT NOT SATISFIED AT A BREAK.
%BRK2	DAC	%NOGO		/-1 TO %NOGO.
	JMP	%C1		/GO TO CONTINUE ROUTINE.
%DOLBM	.SIXBT	'$B@'
/
/FIX PI, API
/TURN OF PI. RAISE API TO LEVEL 0 . THEN SET
/%STAT1=-1 IF PI WAS ALREADY OFF.
/%STAT2=-1 IF API ALREADY AT LEVEL 0, OR IF
/IT IS OFF.
%PIAPI	0
	CLC
	DAC	%STAT2		/PRE-SET API STATUS OFF.
	IORS			/READ PI
	IOF			/TURN OFF
	SMA!CLA			/SKIP (AND CLEAR) IF PI WAS ON.
	CLC			/IF OFF,-1 TO AC
	DAC	%STAT1		/SET &STAT1
	LAC	%L45Z		/(400000	
	SPI			/SKIP IF API IS ON.
	JMP*	%PIAPI		/EXIT IF API OFF.
	ISA+10			/TURN OFF API
	LAC	%L200
	SPI			/SKIP IF NOT AT LEVEL 0
	SKP!CLC			/-1 TO AC IF AT 0.
	CLA			/ 0 IF NOT AT LEVEL 0.
	DAC	%STAT2		/SET %STAT2.
	LAC	%L42
	ISA			/TURN API ON AT LEVEL 0.
	JMP*	%PIAPI		/RETURN
/RESET USER INSTRUCTIONS AT BREAKPOINTS.
/
	.EOT
