.MCALL .MODULE .IIF NDF SYSL$X, SYSL$X = 0 ;Build I-form routines by default .IF EQ SYSL$X .MODULE ISPFN,VERSION=07,COMMENT=,IDENT=NO,LIB=YES .IFF ;EQ SYSL$X .MODULE MSPFN,VERSION=07,COMMENT=,IDENT=NO,LIB=YES .ENDC ;EQ SYSL$X ; 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. ;++ ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ; 001 WLD 05-OCT-90 Change WDCNT to WCNT in ISPFN ; calling sequence. ; ; 002 WLD 15-OCT-90 Change COMMENT in .MODULE to ; fix problem with .ISPFN. ; ; (006) 01-Nov-90 MBG Implemented 'more mapping' form of requests ; ;-- .SBTTL Module Declarations .NLIST .ENABL LC .DSABL GBL .NLIST CND .LIST ;+ ; ; FACILITY: ; ; RT-11 System Subroutine Library (SYSLIB) ; ; CALLABLE ENTRIES: ; ; ISPFN, ISPFNC, ISPFNW ; or ; MSPFN, MSPFNC, MSPFNW ; ; ENVIRONMENT: ; ; The I-form routines can be used by any job in a single- or ; multi-job enviroment. ; ; The M-form routines can be used by any job in a single- or ; multi-job mapped environment. ; ; "TRAP" is used to provide error processing. ; ; To use these functions, the handler must be in memory, and a ; channel must be associated with a file via a non-file-structured ; LOOKUP call. ; ; INCLUDE FILES: ; ; SYSMAC.SML ; RT-11 system macro library. .MCALL .BR .MCALL .SPFUN ; SPFUN programmed request. .LIBRARY "SRC:SYSTEM.MLB" .MCALL ..SPFU ..SPFU ; ; EXTERNAL REFERENCES: ; .GLOBL $ERRP0 ; Entry point to EMT error conver rtn .GLOBL $NXADR ; Entry point to next address routine .GLOBL $NXVAL ; Entry point to next value routine .GLOBL $SYSLB ; Include system library work area .GLOBL $NOARG ; Missing argument code .WEAK $MSARG ; Trap code for missing argument .IF NE SYSL$X .GLOBL $BCMOD ;Routine to handle BMODE and CMODE arguments .ENDC ;NE SYSL$X ; ; CONDITIONALS: ; ; SYSL$X (0) Build I-form library routines ; 1 Build M-form library routines ; ;- .SBTTL {I|M}SPFN{_|C|W} - Fortran Callable Routines ;+ ; ; FUNCTIONAL DESCRIPTION: ; ; These calls are used in conjuction with special functions in ; various device handlers. They provide a means of doing device- ; dependent functions, such as rewind and backspace with magtapes, ; on those devices. ; ; ISPFN, MSPFN: ; Posts a request to perform a function on a device. ; Program execution continues. The request completes ; asynchronously and must be checked for. ; ISPFNC, MSPFNC: ; Posts a request to perform a function on a device. ; Program execution continues. When the request completes, ; the specified asynchronous completion routine is ; executed. ; ISPFNW, MSPFNW: ; Posts a request to perform a function on a device. ; Program execution continues when the request completes. ; ; CALLING SEQUENCE: ; ; i = ISPFN ( code, chan [, wcnt, buff, blk ] ) ; i = ISPFNC ( code, chan [, wcnt, buff, blk,] crtn ) ; i = ISPFNW ( code, chan [, wcnt, buff, blk ] ) ; ; i = MSPFN ( code, chan [, wcnt, buff, blk ] [,bmode] ) ; i = MSPFNC ( code, chan [, wcnt, buff, blk ] crtn [,bmode] [,cmode] ) ; i = MSPFNW ( code, chan [, wcnt, buff, blk ] [, bmode] ) ; ; INPUT PARAMETERS: ; ; R5 address of argument list ; 0(R5) argument count ; 2(R5) address of code for function to be performed ; 4(R5) address of channel number ; 6(R5) address of word count (function dependent argument) ; 10(R5) address of data buffer ; 12(R5) address of block number (function dependent argument) ; ; arguments beyond the fifth one depend on call: ; ; ISPFNC: ; 14(R5) address of assembly language completion routine to be ; entered when the request completes ; ; MSPFN, MSPFNW: ; 14(R5) address of string specifying the data buffer mapping space ; ; MSPFNC: ; 14(R5) address of assembly language completion routine to be ; entered when the request completes ; 16(R5) address of string specifying the data buffer address space ; 20(R5) address of string specifying the completion routine ; address space ; ; OUTPUT PARAMETERS: ; ; R0 Function return ; 0 normal return ; 1 attempt to read or write past end-of-file ; 2 hardware error occured on channel ; 3 channel specified is not open ; -19. Invalid mode specified (M-form request) ; ; Notes: ; o If entered from ISPFNF, R1 already contains the address of ; the completion routine ; ;- .PSECT SYS$I,I .ENABL LSB .IF EQ SYSL$X SPFN:: ISPFN:: .IFF ;EQ SYSL$X MSPFN:: .ENDC ;EQ SYSL$X MOV #1,R1 ;Set asynch flag (non-wait mode) BR $SPFN ; and join common code .IF EQ SYSL$X SPFNC:: ISPFNC:: .IFF ;EQ SYSL$X MSPFNC:: .ENDC ;EQ SYSL$X MOV #$NOARG,R1 ;Indicate completion routine required BR $SPFN ; and join common code .IF EQ SYSL$X SPFNW:: ISPFNW:: .IFF ;EQ SYSL$X MSPFNW:: .ENDC ;EQ SYSL$X CLR R1 ;Reset asynch flag (wait mode) .BR $SPFN ; and join common code .IF EQ SYSL$X $SPFN:: .IFF ;EQ SYSL$X $SPFN: .ENDC ;EQ SYSL$X MOV (R5)+,R4 ;R4 (low byte) contains argument count SUB #L.SPFU,SP ;Make room on stack for EMT area MOV SP,R2 ;R2 -> Completion address in EMT area ADD #A.SRTN,R2 ; ... ; Arguments are in an order which permits loading of the EMT area ; in reverse order beginning with Function/Type word CALL $NXVAL ;Get function code BCS ERR ;Argument is required... SWAB R0 ;Move function code to high byte .IF EQ SYSL$X BIS #..SPFV,R0 ;Indicate SPFUN request .IFF; EQ SYSL$X BIS #..EMIO,R0 ;Fixed part of extended mapping .ENDC; EQ SYSL$X MOV R0,-(R2) ;Move to EMT area CALL $NXVAL ;Get channel number BCS ERR ;Argument is required... MOVB R0,@SP ;Place in EMT area CLR R0 ;Default word count to zero CALL $NXVAL ;Get word count (function dependent) MOV R0,-(R2) ;Move to EMT area CLR R0 ;Default buffer address to zero CALL $NXADR ;Get buffer address MOV R0,-(R2) ;Move to EMT area CLR R0 ;Default block number to zero CALL $NXVAL ;Get block number (function dependent) MOV R0,-(R2) ;Move to EMT area CMP R1,#$NOARG ;Completion routine required? BNE 10$ ;Nope... CALL $NXADR ;Yes, get its address BCS ERR ;Argument is required... MOV R0,R1 ;R1 -> Completion routine 10$: .IF NE SYSL$X CALL $BCMOD ;Handler BMODE and CMODE arguments BCS 20$ ;Invalid mode specified, ; error code (-19.) in R0 BIS (SP)+,A.SPFU(SP) ;Merge mapping mask .ENDC ;NE SYSL$X .SPFUN SP,CRTN=R1 ;Perform the request CALL $ERRP0 ;Convert any EMT errors 20$: ADD #L.SPFU,SP ;Dump the EMT area RETURN ERR: TRAP $MSARG ;Report missing arguments RETURN .DSABL LSB .END