perm filename UNDER.FAI[SYS,HE]1 blob sn#004260 filedate 1972-06-07 generic text, type T, neo UTF8
00100		INTERNAL UNDERFLOW
00200		EXTERNAL JOBTPC,JOBAPR
00300		TITLE UNDERFLOW
00400		OPDEF ERROR [5B8]
00500	
00600	;The parameter to underflow controls the various messages:
00700	;the 01 bit turns on floating underflow,
00800	;the 02 bit turns on floating overflow
00900	;the 04 bit truns on zero divide
01000	;the 10 bit turns on fixed overflow
01100	
01200	UNDERF:	MOVEI 2,10
01300		JFCL 17,.+1;	CLEAR ANY PREVIOUSLY SET FLAGS
01400		SKIPN 1,-1(17);   CHANGED FROM SKIPE BECAUSE SENSE OF FLAG WAS WRONG
01500		SETZ 2,
01600		MOVE 3,[XWD -4,UNDFLG]
01700	LP:	SETZM (3)
01800		TRNE 1,1
01900		SETOM (3)	;ENABLE ERROR MESSAGE ON BIT=1
02000		LSH 1,-1
02100		AOBJN 3,LP
02200		SUB 17,[(2)2]
02300		MOVEI 1,FLTOV
02400		MOVEM 1,JOBAPR
02500		CALLI 2,16	;SET APR FLAGS
02600		MOVE 1,2(17)
02700		TLZ 1,440140	;CLEAR PREV FLAGS
02800		JRST 2,@1	;RETURN
02900	
03000	FLTOV:	MOVEM 1,SAVE1
03100		MOVE 1,JOBTPC
03200		TLNN 1,100	; is it a floating underflow?
03300		JRST OV		;no
03400		MOVE 1,-1(1)	;get opcode which caused it
03500		TLNN 1,40000	;test for standard flt pt opcode
03600		TLZ 1,2000	;change for FSC
03700		DPB 1,[POINT 29,.+2,35]	;modify the SETZ 
03800		MOVE 1,SAVE1	;restore ACs
03900		SETZ 0,		;zero ac and/or memory
04000		MOVEM 1,SAVE1
04100		SKIPN UNDFLG
04200		JRST WO		;dont print message
04300		MOVE 1,BP1
04400		JSR NUMOUT
04500		OUTSTR MESS1
04600	WO:	MOVE 1,JOBTPC
04700		TLZ 1,440140	;zero the error bits
04800		MOVEM 1,JOBTPC
04900		MOVE 1,SAVE1	
05000		JRST 2,@JOBTPC	;return
05100		
05200	OV:	TLNN 1,40000	;was it a floating overflow?
05300		JRST ZDIV	;no
05400		SKIPN FOVFLG
05500		JRST WO		;dont print flt over message
05600		MOVE 1,BP2
05700		JSR NUMOUT
05800		ERROR 1,MESS2
05900		JRST WO
06000	
06100	ZDIV:	TLNN 1,40	;zero divide?
06200		JRST NOTIN	;no
06300		SKIPN ZDFLG
06400		JRST WO		;dont print zero divide message
06500		MOVE 1,BP4
06600		JSR NUMOUT
06700		ERROR 1,MESS4
06800		JRST WO
06900	
07000	NOTIN:	SKIPN OVFLG
07100		JRST WO		;dont print fixed pt overflow message
07200		MOVE 1,BP3
07300		JSR NUMOUT
07400		ERROR 1,MESS3
07500		JRST WO
07600	
07700	NUMOUT:	0
07800		MOVEM 1,PTR
07900		MOVEM 2,SAVE2
08000		MOVEI 2,6
08100		MOVE 1,JOBTPC
08200		HRLZI 1,-1(1)
08300	L1:	ROT 1,3
08400		IORI 1,60
08500		IDPB 1,PTR
08600		HLRI 1,
08700		SOJG 2,L1
08800		MOVE 2,SAVE2
08900		JRST @NUMOUT
09000	
09100	PTR:	0
09200	UNDFLG:	0
09300	FOVFLG:	0
09400	ZDFLG:	0
09500	OVFLG:	0
09600	SAVE1:	0
09700	SAVE2:	0
09800	BP1:	POINT 7,MESS1+6,20
09900	BP2:	POINT 7,MESS2+6,13
10000	BP3:	POINT 7,MESS3+4,20
10100	BP4:	POINT 7,MESS4+5,13
10200	MESS1:	ASCIZ /FLOATING UNDERFLOW OCCURED, PC = 000000
10300	/
10400	MESS2:	ASCIZ/FLOATING OVERFLOW OCCURED, PC = 000000/
10500	MESS3:	ASCIZ/OVERFLOW OCCURED, PC = 000000/
10600	MESS4:	ASCIZ /ZERO DIVIDE OCCURED, PC = 000000/
10700	END