1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-25 13:29:41 +00:00

Moved the target configurations into separate files

git-svn-id: svn://svn.cc65.org/cc65/trunk@416 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2000-10-31 18:08:25 +00:00
parent 0e1c29d299
commit 1226f095e1
16 changed files with 296 additions and 186 deletions

View File

@ -2,4 +2,12 @@
ld65
*.map
*.s
apple2.inc
atari.inc
c128.inc
c64.inc
cbm610.inc
geos.inc
none.inc
pet.inc
plus4.inc

11
src/ld65/cfg/apple2.cfg Normal file
View File

@ -0,0 +1,11 @@
MEMORY {
ZP: start = $00, size = $1A, type = rw;
RAM: start = $800, size = $8E00, file = %O;
}
SEGMENTS {
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
}

14
src/ld65/cfg/atari.cfg Normal file
View File

@ -0,0 +1,14 @@
MEMORY {
ZP: start = $82, size = $7E, type = rw;
HEADER: start = $0000, size = $6, file = %O;
RAM: start = $1F00, size = $9D1F, file = %O; # $9D1F: matches upper bound $BC1F
}
SEGMENTS {
EXEHDR: load = HEADER, type = wprot;
CODE: load = RAM, type = wprot, define = yes;
RODATA: load = RAM, type = wprot;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
AUTOSTRT: load = RAM, type = wprot;
}

11
src/ld65/cfg/c128.cfg Normal file
View File

@ -0,0 +1,11 @@
MEMORY {
ZP: start = $02, size = $1A, type = rw;
RAM: start = $1bff, size = $a401, file = %O;
}
SEGMENTS {
CODE: load = RAM, type = wprot;
RODATA: load = RAM, type = wprot;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
}

11
src/ld65/cfg/c64.cfg Normal file
View File

@ -0,0 +1,11 @@
MEMORY {
ZP: start = $02, size = $1A, type = rw;
RAM: start = $7FF, size = $c801, file = %O;
}
SEGMENTS {
CODE: load = RAM, type = wprot;
RODATA: load = RAM, type = wprot;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
}

11
src/ld65/cfg/cbm610.cfg Normal file
View File

@ -0,0 +1,11 @@
MEMORY {
ZP: start = $02, size = $1A, type = rw;
RAM: start = $0001, size = $FFF0, file = %O;
}
SEGMENTS {
CODE: load = RAM, type = wprot;
RODATA: load = RAM, type = wprot;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
}

67
src/ld65/cfg/cvt-cfg.pl Executable file
View File

