perm filename PINK.OLD[HAK,ROB] blob
sn#429126 filedate 1979-04-02 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00007 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 TITLE PINK
C00004 00003 BufIni: Initialize buffer area into linked list
C00006 00004 AllWho: Fill WhoLine records with information on all jobs
C00008 00005 AllSorts: Sort a WhoLine array into people, phantoms, and segments.
C00011 00006 PerSort:
C00012 00007 executable code
C00013 ENDMK
C⊗;
TITLE PINK
; see also WHOPHN.FAI[S,MRC]
; ac definitions
AC1 ← 1;
AC2 ← 2;
AC3 ← 3;
AC4 ← 4;
AC5 ← 5;
P ← 17;
; data storage
pdlen ←← 20;
pdl: BLOCK pdlen
pdlptr: IOWD pdlen,pdl
LoJob←←=1 ; Lowest valid job #
HiJob←←=63 ; Highest valid job #
MaxJob←←HiJob-LoJob+1 ; Maximum number of jobs possible
; WhoLine Record Definition
Next ←← 0 ; Offset to Next link word
JobN ←← 1 ; Offset to Job Number
Stat ←← 2 ; Offset to Job Status Word
Text ←← 3 ; Offset to WhoLine Text
RecLen ←← 3+=22 ; Length of one record
; 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
RecBuf: BLOCK RecLen*MaxJob ; Storage for WhoLine records
BufIni: ; Initialize buffer area into linked list
COMMENT ⊗
This procedure will turn a block of uninitialized storage into a linked
list of 'WhoLine' records. The link word of each record points to the
next. The last record of the list has a null(0) link word.
The job number for the corresponding record is also initialized.
INPUTS:
AC1: pointer to first word of array to be initialized
OUTPUTS:
AC1: pointer to first record of linked list
REGISTER USAGE:
AC1: Pointer to Previous record under consideration
AC2: Pointer to Current record under consideration
AC3: Current job # under consideration
⊗;
PUSH P,AC1 ;
PUSH P,AC2 ;
PUSH P,AC3 ;
MOVEI AC3,LoJob ; Initialize MaxJob records
MOVE AC2,AC1 ; This ← first record
JRST BufEntr ; jump into loop
Bufloop: ;
MOVE AC1,AC2 ; Prev ← This
ADDI AC2,RecLen ; point to next record
MOVEM AC2,Next(AC1) ; point Next(Prev) to This
BufEntr: ;
SETZM ,Next(AC2) ; clear Next(This)
MOVEM AC3,JobN(AC2) ; set JobNumber for this record
AOJ AC3, ; next job
CAIG AC3,HiJob ; until all jobs done
JRST Bufloop ;
POP P,AC3 ;
POP P,AC2 ;
POP P,AC1 ;
POPJ P,
AllWho: ; Fill WhoLine records with information on all jobs
COMMENT ⊗
This procedure will fill up a linked list of WhoLine records with information
on all jobs.
INPUTS:
AC1: pointer to first record of a linked list of WhoLine records
OUTPUTS:
each record filled with appropriate job info
REGISTER USAGE:
AC1: pointer to Current record under consideration
AC2: Current job under consideration
AC3: general bit slinging
⊗;
PUSH P,AC1 ;
PUSH P,AC2 ;
PUSH P,AC3 ;
Allloop: ;
MOVE AC2,JobN(AC1) ; fetch job number of this record
MOVE AC3,AC2 ;
JBTSTS AC3, ; fetch job status word for current job
MOVEM AC3,Stat(AC1) ; and store in Stat field of current record
HRRZ AC3,AC1 ;
ADDI AC3,Text ; set pointer to text field of current record
HRL AC3,AC2 ; left half gets job #
WHO AC3, ; fetch wholine text for current job
MOVE AC1,Next(AC1) ; next record
JUMPN AC1,Allloop ; until at end of list
POP P,AC3 ;
POP P,AC2 ;
POP P,AC1 ;
POPJ P,
AllSorts: ; Sort a WhoLine array into people, phantoms, and segments.
COMMENT ⊗
This procedure will process the information found in a wholine array
(as filled by the AllWho routine), and return with pointers to three
linked lists within the array: a list of people logged in, a list of
pantom jobs, and a list of upper segments.
INPUTS:
AC1: pointer to first record of a linked list of WhoLine records
OUTPUTS:
AC1: pointer to first record of a linked list of people
AC2: pointer to first record of a linked list of phantoms
AC3: pointer to first record of a linked list of upper segments
REGISTER USAGE:
AC4: pointer to Current record under consideration
⊗;
PUSH P,AC4 ;
PUSH P,AC5 ;
MOVE AC4,AC1 ; look at first record
SortLoop: ;
MOVE AC5,Stat(AC4) ; fetch job status
TLNE AC5,RealJob ; is it a job at all?
JRST NextJob ; no - skip it
TLNE AC5,LogdIn ; is it logged in?
JRST NotHuman ; no - its not a human
GotPerson: ; this one is a real live human's job
MOVE AC1,JobN(AC4)
MOVEI AC2,1 ;
JRST NextJob ; go look at next job
NotHuman: ; Either a segment or a pantom
TLNE AC5,IsSeg ; is it a segment?
JRST GotFantom ; no - it is a segment
GotSegment: ; this one is a segment
JRST NextJob ; go look at next job
GotFantom: ; this one is a phantom, sort onto Fantom list
JRST NextJob ; go look at next job
NextJob:
MOVE AC4,Next(AC4) ; This ← NEXT(This)
JUMPN SortLoop ; Loop until entire list has been scanned
POP P,AC5 ;
POP P,AC4 ;
POPJ P, ;
PerSort:
MOVE AC1,Jobn(AC4)
MOVEI AC2,1
POPJ P,
FanSort:
MOVE AC1,Jobn(AC4)
MOVEI AC2,2
POPJ P,
SegSort:
MOVE AC1,Jobn(AC4)
MOVEI AC2,3
POPJ P,
; executable code
start:
MOVE P,pdlptr ;
MOVEI AC1,RecBuf ;
PUSHJ P,BufIni ; Initialize the FS region
; MOVEI AC1,RecBuf ;
PUSHJ P,AllWho ; Gather information on all the jobs
; MOVEI AC1,RecBuf ;
PUSHJ P,AllSorts ; Sort the records into people, phantoms, and Devos
EXIT
END start