Google
 

Trailing-Edge - PDP-10 Archives - dec-10-omona-u-mc9 - syserd.mac
There are 16 other files named syserd.mac in the archive. Click here to see a list.
	TITLE	SYSERD -- SYSTEM ERROR FILE PROCESSOR VERSION7(433)	OCT 30, 1972	SUBTTL	K. COYE/ RLD

	SUBTTL	MAINLINE PROGRAM CODE




	SEARCH	SYRUNV
	SEARCH	SYRLOW
	SEARCH	SCNMAC

	.REQUIRE SYRLIB

	;DUMALL -- DUMMY MACRO LEVEL 3
	;SUBMACRO DUMXXX
	;ARGS
	;NONE USED TO HOUSE LEVEL 2 SUBMACRO DUMXXX
	;THOSE DEFINED HERE ARE THOSE FULLY PROCESSED BY
	;THIS SEGMENT. PART OF EDIT #120.

	DEFINE	DUMALL<
	DUM101
	DUM102
	DUM111
	DUM130
	DUM131
	DUM160
	DUM161
>

	;EXTERNALS DEFINED HERE ARE IN SYRLIB.MAC, THE LIBRARY
	;OF COMMON ROUTINES FOR ALL PARTS OF THE SYSERR PACKAGE.

	EXTERNAL HEADRD,ABORT,CHRCHK,DATECK,FILERR,TOOBIG,MBCHAR
	EXTERNAL CNISU2,BADNAM,MASSVM,DEVCHK,ERRINT,SKIPIT,IDCHK
	EXTERNAL STRCHK,DETCHK,DMPENT,HDRLST,PAGXCD,DVCHAR,TMCHAR
	EXTERNAL SAYDAY,GETNBS,.OCTLE,.DECML,.ASCIE,.SIXBT,ENTRST,NOTRAN,SPACE3
	EXTERNAL .HAFWD,.SPECL,.HTIME,.PPNWW,.ODECW,.UDATE,.TASCI,.PPNWT
	EXTERNAL .TDIRW,R5VSIX,MONVER,BADADD,TAB031,TYPAST,BLDPTR
	EXTERNAL ACLST,SAVE4P,RET4P,HWDUMP,TYPBCD,LSTEB,JFLOOP,CNIDCD
	EXTERNAL XORTAB,BITLST,.DVTAB,.MXBLK,.TRBLK,.SUBLK,.SECBK
	EXTERNAL WDCNT,COMPAR,SKPRTN,TYPNBS,TITLST,SKIPWD,ADVBFF
	EXTERNAL FIXBUF,STBUFF,INPWD,GOSUM,GETWD,FFPRNT,SLPRNT,CLPRNT
	EXTERNAL TBPRNT,CHROUT,TTYSIX,MDECHR,FIXNAM



	;INTERNALS DEFINED HERE ARE FOR USE BY SYRLIB
	INTERNAL KONMSK,KLEDMP,MINERB,DEVDS2,ALLTBL
	INTERNAL NAMLT2,TYPMES,LINE,ALLLTH,NAMTB2,DUMDAY
	INTERNAL DEVTYP,ERINDX,PCSTBL,PDLPNT,BITCHK,ERRLTH
	INTERNAL ERRTBL,SUMUPD,MASLTH,NAMLTH
	

	INTERNAL MASNA2,MASLT2


	.JBVER==137
	LOC	.JBVER

	BYTE	(3)VWHO(9)VSYSER(6)VMINOR(18)VEDIT
	SALL


	TWOSEG
	RELOC	400000


	;PROCSD -- STANDARD ENTRY PROCESSOR #1
	;CALL	JRST PROCSD
	;
	;RETURN	JRST ABORT	WHEN ENTRY IS PROCESSED OR ABORTED
	;OPERATION IS CONTROLLED BY ENTRY IN CONTROL TABLE
	;ROUTINE GETS AOB POINTER TO DESIRED WORD IN BUFFER
	;IF THERE IS ONE PRESENT
	;THEN DISPATCHES TO WORD PROCESSOR LEVEL
	;VIA PUSHJ	P,SUBTAB(MODE)
	;PASSES BUFFER WORD IN P2 TO WORD PROCESSOR

PROCSD:	SETZM	OFFSET		;CLEAR WORD OFFSET COUNT
	MOVE	P1,(CTINDX)	;PICKUP FIRST WORD IN CONTROL TABLE
	JUMPE	P1,ABORT	;ABORT WHEN END OF CTL TABLE SEEN
	TLNE	P1,770000	;DO WE NEED TO GET AN AOB POINTER
	PUSHJ	P,GETAOB	;YES-WORD IS IN A RELOCATABLE SUBTABLE IN ENTRY
	LDB	T2,[POINT 6,P1,11]	;PICKUP WORD LOCATION IN ENTRY
	ADD	T2,OFFSET	;OFFSET CONTAINS AOB BLOCK STARTING LOCATION
	CAML	T2,ENTRWC	;DONT TRY EDIT 153 TO ACCESS WORDS OUTSIDE OF ENTRY
	AOJA	CTINDX,PROCSD	;GET NEXT WORD IN CTL TABLE
	CAILE	T2,WKSIZE	;MAKE SURE THE WORD ASKED FOR IS IN WORK BUFFER
	AOJA	CTINDX,PROCSD	;IGNORE AND GET NEXT WORD
	MOVE	P2,WKBUFF(T2)	;PICKUP DATA WORD IN WORK BUFF
	LDB	T3,[POINT 6,P1,17]	;PICKUP WORD PROCESSES MODE
	CAIG	T3,SUBMAX	;IS IT AND UNKNOWN MODE
	PUSHJ	P,SUBTAB(T3)	;ITS RECOGINIZED
	AOJA	CTINDX,PROCSD	;EITHER NOT KNOWN OR FALL HERE

GETAOB:	LDB	T2,[POINT 6,P1,5]	;PICKUP AOBJN POINTER ADDRESS IN ENTRY
					;AOB GIVEN IS WITH REF TO HEADER
	SKIPL	T2,WKBUFF(T2)	;PICKUP THE ACTUAL POINTER AND SKIP IF LEGAL
	JRST	AOBQIT		;AOBJN POINTER = 0 CLEAN UP PDL AND GO TO PROCSA
	SUB	T2,HEADWC	;CORRECT AOB POINTER FOR HEADER SIZE
	HRRZM	T2,OFFSET	;SAVE IT IN OFFSET
	MOVEM	T2,AOBPNT	;SAVE POINTER FOR SPECL ROUTINE USAGE
	POPJ	P,		;VAMOOSE



	;HERE WHEN AOBJN POINTER = POS IN LH
	;NORMALLY SHOULD NOT HAPPEN

AOBQIT:	POP	P,T2		;DUMMY POP TO FIX PDP
	AOJA	CTINDX,PROCSD	;BUMP CTINDX AND BACK TO START
	SUBTTL	DIALOG RELATED SUBROUTINES
	;HERE IS THE DUMMY PROCSB FOR THIS HIGH SEG
	;IT SAVES THE AC'S AND THEN CALLS OVRLAY FOR REPLACEMENT
	;WITH SYSERA.HGH

PROCSA:	MOVE	T1,[SIXBIT/SYSERA/]
	MOVEM	T1,OVRBLK+1	;INTO THE SPEC AREA
	SETZ	15,
	MOVEM	17,SAVEAC+17
	MOVEI	17,SAVEAC
	BLT	17,SAVEAC+16	;TUCK AWAY OUR AC'S
	JRST	OVRLAY		;NOW PLEASE OVERLAY US WITH PROCSA


	;HERE IS THE DUMMY PROCSB FOR THIS HIGH SEG
	;IT SAVES THE AC'S AND THEN CALLS OVRLAY FOR REPLACEMENT
	;WITH SYSERB.HGH

PROCSB:	MOVE	T1,[SIXBIT/SYSERB/]
	MOVEM	T1,OVRBLK+1	;INTO THE SPEC AREA
	SETZ	15,
	MOVEM	17,SAVEAC+17
	MOVEI	17,SAVEAC
	BLT	17,SAVEAC+16	;TUCK AWAY OUR AC'S
	JRST	OVRLAY		;NOW PLEASE OVERLAY US WITH PROCSB

	;HERE IS THE DUMMY PROCSC FOR THIS HIGH SEG
	;IT SAVES THE AC'S AND THEN CALLS OVRLAY FOR REPLACEMENT
	;WITH SYSERC.HGH

PROCSC:	MOVE	T1,[SIXBIT/SYSERC/]
	MOVEM	T1,OVRBLK+1	;INTO THE SPEC AREA
	SETZ	15,
	MOVEM	17,SAVEAC+17
	MOVEI	17,SAVEAC
	BLT	17,SAVEAC+16	;TUCK AWAY OUR AC'S
	JRST	OVRLAY		;NOW PLEASE OVERLAY US WITH PROCSA





	;STARTD-- ROUTINE TO START AT WHEN OVERLAYED
	;TO CORRECTLY PROCESS CURRENT ENTRY.

STARTD:	MOVEI	T1,CHROUT	;OUR TYPO ROUTINE
	PUSHJ	P,.TYOCH##	;INIT SCAN
	MOVE	T1,ERTYPE	;CURRENT TYPE
	PUSHJ	P,ERRINT	;GET OUR INDEX VALUE
	MOVE	T1,ERTYPE	;CORRECT INDEX TO ENTCHR TABLE
	MOVE	T2,ENTCHR(T1)	;PICKUP ENTRY CHAR WORD
	TLZ	F,F.BTCK	;CLEAR EXAMINE ENTRY FLAG
	TLNN	T2,E.LALL!E.LNXM!E.LPAR!E.LPER!E.LSUM	;ANY LISTING DESIRED
	JRST	SKIPIT		;SKIP THIS ENTRY
	TLNE	T2,E.LNXM!E.LPAR!E.LPER!E.LSUM	;ANY REASON TO DO BIT CHECKING?
	TLO	F,F.BTCK	;YES-SET FLAG TO DO IT LATER
	MOVE	T3,ERTYPE	;GET CORRECT INDEX
	AOS	ENTCHR(T3)	;NO- BUMP COUNTER
	SETZ	WKINDX,		;CLEAR INDEX INTO BUFFER
	SKIPG	T1,ENTRWC	;PICKUP ENTRY LENGTH AND CHECK FOR LEGALITY
	JRST	ENTRST		;OPP, TRY TO RESYNC
	MOVE	P4,ERRIND
	TLNE	F,F.BTCK	;ANY TO DO?
	PUSHJ	P,@BITCHK(P4)	;GO DO IT
	TRNE	F,F.REM		;[417]/REMOTE?
	 JRST	REMDAT##	;YES-DO IMAGE BINARY DUMP
	PUSHJ	P,HDRLST
	MOVE	T2,ALLIND
	HRRZ	T1,PCSTBL(T2)
	HLRZ	CTINDX,PCSTBL(T2)	;CONTROL TABLE ADDRESS
	JRST	(T1)

	SUBTTL	WORD LEVEL SUBROUTINES
	;SUBTAB -- SUBROUTINES TO OUTPUT ENTRY WORD IN DESIRED FORMAT
	;SETUP  P1=ADDRESS OF TEXT TO BE OUTPUT AS DESCRIPTOR
	;	FOR THIS DATA WORD.
	;	P2= WORD TO BE OUTPUT.
	;CALL	PUSHJ	P,SUBTAB(MODE)
	;
	;RETURN	CALL+1
	;DISPATCHES TO APPROPIATE ROUTINE INTERNALLY TO DO WORD CONVERSION AND OUTPUT
SUBTAB:	SINDEX	<OCTLE>
	SINDEX	<DECML>
	SINDEX	<ASCIE>
	SINDEX	<SIXBT>
	SINDEX	<HAFWD>
	SINDEX	<SPECL>
	SINDEX	<HTIME>
	SINDEX	<PPNWW>
	SINDEX	<UDATE>
	SINDEX	<TASCI>
	SINDEX	<PPNWT>

	;SPECIAL LISTING ROUTINES START HERE.


PT%001:	TYPEIT	<STATUS AT ERROR:
	BAD DATA DETECTED BY:	>
	LDB	T2,[POINT 5,P2,5]	;GET PAGE FAIL CODE
	CAIN	T2,25			;PAGE TABLE?
	 MOVEI	T1,[ASCIZ/PAGE TABLE/]
	CAIN	T2,36			;AR/
	 MOVEI	T1,[ASCIZ/AR/]
	CAIN	T2,37			;ARX?
	 MOVEI	T1,[ASCIZ/ARX/]
	PUSHJ	P,.TSTRG
	TYPEIT	<
	PAGE FAIL WD AT TRAP:	>
	MOVE	T1,P2			;SHOULD STILL BE THERE
	PUSHJ	P,.TXWDW
	TYPEIT	<
	BAD DATA WORD:	>
	MOVE	P1,WKBUFF+PT%BDW	;GET IT
	MOVE	T1,P1
	PUSHJ	P,.TXWDW
	TYPEIT	<
	GOOD DATA WORD:	>
	MOVE	P2,WKBUFF+PT%GDW	;GOOD CONTENTS,MAYBE
	MOVE	T1,P2
	PUSHJ	P,.TXWDW
	XOR	P1,P2			;CREATE DIFFERENCE
	TYPEIT	<
	DIFFERENCE:	>
	MOVE	T1,P1
	PUSHJ	P,.TXWDW
	TYPEIT	<
	PHYSICAL MEM ADDR.
	 AT FAILURE:	>
	MOVE	T1,WKBUFF+PT%PMA
	PUSHJ	P,.TXWDW
	TYPEIT	<
	RECOVERY:	>
	MOVE	P1,WKBUFF+PT%TRY	;RETRY WORD
	MOVE	T1,[SIXBIT/CONT./]	;ASSUME GOODNESS
	TLNE	P1,ERRHRD		;BETTER CHECK
	 MOVE	T1,[SIXBIT/CRASH/]
	PUSHJ	P,.TSIXN

	TYPEIT	< USER
	RETRY COUNT:	>
	HRRZ	T1,P1
	PUSHJ	P,.ODECW
	TLNE	P1,1B20
	 PUSHJ	P,[TYPEIT	(
	CACHE ERROR,)
		POPJ	P,0]
	TLNE	P1,1B21
	 PUSHJ	P,[TYPEIT	(
	CACHE IN USE,)
		POPJ	P,0]
	TLNE	P1,1B22
	 PUSHJ	P,[TYPEIT	(
	ERROR ON SWEEP TO CORE,)
		POPJ	P,0]
	POPJ	P,0	;BACK TO PROCSD



	;SPECIAL ROUTINES FORTOPS20 RELOAD AND BUGHLT/BUGCHK
	;ARE HERE


RL%001:	TYPEIT	<
RELOAD BREAKDOWN:
>
	SKIPN	P2		;WAS IT BUGHLT?
	 JRST	RL%002		;NO
	TYPEIT	<	BUGHLT ADDRESS:	>
	MOVE	T1,P2		;GET THE ADDR
	PUSHJ	P,.TOCTW
RL%002:	SKIPN	P1,WKBUFF+RL%OPR	;OFFSET FROM WKBUFF
	 POPJ	P,0		;NONE THERE
	TYPEIT	<	WHY RELOAD:	>
	HRRZI	T1,WKBUFF(P1)	;ADDR OF ASCIZ
	PJRST	.TSTRG		;TO OPR COMMENTS


	;HERE FOR 102

