Working
git-svn-id: svn://svn.cc65.org/cc65/trunk@2091 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -6,10 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2002 Ullrich von Bassewitz */
|
/* (C) 2002-2003 Ullrich von Bassewitz */
|
||||||
/* Wacholderweg 14 */
|
/* R<EFBFBD>merstrasse 52 */
|
||||||
/* D-70597 Stuttgart */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@musoftware.de */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
@@ -46,17 +46,19 @@
|
|||||||
|
|
||||||
typedef struct CfgData CfgData;
|
typedef struct CfgData CfgData;
|
||||||
struct CfgData {
|
struct CfgData {
|
||||||
char* Attr; /* The attribute name */
|
|
||||||
enum {
|
enum {
|
||||||
Invalid,
|
CfgDataInvalid,
|
||||||
Id,
|
CfgDataId,
|
||||||
Number,
|
CfgDataNumber,
|
||||||
String
|
CfgDataString
|
||||||
} Type; /* Type of the value */
|
} Type; /* Type of the value */
|
||||||
union {
|
union {
|
||||||
char* SVal; /* String or id value */
|
char* SVal; /* String or id value */
|
||||||
long IVal; /* Integer value */
|
long IVal; /* Integer value */
|
||||||
} V;
|
} V;
|
||||||
|
unsigned Line; /* Line where the attribute was defined */
|
||||||
|
unsigned Col; /* Column of attribute definition */
|
||||||
|
char Attr[1]; /* The attribute name */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
107
src/sim65/chip.c
107
src/sim65/chip.c
@@ -6,10 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2002 Ullrich von Bassewitz */
|
/* (C) 2002-2003 Ullrich von Bassewitz */
|
||||||
/* Wacholderweg 14 */
|
/* R<EFBFBD>merstrasse 52 */
|
||||||
/* D-70597 Stuttgart */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@musoftware.de */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
@@ -94,7 +94,7 @@ static int CmpChips (void* Data attribute ((unused)),
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static Chip* NewChip (ChipLibrary* Library, const ChipData* Data)
|
Chip* NewChip (ChipLibrary* Library, const ChipData* Data)
|
||||||
/* Allocate a new chip structure, initialize and return it */
|
/* Allocate a new chip structure, initialize and return it */
|
||||||
{
|
{
|
||||||
/* Allocate memory */
|
/* Allocate memory */
|
||||||
@@ -105,68 +105,34 @@ static Chip* NewChip (ChipLibrary* Library, const ChipData* Data)
|
|||||||
C->Data = Data;
|
C->Data = Data;
|
||||||
C->Instances = EmptyCollection;
|
C->Instances = EmptyCollection;
|
||||||
|
|
||||||
|
/* Insert the new chip into the collection of all chips */
|
||||||
|
CollAppend (&Chips, C);
|
||||||
|
|
||||||
/* Return the structure */
|
/* Return the structure */
|
||||||
return C;
|
return C;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
ChipInstance* NewChipInstance (unsigned long Addr, unsigned Size)
|
||||||
static void FreeChip (Chip* C)
|
/* Allocate a new chip instance for the chip. */
|
||||||
/* ## Free the given chip structure */
|
|
||||||
{
|
{
|
||||||
/* Free the structure itself */
|
/* Allocate a new ChipInstance structure */
|
||||||
xfree (C);
|
ChipInstance* Instance = xmalloc (sizeof (*Instance));
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
/* Initialize the fields */
|
||||||
|
Instance->C = 0;
|
||||||
|
Instance->Addr = Addr;
|
||||||
|
Instance->Size = Size;
|
||||||
|
Instance->InstanceData = 0;
|
||||||
|
|
||||||
|
/* Return the new struct */
|
||||||
void LoadChips (void)
|
return Instance;
|
||||||
/* Load all chips from all libraries */
|
|
||||||
{
|
|
||||||
unsigned I, J;
|
|
||||||
|
|
||||||
/* Walk through all libraries */
|
|
||||||
for (I = 0; I < CollCount (&ChipLibraries); ++I) {
|
|
||||||
|
|
||||||
/* Get the library entry */
|
|
||||||
ChipLibrary* L = CollAt (&ChipLibraries, I);
|
|
||||||
|
|
||||||
/* Create the chips */
|
|
||||||
for (J = 0; J < L->ChipCount; ++J) {
|
|
||||||
|
|
||||||
/* Get a pointer to the chip data */
|
|
||||||
const ChipData* Data = L->Data + J;
|
|
||||||
|
|
||||||
/* Check if the chip data has the correct version */
|
|
||||||
if (Data->MajorVersion != CHIPDATA_VER_MAJOR) {
|
|
||||||
Warning ("Version mismatch for `%s' (%s), expected %u, got %u",
|
|
||||||
Data->ChipName, L->LibName,
|
|
||||||
CHIPDATA_VER_MAJOR, Data->MajorVersion);
|
|
||||||
/* Ignore this chip */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Generate a new chip and insert it into the collection */
|
|
||||||
CollAppend (&Chips, NewChip (L, Data));
|
|
||||||
|
|
||||||
/* Output chip name and version to keep the user happy */
|
|
||||||
Print (stdout, 1,
|
|
||||||
"Found chip `%s' version %u.%u\n",
|
|
||||||
Data->ChipName,
|
|
||||||
Data->MajorVersion,
|
|
||||||
Data->MinorVersion);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Last act: Sort the chips by name */
|
|
||||||
CollSort (&Chips, CmpChips, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const Chip* FindChip (const char* Name)
|
static Chip* FindChip (const char* Name)
|
||||||
/* Find a chip by name. Returns the Chip data structure or NULL if the chip
|
/* Find a chip by name. Returns the Chip data structure or NULL if the chip
|
||||||
* could not be found.
|
* could not be found.
|
||||||
*/
|
*/
|
||||||
@@ -177,7 +143,7 @@ const Chip* FindChip (const char* Name)
|
|||||||
for (I = 0; I < CollCount (&Chips); ++I) {
|
for (I = 0; I < CollCount (&Chips); ++I) {
|
||||||
|
|
||||||
/* Get the chip at this position */
|
/* Get the chip at this position */
|
||||||
const Chip* C = CollConstAt (&Chips, I);
|
Chip* C = CollAt (&Chips, I);
|
||||||
|
|
||||||
/* Compare the name */
|
/* Compare the name */
|
||||||
if (strcmp (Name, C->Data->ChipName) == 0) {
|
if (strcmp (Name, C->Data->ChipName) == 0) {
|
||||||
@@ -192,3 +158,34 @@ const Chip* FindChip (const char* Name)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void InitChipInstance (ChipInstance* CI, const char* ChipName,
|
||||||
|
const struct CfgData** Data, unsigned Count)
|
||||||
|
/* Initialize the given chip instance. Assign it to the chip named ChipName,
|
||||||
|
* and call the init function of the chip passing the given config data.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
/* Find the chip with the given name */
|
||||||
|
Chip* C = FindChip (ChipName);
|
||||||
|
if (C == 0) {
|
||||||
|
Error ("No chip `%s' found for address $%6lX", ChipName, CI->Addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Call the initialization function */
|
||||||
|
CI->InstanceData = C->Data->InitInstance (CI->Addr, CI->Size, Data, Count);
|
||||||
|
|
||||||
|
/* Assign the chip instance to the chip */
|
||||||
|
CI->C = C;
|
||||||
|
CollAppend (&C->Instances, CI);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void SortChips (void)
|
||||||
|
/* Sort all chips by name. Called after loading */
|
||||||
|
{
|
||||||
|
/* Last act: Sort the chips by name */
|
||||||
|
CollSort (&Chips, CmpChips, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,19 +53,21 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
/* Forwards */
|
||||||
|
struct CfgData;
|
||||||
|
struct ChipLibrary;
|
||||||
|
typedef struct Chip Chip;
|
||||||
typedef struct ChipInstance ChipInstance;
|
typedef struct ChipInstance ChipInstance;
|
||||||
|
|
||||||
|
/* One instance of a chip */
|
||||||
struct ChipInstance {
|
struct ChipInstance {
|
||||||
Chip* C; /* Pointer to corresponding chip */
|
Chip* C; /* Pointer to corresponding chip */
|
||||||
unsigned Addr; /* Start address of range */
|
unsigned long Addr; /* Start address of range */
|
||||||
unsigned Size; /* Size of range */
|
unsigned Size; /* Size of range */
|
||||||
|
void* InstanceData; /* Chip instance data */
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Chip structure */
|
/* Chip structure */
|
||||||
typedef struct Chip Chip;
|
|
||||||
struct Chip {
|
struct Chip {
|
||||||
struct ChipLibrary* Library; /* Pointer to library data structure */
|
struct ChipLibrary* Library; /* Pointer to library data structure */
|
||||||
const ChipData* Data; /* Chip data as given by the library */
|
const ChipData* Data; /* Chip data as given by the library */
|
||||||
@@ -80,14 +82,21 @@ struct Chip {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void LoadChips (void);
|
Chip* NewChip (struct ChipLibrary* Library, const ChipData* Data);
|
||||||
/* Load all chips from all libraries */
|
/* Allocate a new chip structure, initialize and return it */
|
||||||
|
|
||||||
const Chip* FindChip (const char* Name);
|
ChipInstance* NewChipInstance (unsigned long Addr, unsigned Size);
|
||||||
/* Find a chip by name. Returns the Chip data structure or NULL if the chip
|
/* Allocate a new chip instance for the chip. */
|
||||||
* could not be found.
|
|
||||||
|
void InitChipInstance (ChipInstance* CI, const char* ChipName,
|
||||||
|
const struct CfgData** Data, unsigned Count);
|
||||||
|
/* Initialize the given chip instance. Assign it to the chip named ChipName,
|
||||||
|
* and call the init function of the chip passing the given config data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void SortChips (void);
|
||||||
|
/* Sort all chips by name. Called after loading */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* End of chip.h */
|
/* End of chip.h */
|
||||||
@@ -96,3 +105,4 @@ const Chip* FindChip (const char* Name);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2002 Ullrich von Bassewitz */
|
/* (C) 2002-2003 Ullrich von Bassewitz */
|
||||||
/* Wacholderweg 14 */
|
/* R<EFBFBD>merstrasse 52 */
|
||||||
/* D-70597 Stuttgart */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@musoftware.de */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
@@ -49,6 +49,7 @@
|
|||||||
#define CHIPDATA_VER_MINOR 0U
|
#define CHIPDATA_VER_MINOR 0U
|
||||||
|
|
||||||
/* Forwards */
|
/* Forwards */
|
||||||
|
struct CfgData;
|
||||||
struct SimData;
|
struct SimData;
|
||||||
|
|
||||||
/* ChipDesc structure */
|
/* ChipDesc structure */
|
||||||
@@ -60,7 +61,8 @@ struct ChipData {
|
|||||||
|
|
||||||
/* -- Exported functions -- */
|
/* -- Exported functions -- */
|
||||||
int (*InitChip) (const struct SimData* Data);
|
int (*InitChip) (const struct SimData* Data);
|
||||||
void* (*InitInstance) (unsigned Addr, unsigned Range);
|
void* (*InitInstance) (unsigned Addr, unsigned Range,
|
||||||
|
const struct CfgData** Data, unsigned CfgDataCount);
|
||||||
void (*WriteCtrl) (void* Data, unsigned Offs, unsigned char Val);
|
void (*WriteCtrl) (void* Data, unsigned Offs, unsigned char Val);
|
||||||
void (*Write) (void* Data, unsigned Offs, unsigned char Val);
|
void (*Write) (void* Data, unsigned Offs, unsigned char Val);
|
||||||
unsigned char (*ReadCtrl) (void* Data, unsigned Offs);
|
unsigned char (*ReadCtrl) (void* Data, unsigned Offs);
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2002 Ullrich von Bassewitz */
|
/* (C) 2002-2003 Ullrich von Bassewitz */
|
||||||
/* Wacholderweg 14 */
|
/* R<EFBFBD>merstrasse 52 */
|
||||||
/* D-70597 Stuttgart */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@musoftware.de */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
@@ -36,10 +36,12 @@
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
|
#include "fname.h"
|
||||||
#include "print.h"
|
#include "print.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
|
||||||
/* sim65 */
|
/* sim65 */
|
||||||
|
#include "chip.h"
|
||||||
#include "chippath.h"
|
#include "chippath.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "chiplib.h"
|
#include "chiplib.h"
|
||||||
@@ -52,9 +54,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Forwards */
|
|
||||||
struct ChipData;
|
|
||||||
|
|
||||||
/* A collection containing all libraries */
|
/* A collection containing all libraries */
|
||||||
Collection ChipLibraries = STATIC_COLLECTION_INITIALIZER;
|
Collection ChipLibraries = STATIC_COLLECTION_INITIALIZER;
|
||||||
|
|
||||||
@@ -66,18 +65,16 @@ Collection ChipLibraries = STATIC_COLLECTION_INITIALIZER;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static ChipLibrary* NewChipLibrary (const char* LibName)
|
static ChipLibrary* NewChipLibrary (const char* PathName)
|
||||||
/* Create, initialize and return a new ChipLibrary structure */
|
/* Create, initialize and return a new ChipLibrary structure */
|
||||||
{
|
{
|
||||||
/* Allocate memory */
|
/* Allocate memory */
|
||||||
ChipLibrary* L = xmalloc (sizeof (ChipLibrary));
|
ChipLibrary* L = xmalloc (sizeof (ChipLibrary));
|
||||||
|
|
||||||
/* Initialize the fields */
|
/* Initialize the fields */
|
||||||
L->LibName = xstrdup (LibName);
|
L->LibName = xstrdup (FindName (PathName));
|
||||||
L->PathName = 0;
|
L->PathName = xstrdup (PathName);
|
||||||
L->Handle = 0;
|
L->Handle = 0;
|
||||||
L->Data = 0;
|
|
||||||
L->ChipCount = 0;
|
|
||||||
L->Chips = EmptyCollection;
|
L->Chips = EmptyCollection;
|
||||||
|
|
||||||
/* Return the allocated structure */
|
/* Return the allocated structure */
|
||||||
@@ -110,25 +107,21 @@ static void FreeChipLibrary (ChipLibrary* L)
|
|||||||
|
|
||||||
void LoadChipLibrary (const char* LibName)
|
void LoadChipLibrary (const char* LibName)
|
||||||
/* Load a chip library. This includes loading the shared libary, allocating
|
/* Load a chip library. This includes loading the shared libary, allocating
|
||||||
* and initializing the data structure.
|
* and initializing the data structure, and loading all chip data from the
|
||||||
|
* library.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
const char* Msg;
|
const char* Msg;
|
||||||
int (*GetChipData) (const struct ChipData**, unsigned*);
|
int (*GetChipData) (const struct ChipData**, unsigned*);
|
||||||
int ErrorCode;
|
int ErrorCode;
|
||||||
|
const ChipData* Data; /* Pointer to chip data */
|
||||||
|
unsigned ChipCount; /* Number of chips in this library */
|
||||||
|
unsigned I;
|
||||||
|
|
||||||
|
|
||||||
/* Allocate a new ChipLibrary structure */
|
/* Allocate a new ChipLibrary structure */
|
||||||
ChipLibrary* L = NewChipLibrary (LibName);
|
ChipLibrary* L = NewChipLibrary (LibName);
|
||||||
|
|
||||||
/* Locate the library */
|
|
||||||
L->PathName = FindChipLib (LibName);
|
|
||||||
if (L->PathName == 0) {
|
|
||||||
/* Library not found */
|
|
||||||
Error ("Cannot find chip plugin library `%s'", LibName);
|
|
||||||
FreeChipLibrary (L);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Open the library */
|
/* Open the library */
|
||||||
L->Handle = dlopen (L->PathName, RTLD_GLOBAL | RTLD_LAZY);
|
L->Handle = dlopen (L->PathName, RTLD_GLOBAL | RTLD_LAZY);
|
||||||
|
|
||||||
@@ -153,7 +146,7 @@ void LoadChipLibrary (const char* LibName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Call the function to read the chip data */
|
/* Call the function to read the chip data */
|
||||||
ErrorCode = GetChipData (&L->Data, &L->ChipCount);
|
ErrorCode = GetChipData (&Data, &ChipCount);
|
||||||
if (ErrorCode != 0) {
|
if (ErrorCode != 0) {
|
||||||
Error ("Function `GetChipData' in `%s' returned error %d", L->LibName, ErrorCode);
|
Error ("Function `GetChipData' in `%s' returned error %d", L->LibName, ErrorCode);
|
||||||
FreeChipLibrary (L);
|
FreeChipLibrary (L);
|
||||||
@@ -165,6 +158,38 @@ void LoadChipLibrary (const char* LibName)
|
|||||||
|
|
||||||
/* Print some information */
|
/* Print some information */
|
||||||
Print (stderr, 1, "Opened chip library `%s'\n", L->PathName);
|
Print (stderr, 1, "Opened chip library `%s'\n", L->PathName);
|
||||||
|
|
||||||
|
/* Create the chips */
|
||||||
|
for (I = 0; I < ChipCount; ++I) {
|
||||||
|
|
||||||
|
Chip* C;
|
||||||
|
|
||||||
|
/* Get a pointer to the chip data */
|
||||||
|
const ChipData* D = Data + I;
|
||||||
|
|
||||||
|
/* Check if the chip data has the correct version */
|
||||||
|
if (Data->MajorVersion != CHIPDATA_VER_MAJOR) {
|
||||||
|
Warning ("Version mismatch for `%s' (%s), expected %u, got %u",
|
||||||
|
D->ChipName, L->LibName,
|
||||||
|
CHIPDATA_VER_MAJOR, D->MajorVersion);
|
||||||
|
/* Ignore this chip */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Generate a new chip */
|
||||||
|
C = NewChip (L, D);
|
||||||
|
|
||||||
|
/* Insert a reference to the chip into the library exporting it */
|
||||||
|
CollAppend (&L->Chips, C);
|
||||||
|
|
||||||
|
/* Output chip name and version to keep the user happy */
|
||||||
|
Print (stdout, 1,
|
||||||
|
" Found `%s', version %u.%u in library `%s'\n",
|
||||||
|
Data->ChipName,
|
||||||
|
Data->MajorVersion,
|
||||||
|
Data->MinorVersion,
|
||||||
|
L->LibName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,9 @@
|
|||||||
/* common */
|
/* common */
|
||||||
#include "coll.h"
|
#include "coll.h"
|
||||||
|
|
||||||
|
/* sim65 */
|
||||||
|
#include "chipdata.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -58,8 +61,6 @@ struct ChipLibrary {
|
|||||||
char* LibName; /* Name of the library as given */
|
char* LibName; /* Name of the library as given */
|
||||||
char* PathName; /* Name of library including path */
|
char* PathName; /* Name of library including path */
|
||||||
void* Handle; /* Pointer to libary handle */
|
void* Handle; /* Pointer to libary handle */
|
||||||
const struct ChipData* Data; /* Pointer to chip data */
|
|
||||||
unsigned ChipCount; /* Number of chips in this library */
|
|
||||||
Collection Chips; /* Chips in this library */
|
Collection Chips; /* Chips in this library */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -76,12 +77,8 @@ extern Collection ChipLibraries;
|
|||||||
|
|
||||||
void LoadChipLibrary (const char* LibName);
|
void LoadChipLibrary (const char* LibName);
|
||||||
/* Load a chip library. This includes loading the shared libary, allocating
|
/* Load a chip library. This includes loading the shared libary, allocating
|
||||||
* and initializing the data structure.
|
* and initializing the data structure, and loading all chip data from the
|
||||||
*/
|
* library.
|
||||||
|
|
||||||
void* GetChipLibSym (const ChipLibrary* L, const char* SymName);
|
|
||||||
/* Locate a symbol in a module and return it. Abort on errors (may be modified
|
|
||||||
* later to return NULL).
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,8 @@
|
|||||||
int InitChip (const struct SimData* Data);
|
int InitChip (const struct SimData* Data);
|
||||||
/* Initialize the chip, return an error code */
|
/* Initialize the chip, return an error code */
|
||||||
|
|
||||||
static void* InitInstance (unsigned Addr, unsigned Range);
|
static void* InitInstance (unsigned Addr, unsigned Range,
|
||||||
|
const CfgData** Data, unsigned CfgDataCount);
|
||||||
/* Initialize a new chip instance */
|
/* Initialize a new chip instance */
|
||||||
|
|
||||||
static void WriteCtrl (void* Data, unsigned Offs, unsigned char Val);
|
static void WriteCtrl (void* Data, unsigned Offs, unsigned char Val);
|
||||||
@@ -144,7 +145,8 @@ int InitChip (const struct SimData* Data)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void* InitInstance (unsigned Addr, unsigned Range)
|
static void* InitInstance (unsigned Addr, unsigned Range,
|
||||||
|
const CfgData** Data, unsigned CfgDataCount)
|
||||||
/* Initialize a new chip instance */
|
/* Initialize a new chip instance */
|
||||||
{
|
{
|
||||||
/* Allocate a new instance structure */
|
/* Allocate a new instance structure */
|
||||||
|
|||||||
@@ -54,9 +54,11 @@
|
|||||||
int InitChip (const struct SimData* Data);
|
int InitChip (const struct SimData* Data);
|
||||||
/* Initialize the chip, return an error code */
|
/* Initialize the chip, return an error code */
|
||||||
|
|
||||||
static void* InitInstance (unsigned Addr, unsigned Range);
|
static void* InitInstance (unsigned Addr, unsigned Range,
|
||||||
|
const CfgData** Data, unsigned CfgDataCount);
|
||||||
/* Initialize a new chip instance */
|
/* Initialize a new chip instance */
|
||||||
|
|
||||||
|
|
||||||
static void Write (void* Data, unsigned Offs, unsigned char Val);
|
static void Write (void* Data, unsigned Offs, unsigned char Val);
|
||||||
/* Write user data */
|
/* Write user data */
|
||||||
|
|
||||||
@@ -129,9 +131,10 @@ int InitChip (const struct SimData* Data)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void* InitInstance (unsigned Addr attribute ((unused)),
|
static void* InitInstance (unsigned Addr, unsigned Range,
|
||||||
unsigned Range attribute ((unused)))
|
const CfgData** Data, unsigned CfgDataCount)
|
||||||
/* Initialize a new chip instance */
|
/* Initialize a new chip instance */
|
||||||
|
|
||||||
{
|
{
|
||||||
/* We don't need any instance data */
|
/* We don't need any instance data */
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1998-2002 Ullrich von Bassewitz */
|
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||||
/* Wacholderweg 14 */
|
/* R<EFBFBD>merstrasse 52 */
|
||||||
/* D-70597 Stuttgart */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@musoftware.de */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
@@ -42,6 +42,7 @@
|
|||||||
#include "check.h"
|
#include "check.h"
|
||||||
#include "bitops.h"
|
#include "bitops.h"
|
||||||
#include "print.h"
|
#include "print.h"
|
||||||
|
#include "strutil.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
|
||||||
/* sim65 */
|
/* sim65 */
|
||||||
@@ -54,21 +55,49 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Data */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* List of all memory locations */
|
||||||
|
static Collection Locations;
|
||||||
|
|
||||||
|
/* One memory location */
|
||||||
|
typedef struct Location Location;
|
||||||
|
struct Location {
|
||||||
|
unsigned long Start; /* Start of memory location */
|
||||||
|
unsigned long End; /* End memory location */
|
||||||
|
Collection Attributes; /* Attributes given */
|
||||||
|
unsigned Line; /* Line in config file */
|
||||||
|
unsigned Col; /* Column in config file */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* struct CfgData */
|
/* struct CfgData */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static CfgData* NewCfgData (const char* Tok)
|
static CfgData* NewCfgData (void)
|
||||||
/* Create and intialize a new CfgData struct, then return it */
|
/* Create and intialize a new CfgData struct, then return it. The function
|
||||||
|
* uses the current output of the config scanner.
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
|
/* Get the length of the identifier */
|
||||||
|
unsigned AttrLen = strlen (CfgSVal);
|
||||||
|
|
||||||
/* Allocate memory */
|
/* Allocate memory */
|
||||||
CfgData* D = xmalloc (sizeof (CfgData));
|
CfgData* D = xmalloc (sizeof (CfgData) + AttrLen);
|
||||||
|
|
||||||
/* Initialize the fields */
|
/* Initialize the fields */
|
||||||
D->Attr = xstrdup (Tok);
|
D->Type = CfgDataInvalid;
|
||||||
D->Type = Invalid;
|
D->Line = CfgErrorLine;
|
||||||
|
D->Col = CfgErrorCol;
|
||||||
|
memcpy (D->Attr, CfgSVal, AttrLen+1);
|
||||||
|
|
||||||
/* Return the new struct */
|
/* Return the new struct */
|
||||||
return D;
|
return D;
|
||||||
@@ -77,7 +106,87 @@ static CfgData* NewCfgData (const char* Tok)
|
|||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Data */
|
/* struct Location */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static Location* NewLocation (unsigned long Start, unsigned long End)
|
||||||
|
/* Create a new location, initialize and return it */
|
||||||
|
{
|
||||||
|
/* Allocate memory */
|
||||||
|
Location* L = xmalloc (sizeof (Location));
|
||||||
|
|
||||||
|
/* Initialize the fields */
|
||||||
|
L->Start = Start;
|
||||||
|
L->End = End;
|
||||||
|
L->Attributes = EmptyCollection;
|
||||||
|
L->Line = CfgErrorLine;
|
||||||
|
L->Col = CfgErrorCol;
|
||||||
|
|
||||||
|
/* Return the new struct */
|
||||||
|
return L;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int CmpLocations (void* Data attribute ((unused)),
|
||||||
|
const void* lhs, const void* rhs)
|
||||||
|
/* Compare function for CollSort */
|
||||||
|
{
|
||||||
|
/* Cast the object pointers */
|
||||||
|
const Location* Left = (const Location*) rhs;
|
||||||
|
const Location* Right = (const Location*) lhs;
|
||||||
|
|
||||||
|
/* Do the compare */
|
||||||
|
if (Left->Start < Right->Start) {
|
||||||
|
return 1;
|
||||||
|
} else if (Left->Start > Right->Start) {
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static const CfgData* LocationFindAttr (const Location* L, const char* AttrName)
|
||||||
|
/* Find the attribute with the given name and return it. Return NULL if the
|
||||||
|
* attribute was not found.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
unsigned I;
|
||||||
|
|
||||||
|
/* Walk through the attributes checking for a "mirror" attribute */
|
||||||
|
for (I = 0; I < CollCount (&L->Attributes); ++I) {
|
||||||
|
|
||||||
|
/* Get the next attribute */
|
||||||
|
const CfgData* D = CollConstAt (&L->Attributes, I);
|
||||||
|
|
||||||
|
/* Compare the name */
|
||||||
|
if (StrCaseCmp (D->Attr, AttrName) == 0) {
|
||||||
|
/* Found */
|
||||||
|
return D;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Not found */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int LocationIsMirror (const Location* L)
|
||||||
|
/* Return true if the given location is a mirror of another one. */
|
||||||
|
{
|
||||||
|
/* Find the "mirror" attribute */
|
||||||
|
return (LocationFindAttr (L, "mirror") != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Code */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
@@ -105,73 +214,73 @@ static void AttrCheck (unsigned Attr, unsigned Mask, const char* Name)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void ParseChips (void)
|
static void ParseMemory (void)
|
||||||
/* Parse a CHIPS section */
|
/* Parse a MEMORY section */
|
||||||
{
|
{
|
||||||
static const IdentTok Attributes [] = {
|
unsigned I;
|
||||||
{ "ADDR", CFGTOK_ADDR },
|
const Location* Last;
|
||||||
{ "RANGE", CFGTOK_RANGE },
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Bits and stuff to remember which attributes we have read */
|
|
||||||
enum {
|
|
||||||
CA_ADDR = 0x01,
|
|
||||||
CA_RANGE = 0x02
|
|
||||||
};
|
|
||||||
unsigned Attr;
|
|
||||||
|
|
||||||
/* Attribute values. Initialize to make gcc happy. */
|
while (CfgTok == CFGTOK_INTCON) {
|
||||||
const Chip* C;
|
|
||||||
unsigned Addr = 0;
|
|
||||||
unsigned Range = 0;
|
|
||||||
|
|
||||||
while (CfgTok == CFGTOK_IDENT) {
|
Location* L;
|
||||||
|
|
||||||
/* Search the chip with the given name */
|
/* Remember the start address and skip it */
|
||||||
C = FindChip (CfgSVal);
|
unsigned long Start = CfgIVal;
|
||||||
if (C == 0) {
|
CfgNextTok ();
|
||||||
CfgError ("No such chip: `%s'", CfgSVal);
|
|
||||||
|
/* .. must follow */
|
||||||
|
CfgConsume (CFGTOK_DOTDOT, "`..' expected");
|
||||||
|
|
||||||
|
/* End address must follow and must be greater than start */
|
||||||
|
CfgAssureInt ();
|
||||||
|
if (CfgIVal < Start) {
|
||||||
|
CfgError ("Start address must be greater than end address");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip the name plus the following colon */
|
/* Create a new location and add it to the list */
|
||||||
|
L = NewLocation (Start, CfgIVal);
|
||||||
|
CollAppend (&Locations, L);
|
||||||
|
|
||||||
|
/* Skip the end address and the following colon */
|
||||||
CfgNextTok ();
|
CfgNextTok ();
|
||||||
CfgConsumeColon ();
|
CfgConsumeColon ();
|
||||||
|
|
||||||
/* Read the attributes */
|
/* Parse attributes terminated by a semicolon */
|
||||||
Attr = 0;
|
|
||||||
while (CfgTok == CFGTOK_IDENT) {
|
while (CfgTok == CFGTOK_IDENT) {
|
||||||
|
|
||||||
/* Map the identifier to a token */
|
/* Generate a new attribute with the given name, then skip it */
|
||||||
cfgtok_t AttrTok;
|
CfgData* D = NewCfgData ();
|
||||||
CfgSpecialToken (Attributes, ENTRY_COUNT (Attributes), "Attribute");
|
CfgNextTok ();
|
||||||
AttrTok = CfgTok;
|
|
||||||
|
|
||||||
/* An optional assignment follows */
|
/* An optional assignment follows */
|
||||||
CfgNextTok ();
|
|
||||||
CfgOptionalAssign ();
|
CfgOptionalAssign ();
|
||||||
|
|
||||||
/* Check which attribute was given */
|
/* Check and assign the attribute value */
|
||||||
switch (AttrTok) {
|
switch (CfgTok) {
|
||||||
|
|
||||||
case CFGTOK_ADDR:
|
case CFGTOK_INTCON:
|
||||||
CfgAssureInt ();
|
D->Type = CfgDataNumber;
|
||||||
CfgRangeCheck (0, 0xFFFF);
|
D->V.IVal = CfgIVal;
|
||||||
FlagAttr (&Attr, CA_ADDR, "ADDR");
|
|
||||||
Addr = (unsigned) CfgIVal;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CFGTOK_RANGE:
|
case CFGTOK_STRCON:
|
||||||
CfgAssureInt ();
|
D->Type = CfgDataString;
|
||||||
CfgRangeCheck (0, 0xFFFF);
|
D->V.SVal = xstrdup (CfgSVal);
|
||||||
FlagAttr (&Attr, CA_RANGE, "RANGE");
|
break;
|
||||||
Range = (unsigned) CfgIVal;
|
|
||||||
|
case CFGTOK_IDENT:
|
||||||
|
D->Type = CfgDataId;
|
||||||
|
D->V.SVal = xstrdup (CfgSVal);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FAIL ("Unexpected attribute token");
|
CfgError ("Invalid attribute type");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Add the attribute to the location */
|
||||||
|
CollAppend (&L->Attributes, D);
|
||||||
|
|
||||||
/* Skip the attribute value and an optional comma */
|
/* Skip the attribute value and an optional comma */
|
||||||
CfgNextTok ();
|
CfgNextTok ();
|
||||||
CfgOptionalComma ();
|
CfgOptionalComma ();
|
||||||
@@ -179,18 +288,42 @@ static void ParseChips (void)
|
|||||||
|
|
||||||
/* Skip the semicolon */
|
/* Skip the semicolon */
|
||||||
CfgConsumeSemi ();
|
CfgConsumeSemi ();
|
||||||
|
|
||||||
/* Check for mandatory parameters */
|
|
||||||
AttrCheck (Attr, CA_ADDR, "ADDR");
|
|
||||||
AttrCheck (Attr, CA_RANGE, "RANGE");
|
|
||||||
|
|
||||||
/* Address + Range may not exceed 16 bits */
|
|
||||||
if (((unsigned long) Range) > 0x10000UL - Addr) {
|
|
||||||
CfgError ("Range error");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the chip ## */
|
/* Sort all memory locations */
|
||||||
|
CollSort (&Locations, CmpLocations, 0);
|
||||||
|
|
||||||
|
/* Check for overlaps and other problems */
|
||||||
|
Last = 0;
|
||||||
|
for (I = 0; I < CollCount (&Locations); ++I) {
|
||||||
|
|
||||||
|
/* Get this location */
|
||||||
|
const Location* L = CollAtUnchecked (&Locations, I);
|
||||||
|
|
||||||
|
/* Check for an overlap with the following location */
|
||||||
|
if (Last && Last->End >= L->Start) {
|
||||||
|
Error ("%s(%u): Address range overlap (overlapping entry is in line %u)",
|
||||||
|
CfgGetName(), L->Line, Last->Line);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If the location is a mirror, it must not have other attributes,
|
||||||
|
* and the mirror attribute must be an integer.
|
||||||
|
*/
|
||||||
|
if (LocationIsMirror (L)) {
|
||||||
|
const CfgData* D;
|
||||||
|
if (CollCount (&L->Attributes) > 1) {
|
||||||
|
Error ("%s(%u): Location at address $%06lX is a mirror "
|
||||||
|
"but has attributes", CfgGetName(), L->Line, L->Start);
|
||||||
|
}
|
||||||
|
D = CollConstAt (&L->Attributes, 0);
|
||||||
|
if (D->Type != CfgDataNumber) {
|
||||||
|
Error ("%s(%u): Mirror attribute is not an integer",
|
||||||
|
CfgGetName (), L->Line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remember this entry */
|
||||||
|
Last = L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +333,7 @@ static void ParseConfig (void)
|
|||||||
/* Parse the config file */
|
/* Parse the config file */
|
||||||
{
|
{
|
||||||
static const IdentTok BlockNames [] = {
|
static const IdentTok BlockNames [] = {
|
||||||
{ "CHIPS", CFGTOK_CHIPS },
|
{ "MEMORY", CFGTOK_MEMORY },
|
||||||
};
|
};
|
||||||
cfgtok_t BlockTok;
|
cfgtok_t BlockTok;
|
||||||
|
|
||||||
@@ -217,8 +350,8 @@ static void ParseConfig (void)
|
|||||||
/* Read the block */
|
/* Read the block */
|
||||||
switch (BlockTok) {
|
switch (BlockTok) {
|
||||||
|
|
||||||
case CFGTOK_CHIPS:
|
case CFGTOK_MEMORY:
|
||||||
ParseChips ();
|
ParseMemory ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1998-2002 Ullrich von Bassewitz */
|
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||||
/* Wacholderweg 14 */
|
/* R<EFBFBD>merstrasse 52 */
|
||||||
/* D-70597 Stuttgart */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@musoftware.de */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
|
|||||||
@@ -37,12 +37,17 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
#include "abend.h"
|
#include "abend.h"
|
||||||
#include "cmdline.h"
|
#include "cmdline.h"
|
||||||
#include "print.h"
|
#include "print.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
#include "xmalloc.h"
|
||||||
|
|
||||||
/* sim65 */
|
/* sim65 */
|
||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
@@ -92,7 +97,47 @@ static void Usage (void)
|
|||||||
static void OptChipDir (const char* Opt attribute ((unused)), const char* Arg)
|
static void OptChipDir (const char* Opt attribute ((unused)), const char* Arg)
|
||||||
/* Handle the --chipdir option */
|
/* Handle the --chipdir option */
|
||||||
{
|
{
|
||||||
AddChipPath (Arg);
|
struct dirent* E;
|
||||||
|
|
||||||
|
/* Get the length of the directory name */
|
||||||
|
unsigned DirLen = strlen (Arg);
|
||||||
|
|
||||||
|
/* Open the directory */
|
||||||
|
DIR* D = opendir (Arg);
|
||||||
|
if (D == 0) {
|
||||||
|
AbEnd ("Cannot read directory `%s': %s", Arg, strerror (errno));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read in all files and treat them as libraries */
|
||||||
|
while ((E = readdir (D)) != 0) {
|
||||||
|
|
||||||
|
struct stat S;
|
||||||
|
|
||||||
|
/* Create the full file name */
|
||||||
|
char* Name = xmalloc (DirLen + 1 + strlen (E->d_name) + 1);
|
||||||
|
strcpy (Name, Arg);
|
||||||
|
strcpy (Name + DirLen, "/");
|
||||||
|
strcpy (Name + DirLen + 1, E->d_name);
|
||||||
|
|
||||||
|
/* Stat the file */
|
||||||
|
if (stat (Name, &S) != 0) {
|
||||||
|
Warning ("Cannot stat `%s': %s", Name, strerror (errno));
|
||||||
|
xfree (Name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if this is a regular file */
|
||||||
|
if (S_ISREG (S.st_mode)) {
|
||||||
|
/* Treat it as a library */
|
||||||
|
LoadChipLibrary (Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Free the name */
|
||||||
|
xfree (Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Close the directory */
|
||||||
|
closedir (D);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -239,16 +284,14 @@ int main (int argc, char* argv[])
|
|||||||
++I;
|
++I;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Sort the already loaded chips */
|
||||||
|
SortChips ();
|
||||||
|
|
||||||
/* Check if we have a valid configuration */
|
/* Check if we have a valid configuration */
|
||||||
if (!CfgAvail ()) {
|
if (!CfgAvail ()) {
|
||||||
Error ("Simulator configuration missing");
|
Error ("Simulator configuration missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load the chips */
|
|
||||||
AddChipPath ("chips");
|
|
||||||
LoadChipLibrary ("ram.so");
|
|
||||||
LoadChips ();
|
|
||||||
|
|
||||||
/* Read the config file */
|
/* Read the config file */
|
||||||
CfgRead ();
|
CfgRead ();
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1998-2002 Ullrich von Bassewitz */
|
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||||
/* Wacholderweg 14 */
|
/* R<EFBFBD>merstrasse 52 */
|
||||||
/* D-70597 Stuttgart */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@musoftware.de */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
@@ -238,7 +238,12 @@ Again:
|
|||||||
|
|
||||||
case '.':
|
case '.':
|
||||||
NextChar ();
|
NextChar ();
|
||||||
|
if (C == '.') {
|
||||||
|
NextChar ();
|
||||||
|
CfgTok = CFGTOK_DOTDOT;
|
||||||
|
} else {
|
||||||
CfgTok = CFGTOK_DOT;
|
CfgTok = CFGTOK_DOT;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ',':
|
case ',':
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1998-2002 Ullrich von Bassewitz */
|
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||||
/* Wacholderweg 14 */
|
/* R<EFBFBD>merstrasse 52 */
|
||||||
/* D-70597 Stuttgart */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@musoftware.de */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
@@ -57,15 +57,11 @@ typedef enum {
|
|||||||
CFGTOK_EQ,
|
CFGTOK_EQ,
|
||||||
CFGTOK_COLON,
|
CFGTOK_COLON,
|
||||||
CFGTOK_DOT,
|
CFGTOK_DOT,
|
||||||
|
CFGTOK_DOTDOT,
|
||||||
CFGTOK_EOF,
|
CFGTOK_EOF,
|
||||||
|
|
||||||
/* Primary blocks */
|
/* Primary blocks */
|
||||||
CFGTOK_CHIPS,
|
CFGTOK_MEMORY,
|
||||||
|
|
||||||
/* Chips section */
|
|
||||||
CFGTOK_NAME,
|
|
||||||
CFGTOK_ADDR,
|
|
||||||
CFGTOK_RANGE,
|
|
||||||
|
|
||||||
/* Special identifiers */
|
/* Special identifiers */
|
||||||
CFGTOK_TRUE,
|
CFGTOK_TRUE,
|
||||||
|
|||||||
Reference in New Issue
Block a user