Google
 

Trailing-Edge - PDP-10 Archives - tops10_tools_bb-fp64b-sb - 10,7/dbusy/dbusy.mac
There are 4 other files named dbusy.mac in the archive. Click here to see a list.
	TITLE	DBUSY -- Count number of disk UNITS BUSY

;COPYRIGHT (C) 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
;TRANSFERRED.
;
;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.

;Assembly instructions:  .LOAD DBUSY

	SEARCH	MACTEN,UUOSYM,SNUP
	.REQUIRE SNUP
	SALL

	DEFINE	COMAND<
	XX	"A",<PUSHJ P,SETALL>
	XX	"C",<PUSHJ P,COM.C>
	XX	"H",<PUSHJ P,HELP>
	XX	"N",<PUSHJ P,SET.RN>
	XX	"P",<PUSHJ P,SET.RP>
	XX	"R",<PUSHJ P,REFRESH>
	XX	"V",<PUSHJ P,SETHPQ>
	XX	" ",<PUSHJ P,DATDMP>
	XX	"<",<PUSHJ P,SLOWER>
	XX	">",<PUSHJ P,FASTER>
	XX	4,<PUSHJ P,TODDT>
	XX	32,<JRST CONTRZ>
>

	DEFINE	COUNT(HISTO)<
	CAIL	%T1,HSTLEN-1	;IN RANGE?
	MOVEI	%T1,HSTLEN-1	;NO, USE DEFAULT CASE
	ADD	%T1,%R		;RELOCATE OFFSET
	AOS	HISTO(%T1)	;HISTOGRAM IT
>

ESC==33
	DEFINE	HOME<
	OUTCHR	[ESC]
	OUTCHR	["H"]
>
	DEFINE	CLEAR<
	OUTCHR	[ESC]
	OUTCHR	["J"]
>
	DEFINE	MOVETO(XP,YP)<
	OUTCHR	[ESC]
	OUTCHR	["Y"]
	PUSH	P,SECRET
	MOVE	SECRET,YP
	ADDI	SECRET," "
	OUTCHR	SECRET
	MOVE	SECRET,XP
	ADDI	SECRET," "
	OUTCHR	SECRET
	POP	P,SECRET
>
	DEFINE	OBYTE(LIST)<IRP LIST,<
	MOVEI	T0,LIST
	IDPB	T0,T4>
>
	DEFINE	ODEC(WID)<
	SETZB	T0,T2
	MOVE	T3,[SETZ WID]
	EXTEND	T0,[CVTBDO "0"
		           " "]
	HALT
>

HSTLEN==20
NL==10

D==1	; Disk output channel
IDDNUM==^D<5*6>	; .2 * seconds between screen updates (initial value)
T0=0
T1=T0+1
T2=T1+1
T3=T2+1
T4=T3+1
P1=T4+1
P2=6
P3=7
C=10
HACK=12
SECRET=HACK+1

	MONREF	<CHN0CB,.CHSYS,CHNQUL,UNISTS,UNISYS,UNIQUL>
	MONREF	<UNYKTP,PCOD,TCOD,TWCOD,TYPRP,TYPRN>
	BRKPNT	APRSU1,COLECT

DBUSY:	JFCL
	RESET
	MOVE	P,[-20,,PDL]
	PUSHJ	P,ZAPTOT
	SETOM	U.TYPE
	SETZM	HI.PRI
	MOVEI	T1,IDDNUM
	MOVEM	T1,DDNUM

	MOVE	T1,[%LDUNI]
	GETTAB	T1,
	FATL	<GETTAB failure for %LDUNI>
	HLRZM	T1,UNIT.P
	PUSHJ	P,GETINF##
REBREAK:PUSHJ	P,SCREEN
	PUSHJ	P,XWRSNP##
	SETZM	COUNTR
FOO:	SOSGE	COUNTR
FOOBAR:	PUSHJ	P,DATDMP
	SOSL	T1,HI.PRI
	JRST	CHKV
FOO3A:	SKPINC
	JRST	[MOVEI	T1,^D200
		 HRLI	T1,(HB.RTC)	; OR CHARACTER
		 HIBER	T1,
		 JFCL
		 SKIPGE HI.PRI
		 JRST	FOO
		 JRST	FOOBAR]
	INCHRW	T1
	CAIL	T1,"a"
	SUBI	T1,40
	MOVSI	T2,-COMLEN
CLOOP:	CAMN	T1,COMTAB(T2)
	XCT	COMINS(T2)
	AOBJN	T2,CLOOP
	HOME
	MOVETO	([1],[^D22])
	OUTSTR	[BYTE (7)ESC,"K",0,0,0]
	JRST	FOO		;END OF COMMAND