BG%001:	TYPEIT	<
	ERROR:		>
	MOVE	T1,[SIXBIT/BUGCHK/]
	CAIN	P2,BG%INF		;BUGINF?
	 MOVE	T1,[SIXBIT/BUGINF/]
	CAIN	P2,BG%HLT		;BUGHLT?
	 MOVE	T1,[SIXBIT/BUGHLT/]	;EDIT 213
	PUSHJ	P,.TSIXN	;SAY EITHER
	PUSHJ	P,.TCRLF
	
	TYPEIT	<	ADDRESS OF ERROR:	>
	MOVE	T1,WKBUFF+BG%ADR
	PUSHJ	P,.TOCTW	;IN OCTAL
	TYPEIT	<
	NAME:			>
	MOVE	T1,WKBUFF+BG%NAM		;GET NAME
	PUSHJ	P,.TSIXN
	PUSHJ	P,.TCRLF
	TYPEIT	<	DESCRIPTION:		>
	HRRZ	T1,WKBUFF+BG%MSG
	ADDI	T1,WKBUFF	;ANOTHER ASCIZ POINTER
	PUSHJ	P,.TSTRG
	PUSHJ	P,DETCHK	;SAID /DETAIL?
	TYPEIT	<
	CONTENTS OF AC'S:>	;YES
	MOVEI	P1,BG%ACS	;OFFSET OF 1ST
	HRLI	P1,-20		;# TO DUMP
	PUSHJ	P,ACLST
	TYPEIT	<
	PI STATUS:	>
	MOVE	T1,WKBUFF+BG%PIS	;GET THE WORD
	PUSHJ	P,.TXWDW		;IN HALF WORD
	MOVE	P1,WKBUFF+BG%RCT	;# OF REGISTERS
	SKIPN	P1			;BUT IF NONE
	 PJRST	TITLST			;LEAVE NOW
	TYPEIT	<
	SELECTED VALUES:	>
	MOVE	T1,P1
	PUSHJ	P,.TOCTW
	HRLZI	P2,-4			;# TO DUMP
	HRRI	P2,WKBUFF+BG%REG
	PUSHJ	P,.TCRLF
	PUSHJ	P,.TTABC
	MOVE	T1,0(P2)		;SOMETHING TO DUMP
	PUSHJ	P,.TXWDW
	PUSHJ	P,.TCRLF
	AOBJN	P2,.-4			;GO BACK IF MORE TO DO
	PUSHJ	P,TITLST	;START ON NEXT PAGE
	POPJ	P,0


PI%001:	TYPEIT	<
	CONI APR:	>
	MOVE	P1,WKBUFF+PI%CNI	;GET THE APR CONI
	MOVE	T1,P1
	PUSHJ	P,.TXWDW
	TYPEIT	< = >
	MOVEI	T1,12		;OFFSET FOR CONI APR KL10
	MOVEM	T1,KONTYP
	PUSHJ	P,CNIDCD	;GO TRANSLATE
;NOW FOR ERA

	TYPEIT	<
	ERA:		>
	MOVE	P1,WKBUFF+PI%ERA
	MOVE	T1,P1
	PUSHJ	P,.TXWDW
	TYPEIT	< = WD #>
	LDB	T1,[POINT 2,P1,1]	;GET WORD #
	PUSHJ	P,.TOCTW
	PUSHJ	P,.TSPAC
	TLNE	P1,1B20			;SWEEP?
	 PUSHJ	P,[TYPEIT	<, SWEEP REF, >
		POPJ	P,0]
	TLNE	P1,1B21		;CHAN?
	PUSHJ	P,[TYPEIT <, CHAN REF, >
		POPJ	P,0]
	LDB	T2,[POINT 3,P1,6]	;GET DATA SOURCE & WRITE BIT
	MOVE	T1,ERAMES(T2)	;ADDR OF SOME ASCIZ
	PUSHJ	P,.TSTRG

;NOW FOR MEM ADDR

	TYPEIT	<
	BASE PHY. MEM ADDR.
	 AT FAILURE:	>
	LDB	T1,[POINT 22,P1,35]	;22 BITS OF ADDR 
	PUSHJ	P,.TOCTW		;NOT HALF WORD
	PUSHJ	P,.TCRLF
	POPJ	P,0



	;P2 HAS PI%DAT
PI%002:	HRLZI	P2,-^D10		;# TO DUMP
	HRRI	P2,WKBUFF+PI%DAT	;BUILDS A POINTER
	HRLZI	P1,-^D10
	HRRI	P1,WKBUFF+PI%ADD	;POINTER TO ADDRESSES
	HRLZI	P3,-^D10
	HRRI	P3,WKBUFF+PI%CDA	;PNTR TO GOOD DATA[420]
	TYPEIT	<
ERRORS DETECTED DURING SWEEP:
ADDRESS	BAD DATA	GOOD DATA	DIFFERENCE
>

PI%003:	MOVE	T1,0(P1)	;GET ADDRESS
	SKIPN	T1			;ANYTHING THERE?
	 JRST	PI%004			;NO
	PUSHJ	P,.TOCTW	;NOT HAFWD
	PUSHJ	P,.TTABC
	MOVE	T1,0(P2)	;GET DATA
	PUSHJ	P,.TXWDW
	PUSHJ	P,.TTABC	;[420]LIST GOOD DATA AND XOR DIFFERENCE
	MOVE	T1,0(P3)	;GET GOOD DATA
	PUSHJ	P,.TXWDW
	PUSHJ	P,.TTABC
	MOVE	T1,0(P2)	;BAD
	MOVE	T2,0(P3)	;GOOD
	XOR	T1,T2		;DIFFERENCE TO T1
	PUSHJ	P,.TXWDW	;LIST IT
				;END [420]
	PUSHJ	P,.TCRLF
PI%004:	AOBJN	P1,.+1
	AOBJN	P3,.+1
	AOBJN	P2,PI%003	;GO DO NEXT OR
	 PUSHJ	P,TITLST	;START ON NEXT PAGE AND
	  POPJ	P,0		;LEAVE

ERAMES:	[ASCIZ/MEMORY READ/]
	[ASCIZ/CHAN STORE STATUS/]
	[ASCIZ/INVALID/]
	[ASCIZ/CHAN DATA/]
	[ASCIZ/INVALID/]
	[ASCIZ/E-BOX STORE/]
	[ASCIZ/CACHE READ/]
	[ASCIZ/CACHE WRITE/]



PI%005:	HRLZI	P2,-^D8		;BUILD A POINTER
	HRRI	P2,WKBUFF+PI%SBD	;FOR SBDLST AND THEN
	JRST	SBDLST			;CALL THE RIGHT ROUTINE


	;HERE WE LIST SYSTEM ME CONFIG BASED ON RESULTS OF
	;SBUS DIAG FUNCTIONS STORED IN WKBUFF
	;FIRST IS INTERLEAVE MODE
	;POINTER TO SUBTABLE IS IN P2
SBDLST:	PUSHJ	P,DETCHK	;DID USER SAY /DETAIL?
	TYPEIT	<
SYSTEM MEMORY CONFIGURATION:
>
	MOVE	P1,P2
;	SKIPN	P2,0(P1)	;DMA PRESENT?
	 JRST	SBDLS1		;NO
	TYPEIT	<
	INTERLEAVE MODE:	>
	LDB	T2,[POINT 2,P2,7]	;GET INTERLEAVE MODE
	MOVE	T1,[SIXBIT/4 WAY/]	;ASSUME THE BEST
	CAIN	T2,2
	 MOVE	T1,[SIXBIT/2 WAY/]
	CAIN	T2,1
	 MOVE	T1,[SIXBIT/NONE/]	;WE TRIED
	PUSHJ	P,.TSIXN
	TYPEIT	<
	DMA:
	LAST ADDR HELD:	>
	LDB	T1,[POINT 22,P2,35]	;A FEW ADDR BITS
	PUSHJ	P,.TOCTW
	TYPEIT	<
	ERRORS DETECTED:	>
	MOVE	P2,0(P1)
	LDB	P3,[POINT 6,P2,5]	;6 ERROR BITS
	SKIPN	P3			;ANY SET?
	 PUSHJ	P,[TYPEIT (NONE)
		POPJ	P,0]
	TRNE	P3,1B32			;NXM?
	 PUSHJ	P,[TYPEIT (INC. CYCLE)	;[435]
		POPJ	P,0]
	TRNE	P3,1B33			;READ PARITY
	 PUSHJ	P,[TYPEIT (READ PARITY)
		POPJ	P,0]
	TRNE	P3,1B34
	 PUSHJ	P,[TYPEIT (WRITE PARITY)
		POPJ	P,0]
	TRNE	P3,1B35
	 PUSHJ	P,[TYPEIT (ADDR PARITY)
		POPJ	P,0]

SBDLS1:;	AOBJN	P1,.+1	;UPDATE POINTER
;	AOBJN	P1,.+1
	SETZ	P3,

SBDLS2:	SKIPN	P2,1(P1)	;GET FUNCTION 1
	 JRST	SBDLS3		;SETUP FOR NEXT
	TYPEIT	<
CONTROLLER:  >
	MOVE	T1,SBDNAM(P3)	;CONTROLLER #
	PUSHJ	P,.TSIXN
	PUSHJ	P,.TSPAC
	PUSHJ	P,.TSPAC
	LDB	T2,[POINT 4,P2,11]	;GET TYPE
	PUSH	P,T2		;SAVE IT
	MOVE	T1,SBDTYP(T2)
	PUSHJ	P,.TSIXN
	PUSHJ	P,.TSPAC
	PUSHJ	P,.TSPAC
	POP	P,T3	;GET MEMORY TYPE BACK
	LDB	T2,[POINT 4,P2,7]	;# OF MODULES
	SETZ	T1,
	TRNE	T2,1B35		;SM0 PRESENT?
	 ADDI	T1,1
	TRNE	T2,1B34		;SM1?
	 ADDI	T1,1
	TRNE	T2,1B33		;SM2?
	 ADDI	T1,1
	TRNE	T2,1B32		;SM3?
	 ADDI	T1,1
	MUL	T1,SBDSIZ(T3)	;TIMES UNIT SIZE
	MOVE	T1,T2			;ANSWER TO T1
	PUSHJ	P,.TDECW
	TYPEIT	< K>
	TYPEIT	<
F0:	>
	MOVE	T1,0(P1)	;GET FUNCTION 0
	PUSHJ	P,.TXWDW
	TYPEIT	<	F1:	>
	MOVE	T1,1(P1)	;GET FUNCTOON 1
	PUSHJ	P,.TXWDW
	TYPEIT	<
	INTERLEAVE MODE:	>
	MOVE	T2,0(P1)	;GETFINCTION0
	LDB	T3,[POINT 2,T2,7]
	MOVE	T1,SBDINT(T3)	;POINTER TO ASCIZ OF INT. MODE
	PUSHJ	P,.TSTRG
	TYPEIT	<
	REQ ENABLED:	>
	MOVE	P2,1(P1)		;GET FUNCTION 1
	TRNN	P2,1B32		;0?
	JRST	.+3
	TYPEIT	<0 >
	TRNN	P2,1B33
	JRST	.+3
	TYPEIT	<1 >
	TRNN	P2,1B34
	JRST	.+3
	TYPEIT	<2 >
	TRNN	P2,1B35
	JRST	.+3
	TYPEIT	(3)
	TYPEIT	<
	LOWER ADDRESS BOUNDARY:	>
	MOVE	P2,1(P1)	;GET FUNCTION 1
	LDB	T1,[POINT 8,P2,21]	;GETS ADDRESS BITDS
	LSH	T1,^D14		;MOVED OVER TO CONVERT TO BETTER FORMAT
	PUSHJ	P,.TOCTW
	TYPEIT	<
	UPPER ADDRESS BOUNDARY:	>
	LDB	T1,[POINT 4,P2,25]	;GETS 18-21
	LSH	T1,^D14		;MOVED TO CORRECT PLACE
	LDB	T2,[POINT 4,P2,17]	;GET 14-17
	HRL	T1,T2	;SETSUP 14-21 FOR UPPER ADDR
	TRO	T1,37777	;SET THE OTHER BITS
	PUSHJ	P,.TOCTW
	TYPEIT	<
	ERRORS DETECTED:	>
	MOVE	P2,0(P1)
	LDB	P4,[POINT 6,P2,5]	;6 ERROR BITS
	SKIPN	P4			;ANY SET?
	 PUSHJ	P,[TYPEIT (NONE)
		POPJ	P,0]
	TRNE	P4,1B32			;INC CYCLE?
	 PUSHJ	P,[TYPEIT (INC CYCLE)
		POPJ	P,0]
	TRNE	P4,1B33			;READ PARITY
	 PUSHJ	P,[TYPEIT (READ PARITY)
		POPJ	P,0]
	TRNE	P4,1B34
	 PUSHJ	P,[TYPEIT (WRITE PARITY)
		POPJ	P,0]
	TRNE	P4,1B35
	 PUSHJ	P,[TYPEIT (ADDR PARITY)
		POPJ	P,0]
SBDLS3:	AOJ	P3,
	AOBJN	P1,.+1	;UPDATE POINTER TWICE
	AOBJN	P1,SBDLS2	;DO NEXT CONTROLLER YX
	 POPJ		P,0	;ALL DONE


SBDNAM:	SIXBIT/#0/
	SIXBIT/#1/
	SIXBIT/#2/
	SIXBIT/#3/

SBDTYP:	SIXBIT/CUST/
	SIXBIT/MA20/
	SIXBIT/DMA20/
	SIXBIT/MB20/
	SIXBIT/UNKN/

SBDSIZ:	0
	^D16
	0
	^D32

	0

SBDINT:	[ASCIZ/OFF-LINE/]
	[ASCIZ/NONE/]
	[ASCIZ/2-WAY/]
	[ASCIZ/4-WAY/]



	;HERE FOR FRONT END DEVICE REPORTING
	;P2 HAS FE%COD

FE%001:	TYPEIT	<
	DEVICE:	>
	HRRZ	T1,P2		;GET DEV TYPE ALONE
	CAILE	T1,^D256	;IN RANGE?
	 JRST	FE$UNK		;NOPE
	CAIL	T1,200		;HARDWARE DEVICE?
	 JRST	FE%004		;NOPE
	MOVE	T1,FE$NAM(P2)		;GET DEVICE NAME
	PUSHJ	P,.TSIXN		;IN SIXBIT
	TYPEIT	<  # >
	HLRZ	T1,P2			;GET DEV #
	TRZ	T1,1B18			;CLR THE I DON'T KNOW BIT
	PUSHJ	P,.ODECW		;WITH A .
	PUSHJ	P,.TCRLF
	TLNN	P2,1B18			;"I DON'T KNOW"?
	 JRST	FE%002			;NO
	TYPEIT	< **DEVICE UNKNOWN TO TOPS**
>

	;NOW GO TO DEVICE DEPENDENT ROUTINES WITH POINTERIN P1

FE%002:	HRRZ	P1,WKBUFF+FE%OFF
	PUSHJ	P,@FE%003(P2)
	POPJ	P,0

FE$NAM:	0
	SIXBIT/CTY/
	SIXBIT/DL11C/
	SIXBIT/DH11/
	SIXBIT/DLSCAN/
	SIXBIT/LP20/
	SIXBIT/CD20/
	SIXBIT/CLOCK/
	SIXBIT/FE DEV/
	SIXBIT/UNK/

FEHNAM:	SIXBIT/KLCPU/
	SIXBIT/KLERR/
	SIXBIT/UNK/
	SIXBIT/UNK/
	SIXBIT/UNK/
FE%005:	0,,FE$KLS	;KL RELOAD REPORT FROM FRONT END
	0,,FE$KLF	;KLERROR FILE DUMP
	0,,FE$UNK
	0,,FE$UNK
	0,,FE$UNK


FE%003:	0,,FE$UNK
	0,,FE$UNK
	0,,FE$UNK
	0,,FE$DH1
	0,,FE$UNK
	0,,FE$LP0	;LP20 ROUTINE
	0,,FE$CD0	;CD20 ROUTINE
	0,,FE$UNK
	0,,FE$UNK
	0,,FE$UNK


