1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 00:29:31 +00:00
git-svn-id: svn://svn.cc65.org/cc65/trunk@2110 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2003-05-01 22:38:47 +00:00
parent 2a5fbd00ef
commit 8fb90af8ff
20 changed files with 653 additions and 187 deletions

190
src/sim65/addrspace.c Normal file
View File

@ -0,0 +1,190 @@
/*****************************************************************************/
/* */
/* 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];
}

99
src/sim65/addrspace.h Normal file
View File

@ -0,0 +1,99 @@
/*****************************************************************************/
/* */
/* 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

View File

@ -40,6 +40,7 @@
#include "xmalloc.h"
/* sim65 */
#include "error.h"
#include "scanner.h"
#include "cfgdata.h"
@ -87,6 +88,19 @@ void FreeCfgData (CfgData* D)
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.
@ -108,7 +122,7 @@ int CfgDataFind (const Collection* Attributes, const char* AttrName)
}
/* Not found */
return -1;
return -1;
}

View File

@ -82,6 +82,11 @@ CfgData* NewCfgData (void);
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.

View File

@ -246,7 +246,7 @@ static Chip* NewChip (ChipLibrary* Library, const ChipData* Data)
Chip* C = xmalloc (sizeof (Chip));
/* Initialize the fields */
C->Library = Library;
C->Lib = Library;
C->Data = Data;
C->Instances = EmptyCollection;
@ -275,6 +275,7 @@ ChipInstance* NewChipInstance (const char* ChipName, unsigned Addr,
/* Initialize the fields */
CI->C = C;
CI->AS = 0;
CI->Addr = Addr;
CI->Size = Size;
CI->Data = C->Data->InitInstance (Addr, Size, Attributes);

View 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 */
@ -54,6 +54,7 @@
/* Forwards */
struct AddressSpace;
struct CfgData;
typedef struct ChipInstance ChipInstance;
typedef struct Chip Chip;
@ -61,17 +62,18 @@ typedef struct ChipLibrary ChipLibrary;
/* 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 */

View 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 */

View File

@ -148,6 +148,8 @@ static int InitChip (const struct SimData* Data)
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));
@ -157,9 +159,22 @@ static void* InitInstance (unsigned Addr, unsigned Range, void* CfgInfo)
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;

View File

@ -51,117 +51,12 @@
#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 */
/*****************************************************************************/
@ -172,7 +67,6 @@ static void ParseMemory (void)
/* Parse a MEMORY section */
{
unsigned I;
const Location* Last;
while (CfgTok == CFGTOK_INTCON) {
@ -245,37 +139,10 @@ static void ParseMemory (void)
}
/* Sort all memory locations */
CollSort (&Locations, CmpLocations, 0);
LocationSort (&Locations);
/* 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 $%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.

View File

@ -6,9 +6,9 @@
/* */
/* */
/* */
/* (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 */
/* */
/* */

View 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 */

View 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 */
@ -61,4 +61,4 @@ extern CPUType CPU;

View 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 */

View 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 */

View File

@ -6,9 +6,9 @@
/* */
/* */
/* */
/* (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 */
/* */
/* */

View File

@ -6,9 +6,9 @@
/* */
/* */
/* */
/* (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 */
/* */
/* */

174
src/sim65/location.c Normal file
View File

@ -0,0 +1,174 @@
/*****************************************************************************/
/* */
/* 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;
}
}

97
src/sim65/location.h Normal file
View File

@ -0,0 +1,97 @@
/*****************************************************************************/
/* */
/* 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

View File

@ -10,7 +10,8 @@ CC = gcc
EBIND = emxbind
LDFLAGS =
OBJS = cfgdata.o \
OBJS = addrspace.o \
cfgdata.o \
chip.o \
chippath.o \
config.o \
@ -18,6 +19,7 @@ OBJS = cfgdata.o \
cputype.o \
error.o \
global.o \
location.o \
main.o \
memory.o \
scanner.o

View 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 */