The System 'dirty page' code is now connected to CartDebug. It now tests

whether the range 0x1000 - 0x1FFF (aka cart space) has been modified, and
if so, it forces a re-disassembly.  Still TODO is modify all the cart
classes that manually handle poke operations to set the page as dirty
when a write actually succeeds.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1974 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-03-26 01:33:40 +00:00
parent 2b384e2353
commit 8fe2d5f6c1
4 changed files with 14 additions and 10 deletions

View File

@ -190,8 +190,8 @@ bool CartDebug::disassemble(const string& autocode, bool force)
// Also check if the current PC is in the current list // Also check if the current PC is in the current list
uInt16 PC = myDebugger.cpuDebug().pc(); uInt16 PC = myDebugger.cpuDebug().pc();
int pcline = addressToLine(PC); int pcline = addressToLine(PC);
bool changed = force || myConsole.cartridge().bankChanged() || bool changed = (force || myConsole.cartridge().bankChanged() ||
(pcline == -1); (pcline == -1) || mySystem.isPageDirty(0x1000, 0x1FFF));
if(changed) if(changed)
{ {
// Look at previous accesses to this bank to begin // Look at previous accesses to this bank to begin

View File

@ -455,6 +455,7 @@ void Debugger::loadState(int state)
int Debugger::step() int Debugger::step()
{ {
saveOldState(); saveOldState();
mySystem->clearDirtyPages();
int cyc = mySystem->cycles(); int cyc = mySystem->cycles();
@ -482,6 +483,7 @@ int Debugger::trace()
if(mySystem->peek(myCpuDebug->pc()) == 32) if(mySystem->peek(myCpuDebug->pc()) == 32)
{ {
saveOldState(); saveOldState();
mySystem->clearDirtyPages();
int cyc = mySystem->cycles(); int cyc = mySystem->cycles();
int targetPC = myCpuDebug->pc() + 3; // return address int targetPC = myCpuDebug->pc() + 3; // return address
@ -565,6 +567,7 @@ int Debugger::cycles()
void Debugger::nextScanline(int lines) void Debugger::nextScanline(int lines)
{ {
saveOldState(); saveOldState();
mySystem->clearDirtyPages();
unlockBankswitchState(); unlockBankswitchState();
while(lines) while(lines)
@ -579,6 +582,7 @@ void Debugger::nextScanline(int lines)
void Debugger::nextFrame(int frames) void Debugger::nextFrame(int frames)
{ {
saveOldState(); saveOldState();
mySystem->clearDirtyPages();
unlockBankswitchState(); unlockBankswitchState();
while(frames) while(frames)

View File

@ -166,7 +166,7 @@ void System::setPageAccess(uInt16 page, const PageAccess& access)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const System::PageAccess& System::getPageAccess(uInt16 page) const System::PageAccess& System::getPageAccess(uInt16 page) const
{ {
// Make sure the page is within range // Make sure the page is within range
assert(page <= myNumberOfPages); assert(page <= myNumberOfPages);
@ -175,13 +175,13 @@ const System::PageAccess& System::getPageAccess(uInt16 page)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void System::setDirtyAddress(uInt16 addr) void System::setDirtyPage(uInt16 addr)
{ {
myPageIsDirtyTable[(addr & myAddressMask) >> myPageShift] = true; myPageIsDirtyTable[(addr & myAddressMask) >> myPageShift] = true;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool System::isDirtyRange(uInt16 start_addr, uInt16 end_addr) bool System::isPageDirty(uInt16 start_addr, uInt16 end_addr) const
{ {
uInt16 start_page = (start_addr & myAddressMask) >> myPageShift; uInt16 start_page = (start_addr & myAddressMask) >> myPageShift;
uInt16 end_page = (end_addr & myAddressMask) >> myPageShift; uInt16 end_page = (end_addr & myAddressMask) >> myPageShift;
@ -194,7 +194,7 @@ bool System::isDirtyRange(uInt16 start_addr, uInt16 end_addr)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void System::clearDirtyAddresses() void System::clearDirtyPages()
{ {
for(uInt32 i = 0; i < myNumberOfPages; ++i) for(uInt32 i = 0; i < myNumberOfPages; ++i)
myPageIsDirtyTable[i] = false; myPageIsDirtyTable[i] = false;

View File

@ -334,14 +334,14 @@ class System : public Serializable
@param page The page to get accessing methods for @param page The page to get accessing methods for
@return The accessing methods used by the page @return The accessing methods used by the page
*/ */
const PageAccess& getPageAccess(uInt16 page); const PageAccess& getPageAccess(uInt16 page) const;
/** /**
Mark the page containing this address as being dirty. Mark the page containing this address as being dirty.
@param addr Determines the page that is dirty @param addr Determines the page that is dirty
*/ */
void setDirtyAddress(uInt16 addr); void setDirtyPage(uInt16 addr);
/** /**
Answer whether any pages in given range of addresses have been Answer whether any pages in given range of addresses have been
@ -350,12 +350,12 @@ class System : public Serializable
@param start_addr The start address; determines the start page @param start_addr The start address; determines the start page
@param end_addr The end address; determines the end page @param end_addr The end address; determines the end page
*/ */
bool isDirtyRange(uInt16 start_addr, uInt16 end_addr); bool isPageDirty(uInt16 start_addr, uInt16 end_addr) const;
/** /**
Mark all pages as clean (ie, turn off the dirty flag). Mark all pages as clean (ie, turn off the dirty flag).
*/ */
void clearDirtyAddresses(); void clearDirtyPages();
/** /**
Save the current state of this system to the given Serializer. Save the current state of this system to the given Serializer.