
%OUT	0
	DAC	%CHARO		/SAVE OUTPUT CHAR.
	LAC	%LTOVL		/SET 150 MS. TIME OUT
	DAC	%TO		/SET TIME-OUT FOR OUTPUT
	LAC	%CHARO		/GET CHAR.
%OUT3	TSF			/SKIP ON HARDWARE FLAG
	JMP	%OUT1
%OUT2	TLS			/OUTPUT
	DZM	%TTOF		/CLEAR PROG TTO FLAG.
	JMP*	%OUT		/EXIT
%OUT1	ISZ	%TTOF		/IS PROG TTO FLAG ON?
	SKP			/NO-SKIP
	JMP	%OUT2		/YES-GO OUTPUT
	ISZ	%TO		/TIME-OUT?
	JMP	%OUT3		/NO-TRY AGAIN
	JMP	%OUT2		/YES-GO OUTPUT
/
/TAPE 3A
/
/%TYPMG		TYPE A MESSAGE
/	INPUT	ADR OF MESSAGE IN AC. MESSAGE IN
/	.SIXBT FORMAT. TERMINATED BY @.
/
%TYPMG	0
	DAC	%SAV3		/SAVE ADR
%TYPB	LAW	-3
	DAC	%SAV5		/SET 3 COUNT
	LAC*	%SAV3		/GET A WORD
	ISZ	%SAV3		/UPDATE POINTER
/
	RAL
%TYPA	JMS	%R6L		/ROTATE 6 LEFT
	DAC	%SAV1
	AND	%L77		/SAVE 6 BITS
	TAD	%L40
	AND	%L77
	TAD	%L40		/CONVERT TO ASCII
	SAD	%L100		/IS IT AN @?
	JMP*	%TYPMG		/YES-EXIT
%JMSOT	JMS	%OUT		/NO-PRINT THE CHAR
	LAC	%SAV1
	ISZ	%SAV5		/DONE WITH 3 CHARACTERS
	JMP	%TYPA		/NO
	JMP	%TYPB		/YES-GET NEXT WORD.