CHKV:	JUMPN	T1,FOO3A
	HOME
	CLEAR
	PUSHJ	P,DATDMP
CHKV3:	HPQ	T1,		; TO HPQ 0
	  JFCL
	JRST	FOO

CONTRZ:	HOME
	CLEAR
	REMBRK			;REMOVE BREAKPOINTS
	RESET
	EXIT	1,
	HALT	.
	JRST	REBREAK

SETALL:	SETOM	T1
	JRST	SETANY
SET.RN:	SKIPA	T1,TYPRN
SET.RP:	MOVE	T1,TYPRP
SETANY:	MOVEM	T1,U.TYPE
	PUSHJ	P,ZAPTOT
	PUSHJ	P,SCREEN
	MOVEI	T1,1
	SLEEP	T1,	; Get some data
	PJRST	DATDMP

TODDT:	HRRZ	T1,.JBDDT##
	JUMPN	T1,(T1)
	OUTSTR	[ASCIZ /? No DDT
/]
	MOVEI	T1,^D200
	HIBER	T1,
	JFCL
	POPJ	P,

REFRESH:PUSHJ	P,SCREEN
	PJRST	DATDMP

FASTER:	MOVE	T1,DDNUM
	LSH	T1,1
	TRO	T1,1
	IDIVI	T1,3
	MOVEM	T1,DDNUM
	MOVEM	T1,COUNTR
	POPJ	P,

SLOWER:	MOVE	T1,DDNUM
	IMULI	T1,3
	ADDI	T1,1
	LSH	T1,-1
	MOVEM	T1,DDNUM
	POPJ	P,

SETHPQ:	SKIPLE	HI.PRI
	JRST	[SETZB T1,HI.PRI
		 JRST CHKV3]
	MOVEI	T1,1
	HPQ	T1,
	JFCL
	MOVEI	T1,^D100
	MOVEM	T1,HI.PRI
	POPJ	P,

COM.C:	PUSHJ	P,ZAPTOT
	PJRST	DATDMP

HELP:	MOVSI	T2,-COMLEN
	OUTSTR	[ASCIZ /
One of: /]
HLOOP:	MOVE	T1,COMTAB(T2)
	CAIGE	T1,40
	OUTCHR	["^"]
	CAIGE	T1,40
	ADDI	T1,"A"-1
	OUTCHR	T1
	OUTCHR	[","]
	AOBJN	T2,HLOOP
	OUTSTR	[ASCIZ / no carriage return needed./]
	HOME
	OUTSTR	[BYTE(7)15,12,0,0,0]
	POPJ	P,

DATDMP:	HOME
	MOVETO	([^D4],[^D00])
	OUTSTR	[ASCIZ /Position count/]
	PUSHJ	P,TYPTYP
	MOVE	P1,[-NL,,PHISTO]
	PUSHJ	P,DUMPIT
	MOVETO	([^D4],[^D11])
	OUTSTR	[ASCIZ /Transfer count/]
	PUSHJ	P,TYPTYP
	MOVE	P1,[-NL,,THISTO]
	PUSHJ	P,DUMPIT
	OUTSTR	[BYTE(7)15,12,12,"!",33,"K",0]
	MOVE	T1,DDNUM
	MOVEM	T1,COUNTR
	POPJ	P,

TYPTYP:	OUTSTR	[ASCIZ /	(/]
	MOVE	T1,[ASCIZ /???)/]
	SKIPGE	T2,U.TYPE
	MOVE	T1,[ASCIZ /All)/]
	CAMN	T2,TYPRP
	MOVE	T1,[ASCIZ /RPx)/]
	CAMN	T2,TYPRN
	MOVE	T1,[ASCIZ /RNx)/]
	OUTSTR	T1
	OUTSTR	[BYTE(7)15,12,0,0,0]
	POPJ	P,

DUMPIT:	SETZB	P2,P3		; ZERO TOTAL
	PUSH	P,P1
DTOTAL:	ADD	P3,(P1)
	AOBJN	P1,DTOTAL
	POP	P,P1
DLOOP:	MOVE	T3,[LINE,,LINE+1]
	SETZM	LINE
	BLT	T3,LINEND
	MOVE	T4,[POINT 7,LINE]
	OBYTE	<15,12>
	MOVE	T1,P2
	ODEC	2
	OBYTE	<" "," ">
	MOVE	T1,(P1)
	ODEC	7
	OBYTE	<" "," ">
	MOVE	T1,(P1)
	IMULI	T1,^D100
	IDIV	T1,P3		; P3/ TOTAL
	PUSH	P,T1
	ODEC	3
	OBYTE	<"%"," ">
	POP	P,T1
	JUMPE	T1,ELINE
	CAILE	T1,^D60
	MOVEI	T1,^D60
