;LSTUSR - Lists users of AlphaBase system
;
	MAYCREF
	SEARCH	SYS
	SEARCH	SYSSYM
	SEARCH	TRM
	JOBIDX	A6
	MOV	JOBTRM(A6),A5
	ADDW	#T$IMI+T$ECS,(A5)

	CALL	TOP
	CALL	CRLF
START:	MOV	JOBTBL,A0
	LEA	A1,BUFF
	MOV	#0,(A1)+		;set up clear buff
	MOV	#0,(A1)+
	MOV	#0,(A1)+
	MOV	#0,(A1)+
	BR	LOOP1			; skip over buffer
BLANK:	ASCII	/  /
BUFF:	BLKW	24.
LOGIN:	RAD50	/LOGIN /
FLPCTL:	RAD50	/FLPCTL/
BGPCTL:	RAD50	/BGCTL /
ABMON:	RAD50	/ABMON /
LOOP1:	MOV	(A0)+,D7
	BEQ	LOOP1			; no job allocated
	CMP	D7,#-1			; ? end of table
	JEQ	ENDTBL			; yes
	MOV	D7,A3			; no put index to jcb in a3

        ; this is the jbc indexed by a3         	 	 
LOOP:	LEA	A1,JOBNAM(A3)		; program name to be unpacked
	LEA	A2,BUFF			; where the unpack goes to
	UNPACK
	UNPACK
	MOV 	#0,(A2)
	MOV	JOBBAS(A3),D1		; job base addr.
	JEQ	LOOP1			; NEVER ON
	MOV	JOBSIZ(A3),D1		; job size
	JEQ	LOOP1			; NO MEMORY
	MOV	JOBUSR(A3),D1		; LOAD PPN NUMBER
	CMP	D1,#177777		; TEST FOR LOGOFF
	JEQ	LOOP1			; IF NOT VALID GOTO MESSAGE
	MOV	JOBPRG(A3),D1		; LOAD JOBNAME
	LEA	A4,LOGIN		; GET ADDR LOGIN
	CMP	D1,(A4)			; COMPAIR TO JOB NAME
	JEQ	LOOP1
	LEA	A4,ABMON		; GET ADDR RAD50 ABMON
	CMP	D1,(A4)			; COMPAIR TO JOB NAME
	JEQ	LOOP1
	LEA	A4,BGPCTL		; GET ADDR RAD50 BGPCTL
	CMP	D1,(A4)			; COMPAIR TO JOB NAME
	JEQ	LOOP1
	LEA	A4,FLPCTL		; GET ADDR RAD50 FLPCTL
	CMP	D1,(A4)			; COMPAIR TO JOB NAME
	JEQ	LOOP1

	MOV	JOBBAS(A3),A1		; POINT TO JOB BASE
	MOV	#0,D1
LOP:
    	MOV	@A1,D1			; size of element
	JEQ	LOOP1			; if zero then last memory mod reached
	ADD	A1,D1			; add addr. to counter for next item
	ADD	#6,A1			; move pointer to NAME
	CMP	(A1),#^H2D361C21	; MACTH FOR GIN
	JEQ	MACH
	MOV	D1,A1			; set new pointer
	JMP	LOP			; goto loop
MACH:	TTYL	BUFF			; PRINT NAME
	LEA	A2,BUFF
	TAB
 	ADD	#^H4C4,A1		; MOVE POINTER TO ID
	TTYL	(A1)			; PRINT IT
	TAB				; BLANK SPACE
	ADD	#6,A1			; BUMP POINTER TO NAME
	TTYL	(A1)			; TYPE NAME
	CALL	CRLF			; kick new line for blank between jobs
	JMP	LOOP1			; goto main loop

ENDTBL:
	EXIT				; get out of the job


NOTO:
NOMEM:
LOGOF:
	JMP	LOOP1

CRLF:	CRLF
	SUB	#1,D2
	JGE	BSK
	KBD	

TOP:	MOV	#19.,D2
	MOVW	#177400,D1	
	TCRT    
	TYPE	< Job 	ID  	Name of user>
	CRLF
	TYPE	<-------------------->
	TYPE	<-------------------->
	TYPE	<-------------------->
	TYPE	<------------------->
	CRLF
BSK:	RTN

	END