mirror of https://github.com/stella-emu/stella.git
Prompt now shows RAM locations that have changed since the last RAM command
in inverse video. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@592 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
040a8d7d22
commit
3501378714
|
@ -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.44 2005-07-02 15:31:30 urchlay Exp $
|
||||
// $Id: Debugger.cxx,v 1.45 2005-07-02 17:15:41 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -129,6 +129,9 @@ void Debugger::setConsole(Console* console)
|
|||
myDebugger = new D6502(mySystem);
|
||||
|
||||
autoLoadSymbols(myOSystem->romFile());
|
||||
|
||||
for(int i=0; i<0x80; i++)
|
||||
myOldRAM[i] = readRAM(i);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -286,19 +289,35 @@ void Debugger::formatFlags(int f, char *out) {
|
|||
out[8] = '\0';
|
||||
}
|
||||
|
||||
/* Danger: readRAM() and writeRAM() take an *offset* into RAM, *not* an
|
||||
actual address. This means you don't get to use these to read/write
|
||||
outside of the RIOT RAM. It also means that e.g. to read location 0x80,
|
||||
you pass 0 (because 0x80 is the 0th byte of RAM).
|
||||
|
||||
However, setRAM() actually uses addresses, not offsets. This means that
|
||||
setRAM() can poke anywhere in the address space. However, it still can't
|
||||
change ROM: you use patchROM() for that. setRAM() *can* trigger a bank
|
||||
switch, if you poke to the "hot spot" for the cartridge.
|
||||
*/
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 Debugger::readRAM(uInt16 addr)
|
||||
uInt8 Debugger::readRAM(uInt16 offset)
|
||||
{
|
||||
return mySystem->peek(addr + kRamStart);
|
||||
offset &= 0x7f; // there are only 128 bytes
|
||||
return mySystem->peek(offset + kRamStart);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::writeRAM(uInt16 addr, uInt8 value)
|
||||
void Debugger::writeRAM(uInt16 offset, uInt8 value)
|
||||
{
|
||||
mySystem->poke(addr + kRamStart, value);
|
||||
offset &= 0x7f; // there are only 128 bytes
|
||||
mySystem->poke(offset + kRamStart, value);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
/* Element 0 of args is the address. The remaining elements are the data
|
||||
to poke, starting at the given address.
|
||||
*/
|
||||
const string Debugger::setRAM(IntArray args) {
|
||||
char buf[10];
|
||||
|
||||
|
@ -311,11 +330,18 @@ const string Debugger::setRAM(IntArray args) {
|
|||
sprintf(buf, "%d", count-1);
|
||||
ret += buf;
|
||||
ret += " location";
|
||||
if(count > 2)
|
||||
if(count != 0)
|
||||
ret += "s";
|
||||
return ret;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 Debugger::oldRAM(uInt8 offset)
|
||||
{
|
||||
offset &= 0x7f;
|
||||
return myOldRAM[offset];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const string Debugger::dumpRAM(uInt16 start)
|
||||
{
|
||||
|
@ -329,8 +355,14 @@ const string Debugger::dumpRAM(uInt16 start)
|
|||
|
||||
for (uInt8 j = 0; j < 0x010; j++)
|
||||
{
|
||||
sprintf(buf, "%.2x ", mySystem->peek(start+i+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 += " ";
|
||||
|
||||
if(j == 0x07) result += "- ";
|
||||
}
|
||||
|
@ -673,6 +705,7 @@ string Debugger::disassemble(int start, int lines) {
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::nextFrame(int frames) {
|
||||
saveRegs();
|
||||
myOSystem->frameBuffer().advance(frames);
|
||||
myBaseDialog->loadConfig();
|
||||
}
|
||||
|
@ -768,6 +801,9 @@ bool Debugger::patchROM(int addr, int value) {
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::saveRegs() {
|
||||
for(int i=0; i<0x80; i++) {
|
||||
myOldRAM[i] = readRAM(i);
|
||||
}
|
||||
oldA = getA();
|
||||
oldX = getX();
|
||||
oldY = getY();
|
||||
|
|
|
@ -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.37 2005-07-02 15:31:30 urchlay Exp $
|
||||
// $Id: Debugger.hxx,v 1.38 2005-07-02 17:15:41 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.37 2005-07-02 15:31:30 urchlay Exp $
|
||||
@version $Id: Debugger.hxx,v 1.38 2005-07-02 17:15:41 urchlay Exp $
|
||||
*/
|
||||
class Debugger : public DialogContainer
|
||||
{
|
||||
|
@ -240,6 +240,7 @@ class Debugger : public DialogContainer
|
|||
bool patchROM(int addr, int value);
|
||||
void saveState(int state);
|
||||
void loadState(int state);
|
||||
uInt8 oldRAM(uInt8 address);
|
||||
|
||||
protected:
|
||||
const string invIfChanged(int reg, int oldReg);
|
||||
|
@ -256,6 +257,7 @@ class Debugger : public DialogContainer
|
|||
PromptWidget *myPrompt;
|
||||
TIADebug *myTIAdebug;
|
||||
|
||||
uInt8 myOldRAM[128];
|
||||
int oldA;
|
||||
int oldX;
|
||||
int oldY;
|
||||
|
|
|
@ -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: Console.cxx,v 1.63 2005-06-29 13:11:03 stephena Exp $
|
||||
// $Id: Console.cxx,v 1.64 2005-07-02 17:15:41 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -152,6 +152,7 @@ Console::Console(const uInt8* image, uInt32 size, OSystem* osystem)
|
|||
// Remember what my media source is
|
||||
myMediaSource = tia;
|
||||
myCart = cartridge;
|
||||
myRiot = m6532;
|
||||
|
||||
// Reset, the system to its power-on state
|
||||
mySystem->reset();
|
||||
|
|
|
@ -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: Console.hxx,v 1.36 2005-06-29 13:11:03 stephena Exp $
|
||||
// $Id: Console.hxx,v 1.37 2005-07-02 17:15:42 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef CONSOLE_HXX
|
||||
|
@ -31,12 +31,13 @@ class System;
|
|||
#include "Props.hxx"
|
||||
#include "TIA.hxx"
|
||||
#include "Cart.hxx"
|
||||
#include "M6532.hxx"
|
||||
|
||||
/**
|
||||
This class represents the entire game console.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: Console.hxx,v 1.36 2005-06-29 13:11:03 stephena Exp $
|
||||
@version $Id: Console.hxx,v 1.37 2005-07-02 17:15:42 urchlay Exp $
|
||||
*/
|
||||
class Console
|
||||
{
|
||||
|
@ -109,6 +110,13 @@ class Console
|
|||
*/
|
||||
Cartridge& cartridge() const { return *myCart; }
|
||||
|
||||
/**
|
||||
Get the 6532 used by the console
|
||||
|
||||
@return The 6532 for this console
|
||||
*/
|
||||
M6532& riot() const { return *myRiot; }
|
||||
|
||||
public:
|
||||
/**
|
||||
Overloaded assignment operator
|
||||
|
@ -238,6 +246,10 @@ class Console
|
|||
|
||||
// Pointer to the Cartridge (the debugger needs it)
|
||||
Cartridge *myCart;
|
||||
|
||||
// Pointer to the 6532 (aka RIOT) (the debugger needs it)
|
||||
// A RIOT of my own! (...with apologies to The Clash...)
|
||||
M6532 *myRiot;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue