;*************************** AMUS Program Label ******************************
; Filename: JOBTSK.M68 Date: 5/14/93
; Category: SBR Hash Code: 303-576-640-271 Version: 1.0(100)
; Initials: ML/AM Name: Steve Ash
; Company: Alpha Clean Systems, Inc. Telephone #: 5016368188
; Related Files:
; Min. Op. Sys.: 1.4(?) Expertise Level: INT
; Special:
; Description: Gets AMOS job name & if it's a "spawned" job--i.e. "%TSK??"--
; translates it to "TSK###" where %TSKAA=TSK000, %TSKAB=TSK001, etc. in order
; to provide a valid AMOS file name. If not a spawned job returns name as is.
;*****************************************************************************
;JOBTSK.M68
;===========================================================================
;
; Get job name & if it's a spawned job trx it to a valid AMOS file name
;
;===========================================================================
; Alpha Clean Systems, Inc
; 224 S Second St
; Rogers, AR 72756
; (501) 636-8188
;===========================================================================
; Usage:
; Gets the AMOS job name and if it indicates that this is a "spawned"
; job -- i.e. "%TSK??" -- then returns the job-name argument as
; "TSK###" where ### = the decimal offset of the last 3 chars of
; the AMOS job name from "KAA" which is assumed to always be the
; first spawned job name.
;
; Syntax:
;
; XCALL JOBTSK, job-name
;
; Where:
; job-name = string var at least 6 bytes long
;
;===========================================================================
; Revision History
; === Vers 1.0 ===
; [100] 14-May-93 - initial release /ACS
;===========================================================================
VMAJOR = 1
VMINOR = 0
VSUB = 0
VEDIT = 100.
NVALU SELECT
IF EQ,SELECT
ASMMSG /=== Assembling .SBR version ===/
OBJNAM .SBR
ENDC
IF EQ,SELECT-1
ASMMSG /=== Assembling .XBR version ===/
OBJNAM .XBR
ENDC
;** Main Routine ***********************************************
START: PHDR -1,0,PH$REE!PH$REU
; s/b 1 string argument at least 6 bytes long
CMPW ARGCNT(A3),#1 ;is there 1 argument?
BNE ARGERR ; no
CMPW A1.TYP(A3),#2 ;is arg-1 a string
BNE ARGERR ; no
CMP A1.SIZ(A3),#6 ;is it at least 6 bytes long?
BLO ARGERR ; no
; get the job name
JOBIDX A6 ;index JCB
LEA A1,JOBNAM(A6) ;point A1 to RAD50 job name
MOV A1.IDX(A3),A2 ;index argument in BASIC
CMPW (A1),#134163 ;are first 3 chars "%TS"?
BEQ TSKJOB ;yes, so go redo job name
; job is a "regular" AMOS job name so just unpack it
UNPACK ;unpack 1st half of job name
UNPACK ;unpack 2nd half of job name
BR STRIP
; job is a "spawned" job -- i.e. named "%TSK" -- so return job name
; as "TSK###" where ### is the decimal offset from "KAA" -- as in
; "%TSKAA".
TSKJOB: MOVB #'T,(A2)+ ;move "TSK" to
MOVB #'S,(A2)+ ; first word of
MOVB #'K,(A2)+ ; BASIC job-name arg
CLR D1 ;make sure D1 is clr
MOVW 2(A1),D1 ;get 2nd 3 chars of JOBNAM as RAD50
SUB #42351,D1 ;convert to offset from "KAA"
DCVT 3,OT$MEM ;output as decimal to BASIC arg
; strip any trailing spaces
STRIP: MOVB #-1,D0 ;init space cnt to pre-increment
10$: INCB D0 ;pre-increment space cnt
CMPB -(A2),#40 ;are we at a space?
BEQ 10$ ; yes - decrement arg index
TSTB D0 ;were there any spaces?
BEQ 20$ ; no - so exit