git-svn-id: svn://svn.cc65.org/cc65/trunk@2139 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-05-04 09:31:44 +00:00
parent dbbce2e939
commit 84339f43bb
11 changed files with 1165 additions and 52 deletions

View File

@@ -52,8 +52,11 @@
static int InitChip (const struct SimData* Data);
/* Initialize the chip, return an error code */
static void* InitInstance (unsigned Addr, unsigned Range, void* CfgInfo);
/* Initialize a new chip instance */
static void* CreateInstance (unsigned Addr, unsigned Range, void* CfgInfo);
/* Create a new chip instance */
static void DestroyInstance (void* Data);
/* Destroy a chip instance */
static void WriteCtrl (void* Data, unsigned Offs, unsigned char Val);
/* Write control data */
@@ -76,7 +79,7 @@ static unsigned char Read (void* Data, unsigned Offs);
/* Control data passed to the main program */
static const struct ChipData ROMData[1] = {
static const struct ChipData CData[1] = {
{
"ROM", /* Name of the chip */
CHIPDATA_TYPE_CHIP, /* Type of the chip */
@@ -85,7 +88,8 @@ static const struct ChipData ROMData[1] = {
/* -- Exported functions -- */
InitChip,
InitInstance,
CreateInstance,
DestroyInstance,
WriteCtrl,
Write,
ReadCtrl,
@@ -115,8 +119,8 @@ struct InstanceData {
int GetChipData (const ChipData** Data, unsigned* Count)
{
/* Pass the control structure to the caller */
*Data = ROMData;
*Count = sizeof (Data) / sizeof (Data[0]);
*Data = CData;
*Count = sizeof (CData) / sizeof (CData[0]);
/* Call was successful */
return 0;
@@ -142,8 +146,8 @@ static int InitChip (const struct SimData* Data)
static void* InitInstance (unsigned Addr, unsigned Range, void* CfgInfo)
/* Initialize a new chip instance */
static void* CreateInstance (unsigned Addr, unsigned Range, void* CfgInfo)
/* Create a new chip instance */
{
char* Name;
FILE* F;
@@ -185,6 +189,21 @@ static void* InitInstance (unsigned Addr, unsigned Range, void* CfgInfo)
static void DestroyInstance (void* Data)
/* Destroy a chip instance */
{
/* Cast the data pointer */
InstanceData* D = (InstanceData*) Data;
/* Free the ROM memory */
Sim->Free (D->Mem);
/* Free the instance data itself */
free (D);
}
static void WriteCtrl (void* Data, unsigned Offs, unsigned char Val)
/* Write control data */
{