Google
 

Trailing-Edge - PDP-10 Archives - BB-L288A-RM - swskit-changed-sources/sysera.mac
There are 15 other files named sysera.mac in the archive. Click here to see a list.
	TITLE	SYSERA -- SYSTEM ERROR FILE PROCESSOR -- MAINLINE CODE
SUBTTL	VERSION 15A(1363)	K. COYE/ RLD/ PJB/ ES/ TJW/ LWE/ SRL/ GSK





;COPYRIGHT (C) 1972,1975,1977,1978,1979,1980 BY
;DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
;
;
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
;ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
;INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
;COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
;OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
;TRANSFERED.
;
;THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
;AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
;CORPORATION.
;
;DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
;SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.


	SEARCH	SYRUNV
	SEARCH	SYRLOW
;*;	SEARCH	SCNMAC
	.REQUIRE SYRLIB


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

	EXTERNAL DAEVER,HEADRD,ABORT,CHRCHK,DATECK,FILERR,TOOBIG,MBCHAR
	EXTERNAL CNISUM,BADNAM,MASSVM,DEVCHK,ERRINT,SKIPIT,IDCHK,NOTRAN
	EXTERNAL STRCHK,DETCHK,DMPENT,HDRLST,PAGXCD,DVCHAR,TMCHAR
	EXTERNAL SAYDAY,GETNBS,.OCTLE,.DECML,.ASCIE,.SIXBT
	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,.TVERW,.TDTTM,.TTIMN
	EXTERNAL BLOKTN,HKSTRG,DUMPOS,DSKPOS,TAPPOS






;INTERNALS DEFINED HERE ARE FOR USE BY SYRLIB
	INTERNAL KONMSK,KLEDMP,MINERB,DEVDSP,MASLTH,ALLTBL
	INTERNAL NAMLTH,TYPMES,LINE,ALLLTH,NAMTBL,DUMDAY
	INTERNAL DEVTYP,ERINDX,PCSTBL,PDLPNT,BITCHK,ERRLTH
	INTERNAL MASNAM,ERRTBL,SUMUPD,MASNA2,MASLT2,MDE000
	INTERNAL FE$NAM,BLTTAB



	




;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.
;********BE VERY CAREFULL NOT TO USE "UDATE" IN ANY ENTRY
;********PROCESSED BY SYSERA.   .CTXXX MACRO DEFINITION HAS BEEN
;********MODIFIED TO SUPPORT CODE 5 ENTRIES!!!!!!!!!

	DEFINE	DUMALL<
	DUM001
	DUM003
	DUM005
	DUM006
	DUM007
	DUM010
	DUM014
	DUM017
	DUM020
	DUM040
	DUM041
	DUM045
	DUM071
	DUM072
>



	.JBVER==137
	LOC	.JBVER

	BYTE	(3)VWHO(9)VSYSER(6)VMINOR(18)VEDIT
	IFN	EXPPRT,<
	LALL
	>
	IFE	EXPPRT,<
	SALL
	>

	IF2	<PRINTX	STARTING PASS 2
>

	TWOSEG
	RELOC	400000






;DUMMY ROUTINE TOMAKEPACK. COMPILE
MDE000:
BLTTAB:
FE$NAM:
MASNA2:
MASLT2==0
KLEDMP:	BLOCK 0				;GIVE IT SOME SPACE

;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>
;PROCSA -- STANDARD ENTRY PROCESSOR #1
;CALL	JRST PROCSA
;
;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

PROCSA:	TRNE	F,F.BRF			;/BRIEF ?  -  EDIT [724]
	 JRST	NEWCMD##		;YES! - DO IT THAT WAY
	SETZM	OFFSET			;CLAR WORD OFFSET COUNT
	MOVE	P1,(CTINDX)		;PICKUP FIRST WORD IN CONTROL TABL
	JUMPE	P1,ABORT		;ABORT WHEN END OF CTL TABL SEEN
	TLNE	P1,770000		;DO WE NEED TO GET AN AOB POINTER
	PUSHJ	P,GETAOB		;YES-WORD IS IN A RELOCATABL SUBTABLE IN ENTRY
	LDB	T2,[POINT ^D9,P1,14]	;**WATCHOUT**PICKUP WORD LOCATION IN ENTRY
	ADD	T2,OFFSET		;OFFSET CONTAINS AOB BLOCK STARTING LOCATION
	CAML	T2,ENTRWC		;[153]DONT TRY TO ACCESS WORDS OUTSIDE OF ENTRY
	AOJA	CTINDX,PROCSA		;GET NEXT WORD IN CTL TABLE
	CAILE	T2,WKSIZE		;MAKE SURE THE WORD ASKED FOR IS IN WORK BUFFER
	AOJA	CTINDX,PROCSA		;IGNORE AND GET NEXT WORD
	MOVE	P2,WKBUFF(T2)		;PICKUP DATA WORD IN WORK BUFF
	LDB	T3,[POINT 3,P1,17]	;****WATCHOUT**PICKUP WORD PROCESSES MODE
	CAIG	T3,SUBMAX		;***WATCHOUT***IS IT AND UNKNOWN MODE
	PUSHJ	P,SUBTAB(T3)		;ITS RECOGINIZED
	AOJA	CTINDX,PROCSA		;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,PROCSA		;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 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
PROCSN:	MOVE	T1,[SIXBIT/SYSERN/]
	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 PROCSD FOR THIS HIGH SEG
;IT SAVES THE AC'S AND THEN CALLS OVRLAY FOR REPLACEMENT
;WITH SYSERD.HGH

PROCSD:	MOVE	T1,[SIXBIT/SYSERD/]
	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 PROCSC



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

STARTA:	MOVEI	T1,CHROUT		;OUR TYPEOUT 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
	TRNN	F,F.ENT			;DOING /ENTRY?[752]
	 TRNE	F,F.SEQ
	  JRST	START1
	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
START1:	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
	FATAL	<ENTRY WITH ZERO LENGTH BODY SPECIFIED>
	MOVE	P4,ERRIND
	TLNE	F,F.BTCK		;ANY TO DO?
	PUSHJ	P,@BITCHK(P4)		;GO DO IT
	TRNE	F,F.REM			;[417]/REMOTE?
	 PUSHJ	P,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)

;SPECIAL DECODING ROUTINES

HARDER:	IFN	DEBUGA,<
	TYPEIT	<

UNIT HARD ERROR TOTALS>
	PUSHJ	P,DECHAF
>
	POPJ	P,
SOFTER:	IFN	DEBUGA,<
	TYPEIT	<

UNIT SOFT ERROR TOTALS>
	PUSHJ	P,DECHAF
>
	POPJ	P,
SOFDET:	IFN	DEBUGA,<
	TYPEIT	<

UNIT SOFTWARE-DETECTED ERROR TOTALS>
	TYPEIT	<
	SAT DISCREPANCIES:	>
	LDB	T1,[POINT 12,P2,11]	;PICKUP SAT ERROR BYTE
	PUSHJ	P,.ODECW
	TYPEIT	<
	RETRIEVAL INFO ERRORS:	>
	LDB	T1,[POINT 12,P2,23]	;PICKUP # RIB ERRORS
	PUSHJ	P,.ODECW
	TYPEIT	<
	CHECKSUM ERRORS:	>
	LDB	T1,[POINT 12,P2,35]	;PICKUP # CHKSUM ERRORS
	PUSHJ	P,.ODECW
>
	POPJ	P,			;GO AWAY
SEKINC:	IFN	DEBUGA,<
	TYPEIT	<
	SEEK INCOMPLETES:	>
	MOVE	T1,P2
	PUSHJ	P,.ODECW
>
	POPJ	P,

SOFHNG:	IFN	DEBUGA,<
	TYPEIT	<
	HARD XFER HANGS:	>
	MOVE	P3,[POINT 9,P2]
	ILDB	T1,P3			;PICKUP BITS 0-8
	PUSHJ	P,.ODECW
	TYPEIT	<
	SOFT XFER HANGS:	>
	ILDB	T1,P3			;PICKUP BITS 9-17
	PUSHJ	P,.ODECW
	TYPEIT	<
	SOFT SEEK HANGS:	>
	ILDB	T1,P3			;PICKUP BITS 18-27
	PUSHJ	P,.ODECW
	TYPEIT	<
	SOFT SOFTWARE HANGS:	>
	ILDB	T1,P3
	PUSHJ	P,.ODECW
>
	POPJ	P,

RETRYS:	TYPEIT	<
	RETRIES	PERFORMED:	>
	IFN	DEBUGA,<
	TLNE	P2,ERRHRD		;WAS THIS ERROR NON-RECOVERABLE?
	PUSHJ	P,TYPAST		;YES TYPE ASTERISK
>
	TLZ	P2,-1			;CLEAR LH OF P2
	MOVE	T1,P2
	PUSHJ	P,.ODECW
	POPJ	P,			;GO AWAY


	IFN	DEBUGA<
;ROUTINE TO DECODE LH AND RH OF WORD AND PUBLISH IT
;USED WITH UNIHCT AND UNISCT

DECHAF:	TYPEIT	<
	DATA PARITY:		>
	HRRZ	T1,P2			;PICKUP LH COUNT
	PUSHJ	P,.ODECW
	TYPEIT	<
	DEVICE OR POSITION:	>
	HLRZ	T1,P2			;PICKUP RH COUNT
	PUSHJ	P,.ODECW
	POPJ	P,			;GO BACK
>

;DISKPR -- SUBROUTINE TO PUBLISH READ,WRITE AND SEEK STATISTICS
;CALLED FROM PROCSA WITH PUSHJ	P,DISKPR
;
;RETURN	CALL+1

DISKPR:	IFN	DEBUGA,<
	TYPEIT	<

DISK PERFORMANCE TOTALS:
	READS:			>
	MOVE	T1,P2
	PUSHJ	P,.ODECW
	TYPEIT	<
	WRITES:			>
	MOVE	T1,WKBUFF+HDETWC	;PICKUP TOTAL # READS SINCE RELOAD
	PUSHJ	P,.ODECW		;PUBLISH IT
	TYPEIT	<
	SEEKS:			>
	MOVE	T1,WKBUFF+HDETSC	;PICKUP TOTAL # SEEKS SINCE RELOAD
	PUSHJ	P,.ODECW
>
	POPJ	P,

;HERE START THE ROUTINES TO LIST THE EXTRACTED CRASH INFORMATION,
;CODE 5 ENTRIES.

UNKN:	252525,,252525			;[527]
CINLST:	MOVE	P2,WKBUFF+CINUNI	;[1131]GET COUNT OF UNITS
	SKIPE	P2			;[1131]DON'T DO IT IF NO UNITS TO LIST
	PUSHJ	P,DEVLST		;GO LIST UNIT STATS
	PUSH	P,P1			;SAVE
	SETZ	P1,
	PUSHJ	P,DETCHK##		;/DET?
	POP	P,P1
	TYPEIT	<
CONTENTS OF GETTAB'D ITEMS:
>
	SETZB	P1,P2			;SOME STORAGE
	MOVEI	P3,3			;3 ITEMS PER LINE
CINCON:	MOVE	P2,CINTAB(P1)		;GET NEXT ITEM
	SKIPN	P2			;IF ZERO
	 PJRST	CINCUS			;GO CHECK FOR CUSTOMER ADDED ITEMS
	LDB	T1,[POINT 6,P2,14]	;GET SUBTAB OFFSET
	HRLZ	P4,T1
	LDB	T2,[POINT 3,P2,17]	;AND FLAG BITS
	HRR	P4,T2
	PUSHJ	P,SAVE4P##		;HOLD P1-P4
	HRRZ	P1,P2			;ADDR OF TEXT
	LDB	T1,[POINT 9,P2,8]	;GET OFFSET IN WKBUFF TO DATA WORD
	MOVE	P2,WKBUFF(T1)		;DATA ITEM TO P2
	CAMN	P2,UNKN			;[527]
	 JRST	BADVAL	
	HLRZ	T1,P4			;OFFSET TO SUBTAB
	CAIN	T1,5			;SUBTAB OFFSET =SPECIAL?
	 JRST	SPEC(T2)		;GO HANDLE SPECIAL ITEMS
	PUSHJ	P,SUBTAB(T1)		;GO LIST ITEM AND TEXT
CINCN1:	PUSHJ	P,RET4P##		;RESTORE P1-P4
	SOSG	,P3			;DONE 3 FOR THIS LINE?
	 PUSHJ	P,[ PUSHJ P,.TCRLF
		    MOVEI P3,3
		    POPJ  P,0]		;YES
	CAIE	P3,3			;NO TAB FOR 1ST ITEM EACH LINE
	PUSHJ	P,.TTABC		;SPACE OVER
	AOJA	P1,CINCON		;GET NEXT ITEM ON LIST
;[527]
BADVAL:	HRRZ	T1,P1			;ADDR OF ASCIZ
	PUSHJ	P,.TSTRG
	TYPEIT	< UNKNOWN>
	JRST	CINCN1
	

SPEC:	JRST  SPEC0
	JRST  SPEC1
	JRST  SPEC2
	JRST SPEC3
	JRST SPEC4
	JRST SPEC5
	JRST SPEC6
	JRST SPEC7

SPEC0:	MOVEM	P2,TICSEC
	IMULI	P2,^D24*^D3600
	MOVEM	P2,DATLOC		;SAVE #OF TICKS PER SECOND
	JRST	SPECX			;AND USE COMMON EXIT

SPEC1:	MOVE	T1,P1			;ADDR OF TEXT
	PUSHJ	P,.TSTRG		;IN ASCIZ
	MOVE	T1,P2
	SETZ	T2,
	ASHC	T1,-^D17
	DIV	T1,DATLOC
	MOVE	T2,T1
	HLR	T1,T2
	CAIE	T1,0
	PUSHJ	P,SAYDAY##
	HRRZ	T1,T2
	HRL	T1,DUMDAY
	PUSHJ	P,.CNTDT
	PUSHJ	P,.TTIME
	JRST	SPECX			;COMMON EXIT

SPEC2:	TYPEIT	<

PARITY ERROR INFORMATION:
>
	JRST	SPECX			;COMMON EXIT
SPEC3:	TYPEIT	<

SYSTEM RESPONSE INFORMATION:
>
	JRST	GENRSP			;COMMON EXIT

SPEC4:	PUSHJ	P,.TCRLF		;START ON NEXT LINE
	PUSHJ	P,.TCRLF		;WITH A BLANK LINE
	MOVEI	P3,3			;RE-INIT THE ITEM COUNTER
	JRST	SPECX			;COMMON EXIT
SPEC5:
SPEC6:
SPEC7:

SPECX:	PUSHJ	P,RET4P			;RESTORE P1-P4
	AOJA	P1,CINCON		;DUMMY FOR NOW

;HERE CHECK FOR GETTABED ITEMS DEFINED BY CUSTOMER
;ANY FOUND WILL BE LISTED IN OCTAL

CINCUS:	MOVE	T1,WKBUFF+CINUNI	;GET # OF DISK UNITS INCLUDED
	IMULI	T1,10			;10 ITEMS PER UNIT
	ADDI	T1,1			;ADJUST PNTR
	MOVE	P1,WKBUFF+CINUNI(T1)	; BETTER BE AOBJN PNTR OF LENGTH OF ITEMS
	SKIPN	P1			;IF ZERO,
	 PJRST	TITLST			;WE'RE DONE
	TYPEIT	<
LISTING CUSTOMER DEFINED GETTAB ITEMS IN OCTAL
	>
CUSCON:	MOVE	T1,WKBUFF(P1)		;GET AN ITEM
	PUSHJ	P,.TXWDW
	PUSHJ	P,.TCRLF
	PUSHJ	P,.TTABC
	AOBJN	P1,CUSCON		;MORE TO DO
	PJRST	TITLST			;NOPE
