This commit is contained in:
marketideas
2019-11-22 09:33:24 -08:00
parent 279de5caa5
commit 476a46d7db
4 changed files with 49 additions and 14 deletions

15
asm.cpp
View File

@@ -1239,6 +1239,11 @@ TSymbol * CLASS::findVariable(std::string symname, TVariable &vars)
{ {
TSymbol *res = NULL; TSymbol *res = NULL;
if (!casesen)
{
symname = Poco::toUpper(symname);
}
if ((expand_macrostack.size() > 0) && (vars.id != expand_macro.variables.id)) if ((expand_macrostack.size() > 0) && (vars.id != expand_macro.variables.id))
{ {
res = findVariable(symname, expand_macro.variables); res = findVariable(symname, expand_macro.variables);
@@ -1978,7 +1983,7 @@ restart:
off = mVec[0].offset; off = mVec[0].offset;
len = mVec[0].length; len = mVec[0].length;
s = oper.substr(off, len); s = oper.substr(off, len);
slen = s.length();
sym = NULL; sym = NULL;
if (expand_macrostack.size() > 0) if (expand_macrostack.size() > 0)
{ {
@@ -1995,6 +2000,7 @@ restart:
if (sym->var_text != "") if (sym->var_text != "")
{ {
oper = oper.replace(off, len, sym->var_text); oper = oper.replace(off, len, sym->var_text);
slen = oper.length();
ct++; ct++;
if (pass > 0) if (pass > 0)
{ {
@@ -2201,7 +2207,11 @@ void CLASS::process(void)
std::string outop; std::string outop;
line.printoperand = line.operand; line.printoperand = line.operand;
x = 0;
if (macrostack.size() == 0)
{
x = substituteVariables(line, outop); x = substituteVariables(line, outop);
}
if (x > 0) if (x > 0)
{ {
line.printoperand = outop; line.printoperand = outop;
@@ -2243,6 +2253,8 @@ void CLASS::process(void)
{ {
TMacro *mac = NULL; TMacro *mac = NULL;
bool inoperand = false; bool inoperand = false;
if (macrostack.size() == 0)
{
mac = findMacro(realop); mac = findMacro(realop);
if (mac == NULL) if (mac == NULL)
{ {
@@ -2259,6 +2271,7 @@ void CLASS::process(void)
inoperand = true; inoperand = true;
} }
} }
}
if (mac == NULL) if (mac == NULL)
{ {
x = callOpCode(op, line); x = callOpCode(op, line);

View File

@@ -846,6 +846,7 @@ void CLASS::insertOpcodes(void)
pushopcode("DUM", P_DUM, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO)); pushopcode("DUM", P_DUM, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
pushopcode("DEND", P_DEND, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO)); pushopcode("DEND", P_DEND, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
pushopcode("AST", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO)); pushopcode("AST", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
pushopcode("CAS", P_CAS, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
pushopcode("CYC", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO)); pushopcode("CYC", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
pushopcode("DAT", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO)); pushopcode("DAT", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
pushopcode("EXP", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO)); pushopcode("EXP", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));

View File

@@ -143,6 +143,7 @@ int CLASS::doMAC(T65816Asm &a, MerlinLine &line, TSymbol &opinfo)
{ {
if (a.expand_macrostack.size() > 0) if (a.expand_macrostack.size() > 0)
{ {
line.flags |= FLAG_NOLINEPRINT;
goto out; goto out;
} }
if (line.lable.length() == 0) if (line.lable.length() == 0)
@@ -157,6 +158,12 @@ int CLASS::doMAC(T65816Asm &a, MerlinLine &line, TSymbol &opinfo)
a.currentmacro.lcname = Poco::toLower(line.lable); a.currentmacro.lcname = Poco::toLower(line.lable);
a.currentmacro.start = line.lineno; a.currentmacro.start = line.lineno;
a.currentmacro.running = true; a.currentmacro.running = true;
if (!a.casesen)
{
a.currentmacro.name = Poco::toUpper(a.currentmacro.name);
}
if (a.pass == 0) if (a.pass == 0)
{ {
} }
@@ -899,6 +906,7 @@ int CLASS::doASC(T65816Asm &a, MerlinLine &line, TSymbol &opinfo)
int CLASS::ProcessOpcode(T65816Asm &a, MerlinLine &line, TSymbol &opinfo) int CLASS::ProcessOpcode(T65816Asm &a, MerlinLine &line, TSymbol &opinfo)
{ {
int res = 0; int res = 0;
std::string s;
switch (opinfo.opcode) switch (opinfo.opcode)
{ {
@@ -949,6 +957,18 @@ int CLASS::ProcessOpcode(T65816Asm &a, MerlinLine &line, TSymbol &opinfo)
case P_SAV: case P_SAV:
a.savepath = a.processFilename(line.operand, Poco::Path::current(), 0); a.savepath = a.processFilename(line.operand, Poco::Path::current(), 0);
break; break;
case P_CAS:
s = Poco::toUpper(line.operand);
if (s == "SE")
{
a.casesen = true;
}
if (s=="IN")
{
a.casesen=false;
}
res = 0;
break;
case P_MAC: case P_MAC:
res = doMAC(a, line, opinfo); res = doMAC(a, line, opinfo);
break; break;

View File

@@ -21,6 +21,7 @@ enum
P_ASC, P_ASC,
P_ERR, P_ERR,
P_MAC, P_MAC,
P_CAS,
P_MAX P_MAX
}; };