Google
 

Trailing-Edge - PDP-10 Archives - klad_sources - klad.sources/errhan.mac
There are no other files named errhan.mac in the archive.
SUBTTL	*ERRHAN* PDP-10 DIAGNOSTIC ERROR HANDLER, V76A, JUNE 15,1976

;*THE DIAGNOSTIC ERROR HANDLER IS A SUBROUTINE CAPABLE OF REPORTING
;*A STANDARD BUT FLEXIBLE FORMAT OF TEST DATA AND DIAGNOSTIC
;*INFORMATION.  THE ERROR HANDLER ALSO INTERPRETS AND CONTROLS TEST
;*SWITCHES SUCH AS TYPEOUT SUPPRESSION, CONTINUE/HALT OR LOOP ON
;*ERROR, AND BELL ON ERROR.

%ERCAL:	0
	IFDEF	EXCASB,<IFDEF KI10,<
	SKIPN	KAIFLG
	JRST	.+5
	SKIPE	USER
	JRST	.+3
	SKIPE	MARGIN
	DATAO	APR,[IMGNOF,,ISPDOF] >>
	MOVEM	0,%AC0#
	MOVEM	1,%AC1#
	MOVEM	2,%AC2#
	MOVEM	3,%AC3#
	MOVEM	4,%AC4#
	AOS	ERRTLS		;INCREMENT ERROR TOTALS
	MOVEI	1		;DON'T REPEAT LOOP SECTION
	MOVEM	REPT
	HRRZ	3,%ERCAL	;GET <ADDRESS+1> OF ERROR CALL.
	SWITCH
	CAME	3,ERRPC		;SKIP IF SAME ERROR
	JRST	.+3
	TLNN	PALERS		;PRINT ALL ERRORS ?
	JRST	%ERSW1		;THIS ERROR ALREADY REPORTED ONCE.
;*BYPASS ERROR REPORT IF NOPNT SWITCH IS SET

	TLNE	0,NOPNT
	JRST	%ERSW1
	MOVEM	3,ERRPC
	SETZM	%ERCNT#
	SKIPGE	MONCTL		;DIAG MON OR SYS EXER ?
	JRST	%ERPRA		;YES, GO PRINT TITLE
%ERPRB:	SKIPN	PASCNT
	JRST	.+5		;DON'T PRINT PASS COUNTER ON FIRST PASS
	MOVEI	0,[ASCIZ/
TEST PASS COUNT = /]
	PNTAL
	MOVE	0,PASCNT
	PNTDEC			;PRINT TEST PASS COUNTER
	MOVEI	0,[ASCIZ/
PC=  /]
	PNTAL		
	MOVEI	0,-1(3)
	PNT6			;PRINT PC OF ERROR CALL.
	MOVE	0,CONSW
	TLNE	TXTINH		;TEXT INHIBITED ?
	JRST	%ERPR2		;YES
	MOVEI	0,[ASCIZ/
ERROR IN /]
	HLRZ	1,1(3)		;GET NAME OF FAILING TEST
	JUMPE	1,%ERPR1	;JUMP IF NO TEST NAME
	PNTAL		
	MOVE	0,1
	PNTAL			;REPORT NAME OF FAILING TEST
	MOVEI	0,[ASCIZ/ - /]
	JRST	.+2
%ERPR1:	MOVEI	0,CRLF
	HRRZ	1,1(3)		;GET NAME OF FUNCTION TESTED
	JUMPE	1,%ERPR2	;JUMP IF NO FUNCTION CALLED OUT.
	PNTAL		
	MOVE	0,1
	PNTAL			;REPORT FUNCTION BEING TESTED.

%ERPR2:	SETOM	%DISCR#		;SET 'DISCREPANCY FLAG'.

;*GET X FROM JSR X,%ERCAL. PASS X ARGUMENT ONTO PRINT.

	LDB	4,[POINT 4,-1(3),12]	;PICK UP X ARGUMENT
	MOVEI	2,14
	JUMPN	4,.+2		;PRINT 12 OCTAL DIGITS IF X=0
	MOVEM	2,4
	CAILE	4,14		;MAKE SURE THAT X IS A LEGAL ARGUMENT
	ERRHLT			;PROGRAM CALL ERROR
	LSH	4,^D<35-12>	;PUT X IN AC FIELD
	ADD	4,[PNTA]
	MOVEM	4,%ERIN1
	MOVEM	4,%ERIN2
	MOVEM	4,%ERIN3
	MOVEI	0,[ASCIZ/
CORRECT:  /]
	HLRZ	2,2(3)		;GET ADDRESS OF EXPECTED TEST RESULTS
	JUMPN	2,.+3
	SETZM	%DISCR		;NO 'CORRECT RESULT' TYPEOUT
	JRST	%ERPR3
	CAILE	2,4		;ARE TEST RESULTS IN AC THAT HAS BEEN SAVED?
	JRST	%ERP2A
	CAIN	2,1		;AC1?
	MOVE	1,%AC1
	CAIN	2,2		;AC2?
	MOVE	1,%AC2
	CAIN	2,3		;AC3?
	MOVE	1,%AC3
	CAIN	2,4		;AC4?
	MOVE	1,%AC4
	JRST	.+2
%ERP2A:	MOVE	1,(2)
;*AC1 NOW CONTAINS THE CORRECT TEST RESULTS.

	PNTAL			;CORRECT RESULTS.
	MOVE	0,1
%ERIN1:	0			;JSR X,$PRINT. REPORT CORRECT DATA
	MOVEM	1,%COREC#	;SAVE CORRECT DATA
