       .TITLE OTSER
/
/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.
	.EJECT
/COPYRIGHT 1970, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
/EDIT #013   12-20-71
/EDIT #014	20-MAY-75	RK BLACKETT  SPR 15-979  MAKE CHANGES
/				  SO THAT END-OF-MEDIUM ALSO TRIGGERS
/				  THE END= BRANCH.
/EDIT #015	20-AUG-75	M. HEBENSTREIT  DISCLAIMER
/OBJECT TIME ERROR ROUTINE.
/CALLING SEQUENCE--JMS* .ER
/                  .DSA ERROR NUMBER (BIT 0 = 1 IF RECOVERABLE).
/DEFINE RSX -----TO GET RSX VERSION.
/ALSO MUST DEFINE %FPP FOR FLT. POINT PROC. IF RSX DEFINED.
/RSX VERSION USES SPMSG TO OUTPUT MESSAGES.  SPMSG PRINTS ERROR
/NUMBER AND TASK NAME, THEN RETURNS TO OTSER.
/
/NO PARAMETERS DEFINED-----DOS15 VERSION
	.GLOBL OTSER
OTSER=.
	.GLOBL	.ER,.ZR,.ERST,.ER4,.ER3
	.GLOBL .SPC		/USED BY .FPP IF PRESENT
	.GLOBL .AERTB		/USED BY ERRSET
	.IFDEF RSX
	.GLOBL .SP,.SA,.SM
X10=10
ECLA=641000
UNDST=713770		/UNNORM DOUBLE STORE.
UNDLD=713170		/UNNORM. DOUBLE LOAD.
.ER	CAL	0
	DAC ACSAVE	/FOR COMMON ROUTINES
	PAL		/SAVE AC OR BITS 12-17 OF HDR INCASE OTS 11.
.ER4	NOP	/JMP ER5 IF END,ERR EXITS SPECIFIED
ER7	LAC*	(X10)	/SAVE X10 FOR POSSIBLE RETURN
	DAC	SAVX10
	.IFDEF	%FPP
	UNDST		/SAVE FPP AC.  MAY BE RECOV. ERROR.
	TFPAC
	.ENDC
	LAC*	.SA	/PICK UP ADDRESS OF BUFFER
	DAC*	(X10)
	LAW	-4	/SET UP TO PRINT OTS-
	DAC	CNT
	LAC	MSGADR	/PICK UP ADDRESS OF OTS-
	DAC	CNT1
ER1	LAC*	CNT1
	DAC*	X10	/STORE CHARACTER IN BUFFER
	ISZ	CNT1	/INCREASE POINTER
	ISZ	CNT	/HAVE WE COPIED FOUR CHARACTERS?
	JMP	ER1	/NO COPY ANOTHER ONE
	LAC*	.ER	/PICK UP ERROR NUMBER
	DAC	CNT1	/SAVE IT TO DETERMINE IF FATAL ERROR
	JMS ER8		/SUPPRESS?
	JMP ER9	/YES
	LAC	CNT1	/ERR # TO AC.
	LMQ		/NO.  SAVE IT IN MQ TO DECODE IT
	LLS	14	/LEFT JUSTIFY
	ECLA!LLS 3	/MOVE 3 BITS INTO AC
	AAC	60	/MAKE IT OCTAL
	DAC*	X10	/STORE IT IN BUFFER
	ECLA!LLS 3	/MOVE SECOND NUMBER INTO AC
	AAC	60	/MAKE IT OCTAL ASCII
	DAC*	X10	/STORE IT IN BUFFER
	LAW	-12
	TAD*	.ER	/IS ERROR A FORMAT ERROR?
	SZA!CLL
	JMP	ER2	/NO  PRINT MESSAGE
	ISZ	.ER	/POINT TO ERROR MESSAGE
	LAC	(074)	/PUT A < INTO BUFFER
	DAC*	X10
	XCT*	.ER	/PICK UP FORMAT MESSAGE
	LMQ		/IN 5/7 ASCII TO BE DECODED
	ECLA!LLS 7	/PICK UP FIRST 7 BITS
	DAC*	X10	/STORE IT IN BUFFER
	ECLA!LLS 7	/PICK UP NEXT 7 BITS
	DAC*	X10	/STORE IT IN BUFFER
	ECLA!LLS 7	/PICK UP LAST FOUR BITS
	DAC	CNT
	ISZ	.ER	/INCREMENT ER TO PICK UP SECOND WORD
	XCT*	.ER	/LOAD SECOND WORD
	LMQ		/SAVE IT IN MQ
	ECLA!LLS 3	/PICK UP FIRST 3 BITS
	XOR	CNT	/PUT ON FIRST FOUR BITS
	DAC*	X10	/STORE IT IN MESSAGE
	ECLA!LLS 7	/PICK UP LAST WORD
	DAC*	X10
	LAC	(076)	/INSERT A > IN BUFFER
	DAC*	X10
