perm filename PINK.FAI[HAK,ROB]2 blob sn#436094 filedate 1979-04-22 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00008 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002		TITLE PINK
C00005 00003		.SBTTL	Static Data
C00014 00004		.SBTTL	Data Storage
C00015 00005	GETINFO JOBPNT SETUP
C00019 00006	ALLWHO ALLWH1 ASExit NotRJob GotPerson GotFantom GotSegment ADDREC
C00024 00007	TxtPer - 'Textify' one job record, assuming Person type job
C00026 00008	START
C00028 ENDMK
C⊗;
	TITLE PINK

; see also WHOPHN.FAI[S,MRC]

; ac definitions
AC1 ← 1;
AC2 ← 2;
AC3 ← 3;
AC4 ← 4;
AC5 ← 5;
P ← 17;
PDLEN←←40	;

; offsets into system table
SYSTAB←←400000	; The system table will be mapped as an upper segment
JBTSTS←←210	; job status table
PRJPRG←←211	; prj,prg name (sixbit) table
JOBNAM←←225	; job name table
MAXJOB←←222	; highest job number possible

; Masks for left half of words returned by a JBTSTS UUO.
RealJob	←← 40000	; The job is either a person, phantom, or segment
LogdIn	←← 10000	; The job is logged in, so it is a real person
IsSeg	←←  1000	; The job is a segment

	SET	JobRec,0	; Job Info Record Definition
	USE	JobRec
J.Next::BLOCK	1	; Link to next record
J.JobN::BLOCK	1	; Job number of this record
J.PPN::	BLOCK	1	; Sixbit PPN for this job
J.JNam::BLOCK	1	; Sixbit Job Name for this job
J.Stat::BLOCK	1	; Status word (from JBTSTS) for this job
J.TTY:: BLOCK	1	; Controlling TTY for this job
JLength ←← .		; Length of this record
	USE

; Screen definitions for the text output
ScrWid←←=78		; The width of a screen (in characters)
NCols←←2		; The number of columns in our format
LinLen←←ScrWid/Ncols	; The number of characters per line of text
NTWrds←←<LinLen+5>/5	; The number of words used per line of text

	SET	TxtRec,0	; Text Record Definition
T.Next::BLOCK	1		; Link to next record
T.Txt::	BLOCK	TTWrds		; One line of text
	USE

	.SBTTL	Static Data

comment ⊗

0         1         2         3         4
01234567890123456789012345678901234567890

34MLB:Marc Le Brun66Moravec
JJPPN:NNNNNNNNNNNNTTRRRRRRRRRRRRRRRRRR JJPPN:NNNNNNNNNNNNTTRRRRRRRRRRRRRRRRRR

Balasubramanian Kumar
Music Lab, Chowning, Grey, Loy, Rush, Smith

a routine that takes:
pointer to source string (ILDB type pointer)
pointer to destination string (IDPB type pointer)
and copies until one or t'other is exhausted

⊗;
	.SBTTL	Data Storage

PerLst:	BLOCK	JLength		; dummy listhead for Person list
FanLst:	BLOCK	JLength		; dummy listhead of Phantom list
SegLst:	BLOCK	JLength		; dummy listhead of Segment list
RecBuf:	BLOCK 	JLength*=64	; Storage for Job Info Records
TxtBuf:	BLOCK	TLength*=64	; Storage for Text Records

PDLPTR:	IOWD	PDLEN,PDL
PDL:	BLOCK	PDLEN
;GETINFO JOBPNT SETUP

; GetInfo(jobrec,jobnum)	; fill a job record with info about a job
;   This procedure will fill all the fields (except the link words) of a
;   job record with information on a specified job.
;
; INPUTS:
;   AC1:	pointer to record to recieve the data
;   AC2:	job number of job in question
; REGISTER USAGE:
;   AC1:	General usage - offset into system tables
;   AC2:	job # under consideration
;   AC3:	pointer to the record to get the data
;
GETINFO:
	PUSH	P,AC1
	PUSH	P,AC3
	MOVE	AC3,AC1		; Save the pointer to the record
;	SETZM	J.Next(AC3)	; zero the link word
	MOVEM	AC2,J.JobN(AC3)	; get the job # for this record
	MOVEI	AC1,PRJPRG	; get the PRJ,PRG for this job
	PUSHJ	P,JOBPNT
	MOVEM	AC1,J.PPN(AC3)
	MOVEI	AC1,JBTSTS	; get the job status for this job
	PUSHJ	P,JOBPNT
	MOVEM	AC1,J.Stat(AC3)
	MOVEI	AC1,JOBNAM	; get the job name for this job
	PUSHJ	P,JOBPNT
	MOVEM	AC1,J.JNam(AC3)
	POP	P,AC3
	POP	P,AC1
	POPJ	P,

; JobPnt(TablePointer,JobNum)
;    This routine will return the dataum from a table of job information of some
;    specific type.  For exapmle, if AC1 contains 211, and AC2 contains 5, then
;    a the PRJPRG for job 5 is returned in AC1.
;    ** This routine assumes the system table has been mapped into high core via
;    a SETPR2 call **.
;
; INPUTS:
;   AC1:	offset into system table pointer to job table info
;   AC2:	current job number
; OUTPUTS:
;   AC1:	job table information
;
JOBPNT:
	MOVE AC1,STSTAB(AC1)	; fetch pointer to table in ac1
	ADD  AC1,AC2		; make index into table
	MOVE AC1,SYSTAB(AC1)	; fetch the data from the table
	POPJ P,			; and return

