;*; Updated on 13-Jan-92 at 11:29 AM by Michele Tonti; edit time: 0:00:17
; this program searchs the job table for the user's job and returns the line
; number in the table of the user's job.  syntax for calling from basic is
;               XCALL USERNO,FFFF
; where FFFF is a floating point number.
;       written by Robert Kurz, 1547 Cherrywood Drive, Martinez, CA 94553
;       donated by Robert Kurz & Doug Shaker
;
; Slightly modified for AAA 04-23-86
;
SEARCH SYS                              ;Collecting monitor calls
SEARCH SYSSYM

OBJNAM USERNO.SBR                       ;notice .SBR extension

USERNO: PHDR    -1,0,PH$REE!PH$REU      ; Re-entrant and re-usable
        CMPW    (A3)+,#1                ; number of arguments must be 1
        BNE     SYNTAX                  ; else print out syntax error msg.
        MOVW    (A3)+,D5                ; type of argument
        ANDW    #7,D5                   ; mask off "type" (bits 0..2)
        CMPW    D5,#4                   ; must be floating point
        BNE     SYNTAX                  ; else syntax error message
        MOV     (A3)+,A2                ; address of variable to A2
        JOBIDX  A1                      ; get the address of our job
        MOV     JOBTBL,A0               ; get the address of the jobtable
        CLR     D1                      ; and clear the "count"
LOOP:   INC     D1                      ; increment job number
        CMP     A1,(A0)+                ; compare this entry to our job
        BNE     LOOP                    ; if not the same try the next one
        FLTOF   D1,@A2                  ; convert to floating point
        RTN                             ; all done
SYNTAX: TYPECR  <XCALL USERNO must have one floating point argument>
        RTN
END