Envoy Application Programming Manual

Table Of Contents
File-System Procedures
Envoy Application Programming Manual427159-001
C-34
WRITEREAD[X]
Examples
CALL WRITE (fnum,out^buffer,102);
where fnum is the one-word integer variable specified in the OPEN call that opened the
particular a communications line and out^buffer is the name of the integer array
within the application program from which the outgoing data is to be received. The write
count of 102 specifies that a message containing 100 bytes of data (this count also
includes the two-byte MCW that is going to be transmitted).
CALL WRITE (fnum,out^buffer,102,out^count);
This example is the same as the preceding one except that the WRITE call includes
out^count, which is the name of an integer variable into which Envoy places a value
specifying how many bytes Envoy actually received from the buffer and transmitted to
the remote station. For successful completions, count written is always the same as write
count. If, however, an error occurs and it prematurely terminates the message transfer,
then count written differs from write count. Depending on the type of error that
occurred, count written may or may not contain a useful value (it may, for example,
contain the value zero when in fact one or more bytes were actually transmitted).
WRITEREAD[X]
A call to the WRITEREAD[X] procedure initiates two separate I/O operations: a
WRITE[X] followed by a READ[X]. The READ[X] operation is not queued until the
WRITE operation has completed. Both operations use the same application program
buffer.
For terminals, the asynchronous multiplexer controller includes a special hardware
feature that assures that the system is ready to read from the terminal as soon as the
WRITE[X] is completed. Note that a carriage return and line feed sequence is NOT sent
to the terminal after the write portion of the WRITEREAD[X] operation.
WRITEREAD is intended for use with 16-bit addresses, while WRITEREAD is
intended for use with 32-bit extended addresses. Therefore, the data buffer for
WRITEREADX can be either in the caller’s stack segment or any extended data
segment.
The form of the WRITEREAD[X] procedure is:
filenum input
INT:value (Use with WRITEREAD and WRITEREADX)
is the number returned by the OPEN call that opened the line. In a WRITEREAD[X]
call, you supply this variable to Envoy.
CALL WRITEREAD[X]( filenum !i
, buffer !i,o
, write-count !i
, read-count !i
,[count-read] !o
,[tag ]); !i