FE$UNK:	TYPEIT	< - DEVICE IS UNKNOWN TO SYSERR
>
	TYPEIT	<
	DEVICE CODE:	>
	HRRZ	T1,WKBUFF+FE%COD	;GET DEV CODE	
	PUSHJ	P,.TOCTW		;IN OCTAL
	TYPEIT	<
	DATA IN ERROR BLOCK:
>
	MOVE	P1,WKBUFF+FE%OFF	;GET OFFSET
	ADDI	P1,WKBUFF		;CORRECT IT
FE$UN1:	PUSHJ	P,.TTABC
	MOVE	T1,0(P1)		;GET VALUE
	PUSHJ	P,.TXWDW		;IN HALF WORD FORMAT
	PUSHJ	P,.TCRLF
	AOBJN	P1,FE$UN1		;MORE TO DO
	 POPJ	P,0
	POPJ	P,0
FE%004:	SUBI	T1,200		;REMOVE OFFSET
	MOVE	P3,T1		;SAVE IT
	MOVE	T1,FEHNAM(P3)	;GET A NAME
	PUSHJ	P,.TSIXN
	HRRZ	P1,WKBUFF+FE%OFF	;SETUP OFFSET
	PUSHJ	P,@FE%005(P3)	;GO TO DEVICE ROUTINES
	POPJ	P,0		;THEN BACK TO PROCSD


	;ROUTINE TO UNPACK 3 WORDS FROM KLEFIL INTO ONE
	;PDP-10 WORD IN T1.  P1 HOLDS POINTER TO 1ST
	;WORD AND IS UPDATED IN THIS ROUTINE.
FE$BWD:	MOVE	T2,KLEFIL(P1)	;GET 1ST PORTION
	DPB	T2,[POINT 16,T1,35]
	ADDI	P1,1		;UPDATE
	MOVE	T2,KLEFIL(P1)	;GET 2ND
	DPB	T2,[POINT 16,T1,19]
	ADDI	P1,1		;UPDATE AGAIN
	MOVE	T2,KLEFIL(P1)	;GET 3RD
	DPB	T2,[POINT 4,T1,3]	;LAST BITS
	POPJ	P,0		;WORD IN T1 SO RETURN

FE$LP0:	TYPEIT	<
	STD. STATUS:	>
	MOVE	P1,WKBUFF+FE%OFF	;GET FUL OFFSETWORD
	ADDI	P1,WKBUFF		;CORRECT TO POINT INTO WKBUFF
	LDB	T1,[POINT 16,(P1),15]	;GET DV.XXX
	PUSH	P,P1			;SAVE A POINTER
	PUSH	P,T1			;SAVE THE WORD
	PUSHJ	P,.TOCTW
	MOVEI	T1,36			;CORRECTOFFSET
	MOVEM	T1,KONTYP
	TYPEIT	< = >
	POP	P,P1			;GET THE WORD BACK
	PUSHJ	P,CNIDCD		;1 FOR ONE XLATION

	;NOW FOR 2ND STATUS BYTE
	TYPEIT	<
	LP20 GEN STATUS:	>
	POP	P,P1			;GET POINTER BACK
	PUSH	P,P1	;SAVE IT STILL
	LDB	T1,[POINT 16,(P1),31]	;GET DD.LP20
	PUSH	P,T1		;SAVEIT
	PUSHJ	P,.TOCTW
	POP	P,P1			;GET IT BACK
	MOVEI	T1,37			;OFFSET
	MOVEM	T1,KONTYP		;SETUP
	TYPEIT	< = >
	PUSHJ	P,CNIDCD
	POP	P,P1			;GET POINTER BACK
	AOBJN	P1,.+1			;SKIP 2 11-WORDS FOR NOW
	AOBJN	P1,.+1			;POINT AT NEXT TWO
	HRLI	P1,-^D8		;;# OF REGISTERSTO LIST
	HRLI	P2,LP$REG		;ADDR OF REG NAMES
	HRRI	P2,LP$CON		;ADDR OF CONTROL TABLE
	TYPEIT	<
	LP20 DEVICE REGISTERS
>
	PUSHJ	P,LSTEB			;LIST DEVICE REGISTERS
	PUSHJ	P,TITLST		;START ON NEXT PAGE
	POPJ	P,0


	;TABLES FOR LP20 LISTINGS
LP$REG:	SIXBIT/LPCSRA/
	SIXBIT/LPCSRB/
	SIXBIT/LPBSAD/
	SIXBIT/LPBCTR/
	SIXBIT/LPPCTR/
	SIXBIT/LPRAMD/
	SIXBIT/LPCCTR/
	SIXBIT/LPTDAT/


LP$CON:	40,,0
	41,,0
	-1,,NOTRAN
	-1,,NOTRAN
	-1,,NOTRAN
	-1,,NOTRAN
	-1,,LPCLST
	-1,,LPDLST
;DH11 ROUTINES

FE$DH1:	TYPEIT	<
	STD. STATUS:	>
	MOVE	P1,WKBUFF+FE%OFF	;GET FUL OFFSETWORD
	ADDI	P1,WKBUFF		;CORRECT TO POINT INTO WKBUFF
	LDB	T1,[POINT 16,(P1),15]	;GET DV.XXX
	PUSH	P,P1			;SAVE A POINTER
	PUSH	P,T1			;SAVE THE WORD
	PUSHJ	P,.TOCTW
	MOVEI	T1,36			;CORRECTOFFSET
	MOVEM	T1,KONTYP
	TYPEIT	< = >
	POP	P,P1			;GET THE WORD BACK
	PUSH	P,P1			;AND SAVE IT STILL
	PUSHJ	P,CNIDCD		;1 FOR ONE XLATION
	POP	P,P2			;GET THE WORD BACK
	POP	P,P1			;AND THE POINTER
	TRNN	P2,1B25		;LOST INTERRUPT?
	 JRST FE$DHA			;MUST BE DEV HUNG.
	TYPEIT	<
	PAGE ADDR OF DH WHICH FAILED:	>
	LDB	T1,[POINT 16,(P1),31]	;GET NEXT WORD
	PUSHJ	P,.TOCTW		;DUMP IN OCTAL
	POPJ	P,0			;THAT'S ALL TO LIST

FE$DHA:	TYPEIT	<
	CONTENTS OF COUNTERS:	>
	LDB	T1,[POINT 16,(P1),31]	;GET ONE
	PUSHJ	P,.TOCTW		;LIST IT
	PUSHJ	P,.TCRLF
	PUSHJ	P,.TTABC
	LDB	T1,[POINT 16,1(P1),15]	;2ND
	PUSHJ	P,.TOCTW
	PUSHJ	P,.TCRLF
	PUSHJ	P,.TTABC
	LDB	T1,[POINT 16,1(P1),31]	;3RD
	PUSHJ	P,.TOCTW
	PUSHJ	P,.TCRLF
	PUSHJ	P,.TTABC
	LDB	T1,[POINT 16,2(P1),15]	;4TH
	PUSHJ	P,.TOCTW
	PUSHJ	P,.TCRLF
	PUSHJ	P,.TTABC
	POPJ	P,0			;THAT'S ALL TO LIST



FE$CD0:	TYPEIT	<
	STD. STATUS:	>
	MOVE	P1,WKBUFF+FE%OFF	;GET FUL OFFSETWORD
	ADDI	P1,WKBUFF		;CORRECT TO POINT INTO WKBUFF
	LDB	T1,[POINT 16,(P1),15]	;GET DV.XXX
	PUSH	P,P1			;SAVE A POINTER
	PUSH	P,T1			;SAVE THE WORD
	PUSHJ	P,.TOCTW
	MOVEI	T1,36			;CORRECTOFFSET
	MOVEM	T1,KONTYP
	TYPEIT	< = >
	POP	P,P1			;GET THE WORD BACK
	PUSHJ	P,CNIDCD		;1 FOR ONE XLATION

	;NOW FOR 2ND STATUS BYTE
	TYPEIT	<
	CD20 GEN STATUS:	>
	POP	P,P1			;GET POINTER BACK
	PUSH	P,P1	;SAVE IT STILL
	LDB	T1,[POINT 16,(P1),31]	;GET DD.CD11
	PUSH	P,T1		;SAVEIT
	PUSHJ	P,.TOCTW
	PUSHJ	P,.TTABC
	POP	P,P1			;GET IT BACK
	MOVEI	T1,42			;OFFSET
	MOVEM	T1,KONTYP		;SETUP
	TYPEIT	< = >
	PUSHJ	P,CNIDCD
	POP	P,P1			;GET POINTER BACK
	AOBJN	P1,.+1			;SKIP 2 BYTES FOR NOW
	TYPEIT	<
	CD20 DEVICE REGISTERS
	>
	MOVE	T1,[SIXBIT/CD11ST/]
	PUSHJ	P,.TSIXN	;INSIXBIT
	PUSHJ	P,.TTABC
	LDB	T1,[POINT 16,(P1),31]
	PUSH	P,T1			;SAVE IT
	PUSHJ	P,.TOCTW		;IN OCTAL
	MOVEI	T1,43		;OFFSET FOR THIS REG
	MOVEM	T1,KONTYP
	PUSHJ	P,.TTABC	;SOME SPACE
	POP	P,T1			;GETWORD BACK
	PUSHJ	P,SAVE4P		;SAVE AC'S
	MOVE	P1,T1		;SETUP
	TYPEIT	< = >
	PUSHJ	P,CNIDCD	;GO DECODE
	PUSHJ	P,RET4P			;RETURN THOSE AC'S
	PUSHJ	P,.TCRLF
	AOBJN	P1,.+1			;ADJUST FOR WORDS WE JUST DID
	HRLI	P1,-^D3		;;# OF REGISTERSTO LIST
	HRLI	P2,CD$REG		;ADDR OF REG NAMES
	HRRI	P2,CD$CON		;ADDR OF CONTROL TABLE
	PUSHJ	P,LSTEB			;LIST DEVICE REGISTERS
	PUSHJ	P,TITLST		;START ON NEXT PAGE
	POPJ	P,0

FE$KLS:	TYPEIT	<
	STD. STATUS:	>
	MOVE	P1,WKBUFF+FE%OFF	;GET FUL OFFSETWORD
	ADDI	P1,WKBUFF		;CORRECT TO POINT INTO WKBUFF
	LDB	T1,[POINT 16,(P1),15]	;GET DV.XXX
	PUSH	P,P1			;SAVE A POINTER
	PUSH	P,T1			;SAVE THE WORD
	PUSHJ	P,.TOCTW
	MOVEI	T1,36			;CORRECTOFFSET
	MOVEM	T1,KONTYP
	TYPEIT	< = >
	POP	P,P1			;GET THE WORD BACK
	PUSHJ	P,CNIDCD		;1 FOR ONE XLATION

	;NOW FOR 2ND STATUS BYTE
	TYPEIT	<
	KL RELOAD STATUS FROM FRONT END:  >
	POP	P,P1			;GET POINTER BACK
	PUSH	P,P1	;SAVE IT STILL
	LDB	T1,[POINT 16,(P1),31]	;GET DD.KLWD
	PUSH	P,T1		;SAVEIT
	PUSHJ	P,.TOCTW
	PUSHJ	P,.TTABC
	POP	P,P1			;GET IT BACK
	MOVEI	T1,46			;OFFSET
	MOVEM	T1,KONTYP		;SETUP
	TYPEIT	< = >
	PUSHJ	P,CNIDCD
	POP	P,P1			;GET POINTER BACK
	POPJ	P,0		;THAT'S ALL

	;TABLES FOR CD11 LISTINGS

CD$REG:	SIXBIT/CD11CC/
	SIXBIT/CD11BA/
	SIXBIT/CD11DB/


CD$CON:	-1,,NOTRAN
	-1,,NOTRAN
	-1,,NOTRAN


	;THIS IS A MAP OF TE FORMAT OF TE  KLERROR FILE AFTER
	;IT IS REBUILT INTO SYSER'S LOW SEGMENT.  THE DEFINED
	;VALUES ARE THE OFFSETS TO THHE START OF THE FILE.
	
	KR.FTY==0		;KLERROR FORMAT VERSION
	KR.RLC==1		;RECORD LENGTH IN BYTES
	KR.TMYR==2		;TIME OF DAY - YEAR
	KR.TMMO==3		;   - MONTH
	KR.TMDA==4		;   - DAY
	KR.TMHR==5		;   - HOUR
	KR.TMMI==6		;   - MINUTE
	KR.TMSE==7		;   - SECOND

	KR.KSN==12		;KL SER #
	KR.ESN==13		;FE SER #
	KR.UVN==14		;MICRO CODE VERSION
	KR.MVN==15		;MONITOR VERSION
	KR.RVN==21		;FE SOFT VER #
	KR.ECD==23		;ERROR CODE
	KR.DG1==24		;DTE DIAG 1
	KR.DG2==25		;DTE DIAG 2
	KR.DGS==26		;DTE DIAG STATUS
	KR.DG3==27		;DTE DIAG 3
	KR.FNR==30		;START OF FUNCTION READ VALUES
	KR.IPE==330		;-11 RAD 50 ERROR WROD
	KR.CHK==337		;CHECKSUM FOR ABOVE DATA


	;HERE ARE ROUTINES TO DUMP KLEFIL 
FE$KLF:	TYPEIT	<
	CONTENTS OF KLERROR FILE:
>
	TYPEIT	<CONTENTS OF RECORD #1  SEEN AT FIRST ERROR
>
KLFCON:	TYPEIT	<	CREATED:  >
	MOVEI	P1,KR.TMYR		;OFFSET TO START OF DATE/TIME
	MOVE	T1,KLEFIL+1(P1)	;GET MONTH FIR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	T1,KLEFIL(P1)	;GET THAT VALUE
	MOVE	P2,T1		;SAVE IT FOR TRANSLATION
	PUSHJ	P,.TOCTW	;IN DECIMAL
	TYPEIT	< = >
	TRNN	P2,1B35
	JRST	.+3
	TYPEIT	<CLK STOP,>
	TRNN	P2,1B34
	JRST	.+3
	TYPEIT	<DRAM PAR,>
	TRNN	P2,1B33
	JRST	.+3
	TYPEIT	<CRAM PAR,>
	TRNN	P2,1B32
	JRST	.+3
	TYPEIT	<FAST MEM PAR,>
	TRNN	P2,1B31
	JRST	.+3
	TYPEIT	<FIELD SERVICE STOP,>
	SKIPE	P2
	JRST	.+3
	 TYPEIT	<NONE>
	PUSHJ	P,.TCRLF
	TYPEIT	<	DTE DIAG STATUS:	>
	MOVEI	P1,KR.DGS
	MOVE	T1,KLEFIL(P1)	;GET THAT VALUE
	PUSHJ	P,.TOCTW	;IN DECIMAL
	TYPEIT	<
	DTE DIAG 1:	>
	MOVEI	P1,KR.DG1
	MOVE	T1,KLEFIL(P1)	;GET THAT VALUE
	PUSHJ	P,.TOCTW	;IN DECIMAL
	TYPEIT	<	DTE DIAG 2:	>
	MOVEI	P1,KR.DG2
	MOVE	T1,KLEFIL(P1)	;GET THAT VALUE
	PUSHJ	P,.TOCTW	;IN DECIMAL
	TYPEIT	<	DTE DIAG 3:	>
	MOVEI	P1,KR.DG3
	MOVE	T1,KLEFIL(P1)	;GET THAT VALUE
	PUSHJ	P,.TOCTW	;IN DECIMAL
;NOW DUMP FUNCTION READS
	HRLI	P1,-100		;NUMBER TO DO
	HRRI	P1,KR.FNR		;STARTING OFFSET
	MOVEI	P2,0		;WHERE TO PUT THE WORDS
