From: cuz Date: Sun, 23 Nov 2003 21:38:23 +0000 (+0000) Subject: New option --memory-model X-Git-Tag: V2.12.0~1122 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2863d55ebdaaefc2d8f7162d9f9129d432223a77;p=cc65 New option --memory-model git-svn-id: svn://svn.cc65.org/cc65/trunk@2678 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/ca65/main.c b/src/ca65/main.c index 6223bfe92..977057c58 100644 --- a/src/ca65/main.c +++ b/src/ca65/main.c @@ -94,6 +94,7 @@ static void Usage (void) " -h\t\t\tHelp (this text)\n" " -i\t\t\tIgnore case of symbols\n" " -l\t\t\tCreate a listing if assembly was ok\n" + " -mm model\t\tSet the memory model\n" " -o name\t\tName the output file\n" " -s\t\t\tEnable smart mode\n" " -t sys\t\tSet the target system\n" @@ -108,6 +109,7 @@ static void Usage (void) " --ignore-case\t\tIgnore case of symbols\n" " --include-dir dir\tSet an include directory search path\n" " --listing\t\tCreate a listing if assembly was ok\n" + " --memory-model model\tSet the memory model\n" " --pagelength n\tSet the page length for the listing\n" " --smart\t\tEnable smart mode\n" " --target sys\t\tSet the target system\n" @@ -272,6 +274,20 @@ static void OptListing (const char* Opt attribute ((unused)), +static void OptMemoryModel (const char* Opt attribute ((unused)), const char* Arg) +/* Set the memory model */ +{ + if (strcmp (Arg, "near") == 0) { + DefAddrSize = ADDR_SIZE_ABS; + } else if (strcmp (Arg, "far") == 0) { + DefAddrSize = ADDR_SIZE_FAR; + } else { + AbEnd ("Unknown memory model: %s", Arg); + } +} + + + static void OptPageLength (const char* Opt attribute ((unused)), const char* Arg) /* Handle the --pagelength option */ { @@ -509,6 +525,7 @@ int main (int argc, char* argv []) { "--ignore-case", 0, OptIgnoreCase }, { "--include-dir", 1, OptIncludeDir }, { "--listing", 0, OptListing }, + { "--memory-model", 1, OptMemoryModel }, { "--pagelength", 1, OptPageLength }, { "--smart", 0, OptSmart }, { "--target", 1, OptTarget }, @@ -534,28 +551,36 @@ int main (int argc, char* argv []) const char* Arg = ArgVec [I]; /* Check for an option */ - if (Arg [0] == '-') { - switch (Arg [1]) { + if (Arg[0] == '-') { + switch (Arg[1]) { - case '-': - LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); - break; + case '-': + LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); + break; - case 'g': - OptDebugInfo (Arg, 0); - break; + case 'g': + OptDebugInfo (Arg, 0); + break; - case 'h': - OptHelp (Arg, 0); - break; + case 'h': + OptHelp (Arg, 0); + break; case 'i': - OptIgnoreCase (Arg, 0); - break; + OptIgnoreCase (Arg, 0); + break; - case 'l': - OptListing (Arg, 0); - break; + case 'l': + OptListing (Arg, 0); + break; + + case 'm': + if (Arg[2] == 'm') { + OptMemoryModel (Arg, GetArg (&I, 3)); + } else { + UnknownOption (Arg); + } + break; case 'o': OutFile = GetArg (&I, 2);