bioscom()                Communications I/O
 
 #include   <bios.h>
 
 int        bioscom(cmd,byte,port);
 int        cmd;                         Operation to perform
 char       byte;                        Bits to set communications port
 int        port;                        Specified I/O port
 
    bioscom() performs various RS232 communications over the I/0 port
    specified by 'port' (0 = COM1, 1 = COM2, and so forth). 'cmd' can be
    one of the following:
 
           0    Sets the communications parameters to the value in
                'byte'.
           1    Sends the character in 'byte' out over the communications
                line.
           2    Receives a character from the communications line.
           3    Returns the current status of the communications port.
 
    'byte' is a combination of the following bits:
 
                0x02     7 data bits
                0x03     8 data bits
                0x00     1 stop bit
                0x04     2 stop bits
 
                0x00     No parity
                0x08     Odd parity
                0x18     Even parity
 
                0x00     110 baud
                0x20     150 baud
                0x40     300 baud
                0x60     600 baud
                0x80     1200 baud
                0xA0     2400 baud
                0xC0     4800 baud
                0xE0     9600 baud
 
    For example, a 'byte' value of 0xEB (0xE0 | 0x08 | 0x00 | 0x03) sets
    the communications port to 9600 baud, odd parity, 1 stop bit, and 8
    data bits.
 
    Returns:    With a 'cmd' value of 0 - 3: A 16-bit integer is
                returned.  The upper 8 bits are status bits:
 
                bit 15   Time out
                bit 14   Transmit shift register empty
                bit 13   Transmit holding register empty
                bit 12   Break detect
                bit 11   Framing error
                bit 10   Parity error
                bit 9    Overrun error
                bit 8    Data ready
 
                The value of the lower 8 bits vary depending on the value
                of 'cmd'.
 
                With a 'cmd' value of 1: If bit 15 is set, the 'byte'
                value could not be transmitted. Otherwise, the remaining
                upper and lower bits are appropriately set.
 
                With a 'cmd' value of 2: If successful, the byte read is
                in the lower bits of the return value. If an error
                occurred, at least one of the upper bits is set.  If no
                upper bits are set, the byte was received without error.
 
                With a 'cmd' value of 0 or 3: The return value has the
                upper bits set as defined.  The lower bits are defined as
                follows:
 
                bit 7    Received line signal detect
                bit 6    Ring indicator
                bit 5    Data set ready
                bit 4    Clear to send
                bit 3    Delta receive line signal detector
                bit 2    Trailing edge ring detector
                bit 1    Delta data set ready
                bit 0    Delta clear to send

This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster