Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <bios.h>
    unsigned short _bios_serialcom( unsigned service,
                                    unsigned serial_port,
                                    unsigned data );

Description:
    The _bios_serialcom function uses INT 0x14 to provide serial
    communications services to the serial port specified by serial_port.  0
    represents COM1, 1 represents COM2, etc.  The values for service are:

    _COM_INIT
        Initializes the serial port to the parameters specified in data.

    _COM_SEND
        Transmits the low-order byte of data to the serial port.

    _COM_RECEIVE
        Reads an input character from the serial port.

    _COM_STATUS
        Returns the current status of the serial port.

    The value passed in data for the _COM_INIT service can be built using
    the appropriate combination of the following values:

    _COM_110
        110 baud

    _COM_150
        150 baud

    _COM_300
        300 baud

    _COM_600
        600 baud

    _COM_1200
        1200 baud

    _COM_2400
        2400 baud

    _COM_4800
        4800 baud

    _COM_9600
        9600 baud

    _COM_NOPARITY
        No parity

    _COM_EVENPARITY
        Even parity

    _COM_ODDPARITY
        Odd parity

    _COM_CHR7
        7 data bits

    _COM_CHR8
        8 data bits

    _COM_STOP1
        1 stop bit

    _COM_STOP2
        2 stop bits


Returns:
    The _bios_serialcom function returns a 16-bit value with the high-order
    byte containing status information defined as follows:

    bit 15 (0x8000)
        Timed out

    bit 14 (0x4000)
        Transmit shift register empty

    bit 13 (0x2000)
        Transmit holding register empty

    bit 12 (0x1000)
        Break detected

    bit 11 (0x0800)
        Framing error

    bit 10 (0x0400)
        Parity error

    bit 9 (0x0200)
        Overrun error

    bit 8 (0x0100)
        Data ready

    The low-order byte of the return value depends on the value of the
    service argument.

    When service is _COM_SEND, bit 15 will be set if the data could not be
    sent.  If bit 15 is clear, the return value equals the byte sent.

    When service is _COM_RECEIVE, the byte read will be returned in the
    low-order byte if there was no error.  If there was an error, at least
    one of the high-order status bits will be set.

    When service is _COM_INIT or _COM_STATUS the low-order bits are defined
    as follows:

    bit 0 (0x01)
        Clear to send (CTS) changed

    bit 1 (0x02)
        Data set ready changed

    bit 2 (0x04)
        Trailing-edge ring detector

    bit 3 (0x08)
        Receive line signal detector changed

    bit 4 (0x10)
        Clear to send

    bit 5 (0x20)
        Data-set ready

    bit 6 (0x40)
        Ring indicator

    bit 7 (0x80)
        Receive-line signal detected


Example:
    #include <stdio.h>
    #include <bios.h>

    void main()
      {
        unsigned short status;

        status = _bios_serialcom( _COM_STATUS, 1, 0 );
        printf( "Serial status: 0x%2.2X\n", status );
      }

Classification:
    BIOS

Systems:
    DOS, Win, NT, DOS/PM

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson