mirror of
https://github.com/marketideas/qasm.git
synced 2025-01-13 20:32:14 +00:00
]var EQU does an eval first and updates the variable to the resulting hex value
This commit is contained in:
parent
2e6f8af54e
commit
7534c45def
43
asm.cpp
43
asm.cpp
@ -205,7 +205,14 @@ void CLASS::print(uint32_t lineno)
|
||||
{
|
||||
pcol += printf(" ");
|
||||
}
|
||||
pcol += printf("%s ", printoperand.c_str());
|
||||
if (isDebug() > 2)
|
||||
{
|
||||
pcol += printf("%s ", operand.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
pcol += printf("%s ", printoperand.c_str());
|
||||
}
|
||||
//pcol += printf("%-12s %-8s %-10s ", printlable.c_str(), opcode.c_str(), operand.c_str());
|
||||
}
|
||||
if ((errorcode > 0) && (!merlinerrors))
|
||||
@ -290,7 +297,7 @@ void CLASS::clear()
|
||||
opcode = "";
|
||||
opcodelower = "";
|
||||
operand = "";
|
||||
printoperand="";
|
||||
printoperand = "";
|
||||
comment = "";
|
||||
operand_expr = "";
|
||||
operand_expr2 = "";
|
||||
@ -1327,20 +1334,20 @@ int CLASS::callOpCode(std::string op, MerlinLine &line)
|
||||
case '>':
|
||||
line.expr_value >>= 8;
|
||||
line.expr_value &= 0xFFFF;
|
||||
if ((line.syntax&SYNTAX_MERLIN32)==SYNTAX_MERLIN32)
|
||||
if ((line.syntax & SYNTAX_MERLIN32) == SYNTAX_MERLIN32)
|
||||
{
|
||||
line.flags |= FLAG_FORCEABS;
|
||||
}
|
||||
break;
|
||||
case '^':
|
||||
line.expr_value = (line.expr_value >> 16) & 0xFFFF;
|
||||
if ((line.syntax&SYNTAX_MERLIN32)==SYNTAX_MERLIN32)
|
||||
if ((line.syntax & SYNTAX_MERLIN32) == SYNTAX_MERLIN32)
|
||||
{
|
||||
line.flags |= FLAG_FORCEABS;
|
||||
}
|
||||
break;
|
||||
case '|':
|
||||
if ((line.syntax&SYNTAX_MERLIN32)!=SYNTAX_MERLIN32)
|
||||
if ((line.syntax & SYNTAX_MERLIN32) != SYNTAX_MERLIN32)
|
||||
{
|
||||
line.flags |= FLAG_FORCELONG;
|
||||
}
|
||||
@ -1820,8 +1827,8 @@ int CLASS::substituteVariables(MerlinLine & line, std::string &outop)
|
||||
uint32_t len, off, ct;
|
||||
|
||||
bool done = false;
|
||||
operin=oper;
|
||||
ct=0;
|
||||
operin = oper;
|
||||
ct = 0;
|
||||
restart:
|
||||
while (!done)
|
||||
{
|
||||
@ -1873,28 +1880,28 @@ restart:
|
||||
}
|
||||
else
|
||||
{
|
||||
done=true;
|
||||
done = true;
|
||||
}
|
||||
offset += len;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = slen;
|
||||
done=true;
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
done=true;
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
//printf("inoper=|%s| outoper=|%s|\n",operin.c_str(),oper.c_str());
|
||||
if (ct>0)
|
||||
if (ct > 0)
|
||||
{
|
||||
outop=oper;
|
||||
res=ct;
|
||||
outop = oper;
|
||||
res = ct;
|
||||
}
|
||||
return (res);
|
||||
}
|
||||
@ -1996,14 +2003,14 @@ void CLASS::process(void)
|
||||
}
|
||||
}
|
||||
std::string outop;
|
||||
if (pass==0)
|
||||
if (pass == 0)
|
||||
{
|
||||
line.printoperand=line.operand;
|
||||
line.printoperand = line.operand;
|
||||
}
|
||||
x = substituteVariables(line,outop);
|
||||
if (x>0)
|
||||
x = substituteVariables(line, outop);
|
||||
if (x > 0)
|
||||
{
|
||||
line.operand=outop;
|
||||
line.operand = outop;
|
||||
}
|
||||
x = parseOperand(line);
|
||||
if (x >= 0)
|
||||
|
2
asm.h
2
asm.h
@ -78,6 +78,7 @@ enum asmErrors
|
||||
errBadLUPOperand,
|
||||
errBadLabel,
|
||||
errBadOperand,
|
||||
errErrOpcode,
|
||||
errMAX
|
||||
};
|
||||
|
||||
@ -112,6 +113,7 @@ const std::string errStrings[errMAX + 1] =
|
||||
"LUP value must be 0 < VAL <= $8000",
|
||||
"Unknown label",
|
||||
"Bad operand",
|
||||
"Break",
|
||||
|
||||
""
|
||||
};
|
||||
|
15
opcodes.cpp
15
opcodes.cpp
@ -94,7 +94,18 @@ int CLASS::doEQU(MerlinLine &line, TSymbol &sym)
|
||||
else if (isvar)
|
||||
{
|
||||
res = -1;
|
||||
s = addVariable(line.lable, line.operand, true);
|
||||
|
||||
if (syntax==SYNTAX_MERLIN)
|
||||
{
|
||||
char buff[32];
|
||||
sprintf(buff,"$%08X",line.expr_value);
|
||||
std::string s1=buff;
|
||||
s = addVariable(line.lable, s1, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
s = addVariable(line.lable, line.operand, true);
|
||||
}
|
||||
if (s != NULL)
|
||||
{
|
||||
res = 0;
|
||||
@ -849,7 +860,7 @@ void CLASS::insertOpcodes(void)
|
||||
pushopcode("IF", P_DO, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
|
||||
pushopcode("FIN", P_DO, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
|
||||
pushopcode("CHK", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
|
||||
pushopcode("ERR", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
|
||||
pushopcode("ERR", P_ERR, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
|
||||
pushopcode("KBD", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
|
||||
pushopcode("LUP", P_LUP, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
|
||||
pushopcode("--^", P_LUP, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO));
|
||||
|
11
psuedo.cpp
11
psuedo.cpp
@ -844,6 +844,17 @@ int CLASS::ProcessOpcode(T65816Asm &a, MerlinLine &line, TSymbol &opinfo)
|
||||
case P_SAV:
|
||||
a.savepath = a.processFilename(line.operand, Poco::Path::current(), 0);
|
||||
break;
|
||||
case P_ERR:
|
||||
if (a.pass>0)
|
||||
{
|
||||
if ((line.expr_value!=0) || (line.eval_result<0))
|
||||
{
|
||||
line.setError(errErrOpcode);
|
||||
//a.passcomplete=true; // terminate assembly
|
||||
}
|
||||
}
|
||||
res=0;
|
||||
break;
|
||||
case P_LST:
|
||||
res = doLST(a, line, opinfo);
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user