diff --git a/src/ld65/config.c b/src/ld65/config.c index 657813ce1..6e310a8d5 100644 --- a/src/ld65/config.c +++ b/src/ld65/config.c @@ -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); } diff --git a/src/ld65/global.c b/src/ld65/global.c index fea95b899..a12167306 100644 --- a/src/ld65/global.c +++ b/src/ld65/global.c @@ -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 */ diff --git a/src/ld65/global.h b/src/ld65/global.h index 8244ef742..d68b69029 100644 --- a/src/ld65/global.h +++ b/src/ld65/global.h @@ -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 */ diff --git a/src/ld65/main.c b/src/ld65/main.c index db35f8d0f..b8aa72ed1 100644 --- a/src/ld65/main.c +++ b/src/ld65/main.c @@ -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 },