2000-05-28 13:40:48 +00:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* */
|
|
|
|
|
/* config.h */
|
|
|
|
|
/* */
|
|
|
|
|
/* Target configuration file for the ld65 linker */
|
|
|
|
|
/* */
|
|
|
|
|
/* */
|
|
|
|
|
/* */
|
2005-01-08 13:44:11 +00:00
|
|
|
|
/* (C) 1998-2005 Ullrich von Bassewitz */
|
2003-05-22 22:20:32 +00:00
|
|
|
|
/* R<>merstrasse 52 */
|
|
|
|
|
/* D-70794 Filderstadt */
|
|
|
|
|
/* EMail: uz@cc65.org */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
/* */
|
|
|
|
|
/* */
|
|
|
|
|
/* 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 CONFIG_H
|
|
|
|
|
#define CONFIG_H
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-09-14 21:08:05 +00:00
|
|
|
|
/* ld65 */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
#include "segments.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Data */
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* File list entry */
|
2000-11-02 22:11:25 +00:00
|
|
|
|
typedef struct File File;
|
|
|
|
|
struct File {
|
2003-06-04 12:40:14 +00:00
|
|
|
|
unsigned Name; /* Name index of the file */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
File* Next; /* Pointer to next entry in list */
|
|
|
|
|
unsigned Flags;
|
|
|
|
|
unsigned Format; /* Output format */
|
2000-11-02 22:11:25 +00:00
|
|
|
|
struct Memory* MemList; /* List of memory areas in this file */
|
|
|
|
|
struct Memory* MemLast; /* Last memory area in this file */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Segment list node. Needed because there are two lists (RUN & LOAD) */
|
2000-11-02 22:11:25 +00:00
|
|
|
|
typedef struct MemListNode MemListNode;
|
|
|
|
|
struct MemListNode {
|
|
|
|
|
MemListNode* Next; /* Next entry */
|
|
|
|
|
struct SegDesc* Seg; /* Segment */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Memory list entry */
|
2000-11-02 22:11:25 +00:00
|
|
|
|
typedef struct Memory Memory;
|
|
|
|
|
struct Memory {
|
2003-06-04 12:40:14 +00:00
|
|
|
|
unsigned Name; /* Name index of the memory section */
|
2000-11-02 22:11:25 +00:00
|
|
|
|
Memory* Next; /* Pointer to next entry in list */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
Memory* FNext; /* Next in file list */
|
|
|
|
|
unsigned Attr; /* Which values are valid? */
|
2000-11-02 22:11:25 +00:00
|
|
|
|
unsigned Flags; /* Set of bitmapped flags */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
unsigned long Start; /* Start address */
|
|
|
|
|
unsigned long Size; /* Length of memory section */
|
|
|
|
|
unsigned long FillLevel; /* Actual fill level of segment */
|
|
|
|
|
unsigned char FillVal; /* Value used to fill rest of seg */
|
2005-01-23 11:19:26 +00:00
|
|
|
|
unsigned char Relocatable; /* Memory area is relocatable */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
MemListNode* SegList; /* List of segments for this section */
|
|
|
|
|
MemListNode* SegLast; /* Last segment in this section */
|
2000-11-02 22:11:25 +00:00
|
|
|
|
File* F; /* File that contains the entry */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Segment descriptor entry */
|
2000-11-02 22:11:25 +00:00
|
|
|
|
typedef struct SegDesc SegDesc;
|
|
|
|
|
struct SegDesc {
|
2003-06-04 12:40:14 +00:00
|
|
|
|
unsigned Name; /* Index of the name */
|
2000-11-02 22:11:25 +00:00
|
|
|
|
SegDesc* Next; /* Pointer to next entry in list */
|
2003-06-04 12:40:14 +00:00
|
|
|
|
Segment* Seg; /* Pointer to segment structure */
|
|
|
|
|
unsigned Attr; /* Attributes for segment */
|
|
|
|
|
unsigned Flags; /* Set of bitmapped flags */
|
2000-11-02 22:11:25 +00:00
|
|
|
|
Memory* Load; /* Load memory section */
|
2003-06-04 12:40:14 +00:00
|
|
|
|
Memory* Run; /* Run memory section */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
unsigned long Addr; /* Start address or offset into segment */
|
2005-01-08 13:44:11 +00:00
|
|
|
|
unsigned char Align; /* Run area alignment if given */
|
|
|
|
|
unsigned char AlignLoad; /* Load area alignment if given */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Segment list */
|
|
|
|
|
extern SegDesc* SegDescList; /* Single linked list */
|
|
|
|
|
extern unsigned SegDescCount; /* Number of entries in list */
|
|
|
|
|
|
|
|
|
|
/* Memory flags */
|
|
|
|
|
#define MF_DEFINE 0x0001 /* Define start and size */
|
|
|
|
|
#define MF_FILL 0x0002 /* Fill segment */
|
|
|
|
|
#define MF_RO 0x0004 /* Read only memory area */
|
2005-01-23 11:19:26 +00:00
|
|
|
|
#define MF_OVERFLOW 0x0008 /* Memory area overflow */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
/* Segment flags */
|
2003-05-22 22:20:32 +00:00
|
|
|
|
#define SF_RO 0x0001 /* Read only segment */
|
2000-11-02 22:11:25 +00:00
|
|
|
|
#define SF_BSS 0x0002 /* Segment is BSS style segment */
|
2003-05-22 22:20:32 +00:00
|
|
|
|
#define SF_ZP 0x0004 /* Zeropage segment (o65 only) */
|
2003-09-14 21:08:05 +00:00
|
|
|
|
#define SF_DEFINE 0x0008 /* Define start and size */
|
2005-01-08 13:44:11 +00:00
|
|
|
|
#define SF_ALIGN 0x0010 /* Align segment in run area */
|
|
|
|
|
#define SF_ALIGN_LOAD 0x0020 /* Align segment in load area */
|
|
|
|
|
#define SF_OFFSET 0x0040 /* Segment has offset in memory */
|
|
|
|
|
#define SF_START 0x0080 /* Segment has fixed start address */
|
|
|
|
|
#define SF_OPTIONAL 0x0100 /* Segment is optional (must not exist) */
|
|
|
|
|
#define SF_RUN_DEF 0x0200 /* RUN symbols already defined */
|
|
|
|
|
#define SF_LOAD_DEF 0x0400 /* LOAD symbols already defined */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Code */
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CfgRead (void);
|
|
|
|
|
/* Read the configuration */
|
|
|
|
|
|
2005-01-23 11:19:26 +00:00
|
|
|
|
unsigned CfgAssignSegments (void);
|
|
|
|
|
/* Assign segments, define linker symbols where requested. The function will
|
|
|
|
|
* return the number of memory area overflows (so zero means anything went ok).
|
|
|
|
|
* In case of overflows, a short mapfile can be generated later, to ease the
|
|
|
|
|
* task of rearranging segments for the user.
|
|
|
|
|
*/
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
void CfgWriteTarget (void);
|
|
|
|
|
/* Write the target file(s) */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* End of config.h */
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-05-22 22:20:32 +00:00
|
|
|
|
|