Include:
Prototype: unsigned _bios_serialcom(unsigned service, unsigned port,
unsigned databyte);
service: _COM_INIT _COM_SEND _COM_RECEIVE _COM_STATUS
data: _COM_CHR7 _COM_CHR8
_COM_STOP1 _COM_STOP2
_COM_NOPARITY _COM_EVENPARITY _COM_ODDPARITY
_COM_110 _COM_150 _COM_300 _COM_600
_COM_1200 _COM_2400 _COM_4800 _COM_9600
(may be joined with |)
Returns: a 16-bit status byte and other service-dependent information.
The _bios_serialcom routine uses INT 0x14 to provide serial communications
services. The serial_port argument is set to 0 for COM1, to 1 for COM2, and
so on. The service argument can be set to one of the following manifest
constants: _COM_INIT, _COM_SEND, _COM_RECEIVE, _COM_STATUS.
The data argument is ignored if service is set to _COM_RECEIVE or
_COM_STATUS. The data argument for _COM_INIT is created by ORing together
one or more of the following constants:
_COM_CHR7 _COM_CHR8
_COM_STOP1 _COM_STOP2
_COM_NOPARITY _COM_EVENPARITY _COM_ODDPARITY
_COM_110 _COM_150 _COM_300
_COM_600 _COM_1200 _COM_2400
_COM_4800 _COM_9600
The default value of data is 1 stop bit, no parity, and 110 baud.
----- Note -----
This function works only with IBM(R) Personal Computers and true compatibles.
----------------
Return Value
The function returns a 16-bit integer whose high-order byte contains status
bits. The meaning of the low-order byte varies, depending on the service
value. The high-order bits are as follows:
Bit Meaning if Set
15 Timed out
14 Transmission-shift register empty
13 Transmission-hold register empty
12 Break detected
11 Framing error
10 Parity error
9 Overrun error
8 Data ready
When service is _COM_SEND, bit 15 will be set if data could not be sent.
When service is _COM_RECEIVE, the byte read will be returned in the low-
order bits if the call is successful. If an error occurs, at least one of
the high-order bits will be set.
When service is _COM_INIT or _COM_STATUS, the low-order bits are defined as
follows:
Bit Meaning if Set
7 Receive-line signal detected
6 Ring indicator
5 Data-set ready
4 Clear to send
3 Change in receive-line signal detected
2 Trailing-edge ring indicator
1 Change in data-set ready status
0 Change in clear-to-send status