.TITLE PRINT MESSAGE ON TI: .IDENT /V1.01/ .NLIST TOC,SYM .ENABL LC ;+ ; Author: C J Doran Date: 29-Oct-81 ; Sira Institute Ltd., ; South Hill, Chislehurst, Kent, BR7 5EH, England. ; ; SUBROUTINE PRINT(MESSAGE) ; ; Output a string to the FORTRAN error message LUN (.MOLUN). ; ; This subroutine is identical to the RT-11 Syslib PRINT subroutine. ; It outputs the argument string (if any) to TI:, via the F4P OTS ; error message LUN, .MOLUN . If the string terminates with a null, it ; is followed by a CR/LF, which may be suppressed by terminating with ; octal 200 instead. If there is no argument, or it is an empty string ; (terminated with a null) just a blank line is sent. ; ; Writing direct to .MOLUN guarantees that output will go to TI:, ; rather than wherever the TYPE LUN has been assigned. Further, it ; saves having a file control buffer for terminal I/O. The disadvantage ; is that only text can be output -- you must ENCODE into a string ; to print numbers. However, unlike TYPE, PRINT can be called from a ; USEREX-defined subroutine, as it does not require any files to be open. ; ; Assemble as: ; >MAC PRINT=PRINT ; ; Include this module in the user task-build list. Do NOT allow for the ; message output LUN in the ACTFIL, UNITS, or ASG task-builder options, ; as TKB does this automatically. ; ; See also the error message processing facilities described in the ; FORTRAN-IV-PLUS Object Time System Reference Manual (AA-1874B-TC), ; Section 7. Note, however, that PRINT will work regardless of whether ; or not the error message processor, $ERRLO/$ERRMO, is included in the ; task; i.e. even if F4PNER is used. ;- .PSECT $PDATA,RW,D,LCL,REL,CON CRLF: .BYTE CR,LF .PSECT $CODE1,RW,I,LCL,REL,CON .MCALL DIR$,WTSE$S W.QIO=20 ; Offset to address of .MOLUN QIO DPB W.ERLN=156 ; Offset to address of MO's message buffer MOFLAG=30. ; Event flag PRINT:: MOV @#$OTSV,%3 ; Address OTS impure data area MOV W.QIO(%3),%2 ; Get address of .MOLUN QIO DPB MOV .MOLUN,Q.IOLU(%2) ; Put in MO LUN number ADD #Q.IOPL,%2 ; Point to string address QIO parameter TSTB @%5 ; Any arguments? BEQ $MONLN ; Just newline if none TST (%5)+ ; Advance pointer to argument $MOMSG::MOV @%5,%1 ; Fetch address of string CMP %1,#177777 ; Null argument? BEQ $MONLN ; Newline again if so 10$: BITB #177,(%1)+ ; Search for terminating null or "200 BNE 10$ ; Repeat until found MOVB -(%1),-(SP) ; Save terminator SUB @%5,%1 ; Compute no of chars in string BEQ 20$ ; Don't try to output null string MOV @%5,(%2)+ ; Load address of string MOV %1,@%2 ; and its length JSR PC,$MOQIO ; Output string 20$: TSTB (SP)+ ; Was terminator 0 or "200? BMI EXIT ; "200, no trailing newline ; Print CR/LF. Also called from GTLIN (see below). $MONLN::MOV #CRLF,(%2)+ ; Print CR/LF MOV #2,@%2 ; Length 2 bytes ; Fall through to QIO and return ; Execute QIOW on .MOLUN . %3->F4P workspace area, %2->W.QIO+Q.IOPL+2 ; On exit, %2->W.QIO+Q.IOPL . Also called by GTLIN. $MOQIO::DIR$ W.QIO(%3) ; Execute QIO to .MOLUN WTSE$S #MOFLAG ; Wait for it to complete MOV W.ERLN(%3),-(%2) ; Restore MO's buffer address (and %2) EXIT: RTS PC ; Return .END