.MCALL .MODULE .IIF NDF SYSL$X, SYSL$X = 0 ;Build I-form routines by default .IF EQ SYSL$X .MODULE IWRITE,VERSION=05,COMMENT=,IDENT=NO,LIB=YES .IFF ;EQ SYSL$X .MODULE MWRITE,VERSION=05,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. .SBTTL Module Declaration .NLIST .ENABL LC .DSABL GBL .NLIST CND .LIST ;+ ; ; FACILITY: ; ; RT-11 System Subroutine Library (SYSLIB) ; ; CALLABLE ENTRIES: ; ; IWRITE, IWRITC, IWRITW ; or ; MWRITE, MWRITC, MWRITW ; ; ENVIRONMENT: ; ; The I-form routines can be used by any job running in a single- ; or multi-job environment. ; ; The M-form routines can be used by any job running in a single- ; or multi-job mapped environment. ; ; "TRAP" is used to provide error processing. ; ; INCLUDE FILES: ; ; SYSMAC.SML ; RT-11 system macro library. .MCALL .BR .MCALL .WRITC ; .WRITC programmed request. .LIBRARY "SRC:SYSTEM.MLB" .MCALL ..WRIT ..WRIT ; ; 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 $ERRM0 ; Entry point to EMT error conver rtn .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}WRIT{C|E|W} - Fortran Callable Routines ;+ ; ; FUNCTIONAL DESCRIPTION: ; ; IWRITE, MWRITE: ; Posts a request to write a specified number of words ; to the file associated with the indicated channel. ; Program execution continues. The request completes ; asynchronously and must be checked for. ; IWRITC, MWRITC: ; Posts a request to write a specified number of words ; to the file associated with the indicated channel. ; Program execution continues. When the request completes, ; the specified asynchronous completion routine is ; executed. ; IWRITW, MWRITW: ; Posts a request to write a specified number of words ; to the file associated with the indicated channel. ; Program execution continues when the request completes. ; ; CALLING SEQUENCE: ; ; i = IWRITE ( wcnt, buff, blk, chan ) ; i = IWRITC ( wcnt, buff, blk, chan, crtn ) ; i = IWRITW ( wcnt, buff, blk, chan ) ; ; i = MWRITE ( wcnt, buff, blk, chan [, bmode] ) ; i = MWRITC ( wcnt, buff, blk, chan, crtn [, bmode] [, cmode] ) ; i = MWRITW ( wcnt, buff, blk, chan [, bmode] ) ; ; INPUT PARAMETERS: ; ; R5 address of argument list ; 0(R5) argument count ; 2(R5) address of word count ; 4(R5) address of data buffer ; 6(R5) address of block number ; 10(R5) address of a channel number ; ; arguments beyond the fourth one depend on call: ; ; IWRITC: ; 12(R5) address of assembly language completion routine to be ; entered when the request completes. ; ; MWRITE,MWRITW: ; 12(R5) address of string specifying the data buffer address space ; ; MWRITEC: ; 12(R5) address of assembly language completion routine to be ; entered when the request completes. ; 14(R5) address of string specifying the data buffer address space ; 16(R5) address of string specifying the completion routine ; address space ; ; OUTPUT PARAMETERS: ; ; R0 Function return ; +n Normal return, n= # words being write ; -1 Attempt to write past end-of-file ; -2 Hard error occurred on channel ; -3 Channel is not open ; -19. Invalid mode specified (M-form request) ; ; Notes: ; o If entered from IWRITF, R1 already contains the address of ; the completion routine ; ;- .PSECT SYS$I .ENABL LSB .IF EQ SYSL$X WRITE:: IWRITE:: .IFF ;EQ SYSL$X MWRITE:: .ENDC ;EQ SYSL$X MOV #1,R1 ;Set asynch flag (non-wait mode) BR $WRITE ; and join common code .IF EQ SYSL$X WRITC:: IWRITC:: .IFF ;EQ SYSL$X MWRITC:: .ENDC ;EQ SYSL$X MOV #$NOARG,R1 ;Indicate completion routine required BR $WRITE ; and join common code .IF EQ SYSL$X WRITW:: IWRITW:: .IFF ;EQ SYSL$X MWRITW:: .ENDC ;EQ SYSL$X CLR R1 ;Reset asynch flag (wait mode) .BR $WRITE ; and join common code .IF EQ SYSL$X $WRITE:: .IFF ;EQ SYSL$X $WRITE: .ENDC ;EQ SYSL$X MOV (R5)+,R4 ;R4 (low byte) contains argument count SUB #L.WRIU,SP ;Make room on stack for EMT area MOV SP,R2 ;R2 -> Word in EMT area beyond wcnt ADD #A.CRTN,R2 ; ... ; Arguments are in an order which permit loading of the EMT area ; in reverse order beginning with the word count CALL $NXVAL ;Get word count BCS ERR ;Argument is required... MOV R0,-(R2) ;Move to EMT area CALL $NXADR ;Get buffer address BCS ERR ;Argument is required... MOV R0,-(R2) ;Move to EMT area CALL $NXVAL ;Get block number BCS ERR ;Argument is required... MOV R0,-(R2) ;Move to EMT area CALL $NXVAL ;Get channel number BCS ERR ;Argument is required... MOV R0,R3 ;R3 = Channel CMP R1,#$NOARG ;Completion routine required? BNE 10$ ;Nope... CALL $NXADR ;Yes, get its address MOV R0,R1 ;R1 -> Completion routine 10$: .IF NE SYSL$X CALL $BCMOD ;Handle BMODE and CMODE arguments BCS 20$ ;Invalid mode specified, ; error code (-19.) in R0 MOV (SP)+,R2 ;R2 = Buffer mapping mask .IFF ;NE SYSL$X .WRITC SP,R3,CRTN=R1 ;Perform the I-form request .IFT ;NE SYSL$X .WRITC SP,R3,CRTN=R1,BMODE=*BYPASS*,CMODE=R2 ;Perform the M-form request .ENDC ;NE SYSL$X BCC 20$ ;Success... CALL $ERRM0 ;Get and convert any errors 20$: ADD #L.WRIU,SP ;Dump the EMT area RETURN ERR: TRAP $MSARG ;Report missing arguments RETURN .DSABL LSB .END