Device driver for IBM 5150 PC's serial port (AUX).
By J. Eric Roskos
Public Domain, may not be sold for profit.
This driver is initialized by calling AuxInit, and MUST be
deactivated by calling AuxOff before the program exits (or a sub-
sequent serial interrupt will cause the system to hang).
It uses serial interrupts, and thus works considerably better than
the standard AUX device driver supplied with the IBM PC.
Once AuxInit is called, you can read and write to the predefined
Turbo Pascal file "Aux" to access the serial port. The procedure
AuxSt returns True if a character is presently available at the
serial port, equivalent to the KeyPressed procedure for the console.
You don't have to (and shouldn't) call any of the other procedures
in this file other than AuxInit, AuxOff, and AuxSt.
Presently, only input is done via interrupts; output is via
conventional polling, and a write to the serial port will cause
a busy-wait until any previous character is completely transmitted.
The input buffer's size is defined by the constant BUFSIZ below,
which must be a power of 2 (or the wrap-around algorithm won't work).
The serial port is presently initialized to 1200 baud; if you want
to set it via the MODE command of DOS instead, you can comment out
the statements indicated below.
If the input buffer becomes full, a ^S is sent to the remote machine;
a ^Q is then sent when it empties sufficiently to resume. This
is indeed used at 1200 baud if a number of escape sequences are
sent in succession.
Only the top 24 lines of the screen are used, in order to comply with
most standard terminals. However, for this to work you have to
compile the program with Turbo Pascal version 2.0 or later, and use
an IBM PC version of the compiler (not the generic MS-DOS version).
|