FE$KL1:	MOVE	T2,KLEFIL(P1)	;GET 1ST PORTION
	DPB	T2,[POINT 16,T1,35]
	ADDI	P1,1		;UPDATE
	MOVE	T2,KLEFIL(P1)	;GET 2ND
	DPB	T2,[POINT 16,T1,19]
	ADDI	P1,1		;UPDATE AGAIN
	MOVE	T2,KLEFIL(P1)	;GET 3RD
	DPB	T2,[POINT 4,T1,3]	;LAST BITS
	MOVEM	T1,KLEFIL(P2)	;PUT AWAY THE WORD
	AOS	P2
	AOBJN	P1,FE$KL1	;UPDATE & DO NEXT

;HERE SETUP TO CALL SYSERK TO LIST CONTENTS
	SETZ	15,	;CLEAR OLD STARTING ADDRESS
	MOVEI	14,FE$KLA	;SETUP RETURN ADDRESS
	MOVE	T1,[SIXBIT/SYSERK/]
	MOVEM	T1,OVRBLK+1	;HIS NAME
	MOVE	16,[SIXBIT/SYSERD/]	;OUR NAME FOR PROPER RETURN
	MOVEM	17,SAVEAC+17
	MOVEI	17,SAVEAC
	BLT	17,SAVEAC+16	;STORE AC'S
	JRST OVRLAY		;GO REPLACE US

;WHEN SYSERK IS FINISHED IT WILL CALL SYSERD BACK AND
;THE OVERLAY WILL USE THE NEXT LINE AS THE STARTING ADDRESS INSTEAD
;OF THAT STORED BY LINK
FE$KLA:	MOVEI	15,0		;CLEAR RETURN ADDRESS
	MOVEI	T1,CHROUT
	PUSHJ	P,.TYOCH	;RE-INIT SCAN ROUTINES
	PUSHJ	P,.TCRLF	;NEXT LINE PLEASE
	MOVEI	P1,KR.IPE		;MIGHT BE LOCATION 330??

	SKIPN	P2,KLEFIL(P1)	;ANY ERRORS DETECTED
	 JRST	FE$KLB		;NOPE
	TYPEIT	<**** DATA MAY NOT BE VALID ****>
	PUSHJ	P,.TCRLF
	TYPEIT	<	ERROR DETECTED:	>
	MOVE	T1,P2
	PUSHJ	P,R5VSIX	;CONVERT IT TO SIXBIT
	HRLZ	T1,T1		;MOVE IT OVER
	PUSHJ	P,.TSIXN	;NOW DUMP IT

FE$KLB:	SKIPE	KLEFL1		;-1 NOW SAYS WE JUST LISTED 2ND RECORD
	 JRST 	FE$KLC		;SO RETURN TO PROCSD
	HRRZ	T1,KLEPNT	;GET LAST ADDR USED TO BUILD THIS FILE
	CAIG	T1,KLE1FL	;USED SECOND RECORD?
	 JRST	FE$KLC		;NO-RETURN NOE
	CAIL	T1,KLEFIL	;ANY WORDS IN 2ND RECORD?
	 JRST FE$KLC		;NO SO DON'T GO ANY FURTHER
	SETOM	KLEFL1		;YES, WE MUST LIST THEM TOO
;*******
;IF DEBUGGING, BETTER PUT A BREAKPOINT HERE IF YOU WANT TO
;SEE THE CONTENTS OF THE 1ST RECORD.  IT WON'T BE AROUND MUCH
;LONGER!!!!!
;********
	SETZM	KLEFIL				;CLEAR
	MOVE	T1,[XWD KLEFIL,KLEFIL+1]	;THE FIRST
	BLT	T1,KLEEND-1			;FILE AREA
	MOVE	T1,[XWD KLE1FL,KLEFIL]	;THEN COPY THE 2ND RECORD
	BLT	T1,KLEEND-1	;TO THE 1ST RECORD AREA.
	PUSHJ	P,TITLST		;START ON NEXT PAGE
	TYPEIT	<

LISTING 2ND RECORD, THE LAST ERROR SEEN

>
	JRST	KLFCON	;USE ALL THE SAME CODE AGAIN
FE$KLC:	PUSHJ	P,TITLST	
	SETZM	KLEFL2		;NO MORE BUILDING OF KLEFIL
	SETZM	KLEFL3		;OR LISTING EITHER
	SETZM	KLEFL1		;CLEAR THAT ONE TOO
	POPJ	P,0	

;SPECIAL TRANSLATION FOR LP20 REGISTERS

LPCLST:	MOVE	P1,T1		;GET WORD
	TYPEIT	<COL. CNTR. = >
	LDB	T1,[POINT 8,P1,27]	;UPPER BYTE
	PUSHJ	P,.TOCTW
	TYPEIT	< CHAR. BUF = >
	LDB	T1,[POINT 8,P1,35]	;LOWER BYTE
	PUSHJ	P,.TOCTW
	PUSHJ	P,.TCRLF
	POPJ	P,0

LPDLST:	MOVE	P1,T1			;GET THE WORD
	TYPEIT	<CHKSUM = >
	LDB	T1,[POINT 8,P1,27]	;UPPER BYTE
	PUSHJ	P,.TOCTW
	TYPEIT	< LPT DATA = >
	LDB	T1,[POINT 8,P1,35]	;LOWER BYTE
	PUSHJ	P,.TOCTW
	PUSHJ	P,.TCRLF
	POPJ	P,0


	;SPECIAL ROUTINE FOR CODE 131 FROENT END RELOAD
	;P2 HAS R1%NUM

R1%000:	TYPEIT	<
	FRONT END #:	>
	MOVEI	T1,[ASCIZ/PRIVILEGED  /]
	TLZE	P2,1B18		;IS IT?
	 PUSHJ	P,.TSTRG		;YUP
	MOVE	T1,P2
	PUSHJ	P,.TOCTW
	MOVE	P3,WKBUFF+R1%STS	;GET STATUS WORD
	TYPEIT	<
	STATUS AT RELOAD:	>
	MOVE	P1,P3
	MOVEI	T1,45			;OFFSET
	MOVEM	T1,KONTYP
	PUSH	P,P3			;SAVE THE STATUS WORD
	PUSHJ	P,CNIDCD
	TYPEIT	<
	RETRIES:	>
	POP	P,P3		;GET STATUS BACK
	LDB	T1,[POINT 6,P3,35]
	PUSHJ	P,.TDECW
	POPJ	P,0
	;MB%000 ETC--	ROUTINES TO DO MOST OF THE WORK TO LIST
	;CODE 111 ENTRIES, MASSBUS DEVICE ERRORS.
	;DEVICE TYPE WORD IS IN P2 WHEN WE GET HERE
	;CALLED VIA PUSHJ FROM PROCSA RETURNS POPJ SEVERAL
	;PAGES FROM HERE.
	;CHANGED WITH [315] TO SUPPORT RP05&RP06

MDE000:	0
	SIXBIT/RP04/
	SIXBIT/RS04/
	SIXBIT/TU16/
	SIXBIT/TU45/
	SIXBIT/RP05/
	SIXBIT/RP06/

MB%000:	TYPEIT	<
	UNIT TYPE:	>
	MOVE P3,MDEDTP			;GET TYPE BACK
	MOVE	T1,MDE000(P3)		;GET IT IN SIXBIT
	PUSHJ	P,.TSIXN
	;NOW FOR SERIAL #
	MOVEI	T1,WKBUFF+MB%REG+10	;LOCATION FOR RP04
	MOVS	P1,0(T1)	;GET THE S/N
	SKIPN	P1		;ANYTHING THERE?
	POPJ	P,0			;NO-LEAVE NOW
	TYPEIT	<
	UNIT SERIAL #:	>
	HLRZ	T1,P1
	ANDI	T1,170000		;GET MSD
	LSH	T1,-14			;SHOVE IT DOWN
	PUSHJ	P,.TDECW		;OUTPUT IT
	HLRZ	T1,P1
	ANDI	T1,07400		;GET NEXT DIGIT
	LSH	T1,-10
	PUSHJ	P,.TDECW
	HLRZ	T1,P1			;GET NEXT DIGIT
	ANDI	T1,00360		;MASK IT OFF
	LSH	T1,-4
	PUSHJ	P,.TDECW		;OUTPUT IT
	HLRZ	T1,P1			;GET LSD
	ANDI	T1,0017			;STRIP
	PUSHJ	P,.TDECW
	TYPEIT	<.>
	POPJ	P,0			;NOW GO BACK TO PROCSD
	;HERE TO OUTPUT FAILURE LOCATION

MB%001:	MOVE T1,MDEDTP				;GET DEV TYPE BACK
	CAIE	T1,3				;MAGTAPE?
	CAIN	T1,4
	  JRST MB%01C				;YUP
	
;HERE FOR LBN (RP04 OR RS04)
	TYPEIT	<
	LBN:		>
	MOVE 	T1,WKBUFF+MB%LOC		;GET LBN
	PUSHJ	P,.TDECW			;TYPE IN DECIMAL
	TYPEIT	<.  =
	>
	MOVE T1,MDEDTP				;GET TYPE AGAIN
	CAIN	T1,2				;RP04?
	  JRST	MB%01B				;NO-MUST BE RS04
	MOVE	P3,WKBUFF+MB%LOC
	MOVEI	P1,5	;FOR RP04&5
	CAIN	T1,6		;RP06?
	 MOVEI	P1,7		;CHHANGE OFFSET
	CAMGE	P3,.MXBLK(P1)			;[144]1ST UNIT OF STR?
	 JRST	MB%01A				;OK
	SUB	P3,.MXBLK(P1)			;- 1 UNITS WORTH
	JRST	.-3				;AND TRY AGAIN
MB%01A:	TYPEIT	<CYL:   >
	IDIV	P3,.TRBLK(P1)			;GET CYL #
	MOVE	T1,P3
	PUSHJ	P,.ODECW			;SAY IT IN DECIMAL
	MOVE	P3,P4				;REMAINDER
	TYPEIT	<	SURF:   >
	IDIV	P3,.SUBLK(P1)			;SURFACE #
	MOVE	T1,P3
	PUSHJ	P,.ODECW			;AGAIN WITH ".".
	TYPEIT	<	SECT:   >
	MOVE	P3,P4				;REMAINDER
	IMUL	P3,.SECBK(P1)			;X BLOCKS/SECTOR
	MOVE	T1,P3
	PUSHJ	P,.ODECW
	JRST	MB%01D				;GO AROUND MAGTAPE
	;HERE FOR LBN FOR RS04

MB%01B:	MOVE	P3,WKBUFF+MB%LOC		;GET LBN
	CAMGE	P3,.MXBLK+4			;[144]1ST UNIT IN STR?
	 JRST	.+3				;YES-OK
	SUB	P3,.MXBLK+4			;-1 UNITS WORTH
	JRST	.-3				;TRY AGAIN
	TYPEIT	<TRACK:   >
	IDIV	P3,.TRBLK+4			;GET TRK #
	MOVE	T1,P3
	PUSHJ	P,.ODECW			;SAY IT WITH FLOWERS
	MOVE	P3,P4				;REMAINDER
	TYPEIT	<	SECT:   >
	IMUL	P3,.SECBK+4			;GET SECTOR #
	MOVE	T1,P3
	PUSHJ	P,.ODECW
	JRST	MB%01D				;GO AROUND MAGTAPE

	;HERE FOR MAGTAPE FAILURE LOCATION
MB%01C:	TYPEIT	<
	LOCATION:    RECORD  #  >
	HRRZ	T1,WKBUFF+MB%LOC
	PUSHJ	P,.ODECW
	TYPEIT	<    OF FILE #  >
	HLRZ	T1,WKBUFF+MB%LOC
	PUSHJ	P,.ODECW
	
;HERE AFTER DUMPING FAILURE LOCATION - NOW TO DUMP
	;OPERATION ISSUED TO DEVICE
MB%01D:	TYPEIT	<
	OPERATION AT ERROR:	>
	HRLZ	T1,WKBUFF+MB%ICR	;GET ISSUED CONTROL REG.
	MOVE	T2,MDEDTP		;SETUPINDEX
	PUSHJ	P,@MDE011(T2)		; LET ROUTINE DO WORK
	POPJ	P,0			;BACK TO PROCSD FOR A WHILE


MB%004:	TYPEIT	<
	RETRIES PERFORMED:	>
	HRRZ	T1,P2	;MB%FEC HAS RETRIES(?)
	PUSHJ	P,.ODECW
	POPJ	P,0

	;MB%CNI IS IN P2

