Technical information
Pasterm Serial Solutions
that is the file variable to find the handle (a word) that DOS
associates with the file.
Reading From The File._____________________
The Procedure InpStr, Figure 9-3, reads from the serial
port. The procedure is local to the function InXlat.
Figure 9-2. Procedure InpStr.__________________________
{Read a character from COM port.}
{If echo to line true then send it back out}
PROCEDURE InpStr (VAR s :Ins);
BEGIN
{$I-}
Read(Com_Inp, s[1]); { Read in Character}
{$I+}
IF
IOResult = 0 { Any read in}
THEN BEGIN
s[0] := #1; { Set one read in}
IF
Echol in Echo { Echo to line}
THEN
OutStr(s); { Send to port}
END
ELSE BEGIN
s[0] := #0; { Set none read}
END;
END;
The read is performed by Read. It is at the first access of the
port for a read or write that the driver itself is actually accessed.
It sets up its internal buffers, which are essential for interrupt
driven I/O, and initialises the serial hardware. If the driver can
return no data then IOResult returns a non-zero value which
InpStr checks. Inpstr also handles echo to line, by calling OutStr,
the serial output procedure.
Writing To The File.__________________
This is performed by OutStr, shown in Figure 9-3.
Chapter 9 Page 145