Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - _bios_serialcom http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   _bios_serialcom

   Usage
   #include <bios.h>
   int _bios_serialcom(unsigned service, unsigned port, unsigned data);

   Description
   This  function  uses  the BIOS  to provide a number  of  serial  RS232
   operations.  The IBM BIOS only allows polled operation of  the  serial
   ports,  not interrupt operation.  The port argument is the  number  of
   the serial port to address. This is set to 0 for COM1 and 1 for COM2.

   There are four services provided:
   Inititialize0
   Set up the serial port as specified in the data argument (see below).

   send1
   Transmit the data character through the selected serial port

   receive2
   Accepts an. input character through the selected serial port.

   status3
   Return the current status of the selected serial port.

   The  data argument for the initialize service is created by oring
   together one value from each of the following categories.

   Baud Rate
   Rate Value

   110  0
   150  32
   300  64
   600  96
   1200 128
   2400 160
   4800 192
   9600 224

   Data Word      Length
   Word Length    Value
   7 data bits    2
   8 data bits    3

   Stop Bits
   No of bits
        Value
   1    0
   2    4

   Parity
   Parity
        Value
   none 0
   odd  8
   even 24

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

   main()
   {
   unsigned com1_status;

        com1_status = _bios_serialcom(3,0,0);
        printf("COM1 status: %x\n",com1_status);
   }

   Return Value
   A  16 bit integer whose high byte contains status bits. The  low  byte
   will vary according to the service requested.

   The high byte status bits are as follows:

   Bit  Meaning when set
   15   Timed out
   14   Transmitter Shift register empty
   13   Transmitter Holding register empty
   12   Break detected
   11   Framing Error
   10   Parity Error
   9    Overrun Error
   8    Data Ready

   If  the  service requested is send, then bit 15 will be  set  if  data
   could not be sent.

   If  the  service  requested is recieve, then the  byte  read  will  be
   returned in the low byte, If an error occurred at least one bit in the
   high byte will be set, to indicate the source of the error.

   If  the service requested is either initialize or  status,  additional
   status information will be returned in the low byte:

   Bit  Meaning when set
   7    Data Carrier Detect (DCD) state
   6    Ring Indicator (RI) state
   5    Data Set Ready (DSR) state
   4    Clear To Send (CTS) state
   3    Change in DCD
   2    Change in RI
   1    Change in DSR
   0    Change in CTS


See Also: BIOS_package

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