.MCALL .MODULE .MODULE MTGET,VERSION=06,COMMENT=,IDENT=NO,LIB=YES ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion of the above copyright notice. This software, or ; any other copies thereof, may not be provided or otherwise ; made available to any other person except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. .SBTTL Module Declaration .NLIST .ENABL LC .DSABL GBL .NLIST CND .LIST ;+ ; ; FACILITY: ; ; RT-11 System Subroutine Library (SYSLIB) ; ; CALLABLE ENTRIES: ; ; MTGET, MTATCH ; ; ENVIRONMENT: ; ; The I-form routines can be used by any job running in a single- ; or multi-job environment with multiterminal support. ; ; The M-form routines can be used by any job running in a single- ; or multi-job mapped or unmapped environment with multiterminal ; support. ; ; INCLUDE FILES: ; ; SYSMAC.SML ; RT-11 system macro library. .MCALL .BR .MCALL .MTSET ; MTSET programmed request. ; ; EXTERNAL REFERENCES: ; .GLOBL $SYSLB ; Include system library work area. .GLOBL $NXVAL ; Entry point to next value routine. .GLOBL $NXADR ; Entry point to next address routine .GLOBL $ERRP0 ; Entry point to EMT error conver rtn .WEAK $MSARG ; Trap code for missing argument .GLOBL $NOARG ;Flag to indicate no argument present .GLOBL $AMODE ;Routine to process AMODE argument ; ;- .SBTTL MTGET,MTATCH - Fortran Callable Routines ;+ ; ; FUNCTIONAL DESCRIPTION: ; ; MTGET ; Requests information about a specific terminal in a ; multiterminal system ; ; MTATCH ; Allocates a terminal for the exclusive use by the ; requesting job. ; ; CALLING SEQUENCE: ; ; i = MTGET ( unit, addr [, jobnum] ) ; i = MTATCH ( unit [, addr] [, jobnum] [, amode] ) ; ; INPUT PARAMETERS: ; ; R5 address of argument list ; 0(R5) argument count ; 2(R5) address of terminals logical unit number ; ; arguments beyond the first depend on the call: ; ; MTGET ; 4(R5) address of the terminal status block ; 6(R5) address of the word to receive the job number if the ; terminal is attached by another job ; ; MTATCH ; 4(R5) address of an asynchronous terminal status word ; 6(R5) address of the word to receive the job number if the ; terminal is attached by another job ; 10(R5) address of the string specifying the asynchronous ; terminal status word address space {U|S} ; ; ROUTINE VALUE: ; ; MTGET: ; R0 function return ; 0 normal return ; 2 Unit number is invalid ; 3 Unit does not exist ; 5 Unit is attached by another job, number returned in jobnum ; 6 With XM, the status block address is not in valid ; user virtual address space ; 7 Unit is attached by a handler, name returned in jobnum ; ; MTATCH: ; R0 function return ; 0 normal return ; 3 Unit does not exist ; 5 Unit is attached by another job, number returned in jobnum ; 6 With XM, the status block address is not in valid ; user virtual address space ; 7 Unit is attached by a handler, name returned in jobnum ; -19. Invalid mode argument ; ;- .PSECT SYS$I .ENABL LSB MTATCH:: MOV #5,R1 ;Set function code BR $MTCMN ; and join common code MTGET:: MOV #1,R1 ;Set function code .BR $MTCMN $MTCMN: MOV (R5)+,R4 ;R4 (low byte) contains argument count MOV SP,R2 ;R2 -> End of EMT area SUB #<3*2>,SP ; which will be built on the stack CALL $NXVAL ;Get unit number BCS ERR ;Required argument... MOV R0,-(R2) ;Move unit to EMT area CLR R0 ;Default status word address CALL $NXADR ;Get status word address BCC 10$ ;Got it... CMP R1,#1 ;None, is this MTGET? BEQ ERR ;Yes, required argument for MTGET 10$: MOV R0,-(R2) ;Move to EMT area BIS #37*400,R1 ;Merge EMT subcode with function MOV R1,-(R2) ;Move to EMT area on stack MOV #$NOARG,R0 ;Default to no argument CALL $NXADR ;Get address of jobnum MOV R0,R2 ;R2 -> jobnum CALL $AMODE ;Process AMODE argument BCS 30$ ;Invalid mode argument specified, ; error code (-19.) in R0 BIS (SP)+,2(SP) ;Set address space flag .MTSET SP,CODE=NOSET ;Perform the request MOV R0,R3 ;Save R0 for possible return in JOBNUM CALL $ERRP0 ;Get and convert any EMT errors CMP R0,#5 ;Is unit attached by another job? BEQ 20$ ;Yes... CMP R0,#7 ;Is it attached by a handler? BNE 30$ ;Nope... 20$: CMP R2,#$NOARG ;Was JOBNUM specified? BEQ 30$ ;Nope... MOV R3,@R2 ;Return job number or handler name 30$: ADD #<3*2>,SP ;Dump the EMT area RETURN ERR: TRAP $MSARG ;Report missing arguments... RETURN .DSABL LSB .END