Improvements to the debugger prompt

- commands are now properly range checked (byte, short, etc)
  - better error messages
  - internally, use 16-bit/8-bit instead of 32-bit when necessary
This commit is contained in:
Stephen Anthony 2017-04-15 19:00:50 -02:30
parent d456721c5e
commit 3aeae9b6f6
10 changed files with 142 additions and 160 deletions

View File

@ -345,58 +345,55 @@ int Debugger::trace()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::toggleBreakPoint(int bp) void Debugger::toggleBreakPoint(uInt16 bp)
{ {
breakPoints().initialize(); breakPoints().initialize();
if(bp < 0) bp = myCpuDebug->pc();
breakPoints().toggle(bp); breakPoints().toggle(bp);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::setBreakPoint(int bp, bool set) void Debugger::setBreakPoint(uInt16 bp, bool set)
{ {
breakPoints().initialize(); breakPoints().initialize();
if(bp < 0) bp = myCpuDebug->pc();
if(set) breakPoints().set(bp); if(set) breakPoints().set(bp);
else breakPoints().clear(bp); else breakPoints().clear(bp);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::breakPoint(int bp) bool Debugger::breakPoint(uInt16 bp)
{ {
if(bp < 0) bp = myCpuDebug->pc();
return breakPoints().isSet(bp); return breakPoints().isSet(bp);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::toggleReadTrap(int t) void Debugger::toggleReadTrap(uInt16 t)
{ {
readTraps().initialize(); readTraps().initialize();
readTraps().toggle(t); readTraps().toggle(t);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::toggleWriteTrap(int t) void Debugger::toggleWriteTrap(uInt16 t)
{ {
writeTraps().initialize(); writeTraps().initialize();
writeTraps().toggle(t); writeTraps().toggle(t);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::toggleTrap(int t) void Debugger::toggleTrap(uInt16 t)
{ {
toggleReadTrap(t); toggleReadTrap(t);
toggleWriteTrap(t); toggleWriteTrap(t);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::readTrap(int t) bool Debugger::readTrap(uInt16 t)
{ {
return readTraps().isInitialized() && readTraps().isSet(t); return readTraps().isInitialized() && readTraps().isSet(t);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::writeTrap(int t) bool Debugger::writeTrap(uInt16 t)
{ {
return writeTraps().isInitialized() && writeTraps().isSet(t); return writeTraps().isInitialized() && writeTraps().isSet(t);
} }
@ -463,7 +460,7 @@ string Debugger::showWatches()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::patchROM(int addr, int value) bool Debugger::patchROM(uInt16 addr, uInt8 value)
{ {
return myConsole.cartridge().patch(addr, value); return myConsole.cartridge().patch(addr, value);
} }

View File

@ -219,9 +219,9 @@ class Debugger : public DialogContainer
void setAccessFlags(uInt16 addr, uInt8 flags) void setAccessFlags(uInt16 addr, uInt8 flags)
{ mySystem.setAccessFlags(addr, flags); } { mySystem.setAccessFlags(addr, flags); }
void setBreakPoint(int bp, bool set); void setBreakPoint(uInt16 bp, bool set);
bool patchROM(int addr, int value); bool patchROM(uInt16 addr, uInt8 value);
/** /**
Normally, accessing RAM or ROM during emulation can possibly trigger Normally, accessing RAM or ROM during emulation can possibly trigger
@ -256,14 +256,14 @@ class Debugger : public DialogContainer
void nextFrame(int frames); void nextFrame(int frames);
bool rewindState(); bool rewindState();
void toggleBreakPoint(int bp); void toggleBreakPoint(uInt16 bp);
bool breakPoint(int bp); bool breakPoint(uInt16 bp);
void toggleReadTrap(int t); void toggleReadTrap(uInt16 t);
void toggleWriteTrap(int t); void toggleWriteTrap(uInt16 t);
void toggleTrap(int t); void toggleTrap(uInt16 t);
bool readTrap(int t); bool readTrap(uInt16 t);
bool writeTrap(int t); bool writeTrap(uInt16 t);
void clearAllTraps(); void clearAllTraps();
// Set a bunch of RAM locations at once // Set a bunch of RAM locations at once

View File

@ -37,7 +37,7 @@ class BinAndExpression : public Expression
{ {
public: public:
BinAndExpression(Expression* left, Expression* right) : Expression(left, right) { } BinAndExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myLHS->evaluate() & myRHS->evaluate(); } { return myLHS->evaluate() & myRHS->evaluate(); }
}; };
@ -46,7 +46,7 @@ class BinNotExpression : public Expression
{ {
public: public:
BinNotExpression(Expression* left) : Expression(left) { } BinNotExpression(Expression* left) : Expression(left) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return ~(myLHS->evaluate()); } { return ~(myLHS->evaluate()); }
}; };
@ -55,7 +55,7 @@ class BinOrExpression : public Expression
{ {
public: public:
BinOrExpression(Expression* left, Expression* right) : Expression(left, right) { } BinOrExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myLHS->evaluate() | myRHS->evaluate(); } { return myLHS->evaluate() | myRHS->evaluate(); }
}; };
@ -64,7 +64,7 @@ class BinXorExpression : public Expression
{ {
public: public:
BinXorExpression(Expression* left, Expression* right) : Expression(left, right) { } BinXorExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myLHS->evaluate() ^ myRHS->evaluate(); } { return myLHS->evaluate() ^ myRHS->evaluate(); }
}; };
@ -73,7 +73,7 @@ class ByteDerefExpression : public Expression
{ {
public: public:
ByteDerefExpression(Expression* left): Expression(left) { } ByteDerefExpression(Expression* left): Expression(left) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return Debugger::debugger().peek(myLHS->evaluate()); } { return Debugger::debugger().peek(myLHS->evaluate()); }
}; };
@ -82,7 +82,7 @@ class ByteDerefOffsetExpression : public Expression
{ {
public: public:
ByteDerefOffsetExpression(Expression* left, Expression* right) : Expression(left, right) { } ByteDerefOffsetExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return Debugger::debugger().peek(myLHS->evaluate() + myRHS->evaluate()); } { return Debugger::debugger().peek(myLHS->evaluate() + myRHS->evaluate()); }
}; };
@ -91,7 +91,7 @@ class ConstExpression : public Expression
{ {
public: public:
ConstExpression(const int value) : Expression(), myValue(value) { } ConstExpression(const int value) : Expression(), myValue(value) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myValue; } { return myValue; }
private: private:
@ -103,7 +103,7 @@ class CpuMethodExpression : public Expression
{ {
public: public:
CpuMethodExpression(CpuMethod method) : Expression(), myMethod(std::mem_fn(method)) { } CpuMethodExpression(CpuMethod method) : Expression(), myMethod(std::mem_fn(method)) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myMethod(Debugger::debugger().cpuDebug()); } { return myMethod(Debugger::debugger().cpuDebug()); }
private: private:
@ -115,7 +115,7 @@ class DivExpression : public Expression
{ {
public: public:
DivExpression(Expression* left, Expression* right) : Expression(left, right) { } DivExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ int denom = myRHS->evaluate(); { int denom = myRHS->evaluate();
return denom == 0 ? 0 : myLHS->evaluate() / denom; } return denom == 0 ? 0 : myLHS->evaluate() / denom; }
}; };
@ -125,7 +125,7 @@ class EqualsExpression : public Expression
{ {
public: public:
EqualsExpression(Expression* left, Expression* right) : Expression(left, right) { } EqualsExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myLHS->evaluate() == myRHS->evaluate(); } { return myLHS->evaluate() == myRHS->evaluate(); }
}; };
@ -134,7 +134,7 @@ class EquateExpression : public Expression
{ {
public: public:
EquateExpression(const string& label) : Expression(), myLabel(label) { } EquateExpression(const string& label) : Expression(), myLabel(label) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return Debugger::debugger().cartDebug().getAddress(myLabel); } { return Debugger::debugger().cartDebug().getAddress(myLabel); }
private: private:
@ -146,7 +146,7 @@ class FunctionExpression : public Expression
{ {
public: public:
FunctionExpression(const string& label) : Expression(), myLabel(label) { } FunctionExpression(const string& label) : Expression(), myLabel(label) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return Debugger::debugger().getFunction(myLabel).evaluate(); } { return Debugger::debugger().getFunction(myLabel).evaluate(); }
private: private:
@ -158,7 +158,7 @@ class GreaterEqualsExpression : public Expression
{ {
public: public:
GreaterEqualsExpression(Expression* left, Expression* right) : Expression(left, right) { } GreaterEqualsExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myLHS->evaluate() >= myRHS->evaluate(); } { return myLHS->evaluate() >= myRHS->evaluate(); }
}; };
@ -167,7 +167,7 @@ class GreaterExpression : public Expression
{ {
public: public:
GreaterExpression(Expression* left, Expression* right) : Expression(left, right) { } GreaterExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myLHS->evaluate() > myRHS->evaluate(); } { return myLHS->evaluate() > myRHS->evaluate(); }
}; };
@ -176,7 +176,7 @@ class HiByteExpression : public Expression
{ {
public: public:
HiByteExpression(Expression* left) : Expression(left) { } HiByteExpression(Expression* left) : Expression(left) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return 0xff & (myLHS->evaluate() >> 8); } { return 0xff & (myLHS->evaluate() >> 8); }
}; };
@ -185,7 +185,7 @@ class LessEqualsExpression : public Expression
{ {
public: public:
LessEqualsExpression(Expression* left, Expression* right) : Expression(left, right) { } LessEqualsExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myLHS->evaluate() <= myRHS->evaluate(); } { return myLHS->evaluate() <= myRHS->evaluate(); }
}; };
@ -194,7 +194,7 @@ class LessExpression : public Expression
{ {
public: public:
LessExpression(Expression* left, Expression* right) : Expression(left, right) { } LessExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myLHS->evaluate() < myRHS->evaluate(); } { return myLHS->evaluate() < myRHS->evaluate(); }
}; };
@ -203,7 +203,7 @@ class LoByteExpression : public Expression
{ {
public: public:
LoByteExpression(Expression* left) : Expression(left) { } LoByteExpression(Expression* left) : Expression(left) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return 0xff & myLHS->evaluate(); } { return 0xff & myLHS->evaluate(); }
}; };
@ -212,7 +212,7 @@ class LogAndExpression : public Expression
{ {
public: public:
LogAndExpression(Expression* left, Expression* right) : Expression(left, right) { } LogAndExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myLHS->evaluate() && myRHS->evaluate(); } { return myLHS->evaluate() && myRHS->evaluate(); }
}; };
@ -221,7 +221,7 @@ class LogNotExpression : public Expression
{ {
public: public:
LogNotExpression(Expression* left) : Expression(left) { } LogNotExpression(Expression* left) : Expression(left) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return !(myLHS->evaluate()); } { return !(myLHS->evaluate()); }
}; };
@ -230,7 +230,7 @@ class LogOrExpression : public Expression
{ {
public: public:
LogOrExpression(Expression* left, Expression* right) : Expression(left, right) { } LogOrExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myLHS->evaluate() || myRHS->evaluate(); } { return myLHS->evaluate() || myRHS->evaluate(); }
}; };
@ -239,7 +239,7 @@ class MinusExpression : public Expression
{ {
public: public:
MinusExpression(Expression* left, Expression* right) : Expression(left, right) { } MinusExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myLHS->evaluate() - myRHS->evaluate(); } { return myLHS->evaluate() - myRHS->evaluate(); }
}; };
@ -248,7 +248,7 @@ class ModExpression : public Expression
{ {
public: public:
ModExpression(Expression* left, Expression* right) : Expression(left, right) { } ModExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ int rhs = myRHS->evaluate(); { int rhs = myRHS->evaluate();
return rhs == 0 ? 0 : myLHS->evaluate() % rhs; } return rhs == 0 ? 0 : myLHS->evaluate() % rhs; }
}; };
@ -258,7 +258,7 @@ class MultExpression : public Expression
{ {
public: public:
MultExpression(Expression* left, Expression* right) : Expression(left, right) { } MultExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myLHS->evaluate() * myRHS->evaluate(); } { return myLHS->evaluate() * myRHS->evaluate(); }
}; };
@ -267,7 +267,7 @@ class NotEqualsExpression : public Expression
{ {
public: public:
NotEqualsExpression(Expression* left, Expression* right) : Expression(left, right) { } NotEqualsExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myLHS->evaluate() != myRHS->evaluate(); } { return myLHS->evaluate() != myRHS->evaluate(); }
}; };
@ -276,7 +276,7 @@ class PlusExpression : public Expression
{ {
public: public:
PlusExpression(Expression* left, Expression* right) : Expression(left, right) { } PlusExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myLHS->evaluate() + myRHS->evaluate(); } { return myLHS->evaluate() + myRHS->evaluate(); }
}; };
@ -285,7 +285,7 @@ class CartMethodExpression : public Expression
{ {
public: public:
CartMethodExpression(CartMethod method) : Expression(), myMethod(std::mem_fn(method)) { } CartMethodExpression(CartMethod method) : Expression(), myMethod(std::mem_fn(method)) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myMethod(Debugger::debugger().cartDebug()); } { return myMethod(Debugger::debugger().cartDebug()); }
private: private:
@ -297,7 +297,7 @@ class ShiftLeftExpression : public Expression
{ {
public: public:
ShiftLeftExpression(Expression* left, Expression* right) : Expression(left, right) { } ShiftLeftExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myLHS->evaluate() << myRHS->evaluate(); } { return myLHS->evaluate() << myRHS->evaluate(); }
}; };
@ -306,7 +306,7 @@ class ShiftRightExpression : public Expression
{ {
public: public:
ShiftRightExpression(Expression* left, Expression* right) : Expression(left, right) { } ShiftRightExpression(Expression* left, Expression* right) : Expression(left, right) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myLHS->evaluate() >> myRHS->evaluate(); } { return myLHS->evaluate() >> myRHS->evaluate(); }
}; };
@ -315,7 +315,7 @@ class TiaMethodExpression : public Expression
{ {
public: public:
TiaMethodExpression(TiaMethod method) : Expression(), myMethod(std::mem_fn(method)) { } TiaMethodExpression(TiaMethod method) : Expression(), myMethod(std::mem_fn(method)) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return myMethod(Debugger::debugger().tiaDebug()); } { return myMethod(Debugger::debugger().tiaDebug()); }
private: private:
@ -327,7 +327,7 @@ class UnaryMinusExpression : public Expression
{ {
public: public:
UnaryMinusExpression(Expression* left) : Expression(left) { } UnaryMinusExpression(Expression* left) : Expression(left) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return -(myLHS->evaluate()); } { return -(myLHS->evaluate()); }
}; };
@ -336,7 +336,7 @@ class WordDerefExpression : public Expression
{ {
public: public:
WordDerefExpression(Expression* left) : Expression(left) { } WordDerefExpression(Expression* left) : Expression(left) { }
uInt16 evaluate() const override uInt32 evaluate() const override
{ return Debugger::debugger().dpeek(myLHS->evaluate()); } { return Debugger::debugger().dpeek(myLHS->evaluate()); }
}; };

View File

@ -66,7 +66,7 @@ DebuggerParser::DebuggerParser(Debugger& d, Settings& s)
// main entry point: PromptWidget calls this method. // main entry point: PromptWidget calls this method.
string DebuggerParser::run(const string& command) string DebuggerParser::run(const string& command)
{ {
/* #if 0
// this was our parser test code. Left for reference. // this was our parser test code. Left for reference.
static Expression *lastExpression; static Expression *lastExpression;
@ -99,14 +99,10 @@ string DebuggerParser::run(const string& command)
commandResult = "no valid expr"; commandResult = "no valid expr";
return commandResult; return commandResult;
} }
*/ #endif
string verb; string verb;
getArgs(command, verb); getArgs(command, verb);
#ifdef EXPR_REF_COUNT
extern int refCount;
cerr << "Expression count: " << refCount << endl;
#endif
commandResult.str(""); commandResult.str("");
for(int i = 0; i < kNumCommands; ++i) for(int i = 0; i < kNumCommands; ++i)
@ -373,24 +369,9 @@ bool DebuggerParser::getArgs(const string& command, string& verb)
if(curArg != "") if(curArg != "")
argStrings.push_back(curArg); argStrings.push_back(curArg);
argCount = int(argStrings.size()); argCount = uInt32(argStrings.size());
/*
cerr << "verb = " << verb << endl;
cerr << "arguments (" << argCount << "):\n";
for(int x = 0; x < argCount; x++)
cerr << "command " << x << ": " << argStrings[x] << endl;
*/
/* for(uInt32 arg = 0; arg < argCount; ++arg)
// Now decipher each argument, in turn.
for(int i=0; i<argCount; i++) {
int temp = decipher_arg(argStrings[i]);
args.push_back(temp); // value maybe -1, if not expression argument
// (validate_args will decide whether that's OK, not us.)
}
*/
for(int arg = 0; arg < argCount; ++arg)
{ {
if(!YaccParser::parse(argStrings[arg].c_str())) if(!YaccParser::parse(argStrings[arg].c_str()))
{ {
@ -423,7 +404,7 @@ bool DebuggerParser::validateArgs(int cmd)
} }
// Figure out how many arguments are required by the command // Figure out how many arguments are required by the command
int count = 0, argRequiredCount = 0; uInt32 count = 0, argRequiredCount = 0;
while(*p != kARG_END_ARGS && *p != kARG_MULTI_BYTE) while(*p != kARG_END_ARGS && *p != kARG_MULTI_BYTE)
{ {
count++; count++;
@ -435,19 +416,19 @@ bool DebuggerParser::validateArgs(int cmd)
argRequiredCount = (*p == kARG_END_ARGS) ? count : argCount; argRequiredCount = (*p == kARG_END_ARGS) ? count : argCount;
p = commands[cmd].parms; p = commands[cmd].parms;
int curCount = 0; uInt32 curCount = 0;
do { do {
if(curCount >= argCount) if(curCount >= argCount)
break; break;
int curArgInt = args[curCount]; uInt32 curArgInt = args[curCount];
string& curArgStr = argStrings[curCount]; string& curArgStr = argStrings[curCount];
switch(*p) switch(*p)
{ {
case kARG_WORD: case kARG_WORD:
if(curArgInt < 0 || curArgInt > 0xffff) if(curArgInt > 0xffff)
{ {
commandResult.str(red("invalid word argument (must be 0-$ffff)")); commandResult.str(red("invalid word argument (must be 0-$ffff)"));
return false; return false;
@ -455,7 +436,7 @@ bool DebuggerParser::validateArgs(int cmd)
break; break;
case kARG_BYTE: case kARG_BYTE:
if(curArgInt < 0 || curArgInt > 0xff) if(curArgInt > 0xff)
{ {
commandResult.str(red("invalid byte argument (must be 0-$ff)")); commandResult.str(red("invalid byte argument (must be 0-$ff)"));
return false; return false;
@ -519,7 +500,7 @@ cerr << "curCount = " << curCount << endl
string DebuggerParser::eval() string DebuggerParser::eval()
{ {
ostringstream buf; ostringstream buf;
for(int i = 0; i < argCount; ++i) for(uInt32 i = 0; i < argCount; ++i)
{ {
string rlabel = debugger.cartDebug().getLabel(args[i], true); string rlabel = debugger.cartDebug().getLabel(args[i], true);
string wlabel = debugger.cartDebug().getLabel(args[i], false); string wlabel = debugger.cartDebug().getLabel(args[i], false);
@ -665,7 +646,7 @@ void DebuggerParser::executeBase()
// "break" // "break"
void DebuggerParser::executeBreak() void DebuggerParser::executeBreak()
{ {
int bp; uInt16 bp;
if(argCount == 0) if(argCount == 0)
bp = debugger.cpuDebug().pc(); bp = debugger.cpuDebug().pc();
else else
@ -718,7 +699,7 @@ void DebuggerParser::executeCheat()
return; return;
} }
for(int arg = 0; arg < argCount; arg++) for(uInt32 arg = 0; arg < argCount; ++arg)
{ {
const string& cheat = argStrings[arg]; const string& cheat = argStrings[arg];
if(debugger.myOSystem.cheat().add("DBG", cheat)) if(debugger.myOSystem.cheat().add("DBG", cheat))
@ -1053,7 +1034,7 @@ void DebuggerParser::executeListbreaks()
ostringstream buf; ostringstream buf;
int count = 0; int count = 0;
for(uInt32 i = 0; i < 0x10000; i++) for(uInt32 i = 0; i <= 0xffff; ++i)
{ {
if(debugger.breakPoints().isSet(i)) if(debugger.breakPoints().isSet(i))
{ {
@ -1117,7 +1098,7 @@ void DebuggerParser::executeListtraps()
{ {
int count = 0; int count = 0;
for(uInt32 i = 0; i < 0x10000; ++i) for(uInt32 i = 0; i <= 0xffff; ++i)
{ {
if(debugger.readTrap(i) || debugger.writeTrap(i)) if(debugger.readTrap(i) || debugger.writeTrap(i))
{ {
@ -1243,8 +1224,8 @@ void DebuggerParser::executeRiot()
// "rom" // "rom"
void DebuggerParser::executeRom() void DebuggerParser::executeRom()
{ {
int addr = args[0]; uInt16 addr = args[0];
for(int i = 1; i < argCount; ++i) for(uInt32 i = 1; i < argCount; ++i)
{ {
if(!(debugger.patchROM(addr++, args[i]))) if(!(debugger.patchROM(addr++, args[i])))
{ {
@ -1301,7 +1282,7 @@ void DebuggerParser::executeRunTo()
const CartDebug& cartdbg = debugger.cartDebug(); const CartDebug& cartdbg = debugger.cartDebug();
const CartDebug::DisassemblyList& list = cartdbg.disassembly().list; const CartDebug::DisassemblyList& list = cartdbg.disassembly().list;
uInt32 count = 0, max_iterations = int(list.size()); uInt32 count = 0, max_iterations = uInt32(list.size());
// Create a progress dialog box to show the progress searching through the // Create a progress dialog box to show the progress searching through the
// disassembly, since this may be a time-consuming operation // disassembly, since this may be a time-consuming operation
@ -1352,8 +1333,7 @@ void DebuggerParser::executeRunToPc()
// Update romlist to point to current PC // Update romlist to point to current PC
int pcline = cartdbg.addressToLine(debugger.cpuDebug().pc()); int pcline = cartdbg.addressToLine(debugger.cpuDebug().pc());
done = (pcline >= 0) && (list[pcline].address == args[0]); done = (pcline >= 0) && (list[pcline].address == args[0]);
++count; } while(!done && ++count < list.size());
} while(!done && count < list.size());
if(done) if(done)
commandResult commandResult
@ -1683,10 +1663,10 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
{ {
"a", "a",
"Set Accumulator to <value>", "Set Accumulator to <value>",
"Valid value is 0 - 255\nExample: a ff, a #10", "Valid value is 0 - ff\nExample: a ff, a #10",
true, true,
true, true,
{ kARG_WORD, kARG_END_ARGS }, { kARG_BYTE, kARG_END_ARGS },
std::mem_fn(&DebuggerParser::executeA) std::mem_fn(&DebuggerParser::executeA)
}, },
@ -1703,7 +1683,8 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
{ {
"break", "break",
"Set/clear breakpoint at <address>", "Set/clear breakpoint at <address>",
"Command is a toggle, default is current PC\n:Example: break, break f000", "Command is a toggle, default is current PC\nValid address is 0 - ffff\n"
"Example: break, break f000",
false, false,
true, true,
{ kARG_WORD, kARG_END_ARGS }, { kARG_WORD, kARG_END_ARGS },
@ -1806,7 +1787,7 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
"Shows a color swatch for the given value\nExample: colortest 1f", "Shows a color swatch for the given value\nExample: colortest 1f",
true, true,
false, false,
{ kARG_WORD, kARG_END_ARGS }, { kARG_BYTE, kARG_END_ARGS },
std::mem_fn(&DebuggerParser::executeColortest) std::mem_fn(&DebuggerParser::executeColortest)
}, },
@ -2028,7 +2009,7 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
"Example: loadstate 0, loadstate 9", "Example: loadstate 0, loadstate 9",
true, true,
true, true,
{ kARG_WORD, kARG_END_ARGS }, { kARG_BYTE, kARG_END_ARGS },
std::mem_fn(&DebuggerParser::executeLoadstate) std::mem_fn(&DebuggerParser::executeLoadstate)
}, },
@ -2178,10 +2159,10 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
{ {
"s", "s",
"Set Stack Pointer to value xx", "Set Stack Pointer to value xx",
"Example: s f0", "Accepts 8-bit value, Example: s f0",
true, true,
true, true,
{ kARG_WORD, kARG_END_ARGS }, { kARG_BYTE, kARG_END_ARGS },
std::mem_fn(&DebuggerParser::executeS) std::mem_fn(&DebuggerParser::executeS)
}, },
@ -2252,7 +2233,7 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
"Example: savestate 0, savestate 9", "Example: savestate 0, savestate 9",
true, true,
false, false,
{ kARG_WORD, kARG_END_ARGS }, { kARG_BYTE, kARG_END_ARGS },
std::mem_fn(&DebuggerParser::executeSavestate) std::mem_fn(&DebuggerParser::executeSavestate)
}, },
@ -2383,20 +2364,20 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
{ {
"x", "x",
"Set X Register to value xx", "Set X Register to value xx",
"Valid value is 0 - 255\nExample: x ff, x #10", "Valid value is 0 - ff\nExample: x ff, x #10",
true, true,
true, true,
{ kARG_WORD, kARG_END_ARGS }, { kARG_BYTE, kARG_END_ARGS },
std::mem_fn(&DebuggerParser::executeX) std::mem_fn(&DebuggerParser::executeX)
}, },
{ {
"y", "y",
"Set Y Register to value xx", "Set Y Register to value xx",
"Valid value is 0 - 255\nExample: y ff, y #10", "Valid value is 0 - ff\nExample: y ff, y #10",
true, true,
true, true,
{ kARG_WORD, kARG_END_ARGS }, { kARG_BYTE, kARG_END_ARGS },
std::mem_fn(&DebuggerParser::executeY) std::mem_fn(&DebuggerParser::executeY)
}, },

View File

@ -112,7 +112,7 @@ class DebuggerParser
// Arguments in 'int' and 'string' format for the currently running command // Arguments in 'int' and 'string' format for the currently running command
IntArray args; IntArray args;
StringList argStrings; StringList argStrings;
int argCount; uInt32 argCount;
StringList watches; StringList watches;

View File

@ -35,7 +35,7 @@ class Expression
: myLHS(lhs), myRHS(rhs) { } : myLHS(lhs), myRHS(rhs) { }
virtual ~Expression() = default; virtual ~Expression() = default;
virtual uInt16 evaluate() const { return 0; } virtual uInt32 evaluate() const { return 0; }
protected: protected:
unique_ptr<Expression> myLHS, myRHS; unique_ptr<Expression> myLHS, myRHS;

View File

@ -27,12 +27,12 @@ class PackedBitArray
public: public:
PackedBitArray() : myInitialized(false) { } PackedBitArray() : myInitialized(false) { }
bool isSet(uInt32 bit) const { return myBits[bit]; } bool isSet(uInt16 bit) const { return myBits[bit]; }
bool isClear(uInt32 bit) const { return !myBits[bit]; } bool isClear(uInt16 bit) const { return !myBits[bit]; }
void set(uInt32 bit) { myBits[bit] = true; } void set(uInt16 bit) { myBits[bit] = true; }
void clear(uInt32 bit) { myBits[bit] = false; } void clear(uInt16 bit) { myBits[bit] = false; }
void toggle(uInt32 bit) { myBits.flip(bit); } void toggle(uInt16 bit) { myBits.flip(bit); }
void initialize() { myInitialized = true; } void initialize() { myInitialized = true; }
void clearAll() { myInitialized = false; myBits.reset(); } void clearAll() { myInitialized = false; myBits.reset(); }

View File

@ -93,8 +93,8 @@ expression: expression '+' expression { if(DEBUG_EXP) fprintf(stderr, " +"); $$
| '>' expression { if(DEBUG_EXP) fprintf(stderr, " U>"); $$ = new HiByteExpression($2); lastExp = $$; } | '>' expression { if(DEBUG_EXP) fprintf(stderr, " U>"); $$ = new HiByteExpression($2); lastExp = $$; }
| '(' expression ')' { if(DEBUG_EXP) fprintf(stderr, " ()"); $$ = $2; lastExp = $$; } | '(' expression ')' { if(DEBUG_EXP) fprintf(stderr, " ()"); $$ = $2; lastExp = $$; }
| expression '[' expression ']' { if(DEBUG_EXP) fprintf(stderr, " []"); $$ = new ByteDerefOffsetExpression($1, $3); lastExp = $$; } | expression '[' expression ']' { if(DEBUG_EXP) fprintf(stderr, " []"); $$ = new ByteDerefOffsetExpression($1, $3); lastExp = $$; }
| NUMBER { if(DEBUG_EXP) fprintf(stderr, " %d", $1); $$ = new ConstExpression($1); lastExp = $$; } | NUMBER { if(DEBUG_EXP) fprintf(stderr, "const %d", $1); $$ = new ConstExpression($1); lastExp = $$; }
| EQUATE { if(DEBUG_EXP) fprintf(stderr, " %s", $1); $$ = new EquateExpression($1); lastExp = $$; } | EQUATE { if(DEBUG_EXP) fprintf(stderr, "equate %s", $1); $$ = new EquateExpression($1); lastExp = $$; }
| CPU_METHOD { if(DEBUG_EXP) fprintf(stderr, " (CpuMethod)"); $$ = new CpuMethodExpression($1); lastExp = $$; } | CPU_METHOD { if(DEBUG_EXP) fprintf(stderr, " (CpuMethod)"); $$ = new CpuMethodExpression($1); lastExp = $$; }
| CART_METHOD { if(DEBUG_EXP) fprintf(stderr, " (CartMethod)"); $$ = new CartMethodExpression($1); lastExp = $$; } | CART_METHOD { if(DEBUG_EXP) fprintf(stderr, " (CartMethod)"); $$ = new CartMethodExpression($1); lastExp = $$; }
| TIA_METHOD { if(DEBUG_EXP) fprintf(stderr, " (TiaMethod)"); $$ = new TiaMethodExpression($1); lastExp = $$; } | TIA_METHOD { if(DEBUG_EXP) fprintf(stderr, " (TiaMethod)"); $$ = new TiaMethodExpression($1); lastExp = $$; }

View File

@ -1,8 +1,8 @@
/* A Bison parser, made by GNU Bison 3.0.2. */ /* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison implementation for Yacc-like parsers in C /* Bison implementation for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -44,7 +44,7 @@
#define YYBISON 1 #define YYBISON 1
/* Bison version. */ /* Bison version. */
#define YYBISON_VERSION "3.0.2" #define YYBISON_VERSION "3.0.4"
/* Skeleton name. */ /* Skeleton name. */
#define YYSKELETON_NAME "yacc.c" #define YYSKELETON_NAME "yacc.c"
@ -166,7 +166,7 @@ extern int yydebug;
/* Value type. */ /* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE YYSTYPE;
union YYSTYPE union YYSTYPE
{ {
#line 28 "stella.y" /* yacc.c:355 */ #line 28 "stella.y" /* yacc.c:355 */
@ -181,6 +181,8 @@ union YYSTYPE
#line 183 "y.tab.c" /* yacc.c:355 */ #line 183 "y.tab.c" /* yacc.c:355 */
}; };
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
#endif #endif
@ -194,7 +196,7 @@ int yyparse (void);
/* Copy the second part of user declarations. */ /* Copy the second part of user declarations. */
#line 198 "y.tab.c" /* yacc.c:358 */ #line 200 "y.tab.c" /* yacc.c:358 */
#ifdef short #ifdef short
# undef short # undef short
@ -1338,215 +1340,215 @@ yyreduce:
case 2: case 2:
#line 66 "stella.y" /* yacc.c:1646 */ #line 66 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, "\ndone\n"); result.exp = (yyvsp[0].exp); } { if(DEBUG_EXP) fprintf(stderr, "\ndone\n"); result.exp = (yyvsp[0].exp); }
#line 1342 "y.tab.c" /* yacc.c:1646 */ #line 1344 "y.tab.c" /* yacc.c:1646 */
break; break;
case 3: case 3:
#line 69 "stella.y" /* yacc.c:1646 */ #line 69 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " +"); (yyval.exp) = new PlusExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " +"); (yyval.exp) = new PlusExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1348 "y.tab.c" /* yacc.c:1646 */ #line 1350 "y.tab.c" /* yacc.c:1646 */
break; break;
case 4: case 4:
#line 70 "stella.y" /* yacc.c:1646 */ #line 70 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " -"); (yyval.exp) = new MinusExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " -"); (yyval.exp) = new MinusExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1354 "y.tab.c" /* yacc.c:1646 */ #line 1356 "y.tab.c" /* yacc.c:1646 */
break; break;
case 5: case 5:
#line 71 "stella.y" /* yacc.c:1646 */ #line 71 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " *"); (yyval.exp) = new MultExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " *"); (yyval.exp) = new MultExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1360 "y.tab.c" /* yacc.c:1646 */ #line 1362 "y.tab.c" /* yacc.c:1646 */
break; break;
case 6: case 6:
#line 72 "stella.y" /* yacc.c:1646 */ #line 72 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " /"); (yyval.exp) = new DivExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " /"); (yyval.exp) = new DivExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1366 "y.tab.c" /* yacc.c:1646 */ #line 1368 "y.tab.c" /* yacc.c:1646 */
break; break;
case 7: case 7:
#line 73 "stella.y" /* yacc.c:1646 */ #line 73 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " %%"); (yyval.exp) = new ModExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " %%"); (yyval.exp) = new ModExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1372 "y.tab.c" /* yacc.c:1646 */ #line 1374 "y.tab.c" /* yacc.c:1646 */
break; break;
case 8: case 8:
#line 74 "stella.y" /* yacc.c:1646 */ #line 74 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " &"); (yyval.exp) = new BinAndExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " &"); (yyval.exp) = new BinAndExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1378 "y.tab.c" /* yacc.c:1646 */ #line 1380 "y.tab.c" /* yacc.c:1646 */
break; break;
case 9: case 9:
#line 75 "stella.y" /* yacc.c:1646 */ #line 75 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " |"); (yyval.exp) = new BinOrExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " |"); (yyval.exp) = new BinOrExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1384 "y.tab.c" /* yacc.c:1646 */ #line 1386 "y.tab.c" /* yacc.c:1646 */
break; break;
case 10: case 10:
#line 76 "stella.y" /* yacc.c:1646 */ #line 76 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " ^"); (yyval.exp) = new BinXorExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " ^"); (yyval.exp) = new BinXorExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1390 "y.tab.c" /* yacc.c:1646 */ #line 1392 "y.tab.c" /* yacc.c:1646 */
break; break;
case 11: case 11:
#line 77 "stella.y" /* yacc.c:1646 */ #line 77 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " <"); (yyval.exp) = new LessExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " <"); (yyval.exp) = new LessExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1396 "y.tab.c" /* yacc.c:1646 */ #line 1398 "y.tab.c" /* yacc.c:1646 */
break; break;
case 12: case 12:
#line 78 "stella.y" /* yacc.c:1646 */ #line 78 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " >"); (yyval.exp) = new GreaterExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " >"); (yyval.exp) = new GreaterExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1402 "y.tab.c" /* yacc.c:1646 */ #line 1404 "y.tab.c" /* yacc.c:1646 */
break; break;
case 13: case 13:
#line 79 "stella.y" /* yacc.c:1646 */ #line 79 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " >="); (yyval.exp) = new GreaterEqualsExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " >="); (yyval.exp) = new GreaterEqualsExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1408 "y.tab.c" /* yacc.c:1646 */ #line 1410 "y.tab.c" /* yacc.c:1646 */
break; break;
case 14: case 14:
#line 80 "stella.y" /* yacc.c:1646 */ #line 80 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " <="); (yyval.exp) = new LessEqualsExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " <="); (yyval.exp) = new LessEqualsExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1414 "y.tab.c" /* yacc.c:1646 */ #line 1416 "y.tab.c" /* yacc.c:1646 */
break; break;
case 15: case 15:
#line 81 "stella.y" /* yacc.c:1646 */ #line 81 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " !="); (yyval.exp) = new NotEqualsExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " !="); (yyval.exp) = new NotEqualsExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1420 "y.tab.c" /* yacc.c:1646 */ #line 1422 "y.tab.c" /* yacc.c:1646 */
break; break;
case 16: case 16:
#line 82 "stella.y" /* yacc.c:1646 */ #line 82 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " =="); (yyval.exp) = new EqualsExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " =="); (yyval.exp) = new EqualsExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1426 "y.tab.c" /* yacc.c:1646 */ #line 1428 "y.tab.c" /* yacc.c:1646 */
break; break;
case 17: case 17:
#line 83 "stella.y" /* yacc.c:1646 */ #line 83 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " >>"); (yyval.exp) = new ShiftRightExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " >>"); (yyval.exp) = new ShiftRightExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1432 "y.tab.c" /* yacc.c:1646 */ #line 1434 "y.tab.c" /* yacc.c:1646 */
break; break;
case 18: case 18:
#line 84 "stella.y" /* yacc.c:1646 */ #line 84 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " <<"); (yyval.exp) = new ShiftLeftExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " <<"); (yyval.exp) = new ShiftLeftExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1438 "y.tab.c" /* yacc.c:1646 */ #line 1440 "y.tab.c" /* yacc.c:1646 */
break; break;
case 19: case 19:
#line 85 "stella.y" /* yacc.c:1646 */ #line 85 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " ||"); (yyval.exp) = new LogOrExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " ||"); (yyval.exp) = new LogOrExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1444 "y.tab.c" /* yacc.c:1646 */ #line 1446 "y.tab.c" /* yacc.c:1646 */
break; break;
case 20: case 20:
#line 86 "stella.y" /* yacc.c:1646 */ #line 86 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " &&"); (yyval.exp) = new LogAndExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " &&"); (yyval.exp) = new LogAndExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1450 "y.tab.c" /* yacc.c:1646 */ #line 1452 "y.tab.c" /* yacc.c:1646 */
break; break;
case 21: case 21:
#line 87 "stella.y" /* yacc.c:1646 */ #line 87 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " U-"); (yyval.exp) = new UnaryMinusExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " U-"); (yyval.exp) = new UnaryMinusExpression((yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1456 "y.tab.c" /* yacc.c:1646 */ #line 1458 "y.tab.c" /* yacc.c:1646 */
break; break;
case 22: case 22:
#line 88 "stella.y" /* yacc.c:1646 */ #line 88 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " ~"); (yyval.exp) = new BinNotExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " ~"); (yyval.exp) = new BinNotExpression((yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1462 "y.tab.c" /* yacc.c:1646 */ #line 1464 "y.tab.c" /* yacc.c:1646 */
break; break;
case 23: case 23:
#line 89 "stella.y" /* yacc.c:1646 */ #line 89 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " !"); (yyval.exp) = new LogNotExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " !"); (yyval.exp) = new LogNotExpression((yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1468 "y.tab.c" /* yacc.c:1646 */ #line 1470 "y.tab.c" /* yacc.c:1646 */
break; break;
case 24: case 24:
#line 90 "stella.y" /* yacc.c:1646 */ #line 90 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " U*"); (yyval.exp) = new ByteDerefExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " U*"); (yyval.exp) = new ByteDerefExpression((yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1474 "y.tab.c" /* yacc.c:1646 */ #line 1476 "y.tab.c" /* yacc.c:1646 */
break; break;
case 25: case 25:
#line 91 "stella.y" /* yacc.c:1646 */ #line 91 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " U@"); (yyval.exp) = new WordDerefExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " U@"); (yyval.exp) = new WordDerefExpression((yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1480 "y.tab.c" /* yacc.c:1646 */ #line 1482 "y.tab.c" /* yacc.c:1646 */
break; break;
case 26: case 26:
#line 92 "stella.y" /* yacc.c:1646 */ #line 92 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " U<"); (yyval.exp) = new LoByteExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " U<"); (yyval.exp) = new LoByteExpression((yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1486 "y.tab.c" /* yacc.c:1646 */ #line 1488 "y.tab.c" /* yacc.c:1646 */
break; break;
case 27: case 27:
#line 93 "stella.y" /* yacc.c:1646 */ #line 93 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " U>"); (yyval.exp) = new HiByteExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " U>"); (yyval.exp) = new HiByteExpression((yyvsp[0].exp)); lastExp = (yyval.exp); }
#line 1492 "y.tab.c" /* yacc.c:1646 */ #line 1494 "y.tab.c" /* yacc.c:1646 */
break; break;
case 28: case 28:
#line 94 "stella.y" /* yacc.c:1646 */ #line 94 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " ()"); (yyval.exp) = (yyvsp[-1].exp); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " ()"); (yyval.exp) = (yyvsp[-1].exp); lastExp = (yyval.exp); }
#line 1498 "y.tab.c" /* yacc.c:1646 */ #line 1500 "y.tab.c" /* yacc.c:1646 */
break; break;
case 29: case 29:
#line 95 "stella.y" /* yacc.c:1646 */ #line 95 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " []"); (yyval.exp) = new ByteDerefOffsetExpression((yyvsp[-3].exp), (yyvsp[-1].exp)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " []"); (yyval.exp) = new ByteDerefOffsetExpression((yyvsp[-3].exp), (yyvsp[-1].exp)); lastExp = (yyval.exp); }
#line 1504 "y.tab.c" /* yacc.c:1646 */ #line 1506 "y.tab.c" /* yacc.c:1646 */
break; break;
case 30: case 30:
#line 96 "stella.y" /* yacc.c:1646 */ #line 96 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " %d", (yyvsp[0].val)); (yyval.exp) = new ConstExpression((yyvsp[0].val)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, "const %d", (yyvsp[0].val)); (yyval.exp) = new ConstExpression((yyvsp[0].val)); lastExp = (yyval.exp); }
#line 1510 "y.tab.c" /* yacc.c:1646 */ #line 1512 "y.tab.c" /* yacc.c:1646 */
break; break;
case 31: case 31:
#line 97 "stella.y" /* yacc.c:1646 */ #line 97 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " %s", (yyvsp[0].Equate)); (yyval.exp) = new EquateExpression((yyvsp[0].Equate)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, "equate %s", (yyvsp[0].Equate)); (yyval.exp) = new EquateExpression((yyvsp[0].Equate)); lastExp = (yyval.exp); }
#line 1516 "y.tab.c" /* yacc.c:1646 */ #line 1518 "y.tab.c" /* yacc.c:1646 */
break; break;
case 32: case 32:
#line 98 "stella.y" /* yacc.c:1646 */ #line 98 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " (CpuMethod)"); (yyval.exp) = new CpuMethodExpression((yyvsp[0].cpuMethod)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " (CpuMethod)"); (yyval.exp) = new CpuMethodExpression((yyvsp[0].cpuMethod)); lastExp = (yyval.exp); }
#line 1522 "y.tab.c" /* yacc.c:1646 */ #line 1524 "y.tab.c" /* yacc.c:1646 */
break; break;
case 33: case 33:
#line 99 "stella.y" /* yacc.c:1646 */ #line 99 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " (CartMethod)"); (yyval.exp) = new CartMethodExpression((yyvsp[0].cartMethod)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " (CartMethod)"); (yyval.exp) = new CartMethodExpression((yyvsp[0].cartMethod)); lastExp = (yyval.exp); }
#line 1528 "y.tab.c" /* yacc.c:1646 */ #line 1530 "y.tab.c" /* yacc.c:1646 */
break; break;
case 34: case 34:
#line 100 "stella.y" /* yacc.c:1646 */ #line 100 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " (TiaMethod)"); (yyval.exp) = new TiaMethodExpression((yyvsp[0].tiaMethod)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " (TiaMethod)"); (yyval.exp) = new TiaMethodExpression((yyvsp[0].tiaMethod)); lastExp = (yyval.exp); }
#line 1534 "y.tab.c" /* yacc.c:1646 */ #line 1536 "y.tab.c" /* yacc.c:1646 */
break; break;
case 35: case 35:
#line 101 "stella.y" /* yacc.c:1646 */ #line 101 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " (DefinedFunction)"); (yyval.exp) = new FunctionExpression((yyvsp[0].DefinedFunction)); lastExp = (yyval.exp); } { if(DEBUG_EXP) fprintf(stderr, " (DefinedFunction)"); (yyval.exp) = new FunctionExpression((yyvsp[0].DefinedFunction)); lastExp = (yyval.exp); }
#line 1540 "y.tab.c" /* yacc.c:1646 */ #line 1542 "y.tab.c" /* yacc.c:1646 */
break; break;
case 36: case 36:
#line 102 "stella.y" /* yacc.c:1646 */ #line 102 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " ERR: "); yyerror((char*)"Invalid label or constant"); return 1; } { if(DEBUG_EXP) fprintf(stderr, " ERR: "); yyerror((char*)"Invalid label or constant"); return 1; }
#line 1546 "y.tab.c" /* yacc.c:1646 */ #line 1548 "y.tab.c" /* yacc.c:1646 */
break; break;
#line 1550 "y.tab.c" /* yacc.c:1646 */ #line 1552 "y.tab.c" /* yacc.c:1646 */
default: break; default: break;
} }
/* User semantic actions sometimes alter yychar, and that requires /* User semantic actions sometimes alter yychar, and that requires

View File

@ -1,8 +1,8 @@
/* A Bison parser, made by GNU Bison 3.0.2. */ /* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C /* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -87,7 +87,7 @@ extern int yydebug;
/* Value type. */ /* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE YYSTYPE;
union YYSTYPE union YYSTYPE
{ {
#line 28 "stella.y" /* yacc.c:1909 */ #line 28 "stella.y" /* yacc.c:1909 */
@ -102,6 +102,8 @@ union YYSTYPE
#line 104 "y.tab.h" /* yacc.c:1909 */ #line 104 "y.tab.h" /* yacc.c:1909 */
}; };
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
#endif #endif