STARS:	OBYTE	<"*">
	SOJG	T1,STARS
ELINE:	OBYTE	<ESC,"K",0>
	OUTSTR	LINE
	AOS	P2
	AOBJN	P1,DLOOP
	POPJ	P,

ZAPTOT:	MOVE	T1,[PHISTO,,PHISTO+1]
	SETZM	PHISTO
	BLT	T1,PHISTO+HSTLEN
	MOVE	T1,[THISTO,,THISTO+1]
	SETZM	THISTO
	BLT	T1,THISTO+HSTLEN
	POPJ	P,

SCREEN:	HOME
	CLEAR
	POPJ	P,

;HERE IN EXEC MODE ON A CLOCK TICK (CH7)

COLECT:	PUSH	%P,%T1
	PUSH	%P,%T2
	PUSH	%P,%T3
	PUSH	%P,%T4
	PUSH	%P,%U
	MOVE	%U,UNIT.P(%R)	; ADDRESS OF 1ST UNIT
	SETZB	%T1,%T4
DO.PQ1:	LDB	%T2,@UNYKTP(%R)	; GET UNIT TYPE
	SKIPL	U.TYPE(%R)	; ALL OK?
	CAMN	%T2,U.TYPE(%R)	; OR RIGHT UNIT?
	CAIA			; YES
	JRST	DO.NXT(%R)
	MOVE	%T3,%U		; T3/ UDB BASE ADDRESS
	ADD	%T3,UNISTS(%R)	; T3/ XXXXCB+UNISTS
	MOVE	%T3,(%T3)	; GET STATUS FOR THIS UDB
	CAMN	%T3,PCOD(%R)	;UNIT POSITIONING?
	AOS	%T1		;EWE-BETCHA
;	CAME	%T3,TWCOD(%R)	;TRANSFER WAIT?
	CAMN	%T3,TCOD(%R)	;OR ACTIVE?
	AOS	%T4		;YES, COUNT IT
	MOVE	%T3,UNIQUL(%R)
	ADD	%T3,%U
;	ADD	%T1,(%T3)	;PLUS LENGTH OF POSITION QUEUE
DO.NXT:	ADD	%U,UNISYS(%R)
	HLRZ	%U,(%U)
	JUMPN	%U,DO.PQ1(%R)
	COUNT	(PHISTO)	;SO MUCH FOR P'S
	MOVE	%T1,%T4
	JRST	DO.CH9(%R)

DO.CHN:	MOVE	%T2,CHN0CB(%R)
	SETZM	%T1
DO.CH1:	SKIPL	(%T2)		; WORD 0 = -1 ?
	AOS	%T1		; NO--FILE IN T STATE
	MOVE	%T3,CHNQUL(%R)
	ADD	%T3,%T2		; T3/ CHNQUL(THIS CHN DB)
	ADD	%T1,(%T3)	; T1/ TWQ ACTIVITY
	MOVE	%T3,.CHSYS(%R)
	ADD	%T2,%T3
	HLRZ	%T2,(%T2)	; T2/ NEXT CHN DB
	JUMPN	%T2,DO.CH1(%R)
DO.CH9:	COUNT	(THISTO)
	POP	%P,%U
	POP	%P,%T4
	POP	%P,%T3		;DONE, RESTORE ACS
	POP	%P,%T2
	POP	%P,%T1
	POPJ	%P,

PDL:	BLOCK	20		;PDL
	BLOCK	10		;ABJECT PARANOIA
PHISTO:	BLOCK	HSTLEN+1	;FIRST WORD TO GO TO OUTPUT FILE
	BLOCK	10		;DITTO
THISTO:	BLOCK	HSTLEN+1
	BLOCK	10		;DATTO
U.TYPE:	EXP	-1
HI.PRI:	EXP	0
UNIT.P:	EXP	444444
COUNTR:	BLOCK	1
LINE:	BLOCK	^D30
LINEND:	BLOCK	1
DDNUM:	EXP	0

	DEFINE	XX(AA,BB)<
	EXP	AA
>
COMTAB:	COMAND
COMLEN=.-COMTAB

	DEFINE	XX(AA,BB)<
	BB
>
COMINS:	COMAND
	END	DBUSY