Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper Tools . Books 1-3 - <b>com_num()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 COM_NUM()
 Gives the number of the highest available serial interface port
------------------------------------------------------------------------------
 Syntax

     COM_NUM() --> nMaxCom

 Returns

     COM_NUM() returns the number of the highest available serial interface
     port.

 Description

     This function returns the number of the serial interface port available.
     This is not to say that a return value of 3 necessarily means that ports
     1 through 3 are available; for example, COM2 could be missing.  Whether
     or not a serial port can actually be used can be tested using the
     COM_OPEN() or COM_INIT() functions.

     Normally the addresses described in the Introduction to this chapter are
     scanned for available ports.  Scanning can happen over alternate
     addresses selected through COM_SETIO().

     Important!  Four I/O addresses are assigned to ports COM1 - COM4,
     internal to the port functions.  The COM_NUM() function goes through
     these four addresses and tests to see if a port is available there.
     This can lead to problems if some other hardware is installed in one of
     the address areas.  For example, problems like this have been noted in
     conjunction with ArcNet network cards, which conflict in the address
     area with COM4.  The critical address areas are listed in the table
     below.

     Table 3-6: I/O Addresses for COM1-COM4
     ------------------------------------------------------------------------
     Port    I/O Addresses
     ------------------------------------------------------------------------
     COM1    03F8h - 03FFh
     COM2    02F8h - 02FFh
     COM3    03E8h - 03EFh
     COM4    02E8h - 02EFh
     ------------------------------------------------------------------------

     If any kind of hardware is found within this I/O address area, then the
     conflicting COM port can be masked.  Additionally, using COM_SETIO()
     (<nComPort>, 0) the accompanying base address within the internal table
     is deleted.  You can only mask the conflicting port when COM_NUM() has
     not previously been called in the program.  If COM_NUM() has been called
     in the program, the interface is marked "in use".

 Examples

     .  Determine the number of ports at the standard addresses:

        ? COM_NUM()                 // e.g. 4

     .  Determine the number of ports at unusual addresses:

        COM_SETIO(3, "110")         // COM3, 110h
        COM_SETIO(4, "120")         // COM4, 120h
        ? COM_NUM()


See Also: COM_SETIO() COM_OPEN()

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