;*************************** AMUS Program Label ****************************** ; Filename: JOBTRM.M68 Date: 1/19/93 ; Category: SBR Hash Code: 043-742-426-263 Version: 1.0(104) ; Initials: ML/AM Name: Steve Ash ; Company: Alpha Clean Systems, Inc. Telephone #: 5016368188 ; Related Files: ; Min. Op. Sys.: 1.xD(?) Expertise Level: INT ; Special: may not assemble using pre-2.0 assembler ; Description: AlphaBASIC SBR to return AMOS job, term, & .TDV names for ; current job & those for parent job if running under MULTI; see also ; CTLJOB.M68 & JOBNUM.M68 ;***************************************************************************** ;JOBTRM.M68 ;=========================================================================== ; ; Get Job, Terminal, & Terminal Driver Names ; ;=========================================================================== ; Alpha Clean Systems, Inc ; 224 S Second St ; Rogers, AR 72756 ; (501) 636-8188 ;=========================================================================== ; Usage: ; ; XCALL JOBTRM, jobnam, jobtrm, jobtdv, ctljob, ctltrm, ctltdv ; ; Where: ; jobnam = AMOS job name ; jobtrm = AMOS terminal name ; jobtdv = AMOS terminal driver ; ctljob = MULTI controller job name (if job has been spawned by MULTI) ; ctltrm = MULTI controller job terminal name (") ; ctltdv = MULTI controller job terminal driver (") ; ; All "jobxxx" & "ctlxxx" are string vars at least 6 bytes long. ; All arguments will be returned with trailing spaces stripped. ; ;=========================================================================== ; Revision History ; === Vers 1.0 === ; [100] 08-Sep-88 - initial release /who ; [101] 16-Sep-88 - fix pblm w/DEPACK NULLing out 1st byte past arg if ; arg contains no spaces /saa ; [102] 16-Sep-88 - change BEQ to JEQ due to [101] above /saa ; [103] 16-Sep-88 - added arg-tests for debugging /saa ; [104] 09-Oct-90 - add conditional assembly code for .SBR/.XBR /wda ;=========================================================================== VMAJOR=1. VMINOR=0. VSUB=0. VEDIT=104. NVALU SELECT IF EQ,SELECT ASMMSG /=== Assembling .SBR version ===/ OBJNAM .SBR ENDC IF EQ,SELECT-1 ASMMSG /=== Assembling .XBR version ===/ OBJNAM .XBR ENDC ;** External Routines ****************************************** SEARCH SYS SEARCH SYSSYM SEARCH TRM ;** Offset Definitions ***************************************** ; use .OFDEFs to eliminate need to compute each address .OFINI .OFDEF ARGCNT,2 ; argument count .OFDEF A1.TYP,2 ; argument #1 type .OFDEF A1.IDX,4 ; argument #1 index .OFDEF A1.SIZ,4 ; argument #1 size .OFDEF A2.TYP,2 ; argument #2 type .OFDEF A2.IDX,4 ; argument #2 index .OFDEF A2.SIZ,4 ; argument #2 size .OFDEF A3.TYP,2 ; argument #3 type .OFDEF A3.IDX,4 ; argument #3 index .OFDEF A3.SIZ,4 ; argument #3 size .OFDEF A4.TYP,2 ; argument #4 type .OFDEF A4.IDX,4 ; argument #4 index .OFDEF A4.SIZ,4 ; argument #4 size .OFDEF A5.TYP,2 ; argument #5 type .OFDEF A5.IDX,4 ; argument #5 index .OFDEF A5.SIZ,4 ; argument #5 size .OFDEF A6.TYP,2 ; argument #6 type .OFDEF A6.IDX,4 ; argument #6 index .OFDEF A6.SIZ,4 ; argument #6 size ;** Macro Definitions ****************************************** ; UNPACKs 4 RAD50 chars into 6 ASCII; NULLs 1st SPace in string DEFINE DEPACK arg ;UNPACKs 4 MOV arg(A3),A2 ;point to basic xcall arg UNPACK ;1st 2 bytes -> 3 chars UNPACK ;2nd 2 bytes -> 3 chars MOVB #-1,D0 ;set space cnt for pre-increment[101] 10$$: INCB D0 ;pre-increment space cnt [101] CMPB -(A2),#40 ;are we at a space? BEQ 10$$ ; yes - decrement arg index TSTB D0 ;were there any spaces? [101] BEQ 20$$ ; no - go on [101] CLRB 1(A2) ; yes - set 1st space to NUL 20$$: ; [101] ENDM ; makes sure argument-type is a string [103] DEFINE CKATYP arg1,arg2 CMPW arg1(A3),arg2 ;is arg a string JNE ARGERR ; no ENDM ;** Main Routine *********************************************** START: PHDR -1,0,PH$REE!PH$REU CMPW ARGCNT(A3),#6 ;are there 6 arguments passed? JNE ARGERR CKATYP A1.TYP,#2 ;check arg-1 type [103] CKATYP A2.TYP,#2 ;check arg-2 type [103] CKATYP A3.TYP,#2 ;check arg-3 type [103] CKATYP A4.TYP,#2 ;check arg-4 type [103] CKATYP A5.TYP,#2 ;check arg-5 type [103] CKATYP A6.TYP,#2 ;check arg-6 type [103] ; Get job name JOBIDX A6 ;index JCB LEA A1,JOBNAM(A6) ;point A1 to RAD50 job name DEPACK A1.IDX ;convert to ASCII ; The following lines check to see if JOBNAM starts w/a "%" -- for ; MULTI spawned jobs -- if so, it replaces it w/an "M". ; ; MOV A1.IDX(A3),A2 ;repoint to JOBNAM argument ; CMPB (A2),#'% ;is 1st byte a "%" ; BNE 15$ ;no - so go on ; ; MOVB #'M,(A2) ;yes - so replace w/"M" ; Get terminal name 15$: JOBIDX A6 ;index JCB MOV JOBTRM(A6),A1 ;point to terminal status word SUB #4,A1 ;A1 points to the terminal name DEPACK A2.IDX ;convert to ASCII ; Get terminal driver name JOBIDX A6 ;A1 points to JCB MOV JOBTRM(A6),A1 ;A1 points to terminal status word MOV T.TDV(A1),A1 ;point to the terminal driver SUB #4,A1 ;A1 points to the terminal driver name DEPACK A3.IDX ;convert to ASCII ; Check to see if it's a MULTI spawned job JOBIDX A6 ;index JCB MOV JOBATT(A6),D6 ;get controller job JEQ EXIT ;none so go exit [102] ; Get controller job name MOV D6,A6 ;get owner job address LEA A1,JOBNAM(A6) ;point A1 to RAD50 job name DEPACK A4.IDX ;convert to ASCII ; Get controller job terminal name JOBIDX A6 ;index JCB MOV JOBATT(A6),A6 ;get controller job MOV JOBTRM(A6),A1 ;point to terminal status word SUB #4,A1 ;point to the terminal name DEPACK A5.IDX ;convert to ASCII ; Get controller job terminal driver name JOBIDX A6 ;index JCB MOV JOBATT(A6),A6 ;get controller job MOV JOBTRM(A6),A1 ;point to terminal status word MOV T.TDV(A1),A1 ;point to the terminal driver SUB #4,A1 ;A1 points to the terminal driver name DEPACK A6.IDX ;convert to ASCII EXIT: RTN ;normal exit ;****** Error Routines ***************************************** ; display argument error message & exit to AMOS [103] ARGERR: MOVW #<-1_8.>+37.,D1 ;make sure TCRT ; screen is on MOV #7,D1 ;ring terminal TTY ; bell TYPE IF EQ,SELECT TYPE ENDC IF EQ,SELECT-1 TYPE ENDC TYPESP < - Notify Tech Support> KBD ;get KBD input RTN ;return to AlphaBASIC END ;=========================================================================== .