.TITLE QIOIBM .IDENT /08AU86/ ; Version: ; File:[22,320]QIOIBM.MAC ; Author: Peter Stadick (Phil Hannay (derived from QIOW.MAC)) ; History: 08-Aug-86 -- created. ; ; Last Edit: 13-JAN-1989 19:31:41 ; .REM | Procedure QIOIBM(LUN:Integer; EFNR:Event_flag; EFNW:Event_flag; Inadr:Address; Insiz:Integer; Timeout:INTEGER; Outadr:Address; Outsiz:Integer; Ttable:Address; VAR Iostat:IO_status_block );EXTERNAL; {*USER* Pascal-3 Procedure to execute QIO Read with write function for comminications with an IBM series one. This procedure is provided since it won't fit into the normal parameters for the Pascal-3 QIOW procedure. This will be done, outputting characters specified by OUTADR and OUTSIZ, and inputting the response characters into the area specified by INADR and INSIZ. Note that we order the input and output buffer parmeters in the same order as the QIO parameter list, so that we specify the input buffer and size first, and then later, the output buffer and size. This may seem inconsistent since we output first and then input. But this keeps it consistent with the order if your used to using the QIO in macro. No vertical form control will be provided. This means that there will be no after the prompt output. If you desire different form control, you must embed the desired form control characters into the output prompt. LUN is the logical unit number to be assigned to the appropriate device. EFN is the event flag to be set when the I/O is completed. f0 may not be specified. EFNR is used for the read and EFNW is used for the write. INADR is the starting address of the buffer to be written as the prompt. Use LOOPHOLE(Address,Ref(string)) to produce this parameter. INSIZ is the size of the buffer referenced by OUTADR. This value must not exceed the size of the buffer referenced by OUTADR to prevent writing beyond the end of the buffer. It can be smaller than the buffer, to terminate the qio on a fixed number of characters. Timeout is an optional feature. If used, the number passed should reflect the number of 10-second intervals that should elapse before processing continues. The 10-second feature is not terribly accurate; specifying an interval of 10 seconds may give an interval of from 1 to 10 seconds. A zero indicates a "zero timeout" is to be done, a negative value indicates "no timeout" is to be done, and a positive value indicates "timeout of value*10 seconds" to be done. Note that this will conform to Version 3.0 of M+, when zero timeouts are implemented. Previous QIO procedures did not accomodate zero timeouts. OUTADR is the starting address of the buffer to be written as the prompt. Use LOOPHOLE(Address,Ref(string)) to produce this parameter. OUTSIZ is the size of the buffer referenced by OUTADR. TTABLE is the starting address of the 16 word terminator table. IOSTAT represents the two words of the IO status block. IOSTAT[1] contains the IO status word. For read functions, the high byte contains the terminating character and the low byte the 1 for success. If input terminated on char count, IOSTAT[1] will be just 1, and terminating character 0 (null). If input terminated on timeout, IOSTAT[1] will be 2, and terminating character 0 (null). IOSTAT[2] is the second word of the IO status block, for read functions, it contains the byte count of characters read in (not counting the . Directive status is available in $DSW on return. } | ; ; Assemble with PASMAC.MAC as prefix file. ; ; Adapted from QIOW with thanks to Frank S., Randy B. and Jim B. ; .MCALL QIO$S .MCALL QIOW$S .MCALL WTSE$S PROC QIOIBM PARAM LUN, INTEGER PARAM EFNR, SCALAR PARAM EFNW, SCALAR PARAM INADR, ADDRESS PARAM INSIZ, INTEGER PARAM TMO, INTEGER PARAM OUTADR, ADDRESS PARAM OUTSIZ, INTEGER PARAM TTABLE, ADDRESS PARAM IOSTAT, ADDRESS SAVE BEGIN MOV SP,R0 ;PRESERVE SP MOV #IO.RTT,R1 ;RTT FUNCTION CODE IN R1 BIS #TF.RNE,R1 ;OR IN TF.RNE INTO IO.RTT IN R1 BIS #TF.RAL,R1 ;OR IN TF.RAL INTO IO.RTT IN R1 MOVB EFNR(0),R2 ;EFN PARAM IS A BYTE, MUST CLEAN IT UP BIC #^C^O377,R2 ;MAKE IT AN UNSIGNED WORD BNE 2$ MOV #IE.IEF, $DSW ;MUST SUPPLY EVENT FLAG BR XT ;BRANCH IF ERROR 2$: CLR R4 ;R4 IS TIMEOUT VALUE TST TMO(0) ;SEE IF WE ARE TO DO A TIMEOUT BLT 3$ ;BRANCH IF NEGATIVE (NO TIMEOUT) BIS #TF.TMO,R1 ;OR IN TF.TMO INTO IO.RTT IN R1 MOV TMO(0),R4 ;PUT TIMEOUT VALUE INTO R4 3$: MOV IOSTAT(SP),R3 ;GET ADDRESS OF IO STATUS BLOCK QIO$S R1,LUN(0),R2,,R3,, ; ; NOW THAT THE READ IS POSTED LETS WRITE RESPONCE ; MOV #IO.WAL,R1 ;WAL FUNCTION CODE IN R1 MOVB EFNW(0),R2 ;EFN PARAM IS A BYTE, MUST CLEAN IT UP BIC #^C^O377,R2 ;MAKE IT AN UNSIGNED WORD BNE 4$ MOV #IE.IEF, $DSW ;MUST SUPPLY EVENT FLAG BR XT 4$: QIOW$S R1,LUN(0),R2,,,, WTSE$S EFNR(0) ;WAIT FOR READ TO COMPLETE XT: ENDPR .END