From 0d7763cedb6cd6b036c9c15fa2ba6cda55341031 Mon Sep 17 00:00:00 2001 From: cuz Date: Thu, 24 Aug 2000 06:41:55 +0000 Subject: [PATCH] New long option: --start-addr git-svn-id: svn://svn.cc65.org/cc65/trunk@307 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cl65/main.c | 11 +++++++++++ src/ld65/main.c | 21 +++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/cl65/main.c b/src/cl65/main.c index bf7f89442..dc20e9ee5 100644 --- a/src/cl65/main.c +++ b/src/cl65/main.c @@ -562,6 +562,7 @@ static void Usage (void) " --help\t\tHelp (this text)\n" " --include-dir dir\tSet a compiler include directory path\n" " --mapfile name\tCreate a map file\n" + " --start-addr addr\tSet the default start address\n" " --target sys\t\tSet the target system\n" " --version\t\tPrint the version number\n" " --verbose\t\tVerbose mode\n", @@ -632,6 +633,15 @@ static void OptMapFile (const char* Opt, const char* Arg) +static void OptStartAddr (const char* Opt, const char* Arg) +/* Set the default start address */ +{ + CmdAddArg (&LD65, "-S"); + CmdAddArg (&LD65, Arg); +} + + + static void OptTarget (const char* Opt, const char* Arg) /* Set the target system */ { @@ -675,6 +685,7 @@ int main (int argc, char* argv []) { "--help", 0, OptHelp }, { "--include-dir", 1, OptIncludeDir }, { "--mapfile", 1, OptMapFile }, + { "--start-addr", 1, OptStartAddr }, { "--target", 1, OptTarget }, { "--verbose", 0, OptVerbose }, { "--version", 0, OptVersion }, diff --git a/src/ld65/main.c b/src/ld65/main.c index 0d1f171ef..3c4c5572b 100644 --- a/src/ld65/main.c +++ b/src/ld65/main.c @@ -102,6 +102,7 @@ static void Usage (void) "Long options:\n" " --help\t\tHelp (this text)\n" " --mapfile name\tCreate a map file\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", ProgName); @@ -127,8 +128,7 @@ static unsigned long CvtNumber (const char* Arg, const char* Number) /* Check if we do really have a number */ if (Converted != 1) { - fprintf (stderr, "Invalid number given in argument: %s\n", Arg); - exit (EXIT_FAILURE); + Error ("Invalid number given in argument: %s\n", Arg); } /* Return the result */ @@ -241,6 +241,14 @@ static void OptMapFile (const char* Opt, const char* Arg) +static void OptStartAddr (const char* Opt, const char* Arg) +/* Set the default start address */ +{ + StartAddr = CvtNumber (Opt, Arg); +} + + + static void OptTarget (const char* Opt, const char* Arg) /* Set the target system */ { @@ -280,6 +288,7 @@ int main (int argc, char* argv []) { "--config", 1, OptConfig }, { "--help", 0, OptHelp }, { "--mapfile", 1, OptMapFile }, + { "--start-addr", 1, OptStartAddr }, { "--target", 1, OptTarget }, { "--version", 0, OptVersion }, }; @@ -335,8 +344,8 @@ int main (int argc, char* argv []) case 'v': switch (Arg [2]) { - case 'm': VerboseMap = 1; break; - case '\0': ++Verbose; break; + case 'm': VerboseMap = 1; break; + case '\0': ++Verbose; break; default: UnknownOption (Arg); } break; @@ -348,13 +357,13 @@ int main (int argc, char* argv []) case 'L': switch (Arg [2]) { case 'n': LabelFileName = GetArg (&I, 3); break; - case 'p': WProtSegs = 1; break; + case 'p': WProtSegs = 1; break; default: UnknownOption (Arg); break; } break; case 'S': - StartAddr = CvtNumber (Arg, GetArg (&I, 2)); + OptStartAddr (Arg, GetArg (&I, 2)); break; case 'V': -- 2.39.5