]> git.sur5r.net Git - cc65/commitdiff
Add support for a module id
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 25 Apr 2002 18:11:05 +0000 (18:11 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 25 Apr 2002 18:11:05 +0000 (18:11 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@1266 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/ld65/config.c
src/ld65/global.c
src/ld65/global.h
src/ld65/main.c

index 657813ce1d28b9c576a54b3ba0a4be10c0884e40..6e310a8d52ef41090c1799914d5166d65cb40793 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2000 Ullrich von Bassewitz                                       */
+/* (C) 1998-2002 Ullrich von Bassewitz                                       */
 /*               Wacholderweg 14                                             */
 /*               D-70597 Stuttgart                                           */
 /* EMail:        uz@musoftware.de                                            */
@@ -823,7 +823,6 @@ static void ParseO65 (void)
 
     /* Remember the attributes read */
     unsigned OS = 0;            /* Initialize to keep gcc happy */
-    unsigned ID = 0;            /* Dito */
     unsigned Version = 0;
 
     /* Read the attributes */
@@ -920,7 +919,7 @@ static void ParseO65 (void)
                 /* We're expecting a number in the 0..$FFFF range*/
                 CfgAssureInt ();
                 CfgRangeCheck (0, 0xFFFF);
-                ID = (unsigned) CfgIVal;
+                ModuleId = (unsigned) CfgIVal;
                 break;
 
             case CFGTOK_VERSION:
@@ -957,7 +956,7 @@ static void ParseO65 (void)
     }
 
     /* Set the O65 operating system to use */
-    O65SetOS (O65FmtDesc, OS, Version, ID);
+    O65SetOS (O65FmtDesc, OS, Version, ModuleId);
 }
 
 
index fea95b899bab559923632cf8b9af4cdd077a4127..a121673068ba669cfd49a804f70bbbea4e7d037e 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2001 Ullrich von Bassewitz                                       */
+/* (C) 1998-2002 Ullrich von Bassewitz                                       */
 /*               Wacholderweg 14                                             */
 /*               D-70597 Stuttgart                                           */
 /* EMail:        uz@cc65.org                                                 */
@@ -45,6 +45,7 @@
 
 const char* OutputName     = "a.out";  /* Name of output file */
 
+unsigned ModuleId           = 0;        /* Id for o65 module */
 unsigned long StartAddr            = 0x200;    /* Start address */
 
 unsigned char VerboseMap    = 0;       /* Verbose map file */
index 8244ef7422a9d38293bdad3858129d165632e679..d68b69029185f1c4703505f60dfe82611378d521 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2001 Ullrich von Bassewitz                                       */
+/* (C) 1998-2002 Ullrich von Bassewitz                                       */
 /*               Wacholderweg 14                                             */
 /*               D-70597 Stuttgart                                           */
 /* EMail:        uz@cc65.org                                                 */
@@ -45,7 +45,8 @@
 
 
 extern const char*     OutputName;     /* Name of output file */
-
+                                                                           
+extern unsigned         ModuleId;       /* Id for o65 module */
 extern unsigned long   StartAddr;      /* Start address */
 
 extern unsigned char   VerboseMap;     /* Verbose map file */
index db35f8d0fbd980395335701d01c56d1d7aa6802e..b8aa72ed163fab98b8d53ba4fd6a4f2a8d252e18 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                          */
 /*                                                                          */
 /*                                                                          */
-/* (C) 1998-2001 Ullrich von Bassewitz                                      */
+/* (C) 1998-2002 Ullrich von Bassewitz                                      */
 /*              Wacholderweg 14                                             */
 /*              D-70597 Stuttgart                                           */
 /* EMail:       uz@musoftware.de                                            */
@@ -105,6 +105,7 @@ static void Usage (void)
                     "  --config name\tUse linker config file\n"
             "  --help\t\tHelp (this text)\n"
             "  --mapfile name\tCreate a map file\n"
+             "  --module-id id\tSpecify a module id\n"
                     "  --start-addr addr\tSet the default start address\n"
                     "  --target sys\t\tSet the target system\n"
                     "  --version\t\tPrint the linker version\n",
@@ -253,6 +254,18 @@ static void OptMapFile (const char* Opt attribute ((unused)), const char* Arg)
 
 
 
+static void OptModuleId (const char* Opt, const char* Arg)
+/* Specify a module id */
+{
+    unsigned long Id = CvtNumber (Opt, Arg);
+    if (Id > 0xFFFFUL) {
+        Error ("Range error in module id");
+    }
+    ModuleId = (unsigned) Id;
+}
+
+
+
 static void OptStartAddr (const char* Opt, const char* Arg)
 /* Set the default start address */
 {
@@ -299,9 +312,10 @@ int main (int argc, char* argv [])
     /* Program long options */
     static const LongOpt OptTab[] = {
                { "--config",           1,      OptConfig               },
-       { "--dbgfile",          1,      OptDbgFile              },
-       { "--help",             0,      OptHelp                 },
-       { "--mapfile",          1,      OptMapFile              },
+       { "--dbgfile",          1,      OptDbgFile              },
+       { "--help",             0,      OptHelp                 },
+       { "--mapfile",          1,      OptMapFile              },
+               { "--module-id",        1,      OptModuleId             },
        { "--start-addr",       1,      OptStartAddr            },
        { "--target",           1,      OptTarget               },
        { "--version",          0,      OptVersion              },