--- /dev/null
+/*****************************************************************************/
+/* */
+/* addrspace.c */
+/* */
+/* CPU address space for the 6502 simulator */
+/* */
+/* */
+/* */
+/* (C) 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 */
+/* warranty. In no event will the authors be held liable for any damages */
+/* arising from the use of this software. */
+/* */
+/* Permission is granted to anyone to use this software for any purpose, */
+/* including commercial applications, and to alter it and redistribute it */
+/* freely, subject to the following restrictions: */
+/* */
+/* 1. The origin of this software must not be misrepresented; you must not */
+/* claim that you wrote the original software. If you use this software */
+/* in a product, an acknowledgment in the product documentation would be */
+/* appreciated but is not required. */
+/* 2. Altered source versions must be plainly marked as such, and must not */
+/* be misrepresented as being the original software. */
+/* 3. This notice may not be removed or altered from any source */
+/* distribution. */
+/* */
+/*****************************************************************************/
+
+
+
+/* common */
+#include "check.h"
+#include "xmalloc.h"
+
+/* sim65 */
+#include "chip.h"
+#include "cpucore.h"
+#include "error.h"
+#include "addrspace.h"
+
+
+
+/*****************************************************************************/
+/* Code */
+/*****************************************************************************/
+
+
+
+AddressSpace* NewAddressSpace (unsigned Size)
+/* Allocate a new address space and return it */
+{
+ unsigned I;
+
+ /* Allocate memory */
+ AddressSpace* AS = xmalloc (sizeof (AddressSpace) +
+ (Size - 1) * sizeof (ChipInstance*));
+
+ /* Initialize the struct */
+ AS->CPU = 0;
+ AS->Size = Size;
+ for (I = 0; I < Size; ++I) {
+ AS->Data[I] = 0;
+ }
+
+ /* Return the new struct */
+ return AS;
+}
+
+
+
+void ASWrite (AddressSpace* AS, unsigned Addr, unsigned char Val)
+/* Write a byte to a given location */
+{
+ const ChipInstance* CI;
+
+ /* Make sure, the addresses are in a valid range */
+ PRECONDITION (Addr < AS->Size);
+
+ /* Get the instance of the chip at this address */
+ CI = AS->Data[Addr];
+
+ /* Check if the memory is mapped */
+ if (CI == 0) {
+ Break ("Writing to unassigned memory at $%06X", Addr);
+ } else {
+ CI->C->Data->Write (CI->Data, Addr - CI->Addr, Val);
+ }
+}
+
+
+
+unsigned char ASRead (AddressSpace* AS, unsigned Addr)
+/* Read a byte from a location */
+{
+ const ChipInstance* CI;
+
+ /* Make sure, the addresses are in a valid range */
+ PRECONDITION (Addr < AS->Size);
+
+ /* Get the instance of the chip at this address */
+ CI = AS->Data[Addr];
+
+ /* Check if the memory is mapped */
+ if (CI == 0) {
+ Break ("Reading from unassigned memory at $%06X", Addr);
+ return 0xFF;
+ } else {
+ return CI->C->Data->Read (CI->Data, Addr - CI->Addr);
+ }
+}
+
+
+
+void ASWriteCtrl (AddressSpace* AS, unsigned Addr, unsigned char Val)
+/* Write a byte to a given location */
+{
+ const ChipInstance* CI;
+
+ /* Make sure, the addresses are in a valid range */
+ PRECONDITION (Addr < AS->Size);
+
+ /* Get the instance of the chip at this address */
+ CI = AS->Data[Addr];
+
+ /* Check if the memory is mapped */
+ if (CI == 0) {
+ Break ("Writing to unassigned memory at $%06X", Addr);
+ } else {
+ CI->C->Data->WriteCtrl (CI->Data, Addr - CI->Addr, Val);
+ }
+}
+
+
+
+unsigned char ASReadCtrl (AddressSpace* AS, unsigned Addr)
+/* Read a byte from a location */
+{
+ const ChipInstance* CI;
+
+ /* Make sure, the addresses are in a valid range */
+ PRECONDITION (Addr < AS->Size);
+
+ /* Get the instance of the chip at this address */
+ CI = AS->Data[Addr];
+
+ /* Check if the memory is mapped */
+ if (CI == 0) {
+ Break ("Reading from unassigned memory at $%06X", Addr);
+ return 0xFF;
+ } else {
+ return CI->C->Data->ReadCtrl (CI->Data, Addr - CI->Addr);
+ }
+}
+
+
+void ASAssignChip (AddressSpace* AS, ChipInstance* CI,
+ unsigned Addr, unsigned Range)
+/* Assign a chip instance to memory locations */
+{
+ /* Make sure, the addresses are in a valid range */
+ PRECONDITION (Addr + Range <= AS->Size);
+
+ /* Assign the chip instance */
+ while (Range--) {
+ CHECK (AS->Data[Addr] == 0);
+ AS->Data[Addr++] = CI;
+ }
+
+ /* Set the backpointer to us */
+ CI->AS = AS;
+}
+
+
+ChipInstance* ASGetChip (const AddressSpace* AS, unsigned Addr)
+/* Get the chip that is located at the given address (may return NULL). */
+{
+ /* Make sure, the addresses are in a valid range */
+ PRECONDITION (Addr < AS->Size);
+
+ /* Return the chip instance */
+ return AS->Data[Addr];
+}
+
+
+
--- /dev/null
+/*****************************************************************************/
+/* */
+/* addrspace.h */
+/* */
+/* CPU address space for the 6502 simulator */
+/* */
+/* */
+/* */
+/* (C) 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 */
+/* warranty. In no event will the authors be held liable for any damages */
+/* arising from the use of this software. */
+/* */
+/* Permission is granted to anyone to use this software for any purpose, */
+/* including commercial applications, and to alter it and redistribute it */
+/* freely, subject to the following restrictions: */
+/* */
+/* 1. The origin of this software must not be misrepresented; you must not */
+/* claim that you wrote the original software. If you use this software */
+/* in a product, an acknowledgment in the product documentation would be */
+/* appreciated but is not required. */
+/* 2. Altered source versions must be plainly marked as such, and must not */
+/* be misrepresented as being the original software. */
+/* 3. This notice may not be removed or altered from any source */
+/* distribution. */
+/* */
+/*****************************************************************************/
+
+
+
+#ifndef ADDRSPACE_H
+#define ADDRSPACE_H
+
+
+
+/*****************************************************************************/
+/* Data */
+/*****************************************************************************/
+
+
+
+/* Forwards */
+struct CPUData;
+struct ChipInstance;
+
+/* Forwards */
+typedef struct AddressSpace AddressSpace;
+struct AddressSpace {
+
+ struct CPU* CPU; /* Backpointer to CPU */
+ unsigned Size; /* Address space size */
+ struct ChipInstance* Data[1]; /* Pointer to chips, dynamically! */
+
+};
+
+
+
+/*****************************************************************************/
+/* Code */
+/*****************************************************************************/
+
+
+
+AddressSpace* NewAddressSpace (unsigned Size);
+/* Allocate a new address space and return it */
+
+void ASWrite (AddressSpace* AS, unsigned Addr, unsigned char Val);
+/* Write a byte to a given location */
+
+unsigned char ASRead (AddressSpace* AS, unsigned Addr);
+/* Read a byte from a location */
+
+void ASWriteCtrl (AddressSpace* AS, unsigned Addr, unsigned char Val);
+/* Write a byte to a given location */
+
+unsigned char ASReadCtrl (AddressSpace* AS, unsigned Addr);
+/* Read a byte from a location */
+
+void ASAssignChip (AddressSpace* AS, struct ChipInstance* CI,
+ unsigned Addr, unsigned Range);
+/* Assign a chip instance to memory locations */
+
+struct ChipInstance* ASGetChip (const AddressSpace* AS, unsigned Addr);
+/* Get the chip that is located at the given address (may return NULL). */
+
+
+
+/* End of addrspace.h */
+
+#endif
+
+
+
+
#include "xmalloc.h"
/* sim65 */
+#include "error.h"
#include "scanner.h"
#include "cfgdata.h"
+void CfgDataCheckType (const CfgData* D, unsigned Type)
+/* Check the config data type and print an error message if it has the wrong
+ * type.
+ */
+{
+ if (D->Type != Type) {
+ Error ("%s(%u): Attribute `%s' has invalid type",
+ CfgGetName (), D->Line, D->Attr);
+ }
+}
+
+
+
int CfgDataFind (const Collection* Attributes, const char* AttrName)
/* Find the attribute with the given name and return its index. Return -1 if
* the attribute was not found.
}
/* Not found */
- return -1;
+ return -1;
}
void FreeCfgData (CfgData* D);
/* Free a config data structure */
+void CfgDataCheckType (const CfgData* D, unsigned Type);
+/* Check the config data type and print an error message if it has the wrong
+ * type.
+ */
+
int CfgDataFind (const Collection* Attributes, const char* AttrName);
/* Find the attribute with the given name and return its index. Return -1 if
* the attribute was not found.
Chip* C = xmalloc (sizeof (Chip));
/* Initialize the fields */
- C->Library = Library;
+ C->Lib = Library;
C->Data = Data;
C->Instances = EmptyCollection;
/* Initialize the fields */
CI->C = C;
+ CI->AS = 0;
CI->Addr = Addr;
CI->Size = Size;
CI->Data = C->Data->InitInstance (Addr, Size, Attributes);
/* */
/* */
/* */
-/* (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 */
/* Forwards */
+struct AddressSpace;
struct CfgData;
typedef struct ChipInstance ChipInstance;
typedef struct Chip Chip;
/* One instance of a chip */
struct ChipInstance {
- Chip* C; /* Pointer to corresponding chip */
- unsigned Addr; /* Start address of range */
- unsigned Size; /* Size of range */
- void* Data; /* Chip instance data */
+ 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 */
struct Chip {
- struct ChipLibrary* Library; /* Pointer to library data structure */
- const ChipData* Data; /* Chip data as given by the library */
- Collection Instances; /* Pointer to chip instances */
+ struct ChipLibrary* Lib; /* Pointer to library data structure */
+ const ChipData* Data; /* Chip data as given by the library */
+ Collection Instances; /* Pointer to chip instances */
};
/* ChipLibrary structure */
/* */
/* */
/* */
-/* (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 */
static void* InitInstance (unsigned Addr, unsigned Range, void* CfgInfo)
/* Initialize a new chip instance */
{
+ long Val;
+
/* Allocate a new instance structure */
InstanceData* D = Sim->Malloc (sizeof (InstanceData));
D->MemAttr = Sim->Malloc (Range * sizeof (D->MemAttr[0]));
D->Mem = Sim->Malloc (Range * sizeof (D->Mem[0]));
- /* Clear the RAM and attribute memory */
+ /* Check if a value is given that should be used to clear the RAM.
+ * Otherwise use random values.
+ */
+ if (Sim->GetCfgNum (CfgInfo, "fill", &Val) == 0) {
+ /* No "fill" attribute */
+ unsigned I;
+ for (I = 0; I < Range; ++I) {
+ D->Mem[I] = (unsigned char) rand ();
+ }
+ } else {
+ /* Got a "fill" attribute */
+ memset (D->Mem, (int) Val, Range);
+ }
+
+ /* Clear the attribute memory */
memset (D->MemAttr, 0, Range * sizeof (D->MemAttr[0]));
- memset (D->Mem, 0, Range * sizeof (D->Mem[0]));
/* Done, return the instance data */
return D;
#include "error.h"
#include "global.h"
#include "memory.h"
+#include "location.h"
#include "scanner.h"
#include "config.h"
-/*****************************************************************************/
-/* Data */
-/*****************************************************************************/
-
-
-
-/* List of all memory locations */
-static Collection Locations;
-
-/* One memory location */
-typedef struct Location Location;
-struct Location {
- unsigned Start; /* Start of memory location */
- unsigned End; /* End memory location */
- Collection Attributes; /* Attributes given */
- unsigned Line; /* Line in config file */
- unsigned Col; /* Column in config file */
-};
-
-
-
-/*****************************************************************************/
-/* struct CfgData */
-/*****************************************************************************/
-
-
-
-static void CfgDataCheckType (const CfgData* D, unsigned Type)
-/* Check the config data type */
-{
- if (D->Type != Type) {
- Error ("%s(%u): Attribute `%s' has invalid type",
- CfgGetName (), D->Line, D->Attr);
- }
-}
-
-
-
-/*****************************************************************************/
-/* 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 int LocationGetAttr (const Location* L, const char* AttrName)
-/* Find the attribute with the given name and return it. Call Error() if the
- * attribute was not found.
- */
-{
- int I = CfgDataFind (&L->Attributes, AttrName);
- if (I < 0) {
- Error ("%s(%u): Attribute `%s' missing", CfgGetName(), L->Line, AttrName);
- }
- return I;
-}
-
-
-
-static int LocationIsMirror (const Location* L)
-/* Return true if the given location is a mirror of another one. */
-{
- /* Find the "mirror" attribute */
- return (CfgDataFind (&L->Attributes, "mirror") >= 0);
-}
-
-
-
/*****************************************************************************/
/* Code */
/*****************************************************************************/
/* Parse a MEMORY section */
{
unsigned I;
- const Location* Last;
while (CfgTok == CFGTOK_INTCON) {
}
/* Sort all memory locations */
- CollSort (&Locations, CmpLocations, 0);
-
- /* Check for overlaps and other problems */
- Last = 0;
- for (I = 0; I < CollCount (&Locations); ++I) {
+ LocationSort (&Locations);
- /* 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 $%06X is a mirror "
- "but has attributes", CfgGetName(), L->Line, L->Start);
- }
- D = CollConstAt (&L->Attributes, 0);
- CfgDataCheckType (D, CfgDataNumber);
- }
-
- /* Remember this entry */
- Last = L;
- }
+ /* Check the locations for overlaps and other problems */
+ LocationCheck (&Locations);
/* Now create the chip instances. Since we can only mirror existing chips,
* we will first create all real chips and the mirrors in a second run.
/* */
/* */
/* */
-/* (C) 2002 Ullrich von Bassewitz */
-/* Wacholderweg 14 */
-/* D-70597 Stuttgart */
+/* (C) 2002-2003 Ullrich von Bassewitz */
+/* Römerstrasse 52 */
+/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* */
/* */
/* */
/* */
-/* (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 */
/* */
/* */
/* */
-/* (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 */
-
+
/* */
/* */
/* */
-/* (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 */
/* */
/* */
/* */
-/* (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 */
/* */
/* */
/* */
-/* (C) 2002 Ullrich von Bassewitz */
-/* Wacholderweg 14 */
-/* D-70597 Stuttgart */
+/* (C) 2002-2003 Ullrich von Bassewitz */
+/* Römerstrasse 52 */
+/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* */
/* */
/* */
/* */
-/* (C) 2002 Ullrich von Bassewitz */
-/* Wacholderweg 14 */
-/* D-70597 Stuttgart */
+/* (C) 2002-2003 Ullrich von Bassewitz */
+/* Römerstrasse 52 */
+/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* */
--- /dev/null
+/*****************************************************************************/
+/* */
+/* location.c */
+/* */
+/* Memory location description */
+/* */
+/* */
+/* */
+/* (C) 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 */
+/* warranty. In no event will the authors be held liable for any damages */
+/* arising from the use of this software. */
+/* */
+/* Permission is granted to anyone to use this software for any purpose, */
+/* including commercial applications, and to alter it and redistribute it */
+/* freely, subject to the following restrictions: */
+/* */
+/* 1. The origin of this software must not be misrepresented; you must not */
+/* claim that you wrote the original software. If you use this software */
+/* in a product, an acknowledgment in the product documentation would be */
+/* appreciated but is not required. */
+/* 2. Altered source versions must be plainly marked as such, and must not */
+/* be misrepresented as being the original software. */
+/* 3. This notice may not be removed or altered from any source */
+/* distribution. */
+/* */
+/*****************************************************************************/
+
+
+
+/* common.h */
+#include "coll.h"
+#include "xmalloc.h"
+
+/* sim65 */
+#include "cfgdata.h"
+#include "error.h"
+#include "scanner.h"
+#include "location.h"
+
+
+
+/*****************************************************************************/
+/* Data */
+/*****************************************************************************/
+
+
+
+/* List of all memory locations */
+Collection Locations = STATIC_COLLECTION_INITIALIZER;
+
+
+
+/*****************************************************************************/
+/* Code */
+/*****************************************************************************/
+
+
+
+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;
+ }
+}
+
+
+
+int LocationGetAttr (const Location* L, const char* AttrName)
+/* Find the attribute with the given name and return it. Call Error() if the
+ * attribute was not found.
+ */
+{
+ int I = CfgDataFind (&L->Attributes, AttrName);
+ if (I < 0) {
+ Error ("%s(%u): Attribute `%s' missing", CfgGetName(), L->Line, AttrName);
+ }
+ return I;
+}
+
+
+
+int LocationIsMirror (const Location* L)
+/* Return true if the given location is a mirror of another one. */
+{
+ /* Find the "mirror" attribute */
+ return (CfgDataFind (&L->Attributes, "mirror") >= 0);
+}
+
+
+
+void LocationSort (Collection* Locations)
+/* Sort all locations by address */
+{
+ /* Sort all memory locations */
+ CollSort (Locations, CmpLocations, 0);
+}
+
+
+
+void LocationCheck (const Collection* Locations)
+/* Check all locations for problems */
+{
+ unsigned I;
+
+ /* Check for overlaps and other problems */
+ const Location* Last = 0;
+ for (I = 0; I < CollCount (Locations); ++I) {
+
+ /* Get this location */
+ const Location* L = CollConstAt (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 $%06X is a mirror "
+ "but has attributes", CfgGetName(), L->Line, L->Start);
+ }
+ D = CollConstAt (&L->Attributes, 0);
+ CfgDataCheckType (D, CfgDataNumber);
+ }
+
+ /* Remember this entry */
+ Last = L;
+ }
+}
+
+
+
+
--- /dev/null
+/*****************************************************************************/
+/* */
+/* location.h */
+/* */
+/* Memory location description */
+/* */
+/* */
+/* */
+/* (C) 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 */
+/* warranty. In no event will the authors be held liable for any damages */
+/* arising from the use of this software. */
+/* */
+/* Permission is granted to anyone to use this software for any purpose, */
+/* including commercial applications, and to alter it and redistribute it */
+/* freely, subject to the following restrictions: */
+/* */
+/* 1. The origin of this software must not be misrepresented; you must not */
+/* claim that you wrote the original software. If you use this software */
+/* in a product, an acknowledgment in the product documentation would be */
+/* appreciated but is not required. */
+/* 2. Altered source versions must be plainly marked as such, and must not */
+/* be misrepresented as being the original software. */
+/* 3. This notice may not be removed or altered from any source */
+/* distribution. */
+/* */
+/*****************************************************************************/
+
+
+
+#ifndef LOCATION_H
+#define LOCATION_H
+
+
+
+/* common.h */
+#include "coll.h"
+
+
+
+/*****************************************************************************/
+/* Data */
+/*****************************************************************************/
+
+
+
+/* List of all memory locations */
+extern Collection Locations;
+
+/* One memory location */
+typedef struct Location Location;
+struct Location {
+ unsigned Start; /* Start of memory location */
+ unsigned End; /* End memory location */
+ Collection Attributes; /* Attributes given */
+ unsigned Line; /* Line in config file */
+ unsigned Col; /* Column in config file */
+};
+
+
+
+/*****************************************************************************/
+/* Code */
+/*****************************************************************************/
+
+
+
+Location* NewLocation (unsigned long Start, unsigned long End);
+/* Create a new location, initialize and return it */
+
+int LocationGetAttr (const Location* L, const char* AttrName);
+/* Find the attribute with the given name and return it. Call Error() if the
+ * attribute was not found.
+ */
+
+int LocationIsMirror (const Location* L);
+/* Return true if the given location is a mirror of another one. */
+
+void LocationSort (Collection* Locations);
+/* Sort all locations by address */
+
+void LocationCheck (const Collection* Locations);
+/* Check all locations for problems */
+
+
+
+/* End of location.h */
+
+#endif
+
+
+
EBIND = emxbind
LDFLAGS =
-OBJS = cfgdata.o \
+OBJS = addrspace.o \
+ cfgdata.o \
chip.o \
chippath.o \
config.o \
cputype.o \
error.o \
global.o \
+ location.o \
main.o \
memory.o \
scanner.o
/* */
/* */
/* */
-/* (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 */