; SetUp
;   Maps the job tables as an upper segment (starting at 400000)
;   Gotta call this routine before trying to do any of the above
;   routines.
;
SETUP:				; map the job low core as an upper segment
	PUSH P,AC1
	MOVSI AC1,377777
	SETPR2 AC1,
	HALT			; error return - help!
	POP P,AC1
	POPJ P,

;ALLWHO ALLWH1 ASExit NotRJob GotPerson GotFantom GotSegment ADDREC

; AllWho - get the info on all jobs, split into people, fantoms, segments
;
; This routine fills records with raw data on all jobs, from job 0 to the highest 
; possible job.  The individual records are split into three lists, one for
; jobs that are associated with Real People, one for jobs that are Phantoms, and
; one for jobs that are naught but some poor luser's upper Segment.
;
; register usage:
;   AC1		current record under consideration
;   AC2		current job #
;   AC3		general - Job Status.
;
ALLWHO:
	PUSH	P,AC1		;
	PUSH	P,AC2		;
	PUSH	P,AC3

	PUSHJ	P,SETUP		; setup system tables as upper segment
	SETZM	PerLst		; clear the linked lists
	SETZM	FanLst		;
	SETZM	SegLst		;
	MOVEI	AC1,RecBuf	; start with first record in RecBuf
	SETZM	AC2		; start with job 0
ALLWH1:
	PUSHJ	P,GetInfo	; get a record's worth of info on this job
	MOVE	AC3,J.Stat(AC1)	; fetch job status
	TLNN	AC3,RealJob	; is it a job at all?
	JRST	NotRJob		;   no - let's ignore it
	TLNE	AC3,IsSeg	; is it an upper segment?
	JRST	GotSegment	;   yep - 
	TLNE	AC3,LogdIn	; is it logged in?
	JRST	GotPerson	;  yes, it's a real live human
	JRST	GotFantom	;  nope, must be a phantom

ASExit:				; exit routine for all the above
	ADDI	AC1,JLength	; get pointer to next free record in RECBUF
	ADDI	AC2,1		; look at next job
	CAMG	AC2,SYSTAB+MAXJOB	;
	JRST	ALLWH1		; loop until highest possible job

	POP	P,AC3		;
	POP	P,AC2		;
	POP	P,AC1		;
	POPJ	P,		;

;
; These routines are all entered with AC1 pointing to the current record.
; Exit these routines via a JRST ASExit.
;
NotRJob:		; not a a job at all
	JRST	ASExit
GotPerson:		; this job is a real person
	PUSH	P,AC2
	MOVEI	AC2,PerLst	;
	PUSHJ	P,AddRec	; put this record on the Person List
	POP	P,AC2
	JRST	ASExit
GotFantom:		; this job is a phantom
	PUSH	P,AC2
	MOVEI	AC2,FanLst	;
	PUSHJ	P,AddRec	; put this record on the Person List
	POP	P,AC2
	JRST	ASExit
GotSegment:		; this job slot is senselessly taken by an upper segment
	PUSH	P,AC2
	MOVEI	AC2,SegLst	;
	PUSHJ	P,AddRec	; put this record on the Person List
	POP	P,AC2
	JRST	ASExit

;AddRec
; Insert a record at the head of the specified list.
; INPUTS:
;   AC1		pointer to record to be added
;   AC2		pointer to list head of list to add to
;
ADDREC:
	PUSH	P,AC3
	MOVE	AC3,J.Next(AC2)	; get pointer to next on list
	MOVEM	AC1,J.Next(AC2)	; point list to new record to be added
	MOVEM	AC3,J.Next(AC1)	; point Next(new) at old
	POP	P,AC3
	POPJ	P,
;TxtPer - 'Textify' one job record, assuming Person type job
;
; INPUTS:
;   AC1		pointer to Job Record to be grunched upon
;   AC2		byte pointer to Text Record to output to
;
DONAM1:
	PUSH	P,AC3
	MOVE	AC3,AC1
	MOVE	AC1,J.JobN(AC3)	; get job #
	PUSHJ	P,PUTJBN	; output the job # in the current text record
	MOVE	AC1,J.PPN(AC3)	; get the PRJPRG
	PUSHJ	P,PUTPRG	; output the PRG in the current text record
	MOVEI	AC1,":"		;
	PUSHJ	P,PUTCHR	; output a delimiter twixt PRG and real name
	MOVE	AC1,J.PPN(AC3)	;
	PUSHJ	P,PutNam	; output the real name
	MOVE	AC1,J.TTY(AC3)	;
	PUSHJ	P,PUTTTY	; output the TTY #
	MOVE	AC1,J.TTY(AC3)	;
	PUSHJ	P,PUTRM		; output the Room name
	POP	P,AC3
	POPJ	P,

; all these routines are called with a bytepointer 
PUTJBN:
	POPJ	P,
PUTPRG:
	POPJ	P,
PUTCHR:
	POPJ	P,
PUTNAM:
	POPJ	P,
PUTTTY:
	POPJ	P,
PUTRM:
	POPJ	P,
;START

START:
	MOVE	P,pdlptr	;
	PUSHJ	P,AllWho	; Get data on all people, fantoms, and segments
	EXIT

	END 	START