Working on better 65816 support
git-svn-id: svn://svn.cc65.org/cc65/trunk@2619 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
60
src/common/addrsize.c
Normal file
60
src/common/addrsize.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* addrsize.c */
|
||||
/* */
|
||||
/* Address size definitions */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* R<>merstra<72>e 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 "addrsize.h"
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
const char* AddrSizeToStr (unsigned char AddrSize)
|
||||
/* Return the name for an address size specifier */
|
||||
{
|
||||
switch (AddrSize) {
|
||||
case ADDR_SIZE_DEFAULT: return "default";
|
||||
case ADDR_SIZE_ZP: return "zeropage";
|
||||
case ADDR_SIZE_ABS: return "absolute";
|
||||
case ADDR_SIZE_FAR: return "far";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -45,12 +45,23 @@
|
||||
|
||||
|
||||
#define ADDR_SIZE_DEFAULT 0x00
|
||||
#define ADDR_SIZE_ZEROPAGE 0x01
|
||||
#define ADDR_SIZE_ABSOLUTE 0x02
|
||||
#define ADDR_SIZE_ZP 0x01
|
||||
#define ADDR_SIZE_ABS 0x02
|
||||
#define ADDR_SIZE_FAR 0x03
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
const char* AddrSizeToStr (unsigned char AddrSize);
|
||||
/* Return the name for an address size specifier */
|
||||
|
||||
|
||||
|
||||
/* End of addrsize.h */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,7 @@ LIB = common.a
|
||||
|
||||
|
||||
OBJS = abend.o \
|
||||
addrsize.o \
|
||||
bitops.o \
|
||||
chartype.o \
|
||||
check.o \
|
||||
|
||||
@@ -10,7 +10,7 @@ export WATCOM = c:\\watcom
|
||||
export INCLUDE = $(WATCOM)\\h
|
||||
|
||||
# We will use the windows compiler under linux (define as empty for windows)
|
||||
WINE = wine --
|
||||
WINE = wine --
|
||||
|
||||
# Programs
|
||||
AR = $(WINE) WLIB
|
||||
@@ -55,6 +55,7 @@ endif
|
||||
# All library OBJ files
|
||||
|
||||
OBJS = abend.obj \
|
||||
addrsize.obj \
|
||||
bitops.obj \
|
||||
chartype.obj \
|
||||
check.obj \
|
||||
|
||||
@@ -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<EFBFBD>merstra<EFBFBD>e 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@@ -45,17 +45,15 @@
|
||||
|
||||
|
||||
|
||||
SegDef* NewSegDef (const char* Name, unsigned Type)
|
||||
SegDef* NewSegDef (const char* Name, unsigned AddrSize)
|
||||
/* Create a new segment definition and return it */
|
||||
{
|
||||
/* Allocate memory */
|
||||
SegDef* D = xmalloc (sizeof (SegDef));
|
||||
|
||||
/* Initialize it */
|
||||
if (D) {
|
||||
D->Name = xstrdup (Name);
|
||||
D->Type = Type;
|
||||
}
|
||||
D->Name = xstrdup (Name);
|
||||
D->AddrSize = AddrSize;
|
||||
|
||||
/* Return the result */
|
||||
return D;
|
||||
@@ -75,20 +73,7 @@ void FreeSegDef (SegDef* D)
|
||||
SegDef* DupSegDef (const SegDef* Def)
|
||||
/* Duplicate a segment definition and return it */
|
||||
{
|
||||
return NewSegDef (Def->Name, Def->Type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char* SegTypeToStr (unsigned char Type)
|
||||
/* Map a segment type into a string */
|
||||
{
|
||||
switch (Type) {
|
||||
case SEGTYPE_ABS: return "abs";
|
||||
case SEGTYPE_ZP: return "zp";
|
||||
case SEGTYPE_FAR: return "far";
|
||||
default: return "unknown";
|
||||
}
|
||||
return NewSegDef (Def->Name, Def->AddrSize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* R<>merstrasse 52 */
|
||||
/* R<>merstra<EFBFBD>e 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
@@ -37,6 +37,11 @@
|
||||
#define SEGDEFS_H
|
||||
|
||||
|
||||
|
||||
/* common */
|
||||
#include "addrsize.h"
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
@@ -44,21 +49,15 @@
|
||||
|
||||
|
||||
|
||||
/* Available segment types */
|
||||
#define SEGTYPE_DEFAULT 0
|
||||
#define SEGTYPE_ABS 1
|
||||
#define SEGTYPE_ZP 2
|
||||
#define SEGTYPE_FAR 3
|
||||
|
||||
/* Segment definition */
|
||||
typedef struct SegDef SegDef;
|
||||
struct SegDef {
|
||||
char* Name; /* Segment name */
|
||||
unsigned Type; /* Segment type, see above */
|
||||
unsigned AddrSize; /* Default address size */
|
||||
};
|
||||
|
||||
/* Initializer for static SegDefs */
|
||||
#define STATIC_SEGDEF_INITIALIZER(name, type) { (name), (type) }
|
||||
#define STATIC_SEGDEF_INITIALIZER(name, addrsize) { name, addrsize }
|
||||
|
||||
|
||||
|
||||
@@ -68,7 +67,7 @@ struct SegDef {
|
||||
|
||||
|
||||
|
||||
SegDef* NewSegDef (const char* Name, unsigned Type);
|
||||
SegDef* NewSegDef (const char* Name, unsigned AddrSize);
|
||||
/* Create a new segment definition and return it */
|
||||
|
||||
void FreeSegDef (SegDef* D);
|
||||
@@ -77,9 +76,6 @@ void FreeSegDef (SegDef* D);
|
||||
SegDef* DupSegDef (const SegDef* D);
|
||||
/* Duplicate a segment definition and return it */
|
||||
|
||||
const char* SegTypeToStr (unsigned char Type);
|
||||
/* Map a segment type into a string */
|
||||
|
||||
|
||||
|
||||
/* End of segdefs.h */
|
||||
|
||||
Reference in New Issue
Block a user