;ROUTINE TO LIST THE DISK DATA BLOCKS FROM CRASH.EXE ENTRIES
;CALLED PUSHJ P,DEVLST WITH CINUNI IN P2

DEVLST:	TYPEIT	<
DISK UNIT STATISTICS:
>
	MOVEI	P1,CINUNI+1		;OFFSET TO START OF FIRST
	TYPEIT	<
DEV	TYPE	READS	WRITES	SEEKS	SDEV	SDAT	HDEV	HDAT	SAT	RIB	CHK>
DEVLS1:	PUSHJ	P,.TCRLF		;START ON NEXT LINE
	MOVE	T1,WKBUFF(P1)		;GET UNIT NAME
	PUSHJ	P,.TSIXN		;IN SIXBIT
	PUSHJ	P,.TTABC
	MOVE	T1,WKBUFF+1(P1)		;DSKCHR VALUE
	PUSHJ	P,DEVDET		;DETERMINE AND LIST UNIT TYPE
	PUSHJ	P,.TTABC
	MOVE	T1,WKBUFF+2(P1)		;# READS
	PUSHJ	P,.ODECW		;WITH A "."
	PUSHJ	P,.TTABC
	MOVE	T1,WKBUFF+3(P1)		;# WRITES
	PUSHJ	P,.ODECW		;WITH A "."
	PUSHJ	P,.TTABC
	MOVE	T1,WKBUFF+4(P1)		;# SEEKS
	PUSHJ	P,.ODECW		;WITH A "."
	PUSHJ	P,.TTABC
	HLRZ	T1,WKBUFF+5(P1)		;# SOFT DEVICE ERRORS
	PUSHJ	P,.ODECW		;WITH A "."
	PUSHJ	P,.TTABC
	HRRZ	T1,WKBUFF+5(P1)		;# SOFT DATA ERRORS
	PUSHJ	P,.ODECW		;WITH A "."
	PUSHJ	P,.TTABC
	HLRZ	T1,WKBUFF+6(P1)		;# HARD DEVICE ERRORS
	PUSHJ	P,.ODECW		;WITH A "."
	PUSHJ	P,.TTABC
	HRRZ	T1,WKBUFF+6(P1)		;# HARD DATA ERRORS
	PUSHJ	P,.ODECW		;WITH A "."
	PUSHJ	P,.TTABC
	LDB	T1,[POINT 12,WKBUFF+7(P1),11]	;SAT
	PUSHJ	P,.ODECW
	PUSHJ	P,.TTABC
	LDB	T1,[POINT 12,WKBUFF+7(P1),23]	;RIB
	PUSHJ	P,.ODECW
	PUSHJ	P,.TTABC
	LDB	T1,[POINT 12,WKBUFF+7(P1),35]	;CHK
	PUSHJ	P,.ODECW
	PUSHJ	P,.TTABC
	SUBI	P2,1			;DONE A UNIT
	ADDI	P1,10			;BUMP OFFSET BY A UNIT'S WORTH
	SKIPN	P2			;IF ZERO,
	 POPJ	P,0			;WE'RE DONE
	JRST	DEVLS1			;ELSE DO ANOTHER
;ROUTINE TO DETERMINE AND LIST THE UNIT TYPE DESCRIPTION FOR THE
;DSKCHR VALUE IN T1

DEVDET:	LDB	T2,[POINT 6,T1,26]	;T2 GET CONTROLLER CODE
	LDB	T3,[POINT 3,T1,32]	;T3 GET UNIT CODE
	LSH	T2,3			;SHIFT LEFT 3 BIT
	IOR	T2,T3			;T2 GETS A PNTR
	MOVE	T1,[SIXBIT/UNKN/]	;SAY UNKNOWN
	CAIN	T2,10
	 MOVE	T1,[SIXBIT/RD10/]
	CAIN	T2,11
	 MOVE	T1,[SIXBIT/RM10B/]
	CAIN	T2,21
	 MOVE	T1,[SIXBIT/RP02/]
	CAIN	T2,22
	 MOVE	T1,[SIXBIT/RP03/]
	CAIN	T2,40
	 MOVE	T1,[SIXBIT/RS04/]
	CAIN	T2,50
	 MOVE	T1,[SIXBIT/RP04/]
	CAIN	T2,51
	 MOVE	T1,[SIXBIT/RP06/]
;[1136]
	CAIN	T2,52
	 MOVE	T1,[SIXBIT/RM03/]
	CAIN	T2,53
	 MOVE	T1,[SIXBIT/RP07/]
;END [1136]
	SKIPN	T1			;A TYPE DETERMINED YET??
	 MOVE	T1,[SIXBIT/UNKN/]	;WE MUST SAY SOMETHING
	PUSHJ	P,.TSIXN
	POPJ	P,0			;RETURN TO CALLER
;HERE TO PRINT RESPONSE MEASURES

;THIS CODE WAS TAKEN FROM SYSTAT AND MODIFIED FOR USE HERE
;CODE NEEDED TO SUPPORT MORE THAN 1 CPU IS COMMENTED OUT
;AND SHOULD BE DEBUGGED BEFORE ATTEMPTING USE.
;ROUTINES ARE ADDED WITH [554]
;SOME LOCAL DEFINITIONS
	%SUM==0
	%NUM==1
	%HISUM==2
	%LOSUM==3


GENRSP:	MOVEI	T1,[ASCIZ @			MEAN//ST.DEV. RESP/MIN   # of RESP
@]
	PUSHJ	P,.TSTRG
	HRREI	T1,-5			;5 TYPES OF RESPONSE
	SETZM	T4			;RELATIVE SUBTABLE POINTER
RSP:	MOVEM	T1,RSPCNT		;SAVE RESPONSE TYPE COUNTER
	MOVE	T1,RSPMSG+5(T1)		;GET MSG FOR THIS RESPONSE TYPE
;FOR .GT. 1 CPU INSERT -   	SETZM	CPU		;SET FOR CPU0

	PUSHJ	P,SAVE4T
	PUSHJ	P,.TSTRG
	PUSHJ	P,RET4T
;LOOP TO PRINT RESPONSE FOR EACH CPU

RSPLP1:					;*;MOVE	T1,T4		;GET TYPE INDEX
	MOVEI T1,%NUM			;NO. OF RESPONSES SINCE STARTUP
	PUSHJ	P,GETRSP		;GET FROM MONITOR REL TABLE
;*;	  JRST RSP1C		;NOT PRESENT FOR THIS CPU
;*;	PUSHJ	P,GETDIF	;GET INCREMENTAL VALUE
	PUSH	P,T1			;SAVE TOTAL NO. OF RESPONSES

;*;	MOVE	T1,T4		;GET TYPE INDEX
	MOVEI	T1,%SUM			;SUM OF RESPONSE TIMES IN JIFFIES
	PUSHJ	P,GETRSP		;GET FROM MONITOR REL TABLE
