# Serial communications

The driver at drv/pc/com.fs allows transmission of data through PC's COM1 port
(yes, for now it's hardcoded. It's even hardcoded to 115200 bauds 8N1).

To use it, you simply initialize it with "com$" and then use the API described
below.

## Timeout logic

When using the "com1" stream, we often want to read streams longer than a
single byte. However, bytes come through one at a time.

The CPU is faster than the COM port, so as it ask for the next byte, it will
more often than not meet with an empty buffer.

This is unfortunate. To smooth this out, we define this constant, "TIMEOUTMS",
which is the time we're willing to wait before we give up and consider input to
really be empty.

The word "?com>" waits this long before yielding a f=0.

## API

### Constants

TIMEOUTMS  Default 100. Time we're willing to wait during ?com> polling.

### Words

com$ ( -- )
  Initializes COM1 to 115200 bauds 8N1.

>com ( c -- )
  Send a character to COM1.

?com> ( -- c? f )
  Poll COM1. If a character is present, f=1 and c is present. Otherwise, f=0 and
  c is absent.

com> ( -- c )
  Block until a character is received from COM1.

com1 ( -- a )
  A IO stream [io/stream] wrapper around the above words.
