.TITLE GENERAL_IO_UTILITY .IDENT /V01.0/ ; $IODEF ; I/O symbols ; ;****************************************************************************** .PSECT GIO_LOCAL, NOEXE, WRT ; ; SENSE_BUF: .BLKL 2 SET_BUF: .BLKL 2 IO_STATUS: .BLKL 2 ; ; IN_TERM: .LONG 0 IN_TERM_MASK: .LONG 0 ; ; IN_DESCR: .ASCID /SYS$INPUT/ IN_DEV_DESCR: .BLKL 2 IN_DEV_NAME: .BLKB 63 IN_CHAN: .BLKW 1 ; ; OUT_DESCR: .ASCID /SYS$OUTPUT/ OUT_DEV_DESCR: .BLKL 2 OUT_DEV_NAME: .BLKB 63 OUT_CHAN: .BLKW 1 ; ; .PSECT GIO_CODE, EXE, NOWRT ;********************************************************************** ; ; This function must be executed prior to any calls any global ; entry point in this module. There are no parameters for this ; call. ; ;********************************************************************** ; GIO_INIT:: .WORD ^M ; ; MOVAL IN_DEV_DESCR, R2 MOVAL IN_DEV_NAME, 4(R2) MOVL #63, (R2) ; $TRNLOG_S LOGNAM = IN_DESCR,- RSLLEN = (R2),- RSLBUF = IN_DEV_DESCR CMPB IN_DEV_NAME, #^X1B BNEQ 5$ SUBL #4, (R2) ADDL #4, 4(R2) ; 5$: $ASSIGN_S DEVNAM = IN_DEV_DESCR,- CHAN = IN_CHAN ; ; MOVAL OUT_DEV_DESCR, R2 MOVAL OUT_DEV_NAME, 4(R2) MOVL #63, (R2) ; $TRNLOG_S LOGNAM = OUT_DESCR,- RSLLEN = (R2),- RSLBUF = OUT_DEV_DESCR CMPB OUT_DEV_NAME, #^X1B BNEQ 10$ SUBL #4, (R2) ADDL #4, 4(R2) ; 10$: $ASSIGN_S DEVNAM = OUT_DEV_DESCR,- CHAN = OUT_CHAN RET ; ;********************************************************************* ; ; This subroutine does a logical read of SYS$INPUT. It can ; perform several functions not possible through PASCAL I/O. ; The arguments are as follows: ; ; A1 = Address of input buffer. This buffer may be one ; or more bytes in the user program area. ; A2 = Address of a longword containing the number of ; characters to read. This function will return ; when (A2) characters are read or a valid terminator ; is encountered (see A4). ; A3 = Address of a longword containing the number of ; seconds in the timeout period (0 indicates no timeout). ; A4 = Address of terminator mask. The mask is one longword ; (32 bits, numbered 0-31) that indicates which control ; characters are to be recognized as input terminators. ; For example, if bit 13 is set then a , ASCII 13, ; will terminate the read if it is found. ; A5 = Address of longword to receive number of characters ; actually read. This number will not equal A2 if ; a timeout occurred, or a valid terminator was encountered ; prior to filling the user buffer. ; ; The return value of a function is a longword integer indicating ; the QIO return status. This can be used to determine is the read ; was terminated normally or under an error condition, ; ;********************************************************************* ; GIO_IN:: .WORD ^M ; MOVL @12(AP), IN_TERM_MASK CMPL @16(AP), #0 BEQL 15$ ; $QIOW_S CHAN = IN_CHAN, - FUNC = #IO$_TTYREADALL!IO$M_TIMED!IO$M_NOECHO!IO$M_TRMNOECHO, - IOSB = IO_STATUS, - P1 = @4(AP), - P2 = @8(AP), - P3 = @16(AP), - P4 = #IN_TERM BRB 20$ ; 15$: $QIOW_S CHAN = IN_CHAN, - FUNC = #IO$_TTYREADALL!IO$M_NOECHO!IO$M_TRMNOECHO, - IOSB = IO_STATUS, - P1 = @4(AP), - P2 = @8(AP), - P4 = #IN_TERM ; 20$: MOVL #2, R2 CLRL @20(AP) MOVW IO_STATUS(R2), @20(AP) ; Transfer Count ; RET ; ;************************************************************************ ; ; This subroutine performs a logical write to SYS$OUTPUT. ; There is no implicit at the end of the output so all ; carriage control functions must be supplied in the output ; buffer. The arguments are a follows: ; ; A1 = Address of output buffer ; A2 = Address of a longword containing the number of ; characters to output. The write operation will ; terminate when A2 character have been written ; reguardless of the actual size of the output buffer. ; A3 = Address of a longword containing the number of ; characters actual written. This should always ; equal A2. ; ; The return value of this function is a longword integer indicating ; the QIO return status. This value can be checked to determine the ; success of the write opertaion. ; ;************************************************************************ ; GIO_OUT:: .WORD ^M ; $QIOW_S CHAN = OUT_CHAN, - FUNC = #IO$_WRITELBLK!IO$M_NOFORMAT, - IOSB = IO_STATUS, - P1 = @4(AP), - P2 = @8(AP) ; MOVL #2, R2 CLRL @12(AP) MOVW IO_STATUS(R2), @12(AP) ; Transfer Count ; RET .END