;*************************** AMUS Program Label ******************************
; Filename: JOBNUM.M68 Date: 07/31/91
; Category: SBR Hash Code: 606-003-263-654 Version: 1.0
; Initials: Name: Try your name
; Company: Pick one in the US of A. Telephone #:
; Related Files: XCALL.M68
; Min. Op. Sys.: AMOSL 1.1 Expertise Level: BEG
; Special: None
; Description: Returns the job's number (unique) according to the job's
; position in the job table. If the return value = ZERO then
; the job was not found.
;
;*****************************************************************************
;*; Updated on 31-Jul-91 at 11:32 AM by Tager Evans; edit time: 0:03:29
;JOBNUM.SBR
;
;Call: XCALL JOBNUM, number
;
;Where: number = binary-2 (word) variable to receive the position of the
; job in the job table. If number = 0 then job was not found in
; table.
;
VMAJOR=1
VMINOR=0
OBJNAM .SBR
SEARCH SYS
SEARCH SYSSYM
; The following file, XCALL.M68, is located in P,PN [100,52].
; Copy this file from the Network and place it in DSK0:[7,7].
COPY XCALL.M68 ; Saves you from typing it in.
PHDR -1,PV$RSM,PH$REE!PH$REU
ENTRY: CMPW XC.ARG(A3),#1 ; 1 argument specified?
BLT ARGERR ; no
CMPW XC.TY1(A3),#XC$BIN ; binary argument specified?
BNE TYPERR ; no
MOV XC.SZ1(A3),D0 ; binary size valid?
CMP D0,#2 ; Is it a Binary WORD ?
BNE SIZERR ; no
GETNUM: MOV JOBTBL,A0 ; index Job Table
JOBIDX D2 ; index Job Control Block
CLR D1 ; clear job number counter
SRCHLP: MOV (A0)+,D7 ; obtain next JCB index in Job Table
BMI NOTFND ; End of list - not found
BEQ SRCHLP ; Empty Slot - Skip entry
INC D1 ; Bump job number counter by 1
CMP D7,D2 ; JCB index matches Job Table Entry ?
BNE SRCHLP ; No match - Loop
;; Match - our JCB index is found in the job table
FOUND: MOV XC.AD1(A3),A0 ; point A0 to (number) parameter
MOVW D1,@A0 ; place job number into parameter
RTN ; return to BASIC from XCALL sbr
NOTFND: CLR D1 ; ZERO out counter (Not found)
BR FOUND ; Return with a value of ZERO