CPU register 'source' addresses in the debugger now show labels,

when applicable.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2802 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2013-08-20 14:00:25 +00:00
parent bf3384425c
commit f02995b485
10 changed files with 46 additions and 33 deletions

View File

@ -691,10 +691,17 @@ bool CartDebug::getLabel(ostream& buf, uInt16 addr, bool isRead, int places) con
}
}
if(places > -1)
switch(places)
{
buf << "$" << setw(places) << hex << addr;
return true;
case 2:
buf << "$" << Base::HEX2 << addr;
return true;
case 4:
buf << "$" << Base::HEX4 << addr;
return true;
case 8:
buf << "$" << Base::HEX8 << addr;
return true;
}
return false;

View File

@ -29,6 +29,7 @@ class CartDebugWidget;
#include "bspf.hxx"
#include "Array.hxx"
#include "Base.hxx"
#include "Cart.hxx"
#include "DebuggerSystem.hxx"
#include "System.hxx"

View File

@ -1540,6 +1540,7 @@ void DebuggerParser::executeUHex()
Base::setHexUppercase(enable);
settings.setValue("dbg.uhex", enable);
debugger.rom().invalidate();
commandResult << "uppercase HEX " << (enable ? "enabled" : "disabled");
}

View File

@ -246,6 +246,7 @@ void CpuWidget::loadConfig()
// We push the enumerated items as addresses, and deal with the real
// address in the callback (handleCommand)
Debugger& dbg = instance().debugger();
CartDebug& cart = dbg.cartDebug();
CpuDebug& cpu = dbg.cpuDebug();
const CpuState& state = (CpuState&) cpu.getState();
const CpuState& oldstate = (CpuState&) cpu.getOldState();
@ -282,14 +283,17 @@ void CpuWidget::loadConfig()
myCpuGridBinValue->setList(alist, vlist, changed);
// Update the data sources for the SP/A/X/Y registers
// TODO - change this to use actual labels
myCpuDataSrc[0]->setText(Common::Base::toString(state.srcS),
const string& srcS = state.srcS < 0 ? "IMM" : cart.getLabel(state.srcS, true);
myCpuDataSrc[0]->setText((srcS != EmptyString ? srcS : Common::Base::toString(state.srcS)),
state.srcS != oldstate.srcS);
myCpuDataSrc[1]->setText(Common::Base::toString(state.srcA),
const string& srcA = state.srcA < 0 ? "IMM" : cart.getLabel(state.srcA, true);
myCpuDataSrc[1]->setText((srcA != EmptyString ? srcA : Common::Base::toString(state.srcA)),
state.srcA != oldstate.srcA);
myCpuDataSrc[2]->setText(Common::Base::toString(state.srcX),
const string& srcX = state.srcX < 0 ? "IMM" : cart.getLabel(state.srcX, true);
myCpuDataSrc[2]->setText((srcX != EmptyString ? srcX : Common::Base::toString(state.srcX)),
state.srcX != oldstate.srcX);
myCpuDataSrc[3]->setText(Common::Base::toString(state.srcY),
const string& srcY = state.srcY < 0 ? "IMM" : cart.getLabel(state.srcY, true);
myCpuDataSrc[3]->setText((srcY != EmptyString ? srcY : Common::Base::toString(state.srcY)),
state.srcY != oldstate.srcY);
// Update the PS register booleans

View File

@ -351,8 +351,6 @@ void DebuggerDialog::addRomArea()
myRam = new RamWidget(this, *myFont, xpos, ypos);
addToFocusList(myRam->getFocusList());
// Add the DataGridOpsWidget to any widgets which contain a
// DataGridWidget which we want controlled
myCpu->setOpsWidget(ops);

View File

@ -58,10 +58,10 @@ M6502::M6502(uInt32 systemCyclesPerProcessorCycle, const Settings& settings)
myLastAddress(0),
myLastPeekAddress(0),
myLastPokeAddress(0),
myLastSrcAddressS(0),
myLastSrcAddressA(0),
myLastSrcAddressX(0),
myLastSrcAddressY(0),
myLastSrcAddressS(-1),
myLastSrcAddressA(-1),
myLastSrcAddressX(-1),
myLastSrcAddressY(-1),
myDataAddressForPoke(0)
{
#ifdef DEBUGGER_SUPPORT
@ -134,7 +134,7 @@ void M6502::reset()
myLastAddress = myLastPeekAddress = myLastPokeAddress = 0;
myLastSrcAddressS = myLastSrcAddressA =
myLastSrcAddressX = myLastSrcAddressY = 0;
myLastSrcAddressX = myLastSrcAddressY = -1;
myDataAddressForPoke = 0;
}
@ -362,11 +362,11 @@ bool M6502::save(Serializer& out) const
out.putShort(myLastAddress);
out.putShort(myLastPeekAddress);
out.putShort(myLastPokeAddress);
out.putShort(myLastSrcAddressS);
out.putShort(myLastSrcAddressA);
out.putShort(myLastSrcAddressX);
out.putShort(myLastSrcAddressY);
out.putShort(myDataAddressForPoke);
out.putInt(myLastSrcAddressS);
out.putInt(myLastSrcAddressA);
out.putInt(myLastSrcAddressX);
out.putInt(myLastSrcAddressY);
}
catch(...)
{
@ -410,11 +410,11 @@ bool M6502::load(Serializer& in)
myLastAddress = in.getShort();
myLastPeekAddress = in.getShort();
myLastPokeAddress = in.getShort();
myLastSrcAddressS = in.getShort();
myLastSrcAddressA = in.getShort();
myLastSrcAddressX = in.getShort();
myLastSrcAddressY = in.getShort();
myDataAddressForPoke = in.getShort();
myLastSrcAddressS = in.getInt();
myLastSrcAddressA = in.getInt();
myLastSrcAddressX = in.getInt();
myLastSrcAddressY = in.getInt();
}
catch(...)
{

View File

@ -160,14 +160,14 @@ class M6502 : public Serializable
/**
Return the last data address used as part of a peek operation for
the S/A/X/Y registers. Note that if an address wasn't used (as in
immediate mode), then the address is zero.
immediate mode), then the address is -1.
@return The address of the data used in the last peek, else 0
@return The address of the data used in the last peek, else -1
*/
uInt16 lastSrcAddressS() const { return myLastSrcAddressS; }
uInt16 lastSrcAddressA() const { return myLastSrcAddressA; }
uInt16 lastSrcAddressX() const { return myLastSrcAddressX; }
uInt16 lastSrcAddressY() const { return myLastSrcAddressY; }
Int32 lastSrcAddressS() const { return myLastSrcAddressS; }
Int32 lastSrcAddressA() const { return myLastSrcAddressA; }
Int32 lastSrcAddressX() const { return myLastSrcAddressX; }
Int32 lastSrcAddressY() const { return myLastSrcAddressY; }
/**
Get the total number of instructions executed so far.
@ -348,8 +348,8 @@ class M6502 : public Serializable
/// Indicates the last address used to access data by a peek command
/// for the CPU registers (S/A/X/Y)
uInt16 myLastSrcAddressS, myLastSrcAddressA,
myLastSrcAddressX, myLastSrcAddressY;
Int32 myLastSrcAddressS, myLastSrcAddressA,
myLastSrcAddressX, myLastSrcAddressY;
/// Indicates the data address used by the last command that performed
/// a poke (currently, the last address used by STx)

View File

@ -38,7 +38,7 @@
#ifndef CLEAR_LAST_PEEK
#ifdef DEBUGGER_SUPPORT
#define CLEAR_LAST_PEEK(_addr) _addr = 0;
#define CLEAR_LAST_PEEK(_addr) _addr = -1;
#else
#define CLEAR_LAST_PEEK(_addr)
#endif

View File

@ -38,7 +38,7 @@
#ifndef CLEAR_LAST_PEEK
#ifdef DEBUGGER_SUPPORT
#define CLEAR_LAST_PEEK(_addr) _addr = 0;
#define CLEAR_LAST_PEEK(_addr) _addr = -1;
#else
#define CLEAR_LAST_PEEK(_addr)
#endif

View File

@ -43,6 +43,8 @@ void EditTextWidget::setText(const string& str, bool changed)
EditableWidget::setText(str, changed);
_backupString = str;
_changed = changed;
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -