Google
 

Trailing-Edge - PDP-10 Archives - bb-kl11c-bm_tops20_v6_1_atpch1_16 - autopatch/algots.c05
There are 15 other files named algots.c05 in the archive. Click here to see a list.
 REP 3/1	;05C1
	;COPYRIGHT (C) 1975,1981,1982 BY
 WIT
	;COPYRIGHT (C) 1975,1982,1983 BY
 REP 20/2	;05C2
		IFN FTGETCHK,<PRINTX HEAP INTEGRITY CHECKER LOADED>>
 WIT
		IFN FTGETCHK,<PRINTX Heap integrity checker loaded>>
 REP 34/11	;05C3
		POPJ	SP,0
 WIT
		POPJ	SP,
 DEL 5/21	;05C4
	EDIT(100); Chain DL for debugger
 REP 26/26	;05C5
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 32/26	;05C6
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 17/27	;05C7
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 23/27	;05C8
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 17/28	;05C9
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 23/28	;05C10
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 17/29	;05C11
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 23/29	;05C12
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 44/29	;05C13
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 5/30	;05C14
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 26/30	;05C15
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 33/30	;05C16
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 27/31	;05C17
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 31/31	;05C18
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 31/35	;05C19
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 16/38	;05C20
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 22/38	;05C21
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 40/38	;05C22
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 8/39	;05C23
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 18/39	;05C24
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 25/39	;05C25
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 37/39	;05C26
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 48/39	;05C27
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 9/40	;05C28
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 16/40	;05C29
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 26/40	;05C30
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 37/40	;05C31
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 49/40	;05C32
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 58/40	;05C33
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 11/41	;05C34
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 18/41	;05C35
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 22/43	;05C36
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 23/44	;05C37
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 43/44	;05C38
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 19/46	;05C39
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 42/54	;05C40
		POPJ	SP,0		; [E053] AND RETURN
 WIT
		POPJ	SP,		; [E053] AND RETURN
 REP 16/56	;05C41
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 9/57	;05C42
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 20/57	;05C43
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 31/57	;05C44
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 10/58	;05C45
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 21/58	;05C46
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 32/58	;05C47
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 10/59	;05C48
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 20/59	;05C49
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 17/62	;05C50
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 12/63	;05C51
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 21/63	;05C52
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 30/63	;05C53
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 39/63	;05C54
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 48/63	;05C55
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 8/64	;05C56
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 17/64	;05C57
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 40/64	;05C58
		POPJ	SP,0		; NO
 WIT
		POPJ	SP,		; NO
 REP 44/64	;05C59
		POPJ	SP,0		; IF REQUIRED
 WIT
		POPJ	SP,		; IF REQUIRED
 REP 23/65	;05C60
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 27/65	;05C61
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 10/66	;05C62
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 15/66	;05C63
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 26/66	;05C64
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 31/66	;05C65
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 15/72	;05C66
		MOVEI	A0,0		; SET A0 FOR GETOWN

	BLKE1:	POP	SP,A1		; UNSTACK
		JUMPL	A1,BLKE2	; BLOCK POINTER?
		TLZE	A1,(<Z 17,0>)	; [E057] IS THIS A STRING ARRAY ?
		PUSHJ	SP,DELSCN	; [E057] YES - DELETE SUB-STRINGS
		MOVEI	A1,@A1		; GETSTRING ITSELF, IF STRING VARIABLE.
		JUMPE	A1,BLKE1	; IF NO STRING ASSIGNED, DON'T DELETE.
		PUSHJ	SP,GETOWN	; NO - DELETE ITEM
		JRST	BLKE1
 WIT
		MOVE	A2,[-20,,%IODR+20] ; [316] AOBJN PTR. TO SCAN LOGICAL I/O TABLE
		ADDI	A2,(DB)		; [316] RELOCATE
		SETZM	A01TMP(DB)	; [316] CLEAR "LOGICAL CHANNELS IN USE" FLAG
	BLKELP:	SKIPN	A3,(A2)		; [316] IS THIS LOGICAL CHANNEL IN USE?
		JRST	BLKE1A		; [316] NO, SKIP TO NEXT ENTRY
		HRRZ	A3,1(A3)	; [316] YES, LOAD CURRENT ADDR. OF I/O STRING
		MOVEM	A3,%DDTCB-%IODR-20(A2) ; [316] PUT ADDR. INTO TABLE FOR LATER
		SETOM	A01TMP(DB)	; [316] SET FLAG TO SAY WE FOUND A CHANNEL
		TRNA			; [316] AND SKIP THE NEXT SETZM
	BLKE1A:	SETZM	%DDTCB-%IODR-20(A2) ; [316] UNASSIGNED CHANNEL, CLEAR ENTRY
		AOBJN	A2,BLKELP	; [316] LOOP UNTIL DONE SCANNING I/O TABLE

		MOVEI	A0,0		; [316] SET A0 FOR GETOWN
	BLKE1B:	POP	SP,A1		; [316] UNSTACK
		JUMPL	A1,BLKE2	; [316] JUMP IF THIS ISN'T A BLOCK POINTER
		TLZE	A1,(<Z 17,0>)	; [316] [E057] ELSE, IS THIS A STRING ARRAY?
		PUSHJ	SP,DELSCN	; [316] [E057] YES, DELETE SUB-STRINGS
		MOVEI	A1,@A1		; [316] NO, STATICISE
		JUMPE	A1,BLKE1B	; [316] LOOP IF NO STRING ASSIGNED
		SKIPN	A01TMP(DB)	; [316] ELSE, ANY LOGICAL I/O CHANNELS IN USE?
		JRST	BLKE1C		; [316] NO, JUMP AHEAD
		MOVE	A2,[-20,,%DDTCB]; [316] YES, LOAD PTR. TO SCAN I/O TABLE
		ADDI	A2,(DB)		; [316] RELOCATE
	BLKEL1:	SKIPN	(A2)		; [316] GET NEXT I/O ENTRY - UNUSED CHANNEL?
		JRST	BLKE1D		; [316] YES, SKIP TO NEXT ENTRY
		CAMLE	A1,(A2)		; [316] NO, RETURNED SPACE ABOVE I/O SPACE?
		JRST	BLKE1D		; [316] YES, STRING IS OK
		HLRZ	A3,-1(A1)	; [316] NO, GET STRING'S HEAP SPACE LENGTH
		ADDI	A3,-1(A1)	; [316] CALCULATE STRING END ADDR.
		CAMG	A3,(A2)		; [316] IS I/O CHANNEL OPEN TO THIS STRING?
		JRST	BLKE1D		; [316] NO, STRING AND CHANNEL ARE BOTH OK
		SETZM	%IODR+20-%DDTCB(A2)  ; [323] AND SHUTDOWN THE CHANNEL
		SETZM	%IOSTS+20-%DDTCB(A2) ; [323] ALSO CLEAR EXTRA STATUS BITS
	BLKE1D:	AOBJN	A2,BLKEL1	; [316] LOOP UNTIL DONE WITH I/O TABLE
	BLKE1C:	PUSHJ	SP,GETOWN	; [316] DELETE STRING SPACE
		JRST	BLKE1B		; [316] LOOP UNTIL ALL STRINGS RELEASED
 REP 3/88	;05C67
		POPJ	SP,0		; AND EXIT
 WIT
		POPJ	SP,		; AND EXIT
 REP 26/90	;05C68
	GETKNL:	; KERNEL OF GETOWN - A2 = TABLE POINTER (-LENGTH,,ADDR)
	Edit(062); Use current top of heap if possible
		PUSH	SP,A2		; [E062] SAVE TABLE POINTER
 WIT
	;	EDIT(062); Use current top of heap if possible

	; KERNEL OF GETOWN - A2 = TABLE POINTER (-LENGTH,,ADDR)
	GETKNL:	PUSH	SP,A2		; [E062] SAVE TABLE POINTER
 REP 33/90	;05C69
	GET1:				; ORDINARY GET-N-WORDS ENTRY
		ADDI	A0,1		; ALLOW FOR LINK-WORD
 WIT
	; ORDINARY GET-N-WORDS ENTRY
	GET1:	ADDI	A0,1		; ALLOW FOR LINK-WORD
 REP 50/90	;05C70
		CAIN	A5,0		; [246] IS THIS HEAP ENTRY ALREADY IN USE?
		JRST	[			; [246]
			POP	SP,A5		; [246] YES, IT'S NO GOOD - RESTORE A5
			JRST	GET15		; [246] KEEP SCANNING HEAP TABLE
			]			; [246]
		POP	SP,A5		; [246] NO, RESTORE A5
		MOVEI	A3,(A1)		; [246] THIS ENTRY IS GOOD - REMEMBER IT
		HRLI	A3,(A2)
 WIT
		JUMPE	A5,[POP	SP,A5		; [316] [246] JUMP IF ENTRY IN USE
			JRST	GET15]		; [316] [246] KEEP SCANNING HEAP TABLE
		POP	SP,A5		; [316] [246] ELSE RESTORE A5
		MOVEI	A3,(A1)		; [246] THIS ENTRY IS GOOD - REMEMBER IT
		HRLI	A3,(A2)
 REP 9/91	;05C71
		  TDZA	A1,A1		; [E062] NOT FOUND - LENGTH = 0
 WIT
		 TDZA	A1,A1		; [E062] NOT FOUND - LENGTH = 0
 REP 20/91	;05C72
	GET17:	MOVS	A2,A3		; A2 IS LENGTH,,TABLE POINTER
 WIT
	GET17:	MOVS	A2,A3		; GET LENGTH,,TABLE POINTER
 REP 1/92	;05C73
	GET2:				; A0 = 0 - RETURN SPACE ADDRESSED BY A1
		TLZ	DB,TMPFL1!TMPFL2; CLEAR TEMPORARY FLAG BITS
		HLRZ	A0,-1(A1)	; A0 IS LENGTH OF RETURNED PIECE
		ADDI	A0,-1(A1)	; NOW TOP ADDRESS + 1
		MOVEI	A1,-1(A1)	; GET ADDRESS OF BOTTOM OF PIECE
 WIT

	GET2:				; A0 = 0 - RETURN SPACE ADDRESSED BY A1
		TLZ	DB,TMPFL1!TMPFL2; CLEAR TEMPORARY FLAG BITS
		MOVEI	A1,-1(A1)	; [326] GET BOTTOM ADDR. OF RETURNED SPACE
	IFN FTGETCHK,<			; [326] MAKE SURE SPACE ISN'T RETURNED TWICE
	GET2A:	SKIPN	A3,(A2)		; [326] GET TABLE ENTRY ADDR.
		 JRST	GET2B		; [326] NULL ENTRY, IGNORE
		CAIGE	A1,(A3)		; [326] IS RETURNED SPACE BELOW THIS ENTRY?
		 JRST	GET2B		; [326] YES, OK SO FAR
		HLRZ	A0,A3		; [326] NO, CHECK IF COMPLETELY ABOVE ENTRY
		ADDI	A0,-1(A3)	; [326] GET END ADDR. OF HEAP ENTRY
		CAMG	A1,A0		; [326] IS RETURNED SPACE ABOVE THIS ENTRY?
		 PUSHJ	SP,GETERR	; [326] NO, SPACE IS BEING RETURNED TWICE
	GET2B:	AOBJN	A2,GET2A	; [326] LOOP UNTIL DONE WITH HEAP TABLE
		SKIPE	A2,(A2)		; [326] ANY MORE HEAL TABLES TO USE?
		 JRST	GET2A		; [326] YES, KEEP WORKING
		MOVE	A2,%SYS2(DB)	; [326] NO, RESTORE HEAP TABLE PTR.
	> ; [326] END IFN FTGETCHK
		HLRZ	A0,(A1)		; [326] A0 IS LENGTH OF RETURNED PIECE
		ADDI	A0,(A1)		; [326] NOW TOP ADDRESS + 1
 REP 23/93	;05C74
	;[251] IS NOT, THEN SOME PARTS OF EACH TABLE ENTRY OVERLAP AND THE TABLE IS BAD.
 WIT
	;[251] IS NOT, THEN SOME PART OF EACH TABLE ENTRY OVERLAP AND THE TABLE IS BAD.
 REP 31/93	;05C75
	GET001:	SKIPN	A4,(A2)		;[251] GET REFERENCE ENTRY'S LOW ADDRESS LIMIT
		JRST	GET003		;[251] NULL ENTRY, SKIP IT
		TLZ	A4,-1		;[251] CLEAR LENGTH OUT OF LEFT HALF
		SKIPN	A5,(A3)		;[251] GET NEXT HEAP COMPARISON ENTRY
 WIT
		SKIPN	A4,(A2)		;[326] [251] GET REF. ENTRY'S LOW ADDR. LIMIT
		JRST	GET003		;[251] NULL ENTRY, SKIP IT
		HLRZ	A5,(A4)		;[326] GET LENGTH OF HEAP AREA FROM MEMORY
		MOVSS	A4		;[326] GET LENGTH FROM HEAP TABLE
		SKIPN	A5		;[326] LENGTH=0?
		 PUSHJ	SP,GETERR	;[326] YES, BAD HEAP
		CAIE	A5,(A4)		;[326] NO, LENGTHS THE SAME?
		 PUSHJ	SP,GETERR	;[326] NO, HEAP PROBLEMS
		HLRZS	A4		;[326] YES, GET ADDR. BACK
		HRRZ	A5,(A4)		;[326] GET TABLE ADDR. W/O LENGTH
		CAIE	A5,(A2)		;[326] HEAP & TABLE PTRS. POINT TO EACH OTHER?
		 PUSHJ	SP,GETERR	;[326] NO, HEAP PROBLEMS
	GET001:	HRRZ	A4,(A2)		;[326] YES, GET REF. ENTRY ADDR. BACK
		SKIPN	A5,(A3)		;[251] GET NEXT HEAP COMPARE ENTRY
 REP 44/93	;05C76
		SUB	A5,A4		;[251] DO AREAS OVERLAP AT ALL?
		JUMPL	A5,GETERR	;[251] YES HEAP TABLE IS BAD
 WIT
		SUB	A5,A4		;[316] [251] CALCULATE IF THEY OVERLAP
		SKIPGE	A5		;[316] [251] DO THEY OVERLAP?
		PUSHJ	17,GETERR	;[316] YES, FATAL ERROR
 REP 1/94	;05C77
	GETOWN:	MOVE	A2,%SYS2(DB)	; GET POINTER TO PUBLIC HEAP-TABLE
		PUSHJ	SP,GETKNL	; DO THE JOB
		IFN	FTGETCHK,<
		; ***** OPTIONAL HEAP INTEGRITY CHECKER *****

 WIT

	GETOWN:	MOVE	A2,%SYS2(DB)	; GET POINTER TO PUBLIC HEAP-TABLE
		PUSHJ	SP,GETKNL	; DO THE JOB
	IFN	FTGETCHK,<
 REP 11/94	;05C78
		HRRZ	A2,%SYS2(DB)
		HLRE	A3,%SYS2(DB)	; - (LENGTH OF LIST -1)
 WIT
		HLRE	A3,A2		; [326] - (LENGTH OF LIST -1)
		MOVEI	A2,(A2)		; [326] CLEAR LENGTH OUT
 REP 21/94	;05C79
		JUMPE	A0,GETERR	; [263] ERROR IF ENTRY IS ZERO
		ADD	A2,A0		; MOVE TO NEXT CHUNK
 WIT
		SKIPN	A0		; [316] [263] IS ENTRY ZERO?
		PUSHJ	17,GETERR	; [316] YES, FATAL ERROR
		ADD	A2,A0		; [316] NO, MOVE TO NEXT CHUNK
 REP 26/94	;05C80
		JRST	GETERR		; NO
 WIT
		PUSHJ	17,GETERR	; [316] NO
 REP 36/94	;05C81
		JRST	GETERR		; [263] NO, ERROR
 WIT
		PUSHJ	17,GETERR	; [316] [263] NO, ERROR
 REP 41/94	;05C82
		JRST	GETERR		; NOPE
		JRST	GETX3		; YES - OK

	GETX9:	>	; END OF FTGETCHK
 WIT
		PUSHJ	17,GETERR	; [316] NOPE
		JRST	GETX3		; YES - OK
	GETX9:
	> ; END OF FTGETCHK
 REP 50/94	;05C83
	?ALGCEH CONSISTENCY ERROR IN HEAP HANDLER/]  ;[251]
 WIT
	?ALGCEH CONSISTENCY ERROR IN HEAP HANDLER
	/]				;[316][251] P.C. OF FAILING CODE IS ON STACK
 REP 26/96	;05C84
		POPJ	SP,0		; YES - EXIT
 WIT
		POPJ	SP,		; YES - EXIT
 REP 34/96	;05C85
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 44/96	;05C86
		POPJ	SP,0		; NO - EXIT
 WIT
		POPJ	SP,		; NO - EXIT
 REP 41/98	;05C87
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 51/98	;05C88
		POPJ	SP,0		; YES - TAKE ERROR RETURN
 WIT
		POPJ	SP,		; YES - TAKE ERROR RETURN
 REP 5/99	;05C89
		POPJ	SP,0		; AND TAKE ERROR RETURN - A13 = CHAN #
 WIT
		POPJ	SP,		; AND TAKE ERROR RETURN - A13 = CHAN #
 REP 16/99	;05C90
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 30/101	;05C91
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 40/101	;05C92
		POPJ	SP,0		; YES - TAKE ERROR RETURN
 WIT
		POPJ	SP,		; YES - TAKE ERROR RETURN
 REP 6/102	;05C93
		POPJ	SP,0		; AND GIVE ERROR RETURN - A13 = CHAN #
 WIT
		POPJ	SP,		; AND GIVE ERROR RETURN - A13 = CHAN #
 REP 13/102	;05C94
		TLNE	A11,TTYDEV!TTYTTC;[E112] not going to terminal, ignore.
	EDIT(174); do not duplicate last byte is redirected dump mode
		JRST	OUBT11		;[174] NOT ALGDDT CASE (USE EXISTING CODE)
		JUMPL	A10,OUBT3	;[174] ALGDDT CASE AND BREAK OUTPUT (IGNORE)
		JRST	OUBT12		;[174] ALGDDT CASE AND OUTBYTE
	OUBT11:	JUMPL	A10,OUBT4	;[174] BREAK OUTPUT?
	OUBT12:	TLNE	A11,TTYTTC	; [255] NO, IF TTY DON'T SEND NULL BYTES
		JUMPE	A13,OUBT3	; [255] JUMP IF NULL
		IDPB	A13,BYTPTR(A11)	;[174] NO - PLANT BYTE
 WIT
		TLNE	A11,TTYDEV!TTYTTC ; [E112] not going to terminal, ignore.
	EDIT(174); do not duplicate last byte is redirected dump mode
		JRST	OUBT11		; [174] NOT ALGDDT CASE (USE EXISTING CODE)
		JUMPL	A10,OUBT3	; [174] ALGDDT CASE AND BREAK OUTPUT (IGNORE)
		JRST	OUBT12		; [174] ALGDDT CASE AND OUTBYTE
	OUBT11:	JUMPL	A10,OUBT4	; [174] BREAK OUTPUT?
	OUBT12:	TLNE	A11,TTYTTC	; [255] NO, IF TTY DON'T SEND NULL BYTES
		JUMPE	A13,OUBT3	; [255] JUMP IF NULL
		IDPB	A13,BYTPTR(A11)	; [174] NO - PLANT BYTE
 REP 26/102	;05C95
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 6/104	;05C96
	INCHAR:
		TLNE	DB,INDDT	; IF DDT 
		  JRST	DDTIN%		;  LET HIM DO IT.
		PUSHJ	SP,INBYTE	; GET NEXT BYTE
		IOERR	6,(A13)		; END OF FILE - A13 = CHAN #
		JRST	CNC.AX

		;
		EDIT(145) ; Make EOF a terminator.
		;
	INCHR0:	TLNE	DB,INDDT	; [E145] If in DDT
		  JRST	DDTIN%		; [E145] ..then let him do it.
		PUSHJ	SP,INBYTE	; [E145] Get next byte.
	EDIT (206); IF TRAPPING FOR EOF, USE TRAP
		SKIPA			;[206] EOF, CHECK TO SEE IF WE ARE TRAPPING IT
		JRST	CNC.AX		; [E145]
		PUSH	SP,A13		;[206] SAVE THE CHANNEL NUMBER
		MOVEI	A13,^D38	;[206] CHECK TO SEE IF WE ARE TRAPPING EOF
		ADDI	A13,(DB)	;[206] RELOCATE THE TRAP NUMBER IN THE D.B.
		HRRZ	A13,%TRAPS(A13)	;[206] GET ADDRESS OF TRAP BLOCK, OR ZERO
		SKIPN	A13		;[206] SKIP IF A TRAP IS SET HERE
		 JRST	INCHR1		;[206] NONE SET, GIVE A LF
		POP	SP,A13		;[206] TRAP SET, RESTORE CHANNEL NUMBER
		IOERR	6,(A13)		;[206] AND GIVE THE ERROR
		JRST	CNC.AX		;[206] AND RETURN
	INCHR1:	POP	SP,A13		;[206] NO TRAP SET, RETURN LF LIKE EDIT 145
		MOVEI	A13,LF		;[206] AFTER POPPING THE STACK
		JRST	CNC.AX		;[206] RETURN WITH FREE LF
 WIT
	INCHAR:	TLNE	DB,INDDT	; IF DDT 
		 JRST	DDTIN%		;  LET HIM DO IT.
		PUSHJ	SP,INBYTE	; GET NEXT BYTE
		 IOERR	6,(A13)		; END OF FILE - A13 = CHAN #
		JRST	CNC.AX

	;	EDIT(145) ; Make EOF a terminator.

	INCHR0:	TLNE	DB,INDDT	; [323] [E145] IF IN ALGDDT
		 JRST	DDTIN%		; [323] [E145] THEN LET IT DO INPUT ITSELF
		PUSHJ	SP,INBYTE	; [323] [E145] ELSE READ NEXT BYTE
		 TRNA			; [323] EOF, SKIP AND TEST STATUS
		JRST	CNC.AX		; [323] NORMAL RETURN

		HLRZ	A10,%CHAN(DB)	; [323] GET CHANNEL NUMBER
		ADDI	A10,%IOSTS(DB)	; [323] RELOCATE IT
		SKIPGE	A11,(A10)	; [323] HAVE WE ALREADY GIVEN AN EOF <LF>?
		 IOERR	6,(A13)		; [323] YES, GIVE TRAP/FATAL ERROR THIS TIME
		TLO	A11,(LFEOF)	; [323] NO, SAY THAT THIS IS FIRST EOF FOUND
		MOVEM	A11,(A10)	; [323] REMEMBER FOR NEXT TIME THROUGH
		MOVEI	A13,LF		; [323] LOAD A <LF>
		JRST	CNC.AX		; [323]] RETURN WITH FREE <LF>

 REP 43/104	;05C97
		POPJ	SP,0
		JRST	IGNICH		; IGNORE CR, LF, VT AND FF
 WIT
		POPJ	SP,
		JRST	IGNICH		; IGNORE CR, LF, VT AND FF
 REP 19/111	;05C98
		POPJ	SP,0		; NO
 WIT
		POPJ	SP,		; NO
 REP 23/111	;05C99
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 33/114	;05C100
		JOV	[TLO A2,INTOVL		; OVERFLOWED - SET FLAG
			MOVE	A0,[^D24359738368]  ; AND LOAD 2^35 - 10^10
			JRST	PRIN7]
 WIT
		JOV	[TLO A2,INTOVL		; [327] OVERFLOWED - SET FLAG
			MOVE	A0,[^D24359738368] ; [327] AND LOAD 2^35 - 10^10
			JRST	PRIN7]		; [327]
 REP 5/115	;05C101
		POPJ	SP,0		; EXIT FROM ROUTINE
 WIT
		POPJ	SP,		; EXIT FROM ROUTINE
 REP 15/115	;05C102
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 20/115	;05C103
		JOV	[
		MOVSI	A0,244400	; OVERFLOW - FORM 2.0^35
		JRST	PRIN18]

	PRIN15:	CAML	A0,[^D100000000]  ; 9 OR MORE DIGITS?
 WIT
		JOV	[MOVSI	A0,244400	; [327] OVERFLOW - FORM 2.0^35
			JRST	PRIN18]		; [327]

	PRIN15:	CAML	A0,[^D100000000] ; 9 OR MORE DIGITS?
 REP 3/116	;05C104
		FADRI	A0,000000	; ENSURE STANDARDIZED
		JFOV	[
		MOVEI	A0,0		; BAD NUMBER - ZERO IT
		JRST	PRIN22]
 WIT
		FADRI	A0,0		; [327] INSURE STANDARDIZED
		JFOV	[MOVEI	A0,0		; [327] BAD NUMBER - ZERO IT
			JRST	PRIN22]		; [327] AND CONTINUE
 REP 18/116	;05C105
		CAMGE	A0,[
		XWD	002663,437347]	; VERY SMALL NUMBER?
 WIT
		CAMGE	A0,[2663,,437347] ; [327] VERY SMALL NUMBER?
 REP 3/117	;05C106
		LDB	A7,[
		POINT	9,A0,8]		; EXTRACT EXPONENT
		TLZ	A0,377000	; AND CLEAR IT OUT
		ASH	A0,-170(A7)	; AND CONVERT TO FRACTIONAL FORM
		JOV	[
		MOVE	A0,[
		XWD	031463,146315]
		AOJA	A13,PRIN36]	; CORRECT IF OVERFLOWED
 WIT
		LDB	A7,[POINT 9,A0,8] ; [327] EXTRACT EXPONENT
		TLZ	A0,377000	; AND CLEAR IT OUT
		ASH	A0,-170(A7)	; [327] CONVERT TO FRACTIONAL FORM
		JOV	[MOVE	A0,[31463,,146315] ;[327]
			AOJA	A13,PRIN36]	; [327] CORRECT IF OVERFLOWED
 REP 19/122	;05C107
		POPJ	SP,0		; EXIT
 WIT
		POPJ	SP,		; EXIT
 REP 31/123	;05C108
		POPJ	SP,0		; NO
		MOVE	A13,A1
		JSP	AX,OUCHAR	; YES - OUTPUT SECOND WORD
		POPJ	SP,0
 WIT
		POPJ	SP,		; NO
		MOVE	A13,A1
		JSP	AX,OUCHAR	; YES - OUTPUT SECOND WORD
		POPJ	SP,
 REP 13/125	;05C109
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 31/125	;05C110
		POPJ	SP,0
 WIT
		POPJ	SP,
 REP 49/129	;05C111
		TLOA	A1,INEOF	; [E131] FLAG (INEOF OR
		TLO	A1,OUTEOF	; [E131] OUTEOF) IF NO BYTES
	INOU17:	MOVEM	A1,%IODR(A2)	; SET UP IO DIRECTORY ENTRY
		MOVEI	A1,0		; SAY OK
		POPJ	SP,0
 WIT
		 JRST	[TLO	A1,INEOF	; [323] SET INPUT EOF
			SETZM	%IOSTS(A2)	; [323] FIRST TIME WE FOUND EOF
			JRST	INOU17]		; [323]
		TLO	A1,OUTEOF	; [323] SET OUTPUT EOF
	INOU17:	MOVEM	A1,%IODR(A2)	; SET UP IO DIRECTORY ENTRY
		MOVEI	A1,0		; SAY OK
		POPJ	SP,
 INS 22/132	;05C112
		SETZM	%IOSTS(A1)	; [323] CLEAR EXTRA EOF FLAG
 REP 10/134	;05C113
		MOVEM	A4,.JBFF	; AND SET UP JOBFF
 WIT
		MOVEM	A4,.JBFF	; AND SET UP JBFF
 REP 31/134	;05C114
		MOVEM	A0,(A4)		; STORE DEVICE NAME
		SETOM	.JBFF		; FIX JOBFF
		MOVEI	A1,0		; SAY OK
		POPJ	SP,0		; AND EXIT
 WIT
		SETZM	%IOSTS(A1)	; [323] CLEAR EXTRA EOF FLAG
		MOVEM	A0,(A4)		; STORE DEVICE NAME
		SETOM	.JBFF		; FIX JBFF
		MOVEI	A1,0		; SAY OK
		POPJ	SP,		; AND EXIT
 REP 18/135	;05C115
		POPJ	SP,0		; NO - ERROR RETURN
 WIT
		POPJ	SP,		; NO - ERROR RETURN
 INS 29/135	;05C116
		SETZM	%IOSTS(A4)	; [323] AND EXTRA EOF FLAG
 REP 10/136	;05C117
		POPJ	SP,0		; YES - EXIT
 WIT
		POPJ	SP,		; YES - EXIT
 REP 22/136	;05C118
		POPJ	SP,0		; EXIT

	REL5:	SETZM	%IODR(A4)	; OVRLAY'S CHAN - JUST CLEAR DIR. ENTRY
 WIT
		POPJ	SP,		; EXIT

	REL5:	SETZM	%IODR(A4)	; OVRLAY'S CHAN - JUST CLEAR DIR. ENTRY
		SETZM	%IOSTS(A4)	; [323] CLEAR EXTRA EOF FLAG
 REP 17/137	;05C119
		POPJ	SP,0		; NO - EXIT
 WIT
		POPJ	SP,		; NO - EXIT
 REP 42/137	;05C120
		POPJ	SP,0
 WIT
		SETZM	%IOSTS(A10)	; [323] CLEAR EXTRA EOF FLAG
		POPJ	SP,
 REP 22/138	;05C121
		POPJ	SP,0		; NO - EXIT
 WIT
		POPJ	SP,		; NO - EXIT
 REP 28/138	;05C122
		POPJ	SP,0		; EXIT
 WIT
		SETZM	%IOSTS(A4)	; [323] CLEAR EXTRA EOF FLAG
		POPJ	SP,		; EXIT
 REP 7/139	;05C123
		POPJ	SP,0		; END OF FILE ON INPUT
		PUSHJ	SP,OUBYTE	; OUTPUT BYTE
		POPJ	SP,0		; END OF FILE ON OUTPUT
 WIT
		POPJ	SP,		; END OF FILE ON INPUT
		PUSHJ	SP,OUBYTE	; OUTPUT BYTE
		POPJ	SP,		; END OF FILE ON OUTPUT
 REP 28/140	;05C124
		POPJ	SP,0
 WIT
		POPJ	SP,
 INS 34/144	;05C125
		SETZM	%IOSTS(A1)	; [323] CLEAR EXTRA EOF FLAG
 INS 170/146	;05C126
		TLNE	A6,-1		; [330] REAL POINTERS HAVE ZERO LEFT HALVES
		 AOJA	A7,PRFPR1	; [330] THIS ISN'T A REAL POINTER, LOOP
 REP 1/148	;05C127
	ERRMON:
		TLNE	DB,INDDT	; IN DEBUGGER ?
 WIT

	ERRMON:	TLNE	DB,INDDT	; IN DEBUGGER ?
 INS 6/148	;05C128
		MOVE	A0,.JBTPC	; [311] GET PC OF ERROR
		MOVEM	A0,PDLTMP(DB)	; [311] SAVE IN CASE OF PDL TRAP NOW
 DEL 11/148	;05C129
		PUSHJ	SP,BRKBYT	; [274]
		JFCL			; [274] IGNORE ERROR RETURN FROM BRKBYT
 REP 36/154	;05C130
	M4:	XWD	ERR2PT+ERRDEV+40+<M400A-M400>_6,M400
 WIT
	M4:	XWD	ERR2PT+ERRDEV+40+<M400A-M400>_6,M400 ;[316] IOERR
 REP 49/154	;05C131
		IFN	FTOVRL,<
		XWD	55,M415>
 WIT
	IFN FTOVRL,<55,,M415>		; [324]
	IFE FTOVRL,<0>			; [324]
		XWD	56,M416		; [324]

 REP 59/154	;05C132
	M6:
 WIT
		XWD	70,M510		; [336]
	M6:
 REP 8/164	;05C133
		IFN	FTOVRL,<
	M415:	ASCIZ	/Attempt to use overlay handler's />
	M500:	ASCIZ /Undefine operation (SQRT argument negative)/
 WIT
	IFN FTOVRL,<			; [324]
	M415:	ASCIZ	/Attempt to use overlay handler's/> ; [324] END IFN FTOVRL
	IFE FTOVRL,<0>			; [324] KEEP TABLE ORDER IF FTOVRL IS OFF
	M416:	ASCIZ	/Invalid file specification/ ; [324]

	M500:	ASCIZ /Undefined operation (SQRT argument negative)/ ;[325]
 REP 9/165	;05C134
	M507:	ASCIZ	/Run-time error detected by FORTRAN subprogram/
 WIT
	M507:	ASCIZ /Run-time error detected by FORTRAN subprogram/
	M510:	ASCIZ /Illegal INFO parameter value/ ; [336]
 REP 17/166	;05C135
		JOV	.+1		; [E1013] Clear arithmetic
		JFOV	.+1		; [E1013] .. and floating overflow flags.
		MOVE	A1,.JBTPC	; AND GET PC DUMP
		TLZN	A1,PCFPU	; FLOATING POINT UNDERFLOW?
		JRST	APR6		; NO
		TLZ	A1,PCOVL	; YES - CLEAR OVERFLOW FLAGS
		MOVEM	A1,.JBTPC
 WIT
		JFOVO	.+1		; [331] CLEAR BOTH OVERFLOW FLAGS
		MOVE	A1,.JBTPC	; AND GET PC DUMP
		TLZ	A1,(1B0!1B3!1B11!1B12) ; [311] TURN OFF MATH ERROR BITS
		EXCH	A1,.JBTPC	; [311] SAVE MODIFIED .JBTPC AND GET OLD ONE
		TLZN	A1,PCFPU	; FLOATING POINT UNDERFLOW?
		JRST	APR6		; NO
 REP 12/169	;05C136
		JRSTF	@.JBTPC		; AND RE-ENTER PROGRAM
 WIT
		SKIPN	PDLTMP(DB)	; [311] APR TRAP WHILE HANDLING ANOTHER ERROR?
		JRSTF	@.JBTPC		; [311] NO, CONTINUE PROGRAM NORMALLY
		HRRZ	A1,PDLTMP(DB)	; [311] YES, GET SAVED 0,,.JBTPC BACK
		EXCH	A1,.JBTPC	; [311] RESTORE IT AND GET OUR RETURN ADDR.
		HRRZM	A1,APRTMP(DB)	; [311] PUT IT IN A TEMP. LOCATION
		MOVE	A1,%SYS17(DB)	; [311] RESTORE A1
		JRSTF	@APRTMP(DB)	; [311] AND CONTINUE WHAT WE WERE DOING
 DEL 45/175	;05C137
 SUM 155844