/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*  PORTLIST.CPP                       by Alan Partis, Copyright (C)         */
/*                                     International Trade Systems, Inc.     */
/*                                     1993 All rights reserved.             */
/*                                                                           */
/*  Description:   Member definitions for the PortList class.                */
/*                                                                           */
/*  Contents:      PortList::PortList()                                      */
/*                 PortList::~PortList()                                     */
/*                                                                           */
/*  Date      Initials  Comments                                             */
/*  -----------------------------------------------------------------------  */
/*  14 Sep 93 acp       Initial Creation                                     */
/*                                                                           */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#include "stddefs.h"
#include "portlist.hpp"

//
// ----- Data Global to this class
//

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*  PortList::PortList()               by Alan Partis, Copyright (C)         */
/*                                     International Trade Systems, Inc.     */
/*                                     1993 All rights reserved.             */
/*                                                                           */
/*  Description:   Constructor for a PortList object.  Querries the BIOS     */
/*       data area for active port addresses, then checks for a mouse via    */
/*       int 33h.  Compiles this list into ports array.                      */
/*                                                                           */
/*  Input:    none                                                           */
/*                                                                           */
/*  Output:   none                                                           */
/*                                                                           */
/*  Return:   n/a                                                            */
/*                                                                           */
/*  Date      Initials  Comments                                             */
/*  -----------------------------------------------------------------------  */
/*  05 Sep 93 acp       Initial Creation                                     */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
PortList::PortList()

{

    word far *     bios_data;
    int            i;

    //
    // initialize class data
    //
    current = -1;

    //
    // check BIOS data area for active comm ports
    //
    bios_data = BIOS_SERIAL_DATA;

    for (i = 0; i < COM_PORTS; i++)
    {
         if (*bios_data)
         {
              ports[i].port    =  i;
              ports[i].address = *bios_data;
         }
         else
         {
              ports[i].port    = -1;
              ports[i].address = *bios_data;
         }

         bios_data++;
    }

}   /* end of function PortList::PortList() */



/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*  PortList::~PortList()              by Alan Partis, Copyright (C)         */
/*                                     International Trade Systems, Inc.     */
/*                                     1993 All rights reserved.             */
/*                                                                           */
/*  Description:   Destructor for a PortList object.  Does nothing special.  */
/*                                                                           */
/*  Input:    none                                                           */
/*                                                                           */
/*  Output:   none                                                           */
/*                                                                           */
/*  Return:   n/a                                                            */
/*                                                                           */
/*  Date      Initials  Comments                                             */
/*  -----------------------------------------------------------------------  */
/*  05 Sep 93 acp       Initial Creation                                     */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
PortList::~PortList()

{



}   /* end of function PortList::~PortList() */



/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*  PortList::Next()                   by Alan Partis, Copyright (C)         */
/*                                     International Trade Systems, Inc.     */
/*                                     1993 All rights reserved.             */
/*                                                                           */
/*  Description:   Returns the next active port in the list.  If we are      */
/*       already at the end, then return -1.                                 */
/*                                                                           */
/*  Input:    NewPort                  pointer to empty PORT                 */
/*                                                                           */
/*  Output:   NewPort                  pointer to filled in PORT             */
/*                                                                           */
/*  Return:   none                                                           */
/*                                                                           */
/*  Date      Initials  Comments                                             */
/*  -----------------------------------------------------------------------  */
/*  15 Sep 93 acp       Initial Creation                                     */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void     PortList::Next(PORT *NewPort)

{

    current++;

    while ((current < COM_PORTS) && (ports[current].port == -1))
         current++;

    if (current < COM_PORTS)
    {
         NewPort->port    = ports[current].port;
         NewPort->address = ports[current].address;
    }
    else
    {
         NewPort->port = -1;
    }

}   /* end of function PortList::Next() */



/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*  PortList::Reset()                  by Alan Partis, Copyright (C)         */
/*                                     International Trade Systems, Inc.     */
/*                                     1993 All rights reserved.             */
/*                                                                           */
/*  Description:   Resets the 'current' active port pointer to the start of  */
/*       the port list.                                                      */
/*                                                                           */
/*  Input:    none                                                           */
/*                                                                           */
/*  Output:   none                                                           */
/*                                                                           */
/*  Return:   none                                                           */
/*                                                                           */
/*  Date      Initials  Comments                                             */
/*  -----------------------------------------------------------------------  */
/*  15 Sep 93 acp       Initial Creation                                     */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void     PortList::Reset()

{

    current = -1;

}   /* end of function PortList::Reset() */


  Copyright © Thundernet Development Group Inc., 2003.
All rights reserved.