/
/
/**********
/
/%INT	INTERRUPT HANDLER FOR ODT15
%INT	%MODE
	DAC	%INAC		/SAVE AC
	LAC*	%L0
	DAC	%LOC0
	KSF			/IS IT KEYBOARD?
	JMP	%INTA		/NO
	KRBN			/READ KEYBOARD
	DAC	%CHARI
	CLC
	DAC	%TTIF		/SET PROG TTI FLAG.
	JMP	%INT2		/GO EXIT
%INTA	TSF			/IS IT TELEPRINTER?
	JMP	%INT1		/NO.
	TCF			/YES, CLEAR FLAG.
	CLC
	DAC	%TTOF		/SET PROG TTO FLAG.
%INT2	LAC %INAC		/RESTORE AC
	ION
	RES
	JMP* %LOC0		/RETURN TO ODT15.
/THIS IS A NON-TELETYPE INTERRUPTION ANS IS IGNORED BY ODT15.
/A BASIC RULE IS THAT THE USER MUST HAVE A JMP INSTRUCTION A 
/AT LOCATION 1 IF HE USES INTERRUPTIONS DURING BREAKPOINTS.
/
%INT1	LAC %LOC1		/USER INSTRUCTION FROM LOC1.
	AND %L347S	/IT MAY BE JMP* AUTOINDEXREG.
	TAD %LLAC		/BUILD LAC* USER ADDRESS.
	DAC .+1
%IN000	XX
	LAC %LOC1
	AND %L147S
	SAD %LL02		/WAS IT A JMP* 2.
	JMP %JI2		/YES USE ADDRESS AT 2
	DAC %IN000
	LAC %LOC1		/WAS IT AN INDIRECT REFERENCE
	AND %INBIT
	SNA
	JMP %INTOK
	LAC* %IN000
	DAC %IN000
%INTOK	LAC %LOC0		/RESTOREUSER MODE LINK ETC.
	AND %LIOT	/(700000
	TAD %IN000
	DAC %LOC0
	JMP %INT2
/THE ADDRESS REFERENCED AT LOCATION 1 IS 2.
/ITS AGAINST THE RULES TO HAVE A JMP 2 SO ASSUME
/ITS A JMP* 2.
%JI2	LAC %LOC2	/CONTENTS OF LOC 2
	AND %L147S	/KEEP 13 BITS
	JMP %INTOK-1
/
/
/
/
/
/
/%SEEND	SEEN THE $
/	IF YES, TAKE NORMAL EXIT
/	IF NO, GO TO %QUEST
%SAV3=.
%SEEND	0
	LAC	%DOL
	SMA
	JMP	%QUEST		/TO %QUEST IF NOT SEEN $.
	JMP*	%SEEND		/NORMAL EXIT.
/%IORES	IO RESET ROUTINE
%SAV5=.
%IORES	0
%IOFF	IOF			/DISABLE PI
%ISAPT	ISA+10			/ API
	CAF			/ ALL FLAGS
	JMP*	%IORES		/RETURN
/%BRKST	SET UP ENTRY OF BREAKPOINT ROUTINE
/	THE FIRST FEW LOCATIONS OF ROUTINE %BRK
/	CAN BE DESTROYED. THIS ROUTINE RESTORES
/	THE FIRST 4 LOCATIONS.
	.IFUND	%%OB
%BRKST	0
	LAC	%LJBRK1
	DAC	%BRK+2
	LAC	%IOFF
	DAC	%BRK+3
	DAC	%BRK+5
	LAC	%ISAPT
	DAC	%BRK+4
	JMP*	%BRKST
	.ENDC
/%PNUM	PRINT A 6 DIGIT #.
/	INPUT	18-BIT LOGICAL # IN AC.
/	OUTPUT	6 OCTAL DIGITS FOLLOWED BY TWO BLANKS
/
%PNUM	0
	RCL
	DAC	%SAV5		/SAVE#.
	LAW	-6		/GET 6 COUNT
	JMS	%NUMOU		/PRINT 6 CHARACTERS
	LAW	%BLNK
	JMS	%OUT
	JMS	%OUT		/PRINT 2 MORE BLANKS
	JMP*	%PNUM		/EXIT
/PRINT AN ADDRESS (5 OCTAL DIGITS)
/	INPUT	18-BIT # IN AC
/	OUTPUT	4 DIGITS
/
%PRTAD	0
	AND	%LM4K
	RTL
	RTL			/REMOVE 1 CHAR.
	DAC	%SAV5
	LAW	-5
	JMS	%NUMOU		/PRINT 4 CHARS
	JMP*	%PRTAD		/EXIT
/
/
/	ODT-15 DUMPING FEATURE
/
/	THE DUMPING IS DONE IN THE ABSOLUTE LOADER FORMAT.
/	THERE ARE 5 COMMANDS:
/		$L: USE SLOW PUNCH (ASR)
/		$H: USE FAST PUNCH
/		$F: PUNCH LEADER (2 FEET)
/		K1;K2$D: DUMP FROM K1 THRU K2
/		$T: PUNCH TERMINAL BLOCK AND TRAILER
/
/
	.IFDEF	%%FS
/
/********** ($H)	USE FAST PUNCH
/
%H	JMS	%SEEND
	LAC	%LNOP
	DAC	%HLTA	/NO HALT FOR HIGH SPEED PUNCH
	LAC	%LPSA1
	DAC	%HISPD	/INST TO TURN ON HIGH SPEED PUNCH.
	LAC	%LJPHI	/GET JMS TO PUNCH HI SPEED.
%F1	DAC	%CALLI
	JMP	%ODT0	/GO TO COMMAND PROCESSOR
%LJPHI	JMS %PHI
/
/********** ($L)	USE SLOW PUNCH
/
%L	JMS	%SEEND
	LAC	%HALT
	DAC	%HLTA	/HALT FOR TURN ON/OFF OF SLOW PUNCH.
	LAC	%LNOP
	DAC	%HISPD	/DON'T TURN ON HI SPEED PUNCH.
	LAC	%JMSOT	/GET JMS TO SLOW SPEED OUTPUT
	JMP	%F1
	.ENDC
	.IFUND	%%DFT
/
/**********($F)	PUNCH LEADER
/
%F	JMS	%SEEND
	JMS	%IORES	/IO RESET
	JMS	%CRLF
	XCT	%HLTA	/HALT IF $L IN EFFECT.
	XCT	%HISPD	/PSA+10 IF $H IN EFFECT.
%L1	LAW	-360	/DECIMAL -240=24 INCHES OF TAPE
/
/PUNCH N BLANKS
/
%L2	DAC	%SAV1	/SET COUNT
%PSPCI	CLA
%CALLI	JMS	%OUT	/JMS %OUT FOR $L;JMS %PHI FOR$H. PUNCHES A FRAME.
	ISZ	%SAV1	/DONE?
	JMP	%PSPCI	/NO- DO IT AGAIN.
	XCT	%HLTA	/YES - HALT IF $L.
	JMS	%CRLF
	JMP	%ODT0	/TO NEXT COMMAND
/
/**********  (K1;K2$D)	DUMP FROM K1 THRU K2.
/
%D	JMS	%SEEND
	ISZ	%SEMI	/SEEN ; ?
	JMP	%QUEST	/NO - ERROR
			/YES - %WORDT = K1 (START ADR)
			/AND %WORDS = K2 (STOP ADR).
/
/THE STOP ADR MUST BE LARGER OR EQUAL TO START ADR.
	LAC	%WORDS
	CMA
	TAD	%WORDT	/DIFF = # OF WORDS TO PUNCH (2'S COMP).
	DAC	%WORDS	/SET COUNT.
	SMA
	JMP	%QUEST	/ERROR IF DIFF NOT NEGATIVE.
/
/FORM CHECKSUM, INCLUDING %WORDT AND %WORDS
/
	DAC	%SAV3
	TAD	%WORDT
	DAC	%CKSM	/INITIAL VALUE OF CHECKSUM
	JMS	%CRLF
	JMS	%RLOC1	/RESET LOC. 1
%HLTA	HLT		/HALT FOR $L; NOP FOR $H.
%HISPD	NOP		/NOP FOR $L; PSA+10 FOR $H.
	LAC	%WORDT
	DAC	%SAV1	/SET INITIAL POINTER
	LAC	%CKSM	/GET INITIAL VALUE OF CHECKSUM
%D2	TAD*	%SAV1	/ADD IN CORE VALUES
	ISZ	%SAV1	/UPDATE POINTER
	ISZ	%SAV3	/DONE ?
	JMP	%D2	/NO - GO ADD SOME MORE
	CMA		/FORM FINAL CHECKSUM
	TAD	%LL01	/IN 2'S COMP.
	DAC	%CKSM	/STORE
	LAC	%WORDT	/GET START ADR.
	JMS	%3OUT	/PUNCH IT.
	LAC	%WORDS	/GET WORD COUNT
	JMS	%3OUT	/PUNCH IT
	LAC	%CKSM
	JMS	%3OUT	/PUNCH CHECKSUM
%D1	LAC*	%WORDT	/GET SOURCE
	ISZ	%WORDT
	JMS	%3OUT	/PUNCH
	ISZ	%WORDS	/DONE?
	JMP	%D1	/NO
	LAW	-12	/YES- PUNCH SPACER BLOCK
	JMP	%L2
/
/**********  PUNCH TERMINAL BLOCK
/
%T	JMS	%SEEND
	JMS	%CRLF
	LAC	%WORDS	/GET INPUT
	ISZ	%FRSCS	/WAS THERE ANY OCTAL INPUT?
	SKP!CLC		/NO-- -1 TO HALT LOADER
	XOR	%LXCT	/YES---SET HIGH BIT OF WORD
	DAC	%SAV1
	XCT	%HLTA	/HALT IF $L
	XCT	%HISPD	/START PNCH IF $H
	LAC	%SAV1
	JMS	%3OUT	/PUNCH START ADDRESS
	CLA
	JMS	%3OUT	/PUNCH DUMMY WORD
	JMP	%L1	/PUNCH TRAILER
/
/%PHI	PUNCH A FRAME ON HIGH SPEED PUNCH
/
/	CHARACTER IN AC.
/
/
%PHI	0
	DAC	%CHARO	/SAVE CHARACTER
%PHIA	IORS
	AND	%L400	/SAVE NO TAPE FLAG
	SZA		/SKIP IF OFF
	JMP	%PHIA	/WAIT IF ON
%PHIC	LAC	%CHARO	/GET CHAR
	PSF		/TEST FLAG
	JMP	.-1	/WAIT IF OFF
	PSA		/PUNCH (ALPHA)
	JMP*	%PHI	/EXIT
/
/%3OUT	PUNCH 3 FRAMES
/	18 BITS IN AC
/
%3OUT	0
	RCL
	DAC	%SAV1	/SAVE OUTPUT
	LAW	-3
	DAC	%SAV3	/SET 3 COUNTER
%3OUTA	LAC	%SAV1
	JMS	%R6L	/GET A 6 BIT FRAME
	DAC	%SAV1
	AND	%L77
	XOR	%L200	/SET CHANNEL 8
	XCT	%CALLI	/PUNCH A FRAME
	ISZ	%SAV3	/DONE 3 FRAMES?
	JMP	%3OUTA	/NO
	JMP*	%3OUT	/YES-EXIT
	.ENDC
/%NOBRK			REMOVE ALL BREAK ADDRESSES
%DUM=.
%NOBRK	0
	.IFUND	%%OB
	LAW	%DUM	/DUMMY ADDRESS
	JMS	%FILL
	LAW	%T1	/FILL TABLE 1
	LAW	%T1+3
	JMP*	%NOBRK	/EXIT
	.ENDC
/%NUMOU	PRINT SOME OCTAL NUMBERS
/	INPUT # OF DIGITS TO PRINT IN AC
/	SOURCE # IN LOC. % SAV5
%NUMOU	0
	DAC	%SAV1		/SET LOOP COUNT
%NUMOA	LAC	%SAV5		/GET SOURCE
	RTL
	RAL
	DAC	%SAV5		/GET 3 BITS IN LOW ORDER C.
	AND	%L7
	TAD	%L260		/CONVERT TO ASCII
	JMS	%OUT		/PRINT
	ISZ	%SAV1		/DONE?
	JMP	%NUMOA		/NO
	JMP*	%NUMOU		/YES
/%DELY		DELAY FOR 200 MS
%DELY	0
	LAC	%LTIM
	DAC	%SAV5		/SET A 200 MS TIME-OUT
	ISZ	%SAV5
	JMP	.-1
	JMP*	%DELY		/EXIT
/
/R6L	ROTATE AC 6 LEFT
%R6L	0
	RTL
	RTL
	RTL
	JMP*	%R6L		/EXIT
/
/SUBROUTINE %SETLO SAVES LOW CORE AND SETS IT UP FOR INTERCEPTING
/INTERRUPTS
/
%SETLO	0
	LAC*	%LL01		/SAVE LOCATION 1
	DAC	%LOC1
	LAC*	%LL02		/SAVE LOCATION 2
	DAC	%LOC2
	LAC	%LJMP2
	DAC*	%LL01		/SET UP FOR JMP* 2, 2=%INT ADDRESS.
	LAC %JINT		/%LJINT=%INT
	DAC*	%LL02
	JMP*	%SETLO
/
/	ODT15 DATA AREA
/
/	GENERAL REGISTERS.
%AREG	0			/AC AT BREAKPOINT
%LINK	0			/LINK AT BREAKPOINT
%XMODE	0
	.IFDEF %%BANK
%AMODE	LAC
	.ENDC
	.IFUND %%BANK
%AMODE	0
	.ENDC
	.IFUND	%%WM
%MASK	0			/SEARCH MASK
%LO	0			/LOW LIMIT
%HI	0			/HIGH LIMIT
	.ENDC
%CAD	0			/CURRENT ADR OF OPEN REGISTER.
	.IFUND	%%KU
%HF	0			/$K,$U FLAG
	.ENDC
%USTAD	0			/USER PROG START ADDRESS.
	.IFUND	%%V
%VREG	17			/AUTOINDEX #
	.ENDC
	.IFUND %%OB
/
/	BREAKPOINT STATUS TABLE
/
/	ADR OF BREAK; IF NOT ACTIVW, ADR IS SET=%DUM, A DUMMY.
/
%T1	0;	0;	0;	0
/
/	LOOP COUNT FOR BREAK
/
%T3	0;	0;	0;	0
/
/	USER INSTRUCTION AT BREAK.
/
%T2	0;	0;	0;	0
/
	.ENDC
	.IFDEF	%%OB
%T1	0
%T3	0
%T2	0
	.ENDC
/
/	GENERAL STORAGE AND FLAGS
/
/	NOTE: THE AREA FROM %N THRU %NOGO IS CLEARED BY %REST
/
%N	0			/# OF ACTIVE BREAK.
	.IFUND	%%X
%SKPX	0			/$X OF A SKIP.
%XIP	0			/$X IN PROGRESS
	.ENDC
%TTIF	0			/TTI CHAR READY.
%TTOF	0			/TTO READY FOR CHAR.
	.IFUND	%%KU
%HFF	0			/PI,API OFF BECAUSE OF $K.
	.ENDC
%TTOST	0			/TTO STATUS AT BREAK.
%NOGO	0			/DO NOT BREAK; COUNT NOT SATISFIED.
%SHUT	-1			/0=OPEN REGISTER
				/-1=NO OPEN REGISTER
	.IFUND	%%DFT
%SEMI	0			/SEMICOLON SEEN IN INPUT.
%WORDT	0			/INPUT STATUS WHEN; SEEN.
%FRSCT	0
%CKSM=%SAV5			/CHECKSUM STORAGE FOR DUMP.
	.ENDC
%DOL	0			/$ SEEN IN INPUT.
%WORD	0			/OCTAL INPUT ACCUMULATOR.
%FRSTC	0			/OCTAL INPUT SEEN.
%TOTE	0			/CHARACTER COUNTER.
%WORDS	00			/SAVED INPUT STATUS WHEN
%FRSCS	0			/ $ SEEN.
%PC	0			/PSEUDO PC
%PCS=%PIAPI			/SAVED PC FOR $ 
%LOC1	0			/USER'S LOC. 1 INSTRUCTION.
/
	.IFUND	%%OB
%TP1	0			/POINTER TO TABLE %T1
%TP3	0			/POINTER TO TABLE %T3
	.ENDC
%STAT1	0			/PI STATUS AND
%STAT2	0			/API STATUS AT BREAK.
%CHARI	0			/INPUT CHAR
%CHARO	0			/OUTPUT CHAR.
%INAC	0			/AC AT INTERRUPT (PI)
%TO	0			/TIME-OUT FOR OUTPUT
%BRKIN	JMS+%AUTOX+20000	/(JMS* %AUTO) BREAKPOINT INSTRUCTION.
%JINT	%INT
	.ENDC			/EXTRA .ENDC'S IN
	.ENDC			/CASE OF ERROR.
	.ENDC
/
/CONSTANTS **********
%LAUTO	%AUTOX	/USED TO RESET %AUTOX	
%AXREG	%AUTOX	/VARIABLE CHANGES EVERY TIME $V IS USED.
%LBRK1	%BRK-1
%L10	10
%LINST	CAL* %SAV4
%L175	175
%L176	176
%L33	33
%L44	44
%L25	25
%L3777	3777
%LODT	%ODT
%LL01	1
%LL02	2
%LM4K	17777
%L147S=%LM4K
%T1M1	%T1-1
%L4	4
%L45Z	400000
%L200	200
%L42	400200
%LNOP	NOP
%SAV4	0
%LEBA	EBA
%LDBA	DBA
%L47S	7777
%LJMP2	620002	/JMP* 2
%L0	0	/CONSTANT.
%LEAE	640000
%LIOT	IOT
%L24Z	20000
%INBIT=%L24Z
%LPAGE	10000	/PAGE BIT.
%L347S	37777
%LLAC	LAC
%LJMP	JMP
%LJMS	JMS
%LXCT=%L45Z
%L700	700
%L300	300
%L100	100
%LX4	%X4
%LDT11	DAC %T1-1
%LTOVL	%TOVAL
%L77	77
%JMSI	JMS+20000	/JMS*
%L40	40
%LPSA1	PSA+10
%L400	400
%L7	7
%L260	260
%LTIM	%TIMO
%LJBRK1	JMP %BRK1
%LOC0	0
%LOC2	0
/USER MUST SUPPLY THE .END STATEMENTg