Google
 

Trailing-Edge - PDP-10 Archives - BB-H311B-RM - swskit-utilities/dx20pc.mac
There are 5 other files named dx20pc.mac in the archive. Click here to see a list.
	TITLE	DX20PC	PROGRAM TO WATCH DX20 PC




;THIS PROGRAM IS USEFUL WHEN THE MICROCODE IN THE DX20 APPEARS TO
;BE HUNG IN A LOOP, TO DIAGNOSE THE PROBLEM BY SEEING WHERE THE
;MICROCODE IS LOOPING.  THIS WILL USUALLY INDICATE A PARTICULAR
;HARDWARE PROBLEM.  IT IS SAFE TO RUN THIS PROGRAM AT ANY TIME,
;EVEN WHEN THE DX20 IS BUSY DOING I/O FOR A DRIVE.



	SEARCH	MONSYM,MACSYM
	.REQUIR	MACREL



	DEV==560		;RH20 WHICH IS CONTROLLING THE DX20
				;       **** IMPORTANT ****
				;CHANGE THIS DEFINITION TO MATCH THE
				;SYSTEM'S CONFIGURATION!!



	T1=1			;TEMPORARIES
	T2=2
	T3=3
	T4=4



	PCMASK==7777		;WIDTH OF PC'S IN DX20
	PCWORD==31B5		;DEVICE REGISTER CONTAINING PC

	PI==4			;PI SYSTEM
	PIOFF==400		;CONO TO TURN INTERRUPTS OFF
	PION==200		;CONO TO TURN INTERRUPTS ON AGAIN
	SUBTTL	MAIN PROGRAM





DX20PC:	RESET			;RESET
	USRIO			;GET USER IO PRIVILEGE
	 JSHLT			;CAN'T DO THIS

AGAIN:	MOVE	T1,[TABLE,,TABLE+1]	;GET READY
	SETZM	TABLE		;TO CLEAR OUT PC TABLE
	BLT	T1,TABLE+PCMASK	;DO IT
	HRROI	T1,[ASCIZ/
Number of samples to take: /]	;GET READY
	PSOUT			;ASK
	MOVEI	T1,.PRIIN	;FROM INPUT
	MOVEI	T3,^D10		;DECIMAL
	NIN			;READ IT
	 ERJMP	.+2		;FAILED, USE DEFAULT
	SKIPG	T2		;SEE IF SPECIFIED GOOD NUMBER
	MOVEI	T2,^D10000	;NO, GET STANDARD AMOUNT
	MOVEM	T2,SAMPLE	;SAVE NUMBER OF SAMPLES TO MAKE
	HRROI	T1,[ASCIZ/
Minimum percentage for typeout: /]	;MORE
	PSOUT			;ASK
	MOVEI	T1,.PRIIN	;AGAIN
	MOVEI	T3,^D10		;DECIMAL AGAIN
	NIN			;ASK AGAIN
	 ERJMP	.+2		;FAILED, USE DEFAULT
	SKIPGE	T2		;MAKE VALID
	SETZ	T2,		;SO CLEAR IF NEGATIVE
	CAILE	T2,^D100	;AND SEE IF TOO LARGE
	MOVEI	T2,^D100	;YES
	IMUL	T2,SAMPLE	;GET SET TO COMPUTE MINIMUM SAMPLE
	IDIVI	T2,^D100	;DO IT
	MOVEM	T2,CUTOFF	;SAVE CUTOFF VALUE
	MOVE	T2,SAMPLE	;GET COUNTER READY


LOOP:	MOVX	T1,PCWORD	;GET REGISTER TO READ
	CONO	PI,PIOFF	;**** PREVENT INTERRUPTIONS
	DATAO	DEV,T1		;**** TELL RH20 WHICH REGISTER TO READ
	DATAI	DEV,T1		;**** READ BACK PC WORD
	CONO	PI,PION		;**** ALLOW INTERRUPTS AGAIN
	ANDX	T1,PCMASK	;REMOVE JUNK
	AOS	TABLE(T1)	;INCREMENT PC COUNT FOR THIS VALUE
	SOJG	T2,LOOP		;LOOP UNTIL DONE

	HRROI	T1,[ASCIZ/

 PC	Percent	   Count
-----	-------	 --------
/]				;GET STRING
	PSOUT			;START IT
	MOVEI	T1,.PRIOU	;PRIMARY OUTPUT
	MOVSI	T4,-<PCMASK+1>	;GET LOOP READY
	SETZM	TYPED		;HAVEN'T TYPED ANY YET


TYPLOP:	SKIPE	T2,TABLE(T4)	;WAS THIS PC EXECUTED AT ALL?
	CAMGE	T2,CUTOFF	;AND UP TO MINIMUM LEVEL?
	JRST	TYPNXT		;NO, GO ON
	ADDM	T2,TYPED	;ADD TO TYPED OUT SAMPLES
	HRRZ	T2,T4		;GET PC VALUE
	MOVX	T3,NO%LFL+<4,,^D8>	;FOUR COLUMNS IN OCTAL
	NOUT			;TYPE IT
	 JSHLT			;FAILED
	HRROI	T2,[ASCIZ@/	@]	;MORE TEXT
	SETZ	T3,		;ALL OF IT
	SOUT			;TYPE IT
	MOVE	T2,TABLE(T4)	;GET NUMBER OF TIMES EXECUTED
	IMULI	T2,^D100	;CONVERT TO PERCENTAGE
	IDIV	T2,SAMPLE	;OF TOTAL
	MOVX	T3,NO%LFL+<4,,^D10>	;GET SET
	NOUT			;TYPE IT
	 JSHLT			;FAILED
	HRROI	T2,[ASCIZ/	 /]	;GET READY
	SETZ	T3,		;TO SPACE
	SOUT			;DO IT
	MOVE	T2,TABLE(T4)	;GET NUMBER OF TIMES EXECUTED
	MOVEI	T3,^D10		;DECIMAL OUTPUT
	NOUT			;TYPE IT
	 JSHLT			;FAILED
	HRROI	T2,[ASCIZ/
/]				;FINISH WITH A CRLF
	SETZ	T3,		;ALL OF IT
	SOUT			;TYPE IT

TYPNXT:	AOBJN	T4,TYPLOP	;LOOP OVER WORDS
	MOVE	T2,SAMPLE	;GET TOTAL SAMPLES
	CAMN	T2,TYPED	;TYPED THEM ALL?
	JRST	HAVALL		;YES, SKIP OUTPUT
	HRROI	T2,[ASCIZ/
Samples not shown: /]		;GET READY
	SETZ	T3,		;ALL OF THE TEXT
	SOUT			;DO IT
	MOVE	T2,SAMPLE	;GET TOTAL SAMPLES
	SUB	T2,TYPED	;DECREMENT NUMBER TYPED
	MOVEI	T3,^D10		;DECIMAL
	NOUT			;TYPE IT
	 JSHLT			;ERROR
HAVALL:	HRROI	T2,[ASCIZ/

/]				;FINAL CRLFS
	SETZ	T3,		;END ON NULL
	SOUT			;TYPE IT
	JRST	AGAIN		;LOOP AGAIN
	SUBTTL	DATA




CUTOFF:	BLOCK	1		;LOWEST NUMBER OF SAMPLES TO TYPE
TYPED:	BLOCK	1		;NUMBER OF SAMPLES OUTPUT
SAMPLE:	BLOCK	1		;NUMBER OF SAMPLES TO DO
TABLE:	BLOCK	PCMASK+1	;NUMBER OF TIMES EACH PC WAS SEEN



	END	DX20PC