MB%002:	TYPEIT	<
	ERROR:	>
	MOVEI	T1,[ASCIZ/RECOVERABLE /]	;ASSUME LUCK
	MOVE	T2,WKBUFF+MB%IRS	;GET STATUS WORD
	TLNE	T2,1B20			;HARD ERROR?
	 MOVEI	T1,[ASCIZ/NON-RECOVERABLE /]	;OPPS
	PUSHJ	P,.TSTRG
	MOVE	T1,MASKON	;KONTROLLER TYPE
	MOVEM	T1,KONTYP
	MOVE	P1,P2			;FINISH SETUP
	PUSHJ	P,CNIDCD		;GO DECODE
	TYPEIT	< IN CONTROLLER CONI
		>
	HRLZ	P1,WKBUFF+MB%REG+2	;GET DEVICE'S ERROR REGISTER
	MOVEI	T1,21			;ASSUME RP04,5,OR 6
	MOVE	T2,MDEDTP		;BUT CHECK
	CAIN	T2,3			;FOR TU16 OR
	 MOVEI	T1,27
	CAIN	T2,4		;OR TU45
	 MOVEI	T1,27
	CAIN	T2,2			;OR RS04
	 MOVEI	T1,25
	MOVEM	T1,KONTYP		;FINISH SETUP
	PUSHJ	P,CNIDCD		;GO TRANSLATE
	TYPEIT	< IN DEVICE ERROR REGISTER>
	PUSHJ	P,.TCRLF
	PUSHJ	P,DETCHK
	TYPEIT	<CONTROLLER INFORMATION:
	CONTROLLER:	>
	MOVE	T2,MASKON	;GET CONTROLLER TYPE
	MOVE	T1,[SIXBIT/RH20 #/]	;ASSUME RH20
	CAIE	T2,5			;BETTER CHECK
	 MOVE	T1,[SIXBIT/RH10 #/]
	PUSHJ	P,.TSIXN
	PUSHJ	P,.TSPAC
	MOVE	T1,WKBUFF+MB%CAD		;GET PHY ADDR
	PUSHJ	P,.TOCTW		;DUMP IN OCTAL
	MOVE	T1,MDEDTP		;GET DEVICE TYPE
	CAIL	T1,3			;MAGTAPE?
	 PUSHJ	P,MB%02A		;LIST TM02 #
	;NOW DO CONI'S
	TYPEIT	<
	CONI AT ERROR:	>
	MOVE	T1,MASKON		;GET CONTROLLER TYPE
	MOVEM	T1,KONTYP
	MOVE	T1,WKBUFF+MB%CNI
	MOVE	P1,T1			;FINISH SETUP
	PUSHJ	P,.TXWDW		;IN HALF WORD FORMAT
	TYPEIT	< = >
	PUSHJ	P,CNIDCD	;GO DECODE
	TYPEIT	<
	CONI AT END:	>
	MOVE	T1,WKBUFF+MB%CIF
	MOVE	P1,T1
	PUSHJ	P,.TXWDW
	TYPEIT	< = >
	PUSHJ	P,CNIDCD
	POPJ	P,0			;BACK TO PROCSD

MB%02A:	CAIL	T1,5		;RP05 OR 6?
	 POPJ	P,0
	TYPEIT	<  TM02 #:  >
	HRRZ	T1,WKBUFF+MB%UAD	;GET LOGICAL ADDRESS
	PUSHJ	P,.TOCTW		;LIST IN OCTAL
	POPJ	P,0			;RETURN

	;MB%CS0 IS IN P2
MB%003:	TYPEIT	<
CHANNEL INFORMATION:
	CHAN STATUS WD 0:	>
	MOVE	T1,P2
	PUSHJ	P,.TXWDW
	TYPEIT	<	CW1:  >
	MOVE	T1,WKBUFF+MB%CC1	;1ST CCW
	PUSHJ	P,.TXWDW
	TYPEIT	<  CW2:  >
	MOVE	T1,WKBUFF+MB%CC2	;2ND CCW
	PUSHJ	P,.TXWDW
	TYPEIT	<
	CHN STATUS WD 1:	>
	MOVE	T1,WKBUFF+MB%CS1
	MOVE	P1,T1			;SAVE IT
	PUSHJ	P,.TXWDW
	MOVEI	T1,44			;CORRECT OFFSET
	MOVEM	T1,KONTYP		;FINISH SETUP
	TYPEIT	< = >
	PUSHJ	P,CNIDCD
	TYPEIT	<
	CHN STATUS WD 2:	>
	MOVE	T1,WKBUFF+MB%CS2
	PUSHJ	P,.TXWDW
;SETUP AND CALL ROUTINES TO DUMP 16 DEVICE REGISTERS

	TYPEIT	<
DEVICE REGISTER INFORMATION:
		AT ERROR	AT END		DIFF.		TEXT
>
	MOVE	T1,MDEDTP		;GET UNIT TYPE
	MOVE	P1,[XWD 1,20]		;SETUP P1 FOR MODE 1 AND 20 ITEMS
	CAIE	T1,3				;MAGTAPE?
	CAIN	T1,4
	 HRRI	P1,12		;CHANGE # OF ITEMS
	HRLZI	P2,MASREG			;STARTING ADDR OF TABLE
						;OF SIXBIT REG NAMES
	CAIE	T1,3				;MAGTAPE?
	CAIN	T1,4
	 HRLI	P2,TU6REG		;CHANGE REGISTER NAMES
	HRR	P2,MSCNTL(T1)		;SETUP P2
	MOVE	P3,[XWD MB%REG,MB%REG]	;WHERE TO FIND WORDS.
	PUSHJ	P,HWDUMP			;IF ALL GOES WELL
	;[EDIT 215]
	;NOW LIST DEVICE STATS AT TIME OF ERROR

	TYPEIT	<DEVICE STATISTICS AT TIME OF ERROR:
# OF READS:	>
	MOVE	T1,WKBUFF+MB%RED
	PUSHJ	P,.ODECW
	TYPEIT	<	# OF WRITES:	>
	MOVE	T1,WKBUFF+MB%WRT
	PUSHJ	P,.ODECW
	TYPEIT	<	# OF SEEKS:	>
	MOVE	T1,WKBUFF+MB%SEK
	PUSHJ	P,.ODECW
	TYPEIT	<
# SOFT READ ERRORS:	>
	MOVE	T1,WKBUFF+MB%SRE
	PUSHJ	P,.ODECW
	TYPEIT	<	# SOFT WRITE ERRORS:	>
	MOVE	T1,WKBUFF+MB%SWE
	PUSHJ	P,.ODECW
	TYPEIT	<
# HARD READ ERRORS:	>
	MOVE	T1,WKBUFF+MB%HRE
	PUSHJ	P,.ODECW
	TYPEIT	<	# HARD WRITE ERRORS:	>
	MOVE	T1,WKBUFF+MB%HWE
	PUSHJ	P,.ODECW
	TYPEIT	<
# SOFT POSITIONING ERRORS:	>
	MOVE	T1,WKBUFF+MB%SPE
	PUSHJ	P,.ODECW
	TYPEIT	<	# HARD POSITIONING ERRORS:	>
	MOVE	T1,WKBUFF+MB%HPE
	PUSHJ	P,.ODECW
	TYPEIT	<
# OF MPE:  >
	MOVE	T1,WKBUFF+MB%MPE
	PUSHJ	P,.ODECW
	TYPEIT	<   # OF NXM:  >
	MOVE	T1,MB%NXM
	PUSHJ	P,.ODECW
	TYPEIT	<   # OF OVERRUNS:  >
	MOVE	T1,WKBUFF+MB%OVR
	PUSHJ	P,.ODECW
	;END EDIT 215
	PUSHJ	P,TITLST	;EDIT 116 START ON NEXT PAGE
	POPJ	P,0		;WE'RE DONE!

	;SOME TABLES AND ROUTINES USED WITH MASBUSS ENTRIES
	;FIRST THE TABLE OF SIXBIT REGISTER NAMES
	;CHANGED TO FIT TRAINING'S REQUIREMENTS WITH VER 3C.
MASREG:	SIXBIT/CR(00)/
	SIXBIT/SR(01)/
	SIXBIT/ER(02)/
	SIXBIT/MR(03)/
	SIXBIT/AS(04)/
	SIXBIT/DA(05)/
	SIXBIT/DT(06)/
	SIXBIT/LA(07)/
	SIXBIT/SN(10)/
	SIXBIT/OF(11)/
	SIXBIT/DC(12)/
	SIXBIT/CC(13)/
	SIXBIT/E2(14)/
	SIXBIT/E3(15)/
	SIXBIT/EP(16)/
	SIXBIT/PL(17)/

	;NOW THE CONTROL TABLE ADDRESSES

MSCNTL:	0
	XWD	0,RP04CT
	XWD	0,RS04CT
	XWD	0,TU16CT
	XWD	0,TU16CT
	XWD	0,RP05CT
	XWD	0,RP05CT	;[315]



	;SIXBIT REGISTER NAMES FOR TU16
TU6REG:	SIXBIT/CR(00)/
	SIXBIT/SR(01)/
	SIXBIT/ER(02)/
	SIXBIT/MR(03)/
	SIXBIT/AS(04)/
	SIXBIT/FC(05)/
	SIXBIT/DT(06)/
	SIXBIT/CK(07)/
	SIXBIT/SN(10)/
	SIXBIT/TC(11)/

	;ROUTINES TO TRANSLATE MASSBUS DEVICE REG. AS SPECIAL ROUTINES
	;T1 HAS WORD TO TRANSLATE

MDE011:	0
	XWD	0,RP04CR
	XWD	0,RS04CR
	XWD	0,TU16CR
	XWD	0,TU16CR
	XWD	0,RP04CR
	XWD	0,RP04CR

RS04CR:	HLRZ	P4,T1		;SAVE ERROR WORD
	TRNN	P4,1B24		;AVAIL?
	 JRST	.+3		;NO
	TYPEIT	<DEV.AVAIL.,>
	TRNN	P4,1B35		;GO?
	 JRST	.+3		;NO
	TYPEIT	< GO + >
	ANDI	P4,70		;GET FUNCTION
	LSH	P4,-3		;MOVE IT OVER FOR INDEX
	HRRZ	T1,RS4FUN(P4)	;GET FUNCTION ASCIZ ADDR
	PJRST	.TSTRG		;DUMP IT
RP04CR:	HLRZ	P4,T1	;GET WORD
	TRNN	P4,1B24			;AVAIL?
	 JRST 	.+3			;NO
	TYPEIT	< DEV.AVAIL.,>
	TRNN	P4,1B35			;GO?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P SOME PARTICULAR REGISTERS.
	;CALLED FROM HWDUMP  FIRST TO OUTPUT DESIRED
	;SECTOR/TRACK FOR RP04

RP04BA:	HLRZ	P4,T1		;GET ERROR WORD ALONE

	MOVE	P3,P4
	ANDI	P3,17400	;MASK TO GET TRACK ALONE
	LSH	P3,-^D8		;MOVE IT OVER
	TYPEIT	<D. TRK = >
	MOVE 	T1,P3
	PUSHJ	P,.TOCTW	;PRINT IT
	TYPEIT	<, D.SECT. = >
	ANDI	P4,37		;GET SECTOR
	MOVE 	T1,P4
	PJRST	.TOCTW	;DO IT
	;TO DUMP RP04 OFFSET REG.
RP04MO:	HRRZ	P4,T1
	TYPEIT	<AT END:>
	TRNN	P4,1B20		;SIGN CHANGE?
	 PUSHJ	P,RPMO00	;YUP SAY SO
	TRNE	P4,1B23		;FORMAT BIT ?
	 PUSHJ	P,RPMO01
	TRNE	P4,1B24		;ECI ON?
	 PUSHJ	P,RPMO02
	TRNE	P4,1B25		;HCI?
	 PUSHJ	P,RPMO03
	TYPEIT	< OFFSET = >
	TRNE	P4,1B28		;NEGATIVE DIR.?
	 PUSHJ	P,RPMO04		;YES
	SETZ	P3,		;ZERO COUNTER
	TRNE	P4,1B30		;800?
	 ADDI	P3,^D800
	TRNE	P4,1B31		;400?
	 ADDI	P3,^D400
	TRNE	P4,1B32		;200?
	 ADDI	P3,^D200
	TRNE	P4,1B33		;100?
	 ADDI	P3,^D100
	TRNE	P4,1B34		;50?
	 ADDI	P3,^D50
	TRNE	P4,1B35		;25?
	 ADDI	P3,^D25
	MOVE	T1,P3		;TOTAL IN T1 NOW
	SKIPN	T1		;NO OFFSET?
	 PJRST	RP04M1		;YUP-NONE
	PUSHJ	P,.ODECW	;PRINT WITH A "."
	TYPEIT	< U IN.>
	POPJ	P,0		;GO HOME

RP04M1:	TYPEIT	<NONE>
	POPJ	P,0
RPMO00:	TYPEIT	<SIGN CHANGE OFF,>
	POPJ	P,0
RPMO01:	TYPEIT	<FMT22,>
	POPJ	P,0
RPMO02:	TYPEIT	<ECI,>
	POPJ	P,0
RPMO03:	TYPEIT	<HCI,>
	POPJ	P,0
RPMO04:	TYPEIT	< - >
	POPJ	P,0

	;NOW FOR RP04 DESIRED OR CURRENT CYL

RP04DC:	HLRZ	T1,T1		;GET ERROR ALONE
	ANDI	T1,777		;ONLY CYL BITS WANTED
	MOVE	T2,MDETYP	;[315]GET DEVICE TYPE
	CAIE	T2,6		;RP06?
	 TRZ	T1,10000	;NO-CLEAR EXTRA BIT
	PJRST	.ODECW
	;RS04 DESIRED SECTOR/TRACK ADDRESS
RS04BA:	HLRZ	P4,T1
	MOVE	P3,P4
	ANDI	P3,7700		;TRACK BITS ONLY
	LSH	P3,-6		;MOVE IT OVER
	TYPEIT	<D. TRK = >
	MOVE	T1,P3
	PUSHJ	P,.TOCTW
	TYPEIT	<, D.SECT = >
	ANDI	P4,77		;SECTOR BITS
	MOVE	T1,P4
	PJRST	.TOCTW



	;NOW FOR TU16 REGISTERS

TU16TC:	HLRZ	P4,T1
	TRNN	P4,1B20
	 JRST 	.+3
	TYPEIT	<ACCL,>
	TRNN	P4,1B21
	 JRST	.+3
	TYPEIT	<TCW,>
	TRNN	P4,1B22
	 JRST	.+3
	TYPEIT	< FCS,>
	TRNN	P4,1B23
	 JRST	.+3
	TYPEIT	< EAO/DTE,>
	MOVE	P3,P4
	ANDI	P3,3400		;GET DENSITY
	LSH	P3,-10
	MOVE	T1,TU6DEN(P3)
	PUSHJ	P,.TSTRG
	MOVE	P3,P4
	ANDI	P3,360		;GET FORMAT
	LSH	P3,-4
	MOVE	T1,TU6FOR(P3)
	PUSHJ	P,.TSTRG
	TRNN	P4,1B32
	 JRST	.+3
	TYPEIT	< EVEN PARITY>
	ANDI	P4,7		;GET SLAVE #
	TYPEIT	< SLAVE #>
	MOVE	T1,P4
	PJRST	.TOCTW

TU6DEN:	[ASCIZ/ 200BPI NRZ/]
	[ASCIZ/ 556BPI NRZ/]
	[ASCIZ/ 800BPI NRZ/]
	[ASCIZ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NOTRAN
	XWD	-1,NOTRAN
	XWD	-1,NOTRAN
	XWD	-1,NOTRAN


TU16CT:	XWD	-1,TU16CR
	XWD	26,TU16SR
	XWD	27,TU16ER
	XWD	-1,NOTRAN
	XWD	-1,NOTRAN
	XWD	-1,NOTRAN
	XWD	-1,NOTRAN
	XWD	-1,NOTRAN
	XWD	-1,NOTRAN
	XWD	-1,TU16TC
	XWD	-1,NOTRAN
	XWD	-1,NOTRAN
	XWD	-1,NOTRAN
	XWD	-1,NOTRAN
	XWD	-1,NOTRAN
	XWD	-1,NOTRAN


;TABLE USED FOR BOTH RP05&RP06
RP05CT:	XWD 	-1,RP04CR
	XWD	20,RP04SR
	XWD	21,RP04ER
	XWD	47,RPMRDV
	XWD	-1,NOTRAN
	XWD	-1,RP04BA
	XWD	-1,NOTRAN
	XWD	-1,NOTRAN
	XWD	-1,NOTRAN
	XWD	-1,RP04MO
	XWD	-1,RP04DC
	XWD	-1,RP04DC
	XWD	34,RP05DV
	XWD	35,RP06DV
	XWD	-1,NOTRAN
	XWD	-1,NOTRAN

DEVTYP:0
	0
	SOFTDV
	TM10DV
	RH10DV
	RH20DV
	DX10DV
	TC10DV
	DL10DV
	DL11DV
	KL1ADV
	0
	0
	0
	0
	0
	RP04SR
	RP04ER
	RP04CB
	RP04DA
	RS04SR
	RS04ER
	TU16SR
	TU16ER
	ICPCX1
	DXTAGB
	DXSB03
	DXSB47
	RP05DV
	RP06DV
	FESTDV
	FELPDV
	LPSADV
	LPSBDV
	FECDDV
	CDSTDV
	RHSWDV
	RLD1DV
	FEKLDV
	RPMRDV

	SUBTTL	OUTPUT LISTING RELATED ROUTINES
	;BCKXXX -- SUBROUTINES TO DETERMINE LISTING AND SUMMATION ELIGIBILITY
	;BASED ON BITS IN ENTCHR TABLE
	;CALL	PUSHJ	P,@BITCHK(ERROR CODE)
	;
	;RETURN	CALL+1 TO LIST
	;	JRST	ABORT TO GO TO NEXT ENTRY
	;CHANGED WITH EDIT 211 TO SUPPORT USING ONLY /DEV:SWITCH


BCK101:	MOVE	P1,ERTYPE	
	MOVE	P2,ENTCHR(P1)	;CHARACTERISTICS OF ENTRY
	PUSH	P,P2		;SAVE P2
	TLNE	P2,E.LSUM	;WANT SUMMARY?
	 PUSHJ	P,SUM101		;GO DO IT
	POP	P,P2		;RESTORE P2
	TLNN	F,F.DEV		;EDIT 211-SAID /DEV:?
	 JRST	BC101A		;NO GO AROUND
	MOVE	T1,[SIXBIT/KLCPU/]
	CAME	T1,DEV		;MATCH?
	 JRST	ABORT		;NOPE!
	TLNE	F,F.OSUM	;ANY TYPE SWITCH SPECIFIED?
	 TLO	P2,E.LALL	;NO FORCE LISTING
BC101A:	TLNE	P2,E.LALL	;LIST ALL?
	 POPJ	P,0		;YES
	TLNE	P2,E.LPER	;LIST PERFORMANCE
	 POPJ	P,0		;YES
	JRST	ABORT		;THAT'S ALL TO CHECK
BCK102:	MOVE	P1,ERTYPE	
	MOVE	P2,ENTCHR(P1)	;CHARACTERISTICS OF ENTRY
	PUSH	P,P2		;SAVE P2
	TLNE	P2,E.LSUM	;WANT SUMMARY?
	 PUSHJ	P,SUM102		;GO DO IT
	POP	P,P2		;RESTORE P2
	TLNN	F,F.DEV		;EDIT 211-SAID /DEV:?
	 JRST	BC102A		;NO GO AROUND
	MOVE	T1,[SIXBIT/KLCPU/]
	CAME	T1,DEV		;MATCH?
	 JRST	ABORT		;NOPE!
	TLNE	F,F.OSUM	;ANY TYPE SWITCH SPECIFIED?
	 TLO	P2,E.LALL	;NO FORCE LISTING
BC102A:	TLNE	P2,E.LALL	;LIST ALL?
	 POPJ	P,0		;YES
	TLNE	P2,E.LPER	;LIST PERFORMANCE
	 POPJ	P,0		;YES
	JRST	ABORT		;THAT'S ALL TO CHECK

BCK111:	MOVE	P1,ERTYPE
	MOVE	P4,ENTCHR(P1)		;GET CHAR WORD
	PUSH	P,P4		;SAVE CHARACTERISTICS
	TLNE	P4,E.LSUM		;SUMMARY?
	 PUSHJ	P,SUM111
	TLNN	F,F.TRY		;EDIT 126 SAID /RETRY?
	 JRST	BC111A		;NO
	HRRZ	T1,WKBUFF+MB%FES	;GET # RETRIES
	CAMG	T1,RETRY	;ENTRY VALUE GREATER
	 JRST	ABORT		;NO-DON'T LIST
BC111A:	TLNN	F,F.DEV		;SAID /DEV:?
	 JRST	BK111B			;NO
	SETZ	T2,T2
	MOVE	T1,DEV		;GET SPECIFIED NAME
	CAMN	T1,[SIXBIT/RP04/]
	 MOVEI	T2,1		;SAY RP04
	CAMN	T1,[SIXBIT/RP05/]	;[315]	
	 MOVEI	T2,5		;SAY RP05
	CAMN	T1,[SIXBIT/RP06/]	;[315]
	 MOVEI	T2,6		;SAY RP06
	CAMN	T1,[SIXBIT/TU16/]
	 MOVEI	T2,3		;SAY TU16
	CAMN	T1,[SIXBIT/TU45/]
	 MOVEI	T2,4		;SAY TU16
	CAMN	T2,MDEDTP	;COMPARE AGAINST ENTRY DEVICE TYPE
	 JRST	.+3		;FOUND A MATCH-FORCE LISTING!
	MOVEI	P3,MB%NAM
	PUSHJ	P,DEVCHK
	POP	P,P4		;GET CHARACTERISTICS BACK
	TLNE	F,F.OSUM	;ANY TYPE SWITCH CALLED LIKE /MASALL?
	 TLO	P4,E.LALL	;NO-FORCE LISTING
	PUSH	P,P4		;SAVE CHARACTERISTICS
BK111B:	TRNN	F,F.NDEV	;/NDEV:?
	 JRST	BC111B		;NOPE
	MOVEI	P3,MB%NAM
	PUSHJ	P,NDVCHK##	;GO CHECK
BC111B:	TLNN	F,F.ID			;SAID /ID:?
	 JRST	BC111C
	MOVEI	P3,MB%VID
	PUSHJ	P,IDCHK
BC111C:	POP	P,P4		;GET CHARACTERISTICS BACK
	TLNE	P4,E.LALL		;WANTS ALL?
	 POPJ	P,0			;OK
	TLNN	P4,E.LNXM		;HOW ABOUT NXM
	 JRST	BC111E			;NO-CHECK PARITY
	HRRZ	T1,MASKON	;GET CONTROLLER TYPE
	CAIE	T1,4			;RH10?
	 JRST	BC111D			;NO
	MOVE 	T2,WKBUFF+MB%CNI	;YES-GET CONI WORD
	TLNE	T2,1B35			;NXM ON?
	 POPJ	P,0			;YES;LIST IT
	JRST	BC111E			;NO-CHECK PARITY
BC111D:	MOVE	T2,WKBUFF+MB%CNI	;GET CONI
	TRNE	T2,1B22			;M-BOX ERROR COULD BE NXM?!!
	 POPJ	P,0			;LIST IT
	JRST	BC111E			;NOLUCK CHECK PARITY
BC111E:	TLNN	P4,E.LPAR		;CARE ABOUT PARITY ERRORS?
	 JRST ABORT			;NO THAT'S ALL I COVER
	MOVE	T1,MDEDTP	;GET DEVICE TYPE
	TRNE	T1,2			;RS04?
	JRST	BC111F			;YUP
	TRNE	T1,1			;RP04?
	JRST	BC111H			;YUP
	JRST	BC111G			;MUST BE TU16

BC111F:	HRRZ	T1,WKBUFF+MB%REG+2	;ERROR REG
	TRNN	T1,1B32			;PARITY SET?
	 JRST	BC111J			;NO-CHECK CONTROLLER
	POPJ	P,0			;LIST	IT
BC111G:	HRRZ	T1,WKBUFF+MB%REG+2	;ERROR REG
	TRNN	T1,1B29!1B30!1B32	;THESE ARE POSSIBLE
	 JRST	BC111J			;NO
	POPJ	P,0
BC111H:	HRRZ	T1,WKBUFF+MB%REG+2	;ERROR REG
	TRNE	T1,1B20!1B29!1B32	;CHOICES
	 POPJ	P,0			;ONE SET AT LEAST
	HRRZ	T1,WKBUFF+MB%REG+14	;ERROR REG #2
	TRNE	T1,1B21			;CHOICE
	 POPJ	P,0			;SET-LIST IT
			;OR FALL INTO

	;HERE TO CHECK PARITY ERRORS DET BY THE CONTROLLER
BC111J:	MOVE	T1,MASKON	;KONTROLLER TYPE
	CAIE	T1,4			;RH10?
	 JRST	BC111K			;NO
	MOVE	T1,WKBUFF+MB%CNI
	TDNE	T1,[1B15!1B16!1B18]	;CHOICES
	 POPJ	P,0			;LIST IT
	JRST	ABORT			;FORGET IT
BC111K:	MOVE	T1,WKBUFF+MB%CNI
	TDNE	T1,[1B18!1B22]		;OTHER CHOICES
	 POPJ	P,0			;LIST
	JRST ABORT			;FORGET IT

BCK130:	MOVE	T1,WKBUFF+FE%LTH	;GET # OF 8 BIT BYTES
	LSH	T1,-1		;T1/2 = # OF 11 WORDS
	MOVEM	T1,PAKSIZ
	HRRZ	P1,WKBUFF+FE%COD
	CAIN	P1,200		;RELOADED?
	 PUSHJ	P,KLE200	;ACCOUNT FOR IT AND SETUP
	CAIN	P1,201		;KLERROR FILE PACKET?
	 PUSHJ	P,KLE201	;EXCUSE ME FOR A WHILE
	MOVE	P1,ERTYPE	
	MOVE	P2,ENTCHR(P1)	;CHARACTERISTICS OF ENTRY
	PUSH	P,P2		;SAVE P2
	TLNE	P2,E.LSUM	;WANT SUMMARY?
	 PUSHJ	P,SUM130		;GO DO IT
	POP	P,P2		;RESTORE P2
	TLNN	F,F.DEV		;SAID /DEV:?
	 JRST	BC130A		;NOPE
	HRRZ	T1,WKBUFF+FE%COD	;DEVICE CODE
	CAILE	T1,^D256		;MAX I RECOGNIZE
	 JRST	BC130B		;OPPS
	CAIL	T1,200		;HARDWARE DEVICE?
	 JRST	BC130C		;NOPE
	MOVE	T1,FE$NAM(T1)	;NOW IN SIXBIT
	CAME	T1,DEV
	 JRST	ABORT		;NO MATCH
	TLNE	F,F.OSUM	;ANY TYPE SWITCH CALLED?
	 TLO	P2,E.LALL	;NO-FORCE LISTING
BC130A:	TLNE	P2,E.LALL	;LIST ALL?
	 POPJ	P,0		;YES
	TLNE	P2,E.LPER	;LIST PERFORMANCE
	 POPJ	P,0		;YES
	HRRZ	T2,WKBUFF+FE%COD
	CAIE	T2,200		;RELOAD?
	JRST	ABORT		;NOPE
	MOVE	T1,SWITCH		;GET ADDR OF COMMAND USED
	CAIE	T1,CPUPER	;"/CPUPER"?
	JRST ABORT		;NOPE
	POPJ	P,0		;YUP
BC130B:	WARN	<UNKNOWN DEV TYPE FOUND IN CODE 130 ENTRY-ABORTING ENTRY>
	JRST	ABORT
BC130C:	SUBI	T1,200	;REMOVE OFFSET
	MOVE	T1,FEHNAM(T1)	;A HIGHER NAME
	CAME	T1,DEV		;MATCH?
	 JRST	BC130D		;CHECK FURTHER
	TLNE	F,F.OSUM	;ANY LISTING CALLED FOR?
	 TLO	P2,E.LALL	;NO-FORCE LISTING
	JRST	BC130A		;AND CONTINUE
BC130D:	HRRZ	T2,WKBUFF+FE%COD
	CAIE	T2,201		;KLERR?
	JRST	ABORT		;NOPE
	MOVE	T1,FEHNAM	;GET SIXBIT "KLCPU"
	CAME	T1,DEV	;MATCH
	 JRST	ABORT
	TLNE	F,F.OSUM
	 TLO	P2,E.LALL	;FORCE AS ABOVE
	JRST	BC130A		;AND CONTINUE

;ROUTINES TO WORK WITH KLERROR FILE PACKETS

KLE200:	SKIPE	KLEFL2		;ALREADY PROCESSING FILE?
	 PUSHJ	P,KLEDMP	;WE SHOULDN'T BE!!
	SETOM	KLEFL1		;WATCH FOR NEXT CODE 201
	POPJ	P,0		;BACK TO BCK130

KLE201:	SKIPN	KLEFL2		;ALREADY BUILDING KLEFIL?
	 PUSHJ	P,KL201B	;NO-CHECK FURTHER
	SKIPE	KLEFL1		;1ST PACKET?
	 PUSHJ	P,KLEFCL	;CLEAR WORK AREA & INIT POINTERS
	SETZM	KLEFL1		;DONE THE INIT
	SETOM	KLEFL2		;NOW WE'RE BUILDING THE FILE INTO KLEFIL
	HRRZ	T1,WKBUFF+FE%OFF
	ADDI	T1,WKBUFF	;CORRECTED POINTER
	LDB	T2,[POINT 16,0(T1),15]	;GET STD STATUS BYTE
	TRNE	T2,1B30		;EOF?? IE LAST PACKET??
	 SETOM	KLEFL3		;YES-DO LISTING IF REQ'D
;NOW ADD THIS PACKET TO KLEFIL
	MOVEI	P3,1		;INIT W ORD COUNTER

	MOVE	P1,WKBUFF+FE%OFF	;GET POINTER WORD
	ADDI	P1,WKBUFF	;CORRECTED
	SKIPE	KLEFL4		;SHOULD WE SKIP SOME WORDS?
	 PUSHJ	P,SKPKLE	;YES-GO DO IT
	MOVE	P2,KLEPNT	;WHERE TO PUT WORDS
	SKIPE	KLEFL3		;WORK ON THIS PACKET AT ALL?
	 JRST	PAKDON		;NO
	LDB	T1,[POINT 16,0(P1),31]	;FORGET 1ST BYTE
	MOVEM	T1,0(P2)	;STORE IT AWAY
	AOBJN	P2,.+2		;UPDATE STORE POINTER
	 PUSHJ	P,KLEDON		;FILE IS FINISHED
	AOS	P3
	CAMN	P3,PAKSIZ
	 JRST	PAKDON
	AOBJN	P1,.+2		;UPDATE FETCH POINTER
	 JRST	PAKDON		;PACKET IS FINISHED

KL201A:	LDB	T1,[POINT 16,0(P1),15]	;GET LEFT BYTE
	MOVEM	T1,0(P2)		;PUT IT AWAY
	AOBJN	P2,.+2		;UPDATE STORE POINTER
	 PUSHJ	P,KLEDON		;FILE IS FINISHED
	AOS	P3
	CAMN	P3,PAKSIZ
	 JRST	PAKDON
	LDB	T1,[POINT 16,0(P1),31]	;GET RIGHT BYTE
	MOVEM	T1,0(P2)	;AWAY
	AOBJN	P2,.+2		;UPDATE STORE POINTER
	 PUSHJ	P,KLEDON		;FILE IS FINISHED
	AOS	P3
	CAMN	P3,PAKSIZ
	 JRST	PAKDON
	AOBJN	P1,KL201A	;GET NEXT PAIR

PAKDON:	MOVEM	P2,KLEPNT	;STORE POINTER AWAY
	SKIPN	KLEFL3		;WAS THIS LAST PACKET?
	JRST	ABORT	;[231]KLEFIL IS NOT COMPLETE-DO NOTHING ELSE WITH
		;THIS ENTRY AND GET NEXT ENTRY.
	SETZM	KLEFL3		;CLEAR THE FINISHED FLAG &
	SETZM	KLEFL2		;CLEAR THE BUILDING FLAG
	 POPJ	P,0	;KLEFIL IS COMPLETE-BCK130 ROUTINES WILL
		;DETERMINE IF IT SHOULD BE LISTED AND DO SUMMARY.
		;LISTING WILL BE DONE THROUGH PROCSD ROUTINES.


KL201B:	SKIPE	KLEFL1	;1ST PACKET ALREADY SET?
	 POPJ	P,0	;YUP-ALL IS WELL
	WARN	<UNEXPECTED CODE 130-201 FOUND,ASSUMING START OF FILE>
	TYPEIT	<
$$$$$$$  >
	TYPEIT	<UNEXPECTED CODE 130-201 FOUND,ASSUMING START OF FILE>
	PUSHJ	P,.TCRLF	;CONTINUE ON NEXT LINE
	SETOM	KLEFL1	;FORCE START OF FILE
	POPJ	P,0


	;KLEFCL--ROUTINE TO CLEAR BUFFER AREA AND INIT POINTERS
KLEFCL:	SETZM	KLEFL4
	SETZM	KLEFL5		;CLEAR SOME FLAGS
	SETZM	KLEFIL		;CLEAR START
	MOVE	T1,[XWD KLE1FL,KLE1FL+1]
	BLT	T1,KLEEND	;CLEAR IT ALL INCL KLE1FL AREA
	HRRZ	T2,WKBUFF+FE%OFF	;GET OFFSET
	ADDI	T2,WKBUFF		;CORRECTED
	LDB	T3,[POINT 16,1(T2),15]	;THAT GETS FILE LENGTH!?
	IDIVI	T3,2		;[230]CONVERT TO WORDS FROM BYTES
	SKIPN	T3		;BUT IF ZERO
	 MOVEI	T3,KLESIZ	;USE DEFAULT
	CAILE	T3,KLESIZ	;ALSO IF GREATER
	 MOVEI	T3,KLESIZ	;USE DEFAULT
	MOVN	T1,T3		;-WC
	MOVS	T1,T1		;TO LH
	HRRI	T1,KLEFIL	;START THERE 
	MOVEM	T1,KLEPNT	;STORE IT AWAY
	POPJ	P,0


;HERE WHEN WC FOR KLEFIL IS EXHAUSTED
KLEDON:	SKIPE	KLEFL5		;DOING 2ND HALF ALREADY?
	 JRST	KLEDN1		;YES
	HRRZ	T1,P2		;LAST ADDR USED
	SUBI	T1,KLEFIL	;ADJUSTED START ADDR
	IDIVI	T1,200		;# BLOCKS USED
	MOVEI	T1,200		;INTERESTED IN REMAINDER ONLY
	SUB	T1,T2		;T1 HOLDS # OF WDS TO SKIP TO GET
			;TO START OF NEXT BLOCK IN PDP-11 FORMAT
	CAIN	T1,200		;BUT IF ZERO
	 JRST	KLEDN2
KLEDN4:	HLRE	T2,P1		;P1HOLDS PACKET PNTR
	MOVMS	T2,T2		;# LEFT IN THIS PACKET
	CAMGE	T1,T2		;MORE THAN IN THIS PACKET?
	 JRST	KLEDN3		;NO
	SUB	T1,T2		;YES,T1 GETS REMAINDER TO SKIP IN
			;NEXT PACKET
	SKIPE	T1		;NOW = 0?
	 SETOM	KLEFL4		;REMEMBER TO SKIP
	MOVEM	T1,KLESKP	;SAVE THE NUMBER
	SETOM	KLEFL5		;NOW DOING 2ND HALF
	HRLZI	T1,KLESIZ	;MAX LENGTH
	MOVNS	T1,T1
	HRRI	T1,KLE1FL	;SECOND AREA
	MOVEM	T1,KLEPNT	;FOR FUTURE USE
	JRST	ABORT		;NO MORE FOR THIS ENTRY

;HERE WHEN 2ND RECORD WC EXPIRES--SHOULDN'T HAPPEN BUT...
KLEDN1:	SUBI	P2,1		;ADJUST POINTER FOR THIS WORD
	MOVEM	P2,KLEPNT	;AND STORE IT
	JRST ABORT	;WASTE REST OF ENTRIES UNTIL EOF IS SEEN IN
		;PACKET.  POINTER IS NOT STORED IN KLEPNT SO ALL
		;SUCCEEDING WORDS WILL BE OVERWRITTEN AT END OF
		;KLE1FL.
;HERE TO SKIP &STAY IN CURRENT ENTRY.
;T1 HAS # TO SKIP
KLEDN3:	IDIVI	T1,2	;2 WDS PER KL WORD
	ADD	P1,T1	;RH IS FIXED
	HLRE	T2,P1	;GET -WC
	ADD	T2,T1	;FIX IT
	HRL	P1,T2	;RETURN IT
	LSH	T1,1
	ADD	P3,T1		;UPDATE BYTE CNT
	;AND FALL INTO

;HERE IF 0 WDS TO SKIP BETWEEN RECORDS--SHOULD BE NORMAL CASE(I HOPE)
KLEDN2:	SETOM	KLEFL5		;WORK ON 2ND HALF
	HRLZI	T1,KLESIZ		;MAX
	MOVNS	T1,T1
	HRRI	T1,KLE1FL		;WHERE TO PUT WORDS
	MOVEM	T1,KLEPNT		;FOR FUTURE USE
	MOVE	P2,T1			;SETUP NEW PNTR
;	POPJ	P,0			;BACK TO OUR CALLER
	JRST	ABORT		;THIS SEEMS TO BE THE CORRECT THING
			;TO DO,IF WE WASTE THE REST OF THIS ENTRY
			;THE SECOND RECORD APPEARS TO BE BACK IN
			;SYNC FOR VERSION 1B OF THE MONITOR.

;HERE TO SKIP WORDS AT THE START OF PACKET PROCESSING
SKPKLE:	MOVE	T1,KLESKP		;# TO SKIP
	JRST	KLEDN4		;GET SOME CODE CHEAP!!


;ROUTINE TO LIST PARTIAL CONTENTS OF KLEFIL CALLED WHEN ANOTHER
;START OF FILE(CODE 201) IS DETECTED OR ERROR FILE INCONSISTENCY

KLEDMP:	PUSHJ	P,TITLST	;FRESH PAGE
	SETZM	KLEFL2
	SETZM	KLEFL3		;CLEAR FLAGS
	WARN	<DUMPING PARTIAL CONTENTS OF KLERROR FILE IN OCTAL>
	TYPEIT	<

*** DUMPING PARTIAL CONTENTS OF KLERROR FILE IN OCTAL ***
>
	SETZ	P3,
	TYPEIT	<	# OF KLERROR BYTES DUMPED:	>
	HRRZ	T1,KLEPNT	;LAST ADDR USED
	SUBI	T1,KLEFIL	;1ST USED
	ADDI	T1,1		;ADJUST FOR 1ST
	MOVMS	T1,T1		;ABSOLUTE MAGNITUDE
	MOVEI	T2,KLESIZ	;SETUP A VALUE
	IMULI	T2,2
	CAMLE	T1,T2	;TOO BIG??
	 MOVE	T1,T2	;CHANGE TO MAX
	MOVE	P4,T1		;SAVE IT
	PUSHJ	P,.ODECW	;DUMP IN DECIMAL
	TYPEIT	<
*** DUMPING 1ST RECORD ***
>
	PUSHJ	P,.TCRLF
	PUSHJ	P,.TCRLF
;SAME CODE AS IN STBUFA!
KLEDMA:	MOVEI	P1,8	;WORDS PER LINE
KLEDMB:	PUSHJ	P,SPACE3
	MOVEI	P2,^D12	;CHARACTERS PER WORD
	PUSHJ	P,KLEDMX	;GET A WORD INTO T1
	MOVE	T2,T1
KLEDMC:	MOVEI	T1,0
	ROTC	T1,3		;GET 3 BITS
	ADDI	T1,60		;CONVERT TO ASCIZ
	PUSHJ	P,.TCHAR
	SOJG	P2,KLEDMC	;NEXT 3 BITS
	MOVE	P2,P4		;ANY MORE WORDS?
	CAIN	P2,1
	 POPJ	P,0
	SOJG	P1,KLEDMB	;FINISH THE LINE
	PUSHJ	P,.TCRLF	;NEXT LINE
	JRST 	KLEDMA		;START AGAIN
KLEDMX:	SOSGE	P4
	 JRST	KLEDMZ		;BUMP AND RETURN
	AOJ	P3,
	CAILE	P3,KLESIZ	;DONE 1ST RECORD?
	 PUSHJ	P,KLEDMY	;ADJUST FOR 2ND
	MOVE	T1,KLEFIL(P3)	;GET NEXT WORD
	POPJ	P,0

KLEDMY:	MOVE	T1,[XWD KLE1FL,KLEFIL]	;DON'T BOTHER CLEARING
	BLT	T1,LOWEND-1
	TYPEIT	<
*** DUMPING 2ND RECORD ***

>
	POPJ	P,0	;NOW CONTINUE

KLEDMZ:	POP	P,T1	;DUMMY TO GET RID OF OUR CALLER
	POPJ	P,0	;NOW BACK TO KLEDMP'S CALLER
BCK160:	MOVE	P1,ERTYPE	
	MOVE	P2,ENTCHR(P1)	;CHARACTERISTICS OF ENTRY
	PUSH	P,P2		;SAVE P2
	TLNE	P2,E.LSUM	;WANT SUMMARY?
	 PUSHJ	P,SUM160		;GO DO IT
	POP	P,P2		;RESTORE P2
	TLNN	F,F.DEV		;EDIT 211-SAID /DEV:?
	 JRST	BC160A		;NO GO AROUND
	MOVE	T1,[SIXBIT/CPU/]
	CAME	T1,DEV		;MATCH?
	 JRST	ABORT		;NOPE!
	TLNE	F,F.OSUM	;ANY TYPE SWITCH SPECIFIED?
	 TLO	P2,E.LALL	;NO FORCE LISTING
BC160A:	TLNE	P2,E.LALL	;LIST ALL?
	 POPJ	P,0		;YES
	TLNE	P2,E.LPER	;LIST PERFORMANCE
	 POPJ	P,0		;YES
	JRST	ABORT		;THAT'S ALL TO CHECK

BCK161:	MOVE	P1,ERTYPE	
	MOVE	P2,ENTCHR(P1)	;CHARACTERISTICS OF ENTRY
	PUSH	P,P2		;SAVE P2
	TLNE	P2,E.LSUM	;WANT SUMMARY?
	 PUSHJ	P,SUM161		;GO DO IT
	POP	P,P2		;RESTORE P2
	TLNN	F,F.DEV		;EDIT 211-SAID /DEV:?
	 JRST	BC161A		;NO GO AROUND
	MOVE	T1,[SIXBIT/KLCPU/]
	CAME	T1,DEV		;MATCH?
	 JRST	ABORT		;NOPE!
	TLNE	F,F.OSUM	;ANY TYPE SWITCH SPECIFIED?
	 TLO	P2,E.LALL	;NO FORCE LISTING
BC161A:	TLNE	P2,E.LALL	;LIST ALL?
	 POPJ	P,0		;YES
	TLNE	P2,E.LPER	;LIST PERFORMANCE
	 POPJ	P,0		;YES
	JRST	ABORT		;THAT'S ALL TO CHECK

BCK131:	MOVE	P1,ERTYPE	
	MOVE	P2,ENTCHR(P1)	;CHARACTERISTICS OF ENTRY
	PUSH	P,P2		;SAVE P2
	TLNE	P2,E.LSUM	;WANT SUMMARY?
	 PUSHJ	P,SUM131		;GO DO IT
	POP	P,P2		;RESTORE P2
	TLNN	F,F.DEV		;EDIT 211-SAID /DEV:?
	 JRST	BC131A		;NO GO AROUND
	MOVE	T1,[SIXBIT/11CPU/]
	CAME	T1,DEV		;MATCH?
	 JRST	ABORT		;NOPE!
	TLNE	F,F.OSUM	;ANY TYPE SWITCH SPECIFIED?
	 TLO	P2,E.LALL	;NO FORCE LISTING
BC131A:	TLNE	P2,E.LALL	;LIST ALL?
	 POPJ	P,0		;YES
	TLNE	P2,E.LPER	;LIST PERFORMANCE
	 POPJ	P,0		;YES
	JRST	ABORT		;THAT'S ALL TO CHECK



SUM131:
SUM161:
SUM101:
SUM160:	POPJ	P,0

SUM102:	MOVE	T2,WKBUFF+BG%NAM	;
	MOVEI	T1,BG%WHY		;INIT POINTER
BG%FND:	HLRZ	T3,(T1)			;GET POINTER TO NEXT
	JUMPE	T3,BG%NEW		;EXIT IF NO REASON
	MOVEI	T1,(T3)			;SETUP POINTER
	CAME	T2,1(T1)		;IS THIS THE ENTRY?
	 JRST	BG%FND			;NO,GET NEXT
	AOS	T3,(T1)			;BUMP
	TRNN	T3,-1			;BUT
	  SOS	(T1)			;NOT TOO MUCH(OVERFLOW)
	POPJ	P,0
	
BG%NEW:	AOS	T3,.JBFF##		;NEXT POSITION
	AOS	.JBFF##			;CLEAN HOUSE
	CAMG	T3,.JBREL##		;IS THERE ROOM?
	 JRST	BG%INS			;YES INSERT REASON
	MOVE	T4,T3			;DIFFERENT AC
	CORE	T4,			;GET MORE CORE
	 FATAL	<SYRNCA: NO CORE AVAILABLE>	;OPPS

BG%INS:	MOVEM	T2,(T3)			;SAVE REASON
	ADDI	T3,-1			;INITIAL COUNT AND ADDRESS
	HLRZM	T3,(T3)			;SET COUNT TO ONE
	HRLM	T3,(T1)		;POINT TO THIS BLOCK
	POPJ	P,0		;AND LEAVE


SUM111:	MOVE	T1,MASKON		;TYPE CONTROLLER STORED BY MDECHR
	MOVEM	T1,KONTYP
	MOVE	P2,WKBUFF+MB%IRS		;GET STATUS WORD
	TLZ	P2,1B19			;START CLEAN
	TLNE	P2,1B20			;HARD ERROR?
	 TLO	P2,1B19			;SAY SO
	MOVEI	P3,MB%CNI		;CONI WORD OFFSET
	MOVE	T1,MASIND		;INDEX TO DEVICE
	MOVEM	T1,DVINDX		;FINISH SETUP
	PUSHJ	P,CNISU2		;LET IT WORK
	;HERE TO START SUMMING DEVICE ERROR REGISTERS

	HRRZ	T1,MDEDTP	;GET DEVICE TYPE
	CAIN	T1,2			;RS04?
	PJRST	S111A			;YES
	CAIN	T1,1			;RP04
	PJRST	S111C			;YUP
	PJRST	S111B			;MUST BE TU16 (BETTER BE OR...)

	;HERE FOR RS04
S111A:	MOVE	P1,MASIND		;GET OFFSET FOR THIS DEV
	MOVS	P2,MASDS2(P1)		;COUNTER ADDRESSES
	HRLZ	P1,WKBUFF+MB%REG+2	;WORD TO SUMMATE ERROR REG
	MOVEI	T1,25			;OFFSET FOR RS04 ERROR REG
	MOVEM	T1,KONTYP
	PJRST	MASSVM

	;HERE DO TU16
S111B:	MOVE	P1,MASIND		;GET OFFSET FOR THIS DEV
	MOVS	P2,MASDS2(P1)		;COUNTER ADDRESSES
	HRLZ	P1,WKBUFF+MB%REG+2	;WORD TO SUMMATE
	MOVEI	T1,27			;OFFSET FOR TU16 ERROR REG
	MOVEM	T1,KONTYP
	PJRST	MASSVM


	;HERE DO RP04'S
S111C:	MOVE	P1,MASIND		;GET OFFSET FOR THIS DEV
	MOVS	P2,MASDS2(P1)		;COUNTER ADDRESSES
	HRLZ	P1,WKBUFF+MB%REG+2	;WORD TO SUMMATE
	MOVEI	T1,21			;OFFSET FOR RP04 ERROR REG
	MOVEM	T1,KONTYP
	PUSHJ	P,MASSVM
	HLRZ	T1,P2
	ADDI	T1,NURP02		;INCREASE TO POINT AT 2ND
	HRL	P2,T1		;PUT IT BACK
	HRRZ	T1,P2			;RH
	ADDI	T1,NURP02
	HRR	P2,T1
	AOS	KONTYP			;KONTYP=22
	HRLZ	P1,WKBUFF+MB%REG+14	;2ND WORD
	PUSHJ	P,MASSVM
	HLRZ	T1,P2		;INCREASE TO # 3
	ADDI	T1,NURP10
	HRL	P2,T1		;PUT IT BACK
	HRRZ	T1,P2
	ADDI	T1,NURP10
	HRR	P2,T1
	AOS	KONTYP		;=23
	HRLZ	P1,WKBUFF+MB%REG+15	;3RD WORD
	PUSHJ	P,MASSVM
	 POPJ	P,0	;

SUM130:	HRRZ	T2,WKBUFF+FE%COD	;GET DEVICE CODE
	CAILE	T2,^D256		;IN RANGE?
	 JRST	BC130B			;NOPE
	CAIL	T2,200			;HARDWARE DEVICE
	 JRST	SUM13A
	CAILE	T2,11			;CURRENT LIMIT
	 MOVEI	T2,11			;SAY UNKNOWN
	AOS	NUM130(T2)		;BUMP COUNTER
	POPJ	P,0			;AND GO BACK
	
SUM13A:	SUBI	T2,200		;REMOVE OFFSET
	AOS	NUH130(T2)	;BUMP & GO
	POPJ	P,0

	;SUMUPD -- SUBROUTINE TO AUTOMATICALLY UPDATE ALL PERMANENT
	;SUMMARY COUNTERS PRIOR TO SUMMARY LISTING
	;A DUMMY MACRO DUMFLG IS USED TO GENERATE
	;THE NECESSARY CODE AS FOLLOWS
	;SKIPE	T1,XXXTMP	;PICKUP TEMP COUNTER
	;ADDM	T1,XXXPER	;INCREMENT PERM COUNTER
	;DO NEXT COUNTER SAME.......
	;modified by edit #110
	DEFINE	TBLFLG(A)<
	setz	t1,
	exch	t1,a'tmp
	ADDM	T1,A'PER
>

	;NOW THE ACTUAL CODE GENERATION

;	XLIST
SUMUPD:	DUMFLG
	LIST


;NOW GENERATE THE SOFTWARE SUMMARY COUNTERS UPDATE
;also modified by edit #110
	DEFINE	DUMDV(A)<
	ZZ==0
REPEAT NUMSFB,<
	setz	t1,
	exch	t1,a'st+zz
	ADDM	T1,A'SP+ZZ
	ZZ==ZZ+1
>>
;	XLIST
;	DUMDP
;	DUMFH
;	DUMRP
	LIST
	XLIST
	DUMDP
	DUMFH
	DUMRP
	LIST

	POPJ	P,		;RETURN
	SUBTTL	STORAGE LOCATIONS
DUMDAY:	121165		;DUMMY NBS DAY FOR USE BY SCAN
KONMSK:	0			;MASK FOR ERROR BITS IN RC10 TYPE DEVICE
	0			;MASK FOR ERROR BIT IN A RP10 TYPE DEVICE
	SFMASK			;SOFTWARE DETECTED ERROR MASK
	TMMASK
	RHMASK
	RH20SK
	DXMASK
	TCMASK
	DL1MSK
	DL2MSK
	KLAMSK
	0
	0
	0
	0
	0
	P4SRSK
	P4ERSK
	P4CBSK
	P4DASK
	S4SRSK
	S4ERSK
	T6SRSK
	T6ERSK
	ICPCSK
	DXTBSK
	SB03SK
	SB47SK
	RP05SK
	RP06SK
	FESTSK
	FELPSK
	LPSASK
	LPSBSK
	FECDSK
	CDSTSK
	RHSWSK
	RLD1SK
	FEKLSK
	RPMRSK

MINERB:	0
	0
	MINSFB
	MINTMB
	MINRHB
	MINRH2
	MINDXB
	MINTCB
	MINDL1
	MINDL2
	MINKLA
	0
	0
	0
	0
	0
	MIRP01
	MIRP02
	MIRP10
	MIRP15
	MIRS01
	MIRS02
	MIT601
	MIT602
	MIICPC
	MIDXTB
	MISB03
	MISB47
	MIRP05
	MIRP06
	MIFEST
	MIFELP
	MILPSA
	MILPSB
	MIFECD
	MICDST
	MIRHSW
	MIRLD1
	MIFEKL
	MIRPMR

ERINDX:	0
	0
	0	;SFINDX
	0	;TMINDX
	RHINDX
	RH20DX
	0	;DXINDX
	0	;TCINDX
	0	;DL1IND
	0	;DL2IND
	KLAIND
	0	;0
	0	;0
	0	;0
	0	;0
	0	;0
	RP01DX
	RP02DX
	RP10DX
	RP15DX
	RS01DX
	RS02DX
	T601DX
	T602DX
	0	;ICPCDX
	0	;DXTBDX
	0	;SB03DX
	0	;SB47DX
	RP05DX
	RP06DX
	FESTDX
	FELPDX
	LPSADX
	LPSBDX
	FECDDX
	CDSTDX
	RHSWDX
	RLD1DX
	FEKLDX
	RPMRDX


IDVFLT:	SIXBIT/SYS/		;DEFAULT FILE SPECIFICATIONS
IFLFLT:	SIXBIT/ERROR/
IEXFLT:	SIXBIT/SYS/
ODVFLT:	SIXBIT/DSK/
OFLFLT:	SIXBIT/ERROR/
OEXFLT:	SIXBIT/LST/

PDLPNT:	IOWD	LPDL,PDLST
	SUBTTL	DUMMY MACRO EXPANSION AREA


	;THE FOLLOWING MACRO CODE UTILIZES THE PRINCIPLE OF THE DUMMY
	;MACRO USED EARLIER AND REDEFINES TBLENT TO GENERATE VAIOUS
	;NECESSARY DISPATCH TABLES

	;MACRO TO CREATE A TABLE CONTAINING OFFSET INTO OTHER TABLES
	;WHICH WERE PREVIOUSLY INDEXED BY ERROR TYPE(VER 3 & EARLIER). ALLOWS
	;HOLES TO BE IN SEQUENCE OF ERROR TYPES WHICH ARE USED.

	;THIS FIRST TABLE CONTAINS ALL THE ERROR  TYPES
	;KNOWN TO ALL SYSERR PARTS. THE SECOND IS THE TABLE
	;OF TYPES PROCESSED BY THE SEGMENT.
	;EDIT #120.
	SALL
	DEFINE	TBLENT(A,B,C,D,E)<
	XWD  0,A
	>

ALLTBL:	DUMENT

	ALLLTH=<.-1>-ALLTBL+1		;LENGTH OF ERROR INDEX TABLE

	DEFINE	TBLENT(A,B,C,D,E)<
	IFIDN<D><PROCSD><
	XWD  0,A
	>>

ERRTBL:	0		;FIRST FOUND MUST NOT BE 0
	DUMENT

	ERRLTH=<.-1>-ERRTBL+1		;LENGTH OF ERROR INDEX TABLE


	;THE ENTRY PROCESSING TABLE
	;THIS TABLE MUST BE INDEXED BY THE CONTENTS OF ERTYPE

	DEFINE	TBLENT(A,B,C,D,E)<
	IFIDN<D><PROCSD><
	XWD	C,D
	TYPMAX==A>
	IFDIF<D><PROCSD><
	XWD	0,D
	TYPMAX==A>
	>
PCSTBL:	DUMENT


	;GENERATE THE VARIOUS ASCIZ MESSAGES TO BE USED FOR HEADER
	;ENTRY TYPE IDENTIFICATION
	;FORMAT WILL BE MESS(#) WHERE MESS IS THE ENTRY TYPE
	;DESCRIPTION AND # IS THE ERROR TYPE

	DEFINE	TBLENT(A,B,C,D,E)<
	IFIDN<D><PROCSD><
	[ASCIZ/B/]
	>>


	;GENERATE THE TEXT


TYPMES:	0
	DUMENT
	LIST

	;END OF ENTRY DESCRIPTOR GENERATOR


	;GENERATE THE DISPATCH TABLE TO ENTRY SUMMATION AND BIT CHECK ROUTINES
	;ALL WILL RETRN VIA POPJ	P,
	;TABLE IS INDEXED BY ERROR TYPE CODE

	DEFINE	TBLENT(A,B,C,D,E)<
	IFIDN<D><PROCSD><
	IFDIF<B><UNKNOWN TYPE>,<	XWD	0,BCK'A>
	IFIDN<B><UNKNOWN TYPE>,<	XWD	0,[POPJ	P,]>
	>>
	;GENERATE THE TABLE

BITCHK:	0
	DUMENT


	;GENERATE THE TABLE OF LINE COUNTS FOR OUTPUT LISTING

	DEFINE	TBLENT(A,B,C,D,E)<
	IFIDN<D><PROCSD><
	XWD	0,E
	>>

	RADIX	10

LINE:	0
	DUMENT

	RADIX	8

	;GENERATE THE VARIOUS ENTRY CONTROL TABLES USING THE MACRO TBLWRD
	;TO GENERATE TABLES

	DEFINE	TBLWRD(A,B,C,D,E,F)<
	IFDIF<D><SPECL>,<	BYTE	(6)B,C,D(18)T'A'E>
	IFIDN<D><SPECL>,<	BYTE	(6)B,C,D(18)F>

>
	RADIX	10		;*********NOTE WELL***********

.CT101:	DUM101
	Z
.CT102:	DUM102
	Z
.CT111:	DUM111
	Z
.CT130:	DUM130
	Z
.CT131:	DUM131
	Z
.CT160:	DUM160
	Z
.CT161:	DUM161
	Z

	RADIX	8

	;END OF ENTRY TABLE GENERATION
	;GENERATE THE NECESSARY ASCIZ TEXT FOR NON-SPECIAL ROUTINES

	DEFINE	TBLWRD(A,B,C,D,E,F)<
	IFDIF	<D><SPECL>,<
T'A'E:	ASCIZ/
F/
>>


	;WHAT IS XLISTED IS THE DUMALL CALL AND FOLOWING CODE.
	XLIST
	DUMALL
	LIST




	;END OF ASCIZ TEXT MACRO EXPANSION
	;SWITCH TABLES
	;THE FOLLOWING TABLES WILL BE GENERATED VIA THE DUMMY MACRO
	;DUMCH1
	;THE FIRST IS A DISPATCH TABLE TO BYTES REPRESENTING BITS TO SET
	;IN THE ENTCHR TABLE
	;NEXT IS THE ACTUAL BYTES THEMSELVES

	;TABLE FOR DISPATCH TO THE BYTE OPERANDS

	DEFINE	TBLCH1(A,B,C,D,E,F,G)<
	XWD	0,BYT'G
>

	;MAKE DISPATCH TABLE

BYTDSP:	DUMCH1
	;NOW THE BYTES THEMSELVES


	DEFINE	TBLCH1(A,B,C,D,E,F,G)<
BYT'G:	BYTE (6) B,77,C,77,D,77,E,77,F,77
>


	DUMCH1



	;SWITCH MACRO EXPANSION NEXT


	;DEFINE THE SWITCHES WE RECOGNIZE

	DEFINE	TBLCH1(A,B,C,D,E,F,G)<
	SS	(A,A,0)
>
	DEFINE	TBLCH2(A,B,C)<
	SP	(A,A,B,C)
>

	;CALL A MACRO TO SETUP DEFAULTS

	DEFVAL

	;NOW MAKE SWTCHS MACRO FOR USE WITH DOSCAN LATER

	DEFINE	SWTCHS<
	DUMCH1
	DUMCH2
>

	DOSCAN(SWTAB)


	SALL
	;GENERATE THE CONI BIT TEXT AND ADDRESS DISPATCHER
	RADIX	10		;****** NOTE WELL *****


	DEFINE	TBLDEV(A,B)<
	[ASCIZ\B',\]
>

	SOFTDV:	DUMSF1


	DEFINE	TBLDEV(A,B)<
	[ASCIZ\B',\]
>
	TM10DV:	DUMTM1
	DEFINE	TBLDEV(A,B)<
	[ASCIZ\B',\]
>
	RH10DV:	DUMRH1

	DEFINE	TBLDEV(A,B)<
	[ASCIZ\B',\]
>
	RP04SR:	DURP01
	RP04ER:	DURP02
	RP04CB:	DURP10
	RP04DA:	DURP15
	RS04SR:	DURS01
	RS04ER:	DURS02
	TU16SR:	DUT601
	TU16ER:	DUT602
	ICPCX1:	DUICPC
	DX10DV:	DUMDX1
	DXTAGB:	DUDXTB
	DXSB03:	DUSB03
	DXSB47:	DUSB47
	TC10DV:	DUMTC1
	DL10DV:	DUMDL1
	DL11DV:	DUMDL2
	KL1ADV:	DUMKLA
FESTDV:	DUFEST
FELPDV:	DUFELP
LPSADV:	DULPSA
LPSBDV:	DULPSB
FECDDV:	DUFECD
CDSTDV:	DUCDST
RH20DV:	DUMRH2
RHSWDV:	DURHSW
RLD1DV:	DURLD1
FEKLDV:	DUFEKL
RP05DV:	DURP05
RP06DV:		DURP06
RPMRDV:	DURPMR

	;NOW GENERATE THE ERROR BIT VS INDEX BIT TABLES
	;USING THE TBLDEV MACRO

	DEFINE	TBLDEV(A,B)<
	ZZP==.
	RELOC	KLAIND+A-MINKLA
	ZZ
	ZZ==ZZ+1
	RELOC	ZZP
	>
KLAIND:	REPEAT	36-MINKLA,<0>
	ZZ==0
	DUMKLA


	DEFINE	TBLDEV(A,B)<
	ZZP==.
	RELOC	FESTDX+A-MIFEST
	ZZ
	ZZ==ZZ+1
	RELOC	ZZP
	>
FESTDX:	REPEAT	36-MIFEST,<0>
	ZZ==0
	DUFEST

	DEFINE	TBLDEV(A,B)<
	ZZP==.
	RELOC	RLD1DX+A-MIRLD1
	ZZ
	ZZ==ZZ+1
	RELOC	ZZP
	>
R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SW,<0>
	LIST
	ZZ==0
	DURHSW
	DEFINE TBLDEV(A,B)<
	ZZP==.
	RELOC	RH20DX+A-MINRH2
	ZZ
	ZZ==ZZ+1
	RELOC	ZZP
>
;	XLIST
RH20DX:	REPEAT	36-MINRH2,<0>
	LIST
	ZZ==0
	DUMRH2
	DEFINE TBLDEV(A,B)<
	ZZP==.
	RELOC	RHINDX+A-MINRHB
	ZZ
	ZZ==ZZ+1
	RELOC	ZZP
>
;	XLIST
RHINDX:	REPEAT	36-MINRHB,<0>
	LIST
	ZZ==0
	DUMRH1


	DEFINE TBLDEV(A,B)<
	ZZP==.
	RELOC	FEKLDX+A-MIFEKL
	ZZ
	ZZ==ZZ+1
	RELOC	ZZP
>
;	XLIST
FEKLDX:	REPEAT	36-MIFEKL,<0>
	LIST
	ZZ==0
	DUFEKL


	DEFINE TBLDEV(A,B)<
	ZZP==.
	RELOC	RPMRDX+A-MIRPMR
	ZZ
	ZZ==ZZ+1
	RELOC	ZZP
>
;	XLIST
RPMRDX:	REPEAT	36-MIRPMR,<0>
	LIST
	ZZ==0
	DURPMR


	;NOW GENERATE THE ERROR BIT VS INDEX BIT TABLES
	;THIS ALLOWS NON-CONTIGUOUS ERROR BITS IN CONI WORD
	;TO BE COUNTED IN CONTIGUOUS COUNTERS




	RADIX	8		;	***** DONE WITH RADIX 10 *****
	;GENERATE SIXBIT TABLE OF DEVICE NAMES

	DEFINE	DUMDV(A)<
	SIXBIT/A/
>
NAMTB2::	DUMDVB
NAMLT2=<.-1>-NAMTB2+1	;LENGTH OF TABLE OF SIXBIT NAMES
	
;USING SAME DEFINITION OF MACRO NOW GENERATE
	;LIST OF ONLY MASSBUS DEVICE NAMES

MASNA2:	DUMDVB

	MASLT2=<.-1>-MASNA2+1	;LENGTH OF THIS TABLE

	;GENERATE CONI BIT ERROR DISPATCHER
	;RH = SOFT ERROR POINTER
	;LH = HARD ERROR POINTER

	DEFINE	DUMDV(A)<
	XWD	A'HD,A'SF
>

DEVDS2:	DUMDVB



	DEFINE	DUMDV(A)<
	XWD	A'ST,A'SP
>
	;ST=STORAGE TEMP,SP=PERM.
SOFDS2:	DUMDVB
	;NOW THE DISPATCHER FOR MASSBUS ERROR REGS

	DEFINE	DUMDV (A)<
	XWD	A'DS, A'DH
	>
MASDS2:		DUMDVB
DEVDSP::
MASNAM::
NAMTBL::
MASLTH==0
NAMLTH==0



	END	STARTD