mirror of
https://github.com/libretro/stella2023.git
synced 2024-12-03 15:11:03 +00:00
Added 'palette' debugger prompt command, which shows a colour swatch
of the currently active TIA palette.
This commit is contained in:
parent
435608422b
commit
9736bdd3e8
@ -35,6 +35,8 @@
|
||||
- The 'help' command now accepts other commands, and gives extra
|
||||
information about the command (ie, 'help breakif' prints extended
|
||||
information about the breakif command)
|
||||
- Added 'palette' command, which shows a color swatch of the
|
||||
currently active TIA palette
|
||||
- The previous trap'm' commands now work when setting TIA read
|
||||
addresses; previously they only worked for write addresses
|
||||
- Command completion now works with internal functions and pseudo-ops
|
||||
|
@ -62,7 +62,11 @@ class Base
|
||||
static void setHexUppercase(bool enable);
|
||||
static bool hexUppercase() { return myHexflags & std::ios_base::uppercase; }
|
||||
|
||||
/** Output HEX digits in 1/2/4 byte format */
|
||||
/** Output HEX digits in 0.5/1/2/4 byte format */
|
||||
static inline std::ostream& HEX1(std::ostream& os) {
|
||||
os.flags(myHexflags);
|
||||
return os << std::setw(1);
|
||||
}
|
||||
static inline std::ostream& HEX2(std::ostream& os) {
|
||||
os.flags(myHexflags);
|
||||
return os << std::setw(2) << std::setfill('0');
|
||||
|
@ -1150,6 +1150,13 @@ void DebuggerParser::executeN()
|
||||
debugger.cpuDebug().setN(args[0]);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// "palette"
|
||||
void DebuggerParser::executePalette()
|
||||
{
|
||||
commandResult << debugger.tiaDebug().palette();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// "pc"
|
||||
void DebuggerParser::executePc()
|
||||
@ -2033,6 +2040,16 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
|
||||
std::mem_fn(&DebuggerParser::executeN)
|
||||
},
|
||||
|
||||
{
|
||||
"palette",
|
||||
"Show current TIA palette",
|
||||
"Example: palette (no parameters)",
|
||||
false,
|
||||
false,
|
||||
{ kARG_END_ARGS },
|
||||
std::mem_fn(&DebuggerParser::executePalette)
|
||||
},
|
||||
|
||||
{
|
||||
"pc",
|
||||
"Set Program Counter to address xx",
|
||||
|
@ -68,7 +68,7 @@ class DebuggerParser
|
||||
bool saveScriptFile(string file);
|
||||
|
||||
private:
|
||||
enum { kNumCommands = 70 };
|
||||
enum { kNumCommands = 71 };
|
||||
|
||||
// Constants for argument processing
|
||||
enum {
|
||||
@ -152,6 +152,7 @@ class DebuggerParser
|
||||
void executeLoadconfig();
|
||||
void executeLoadstate();
|
||||
void executeN();
|
||||
void executePalette();
|
||||
void executePc();
|
||||
void executePGfx();
|
||||
void executePrint();
|
||||
|
@ -695,7 +695,7 @@ shared_ptr<DelayQueueIterator> TIADebug::delayQueueIterator() const
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string TIADebug::colorSwatch(uInt8 c)
|
||||
string TIADebug::colorSwatch(uInt8 c) const
|
||||
{
|
||||
string ret;
|
||||
|
||||
@ -742,6 +742,24 @@ string TIADebug::booleanWithLabel(string label, bool value)
|
||||
return "-" + label;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string TIADebug::palette() const
|
||||
{
|
||||
ostringstream buf;
|
||||
|
||||
buf << " 0 2 4 6 8 A C E\n";
|
||||
uInt8 c = 0;
|
||||
for(uInt16 row = 0; row < 16; ++row)
|
||||
{
|
||||
buf << " " << Common::Base::HEX1 << row << " ";
|
||||
for(uInt16 col = 0; col < 8; ++col, c += 2)
|
||||
buf << colorSwatch(c);
|
||||
|
||||
buf << endl;
|
||||
}
|
||||
return buf.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string TIADebug::toString()
|
||||
{
|
||||
@ -776,11 +794,11 @@ string TIADebug::toString()
|
||||
<< "COLUxx: "
|
||||
<< "P0=$" << Common::Base::HEX2 << state.coluRegs[0] << "/"
|
||||
<< colorSwatch(state.coluRegs[0])
|
||||
<< "P1=$" << Common::Base::HEX2 << state.coluRegs[1] << "/"
|
||||
<< " P1=$" << Common::Base::HEX2 << state.coluRegs[1] << "/"
|
||||
<< colorSwatch(state.coluRegs[1])
|
||||
<< "PF=$" << Common::Base::HEX2 << state.coluRegs[2] << "/"
|
||||
<< " PF=$" << Common::Base::HEX2 << state.coluRegs[2] << "/"
|
||||
<< colorSwatch(state.coluRegs[2])
|
||||
<< "BK=$" << Common::Base::HEX2 << state.coluRegs[3] << "/"
|
||||
<< " BK=$" << Common::Base::HEX2 << state.coluRegs[3] << "/"
|
||||
<< colorSwatch(state.coluRegs[3])
|
||||
<< endl
|
||||
<< "P0: GR=%" << Common::Base::toString(state.gr[P0], Common::Base::F_2_8)
|
||||
|
@ -59,6 +59,7 @@ class TIADebug : public DebuggerSystem
|
||||
|
||||
void saveOldState() override;
|
||||
string toString() override;
|
||||
string palette() const;
|
||||
|
||||
// TIA byte (or part of a byte) registers
|
||||
uInt8 nusiz0(int newVal = -1);
|
||||
@ -139,7 +140,7 @@ class TIADebug : public DebuggerSystem
|
||||
|
||||
// TIA strobe registers
|
||||
void strobeWsync() { mySystem.poke(WSYNC, 0); }
|
||||
void strobeRsync() { mySystem.poke(RSYNC, 0); } // not emulated!
|
||||
void strobeRsync() { mySystem.poke(RSYNC, 0); }
|
||||
void strobeResP0() { mySystem.poke(RESP0, 0); }
|
||||
void strobeResP1() { mySystem.poke(RESP1, 0); }
|
||||
void strobeResM0() { mySystem.poke(RESM0, 0); }
|
||||
@ -162,7 +163,7 @@ class TIADebug : public DebuggerSystem
|
||||
|
||||
private:
|
||||
/** Display a color patch for color at given index in the palette */
|
||||
string colorSwatch(uInt8 c);
|
||||
string colorSwatch(uInt8 c) const;
|
||||
|
||||
/** Get specific bits in the collision register (used by collXX_XX) */
|
||||
bool collision(CollisionBit id) const;
|
||||
|
Loading…
Reference in New Issue
Block a user