;*****************************************************************
; JOBARY.M68 - JOB ARRAY Subroutine
;
; by Dave Heyliger - AMUS Staff
;
; Returns all JOBs defined to the system in an array. Array ends with "".
;
; Usage: XCALL JOBARY,array
; where array is MAP1 array(40),S,6,"" (you may modify the 40)
;
; Sample BASIC program:
;
; MAP1 names(40),S,6 ! 40 is not mandatory. Must be > #JOBS
;
; XCALL JOBARY,names(1) ! note names(1) !!!
; FOR I = 1 TO 40
; IF names(I) = "" THEN I = 40 &
; ELSE PRINT names(I)
; NEXT I
;********************************************************************
PARSE: CMPW XC.ARG(A3),#1 ;1 argument specified?
BNE INERR ;nope, error
CMPW XC.TY1(A3),#XC$STR ;string?
BNE INERR ;nope, error
CMP XC.SZ1(A3),#6 ;should be this big
BLT INERR ;nope, error
SETUP: MOV JOBTBL,A0 ;get start of job table listing
MOV XC.AD1(A3),A2 ;get start of array into A2
LOOP: MOV (A0)+,A4 ;A4 points to a JCB or a -1
MOV A4,D0 ;set status register
BMI DONE ;if -1 then done
BEQ LOOP ;no attached JOB but still not done
10$: LEA A1,JOBNAM(A4) ;point A1 to RAD50 job name
UNPACK ;unpack 1st half of job name
UNPACK ;unpack 2nd half of job name
BR LOOP ;get next JOB
DONE: CLR @A2 ;end array with null
RTN ;and return
INERR: TYPECR <Error in entry format for JOBARY.SBR>
RTN