]> git.sur5r.net Git - cc65/blobdiff - src/sim65/chip.h
New module strstack
[cc65] / src / sim65 / chip.h
index 6b594638d588e273e52f044723a77d78aab27047..f614c0ced045bfe72ba4047c566b8c293850f600 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2002      Ullrich von Bassewitz                                       */
-/*               Wacholderweg 14                                             */
-/*               D-70597 Stuttgart                                           */
-/* EMail:        uz@musoftware.de                                            */
+/* (C) 2002-2003 Ullrich von Bassewitz                                       */
+/*               Römerstrasse 52                                             */
+/*               D-70794 Filderstadt                                         */
+/* EMail:        uz@cc65.org                                                 */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
 
 
 
+/* common.h */
+#include "coll.h"
+
+/* sim65 */
+#include "chipdata.h"
+#include "simdata.h"
+
+
+
 /*****************************************************************************/
 /*                                     Data                                  */
 /*****************************************************************************/
 
 
 
-/* Forward */
-struct SimData;
+/* Forwards */
+struct AddressSpace;
+struct CfgData;
+typedef struct ChipInstance ChipInstance;
+typedef struct Chip Chip;
+typedef struct ChipLibrary ChipLibrary;
+
+/* One instance of a chip */
+struct ChipInstance {
+    Chip*                   C;          /* Pointer to corresponding chip */
+    struct AddressSpace*    AS;         /* Pointer to address space */
+    unsigned                Addr;       /* Start address of range */
+    unsigned                Size;       /* Size of range */
+    void*                   Data;       /* Chip instance data */
+};
 
 /* Chip structure */
-typedef struct Chip Chip;
 struct Chip {
-    char*       Name;                   /* Name - must be unique */
-    char*       LibName;                /* Name of the associated library */
-    void*       Handle;                 /* Library handle or pointer to it */
-
-    /* -- Exported functions -- */
-    unsigned        (*InitChip) (const struct SimData* Data);
-    const char*     (*GetName) (void);
-    unsigned        (*GetVersion) (void);
-
-    void            (*WriteCtrl) (unsigned Addr, unsigned char Val);
-    void            (*Write) (unsigned Addr, unsigned char Val);
+    struct ChipLibrary*     Lib;        /* Pointer to library data structure */
+    const ChipData*         Data;       /* Chip data as given by the library */
+    Collection              Instances;  /* Pointer to chip instances */
+};
 
-    unsigned char   (*ReadCtrl) (unsigned Addr);
-    unsigned char   (*Read) (unsigned Addr);
+/* ChipLibrary structure */
+struct ChipLibrary {
+    char*                   LibName;    /* Name of the library as given */
+    char*                   PathName;   /* Name of library including path */
+    void*                   Handle;     /* Pointer to libary handle */
+    Collection              Chips;      /* Chips in this library */
 };
 
 
 
 /*****************************************************************************/
-/*                                          Code                                    */
+/*                                          Code                                    */
 /*****************************************************************************/
 
 
 
-void LoadChip (const char* LibName);
-/* Load a chip. This includes loading the shared libary, allocating and
- * initializing the data structure.
- */
+ChipInstance* NewChipInstance (const char* ChipName, unsigned Addr,
+                               unsigned Size, Collection* Attributes);
+/* Allocate a new chip instance for the chip. */
+
+ChipInstance* MirrorChipInstance (const ChipInstance* Orig, unsigned Addr);
+/* Generate a chip instance mirror and return it. */
 
-void InitChips (void);
-/* Initialize the chips. Must be called *after* all chips are loaded */
+void SortChips (void);
+/* Sort all chips by name. Called after loading */
 
-const Chip* GetChip (const char* Name);
-/* Find a chip by name. Returns the Chip data structure or NULL if the chip
- * could not be found.
+void LoadChipLibrary (const char* LibName);
+/* Load a chip library. This includes loading the shared libary, allocating
+ * and initializing the data structure, and loading all chip data from the
+ * library.
  */