.MCALL .MODULE .MODULE MTSET,VERSION=04,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 Declarations .NLIST .ENABL LC .DSABL GBL .NLIST CND .LIST ; ++ ; FACILITY: ; ; RT-11 System Subroutine Library (SYSLIB) ; ; CALLABLE ENTRIES: ; ; MTSET,MTIN,MTOUT,MTRCTO,MTDTCH,MTPRNT,MTSTAT ; ; ENVIRONMENT: ; ; These routines can be used by any job running in a single-job ; or multi-job environment with multiterminal feature. It uses "TRAP" ; to provide error processing. ; ; ; INCLUDE FILES: ; ; SYSMAC.SML ; RT-11 system macro library. .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 .GLOBL $NOARG ; Missing argument code .WEAK $MSARG ; Trap code for missing argument ; ; Request format (MTSET,IN,OUT,RCTO,DTCH,PRNT,STAT/SYSLIB) ; -------------------------------------------------------- ; MTSET/MTPRNT MTIN/MTOUT ; R0 -->--------- R0 --> ------------ ; 37 | 1,7 37 |2,3 ; --------- ------------ ; addr addr ; --------- ------------ ; - | unit chrcnt| unit ; --------- ------------ ; ; ; MTRCTRO/MTDTCH MTSTAT ;R0 --> ---------- R0 --> ---------- ; 37 | 4,6 37 | 10 ; --------- --------- ; unused addr ; --------- --------- ; - | unit 0 ; --------- --------- .SBTTL MT(SET,IN,OUT,RCTO,DTCH,PRNT,STAT) - FORTRAN CALLABLE SUBROUTINES ; ++ ; FUNCTIONAL DESCRIPTION: ; ; MTSET - sets terminal and line characteristics ; MTIN - transfers characters from a specified terminal to the user program ; MTOUT - transfers characterd to a specified terminal ; MTRCTO - resets the CTRL/O command typed at the specified terminal ; in a multiterminal environment ; MTDTCH - detachs a terminal from a particular job and make it available ; for other jobs(complement of the MTATCH) ; MTPRNT - allows output to be printed at any terminal in a multiterminal ; environment ; ; CALLING SEQUENCE: ; ; MULTI-TERMINAL SUPPORT ROUTINES ; ; I = MTSET ( unit, addr) ; I = MTIN ( unit, char [,chrcnt] ,[ocnt] ) ; I = MTOUT ( unit, char [,chrcnt] ,[ocnt] ) ; I = MTRCTO( unit ) ; I = MTDTCH( unit ) ; I = MTPRNT( unit, string) ; I = MTSTAT( addr) ; ; INPUT PARAMETERS: ; ; R5 - address of MTSET argument block ; 0(R5) - argument count for all entries ; 2(R5) - address of terminal unit number ( MTIN/MTOUT/MTDTCH/MTPRNT/MTRCT0/MTSET ) ; address of eight-word array to return multiterminal status ; information ( MTSTAT ) ; 4(R5) - address of the user buffer ( MTIN/MTOUT ) ; address of a character string to be printed ( MTPRNT ) ; address of the status block ( MTSET ) ; 6(R5) - address of optional number of characters to be read/output ( MTIN/MTOUT ) ; 10(SP) - address of optional number of characters actualy transfered (MTIN/MTOUT) ; ; ; OUTPUT PARAMETERS: ; ; R0 - function status ; ; ROUTINE VALUE: ; ; 0 normal return ; 1 no character in buffer (mtin) / ocnt = number chars transfered ; no room in buffer (mtout) / ocnt = number chars transfered ; 2 invalid unit # - job has not attached it ; 3 non-existent unit # ; 4 invalid request (subcode out of range) ; 5 attempt to attach/detach a unit owned by another job ; or attempt to attach/detach console. ; 6 buffer or status block is outside the valid addressing ; bounds ( xm only) ; ; All emt requests take a 3 word argument blk, even though addr of tcb ; is not required on .mtrcto, .mtdtch and .mtstat ; ; -- .PSECT SYS$I,I .ENABL LSB MTDTCH::MOV #6,R1 ; subcode is 6 BR 10$ ; set flag for MTDCH MTRCTO::MOV #4,R1 ; subcode is 4 10$: CLR R2 ; R2 = #arg - 1 BR 30$ ; goto common code MTPRNT::MOV #7,R1 ; subcode is 7 BR 20$ ; set flag for MTPRNT MTOUT:: MOV #3,R1 ; subcode is 3 BR 20$ ; set flag for MTOUT MTIN:: MOV #2,R1 ; subcode is 2 BR 20$ MTSET:: CLR R1 ; subcode is 0 20$: MOV #1,R2 ; R2 = #arg -1 BR 30$ ; goto common code MTSTAT::MOV #10,R1 ; subcode is 10 30$: MOV SP,R3 ; save stack pointer CLR -(SP) CLR -(SP) ; allocate space for ARG block MOV (R5)+,R4 ; R4 (low byte) arg count CMP #10,R1 ; is it a MTSTAT BEQ 40$ ; yes, then skip UNIT CALL $NXVAL ; get UNIT BCS ERR ; missing UNIT, then ERR MOVB R0,2(SP) ; save UNIT TST R2 ; more arg ? (MTDTCH&MTRCTO have only one arg) BEQ MTXX ; no then do for one 40$: CALL $NXADR ; get ADDR BCS ERR ; missing ADDR, then ERR MOV R0,@SP ; save ADDR on stack TST R4 ; more arg BEQ MTXX ; no, then perform EMT request CLR R0 CALL $NXVAL ; get CHRCNT MOVB R0,3(SP) ; save CHCNT(if any) on high byte of ; last word of ARG block MTXX: BIS #37*400,R1 MOV R1,-(SP) ; store subcode .MTSET SP,CODE=NOSET MOV R0,R1 ; if sccss R0 = updtd user buffer addr CALL $ERRP0 ; Get and convert any errors (status in R0). BNE 60$ ; if error occur then exit 50$: TST R4 ; more arg ? BLE 60$ ; no, then exit CMP #$NOARG,@R5 ; is the arg present? BEQ 60$ ; no, then exit SUB @(R5),R1 ; get count of chartrs transfered MOV R1,@(R5) ; and save for user 60$: MOV R3,SP ; restore stack pntr RETURN ERR: MOV R3,SP ; restore stack pntr TRAP $MSARG ; Handle any missing arguments in call RETURN .END