]> git.sur5r.net Git - cc65/blobdiff - src/ld65/tgtcfg.c
No copyright message here.
[cc65] / src / ld65 / tgtcfg.c
index 2de8765a1a5532badfa31f1c02bc283f4f9f50c8..2601c20e45668404460c5b76f618b44f2b9b338e 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2000 Ullrich von Bassewitz                                       */
-/*               Wacholderweg 14                                             */
-/*               D-70597 Stuttgart                                           */
-/* EMail:        uz@musoftware.de                                            */
+/* (C) 1998-2009, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
 
 
 
+/* common */
+#include "check.h"
+
+/* ld65 */
 #include "binfmt.h"
 #include "tgtcfg.h"
 
 
 
 
-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 = $D2, size = $1A, 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;"
-    "}";
+/* Actual target configurations, converted into C strings by a perl script */
+#include "apple2.inc"
+#include "apple2enh.inc"
+#include "atari.inc"
+#include "atmos.inc"
+#include "bbc.inc"
+#include "c128.inc"
+#include "c16.inc"
+#include "c64.inc"
+#include "cbm510.inc"
+#include "cbm610.inc"
+#include "geos-apple.inc"
+#include "geos-cbm.inc"
+#include "lunix.inc"
+#include "lynx.inc"
+#include "module.inc"
+#include "nes.inc"
+#include "none.inc"
+#include "pet.inc"
+#include "plus4.inc"
+#include "supervision.inc"
+#include "vic20.inc"
 
 
 
 /*****************************************************************************/
-/*                                          Data                                    */
+/*                                          Data                                    */
 /*****************************************************************************/
 
 
 
 /* Target configurations for all systems */
-const TargetDesc Targets [TGT_COUNT] = {
-    {          BINFMT_BINARY,  CfgNone         },
-    {          BINFMT_BINARY,  CfgAtari        },
-    {          BINFMT_BINARY,  CfgC64          },
-    {          BINFMT_BINARY,  CfgC128         },
-    {          BINFMT_BINARY,  CfgAce          },
-    {          BINFMT_BINARY,  CfgPlus4        },
-    {          BINFMT_BINARY,  CfgCBM610       },
-    {          BINFMT_BINARY,  CfgPET          },
-    {          BINFMT_BINARY,  CfgNES          },
-#if 0
-    {   BINFMT_O65,     CfgLunix       },
-    {   BINFMT_O65,    CfgOSA65        },
-#endif
-    {   BINFMT_BINARY, CfgApple2       },
-    {   BINFMT_BINARY,  CfgGeos                },
+const TargetDesc Targets[TGT_COUNT] = {
+    {          BINFMT_BINARY,  CfgNone         },
+    {          BINFMT_O65,     CfgModule       },
+    {          BINFMT_BINARY,  CfgAtari        },
+    {  BINFMT_BINARY,  CfgVic20        },
+    {   BINFMT_BINARY,  CfgC16          },
+    {          BINFMT_BINARY,  CfgC64          },
+    {          BINFMT_BINARY,  CfgC128         },
+    {          BINFMT_BINARY,  CfgPlus4        },
+    {          BINFMT_BINARY,  CfgCBM510       },
+    {          BINFMT_BINARY,  CfgCBM610       },
+    {          BINFMT_BINARY,  CfgPET          },
+    {          BINFMT_BINARY,  CfgBBC          },
+    {   BINFMT_BINARY, CfgApple2       },
+    {   BINFMT_BINARY,  CfgApple2Enh    },
+    {   BINFMT_BINARY,  CfgGeosCBM      },
+    {   BINFMT_BINARY,  CfgGeosApple    },
+    {   BINFMT_O65,     CfgLunix        },
+    {          BINFMT_BINARY,  CfgAtmos        },
+    {          BINFMT_BINARY,  CfgNES          },
+    {          BINFMT_BINARY,  CfgSupervision  },
+    {          BINFMT_BINARY,  CfgLynx         },
 };
 
 
 
+/*****************************************************************************/
+/*                                          Code                                    */
+/*****************************************************************************/
+
+
+
+void DumpBuiltinConfig (FILE* F, target_t T)
+/* Dump a builtin linker configuration */
+{
+    /* Check the given parameter */
+    PRECONDITION (T > TGT_UNKNOWN && T < TGT_COUNT);
+
+    /* Dump the config */
+    fprintf (F, "%s\n", Targets[T].Cfg);
+}
+
+
+
+