mirror of
https://github.com/Museum-of-Art-and-Digital-Entertainment/macross.git
synced 2024-06-01 07:41:43 +00:00
-P support to specify processor. (6502, 65c02, 65c02r, 65c02s)
This commit is contained in:
parent
e35305a646
commit
138058cda6
|
@ -221,6 +221,9 @@ printErrorMessage(errorType theError, va_list ap)
|
|||
"bad name definition: '%s'",
|
||||
"warning: perform statement has no side effects",
|
||||
"value %d is too large to fit in a bit",
|
||||
"fatal: no processor given on command line after '-P'",
|
||||
"fatal: unknown processor: %s",
|
||||
|
||||
};
|
||||
|
||||
static int errorCount = 0;
|
||||
|
|
|
@ -102,6 +102,7 @@ addressType targetOffset;
|
|||
bool terseErrorMessages;
|
||||
valueType *UndefinedValue;
|
||||
symbolUsageKindType unknownSymbolTag;
|
||||
int processor;
|
||||
|
||||
int (*lexDispatchTable[128])();
|
||||
|
||||
|
|
56
initialize.c
56
initialize.c
|
@ -36,6 +36,7 @@
|
|||
#include "semanticMisc.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define isAlphaNumeric(c) (alphaNumericCharacterTable[c])
|
||||
|
@ -45,7 +46,6 @@ extern int yydebug;
|
|||
static fileNameListType *bottomOfInputFileStack;
|
||||
static char *outputFileName;
|
||||
|
||||
static int machine = 0;
|
||||
|
||||
void
|
||||
chokePukeAndDie(void)
|
||||
|
@ -141,6 +141,7 @@ initializeStuff(int argc, char **argv)
|
|||
symbolTableDumpOn = 0;
|
||||
positionIndependentCodeMode = FALSE;
|
||||
hackFlag = 0;
|
||||
processor = P6502; /* 6502 */
|
||||
|
||||
args = argv + 1;
|
||||
for (i=1; i<argc; i++) {
|
||||
|
@ -222,6 +223,26 @@ initializeStuff(int argc, char **argv)
|
|||
positionIndependentCodeMode = TRUE;
|
||||
continue;
|
||||
|
||||
case 'P':
|
||||
/* -P 6502 65c02 w65c02 65c02 */
|
||||
|
||||
if (++i >= argc) {
|
||||
fatalError(NO_DASH_P_PROCESSOR_ERROR);
|
||||
} else {
|
||||
char *cpu = *args++;
|
||||
if (strcasecmp(cpu, "6502") == 0)
|
||||
processor = P6502;
|
||||
else if (strcasecmp(cpu, "65c02") == 0)
|
||||
processor = P65C02;
|
||||
else if (strcasecmp(cpu, "65c02r") == 0)
|
||||
processor = P65C02R;
|
||||
else if (strcasecmp(cpu, "65c02s") == 0)
|
||||
processor = P65C02S;
|
||||
else
|
||||
fatalError(DASH_P_UNKNOWN_PROCESSOR, cpu);
|
||||
}
|
||||
continue;
|
||||
|
||||
case 's':
|
||||
case 'S':
|
||||
case 'h':
|
||||
|
@ -259,11 +280,6 @@ initializeStuff(int argc, char **argv)
|
|||
printVersion();
|
||||
continue;
|
||||
|
||||
case 'x':
|
||||
/* -x6502 -x65c02 -x65c02s */
|
||||
machine++;
|
||||
continue;
|
||||
|
||||
case 'Y':
|
||||
yydebug = TRUE;
|
||||
continue;
|
||||
|
@ -342,6 +358,7 @@ initializeStuff(int argc, char **argv)
|
|||
installBuiltInFunctions();
|
||||
installPredefinedSymbols();
|
||||
installCommandLineDefineSymbols();
|
||||
installProcessorDefine();
|
||||
|
||||
if (listingOn) {
|
||||
if ((saveFileForPass2 = fdopen(mkstemp(pass2SourceFileName),
|
||||
|
@ -432,6 +449,33 @@ installCommandLineDefineSymbols(void)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
installStringDefine(char *name, char *value)
|
||||
{
|
||||
symbolTableEntryType *newSymbol;
|
||||
|
||||
newSymbol = lookupOrEnterSymbol(name, DEFINE_SYMBOL);
|
||||
newSymbol->context->value = makeStringValue(value);
|
||||
newSymbol->context->attributes |= DEFINED_VARIABLE_ATT;
|
||||
}
|
||||
|
||||
void
|
||||
installProcessorDefine()
|
||||
{
|
||||
static char *values[] = {
|
||||
"",
|
||||
"6502",
|
||||
"65c02",
|
||||
"",
|
||||
"65c02r",
|
||||
"",
|
||||
"65c02s",
|
||||
};
|
||||
|
||||
installStringDefine("__processor__", values[processor]);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
createHashTables(void)
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@ void initializeStuff(int argc, char **argv);
|
|||
void installBuiltInFunctions(void);
|
||||
void installPredefinedSymbols(void);
|
||||
void installCommandLineDefineSymbols(void);
|
||||
void installProcessorDefine();
|
||||
void createHashTables(void);
|
||||
void queueInputFile(char *name);
|
||||
void openFirstInputFile(void);
|
||||
|
|
|
@ -102,6 +102,7 @@ extern addressType targetOffset;
|
|||
extern bool terseErrorMessages;
|
||||
extern valueType *UndefinedValue;
|
||||
extern symbolUsageKindType unknownSymbolTag;
|
||||
extern int processor;
|
||||
|
||||
#define DEFAULT_OBJECT_FILE_NAME "m.out"
|
||||
|
||||
|
|
|
@ -1076,10 +1076,20 @@ typedef enum {
|
|||
BAD_COMMAND_LINE_DEFINE_ERROR,
|
||||
PERFORM_WITHOUT_SIDE_EFFECT_ERROR,
|
||||
BIT_VALUE_TOO_LARGE_ERROR,
|
||||
NO_DASH_P_PROCESSOR_ERROR,
|
||||
DASH_P_UNKNOWN_PROCESSOR,
|
||||
} errorType;
|
||||
|
||||
#define ERROR_LIMIT 300
|
||||
|
||||
/* 6502 processor type */
|
||||
enum {
|
||||
P6502 = 1,
|
||||
P65C02 = 2,
|
||||
P65C02R = 4,
|
||||
P65C02S = 6,
|
||||
};
|
||||
|
||||
/* Misc. macros: */
|
||||
|
||||
#define qfree(thing) if (freeFlag) free(thing);
|
||||
|
|
Loading…
Reference in New Issue
Block a user