]> git.sur5r.net Git - cc65/commitdiff
New --memory-model option
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 24 Nov 2003 19:18:01 +0000 (19:18 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 24 Nov 2003 19:18:01 +0000 (19:18 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@2683 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cl65/main.c

index e0edab79dea51a88a7748861b51311511ede3580..14656b74590be3f95e58a611118eec3d213dd4e9 100644 (file)
@@ -58,6 +58,7 @@
 #include "cmdline.h"
 #include "filetype.h"
 #include "fname.h"
 #include "cmdline.h"
 #include "filetype.h"
 #include "fname.h"
+#include "mmodel.h"
 #include "strbuf.h"
 #include "target.h"
 #include "version.h"
 #include "strbuf.h"
 #include "target.h"
 #include "version.h"
@@ -596,6 +597,7 @@ static void Usage (void)
                     "  -h\t\t\tHelp (this text)\n"
                     "  -l\t\t\tCreate an assembler listing\n"
                     "  -m name\t\tCreate a map file\n"
                     "  -h\t\t\tHelp (this text)\n"
                     "  -l\t\t\tCreate an assembler listing\n"
                     "  -m name\t\tCreate a map file\n"
+             "  -mm model\t\tSet the memory model\n"
                     "  -o name\t\tName the output file\n"
              "  -r\t\t\tEnable register variables\n"
                     "  -t sys\t\tSet the target system\n"
                     "  -o name\t\tName the output file\n"
              "  -r\t\t\tEnable register variables\n"
                     "  -t sys\t\tSet the target system\n"
@@ -644,6 +646,7 @@ static void Usage (void)
              "  --lib-path path\tSpecify a library search path\n"
                     "  --listing\t\tCreate an assembler listing\n"
             "  --mapfile name\tCreate a map file\n"
              "  --lib-path path\tSpecify a library search path\n"
                     "  --listing\t\tCreate an assembler listing\n"
             "  --mapfile name\tCreate a map file\n"
+             "  --memory-model model\tSet the memory model\n"
              "  --module\t\tLink as a module\n"
              "  --module-id id\tSpecify a module id for the linker\n"
              "  --o65-model model\tOverride the o65 model\n"
              "  --module\t\tLink as a module\n"
              "  --module-id id\tSpecify a module id for the linker\n"
              "  --o65-model model\tOverride the o65 model\n"
@@ -895,6 +898,21 @@ static void OptMapFile (const char* Opt attribute ((unused)), const char* Arg)
 
 
 
 
 
 
+static void OptMemoryModel (const char* Opt attribute ((unused)), const char* Arg)
+/* Set the memory model */
+{
+    mmodel_t MemoryModel = FindMemoryModel (Arg);
+    if (MemoryModel == MMODEL_UNKNOWN) {
+        Error ("Unknown memory model: %s", Arg);
+    } else if (MemoryModel == MMODEL_HUGE) {
+        Error ("Unsupported memory model: %s", Arg);
+    } else {
+        CmdAddArg2 (&CA65, "-mm", Arg);
+    }
+}
+
+
+
 static void OptModule (const char* Opt attribute ((unused)),
                        const char* Arg attribute ((unused)))
 /* Link as a module */
 static void OptModule (const char* Opt attribute ((unused)),
                        const char* Arg attribute ((unused)))
 /* Link as a module */
@@ -1022,7 +1040,7 @@ static void OptVersion (const char* Opt attribute ((unused)),
             VER_MAJOR, VER_MINOR, VER_PATCH);
 }
 
             VER_MAJOR, VER_MINOR, VER_PATCH);
 }
 
-        
+
 
 static void OptZeropageLabel (const char* Opt attribute ((unused)), const char* Arg)
 /* Handle the --zeropage-label option */
 
 static void OptZeropageLabel (const char* Opt attribute ((unused)), const char* Arg)
 /* Handle the --zeropage-label option */
@@ -1071,6 +1089,7 @@ int main (int argc, char* argv [])
                { "--lib-path",         1,      OptLibPath              },
        { "--listing",          0,      OptListing              },
        { "--mapfile",          1,      OptMapFile              },
                { "--lib-path",         1,      OptLibPath              },
        { "--listing",          0,      OptListing              },
        { "--mapfile",          1,      OptMapFile              },
+        { "--memory-model",     1,      OptMemoryModel          },
         { "--module",           0,      OptModule               },
         { "--module-id",        1,      OptModuleId             },
         { "--o65-model",        1,      OptO65Model             },
         { "--module",           0,      OptModule               },
         { "--module-id",        1,      OptModuleId             },
         { "--o65-model",        1,      OptO65Model             },