Allow a CPU spec in the GLOBAL section of the info file

git-svn-id: svn://svn.cc65.org/cc65/trunk@2269 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-08-12 11:01:46 +00:00
parent f0dace7bd0
commit 98cdbaba4b
2 changed files with 15 additions and 0 deletions

View File

@@ -44,6 +44,7 @@
#endif #endif
/* common */ /* common */
#include "cpu.h"
#include "xmalloc.h" #include "xmalloc.h"
/* da65 */ /* da65 */
@@ -51,6 +52,7 @@
#include "error.h" #include "error.h"
#include "global.h" #include "global.h"
#include "infofile.h" #include "infofile.h"
#include "opctable.h"
#include "scanner.h" #include "scanner.h"
@@ -65,6 +67,7 @@ static void GlobalSection (void)
/* Parse a global section */ /* Parse a global section */
{ {
static const IdentTok GlobalDefs[] = { static const IdentTok GlobalDefs[] = {
{ "CPU", INFOTOK_CPU },
{ "INPUTNAME", INFOTOK_INPUTNAME }, { "INPUTNAME", INFOTOK_INPUTNAME },
{ "OUTPUTNAME", INFOTOK_OUTPUTNAME }, { "OUTPUTNAME", INFOTOK_OUTPUTNAME },
{ "PAGELENGTH", INFOTOK_PAGELENGTH }, { "PAGELENGTH", INFOTOK_PAGELENGTH },
@@ -86,6 +89,17 @@ static void GlobalSection (void)
/* Look at the token */ /* Look at the token */
switch (InfoTok) { 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: case INFOTOK_INPUTNAME:
InfoNextTok (); InfoNextTok ();
InfoAssureStr (); InfoAssureStr ();

View File

@@ -65,6 +65,7 @@ typedef enum token_t {
INFOTOK_LABEL, INFOTOK_LABEL,
/* Global section */ /* Global section */
INFOTOK_CPU,
INFOTOK_INPUTNAME, INFOTOK_INPUTNAME,
INFOTOK_OUTPUTNAME, INFOTOK_OUTPUTNAME,
INFOTOK_PAGELENGTH, INFOTOK_PAGELENGTH,