In addition to the existing OPCODE 8 (read) special COUNT values of 0 (read to LF) and -1 (read to CR), you may now specify any character value for the terminating character to read to, by putting its negative ASCII value (-2 thru -257) in COUNT. For example,
COUNT = -3 ! read to ETX or chr(3)
xcall COMIO, 4, CH, BUF, STATUS, COUNT
Since -1 is interpreted as chr(10) (LF), to specify chr(1) (SOH) as the terminating character, set COUNT = -257.
To read up until a explicit null byte, set COUNT = -256. Note that this requires that we receive a explicit null byte in the input buffer, not to be confused with the implicit null byte used to terminate the buffer.
Consistent with previous operation, the terminating byte is discarded, although it is included in the returned COUNT (indicating the number of characters received). And in the case of COUNT = 0 (wait for LF), if the character preceding the LF is CR, the CR is also discarded. (The previous documentation described this option as waiting for CRLF, but in reality, it has always terminated on LF, with the preceding CR being optional.)