ER4	LAC	(ER9)	/SET RETURN ADDRESS IN .SP
	DAC*	.SP	/TO SIMULATE JMS* .SP
	JMP*	.SM
ER9	LAC	CNT1	/PICK UP CNT1 TO DETERMINE IF ERROR WAS FATAL
	SMA		/FATAL IF POSITIVE NUMBER
	CAL	(10)	/YES FATAL EXIT
	LAC	SAVX10	/RESTORE XR10
	DAC*	(X10)
	.IFDEF	%FPP
	UNDLD		/RESTORE FPP AC INCASE RECOV. ERROR.
	TFPAC
	.ENDC
	LAC	.ER		/RESTORE LINK
	RAL
	LAC	ACSAVE		/SAVE AC.
	ISZ	.ER	/RETURN JMS+2
	JMP*	.ER
/
ER2	LAW	-6
	DAC	CNT
	LAW	-1	/BLANK OUT FORMAT MESSAGE AREA
ER3	DAC*	X10
	ISZ	CNT
	JMP	ER3
	JMP	ER4
SAVX10	0
CNT	0
CNT1	0
MSGADR	MESSAG
MESSAG	117	/O
	124	/T
	123	/S
	055	/-
ACSAVE	0	/TEMP.
	.IFDEF	%FPP
TFPAC	0	/EXPONENT--TEMP. STOR. FOR FPP AC.
	0	/MANTISSA.  HO.
	0	/MANTISSA.  LO.
	.ENDC
	.ENDC
	.IFUND RSX
.ER    CAL    0
       DAC    ACSAVE         /SAVE AC IN CASE ERROR RECOVERABLE.
	DAC .ER3	/STORE BITS 12-17 OR HEADER IN CASE OTS 11
.ER4	NOP	/JMP ER5 IF EXPANDED I/O
/INITIALIZED TO NOP BY I/O CLEAN UP OR BY ER5
/INITIALIZED TO JMP ER5 BY COMPILER CALLED ROUTINE .ZR
ER7       LAC*   .ER            /SAVE ERROR NUMBER AND CONVERT TO A TWO
       DAC    RECFLG         /   DIGIT ASCII-7 NUMBER.
/RETURN TO JMP ER2 IF OTS 30-37 AND MESSAGE IS TO BE SUPPRESSED
/RETURN TO LAC RECFLG IF OTS 30-37 AND MESSAGE IS NOT TO
/BE SUPPRESSED OR NOT OTS 30-37
	JMS ER8	/DETERMINE IF MESSAGE IS TO BE SUPPRESSED
	JMP ER2	/YES IT IS SUPPRESSED
	LAC RECFLG	/NO CONTINUE
       RAL
       AND    (16)
	DAC TEXT+3		/STORE DIGIT 2 IN BUFFER.
       LAC    RECFLG
       RCL; RTL; RTL
       AND    (3400)         /DIGIT 1 TO AC.
       XOR     TEXT+3        /MERGE DIGIT 2
       XOR    (30140)        /MERGE IN TWO 60'S.
       DAC    TEXT+3         /STORE ASCII-7 CHARACTERS IN BUFFER.
       LAC    SHORT
       DAC    TEXT2
       LAW    -12            /TEST FOR ERROR 12 (BAD FORMAT).
       TAD*   .ER            /   IF NOT, PRINT ERROR MESSAGE.
       SZA                   /   IF SO, LENGTHEN ERROR MESSAGE TO
       JMP    ER0            /   INCLUDE CURRENT FORMAT STATEMENT
       ISZ    .ER            /   WORD PAIR.
       XCT*   .ER
       DAC    FMT            /STORE FIRST FORMAT WORD IN BUFFER.
       ISZ    .ER
       XCT*   .ER
       DAC    FMT+1          /STORE SECOND FORMAT WORD IN BUFFER.
       LAC    LONG
       DAC    TEXT2
ER0	CAL 02775	/WRITE ERROR MESSAGE.--
ER6       .DSA   11
       .DSA   TEXT-2
ACSAVE .DSA   0
	CAL 775
	6
ER2    LAC    RECFLG         /CHECK ERROR FOR RECOVERABLE.
       SPA
       JMP    ER1            /   YES--RETURN TO CALLER.
       CAL    00000          /   NO-- CALL .EXIT.
       .DSA   15
ER1	LAC .ER		/RESTORE LINK AND AC BEFORE EXIT.
       RAL
       LAC    ACSAVE
       ISZ    .ER
       JMP*   .ER            /EXIT TO CALLING ROUTINE.
TEXT   .ASCII  ' .OTS '<0><0>'00'
TEXT2  .DSA   0
       .DSA   0
FMT    .BLOCK 2
       .DSA    360320
