home *** CD-ROM | disk | FTP | other *** search
- ///////////////////////////////////////////////////////////////////////////////
- // $Id: AddressSpace.hxx,v 1.1 1994/02/18 19:47:48 bmott Exp $
- ///////////////////////////////////////////////////////////////////////////////
- // AddressSpace.hxx
- //
- // This class maintains a list of devices and provides methods to peek and
- // poke into them.
- //
- //
- // BSVC "A Microprocessor Simulation Framework"
- // Copyright (c) 1993
- // By: Bradford W. Mott
- // June 27,1993
- //
- ///////////////////////////////////////////////////////////////////////////////
- // $Log: AddressSpace.hxx,v $
- // Revision 1.1 1994/02/18 19:47:48 bmott
- // Initial revision
- //
- ///////////////////////////////////////////////////////////////////////////////
-
- #ifndef ADDRESSSPACE_HXX
- #define ADDRESSSPACE_HXX
-
- #include "String.h"
-
- class BasicDevice;
-
- ///////////////////////////////////////////////////////////////////////////////
- // Used to retrieve information on devices attached to the address space
- ///////////////////////////////////////////////////////////////////////////////
- struct AddressSpaceDeviceInformation {
- String name;
- String initialization_arguments;
- unsigned int index;
- };
-
- ///////////////////////////////////////////////////////////////////////////////
- // AddressSpace class declaration
- ///////////////////////////////////////////////////////////////////////////////
- class AddressSpace {
- private:
- // Structure for linked list of devices attached to the address space
- struct DeviceNode {
- BasicDevice *device;
- DeviceNode *next;
- };
-
- DeviceNode *head; // Head of the linked list
- DeviceNode *tail; // Tail of the linked list
-
- // Maximum address for this address space (In CPU words not bytes!!)
- const unsigned long maximum_address;
-
- public:
- AddressSpace(unsigned long maximum_address);
- virtual ~AddressSpace();
-
- // Return the maximum address of the address space
- inline unsigned long MaximumAddress()
- { return(maximum_address); }
-
- // Attach a device to the address space (1=OK,0=ERROR)
- int AttachDevice(BasicDevice*);
-
- // Detach and destory a device from the address space (1=OK,0=ERROR)
- int DetachDevice(unsigned int index);
-
- // Reset all of the attached devices
- void Reset();
-
- // Return the number of attached devices
- int NumberOfAttachedDevices();
-
- // Get information about the device with the given index (1=OK,0=ERROR)
- int GetDeviceInformation(int index, AddressSpaceDeviceInformation& info);
-
- // Peek a location in the address space (1=OK,0=Bus Error)
- virtual int Peek(unsigned long addr, unsigned char &c);
-
- // Poke a location in the address space (1=OK,0=Bus Error)
- virtual int Poke(unsigned long addr, unsigned char c);
- };
- #endif
-