]> git.sur5r.net Git - cc65/commitdiff
Allow a CPU spec in the GLOBAL section of the info file
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 12 Aug 2003 11:01:46 +0000 (11:01 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 12 Aug 2003 11:01:46 +0000 (11:01 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@2269 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/da65/infofile.c
src/da65/scanner.h

index c9e0863aaad0de49c74ff1633cd20ec65a9245e5..eef73cde14aada777e107ace5acc520da2085e75 100644 (file)
@@ -44,6 +44,7 @@
 #endif
 
 /* common */
+#include "cpu.h"
 #include "xmalloc.h"
 
 /* da65 */
@@ -51,6 +52,7 @@
 #include "error.h"
 #include "global.h"
 #include "infofile.h"
+#include "opctable.h"
 #include "scanner.h"
 
 
@@ -65,6 +67,7 @@ static void GlobalSection (void)
 /* Parse a global section */
 {
     static const IdentTok GlobalDefs[] = {
+               {   "CPU",              INFOTOK_CPU             },
                {   "INPUTNAME",        INFOTOK_INPUTNAME       },
        {   "OUTPUTNAME",       INFOTOK_OUTPUTNAME      },
        {   "PAGELENGTH",       INFOTOK_PAGELENGTH      },
@@ -86,6 +89,17 @@ static void GlobalSection (void)
        /* Look at the token */
        switch (InfoTok) {
 
+            case INFOTOK_CPU:
+                InfoNextTok ();
+                InfoAssureStr ();
+                if (CPU != CPU_UNKNOWN) {
+                    InfoError ("CPU already specified");
+                }
+                CPU = FindCPU (InfoSVal);
+                SetOpcTable (CPU);
+                InfoNextTok ();
+                break;
+
            case INFOTOK_INPUTNAME:
                InfoNextTok ();
                InfoAssureStr ();
index 529b0aa13978ee0e006ca12b45c3e0e164ae8b59..d26f191e28109a2e01e22405659f9b5a11c85a9f 100644 (file)
@@ -65,6 +65,7 @@ typedef enum token_t {
     INFOTOK_LABEL,
 
     /* Global section */
+    INFOTOK_CPU,
     INFOTOK_INPUTNAME,
     INFOTOK_OUTPUTNAME,
     INFOTOK_PAGELENGTH,