%ERPR3:	MOVEI	0,[ASCIZ/
ACTUAL:   /]
	HRRZ	2,2(3)		;GET ADDRESS OF ACTUAL TEST RESULTS.
	JUMPN	2,.+3
	SETZM	%DISCR		;NO 'ACTUAL RESULT' TYPEOUT.
	JRST	%ERPR4
	CAILE	2,4		;ARE ACTUAL TEST RESULTS IN AC THAT IS SAVED?
	JRST	%ERP3A
	CAIN	2,1		;AC1?
	MOVE	1,%AC1
	CAIN	2,2		;AC2?
	MOVE	1,%AC2
	CAIN	2,3		;AC3?
	MOVE	1,%AC3
	CAIN	2,4		;AC4?
	MOVE	1,%AC4
	JRST	.+2
%ERP3A:	MOVE	1,(2)

;*AC1 CONTAINS THE ACTUAL TEST RESULTS.

	PNTAL			;ACTUAL RESULTS
	MOVE	0,1
%ERIN2:	0			;JSR X,$PRINT. REPORT ACTUAL DATA
	MOVEM	1,%ACTUL#	;SAVE ACTUAL DATA

%ERPR4:	MOVEI	0,[ASCIZ/
DISCREP:  /]
	SKIPN	%DISCR		;REPORT DATA DISCREPANCY IF BOTH CORRECT AND
	JRST	%ERPR5		;ACTUAL DATA REPORTED.
	MOVE	1,%COREC
	XOR	1,%ACTUL	;XOR CORRECT & ACTUAL DATA
	PNTAL		
	MOVE	0,1
%ERIN3:	0			;JSR X,$PRINT. REPORT DISC BETWEEN COR. & ACT.
;*PICK UP AND REPORT DIAGNOSTIC COMMENT IF ANY.

%ERPR5:	MOVE	0,CONSW
	TLNE	TXTINH		;TEXT INHIBITED ?
	JRST	%ERPR6		;YES
	HRRZ	1,3(3)		;GET ADDRESS OF ASCIZ TEXT.
	JUMPE	1,%ERPR6	;EXIT FROM ERROR PRINT IF NO DIAGNOSTIC TEXT.
	MOVEI	0,CRLF
	PNTAL		
	MOVE	0,1
	PNTAL		
%ERPR6:	MOVEI	CRLF
	PNTA

%ERMORE:JRST	.+1		;TO ADD ROUTINE, PLACE JRST HERE
	IFDEF	EXCASB,<IFDEF	KI10,<
	PNTMGN			;PRINT MARGINS	>>

;*EXAMINE DATA SWITCHES (OR SOFTWARE SWITCHES IF USER MODE).

%ERSW1:	IFDEF ALTGO,<
	TTALTM			;ALTMODE CHECK
	JRST	.+4		;NONE
	MOVEI	.+3		;SAVE ADDRESS FOR CONT
	MOVEM	JOBOPC
	JRST	@ALTMGO		;PERFORM TRANSFER >
	SWITCH			;READ DATA SWITCHES
	MOVEM	0,4
	TLNN	4,ERSTOP	;IS 'HALT ON ERROR' SWITCH SET, (SWITCH ERSTOP)
	JRST	%ERSW2		;NO

;*EXECUTE HALT IF SWITCH ERSTOP SET.

%ERS1A:	MOVE	0,%AC0		;RESTORE AC'S
	MOVE	1,%AC1
	MOVE	2,%AC2
	MOVE	3,%AC3
	MOVE	4,%AC4
	ERRHLT			;ERROR HALT
	JRST	%ERSW2		;CONTINUE FROM HALT

%ERPRA:	SKIPN	%ERFST#		;PRINT PROGRAM NAME
	PNTNM
	SETOM	%ERFST
	JRST	%ERPRB
;*EXAMINE LOOPER SWITCH AND SCOPE LOOP ON ERROR IF SET.

%ERSW2:	TLNE	4,LOOPER
	JRST	.+3
	SETZM	SCOPE		;SCOPE PREVIOUSLY DEFINED .
	JRST	%ERSW3
	SETOM	SCOPE		;FORCE TEST TO LOOP.
	MOVE	0,%ERCAL
	SOS
	AOS	1,%ERCNT	;INCREMENT ERROR COUNT
	HRL	1,0
	SKIPN	USER		;USER MODE ?
	DATAO	PI,1		;DISPLAY ERROR PC,ERROR COUNT.

;*RING TTY BELL IF DING SWITCH IS SET.

%ERSW3:	TLNN	4,DING
	JRST	%EXCAL
	MOVEI	0,BELL		;BELL CODE
	PNTAF

;*RETURN TO ERROR CALL ADDRESS+1

%EXCAL:	MOVE	1,%AC1
	MOVE	2,%AC2
	MOVE	3,%AC3
	MOVE	4,%AC4
	SKIPL	MONCTL		;UNDER DIAGNOSTIC MONITOR ?
	JRST	%EXCL1		;NO, CONTINUE PROGRAM
	MOVE	0,ERRTLS	;YES
	CAIL	0,5		;PRINTED ALLOWED ERRORS ?
	JRST	@RETURN		;YES, RETURN TO CALLING PROGRAM
%EXCL1:	MOVE	0,%AC0
	IFDEF	EXCASB,<IFDEF KI10,<
	SKIPN	KAIFLG
	JRST	.+5
	SKIPE	USER
	JRST	.+3
	SKIPE	MARGIN
	DATAO	APR,MARGIN	;RESET MARGIN SYSTEM >>
	JRSTF	@%ERCAL		;NO, CONTINUE PROGRAM