;*;	  JRST	RSP1B		;NOT PRESENT FOR THIS CPU
;*;	PUSHJ	P,GETDIF	;GET INCREMENTAL VALUE
	MOVE	P1,T1			;MOVE TO N FOR PNTSEC ROUTINE
	MUL	T1,T1			;GET SQUARE OF SUM OF RESPONSES
	PUSH	P,T1			;SAVE FOR STANDARD DEV
	PUSH	P,T2			; ..
	IDIV	P1,-2(P)		;AVERAGE RSP=SUM/NUMBER(IN JIFFIES)
	MOVE	P4,TICSEC		;SETUP FOR PNTSEC
	PUSHJ	P,PNTSEC		;PRINT IN SECONDS + TENTHS
	POP	P,P2			;RESTORE SQUARE OF SUM
	POP	P,P1			; ..
	MOVEI	T1,[ASCIZ @//@]		;SEPARATE MEAN FROM STANDARD DEVIATION
	PUSHJ	P,SAVE4T##		;DON'T TRUST SCAN
	PUSHJ	P,.TSTRG
	PUSHJ	P,RET4T##		;GET BACK T'S

;*;	MOVE	T1,T4		;GET TYPE INDEX
	MOVEI	T1,%LOSUM		;GET LOW SUM OF SQUARES OF RESPONSES
	PUSHJ	P,GETRSP		;GET FROM MONITOR REL TABLE
;*;	  JRST	RSP1B		;NOT THERE
;*;	PUSHJ	P,GETDIF	;GET INCREMENTAL VALUE
	MOVE	T2,T1			;POSITION FOR MULT.
	MOVE	T1,RSPIDX		;GET INDEX TO DIFRSP TABLE
	MOVEM	T1,RSPIX1		;SAVE IT (NEED TO DO DOUBLE
					; PRECISION SUBTRACT)

;*;	MOVE	T1,T4		;GET TYPE INDEX
	MOVEI	T1,%HISUM		;ASK FOR HIGH SUM OF SQUARES
	PUSHJ	P,GETRSP		;FROM MONITOR
;*;	  JRST	RSP1B		;(STRANGE!)
;*;	PUSHJ	P,GETDIF	;GET INCREMENTAL VALUE
	SKIPL	T2			;IS DIFFERENTIAL LOW ORDER PART NEGATIVE?
	JRST	RSPL1A			;NO, OK
					; YES, FUDGE DOUBLE PRECISION
	PUSH	P,P1			;SAVE N
	MOVE	P1,RSPIX1		;GET INDEX TO DIFRSP TABLE
	SETCAB	T2,DIFRSP(P1)		;COMPLEMENT LOW ORDER HALF
	MOVE	P1,RSPIDX		;GET INDEX TO HIGH ORDER HALF
	SOS	T1,DIFRSP(P1)		;BORROW 1
	POP	P,P1			;RESTORE N
RSPL1A:	MUL	T2,(P)			;MULT BY NUMBER
	IMUL	T1,(P)			; BOTH HALVES
	ADD	T1,T2			;INCLUDE CROSS CARRY
	MOVE	T2,T3			;POSITION LOW HALF
	SETCMM	P1			;COMPLEMENT SQUARE OF SUM
	MOVNS	P2			; ..
	SKIPN	P2			;HANDLE CARRY
	ADDI	P1,1			; YES
	TLZ	P2,(1B0)		;GOT (P4,MASTWD)=-SQ.SUM
	ADD	T2,P2			;ADD TO N*SUM SQ.
	ADD	T1,P1			; ..
	TLZE	T2,(1B0)		;SEE IF CARRY
	ADDI	T1,1			;YES. GOT (T1,T2)=N*SUM SQ.-SQ.SUM
	PUSHJ	P,ISQRT			;COMPUTE N=SQRT((A,B))
	IDIV	P1,(P)			;DIVIDE BY NUMBER; N=STD.DEV
	MOVE	P4,TICSEC		;SETUP FOR PNTSEC
	PUSHJ	P,PNTSEC		;PRINT AS SECONDS PLUS TENTHS
	POP	P,T1			;REMOVE NO.
;FOR .GT. 1 CPU INSERT -   	AOS	CPU		;STEP TO NEXT CPU
;*;	JRST	RSPLP1		;GO SEE IF EXISTS	
;HERE WHEN PRINTED MEAN AND STANDARD DEV FOR ALL CPUS
;*;RSP1B:	POP	P,T1		;REMOVE NUMBER
RSP1C:	PUSHJ	P,SAVE4T		;AND A SECOND ONE
	PUSHJ	P,.TTABC		;PRINT A TAB
	PUSHJ	P,RET4T
	MOVE	T1,WKBUFF+CINUPT	;UP TIME IN JIFFIES
	IDIV	T1,TICSEC		;NO. OF SECONDS UP
	IDIVI	T1,^D60			;NO. OF MINUTES UP
	MOVEM	T1,P4			;STORE FOR PNTSEC
;FOR .GT. 1 CPU INSERT -   	SETZM	CPU		;START WITH CPU0
RSPLP2:					;*;MOVE	T1,T4		;GET TYPE INDEX
	MOVEI	T1,%NUM			;NO. OF RESPONSES FOR THIS CPU
	PUSHJ	P,GETRSP		;CALL GETRSP TO SET UP INDEX
;*;	  JRST	RSP2		;NOT THERE
;*;	MOVE	T1,RSPIDX	;DIDN'T REALLY WANT NEW VALUE
;*;	MOVE	T1,DIFRSP(T1)	; GET INCREMENTAL VALUE
	MOVE	P1,T1			;SETUP FOR PNTSEC
	PUSHJ	P,PNTSEC		;PRINT NO. RESPONSES PER MIN
;FOR .GT. 1 CPU INSERT -   	AOS	CPU		;STEP TO NEXT CPU
;*;	JRST	RSPLP2		;TRY NEXT CPU

;HERE TO PRINT NUMBER OF RESPONSES FOR THIS TYPE

RSP2:	MOVEI	T1,[ASCIZ /	   /]
	PUSHJ	P,SAVE4T
	PUSHJ	P,.TSTRG
	PUSHJ	P,RET4T
;FOR .GT. 1 CPU INSERT -   	SETZM	CPU		;START WITH CPU0
RSPLP3:					;*;MOVE	T1,T4		;GET TYPE INDEX
	MOVEI	T1,%NUM			;NO. OF RESPONSES FOR THIS CPU
	PUSHJ	P,GETRSP		;CALL GETRSP TO SET UP INDEX
;*;	  JRST RSP3		;NOT THERE
;*;	MOVE	T1,RSPIDX	;DIDN'T REALLY WANT NEW VALUE
;*;	MOVE	P4,DIFRSP(T1)	; GET INCREMENTAL VALUE
	PUSHJ	P,SAVE4T		;SAVE T'S
	PUSHJ	P,.ODECW		;PRINT # OF RESPONSES
	PUSHJ	P,RET4T
;FOR .GT. 1 CPU INSERT -   	AOS	CPU		;FIND OUT IF ANY MORE CPU'S
;*;	JRST	RSPLP3		;TRY NEXT CPU

;HERE WHEN PRINTED FOR ALL CPUS

RSP3:	PUSHJ	P,.TCRLF
	AOS	T4			;STEP TO NEXT RESPONSE TYPE
	MOVE	T1,RSPCNT
	AOJL	T1,RSP			;PROCESS NEXT TYPE (IF ANY)
;HERE PRINT OTHER 'RESPONSE' TYPE ITEMS

OTHRSP:	TYPEIT	<
	TOTAL UUO COUNT:		>
	MOVE	T1,WKBUFF+CINTUC	;GET # UUO'S
	PUSHJ	P,.ODECW		;WITH A .
	TYPEIT	<	AVG. = >
	MOVE	P4,WKBUFF+CINUPT	;UPTIME IN JIFFIES
	IDIV	P4,TICSEC		;IN SECONDS
	IDIVI	P4,^D60			;IN MINUTES-SETUP FOR PNTSEC
	MOVE	P1,WKBUFF+CINTUC	;# UUO'S DONE, AGAIN
	PUSHJ	P,PNTSEC		;LIST IT
	TYPEIT	< PER MIN.>
	TYPEIT	<
TOTAL JOB CONTEXT SWITCH COUNT:		>
	MOVE	T1,WKBUFF+CINTJC	;GET IT
	MOVE	P1,T1			;SAVE IT
	PUSHJ	P,.ODECW		;IN DECIMAL WITH A .
	TYPEIT	<	AVG. = >
	PUSHJ	P,PNTSEC		;P4 SHOULD STILL BE SET
	TYPEIT	< PER MIN.>
	PUSHJ	P,.TCRLF
	JRST	SPECX			;USE COMMON EXIT


RSPMSG:	[ASCIZ /    'til TTY output:	/]
RSPMS2:	[ASCIZ /    'til TTY input:	/]
RSPMS3:	[ASCIZ /    'til requeued:	/]
RSPMS4:	[ASCIZ /    'til 1st of above:	/]
RSPMS5:	[ASCIZ /    'TIL JOB STARTED: 	/]


;PNTSEC-CALLED FROM GENRSP
PNTSEC:	PUSHJ	P,SAVE4T		;SAVE T'S
	IMULI	P1,^D10			;* 10
	IDIV	P1,P4			;BY TICKS/SEC
	LSH	P2,1			;REMAINDER * 2
	CAML	P2,P4			;ROUNDING NEEDED?
	 AOJ	P1,			;YES
	IDIVI	P1,^D10
	PUSH	P,P2			;SAVE REMAINDER
	MOVE	T1,P1			;SET TO PRINT
	PUSHJ	P,.ODECW		;IN DECIMAL W A .
	POP	P,T1			;GET REMAINDER BACK
	PUSHJ	P,.TDECW		;WITHOUT .
	PUSHJ	P,RET4T			;RESTORE T'S
	POPJ	P,0			;RETURN
;ROUTINE TO COMPUTE INTEGER SQRT:  P1=ISQRT(T1,T2)
;CALLED WITH POS ARG IN "T1,T2", RESULT RETURNED IN "P1", USES P2

ISQRT:	MOVEI	P1,0			;PRESET NULL ANSWER
	JUMPL	T1,ISQ3			;RETURN 0 IF NEG
	MOVE	P1,T1			;COPY ARG
	JFFO	P1,.+2			;SET N1 TO NUM 0S
	MOVEI	P2,^D36			; IN CASE ALL ZERO
	SOS	P2			;BACK DOWN FOR SIGN BIT
	TRZ	P2,1			;MAKE SMALLER EVEN
	LSH	T2,1			;COMPRESS OUT SIGN BIT OF B
	LSHC	T1,-^D35(P2)		;POSITION MOST SIG. BITS IN B
	ASH	P2,-1			;DIVIDE SHIFT BY 2
	MOVNS	P2			;SET TO OTHER WAY FOR ANSWER

	TRO	T2,1			;FORCE SOME BITS ON TO TERMINATE
	MOVEI	P1,0			;CLEAR ANSWER
ISQ1:	ASH	P1,1			;MOVE TO NEXT BIT
	CAMG	T1,P1			;SEE IF REMAINDER IS BIG
	JRST	ISQ2			;NO--LOOP ON
	SUB	T1,P1			;DECREASE REMAINDER
	SUBI	T1,1			; ..
	TRO	P1,2			;INCREASE RESULT
ISQ2:	LSHC	T1,2			;SHIFT REMAINDER TWO BITS
	JUMPN	T2,ISQ1			;LOOP UNTIL DONE
	ASH	T1,-1			;BACK OFF REMAINDER
	CAMLE	T1,P1			;SEE IF ROUNDING NEEDED
	ADDI	P1,1			;YES--INCREASE RESULT

	ASH	P4,^D17(P2)		;POSITION RESULT
ISQ3:	POPJ	P,			;RETURN

;GETRSP - ROUTINE TO EXTRACT DESIRED RESPONSE VALUE FROM WKBUFF
;CALL WITH T1/ OFFSET TO CURRENT BLOCK FOR VALUE
GETRSP:	PUSH	P,T2			;SCRATCH SPACE
	MOVE 	T2,T4			;GET LOOP COUNT
	IMULI	T2,4			;OFFSET 4 WDS/LOOP
	ADDI	T2,WKBUFF+CINRSO	;OFFSET TO FIRST
	ADD	T2,T1			;OFFSET TO DESIRED VALUE
	MOVE	T1,0(T2)		;GET DESIRED VALUE
	POP	P,T2			;RESTORE T2
	CAME	T1,UNKN			;[1104] GOOD VALUE?
	 POPJ	P,0			;[1104] NO, RETURN NOW
	POP	P,			;[1104] CLEAN UP STACK 

BADRSP:	TYPEIT	<
	** UNKNOWN VALUE IN RESPONSE SUBTABLE **
>
	JRST	SPECX			;EXIT RESPONSE SUBROUTINE WITHOUT
					;ANY MORE LISTING
;THIS IS THE TABLE OF GETTAB ITEMS TO BE EXTRACTED FROM A CRASH.
;ADDITIONAL ITEMS SHOULD NOT BE ADDED HERE BY A SITE BECAUSE IT WILL
;CONFUSE SYSERR VERY BADLY. USE THE TABLE CRSGT1 INSTEAD.
;  ";***" INDICATES A SUBTABLE ITEM
	RADIX 10
;THE CIN MACRO HAS THE FOLLOWING SUBARGUEMENTS
;A - THE OFFSET NAME AS DEFINED IN SYRUNV
;B - THE OFFSET VALUE
;C - THE PRINT CODE AS AN OFFSET TO SUBTAB
;D - SOME TYPE OF A FLAG VALUE SUCH AS DONT LIST THIS ITEM
;E - THE TEXT TO LIST FOR THIS VALUE

	DEFINE CINALL<
	CIN	(CINTIC,7,5,0,<              #TICKS PER SECOND: >)
	CIN	(CINTIM,3,5,1,<                    TIME OF DAY: >)
	CIN	(CINSIZ,4,0,0,<             SYSTEM MEMORY SIZE: >)
	CIN	(CINPOK,5,0,0,<                LAST ADDR POKED: >)
	CIN	(CINLNM,6,1,0,<               # JOBS LOGGED IN: >)
	CIN	(CINDBG,9,4,0,<              DEBUG STATUS WORD: >)
	CIN	(CINHSO,10,0,0,<      START OF MONITOR HIGH SEG: >)
	CIN	(CINNWC,11,0,0,<              #OF WORDS OF CORE: >)
	CIN	(CINUPT,12,1,0,<                UPTIME IN TICKS: >)
	CIN	(CINEPO,20,1,0,<            # UNREC EXEC PDL OV: >)
	CIN	(CINEPP,21,1,0,<        # RECOVERED EXEC PDL OV: >)
	CIN	(CINERC,22,1,0,<               SWAP ERROR COUNT: >)
	CIN	(CINDEL,23,1,0,<  DISABLED HARDWARE ERROR COUNT: >)
	CIN	(CINSPC,24,3,0,<                    LAST STOPCD: >)
	CIN	(CINNDS,25,1,0,<                # DEBUG STOPCDS: >)
	CIN	(CINNJS,26,1,0,<                  # JOB STOPCDS: >)
	CIN	(CINSJN,27,0,0,<         LAST STOPCD-JOB NUMBER: >)
	CIN	(CINSPN,28,3,0,<       LAST STOPCD-PROGRAM NAME: >)
	CIN	(CINSUU,29,4,0,<                LAST STOPCD-UUO: >)
	CIN	(CINSPP,30,7,0,<               LAST STOPCD-P,PN: >)
	CIN	(CINPAR,31,5,2,<                PARITY SUBTABLE: >)
	CIN	(CINTPE,14,1,0,<           TOTAL MEM PAR ERRORS: >)
	CIN	(CINSPE,15,1,0,<   TOTAL SPURIOUS PARITY ERRORS: >)
	CIN	(CINMPC,16,1,0,<         MULTIPLE PARITY ERRORS: >)
	CIN	(CINMPA,17,0,0,<               LAST PARITY ADDR: >)
	CIN	(CINMPW,18,4,0,<               LAST PARITY WORD: >)
	CIN	(CINMPP,19,0,0,<                 LAST PARITY PC: >)
	CIN	(CINPLA,32,0,0,<   HIGHEST ADDR OF PARITY ERROR: >)
	CIN	(CINPMR,33,0,0,<  ADDRESS IN SEGMENT OF PAR ERR: >)
	CIN	(CINPTS,34,1,0,<        # PAR ERRORS THIS SWEEP: >)
	CIN	(CINPSC,35,1,0,<                       # SWEEPS: >)
	CIN	(CINPUE,36,1,0,<            USER ENABLED ERRORS: >)
	CIN	(CINPAA,37,4,0,<           LOGICAL AND  OF ADDR: >)
	CIN	(CINPAC,38,4,0,<            LOGICAL AND OF DATA: >)
	CIN	(CINPOA,39,4,0,<             LOGICAL OR OF ADDR: >)
	CIN	(CINPOC,40,4,0,<             LOGICAL OR OF DATA: >)
	CIN	(CINPCS,41,1,0,<   COUNT OF SPUR CHANNEL ERRORS: >)
	CIN	(CINRSP,42,5,3,<              RESPONSE SUBTABLE: >)
	CIN	(CINRSO,43,1,0,<            SUM TTY OUT UUO RES: >)
	CIN	(CINRNO,44,1,0,<                NUM TTY OUT UUO: >)
	CIN	(CINRHO,45,1,0,<          HI-SUM SQ TTY OUT UUO: >)
	CIN	(CINRLO,46,1,0,<          LO-SUM SQ TTY OUT UUO: >)
	CIN	(CINRSI,47,1,0,<                SUM TTY INP UUO: >)
	CIN	(CINRNI,48,1,0,<             NUMBER TTY INP UUO: >)
	CIN	(CINRHI,49,1,0,<          HI-SUM SQ TTY INP UUO: >)
	CIN	(CINRLI,50,1,0,<          LO-SUM SQ TTY INP UUO: >)
	CIN	(CINRSR,51,1,0,<            SUM QUANTUM REQ RES: >)
	CIN	(CINRNR,52,1,0,<         NUMBER QUANTUM REQ RES: >)
	CIN	(CINRHR,53,1,0,<          HI-SUM SQ QUANTUM RES: >)
	CIN	(CINRLR,54,1,0,<      LO-SUM SQ QUANTUM REQ RES: >)
	CIN	(CINRSX,55,1,0,<               SUM ONE OF ABOVE: >)
	CIN	(CINRNX,56,1,0,<            NUMBER ONE OF ABOVE: >)
	CIN	(CINRHX,57,1,0,<         HI-SUM SQ ONE OF ABOVE: >)
	CIN	(CINRLX,58,1,0,<         LO-SUM SQ ONE OF ABOVE: >)
	CIN	(CINRSC,59,1,0,<                    SUM CPU RES: >)
	CIN	(CINRNC,60,1,0,<                 NUMBER CPU RES: >)
	CIN	(CINRHC,61,1,0,<                 HI-SUM CPU RES: >)
	CIN	(CINRLC,62,1,0,<                 LO-SUM CPU RES: >)
	CIN	(CINUPT,0,5,4,<DUMMY TO GET CRLF>)
	CIN	(CINUPT,63,5,1,<                         UPTIME: >)
	CIN	(CINLST,64,5,1,<                      LOST TIME: >)
	CIN	(CINNUL,65,5,1,<                      NULL TIME: >)
	CIN	(CINOHT,66,5,1,<                  OVERHEAD TIME: >)
	CIN	(CINTUC,67,1,0,<                TOTAL UUO COUNT: >)
	CIN	(CINTJC,68,1,0,< TOTAL JOB CONTEXT SWITCH COUNT: >)
	CIN	(CINTNE,69,1,0,<                      TOTAL NXM: >)
	CIN	(CINSNE,70,1,0,<                 TOTAL SPUR NXM: >)
	CIN	(CINNJA,71,1,0,<       # JOBS AFFECTED LAST NXM: >)
	CIN	(CINMNA,72,0,0,<            FIRST ADDR LAST NXM: >)
	>;END OF CINALL DEFINITION
;LAST VALUE IS CINUNI , A
;COUNT OF DISK INFO BLOCKS IN THIS ENTRY,
;EACH HAS THE FORMAT
;SIXBIT NAME
;DSKCHR UUO RESULTS
;TOTAL # READS
;TOTAL # WRITES
;TOTAL # SEEKS
;# SOFT ERRORS
;# HARD ERRORS
;# MONITOR DETECTED ERRORS (RIB,ETC)
	RADIX 8

;NOW DEFINE SOMETHING TO DO WITH THE CIN MACRO AND THEN CALL IT
;VIA CINALL

	DEFINE CIN(A,B,C,D,E)<
	BYTE (^D9)B(6)C(3)D(^D18)<[ASCIZ/E/]>
	>
	RADIX 10
CINTAB:	CINALL
	0
	RADIX 8
;MEMLST--ROUTINE TO SET UP AND CALL ROUTINE TO LIST
;MEMORY CONFIG AT RELOAD. P2 HAS WHYKPG
MEMLST:	HLRZ	T1,P2			;UNLIKELY CODE
	CAIE	T1,707070		;GOOD?
	 POPJ	P,0			;OLD STYLE ENTRY
	SETOM	KFLAG			;ASSUME K PER BIT
	TRNE	P2,1B35			;1= USE PAGES
	 SETZM	KFLAG			;CHANGE IT
	MOVE	P1,WKBUFF+WHYBIT	;POINTER
	PUSHJ	P,BLDPTR		;CORRECT IT
	PUSH	P,P1			;SAVE IT
	SETCMM	0(P1)			;COMPLEMENT THE WHOLE TABLE
	AOBJN	P1,.-1			;UNTIL FINISHED
	TYPEIT	<
MEMORY ON-LINE AT RELOAD:
>
	POP	P,P2			;RETURN A GOOD POINTER
	PUSHJ	P,BITLST		;GO DO TRANSLATION
	POPJ	P,0			;BACK TO PROCSA


;HERE TO PROCESS AN ENTRY TYPE 14

SWE00A:	PUSHJ	P,.TCRLF
	TYPEIT	< 	EVENT TYPE: >
	CAIGE	P2,1
	 JRST	BADCOD
	CAILE	P2,6
	 JRST	BADCOD
	MOVE	T1,SWETYP(P2)
	PJRST	.TSIXN

BADCOD:	TYPEIT	<ILLEGAL EVENT TYPE, ABORTING ENTRY>
	JRST	ABORT
	
SWETYP:	Z
	SIXBIT	/POKE/
	SIXBIT	/SNOOP/
	SIXBIT	/TRPSET/
	SIXBIT	/RTTRP/
	SIXBIT	/MISC 1/
	SIXBIT	/MISC 2/


SWE00B:	PUSHJ	P,.TCRLF
	PUSHJ	P,.TTABC
	TYPEIT	<LOCATION OF USER:>
	PUSHJ	P,.TCRLF
	TYPEIT	<		NODE:>
	LDB	T1,[POINT 12,P2,11]
	PUSHJ	P,.TOCTW
	PUSHJ	P,.TCRLF
	TYPEIT	<		LINE:>
	LDB	T1,[POINT 12,P2,23]
	PUSHJ	P,.TOCTW
	PUSHJ	P,.TCRLF
	TYPEIT	<		TTY>
	LDB	T1,[POINT 12,P2,35]
	PJRST	.TOCTW


SWE00C:	PUSHJ	P,.TCRLF
	TYPEIT	<STORED DATA VALUES:>
	PUSHJ	P,.TCRLF
	ADDI	P2,WKBUFF
SWE00D:	HRRZ	T2,P2
	PUSHJ	P,.TTABC
	MOVE	T1,0(T2)
	PUSHJ	P,.TXWDW
	PUSHJ	P,.TCRLF
	AOBJN	P2,SWE00D
	POPJ	P,0





DEBLST:	TYPEIT	<
	OCTAL VALUE	SIXBIT VALUE>
	MOVN	P2,ENTRWC		;GET - LENGTH FROM HEADER
	HRLZS	P2			;MAKE AOBJN PTR
	ADDI	P2,WKBUFF		;A BETTER POINTER
	
DEBLSA:	PUSHJ	P,.TCRLF
	PUSHJ	P,.TTABC
	MOVE	P1,0(P2)		;GET A WORD
	MOVE	T1,P1
	PUSHJ	P,.TXWDW
	PUSHJ	P,.TTABC
	MOVE	T1,P1			;SAME WORD AGAIN
	PUSHJ	P,.TSIXN
	AOBJN	P2,DEBLSA		;MORE TO DO?
	POPJ	P,0			;NOPE

;HERE FOR CODE 71 ENTRIES P2 HOLDS LPTTYP

LPTLST:	TYPEIT	<
	CONTROLLER TYPE:	>
	LDB	T2,[POINT 6,P2,5]	;GET CONTROLLER TYPE-T2
	MOVE	T1,[SIXBIT/LP100/]	;ASSUME LP100
	CAIE	T2,2			;IS IT?
	 MOVE	T1,[SIXBIT/ BA10/]	;MUST BE BA10 OR ELSE...
	PUSHJ	P,.TSIXN		;LIST THE TYPE
	PUSHJ	P,.TCRLF
	TYPEIT	<	LAST DATA WORD SENT:	>
	MOVE	T1,WKBUFF+LPTWRD	;GET THAT WORD
	PUSHJ	P,.TXWDW		;IN HALF WORD
	PUSHJ	P,.TCRLF
	TYPEIT	<	CONI AT ERROR:	>
	MOVE	T1,WKBUFF+LPTCNI	;GET THE CONI
	PUSH	P,T1			;SAVE IT
	PUSHJ	P,.TXWDW		;HALF WORD
	POP	P,P4			;CONI VALUE BACK
	TLNN	P2,(1B4)		;IS CONTROLLER LP100?
	 POPJ	P,0			;NO DON'T XLATE CONI
	PUSH	P,P4			;SAVE CONI
	TYPEIT	< = >
	MOVE	P1,P4			;VALUE TO TRANSLATE
	MOVEI	T1,5			;OFFSET TO BIT TABLES
	MOVEM	T1,KONTYP		;SETUP
	PUSHJ	P,CNIDCD		;DO TRANSLATION
;NOW DO BYTE TRANSLATION SUCH AS CHARACTER SET ETC.

	POP	P,P4			;VALUE BACK TO P4
	TYPEIT	<
	VFU TYPE:	>
	LDB	T2,[POINT 2,P4,1]	;GET TYPE FIELD
	MOVEI	T1,[ASCIZ/OPTICAL/]	;ASSUME 0
	CAIN	T2,1			;IF 1
	 MOVEI	T1,[ASCIZ/DIRECT ACCESS/]
	CAIN	T2,2			;IF 2
	 MOVEI	T1,[ASCIZ/NONE/]
	PUSHJ	P,.TSTRG		;SAY WHAT'S IN T1
	TYPEIT	<
	CHARACTER SET:	>
	LDB	T2,[POINT 3,P4,25]	;GET CHAR SET FIELD
	MOVEI	T1,[ASCIZ/64 CHAR/]	;ASSUME 0
	CAIN	T2,1			;IF 1
	 MOVEI	T1,[ASCIZ/96 CHAR/]
	CAIN	T2,2
	 MOVEI	T1,[ASCIZ/128 CHAR/]
	CAIN	T2,3
	 MOVEI	T1,[ASCIZ/VARIABLE/]
	PUSHJ	P,.TSTRG		;AGAIN,LIST SOMETHING
	TYPEIT	<
	PAGE COUNTER:	>
	LDB	T1,[POINT ^D12,P4,17]	;CONTENTS OF PAGE COUNTER
	PUSHJ	P,.ODECW		;IN DECIMAL WITH A "."
	POPJ	P,0			;THAT'S ALL THERE IS TO LIST
;INSERT CODE HERE FOR ENTRY 72
;HCC00A - ROUTINE TO TYPE OUT CONTROLLER TYPE
;CALLED WITH HCCTYP IN P2

HCC00A:	PUSHJ	P,.TCRLF
	TYPEIT	<CONTROLLER TYPE:	>
	LDB	T2,[POINT 6,P2,5]	;GET CTRLR TYPE BYTE
	CAIGE	T2,1			;MUST FALL IN
	 JRST	HCC00D			;RANGE OF
	CAILE	T2,4			;1 TO 4
	 JRST	HCC00D			;ELSE DIE
	MOVE	T1,HCCTTB(T2)		;GET NAME
	PUSHJ	P,.TSIXN		;TYPE IT
	POPJ	P,0

HCC00B:	PUSHJ	P,.TCRLF
	TYPEIT	<DEVICE TYPE:		>
	LDB	T2,[POINT 6,P2,11]	;GET DEVICE TYPE BYTE
	CAIGE	T2,1			;MUST FALL INTO RANGE
	 JRST	HCC00E			;OF 1 TO 4
	CAILE	T2,4			;ELSE
	 JRST	HCC00E			;DIE
	MOVE	T1,HCCDTT(T2)		;GET NAME
	PUSHJ	P,.TSIXN		;TYPE IT
	POPJ	P,0

HCC00C:	LDB	T2,[POINT 6,P2,5]	;GET CONTROLLER TYPE BYTE
	CAIN	T2,1
	 JRST	HCCBAE			;DISPATCH FOR BA10
	CAIN	T2,2
	 JRST	HCCLP1			;DISPATCH FOR LP100
	CAIN	T2,3
	 JRST	HCCLP2			;DISPATCH FOR LP20
	CAIN	T2,4
	 JRST	HCCCD2			;DISPATCH FOR CD20

HCCBAE:	LDB	T2,[POINT 6,P2,11]	;GET DEVICE TYPE BYTE
	CAIN	T2,1
	 JRST	HCBALP			;DISPATCH FOR LPT
	CAIN	T2,2
	 JRST	HCBACR			;DISPATCH FOR CDR
	CAIN	T2,3
	 JRST	HCBACP			;DISPATCH FOR CDP
	CAIN	T2,4
	 JRST	HCBAPL			;DISPATCH FOR PLT

HCCLP1:	PUSHJ	P,.TCRLF
	TYPEIT	<VFU TYPE:		>
	HRRZ	T2,WKBUFF+HCCSBP	;GET OFFSET FROM PTR
	ADDI	T2,WKBUFF		;ADD WKBUFF TO IT
	MOVEM	T2,SUBLK1		;STORE IT
	MOVE	P2,WKBUFF+HCCTYP	;GET TYPE WD
	LDB	T2,[POINT 6,P2,11]	;GET DEV TYPE BYTE
	CAIE	T2,1			;IS IT A LPT?
	 JRST	HCLP1E			;NO, ITS AN ERROR
	MOVE	T1,SUBLK1		;GET PTR TO SUB-BLOCK
	ADDI	T1,HCCCLP		;POINT IT TO CORRECT WD
	MOVE	P2,0(T1)		;GET THE WD
	LDB	T2,[POINT 2,P2,1]	;GET VFU TYPE BYTE
	MOVE	T1,HCVFT(T2)		;FOR USE AS INDEX
	PUSHJ	P,.TSTRG		;TYPE THE STRING
	PUSHJ	P,.TCRLF		;AND A CRLF
	TYPEIT	<CHARACTER SET:		>
	LDB	T2,[POINT 2,P2,25]	;GET CHAR SET BYTE
	MOVE	T1,HCCSET(T2)		;GET STRING
	PUSHJ	P,.TSTRG		;TYPE IT
	PUSHJ	P,.TCRLF		;AND A CRLF
	TYPEIT	<CONI AT ERROR:		>	;THIS IS NEXT ITEM
	MOVE	T1,SUBLK1		;GET PTR TO SUB-BLOCK
	ADDI	T1,HCCCLP		;POINT IT TO CORRECT WD
	MOVE	P2,0(T1)		;GET THE WD
	MOVE	T1,P2
	PUSHJ	P,.TXWDW		;TYPE IT
	PUSHJ	P,.TTABC
	MOVEI	T1,5			;LP100 =5
	MOVEM	T1,KONTYP		;FOR CNIDCD
	MOVE	P1,P2			;WD TO XLATE
	PUSHJ	P,CNIDCD
	PUSHJ	P,.TCRLF
	TYPEIT	<LAST DATA WD:		>
	MOVE	T1,SUBLK1		;GET PTR TO SUB-BLOCK
	ADDI	T1,HCCLWD		;POINT IT TO CORRECT WD
	MOVE	P2,0(T1)		;GET THE WD
	MOVE	T1,P2
	PUSHJ	P,.TXWDW		;TYPE IT
	POPJ	P,0


HCLP1E:	TYPEIT	<LP100 ERROR DEVICE IS NOT A LPT, ABORTING ENTRY>
	JRST	ABORT

;HERE TO PRINT LP20 DEVICE REGISTERS

HCCLP2:	HRLI	P2,LP$REG		;ADDRESS OF REGISTER NAMES
	HRRI	P2,LP$CON		;CONTROL TABLE ADDRESSES
	JRST	LPCD20			;GO PROCESS

;HERE FOR CD20 DEVICE REGISTERS

HCCCD2:	HRLI	P2,CD$REG		;ADDRESSES OF CARD READER NAMES
	HRRI	P2,CD$CON		;CONTROL TABLE ADDRESSES
LPCD20:	TYPEIT <
	UBA STATUS:	>
	MOVE	P1,WKBUFF+HCCSBP	;GET OFFSEST INTO SUBTABLE
	ADDI	P1,WKBUFF		;MAKE IT A REAL ADDRESS
	MOVE	T1,(P1)			;GET UBA
	PUSHJ	P,.TXWDW		;TYPE UBA
	MOVEI	T1,6			;GET UBA MASK OFFSET
	MOVEM	T1,KONTYP		;AND SET UP FOR CNIDCD
	TYPEIT	< = >
	PUSH	P,P2			;SAVE P2 SINCE CNIDCD BLOWS IT
	PUSH	P,P1			;SAVE POINTER
	MOVE	P1,(P1)			;AND GET THE UBA AGAIN
	PUSHJ	P,CNIDCD		;THEN TRANSLATE IT
	TYPEIT	<
	UBA MAP:	>
	AOS	P1,(P)			;LOAD INCREMENTED POINTER
	MOVE	T1,(P1)			;GET UBA MAP
	PUSHJ	P,.TXWDW		;TYPE THE MAP
	PUSHJ	P,.TCRLF		;CR/LF
	MOVEI	T1,[ASCIZ/	LP20 /]
	HRRZ	P2,-1(P)		;GET RH OF ARGUMENT
	CAIE	P2,LP$CON		;LP20?
	MOVEI	T1,[ASCIZ/	CD20 /]	;NO. LOAD CORRECT NAME
	PUSHJ	P,.TSTRG
	TYPEIT	<DEVICE REGISTERS
>
	MOVEI	T1,-^D8			;ASSUME LP20
	CAIE	P2,LP$CON		;IS IT?
	MOVEI	T1,-4			;NO. CD20 USES ONLY 4 REGISTERS
	HRLM	T1,(P)			;SET POINTER LENGTH
	AOS	P1,(P)			;POINT TO SUBTABLE
LC2LUP:	MOVE	T2,(P1)			;HACK TO PACK 11-BYTES FOR LSTEB
	LSHC	T1,^D18			;LOAD FIRST BYTE
	LSH	T2,2			;LEFT JUSTIFY SECOND BYTE
	LSHC	T1,^D20			;PACK BOTH BYTES LEFT-JUSTIFIED
	MOVEM	T1,(P1)			;AND PUT THEM BACK
	AOBJN	P1,LC2LUP		;TILL END OF SUBTABLE
	POP	P,P1			;RESET POINTER FOR LSTEB
	POP	P,P2			;AND RESTORE ORIGINAL ARGUMENT
	PUSHJ	P,LSTEB			;TO LIST DEVICE REGISTERS
	PUSHJ	P,TITLST		;GO TO NEXT PAGE
	POPJ	P,

HCBALP:	PUSHJ	P,.TCRLF
	TYPEIT	<CONI LPT:	>
	HRRZ	T2,WKBUFF+HCCSBP	;GET OFFSET FROM PTR
	ADDI	T2,WKBUFF		;ADD WKBUFF TO IT
	MOVEM	T2,SUBLK1		;STORE IT
	MOVE	T1,SUBLK1		;GET PTR TO SUB-BLOCK
	ADDI	T1,HCCCBA		;POINT IT TO CORRECT WD
	MOVE	P2,0(T1)		;GET THE WD
	MOVE	T1,P2
	PJRST	.TXWDW			;TYPE IT

HCBACR:	PUSHJ	P,.TCRLF
	TYPEIT	<CONI CDR:	>
	HRRZ	T2,WKBUFF+HCCSBP	;GET OFFSET FROM PTR
	ADDI	T2,WKBUFF		;ADD WKBUFF TO IT
	MOVEM	T2,SUBLK1		;STORE IT
	MOVE	T1,SUBLK1		;GET PTR TO SUB-BLOCK
	ADDI	T1,HCCCBA		;POINT IT TO CORRECT WD
	MOVE	P2,0(T1)		;GET THE WD
	MOVE	T1,P2
	PJRST	.TXWDW			;TYPE IT

HCBACP:	PUSHJ	P,.TCRLF
	TYPEIT	<CONI CDP:	>
	HRRZ	T2,WKBUFF+HCCSBP	;GET OFFSET FROM PTR
	ADDI	T2,WKBUFF		;ADD WKBUFF TO IT
	MOVEM	T2,SUBLK1		;STORE IT
	MOVE	T1,SUBLK1		;GET PTR TO SUB-BLOCK
	ADDI	T1,HCCCBA		;POINT IT TO CORRECT WD
	MOVE	P2,0(T1)		;GET THE WD
	MOVE	T1,P2
	PJRST	.TXWDW			;TYPE IT

HCBAPL:	PUSHJ	P,.TCRLF
	TYPEIT	<CONI PLT:	>
	HRRZ	T2,WKBUFF+HCCSBP	;GET OFFSET FROM PTR
	ADDI	T2,WKBUFF		;ADD WKBUFF TO IT
	MOVEM	T2,SUBLK1		;STORE IT
	MOVE	T1,SUBLK1		;GET PTR TO SUB-BLOCK
	ADDI	T1,HCCCBA		;POINT IT TO CORRECT WD
	MOVE	P2,0(T1)		;GET THE WD
	MOVE	T1,P2
	PJRST	.TXWDW			;TYPE IT


HCC00D:	TYPEIT	<ILLEGAL CONTROLLER TYPE, ABORTING ENTRY>
	JRST	ABORT

HCC00E:	TYPEIT	<ILLEGAL DEVICE TYPE, ABORTING ENTRY>
	JRST	ABORT

HCCTTB:		Z
	SIXBIT	/BA10/
	SIXBIT	/LP100/
	SIXBIT	/LP20/
	SIXBIT	/CD20/

HCCDTT:		0
	SIXBIT	/LPT/
	SIXBIT	/CDR/
	SIXBIT	/CDP/
	SIXBIT	/PLT/

HCVFT:	[ASCIZ /PAPER TAPE/]
	[ASCIZ /DAVFU/]
	[ASCIZ /NO VFU/]
	[ASCIZ /UNKNOWN/]

HCCSET:	[ASCIZ /64 CHARACTER/]
	[ASCIZ /96 CHARACTER/]
	[ASCIZ /128 CHARACTER/]
	[ASCIZ /INTERCHANGEABLE/]

;TABLES FOR LP20 REGISTER LISTING

LP$REG:	SIXBIT/LPCSRA/
	SIXBIT/LPCSRB/
	SIXBIT/LPBSAD/
	SIXBIT/LPBCTR/
	SIXBIT/LPPCTR/
	SIXBIT/LPRAMD/
	SIXBIT/LPCCTR/
	SIXBIT/LPTDAT/

LP$CON:	7,,0
	10,,0
	-1,,NOTRAN
	-1,,NOTRAN
	-1,,NOTRAN
	-1,,NOTRAN
	-1,,LPCLST
	-1,,LPDLST

;TABLES FOR CD20 REGISTER LISTING

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

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

;SPECIAL TRANSLATION FOR LP20 REGISTERS

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

LPDLST:	MOVE	P1,T1			;GET WORD
	TYPEIT	<CHKSUM = >
	LDB	T1,[POINT 8,P1,27]	;UPPER BYTE
	PUSHJ	P,.TXWDW
	TYPEIT	< LPT DATA = >
	LDB	T1,[POINT 8,P1,35]	;LOWER BYTE
	PUSHJ	P,.TXWDW
	PUSHJ	P,.TCRLF
	POPJ	P,
;HERE TO PROCESS DISK STATISTICS ER.DSC CODE 45

DSC00A:	PUSHJ	P,.TCRLF
	TYPEIT	<						***		  ERROR COUNTS			     ***>
	PUSHJ	P,.TCRLF
	TYPEIT	<			BLOCKS	BLOCKS		!							!>
	PUSHJ	P,.TCRLF
	TYPEIT	<UNIT	PACK	SEEKS	READ	WRITTEN		DATA	DEVICE	SEEK	HUNG	SAT	RIB	CHECKSUM>
	PUSHJ	P,.TCRLF

	HRRZ	P1,P2			;GET THE OFFSET
	ADDI	P1,WKBUFF		;MAKE IT A REAL ADDRESS
DSC0LP:	HLRE	P3,0(P1)		;GET WD CNT FROM 1ST ENTRY
	MOVNS	P3			;MAKE POSITIVE
	ADDI	P3,1			;ADJUST FOR EXTRA WD
	MOVE	T1,DSCNAM(P1)		;GET NAME
	PUSHJ	P,.TSIXN
	PUSHJ	P,.TTABC
	MOVE	T1,DSCHID(P1)		;GET STR NAME
	PUSHJ	P,.TSIXN
	PUSHJ	P,.TTABC
	MOVE	T1,DSCMSC(P1)		;GET MONITOR SEEKS
	MOVE	T2,DSCUSC(P1)		;GET USER SEEKS
	ADD	T1,T2			;ADD THEM
	PUSHJ	P,.TDECW
	PUSHJ	P,.TTABC
	MOVE	T1,DSCBRC(P1)		;GET COUNT OF BUFFERED READS
	MOVE	T2,DSCDRC(P1)		;GET COUNT OF DUMP MODE READS
	ADD	T1,T2			;GET TOTAL
	MOVE	T2,DSCMRC(P1)		;GET COUNT OF MONITOR READS
	ADD	T1,T2			;ADD THEM
	MOVE	T2,DSCICT(P1)		;GET SWAPPER READS
	ADD	T1,T2			;ADD FOR TOTAL READS
	PUSHJ	P,.TDECW
	PUSHJ	P,.TTABC
	MOVE	T1,DSCBWC(P1)		;GET COUNT OF BUFFERED WRITES
	MOVE	T2,DSCDWC(P1)		;GET COUNT OF DUMP WRITES
	ADD	T1,T2			;ADD THEM
	MOVE	T2,DSCMWC(P1)		;GET COUNT OF MONITOR WRITES
	ADD	T1,T2			;ADD THEM
	MOVE	T2,DSCOCT(P1)		;GET COUNT OF SWAPPER WRITES	[1336]
	ADD	T1,T2			;ADD FOR TOTAL WRITES
	PUSHJ	P,.TDECW
	PUSHJ	P,.TTABC
	PUSHJ	P,.TTABC
	MOVE	P4,DSCSCT(P1)		;GET COUNT OF ERRORS
	HRRZ	T1,P4			;GET DATA ERRORS ALONE
	PUSHJ	P,.TDECW
	PUSHJ	P,.TTABC
	HLRZ	T1,P4			;GET DEVICE ERRORS ALONE
	PUSHJ	P,.TDECW
	PUSHJ	P,.TTABC
	MOVE	P4,DSCPCT(P1)		;GET COUNT OF SEEK ERRORS
	HRRZ	T1,P4			;GET SEEK INC'S
	HLRZ	T2,P4			;GET POSITON FAILS
	ADD	T1,T2			;ADD THEM
	PUSHJ	P,.TDECW
	PUSHJ	P,.TTABC
	MOVE	P4,DSCHNG(P1)		;GET HUNG COUNT WD
	LDB	T1,[POINT 9,P4,8]	;GET NTHUNG BYTE
	LDB	T2,[POINT 9,P4,17]	;GET THUNG BYTE
	ADD	T1,T2			;ADD THEM
	LDB	T2,[POINT 9,P4,26]	;GET PHUNG BYTE
	ADD	T1,T2			;ADD THEM
	LDB	T2,[POINT 9,P4,35]	;GET SHUNG BYTE
	ADD	T1,T2			;ADD THEM FOR TOTAL
	PUSHJ	P,.TDECW
	PUSHJ	P,.TTABC
	MOVE	P4,DSCMCT(P1)
	LDB	T1,[POINT 12,P4,11]	;GET SAT BYTE
	PUSHJ	P,.TDECW
	PUSHJ	P,.TTABC
	LDB	T1,[POINT 12,P4,23]	;GET RIB BYTE
	PUSHJ	P,.TDECW
	PUSHJ	P,.TTABC
	LDB	T1,[POINT 12,P4,35]	;GET CHECKSUM BYTE
	PUSHJ	P,.TDECW
	PUSHJ	P,.TCRLF
	ADD	P1,P3
	AOBJN	P2,DSC0LP
	POPJ	P,0
;TMEA -- ROUTINE TO LIST ERROR CODE 20 ENTRIES.

	FUNMSK==17000			;LOCATION OF FUNCTION MASK IN CONI TMC.
	FUNSFT==11			;HOW FAR TO SHIFT IT.
	DENMSK==300			;MASK FOR DENSITY BITS.
	DENSFT==6			; SHIFTER.
	CORDMP==20000			; CORE DUMP BIT.
	PARTYP==40000			; PARITY BIT.
	STRK==4				;7 TRACK BIT.
	WLOCK==10			;WRITE LOCK BIT.

TMEA:	TYPEIT	<
	OPERATION:	   >
	MOVE	T4,WKBUFF+MAGICC	;GET INITIAL CONI TMC.
	MOVE 	T3,T4			;SAVE IT.
	ANDI	T3,FUNMSK		;STRIP OFF FUNCTION BITS.
	LSH	T3,-FUNSFT		;MOVE IT OVER.
	MOVEI	T1,@FUNMSG(T3)		;GET ADDRESS OF TEXT CORRESPON-
					;DING TO FUNCTION.
	PUSHJ	P,.TSTRG		;TYPE IT OUT.
	TYPEIT	<
	STATUS:            >
	MOVE	T3,WKBUFF+MAGICC	;GET CONI TMC AGAIN.
	ANDI	T3,DENMSK		;STRIP OFF DENSITY BITS.
	LSH	T3,-DENSFT		;MOVE IT OVER.
	MOVEI	T1,@DENMSG(T3)		;GET ADDRESS OF DENSITY MESSAGE.
	PUSHJ	P,.TSTRG		;PRINT IT.
	MOVE	T3,WKBUFF+MAGICC	;GET THAT WORD AGAIN.
	TRNN	T3,PARTYP		;ODD PARITY?
	JRST	TME.1			;NO, SAY EVEN PARITY.
	TYPEIT	<  ODD PARITY,>
	JRST	TME.2			;GO AROUND EVEN PARITY MSG.
TME.1:	TYPEIT	< EVEN PARITY,>
TME.2:	TRNN	T3,CORDMP		;CORE DUMP = 1?
	JRST	TME.3			;NO, DON'T SAY ANYTHING.
	TYPEIT	< CORE DUMP,>
TME.3:	MOVE	T3,WKBUFF+MAGICS	; CONI TMS.
	TRNN	T3,STRK			;7 OR 9?
	JRST	TME.4			;9.
	TYPEIT	< 7 TRACK,>
	JRST	TME.5			;GO AROUND 9.
TME.4:	TYPEIT	< 9 TRACK,>
TME.5:	MOVE	T3,WKBUFF+MAGICS	;GET IT AGAIN.
	TRNN	T3,WLOCK		;WRITE LOCKED?
	JRST	TME.6			;NO
	TYPEIT	< WRITE LOCKED
>
	JRST	TME.7
TME.6:	TYPEIT	< WRITE ENABLED
>
TME.7:	TYPEIT	<
ERROR DIAGNOSIS   >
	MOVE	P1,WKBUFF+MAGICS	;GET CONI TMS AGAIN.
	MOVE	T1,KONTYP		;GET CONTROLLER TYPE
	MOVE	T2,KONMSK(T1)		;GET MASK FOR THIS CONI.
	TDNN	P1,T2			;ANY ERROR BITS?
	JRST	TME.10			;NO.
	MOVE	T1,WKBUFF+MAGRTC	;GET # OF RETRIES.
	TLNN	T1,ERRHRD		;RECOVERABLE?
	JRST	TME.14			;NO.
	TYPEIT	<
	NON-RECOVERABLE >
	JRST	TME.15
TME.14:	TYPEIT	<
	RECOVERABLE >
TME.15:	PUSHJ	P,CNIDCD		;GO GET ERROR TRANSLATION.
	JRST	TME.11			;GO AROUND
TME.10:	TYPEIT	<	SOFTWARE ERROR!!>
TME.11:	TYPEIT	<

ERROR ANALYSIS:
	ERROR LOCATION:         RECORD >
	MOVE	T1,WKBUFF+MAGRFF	;GET # OF REC FROM EOF
	ADDI	T1,1			;THIS IS IN NEXT RECORD.
	PUSHJ	P,.ODECW		;TYPE IT.
	TYPEIT	( OF FILE )
	MOVE	T1,WKBUFF+MAGFFB	;GET # OF FILES FROM BOT.
	ADDI	T1,1			;AGAIN, NEXT FILE.
	PUSHJ	P,.ODECW		;TYPE THIS TOO.
	TYPEIT	<
	CONI TMS AT ERROR:      >
	MOVE	T1,WKBUFF+MAGICS	;GET THAT ONE AGAIN
	PUSHJ	P,.TXWDW		;TYPE IT IN HALF WORD.
	TYPEIT	< = >
	MOVE	P1,WKBUFF+MAGICS	;SETUP AND
	PUSHJ	P,CNIDCD		;CALL TRANSLATOR.
	TYPEIT	<
	CONI TMS AT END:        >
	MOVE	T1,WKBUFF+MAGFCS	;GET FINAL CONI TMS
	PUSHJ	P,.TXWDW		;TYPE IT ALSO
	MOVE	P1,WKBUFF+MAGFCS
	MOVE	T1,KONTYP		;GET CONTROLLER TYPE
	MOVE 	T2,KONMSK(T1)		;AND ERROR MASK.
	TYPEIT	< = >
	TDNN	P1,T2			;ANY ERRORS STILL AROUND?
	JRST	TME.12			;NO
	PUSHJ	P,CNIDCD		;TRANSLATE
	JRST	TME.13
TME.12:	TYPEIT	<  NO ERROR BITS DETECTED.>
TME.13:	TYPEIT	<
	RETRIES PERFORMED:      >
	HRRZ	T1,WKBUFF+MAGRTC	;GET # RETRYS WITHOUT ERRHRD BIT.
	PUSHJ	P,.ODECW		;LIST THIS TOO.
	TYPEIT	<
>					;ADD A LITTLE SPACE AND
	SKIPN	WKBUFF+MAGMED		;WAS THIS 10TH ERROR?
	POPJ	P,0			;NO
	MOVEI	T1,@FOO			;GET ADDRESS OF MESSAGE
	PUSHJ	P,.TSTRG		;AND OUTPUT IT.
	MOVEI	T1,@FOOA
	PUSHJ	P,.TSTRG
	MOVEI	T1,@FOOB
	PUSHJ	P,.TSTRG
	MOVEI	T1,@FOOC
	PUSHJ	P,.TSTRG
	POPJ	P,0			;GO HOME.

;HERE ARE THE MESSAGES FOR THE FUNCTION DECODE
;AND DENSITY MESSAGES.  INDEXED BY FUNCTION CODE.

FUNMSG:	[ASCIZ\	NO-OP\]

	[ASCIZ\	REWINDING\]
	[ASCIZ\	READ RECORD\]
	[ASCIZ\	READ-COMPARE RECORD\]	
	[ASCIZ\	WRITE\]
	[ASCIZ\	MARK END OF FILE\]
	[ASCIZ\ SPACE RECORDS FORWARD\]
	[ASCIZ\	SPACE RECORDS REVERSE\]
	[ASCIZ\ INTERRUPT WHEN UNIT READY\]
	[ASCIZ\	REWIND AND UNLOAD\]
	[ASCIZ\	READ MULTIRECORD\]
	[ASCIZ\	READ-COMPARE MULTIRECORD\]
	[ASCIZ\	ERASE AND WRITE\]
	[ASCIZ\	ERASE\]
	[ASCIZ\	SPACE FILE FORWARD\]
	[ASCIZ\	SPACE FILE REVERSE\]

DENMSG:	[ASCIZ\	200 BPI,\]
	[ASCIZ\	556 BPI,\]
	[ASCIZ\	800 BPI,\]
	[ASCIZ\	800 BPI,\]
;ERDIAG -- SUBROUTINE TO DIAGNOSE POSSIBLE CAUSE OF ENTRY
;CALL	PUSHJ	P,ERDIAG
;
;RETURN	CALL+1
ERDIAG:	TYPEIT	<
	DISK CHARACTERISTICS:	>
	MOVE	T1,P2			;PICKUP DSKCHR WORD
	PUSHJ	P,.TXWDW		;TYPE IT
;CODE ADDED WITH EDIT 140 TO LIST USER'S ID ETC

	TYPEIT	<

	USER'S ID:	>
	MOVE	T1,WKBUFF+HDEUID	;GET P,PN
	PUSHJ	P,.TPPNW
	MOVEI	T1,[ASCIZ/
	USER'S PGM:	/]
	PUSHJ	P,.TSTRG
	MOVE	T1,WKBUFF+HDEPGM	;GET PROGRAM NAME
	PUSHJ	P,.TSIXN
	MOVEI	T1,[ASCIZ/
	USER'S FILE:	/]
	PUSHJ	P,.TSTRG
	MOVE	T1,WKBUFF+HDEFIL	;GET FILE REFERENCED
	HLRZ	T2,WKBUFF+HDEEXT	;GET EXTENSION
	CAIN	T2,'UFD'		;IF UFD DO SPECIAL FILE NAME
	 PUSHJ	P,[PUSHJ	P,.TPPNW
			AOS	0(P)
			POPJ	P,0]
	PUSHJ	P,.TSIXN
	TYPEIT	<.>
	HLLZ	T1,WKBUFF+HDEEXT	;EXTENSION IN LEFT HALF
	PUSHJ	P,.TSIXN
;END EDIT 140


;START [1300]
	MOVE	P2,WKBUFF + HDEECT	;GET RETRIES WORD
	TLNN	P2,ERRHNG		;HUNG DEVICE?
	 JRST	ERDGNA			;NO
	TYPEIT	<
	THIS ENTRY CREATED AS A RESULT OF A 'HUNG DEVICE'
>
	HRRZ	T1,P2			;RETRY COUNT ALONE
	SKIPE	T1			;IF ZERO,
	 JRST ERDGNA	
	TYPEIT	<
	REGISTER VALUES ARE FOR LAST UNIT THE CONTROLLER WAS 'CONNECTED' TO
	NOT THE UNIT NAMED ABOVE, ABOVE UNIT WAS TRYING TO BE CONNECTED.
>
;END [1300]
ERDGNA:	TYPEIT	<
ERROR DIAGNOSIS
	>
	MOVE	P3,KONTYP		;PICKUP TYPE OF CONTROLLER 0=RC, 1=RP,4=RH10
	MOVE	P2,WKBUFF+HDESOF	;PICKUP 1CONI WORD
	MOVE	P4,KONMSK(P3)		;PICKUP CONTROLLER ERROR MASK
	TDNE	P4,P2			;ANY ERROR BITS LIT
	JRST	HARDCK			;YES-GO DO BIT DECODING
	TYPEIT	<SOFTWARE-DETECTED >
	MOVEI	P3,2			;SAY IT WAS A SOFTWARE DEVICE
	MOVEM	P3,KONTYP		;(EDIT 102)SET IT TO POINT AT SOFTWARE!!
	MOVE	P2,S			;PICKUP SOFTWARE STATUS FLAGS
	JRST	SAYIT			;PUBLISH TEXT

HARDCK:	AND	P2,P4			;APPLY MASK TO CONI WORD
	MOVE	T1,WKBUFF+HDEECT	;PICKUP RETRY WORD
	TLNN	T1,ERRHRD		;IF BIT 1 = 1 ERROR WAS NON-RECOVERABLE
	JRST	SOFTCK			;IT WAS RECOVERABLE
	TYPEIT	<NON-RECOVERABLE >
	JRST	SAYIT
SOFTCK:	TYPEIT	<RECOVERABLE >
SAYIT:	LSH	P2,@MINERB(P3)		;SHIFT WORD LEFT TILL FIRST KNOWN
					;ERROR BIT POSITION IS IN SIGN BIT
	MOVE	P4,DEVTYP(P3)		;PICKUP ASCIZ TEXT POINTER FOR ERROR BITS
	PUSHJ	P,JFLOOP		;EXIT TO TYPEOUT ENGLISH TRANSLATION
;ADDED WITH EDIT 122
	LDB	P1,[POINT 9,WKBUFF+HDECCT,17]	;GET NUMBER OF SLOTS
	TYPEIT	<
	REMAINING ENTRIES IN
	UNIT'S BAT BLOCK:	>
	MOVE	T1,P1			;GET COUNT
	CAIN	T1,777			;=UNKNOWN?
	 JRST	SAYITA			;YES
	PUSHJ	P,.ODECW		;SAY IT IN DECIMAL
	PJRST	.TCRLF			;EXIT WITH SOME SPACE
SAYITA:	TYPEIT	<UNKNOWN>
	PJRST	.TCRLF
DEVTYP:	RC10DV
	RP10DV
	SOFTDV
	TM10DV
	RH10DV
	LPTDEV
	UBADV
	LPSADV
	LPSBDV
	CDSTDV
;CHNDCD -- SUBROUTINE TO ASSEMBLE ACTUAL COMMAND LIST
;BASED ON TERMINATION WORD WRITTEN BY CHANNEL
;CALL	PUSHJ P,CHNDCD
;
;RETURN	CALL+1

CHNDCD:	TYPEIT	<
	CHANNEL	COMMAND LIST:	>
	HLRZ	T1,WKBUFF+CPEFCW	;PICKUP TERMINATION CHANNEL WORD
	HRRZ	T2,WKBUFF+CPEICW	;PICKUP INITIAL CW
	CAMG	T1,T2			;IS TERM ADD GREATER THAN INIT CW ADDRESS
	JRST	ENTWD3			;NO ONLY WD3 IN LIST IS VALID
	CAIN	T1,1(T2)		;IS TERM ADD = INIT +1
	JRST	ENTWD2			;YES ONLY LIST WDS 2+3 OF CHAN CMD LIST
ENTWD1:	MOVE	T1,P2			;PICKUP 1ST WORD IN LIST
	PUSHJ	P,.TXWDW		;TYPE OUT IN HALFWORD FORMAT
	TYPEIT	<
				>
ENTWD2:	MOVE	T1,WKBUFF+CPECW1	;PICKUP CW #1
	PUSHJ	P,.TXWDW
	TYPEIT	<
				>
ENTWD3:	MOVE	T1,WKBUFF+CPECW0	;PICKUP WD3
	PUSHJ	P,.TXWDW
	POPJ	P,
;CNXDCD -- ROUTINES TO DECODE CONI BITS IN CONI WORD
;CALL	PUSHJ	P,CNXDCD
;
;RETURN	CALL+1

;ENTRY FOR 1CONI WORD
CN1DCD:	TYPEIT	<
	CONI AT ERROR TIME:	>
	JRST	CONIGO

;ENTRY FOR 2CONI WORD
CN2DCD:	TYPEIT	<
	CONI AFTER "RECAL":	>
CONIGO:	MOVE	T1,P2			;PICKUP CONI WORD
	PUSHJ	P,.TXWDW		;OUTPUT IT
	TYPEIT	<  =  >
	MOVE	T1,WKBUFF+HDEDCR	;PICKUP DSKCHR WORD
	MOVEI	P4,RP10DV		;ASSUME ITS A DISKPACK
	TRNE	T1,1B26			;IS IT A FIXED HEAD
	MOVEI	P4,RC10DV		;PICKUP CONI TABLE ADDRESS FOR RC10
	TRNE	T1,1B24			;IS IT A RH10?
	MOVEI	P4,RH10DV		;SAY SO
	MOVE	P3,KONTYP		;PICKUP CONTROLLER TYPE
	AND	P2,KONMSK(P3)
	LSH	P2,@MINERB(P3)
	PUSHJ	P,JFLOOP		;GO DECODE BITS AND OUTPUT TEXT
	TLNE	F,F.JFFO		;DID WE SEE ANY TEXT BIT
	POPJ	P,			;YES GO AWAY
	TYPEIT	<NO ERROR BITS DETECTED>
	POPJ	P,


;BLKIND-- SUBROUTINE TO FIND ADDRESS OF A SCRATCH BLOCK
;IN THE LOW SEG FOR THIS DEVICE WHICH IS SPECIFIED TO
;THIS SUBROUTINE IN SIXBIT.
;CALL P3=SIXBIT DEVICE NAME TO BE SEARCHED FOR
;	PUSHJ	P,BLKIND
;RETURNS CALL+1 IFERROR,NAME ISNT INTABLE ORIS DUPLICATED
;	CALL+2 IF GOOD AND P3 =ADDRESS OF SCRATCH BLOCK

BLKIND:	TRNE	P3,7777			;EDIT132  FUNNY NAME?
	 PUSHJ	P,FIXNAM		;FIX IT
	MOVE	T1,[IOWD NAMLTH,NAMTBL];P3 ALREADYSETUP
	PUSHJ	P,.NAME			;LETSCANDO WORK
	  POPJ	P,			; LET CALLER HANDLE ERROR
	TLZ	T1,-1			;CLR LH
	SUBI	T1,NAMTBL		;T1 NOW = OFFSET
	MOVE	P3,BKLOC(T1)		;SETUP P3 TO RETURN
	AOS	(P)			;AND GIVESKIP
	POPJ	P,			;RETURN
;LBNDCD -- SUBROUTINE TO CONVERT LOGICAL BLOCK NUMBERS TO PHYSICAL
;DISK ADDRESSES.
;SETUP	P2=LOGICAL BLOCK NUMBER OF ERROR
;	HDEDCR=LOCATION OF DSKCHR WORD IN ENTRY
;CALL	PUSHJ	P,LBNDCD
;
;RETURN	CALL+1

LBNDCD:	TYPEIT	<

ERROR ANALYSIS>
	SETZ	P1,			;P1 WILL HOLD DEVICE IDENTIFIER
	MOVEM	P2,.LBN			;STORE THE BLOCK # IN .LBN
	MOVE	P2,WKBUFF+HDEDCR	;GET THE DEVCHR WORDS
	TRNE	P2,1B26			;FIXED HEAD?
	JRST	.FHCHK			;YES-GO SEE IF IT'S A DRUM OR DISK
	TRNE	P2,1B25			;NO-IS IT A DISK PACK?
	JRST	.DPCHK			;YES-GO SEE IF IT IS AN RP02 OR RP03
	TRNE	P2,1B24			;RH10?
	JRST	.RHCHK			;YES
.DBOMB:	WARN	<UNDECIPHERABLE DISK CHARACTERISTIC WORD>
	TYPEIT	<
UNDECIPHERABLE DISK CHARACTERISTICS WORD
>
	PJRST	.LBPRT			;PRINT THE LOGICAL BLOCK NUMBER AND EXIT

.FHCHK:	TRNE	P2,1B32			;IS IT A BURROUGHS DISK?
	MOVEI	P1,1			;NO-SET CODE FOR BRYANT DRUM RM10B
	JRST	.BLKDV			;AND DIVIDE IN BLOCK NUMBERS

.DPCHK:	TRNE	P2,1B31			;IS IT AN RP02?
	JRST	.RP3CK			;NO-MAKE SURE IT'S AN RP03
	MOVEI	P1,2			;YES-SET CODE FOR RP02
	JRST	.BLKDV			;AND DIVIDE IN BLOCK NUMBERS

.RP3CK:	TRNE	P2,1B32			;IS IT IN FACT AN RP03?
	JRST	.DBOMB			;NO-WOULD YOU BELEIVE AN RP0X?
	MOVEI	P1,3			;YES-SET CODE FOR RP03
	JRST	.BLKDV
.RHCHK:	TRNE	P2,1B32			;RS04?
	JRST	.DBOMB			;NO - HELP!!
	MOVEI	P1,4			;YES SETUP P1.

.BLKDV:	PUSHJ	P,.DVPRT		;GO PRINT DEVICE TYPE
	PUSHJ	P,.LBPRT		;GO PRINT THE LOGICAL BLOCK NUMBER
	MOVE	P2,.LBN			;RETURN THE BLOCK NUMBER TO P2
	CAMGE	P2,.MXBLK(P1)		;[144]IS THIS BLOCK ON FIRST UNIT OF STR?
	JRST	.TCPRT			;YES-GO PRINT TRACK/CYLINDER ADDRESS
	SUB	P2,.MXBLK(P1)		;NO-SUBTRACT ONE UNIT'S WORTH OF BLOCKS
	JRST	.-3			;AND CHECK AGAIN

.TCPRT:	MOVEI	T1,[ASCIZ/
	CYLINDER:		/]
	CAIG	P1,1			;IS IT A DISK PACK?
	MOVEI	T1,[ASCIZ/
	TRACK:			/]
	CAIN	P1,4			;OR RS04?
	MOVEI	T1,[ASCIZ/
	TRACK:			/]
	PUSHJ	P,.TSTRG		;TYPE EITHER CYL OR TRK
	IDIV	P2,.TRBLK(P1)		;DIVIDE IT BY TRACKS PER UNIT
	MOVE	T1,P2			;STAND BY TO DUMP IT
	PUSHJ	P,.ODECW
	MOVE	P2,P3			;REMAINDER TO P2
	CAIG	P1,1			;IS IT A PACK?
	JRST	.SECPR			;NO-GO PRINT SECTOR ADDRESS
	CAIN	P1,4			;RS04?
	JRST	.SECPR			;YES.
	MOVEI	T1,[ASCIZ/
	SURFACE:		/]
	PUSHJ	P,.TSTRG
	IDIV	P2,.SUBLK(P1)		;DIVIDE BY # BLOCKS PER SURFACE
	MOVE	T1,P2
	PUSHJ	P,.ODECW
	MOVE	P2,P3			;SAVE REMAINDER

.SECPR:	MOVEI	T1,[ASCIZ/
	SECTOR:			/]
	PUSHJ	P,.TSTRG
	IMUL	P2,.SECBK(P1)		;MULTIPLY IT BY SECTORS PER BLOCK
	MOVE	T1,P2
	PUSHJ	P,.ODECW
	POPJ	P,			;EXEUNT

.LBPRT:	MOVEI	T1,[ASCIZ/
	LOGICAL	BLOCK NUMBER:	/]
	PUSHJ	P,.TSTRG
	MOVE	T1,.LBN
	PUSHJ	P,.ODECW
	POPJ	P,

.DVPRT:	TYPEIT	<
	DEVICE	TYPE:		>
	MOVEI	T1,.DVTAB(P1)		;PICKUP ADDRESS OF ASCIZ DEVICE
	PUSHJ	P,.TSTRG		;TELL THE WORLD
	POPJ	P,			;RETURN
	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

BCK1:	MOVE	P1,RELTIM
	JUMPE	P1,FSTPAS
	MOVE	P1,HDBUFF+HDRDAT
	SUB	P1,HDBUFF+HDRUPT
	SUB	P1,RELTIM
	CAIGE	P1,200			;ABOUT 1 MINUTE
	JRST	ABORT			;THIS IS DEAMON RESTART,FORGET IT.
FSPCON:	MOVE	P1,ERTYPE		;PICKUP ENTRY TYPE
	MOVE	P2,ENTCHR(P1)		;PICKUP CHAR WORD
	TLNE	P2,E.LSUM		;DO WE WANT SUMMARY
	PUSHJ	P,SUM1
	TLNN	P2,E.LNXM		;NXM CAUSED RELOAD
	JRST	B1.1
	MOVE	T1,[SIXBIT/NXM/]
	CAMN	T1,WKBUFF+WHYWHY	;CAUSED BY NXM?
	POPJ	P,			;WIN LIST IT
B1.1:	TLNN	P2,E.LPAR		;PARITY ERR CAUSED RELOAD
	JRST	B1.2
	MOVE	T1,[SIXBIT/PARITY/]
	CAMN	T1,WKBUFF+WHYWHY	;SAME AS WHY RELOAD
	POPJ	P,			;WIN
B1.2:	TLNN	F,F.DEV			;/DEV?
	 JRST	B1.2A
	MOVE	T1,[SIXBIT/CPU/]
	CAME	T1,DEV
	MOVE	T1,[SIXBIT/KLCPU/]
	CAME	T1,DEV
	 JRST	ABORT
	TLO	P2,E.LALL
B1.2A:	TLNE	P2,E.LALL		;ALWAYS LIST?
	POPJ	P,			;DOIT
	TLNE	P2,E.LPER		;PERFORMANCE 
	POPJ	P,			;WIN
	JRST	ABORT			;LISTING NOT FIT TO PRINT
FSTPAS:	MOVE	P1,HDRDAT
	MOVEM	P1,RELTIM
	JRST	FSPCON

BCK71:	MOVE	P1,ERTYPE
	MOVE	P2,ENTCHR(P1)
	TLNN	F,F.DEV			;SAID /DEV?
	 JRST	BC71B			;NO
	MOVE	T1,DEV			;GET WHAT HE SAID
	CAMN	T1,[SIXBIT/LP100/]	;MATCH?
	 JRST	BC71A			;YES-FORCE LISTING
	MOVEI	P3,LPTNAM		;NO-CHECK FURTHER
	PUSHJ	P,DEVCHK		;
BC71A:	TLO	P2,E.LALL		;
BC71B:	TLNE	P2,E.LALL		;WANTS ALL?
	 POPJ	P,0			;YES-LIST IT
	JRST	ABORT			;NO-SORRY NO LISTING

BCK72:	MOVE	P1,ERTYPE
	MOVE	P2,ENTCHR(P1)
	TLNN	F,F.DEV			;DID HE SAY /DEV?
	 JRST	BC72B			;NO
	MOVE	T1,DEV			;YES..GET WHAT HE SAID
	CAMN	T1,[SIXBIT/LP100/]	;MATCH?
	 JRST	BC72A			;YES LIST IT
	MOVEI	P3,HCCNAM		;NO CHECK MORE
	PUSHJ	P,DEVCHK
BC72A:	TLO	P2,E.LALL		;WANTS ALL?
BC72B:	TLNE	P2,E.LALL		;YES-LIST IT
	 POPJ	P,0			;YES..LIST IT
	JRST	ABORT			;NO RETURN

BCK7:	MOVE	P1,ERTYPE
	MOVE	P2,ENTCHR(P1)
	TLNN	F,F.DEV			;/DEV?
	 JRST	BCK7A
	MOVE	T1,[SIXBIT/CPU/]
	CAME	T1,DEV
	MOVE	T1,[SIXBIT/KLCPU/]
	CAME	T1,DEV
	 JRST	ABORT
	TLO	P2,E.LALL
BCK7A:	TLNE	P2,E.LALL		;ALWAYS LIST?
	POPJ	P,			;DOIT
	TLNE	P2,E.LPER		;PERFORMANCE 
	POPJ	P,			;WIN
	JRST	ABORT			;LISTING NOT FIT TO PRINT
BCK3:	MOVE	P1,ERTYPE
	MOVE	P2,ENTCHR(P1)		;PICKUP CHAR WORD
	TLNE	P2,E.LSUM		;SUMMARY DESIRED
	PUSHJ	P,SUM3
	TLNN	F,F.DEV			;/DEV?
	 JRST	BC3A
	MOVE	T1,[SIXBIT/CPU/]
	CAME	T1,DEV
	MOVE	T1,[SIXBIT/KLCPU/]
	CAME	T1,DEV
	 JRST	ABORT
	TLO	P2,E.LALL
BC3A:	TLNN	P2,E.LALL!E.LPAR
	JRST	ABORT			;LOSE
	POPJ	P,			;WIN LIST IT


BCK6:	MOVE	P1,ERTYPE		;PICKUP ENTRY TYPE
	MOVE	P2,ENTCHR(P1)		;PICKUP CHARACTERISTICS WORD
	TLNE	P2,E.LSUM		;SUMMATION DESIRED
	PUSHJ	P,SUM6			;YES-DISPATCH
	TRNN	F,F.NDEV		;EDIT 325 SAID /NDEV:?
	 JRST	BCK6AA			;NO
	MOVEI	P3,CPENAM		;OFFSET
	PUSHJ	P,NDVCHK##		;GO CHECK
BCK6AA:	TLNN	F,F.DEV			;EDIT 124 SAID /DEV:?
	 JRST	BCK6A			;NO
	MOVEI	P3,CPENAM		;OFFSET
	PUSHJ	P,DEVCHK		;GO CHECK
BCK6A:	TLNE	P2,E.LALL		;ALWAYS LIST?
	POPJ	P,			;DOIT
	TLNN	P2,E.LNXM
	JRST	B6.1
	MOVE	T1,WKBUFF+CPENXM	;PICKUP NXM COUNT
	CAMN	T1,NXMTMP		;SAME AS OLD NXM COUNT?
	JRST	B6.1			;YES
	POPJ	P,			;IF TS GREATER THEN NXM CAUSED ERR
					;IF LESS RELOAD OCCURRED THEN ERROR
B6.1:	TLNN	P2,E.LPAR
	JRST	B6.2
	MOVE	T1,WKBUFF+CPEMPE
	JUMPE	T1,B6.2			;CLEARLY WAS NOT CAUSED BY PAR
	CAMN	T1,MPETMP		;SAME AS OLD
B6.2:	JRST	ABORT			;NOT CAUSED BY PAR
	POPJ	P,			;WIN LIST IT

BCK5:					;USE THE SAME CODE AS FOR BCK17
BCK14:BCK17:	MOVE	P1,ERTYPE
	MOVE	P2,ENTCHR(P1)
	TLNN	F,F.DEV			;/DEV?
	 JRST	BCK17A
	MOVE	T1,[SIXBIT/CPU/]
	CAME	T1,DEV
	MOVE	T1,[SIXBIT/KLCPU/]
	CAME	T1,DEV
	 JRST	ABORT
	TLO	P2,E.LALL
BCK17A:	TLNE	P2,E.LALL		;ALWAYS LIST?
	POPJ	P,			;DOIT
	TLNE	P2,E.LPER		;PERFORMANCE 
	POPJ	P,			;WIN
	JRST	ABORT			;LISTING NOT FIT TO PRINT
BCK10:	MOVE	T1,ERTYPE		;PICKUP ENTRY TYPE
	MOVE	P4,ENTCHR(T1)		;PICKUP CHAR WORD
	TLNE	P4,E.LSUM		;SUMMATION DESIRED?
	PUSHJ	P,SUM10			;DOIT
	TLNN	F,F.TRY			;EDIT 126 SAID /RETRY?
	 JRST	BCK10A			;NO
	HRRZ	T1,WKBUFF+HDEECT	;# RETRIES
	CAMG	T1,RETRY		;ENTRY GREATER THAN SPEC?
	 JRST	ABORT			;NO-DON'T LIST
BCK10A:	TLNN	F,F.DEV			;USER SAY /DEV:?
	JRST	BC10.1			;NO
	SETOM	T2,T2
	MOVE	T1,DEV
	CAMN	T1,[SIXBIT/RP02/]
	MOVEI	T2,2
	CAMN	T1,[SIXBIT/RP03/]
	MOVEI	T2,3
	CAMN	T1,[SIXBIT/RD10/]
	MOVEI	T2,0
	CAMN	T1,[SIXBIT/RM10/]
	MOVEI	T2,1
	CAMN	T1,[SIXBIT/RS04/]
	MOVEI	T2,4
	CAMN	T2,MDEDTP		;MATCH?
	 JRST	.+3			;YES
	MOVEI	P3,HDENAM		;YES
	PUSHJ		P,DEVCHK
	TLNE	F,F.OSUM
	TLO	P4,E.LALL
	MOVE	T1,ERTYPE
	MOVEM	P4,ENTCHR(T1)
BC10.1:	TRNN	F,F.NDEV		;[325]"/NDEV:"?
	 JRST	BC10.A
	MOVEI	P3,HDENAM
	PUSHJ	P,NDVCHK		;GO CHECK
BC10.A:	TLNN	F,F.ID			;USER SAY /ID:?
	JRST 	BC10.2			;NO
	MOVEI	P3,HDEHID
	PUSHJ	P,IDCHK
BC10.2:	TLNN	F,F.STR			;SAID /STR?
	 JRST	BC10.4			;NOPE
	MOVEI	P3,HDELOG		;SETUP
	PUSHJ	P,STRCHK		;CHECK IT (EDIT #105)
BC10.4:	MOVE	T1,ERTYPE		;
	MOVE	P4,ENTCHR(T1)		;GET BACK CHAR WORD.
	TLNE	P4,E.LALL		;ALWAYS LIST?
	POPJ	P,			;YES-DOIT
	TLNN	P4,E.LPAR
	JRST	ABORT			;PAR ERROR IS THE ONLT SELECTABLE ERR ON DSK
					;NXM IS IMPOSSIBLE
	MOVE	T1,KONTYP		;GET CONTROLLER TYPE
	CAIN	T1,4			;RH10?
	JRST	BC10.3			;YES
	MOVE	T1,WKBUFF+HDESOF	;PICKUP CONI AT ERROR WORD
	TLNE	T1,4000			;PAR ERR BIT LIT?
	POPJ	P,			;YES-LIST
	JRST	ABORT			;LOSE
BC10.3:	MOVE	T1,WKBUFF+HDESOF	;GET CONI WORD
	TDNE	T1,[1B15!1B16!1B18!1B19];THESE ARE POSSIBLE
					;PAR ERR BITS-ANY SET?
	POPJ	P,0			;YES,LIST THIS ENTRY.
	JRST 	ABORT			;NO FORGET IT


BCK20:	MOVE	P1,ERTYPE
	MOVE	P4,ENTCHR(P1)		;GET CHAR WORD.
	TLNE	P4,E.LSUM		;WANT SUMMARY?
	PUSHJ	P,SUM20			;YES
	TLNN	F,F.TRY			;EDIT 126-USER SAID /RETRY?
	 JRST	BCK20A			;NO
	HRRZ	T1,WKBUFF+MAGRTC	;GET # RETRIES
	CAMG	T1,RETRY		;VALUE GREATER THAN SPEC?
	 JRST 	ABORT			;NO-DONT LIST
BCK20A:	TLNN	F,F.DEV			;DID USER SPECIFY DEVICE?
	JRST	BC20.1			;NO, GO AROUND
	MOVEI	P3,MAGNAM		;GET NAME FROM THIS ENTRY
	PUSHJ	P,DEVCHK
BC20.1:	TRNN	F,F.NDEV		;[325]DID USER SPECIFY DN-EVICE?
	JRST	BK20.1			;NO, GO AROUND
	MOVEI	P3,MAGNAM		;GET NAME FROM THIS ENTRY
	PUSHJ	P,NDVCHK
BK20.1:	TLNN	F,F.ID			;SAY /ID?
	JRST	BC20.2			;NO
	MOVEI	P3,MAGRID		;YES,SETUP
	PUSHJ	P,IDCHK
BC20.2:	TLNE	P4,E.LALL		;WANT ALL?
	POPJ	P,			;YES
	TLNN	P4,E.LPAR		;WANT PARITY ERRORS?
	JRST	ABORT			;NO, THAT'S ALL I CHECK FOR NOW.
	MOVE 	T1,WKBUFF+MAGICS	;YES, GET TMS CONI ERROR WORD.
	TRNE	T1,1B22			;THIS ENTRY HAS PARITY ERROR?*EDIT 130*
	POPJ	P,			;YES, LIST IT
	JRST	ABORT			;NO, FORGET IT
BCK40:	TLNN	F,F.DEV			;DID USER SAY DEV?
	JRST	BC40.1			;NO
	MOVEI	P3,USCNAM		;YES SETUP INDEX OF DEV NAME.
	PUSHJ	P,DEVCHK		;CHECK THIS ENTRY.
BC40.1:	TRNN	F,F.NDEV		;[325]/NDEV?
	 JRST	BC40.A
	MOVEI	P3,USCNAM
	PUSHJ	P,NDVCHK
BC40.A:	MOVE	P1,ERTYPE
	MOVE	P2,ENTCHR(P1)		;PICKUP CHAR WORD
	TLNE	P2,E.LALL		;ALWAYS LIST?
	POPJ	P,			;YES-DOIT
	TLNE	P2,E.LPER		;PERFORMANCE ENTRY REQUESTED
	POPJ	P,			;WIN-LIST IT
	JRST	ABORT			;ALL OTHER REQUESTS ARE IGNORED
					;SINCE ENTRY TYPE 40 IS PER ONLY
BCK41:	MOVE	P1,ERTYPE
	MOVE	P4,ENTCHR(P1)
	TLNE	P4,E.LSUM
	 PUSHJ	P,SUM41
	TLNN	F,F.DEV			;DID USER SPECIFY DEV.
	JRST	BC41.1			;NO GO AROUND.
	MOVEI	P3,MSCNAM		;GET NAME FROM THIS ENTRY?
	PUSHJ	P,DEVCHK
BC41.1:	TRNN	F,F.NDEV		;[325]/NDEV?
	 JRST	BC41.A
	MOVEI	P3,MSCNAM
	PUSHJ	P,NDVCHK
BC41.A:	TLNN	F,F.ID			;/ID?
	JRST	BC41.2			;NO
	MOVEI	P3,MSCRID		;YES, SETUP
	PUSHJ	P,IDCHK
BC41.2:	MOVE	P1,ERTYPE
	MOVE	P2,ENTCHR(P1)		;GET CHAR WORD
	TLNE	P2,E.LALL		;WANTS ALL?
	POPJ	P,			;YES
	TLNN	P2,E.LPER		;WANTS PERFORMANCE STATS?
	JRST 	ABORT			;NO, GOODBYE
	SKIPE	WKBUFF+MSCHRE		;YES, ANY HARD RED ERRORS?
	POPJ	P,0			;YES,LIST.
	SKIPE	WKBUFF+MSCHWE		;NO, WHAT ABOUT HARD WRITE ERRORS?
	POPJ	P,0			;YES.
	MOVE	T1,WKBUFF+MSCSRE	;GET # OF SOFT READ ERRORS
	CAML	T1,SRE			;ERRORS G.T. THRESHOLD?
	POPJ	P,0			;YES LIST
	MOVE	T1,WKBUFF+MSCSWE	;GET # OF SOFT WRITE ERRORS.
	CAML	T1,SWE			;ERRORS G.T. THRESHOLD?
	POPJ	P,0			;YES, LIST
	JRST	ABORT			;NO, FORGET IT.

BCK45:	TLNE F,F.DEV			;SAID /DEV?[1144]
	JRST ABORT			;YES WE HAVE NO DEVICES.
	MOVE	P1,ERTYPE
	MOVE	P2,ENTCHR(P1)
	TLNN	P2,E.LALL!E.LPER	;LIST ONLY IF /ALL OR /PER
	JRST	ABORT
	POPJ	P,0


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

RLDINS:	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
SUM3:	MOVEI	T1,TPETMP
	MOVEI	T2,TPEPER
	MOVE	T3,WKBUFF+MPETPE	;PICKUP # HARD P.E.
	PUSHJ	P,COMPAR		;LET SUBROUTINE DO UPDATING AS NECESSARY
	MOVEI	T1,SPETMP	
	MOVEI	T2,SPEPER
	MOVE	T3,WKBUFF+MPESPE	;PICKUP # SOFT MEM P.E.
	PUSHJ	P,COMPAR
	MOVEI	T1,UEPTMP
	MOVEI	T2,UEPPER
	HRRZ	P4,WKBUFF+MPAPAR	;PICKUP AOB POINTER TO DESIRED WORD
	SUB	P4,HEADWC		;SUBTRACT SIZE OF HEADER
	MOVE	T3,WKBUFF+MPEUEP(P4)	;PICKUP # USER-ENABLED P.E.
	PUSHJ	P,COMPAR
	MOVEI	T1,PCSTMP
	MOVEI	T2,PCSPER
	MOVE	T3,WKBUFF+MPEPCS(P4)	;PICKUP # CHN P.E. NOT DETECTED BY CPU
	PUSHJ	P,COMPAR
	POPJ	P,			;DONE WITH SUM3
SUM6:	MOVEI	T1,NXMTMP
	MOVEI	T2,NXMPER
	MOVE	T3,WKBUFF+CPENXM	;PICKUP # NXMS
	PUSHJ	P,COMPAR		;GO DO COMPARISON AND UPDATING
S6.1:	MOVEI	T1,MPETMP
	MOVEI	T2,MPEPER
	MOVE	T3,WKBUFF+CPEMPE	;PICKUP COUNT OF NXM SEEN BY CHANNEL
	PUSHJ	P,COMPAR
S6.2:	MOVEI	T1,DPETMP
	MOVEI	T2,DPEPER
	MOVE	T3,WKBUFF+CPEDPE	;PICKUP # DATA P.E. SEEN FROM CONTROLLER
	PUSHJ	P,COMPAR
	POPJ	P,			;EXIT BACK TO BITCHKER

SUM10:	MOVE	P1,DVINDX
	HRRZ	P2,SOFDSP(P1)
	HLRZ	P1,SOFDSP(P1)
;edit #110
	ifn	DEBUGA,<
	MOVEI	T1,HDETMP
	MOVEI	T2,HDEPER
	MOVE	P4,WKBUFF+HDEHCT	;PICKUP HARD ERR WORD
	HLRZ	T3,P4			;PICKUP # HDEV ERRS
	PUSHJ	P,COMPAR
	MOVEI	T1,HDTTMP
	MOVEI	T2,HDTPER
	HRRZ	T3,P4			;PICKUP # HDAT ERRORS
	PUSHJ	P,COMPAR
	MOVEI	T1,SDETMP
	MOVEI	T2,SDEPER
	MOVE	P4,WKBUFF+HDESCT
	HLRZ	T3,P4			;PICKUP # SDEV ERRS
	PUSHJ	P,COMPAR
	MOVEI	T1,SDTTMP
	MOVEI	T2,SDTPER
	HRRZ	T3,P4			;PICKUP # SDAT ERRORS
	PUSHJ	P,COMPAR
	>				;end edit#110
	MOVEI	T1,ERRSAT(P1)
	MOVEI	T2,ERRSAT(P2)
	LDB	T3,[POINT 12,WKBUFF+HDEMCT,11]	;PICKUP # SAT FAILS
	PUSHJ	P,COMPAR
	TLNE	F,F.CHNG		;DID COUNT CHANGE ON THIS ERROR
	TLO	S,S.SAT			;SAY SAT FAILURE
	MOVEI	T1,ERRRIB(P1)
	MOVEI	T2,ERRRIB(P2)
	LDB	T3,[POINT 12,WKBUFF+HDEMCT,23]	;PICKUP # RIB ERRS
	PUSHJ	P,COMPAR
	TLNE	F,F.CHNG
	TLO	S,S.RIB
	MOVEI	T1,ERRCHK(P1)
	MOVEI	T2,ERRCHK(P2)
	LDB	T3,[POINT 12,WKBUFF+HDEMCT,35]	;PICKUP # CHKSUM ERRS
	PUSHJ	P,COMPAR
	TLNE	F,F.CHNG
	TLO	S,S.CHK

;FALL INTO S10.1 ROUTINE
S10.1:	MOVEI	T1,ERRINC(P1)
	MOVEI	T2,ERRINC(P2)
	HRRZ	T3,WKBUFF+HDEPCT	;[302]PICKUP # SEEK INCOMP ERRORS
	PUSHJ	P,COMPAR
	MOVEI	T1,ERRHN1(P1)
	MOVEI	T2,ERRHN1(P2)
	LDB	T3,[POINT 9,WKBUFF+HDEHNG,8]	;PICKUP # HARD HANGS
	PUSHJ	P,COMPAR
	TLNE	F,F.CHNG
	TLO	S,S.HNG1
	MOVEI	T1,ERRHN2(P1)
	MOVEI	T2,ERRHN2(P2)
	LDB	T3,[POINT 9,WKBUFF+HDEHNG,17]	;PICKUP # SOFT HANG TYPE 1
	PUSHJ	P,COMPAR
	TLNE	F,F.CHNG
	TLO	S,S.HNG2
	MOVEI	T1,ERRHN3(P1)
	MOVEI	T2,ERRHN3(P2)
	LDB	T3,[POINT 9,WKBUFF+HDEHNG,26]	;PICKUP # SOFT HANGS TYPE 2
	PUSHJ	P,COMPAR
	TLNE	F,F.CHNG
	TLO	S,S.HNG3
	MOVEI	T1,ERRHN4(P1)
	MOVE	T2,ERRHN4(P2)
	LDB	T3,[POINT 9,WKBUFF+HDEHNG,35]	;PICKUP # SOFT HANGS TYPE 3
	PUSHJ	P,COMPAR
	TLNE	F,F.CHNG
	TLO	S,S.HNG4
;EDIT 122
	MOVEI	T1,ERRCWF(P1)
	MOVE	T2,ERRCWF(P2)
	LDB	T3,[POINT 9,WKBUFF+HDECCT, 35]	;# OF TERM CHK FAILS
	PUSHJ	P,COMPAR
	TLNE	F,F.CHNG
	TLO	S,S.CWF			;SAY FAILURE IN S
;edit #110
	ifn	DEBUGA,<
	MOVEI	T1,REDTMP
	MOVEI	T2,REDPER
	MOVE	T3,WKBUFF+HDETRC	;PICKUP TOTAL # READS
	PUSHJ	P,COMPAR
	MOVEI	T1,WRTTMP
	MOVEI	T2,WRTPER
	MOVE	T3,WKBUFF+HDETWC
	PUSHJ	P,COMPAR
	MOVEI	T1,SEKTMP
	MOVEI	T2,SEKPER
	MOVE	T3,WKBUFF+HDETSC
	PUSHJ	P,COMPAR
	>				;end edit #110
	MOVEI	P2,HDEECT
	MOVEI	P3,HDESOF		;SETUP
	PUSHJ	P,CNISUM		;GO PERFORM CONI BIT SUMMING
	SKIPN	HDVER1			;VERSION 1 HEADER?
	 POPJ	P,0			;NO-LEAVE NOW
	LDB	T2,[POINT 9,WKBUFF+HDECCT,17]	;GET # SLOTS IN BAT BLOCK
	CAIL	T2,5			;<5= GIVE WARNING
	 POPJ	P,0			;ITS OK
	MOVE	T2,WKBUFF+HDELOG	;GET STR NAME
	PUSHJ	P,TTYSIX		;CONVERT AND LIST ON USER'S TTY
	WARN	< STRUCTURE FOUND WITH LESS THAN 5 BAT BLOCK SLOTS LEFT>
					;FINISH LINE WITH WARNING AND GET FREE CRLF
	POPJ	P,0			;RETURN TO BCK ROUTINES

SUM14:	POPJ	P,0


SUM20:	MOVE	T4,DVINDX		;STILL SET FROM TMCHAR
	MOVE	T4,DEVDSP(T4)		;SOME ADDRS
	MOVE	T1,WKBUFF+MAGICS	;CONI WORD
	TDNN	T1,[1B11!1B12!1B13!1B18!1B27]	;ANYTHING TO COUNT?
	 POPJ	P,0			;SHORT WAY HOME
	MOVE	T2,WKBUFF+MAGRTC
	HRRZ	T3,T4			;SOFT ERROR COUNTER ADDR
	TLNE	T2,ERRHRD		;BUT IF HARD ERROR
	 HLRZ	T3,T4			;CHANGE ADDR
	TLNE	T1,1B29			;WAS IT CTL PAR
	 AOS	,0(T3)			;YES BUMP COUNT
	TLNE	T1,1B31			;MEM PAR
	 AOS	,1(T3)
	TLNE	T1,1B30
	 AOS	,2(T3)			;NXM
	TRNE	T1,1B18			;UNIT HUNG
	 AOS	,4(T3)
	TRNE	T1,1B27
	 AOS	,3(T3)			;OVRN
	POPJ	P,0			;GO HOME
SUM40:	POPJ	P,

;ADDED WITH EDIT 112
SUM41:	MOVE	P3,WKBUFF+MSCNAM
	TRNE	P3,7777			;EDIT132  FUNNY NAME?
	 PUSHJ	P,FIXNAM		;FIX IT
	MOVE	T1,[IOWD NAMLTH,NAMTBL]
	PUSHJ	P,.NAME
	 PJRST	BADNAM
	TLZ	T1,-1
	SUBI	T1,NAMTBL
	HRRZ	P4,DEVDSP(T1)
	HLRZ	P3,DEVDSP(T1)		;SAVE BOTH HD &SF ADDRS
	MOVE	P1,WKBUFF+MSCWRC	;WORDS READ
	PUSHJ	P,WDCNT			;GO DO IT
	MOVE	T1,WKBUFF+MSCHRE
	ADDM	T1,6(P3)		;UPDATE HARD COUNTER
	MOVE	T1,WKBUFF+MSCSRE
	ADDM	T1,6(P4)		;SOFT COUNTER
	POPJ	P,0			;GO BACK TO BCK41

SUM45:	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
INPSPC:	EXP	13
	SIXBIT/SYS/
	XWD	0,IBUFF
OUTSPC:	EXP	0
	SIXBIT/DSK/
	XWD	OBUFF,0
ERRFIL:	XWD	0,35
	Z
	SIXBIT/ERROR/
	SIXBIT/SYS/
	BLOCK	32
LSTFIL:	SIXBIT/ERROR/
	SIXBIT/LST/
	Z
	Z
;HERE IS THE CODE WHICH WILL BE BUT INTO THE LOW SEG
;AND WILL BE CALLED TO OVERLAY HIGH SEGMENTS.
;EDIT #120


	SETZM	.JBSYM			;TO ALLOW DDT TO WORK
	SETZM	.JBUSY			;WHILE DEBUGGING VARIOUS HIGH
					;SEGMENTS. PUT A BREAKPOINT
					;AT ROUTINES WHICH CALL OVRLAY
					;THEN SET BREAKPOINT AT THE
					;RETURN FROM THE GETSEG AND OPEN
					;THE NEW SYMBOL TABLE
					;AND CONTINUE DEBUGGING.
	MOVEI	T1,OVRBLK		;SPEC BLOCK SETUP BY OUR CALLER
	GETSEG	T1,
	 HALT				;STD ERROR MESSAGES ARE OK
	HRLZI	17,SAVEAC		;COPY BACK
	BLT	17,17			;THE AC'S
	HRRZ	15,400000		;THAT'S THE START OF THE NEW SEG
	JRST	@15			;NOW GO THERE



IARGST:	Z
	Z
	CHROUT				;LOCATION OF TYPEOUT ROUTINE IN SYSERR
	Z
	Z
IAREND==.-1
IARGLN==<IAREND-IARGST>+1		;LENGTH OF ARG BLOCK FOR .ISCAN


DUMDAY:	121165				;DUMMY NBS DAY FOR USE BY SCAN
KONMSK:	RCMASK				;MASK FOR ERROR BITS IN RC10 TYPE DEVICE
	RPMASK				;MASK FOR ERROR BIT IN A RP10 TYPE DEVICE
	SFMASK				;SOFTWARE DETECTED ERROR MASK
	TMMASK
	RHMASK
	LPTMSK
	UBAMSK				;UBA STATUS MASK
	LPSASK				;LP20 REGISTER A
	LPSBSK				;LP20 REGISTER B
	CDSTSK				;CD20 REGISTER

MINERB:	MINRCB
	MINRPB
	MINSFB
	MINTMB
	MINRHB
	MINLPT
	MINUBA
	MILPSA
	MILPSB
	MICDST

ERINDX:	RCINDX
	RPINDX
	SFINDX
	TMINDX
	RHINDX
	LPTIND
	UBADX
	LPSADX
	LPSBDX
	CDSTDX

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.
	IFN	EXPPRT,<
	LALL
	>
	IFE	EXPPRT,<
	SALL
	>

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

ALLTBL:	DUMENT

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

;TABLE OF ERRORS PROCESSED BY THIS ENTRY AND,
; BRIEF PROCESS TABLE POINTERS  -  EDIT [724]
DEFINE	TBLENT(A,B,C,D,E,F)<
	IFIDN<D><PROCSA><
		XWD  F,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 ALLIND

	DEFINE	TBLENT(A,B,C,D,E)<
	IFIDN<D><PROCSA><
	XWD	C,D
	TYPMAX==A>
	IFDIF<D><PROCSA><
	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><PROCSA><
	[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><PROCSA><
	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><PROCSA><
	XWD	0,E
	>>

	RADIX	10

LINE:	0
	DUMENT

	RADIX	8

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

;***********WATCH OUT THIS IS A NON-STD DEFINITION OF TH MACRO******
;*************IT'S NOT LIKE THE OTHERS IN OTHER HIGH SEG'S!!!!!!!!!
	DEFINE	TBLWRD(A,B,C,D,E,F)<
	IFDIF<D><SPECL>,<	BYTE	(6)B(9)C(3)D(18)T'A'E>
	IFIDN<D><SPECL>,<	BYTE	(6)B(9)C(3)D(18)F>

>

.BR001:	BRF001
.CT001:	DUM001
	Z
.BR003:	BRF003
.CT003:	DUM003
	Z
.BR005:	BRF005
.CT005:	DUM005
	Z
.BR006:	BRF006
.CT006:	DUM006
	Z
.BR007:	BRF007
.CT007:	DUM007
	Z
.BR010:	BRF010
.CT010:	DUM010
	Z
.BR014:	BRF014
.CT014:	DUM014
	Z
.BR017:	BRF017
.CT017:	DUM017
	Z
.BR020:	BRF020
.CT020:	DUM020
	Z
.BR040:	BRF040
.CT040:	DUM040
	Z
.BR041:	BRF041
.CT041:	DUM041
	Z
.BR045:	BRF045
.CT045:	DUM045
	Z
.BR071:	BRF071
.CT071:	DUM071
	Z
.BR072:	BRF072
.CT072:	DUM072
	Z

;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 FOLLOWING 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 MACRO TO DEFINE DEFAULTS

	DEFVAL

;NOW MAKE SWTCHS MACRO FOR USE WITH DOSCAN LATER

	DEFINE	SWTCHS<
	DUMCH1
	DUMCH2
>

	DOSCAN(SWTAB)


	IFN	EXPPRT,<
	LALL
	>
	IFE	EXPPRT,<
	SALL
	>

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

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

	RC10DV:	DUMRC1

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


	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',\]
>
	LPTDEV:	DUMLPT

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

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

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

	DEFINE	TBLDEV(A,B)<
	[ASCIZ\B',\]
>
	CDSTDV:	DUCDST
;NOW GENERATE THE ERROR BIT VS INDEX BIT TABLES
;THIS ALLOWS NON-CONTIGUOUS ERROR BITS IN CONI WORD
;TO BE COUNTED IN CONTIGUOUS COUNTERS

	DEFINE	TBLDEV(A,B)<
	ZZP==.
	RELOC	RCINDX+A-MINRCB
	ZZ
	ZZ==ZZ+1
	RELOC	ZZP
>

;	XLIST
RCINDX:	REPEAT	36-MINRCB,<0>
	LIST
	ZZ==0
	DUMRC1

	DEFINE	TBLDEV(A,B)<
	ZZP==.
	RELOC	LPTIND+A-MINLPT
	ZZ
	ZZ==ZZ+1
	RELOC	ZZP
	>
LPTIND:	REPEAT	36-MINLPT,<0>
	ZZ==0
	DUMLPT


	DEFINE	TBLDEV(A,B)<
	ZZP==.
	RELOC	RPINDX+A-MINRPBA
	ZZ
	ZZ==ZZ+1
	RELOC	ZZP
>

;	XLIST
RPINDX:	REPEAT	36-MINRPB,<0>
	LIST
	ZZ==0
	DUMRP1


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

	DEFINE	TBLDEV(A,B)<
	ZZP==.
	RELOC	SFINDX+A-MINSFB
	ZZ
	ZZ==ZZ+1
	RELOC	ZZP
>

;	XLIST
SFINDX:	REPEAT	36-MINSFB,<0>
	LIST
	ZZ==0
	DUMSF1
	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	UBADX+A-MINUBA
	ZZ
	ZZ==ZZ+1
	RELOC	ZZP
>
;	XLIST
UBADX:	REPEAT	36-MINUBA,<0>
	LIST
	ZZ==0
	DUMUBA

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

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

	DEFINE	TBLDEV(A,B)<
	ZZP==.
	RELOC	CDSTDX+A-MICDST
	ZZ
	ZZ==ZZ+1
	RELOC	ZZP
>
;	XLIST
CDSTDX:	REPEAT	36-MICDST,<0>
	ZZ==0
	DUCDST

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

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

MASNAM:	DUMFS
	DUMRP

	MASLTH=<.-1>-MASNAM+1		;LENGTH OF THIS TABLE

;GENERATE LIST OF POINTERS TO 5 WORD SCRATCH BLOCKS

;GENERATE LIST OF POINTERS TO 5 WORD SCRATCH BLOCKS

;FOR ALL DEVICES ON THE SYSTEM
	
DEFINE	DUMDV	(A)<
	XWD	0,A'BK
	>
BKLOC:	DUMDVA

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

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

DEVDS2::
DEVDSP:	DUMDVA



	DEFINE	DUMDV(A)<
	XWD	A'ST,A'SP
>
;ST=STORAGE TEMP,SP=PERM.
SOFDSP:	DUMDVA


FOO:	[ASCIZ\
****************************************************
*						   *
\]
FOOA:	[ASCIZ\*	THIS IS THE TENTH ERROR ON THIS TAPE!      *
\]
FOOB:	[ASCIZ\*	NO MORE ENTRIES WILL BE LISTED FOR THIS    *
*	TAPE.  SEE THE PERFORMANCE ENTRY FOR       *
\]
FOOC:	[ASCIZ\*	THIS TAPE TO FIND THE TOTAL NUMBER OF      *
*	ERRORS.     				   *
*						   *
****************************************************
\]

	END	STARTA