;****************************************************************************
; TDVNAM.M68 - "Terminal Driver Name Subroutine"
;
; Written by: Dave Heyliger - AMUS Staff
;
; Purpose: To return the JOB's terminal driver name
;
; Usage: XCALL TDVNAM,tdv'name
;
; Sample BASIC program:
;
; MAP1 tdv'name,S,8,""
;
; XCALL TDVNAM,tdv'name
; PRINT "This JOB's terminal driver is "tdv'name
; END
;****************************************************************************
SEARCH SYS ;search the regulars
SEARCH SYSSYM
SEARCH TRM
OBJNAM TDVNAM.SBR ;final product
VMAJOR=1 ;original by Dave Heyliger
VMINOR=0 ;version 1.0(100)
VEDIT=100.
PHDR -1,0,PH$REE!PH$REU ; Re-entrant and re-usable
;first do some error checking....
CMPW @A3,#1 ;number of arguments must be 1
BNE 10$ ;error on input - show usage
CMPW 2(A3),#2 ;should be a string variable
BEQ 20$ ;looking good, Louis!
;error on usage - display usage to the user
10$: TYPECR <Usage: XCALL TNAME,terminal'name>
TYPECR < where "terminal'name" is a string variable.>
RTN ;return user
;real simple... point to JCB, then get the terminal name 4 bytes below
20$: JOBIDX A0 ;A1 points to JCB
MOV JOBTRM(A0),A1 ;A1 points to terminal status word
MOV T.TDV(A1),A1
SUB #4,A1 ;A1 points to the terminal driver name
MOV 4(A3),A2 ;A2 points to "terminal'name" variable
UNPACK ;unpack the terminal name
UNPACK
RTN ;and return!