@ -0,0 +1,67 @@
#!/usr/bin/perl
# Check number of params
die "Usage: cvt-cfg.pl input output varname\n" unless ($#ARGV == 2);
# Get the parameters
$InputName = shift (@ARGV);
$OutputName = shift (@ARGV);
$VarName = shift (@ARGV);
# Open both files
open (IN, "<$InputName") or die "Cannot open $InputName\n";
open (OUT, ">$OutputName") or die "Cannot open $OutputName\n";
# Print the header to the output file
print OUT "static const char $VarName [] = \n";
# Read from input, print to output
while ($Line = <IN>) {
# Remove the newline
chomp $Line;
# Separate an existing comment. No need to be overly clever, just ignore
# hash marks in strings.
if ($Line =~ /(.*?)(\s*)(\#\s*)(.*?)\s*$/) {
$Line = $1;
$CommentSpace = $2;
$Comment = $4;
} else {
$CommentSpace = "";
$Comment = "";
}
# Remove leading and trailing spaces
$Line =~ s/^\s*|\s*$//g;
# Replace control chars
$Line =~ s/\\/\\\\/g;
$Line =~ s/\"/\\\"/g;
$Line =~ s/\'/\\\'/g;
# Print to output
print OUT "\"$Line\"";
# Add a comment if we have one
if ($Comment ne "") {
print OUT "$CommentSpace/* $Comment */";
}
# Terminate the line
print OUT "\n";
}
# Terminate the variable declaration
print OUT ";\n";
# Close the files
close IN;
close OUT;
# Done
exit 0;

11
src/ld65/cfg/geos.cfg Normal file
View File

@ -0,0 +1,11 @@
MEMORY {
HEADER: start = $204, size = 508, file = %O;
RAM: start = $400, size = $7C00, file = %O;
}
SEGMENTS {
HEADER: load = HEADER, type = ro;
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
}

17
src/ld65/cfg/lunix.cfg Normal file
View File

@ -0,0 +1,17 @@
MEMORY {
COMBINED: start = $0000, size = $FFFF, file = %O;
ZEROPAGE: start = $0000, size = $0100, file = %O;
}
SEGMENTS {
CODE: load = COMBINED, type = wprot;
RODATA: load = COMBINED, type = wprot;
DATA: load = COMBINED, type = rw, define = yes;
BSS: load = COMBINED, type = bss, define = yes;
ZEROPAGE: load = ZEROPAGE, type = zp;
}
FILES {
%O: format = o65;
}
FORMATS {
o65: os = lunix, type = small, extsym = "LUNIXKERNAL", extsym = "LIB6502";
}

11
src/ld65/cfg/nes.cfg Normal file
View File

@ -0,0 +1,11 @@
MEMORY {
ZP: start = $02, size = $1A, type = rw;
RAM: start = $03FF, size = $7BFF, file = %O;
}
SEGMENTS {
CODE: load = RAM, type = wprot;
RODATA: load = RAM, type = wprot;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
}

9
src/ld65/cfg/none.cfg Normal file
View File

@ -0,0 +1,9 @@
MEMORY {
RAM: start = %S, size = $10000, file = %O;
}
SEGMENTS {
CODE: load = RAM, type = rw;
RODATA: load = RAM, type = rw;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
}

17
src/ld65/cfg/osa65.cfg Normal file
View File

@ -0,0 +1,17 @@
MEMORY {
COMBINED: start = $0000, size = $FFFF, file = %O;
ZEROPAGE: start = $0000, size = $0100, file = %O;
}
SEGMENTS {
CODE: load = COMBINED, type = wprot;
RODATA: load = COMBINED, type = wprot;
DATA: load = COMBINED, type = rw, define = yes;
BSS: load = COMBINED, type = bss, define = yes;
ZEROPAGE: load = ZEROPAGE, type = zp;
}
FILES {
%O: format = o65;
}
FORMATS {
o65: os = osa65, type = small, extsym = "OSA2KERNAL", extsym = "LIB6502";
}

12
src/ld65/cfg/pet.cfg Normal file
View File

@ -0,0 +1,12 @@
MEMORY {
ZP: start = $02, size = $1A, type = rw;
RAM: start = $03FF, size = $7BFF, file = %O;
}
SEGMENTS {
CODE: load = RAM, type = wprot;
RODATA: load = RAM, type = wprot;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
}

11
src/ld65/cfg/plus4.cfg Normal file
View File

@ -0,0 +1,11 @@
MEMORY {
ZP: start = $02, size = $1A, type = rw;
RAM: start = $0fff, size = $7001, file = %O;
}
SEGMENTS {
CODE: load = RAM, type = wprot;
RODATA: load = RAM, type = wprot;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
}

View File

@ -11,6 +11,12 @@ CFLAGS = -g -O2 -Wall -I$(COMMON) $(CDEFS)
CC=gcc
LDFLAGS=
# Perl script for config file conversion
CVT=cfg/cvt-cfg.pl
# -----------------------------------------------------------------------------
# List of all object files
OBJS = bin.o \
binfmt.o \
config.o \
@ -29,7 +35,23 @@ OBJS = bin.o \
objfile.o \
scanner.o \
segments.o \
tgtcfg.o
tgtcfg.o
# -----------------------------------------------------------------------------
# List of all config includes
INCS = apple2.inc \
atari.inc \
c64.inc \
c128.inc \
cbm610.inc \
geos.inc \
none.inc \
pet.inc \
plus4.inc
# -----------------------------------------------------------------------------
#
LIBS = $(COMMON)/common.a
@ -47,14 +69,14 @@ endif
ld65: $(OBJS) $(LIBS)
ld65: $(INCS) $(OBJS) $(LIBS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
clean:
rm -f *~ core *.map
zap: clean
rm -f *.o $(EXECS) .depend
zap: clean
rm -f *.o $(INCS) $(EXECS) .depend
# ------------------------------------------------------------------------------
@ -63,6 +85,36 @@ zap: clean
.PHONY: depend dep
depend dep: $(OBJS:.o=.c)
@echo "Creating dependency information"
$(CC) -I$(COMMON) -MM $^ > .depend
$(CC) -I$(COMMON) -MM -MG $^ > .depend
# -----------------------------------------------------------------------------
# Rules to make config includes
apple2.inc: cfg/apple2.cfg
@$(CVT) $< $@ CfgApple2
atari.inc: cfg/atari.cfg
@$(CVT) $< $@ CfgAtari
c64.inc: cfg/c64.cfg
@$(CVT) $< $@ CfgC64
c128.inc: cfg/c128.cfg
@$(CVT) $< $@ CfgC128
cbm610.inc: cfg/cbm610.cfg
@$(CVT) $< $@ CfgCBM610
geos.inc: cfg/geos.cfg
@$(CVT) $< $@ CfgGeos
none.inc: cfg/none.cfg
@$(CVT) $< $@ CfgNone
pet.inc: cfg/pet.cfg
@$(CVT) $< $@ CfgPET
plus4.inc: cfg/plus4.cfg
@$(CVT) $< $@ CfgPlus4

View File

@ -43,180 +43,20 @@
/*****************************************************************************/
static const char CfgNone [] =
"MEMORY {"
"RAM: start = %S, size = $10000, file = %O;"
"}"
"SEGMENTS {"
"CODE: load = RAM, type = rw;"
"RODATA: load = RAM, type = rw;"
"DATA: load = RAM, type = rw;"
"BSS: load = RAM, type = bss, define = yes;"
"}";
static const char CfgAtari [] =
"MEMORY {"
"ZP: start = $82, size = $7E, type = rw;"
"HEADER: start = $0000, size = $6, file = %O;"
"RAM: start = $1F00, size = $9D1F, file = %O;" /* 9D1F: matches upper bound BC1F */
"}"
"SEGMENTS {"
"EXEHDR: load = HEADER, type = wprot;"
"CODE: load = RAM, type = wprot, define = yes;"
"RODATA: load = RAM, type = wprot;"
"DATA: load = RAM, type = rw;"
"BSS: load = RAM, type = bss, define = yes;"
"ZEROPAGE: load = ZP, type = zp;"
"AUTOSTRT: load = RAM, type = wprot;"
"}";
static const char CfgC64 [] =
"MEMORY {"
"ZP: start = $02, size = $1A, type = rw;"
"RAM: start = $7FF, size = $c801, file = %O;"
"}"
"SEGMENTS {"
"CODE: load = RAM, type = wprot;"
"RODATA: load = RAM, type = wprot;"
"DATA: load = RAM, type = rw;"
"BSS: load = RAM, type = bss, define = yes;"
"ZEROPAGE: load = ZP, type = zp;"
"}";
static const char CfgC128 [] =
"MEMORY {"
"ZP: start = $02, size = $1A, type = rw;"
"RAM: start = $1bff, size = $a401, file = %O;"
"}"
"SEGMENTS {"
"CODE: load = RAM, type = wprot;"
"RODATA: load = RAM, type = wprot;"
"DATA: load = RAM, type = rw;"
"BSS: load = RAM, type = bss, define = yes;"
"ZEROPAGE: load = ZP, type = zp;"
"}";
static const char CfgAce [] =
"";
static const char CfgPlus4 [] =
"MEMORY {"
"ZP: start = $02, size = $1A, type = rw;"
"RAM: start = $0fff, size = $7001, file = %O;"
"}"
"SEGMENTS {"
"CODE: load = RAM, type = wprot;"
"RODATA: load = RAM, type = wprot;"
"DATA: load = RAM, type = rw;"
"BSS: load = RAM, type = bss, define = yes;"
"ZEROPAGE: load = ZP, type = zp;"
"}";
static const char CfgCBM610 [] =
"MEMORY {"
"ZP: start = $02, size = $1A, type = rw;"
"RAM: start = $0001, size = $FFF0, file = %O;"
"}"
"SEGMENTS {"
"CODE: load = RAM, type = wprot;"
"RODATA: load = RAM, type = wprot;"
"DATA: load = RAM, type = rw;"
"BSS: load = RAM, type = bss, define = yes;"
"ZEROPAGE: load = ZP, type = zp;"
"}";
static const char CfgPET [] =
"MEMORY {"
"ZP: start = $02, size = $1A, type = rw;"
"RAM: start = $03FF, size = $7BFF, file = %O;"
"}"
"SEGMENTS {"
"CODE: load = RAM, type = wprot;"
"RODATA: load = RAM, type = wprot;"
"DATA: load = RAM, type = rw;"
"BSS: load = RAM, type = bss, define = yes;"
"ZEROPAGE: load = ZP, type = zp;"
"}";
static const char CfgNES [] =
"MEMORY {"
"RAM: start = $0200, size = $0600, file = \"\";"
"ROM: start = $8000, size = $8000, file = %O;"
"}"
"SEGMENTS {"
"CODE: load = ROM, type = ro;"
"RODATA: load = ROM, type = ro;"
"DATA: load = ROM, run = RAM, type = rw, define = yes;"
"BSS: load = RAM, type = bss, define = yes;"
"VECTORS: load = ROM, type = ro, start = $FFFA;"
"}";
static const char CfgLunix [] =
"MEMORY {"
"COMBINED: start = $0000, size = $FFFF, file = %O;"
"ZEROPAGE: start = $0000, size = $0100, file = %O;"
"}"
"SEGMENTS {"
"CODE: load = COMBINED, type = wprot;"
"RODATA: load = COMBINED, type = wprot;"
"DATA: load = COMBINED, type = rw, define = yes;"
"BSS: load = COMBINED, type = bss, define = yes;"
"ZEROPAGE: load = ZEROPAGE, type = zp;"
"}"
"FILES {"
"%O: format = o65;"
"}"
"FORMATS {"
"o65: os = lunix, type = small,"
"extsym = \"LUNIXKERNAL\", extsym = \"LIB6502\";"
"}";
static const char CfgOSA65 [] =
"MEMORY {"
"COMBINED: start = $0000, size = $FFFF, file = %O;"
"ZEROPAGE: start = $0000, size = $0100, file = %O;"
"}"
"SEGMENTS {"
"CODE: load = COMBINED, type = wprot;"
"RODATA: load = COMBINED, type = wprot;"
"DATA: load = COMBINED, type = rw, define = yes;"
"BSS: load = COMBINED, type = bss, define = yes;"
"ZEROPAGE: load = ZEROPAGE, type = zp;"
"}"
"FILES {"
"%O: format = o65;"
"}"
"FORMATS {"
"o65: os = osa65, type = small,"
"extsym = \"OSA2KERNAL\", extsym = \"LIB6502\";"
"}";
static const char CfgApple2 [] =
"MEMORY {"
"ZP: start = $00, size = $1A, type = rw;"
"RAM: start = $800, size = $8E00, file = %O;"
"}"
"SEGMENTS { "
"CODE: load = RAM, type = ro;"
"RODATA: load = RAM, type = ro;"
"DATA: load = RAM, type = rw;"
"BSS: load = RAM, type = bss, define = yes;"
"ZEROPAGE: load = ZP, type = zp;"
"}";
static const char CfgGeos [] =
"MEMORY {"
"HEADER: start = $204, size = 508, file = %O;"
"RAM: start = $400, size = $7C00, file = %O;"
"}"
"SEGMENTS { "
"HEADER: load = HEADER, type = ro;"
"CODE: load = RAM, type = ro;"
"RODATA: load = RAM, type = ro;"
"DATA: load = RAM, type = rw;"
"BSS: load = RAM, type = bss, define = yes;"
"}";
/* An empty config */
static const char CfgEmpty[] = "";
/* Actual target configurations, converted into C strings by a perl script */
#include "apple2.inc"
#include "atari.inc"
#include "c128.inc"
#include "c64.inc"
#include "cbm610.inc"
#include "geos.inc"
#include "none.inc"
#include "pet.inc"
#include "plus4.inc"
@ -232,18 +72,15 @@ const TargetDesc Targets [TGT_COUNT] = {
{ BINFMT_BINARY, CfgAtari },
{ BINFMT_BINARY, CfgC64 },
{ BINFMT_BINARY, CfgC128 },
{ BINFMT_BINARY, CfgAce },
{ BINFMT_BINARY, CfgEmpty }, /* Ace */
{ BINFMT_BINARY, CfgPlus4 },
{ BINFMT_BINARY, CfgCBM610 },
{ BINFMT_BINARY, CfgPET },
{ BINFMT_BINARY, CfgNES },
#if 0
{ BINFMT_O65, CfgLunix },
{ BINFMT_O65, CfgOSA65 },
#endif
{ BINFMT_BINARY, CfgEmpty }, /* NES */
{ BINFMT_BINARY, CfgApple2 },
{ BINFMT_BINARY, CfgGeos },
};