SHORT  .DSA   064000
LONG   .DSA   360000
RECFLG	.DSA 0
	.ENDC
/CALLING SEQUENCE-TO SET UP EXP. I/O ERROR ADDRESSES
/JMS* .ZR
/.DSA END
/.DSA ERR
/MEANINGFUL AC MUST BE SAVED AND RESTORED
.ZR	0	/CALLED BY COMPILER FOR EXP. I/O SETUP
	DAC ACSAVE	/SAVE FOR COMPILER
	LAC (JMP ER5)		/SET UP FOR EXP I/O
	DAC .ER4
	LAC* .ZR	/GET END ADDRESS  IF 0,NO ADDRESS
	SNA
	LAC (ER7)	/PROCESS AS USUAL
	DAC ENDADR	/SET EXIT ADDR.
	ISZ .ZR	/BUMP TO ERR ADR.
	LAC* .ZR	/GET ERR ADDRESS
	SNA
	LAC (ER7)	/AS USUAL
	DAC ERRADR
	ISZ .ZR	/BUMP FOR EXIT
	LAC ACSAVE	/RESTORE AC
	JMP* .ZR
/EXPECTES AC FOLLOWING ENTRANCE INTO .ER TO BE IN ACSAVE
ER5	LAC (NOP)	/REINITIALIZE 
	DAC .ER4
	LAC* .ER	/GET ERROR NUMBER
	AND (77777)	/MASK BITS 3-17
/MUST IGNORE BITS 0-2 OF ERROR NUMBER ABOVE
	DAC .ERST	/STORE ERROR NUMBER AS STATUS
	SAD (11)	/OTS 11?  TEST FOR EOF
	SKP		/YES
	JMP* ERRADR	/ERROR NOT EOF OR EOM
	LAC ACSAVE	/AC CONTAINS DATA MODE IF OTS 11
	SAD (5)	/EOF
	JMP* ENDADR
	SAD	(6)	/(RKB-014) END OF MEDIUM?
	JMP*	ENDADR	/(RKB-014) YES, TAKE THE END= BRANCH
	JMP* ERRADR	/ERR
.ERST	0	/ERR STATUS WORD-OTS ERR #
ENDADR	ER7
ERRADR	ER7
.ER3	0	/TMP. STR.FOR HEADER IN CASE I/O DATA ERROR - IOERR
/NEEDS THIS IF LOADED
/ER8 DETERMINES IF OTS ERROR IS 30-37 (ARITHMETIC).  IF IT IS
/SUPPRESSED AFTER N ERROR MSGS. OF A TYPE HAVE BEEN
/OUTPUT.  N IS SET BY ERRSET AND IN THE FORM OF-N-1 IN .AERTB TABLE.
/DEFAULT IS N=75 DECIMAL
/CALLING SEQUENCE:    OTS ERROR NUMBER IN AC
/	JMS ER8
/	NEXT INSTR.    RET. HERE IF MSG. IS TO BE SUPPR.
/	NEXT INSTR.	RET. HERE IF MSG. IS TO BE OUTPUT
/
/
ER8	0
	AND (77777)	/DUMP REC. BIT AND BITS 1,2
/MUST IGNORE BITS 0-2 OF ERROR NUMBER ABOVE
	DAC ER11	/TEMP SAVE
	AND (377740)
	SZA	/>37?
	JMP ER8A	/YES.  OUTPUT
	LAC ER11	/CONT. TEST
	TAD (-30)	/
	SPA		/<30?
	JMP ER8A	/YES.  OUTPUT
	TAD (.AERTB)	/GET TABLE POINTER--0-7 IN AC
	DAC ER11
	ISZ* ER11	/BUMP TABLE ENTRY.  IF 0, START SUPPR. MSG.
/OF THIS TYPE
	JMP ER8A	/NOT 0, KEEP OUTPUTING MSG.
	DZM .SPC	/SET SUPPRESS PC PRINT FLAG IF FPP PRESENT
	CLC		/777777 TO TABLE ENTRY SO THAT SUBSEQ.
/MSG. OF THIS TYPE WILL BE SUPPR.
	DAC* ER11
	JMP* ER8
ER8A	ISZ ER8	/DON'T SUPPRESS ERROR MSG.
	JMP* ER8
.SPC	000001		/SUPPR. PC FLAG .  WILL SUPPR. IF 0
ER11	0		/TEMP
/ARITH ERROR TABLE FOR MSG. CONTROL.  ALL ENTRIES SET TO -N-1
/BY ERRSET  (CALL ERRSET(N) FROM F4).  DEFAULT IS -114(75 DEC. MSGS)
.AERTB	-114		/.OTS 30
	-114		/.OTS 31
	-114		/.OTS 32
	-114		/.OTS 33
	-114		/.OTS 34
	-114		/.OTS 35
	-114		/.OTS 36
	-114		/.OTS 37
       .END
