This commit is contained in:
marketideas 2019-11-16 11:14:51 -08:00
parent 022eaa0438
commit a6d239f87a
5 changed files with 55 additions and 13 deletions

View File

@ -208,7 +208,7 @@ void CLASS::print(uint32_t lineno)
}
uint32_t ct = 1;
if (obc > b)
if ((obc > b) && ((truncdata&0x01)==0))
{
ct = 0;
uint8_t db;
@ -1293,7 +1293,7 @@ void CLASS::initpass(void)
passcomplete = false;
dumstartaddr = 0;
dumstart = 0;
truncdata=0;
variables.clear(); // clear the variables for each pass
while (!PCstack.empty())
@ -1308,6 +1308,10 @@ void CLASS::initpass(void)
{
DOstack.pop();
}
while (!LSTstack.empty())
{
LSTstack.pop();
}
curLUP.clear();
curDO.clear();
savepath = "";
@ -1622,6 +1626,7 @@ void CLASS::process(void)
line.eval_result = 0;
line.lineno = lineno + 1;
line.truncdata=truncdata;
//printf("lineno: %d %d |%s|\n",lineno,l,line.operand.c_str());
op = Poco::toLower(line.opcode);

5
asm.h
View File

@ -189,6 +189,7 @@ public:
uint8_t linemx;
uint16_t commentcol;
bool showmx;
uint8_t truncdata;
uint32_t lineno;
uint32_t flags;
uint16_t opflags;
@ -330,7 +331,6 @@ class T65816Asm : public TFileProcessor
public:
// options
bool casesen;
bool listing;
bool showmx;
bool trackrep;
bool merlincompat;
@ -356,10 +356,13 @@ public:
TOriginSection PC;
TLUPstruct curLUP;
TDOstruct curDO;
bool listing;
uint8_t truncdata; // for the TR opcode
std::stack<TOriginSection> PCstack;
std::stack<TLUPstruct> LUPstack;
std::stack<TDOstruct> DOstack;
std::stack<bool> LSTstack;
TPsuedoOp *psuedoops;

View File

@ -738,7 +738,7 @@ void CLASS::insertOpcodes(void)
pushopcode("PAG", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
pushopcode("TTL", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
pushopcode("SKP", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
pushopcode("TR", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
pushopcode("TR", P_TR, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
pushopcode("ASC", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
pushopcode("DCI", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
pushopcode("INV", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));

View File

@ -27,8 +27,8 @@ int CLASS::doDO(T65816Asm &a, MerlinLine &line, TSymbol &opinfo)
int err = 0;
std::string op = Poco::toUpper(line.opcode);
std::string oper = Poco::toUpper(line.operand_expr);
result32=0xFFFFFFFF;
std::string oper = line.operand_expr;
result32 = 0xFFFFFFFF;
if (op == "IF")
{
@ -46,7 +46,7 @@ int CLASS::doDO(T65816Asm &a, MerlinLine &line, TSymbol &opinfo)
if (oper == "")
{
err = errIllegalCharOperand;
a.curDO.doskip=false;
a.curDO.doskip = false;
goto out;
}
@ -66,7 +66,7 @@ int CLASS::doDO(T65816Asm &a, MerlinLine &line, TSymbol &opinfo)
}
result32 = eval_result & 0xFFFFFFFF;
a.curDO.doskip = (result32!=0) ? false : true;
a.curDO.doskip = (result32 != 0) ? false : true;
goto out;
}
@ -98,7 +98,7 @@ int CLASS::doDO(T65816Asm &a, MerlinLine &line, TSymbol &opinfo)
{
// kind of a silent error here, just make sure we reinitialize
err = errUnexpectedOp;
a.curDO.doskip=false;
a.curDO.doskip = false;
}
goto out;
}
@ -375,7 +375,15 @@ int CLASS::doLST(T65816Asm &a, MerlinLine &line, TSymbol &opinfo)
if (a.pass > 0)
{
s = Poco::toUpper(Poco::trim(line.operand_expr));
if ((s == "") || (s == "ON") || (line.expr_value > 0))
if (s == "RTN")
{
if (a.LSTstack.size())
{
a.listing = a.LSTstack.top();
a.LSTstack.pop();
}
}
else if ((s == "ON") || (line.expr_value > 0))
{
//printf("ON\n");
a.skiplist = true;
@ -391,6 +399,29 @@ int CLASS::doLST(T65816Asm &a, MerlinLine &line, TSymbol &opinfo)
return (0);
}
int CLASS::doTR(T65816Asm &a, MerlinLine &line, TSymbol &opinfo)
{
UNUSED(opinfo);
std::string s;
if (a.pass > 0)
{
s = Poco::toUpper(Poco::trim(line.operand_expr));
if (s == "ADR")
{
a.truncdata |= 0x03;
}
else if ((s == "ON") || (line.expr_value > 0))
{
a.truncdata |= 0x01;;
}
else if ((s == "OFF") || (line.expr_value == 0))
{
a.truncdata = 0x00;
}
}
return (0);
}
int CLASS::doHEX(T65816Asm &a, MerlinLine &line, TSymbol &opinfo)
{
UNUSED(opinfo);
@ -523,6 +554,9 @@ int CLASS::ProcessOpcode(T65816Asm &a, MerlinLine &line, TSymbol &opinfo)
case P_DO:
res = doDO(a, line, opinfo);
break;
case P_TR:
res=doTR(a,line,opinfo);
break;
}
return (res);

View File

@ -17,6 +17,7 @@ enum
P_DATA,
P_LUP,
P_DO,
P_TR,
P_MAX
};
@ -33,9 +34,8 @@ public:
int doHEX(T65816Asm &a, MerlinLine &line, TSymbol &opinfo);
int doDATA(T65816Asm &a, MerlinLine &line, TSymbol &opinfo);
int doLUP(T65816Asm &a, MerlinLine &line, TSymbol &opinfo);
int doDO(T65816Asm &a, MerlinLine &line, TSymbol &opinfo);;
int doDO(T65816Asm &a, MerlinLine &line, TSymbol &opinfo);
int doTR(T65816Asm &a, MerlinLine &line, TSymbol &opinfo);
};
#undef CLASS