mirror of https://github.com/stella-emu/stella.git
"dumpram" now respects the default base. If dumping binary, only 4 bytes
per line are displayed. There's room for more, but not for 8... and I expect each line to contain a power-of-two's worth of bytes for some reason (I tried 6 bytes/line, it was somehow jarring). Added bool Debugger::ramChanged(uInt 8 offset) method for the GUI RAM tab to use. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@593 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
3501378714
commit
b3479e8e9a
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Debugger.cxx,v 1.45 2005-07-02 17:15:41 urchlay Exp $
|
||||
// $Id: Debugger.cxx,v 1.46 2005-07-02 18:03:09 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -172,7 +172,10 @@ const string Debugger::valueToString(int value, BaseFormat outputBase)
|
|||
break;
|
||||
|
||||
case kBASE_10:
|
||||
sprintf(rendered, "%d", value);
|
||||
if(value < 0x100)
|
||||
sprintf(rendered, "%3d", value);
|
||||
else
|
||||
sprintf(rendered, "%5d", value);
|
||||
break;
|
||||
|
||||
case kBASE_16:
|
||||
|
@ -343,28 +346,49 @@ uInt8 Debugger::oldRAM(uInt8 offset)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const string Debugger::dumpRAM(uInt16 start)
|
||||
bool Debugger::ramChanged(uInt8 offset)
|
||||
{
|
||||
offset &= 0x7f;
|
||||
return (myOldRAM[offset] != readRAM(offset));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
/* Warning: this method really is for dumping *RAM*, not ROM or I/O! */
|
||||
const string Debugger::dumpRAM(uInt8 start, uInt8 len)
|
||||
{
|
||||
string result;
|
||||
char buf[128];
|
||||
int bytesPerLine;
|
||||
|
||||
for (uInt8 i = 0x00; i < kRamStart; i += 0x10)
|
||||
switch(myParser->base())
|
||||
{
|
||||
sprintf(buf, "%.4x: ", start+i);
|
||||
case kBASE_16:
|
||||
case kBASE_10:
|
||||
bytesPerLine = 0x10;
|
||||
break;
|
||||
|
||||
case kBASE_2:
|
||||
bytesPerLine = 0x04;
|
||||
break;
|
||||
|
||||
case kBASE_DEFAULT:
|
||||
default:
|
||||
return DebuggerParser::red("invalid base, this is a BUG");
|
||||
}
|
||||
|
||||
for (uInt8 i = 0x00; i < len; i += bytesPerLine)
|
||||
{
|
||||
sprintf(buf, "%.2x: ", start+i);
|
||||
result += buf;
|
||||
|
||||
for (uInt8 j = 0; j < 0x010; j++)
|
||||
for (uInt8 j = 0; j < bytesPerLine; j++)
|
||||
{
|
||||
int byte = mySystem->peek(start+i+j);
|
||||
bool changed = (byte != myOldRAM[i+j]);
|
||||
|
||||
if(changed) result += "\177";
|
||||
sprintf(buf, "%.2x", mySystem->peek(start+i+j));
|
||||
result += buf;
|
||||
if(changed) result += "\177";
|
||||
result += invIfChanged(byte, myOldRAM[i+j]);
|
||||
result += " ";
|
||||
|
||||
if(j == 0x07) result += "- ";
|
||||
if(j == 0x07) result += " ";
|
||||
}
|
||||
result += "\n";
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Debugger.hxx,v 1.38 2005-07-02 17:15:41 urchlay Exp $
|
||||
// $Id: Debugger.hxx,v 1.39 2005-07-02 18:03:09 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DEBUGGER_HXX
|
||||
|
@ -51,7 +51,7 @@ enum {
|
|||
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Debugger.hxx,v 1.38 2005-07-02 17:15:41 urchlay Exp $
|
||||
@version $Id: Debugger.hxx,v 1.39 2005-07-02 18:03:09 urchlay Exp $
|
||||
*/
|
||||
class Debugger : public DialogContainer
|
||||
{
|
||||
|
@ -172,7 +172,7 @@ class Debugger : public DialogContainer
|
|||
Return a formatted string containing the contents of the specified
|
||||
device.
|
||||
*/
|
||||
const string dumpRAM(uInt16 start);
|
||||
const string dumpRAM(uInt8 start = kRamStart, uInt8 len = 0x80);
|
||||
const string dumpTIA();
|
||||
|
||||
// Read and write 128-byte RAM area
|
||||
|
@ -240,7 +240,8 @@ class Debugger : public DialogContainer
|
|||
bool patchROM(int addr, int value);
|
||||
void saveState(int state);
|
||||
void loadState(int state);
|
||||
uInt8 oldRAM(uInt8 address);
|
||||
uInt8 oldRAM(uInt8 offset);
|
||||
bool ramChanged(uInt8 offset);
|
||||
|
||||
protected:
|
||||
const string invIfChanged(int reg, int oldReg);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: DebuggerParser.cxx,v 1.45 2005-07-02 15:31:30 urchlay Exp $
|
||||
// $Id: DebuggerParser.cxx,v 1.46 2005-07-02 18:03:09 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -1147,7 +1147,7 @@ void DebuggerParser::executePrint() {
|
|||
// "ram"
|
||||
void DebuggerParser::executeRam() {
|
||||
if(argCount == 0)
|
||||
commandResult = debugger->dumpRAM(kRamStart);
|
||||
commandResult = debugger->dumpRAM();
|
||||
else
|
||||
commandResult = debugger->setRAM(args);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue