Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_3_19910112 - stanford/5-swskit/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
	SUBTTL	DAVID I. BELL/DIB/JGZ


	SEARCH	MONSYM,MACSYM	;GET SYMBOLS
	.REQUIR	SYS:MACREL	;GET SUPPORT ROUTINES
	SALL			;NICE LOOKING MACROS
	.DIRECT	FLBLST		;NICE LISTING


;VERSION INFORMATION:

	VMAJOR==1		;MAJOR VERSION LEVEL
	VMINOR==0		;MINOR VERSION LEVEL
	VEDIT==1		;EDIT LEVEL
	VWHO==0			;WHO LAST EDITED


;DX20PC IS A PRODUCT OF THE MONITOR SUPPORT GROUP OF SOFTWARE SERVICES,
;PRIMARILY FOR INCLUSION ON THE TOPS-20 MONITOR SWSKIT.
;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.

;REVISION HISTORY:
;
;   1	JGZ	9-OCT-81
;		ADD VERSION NUMBER, CLEAN UP CODE, USE TMSG, FMSG.
;
;   2	JGZ	9-OCT-81
;		ADD ENTRY VECTOR, ACCEPT DX20 CHANNEL FROM TTY INSTEAD OF
;		HAVING IT HARD CODED, ADD REVISION HISTORY.
;


;ACCUMULATORS:

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


;CONSTANTS AND FLAGS:

	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
	RH0==540		;DEVICE CODE FOR RH20 CHANNEL ZERO
	SUBTTL	MAIN PROGRAM


;ENTRY VECTOR:

ENTVEC:	JRST	DX20PC		;START ADDRESS
	JRST	DX20PC		;REENTER ADDRESS
	BYTE(3)VWHO(9)VMAJOR(6)VMINOR(18)VEDIT	;VERSION


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
	TMSG	<
Channel number of DX20: >	;PROMPT FOR CHANNEL
	MOVEI	T1,.PRIIN	;FROM INPUT
	MOVEI	T3,^D10		;DECIMAL
	NIN			;READ IT
	 ERJMP	BADCHN		;FAILED, USE DEFAULT
	CAIL	T2,0		;POSITIVE?
	CAILE	T2,7		;IN RANGE?
BADCHN:	 JRST [	TMSG	<
?Invalid channel number
>				;COMPLAIN
		JRST	AGAIN]	;TRY AGAIN
	LSH	T2,^D26		;POSITION CHANNEL NUMBER
	MOVE	T1,[DATAI RH0,T1] ;BASE VALUE
	ADD	T1,T2		;INCORPORATE CORRECT CHANNEL
	MOVEM	T1,XDATAI	;STORE
	ADD	T2,[DATAO RH0,T1] ;ADJUST DATAO BASE VALUE FOR CHANNEL
	MOVEM	T2,XDATAO	;STORE FOR LATER XCT
	TMSG	<
Number of samples to take (10000.): >	;ASK NUMBER OF SAMPLES
	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
	TMSG	<
Minimum percentage for typeout (0): > ;ASK PERCENTAGE
	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

	MOVE	T3,XDATAO	;GET DATAO RHN,T1 FOR XCT
	MOVE	T4,XDATAI	;GET DATAI RHN,T1 FOR XCT

LOOP:	MOVX	T1,PCWORD	;GET REGISTER TO READ
	CONO	PI,PIOFF	;**** PREVENT INTERRUPTIONS
	XCT	T3		;**** TELL RH20 WHICH REGISTER TO READ
	XCT	T4		;**** 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

	TMSG	<

 PC	Percent	   Count
-----	-------	 --------
>				;DO HEADER
	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
	FMSG	</	>	;MORE TEXT
	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
	FMSG	<	 >	;SPACING
	MOVE	T2,TABLE(T4)	;GET NUMBER OF TIMES EXECUTED
	MOVEI	T3,^D10		;DECIMAL OUTPUT
	NOUT			;TYPE IT
	 JSHLT			;FAILED
	FMSG	<
>				;FINISH WITH A CRLF

TYPNXT:	AOBJN	T4,TYPLOP	;LOOP OVER WORDS
	MOVE	T2,SAMPLE	;GET TOTAL SAMPLES
	CAMN	T2,TYPED	;TYPED THEM ALL?
	 JRST	HAVALL		;YES, SKIP OUTPUT
	FMSG	<
Samples not shown: >		;MORE TEXT
	MOVE	T2,SAMPLE	;GET TOTAL SAMPLES
	SUB	T2,TYPED	;DECREMENT NUMBER TYPED
	MOVEI	T3,^D10		;DECIMAL
	NOUT			;TYPE IT
	 JSHLT			;ERROR
HAVALL:	FMSG	<

>				;FINAL CRLFS
	JRST	AGAIN		;LOOP AGAIN
	SUBTTL	DATA AREA


CUTOFF:	BLOCK	1		;LOWEST NUMBER OF SAMPLES TO TYPE
TYPED:	BLOCK	1		;NUMBER OF SAMPLES OUTPUT
SAMPLE:	BLOCK	1		;NUMBER OF SAMPLES TO DO
XDATAI:	BLOCK	1		;GENERATED DATAI RHn,T1
XDATAO:	BLOCK	1		;GENERATED DATAO RHn,T1
TABLE:	BLOCK	PCMASK+1	;NUMBER OF TIMES EACH PC WAS SEEN



	END	<3,,ENTVEC>