mirror of https://github.com/stella-emu/stella.git
Fixed segfault that could occur on startup when a ROM triggered a read
from the write port. Basically, the cartdebug class depended on the console existing, but it wasn't being created until after it was required. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1979 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
088e3e954f
commit
4c75e52a96
|
@ -208,10 +208,6 @@ void Debugger::setConsole(Console* console)
|
||||||
|
|
||||||
// FIXME - these will probably be removed
|
// FIXME - these will probably be removed
|
||||||
// loadListFile();
|
// loadListFile();
|
||||||
|
|
||||||
// Make sure cart RAM is added before this is called,
|
|
||||||
// otherwise the debugger state won't know about it
|
|
||||||
saveOldState(false); // don't add the state to the rewind list
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -668,6 +664,9 @@ void Debugger::setStartState()
|
||||||
|
|
||||||
// Start a new rewind list
|
// Start a new rewind list
|
||||||
myRewindManager->clear();
|
myRewindManager->clear();
|
||||||
|
|
||||||
|
// Save initial state, but don't add it to the rewind list
|
||||||
|
saveOldState(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -286,7 +286,6 @@ void Cartridge::registerRamArea(uInt16 start, uInt16 size,
|
||||||
void Cartridge::triggerReadFromWritePort(uInt16 address)
|
void Cartridge::triggerReadFromWritePort(uInt16 address)
|
||||||
{
|
{
|
||||||
#ifdef DEBUGGER_SUPPORT
|
#ifdef DEBUGGER_SUPPORT
|
||||||
if(&Debugger::debugger().cartDebug())
|
|
||||||
Debugger::debugger().cartDebug().triggerReadFromWritePort(address);
|
Debugger::debugger().cartDebug().triggerReadFromWritePort(address);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,6 +111,12 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
|
||||||
mySystem->attach(myTIA);
|
mySystem->attach(myTIA);
|
||||||
mySystem->attach(myCart);
|
mySystem->attach(myCart);
|
||||||
|
|
||||||
|
#ifdef DEBUGGER_SUPPORT
|
||||||
|
// The debugger must be added before we run the console for the first time
|
||||||
|
myOSystem->debugger().setConsole(this);
|
||||||
|
myOSystem->debugger().initialize();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Auto-detect NTSC/PAL mode if it's requested
|
// Auto-detect NTSC/PAL mode if it's requested
|
||||||
string autodetected = "";
|
string autodetected = "";
|
||||||
myDisplayFormat = myProperties.get(Display_Format);
|
myDisplayFormat = myProperties.get(Display_Format);
|
||||||
|
|
|
@ -511,10 +511,6 @@ bool OSystem::createConsole(const string& romfile, const string& md5sum)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(!audiofirst) myConsole->initializeAudio();
|
if(!audiofirst) myConsole->initializeAudio();
|
||||||
#ifdef DEBUGGER_SUPPORT
|
|
||||||
myDebugger->setConsole(myConsole);
|
|
||||||
myDebugger->initialize();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(showmessage)
|
if(showmessage)
|
||||||
myFrameBuffer->showMessage("New console created");
|
myFrameBuffer->showMessage("New console created");
|
||||||
|
|
|
@ -56,6 +56,7 @@ System::System(uInt16 n, uInt16 m)
|
||||||
for(int page = 0; page < myNumberOfPages; ++page)
|
for(int page = 0; page < myNumberOfPages; ++page)
|
||||||
{
|
{
|
||||||
setPageAccess(page, access);
|
setPageAccess(page, access);
|
||||||
|
myPageIsDirtyTable[page] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bus starts out unlocked (in other words, peek() changes myDataBusState)
|
// Bus starts out unlocked (in other words, peek() changes myDataBusState)
|
||||||
|
@ -99,6 +100,9 @@ void System::reset()
|
||||||
{
|
{
|
||||||
myM6502->reset();
|
myM6502->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// There are no dirty pages upon startup
|
||||||
|
clearDirtyPages();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -157,7 +161,7 @@ void System::resetCycles()
|
||||||
void System::setPageAccess(uInt16 page, const PageAccess& access)
|
void System::setPageAccess(uInt16 page, const PageAccess& access)
|
||||||
{
|
{
|
||||||
// Make sure the page is within range
|
// Make sure the page is within range
|
||||||
assert(page <= myNumberOfPages);
|
assert(page < myNumberOfPages);
|
||||||
|
|
||||||
// Make sure the access methods make sense
|
// Make sure the access methods make sense
|
||||||
assert(access.device != 0);
|
assert(access.device != 0);
|
||||||
|
@ -169,7 +173,7 @@ void System::setPageAccess(uInt16 page, const PageAccess& access)
|
||||||
const System::PageAccess& System::getPageAccess(uInt16 page) const
|
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);
|
||||||
|
|
||||||
return myPageAccessTable[page];
|
return myPageAccessTable[page];
|
||||||
}
|
}
|
||||||
|
@ -253,8 +257,8 @@ void System::poke(uInt16 addr, uInt8 value)
|
||||||
if(access.directPokeBase != 0)
|
if(access.directPokeBase != 0)
|
||||||
{
|
{
|
||||||
// Since we have direct access to this poke, we can dirty its page
|
// Since we have direct access to this poke, we can dirty its page
|
||||||
myPageIsDirtyTable[page] = true;
|
|
||||||
*(access.directPokeBase + (addr & myPageMask)) = value;
|
*(access.directPokeBase + (addr & myPageMask)) = value;
|
||||||
|
myPageIsDirtyTable[page] = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,12 +41,6 @@ class NullDevice;
|
||||||
In general the addressing space will be 8192 (2^13) bytes for a
|
In general the addressing space will be 8192 (2^13) bytes for a
|
||||||
6507 based system and 65536 (2^16) bytes for a 6502 based system.
|
6507 based system and 65536 (2^16) bytes for a 6502 based system.
|
||||||
|
|
||||||
TODO: To allow for dynamic code generation we probably need to
|
|
||||||
add a tag to each page that indicates if it is read only
|
|
||||||
memory. We also need to notify the processor anytime a
|
|
||||||
page access method is changed so that it can clear the
|
|
||||||
dynamic code for that page of memory.
|
|
||||||
|
|
||||||
@author Bradford W. Mott
|
@author Bradford W. Mott
|
||||||
@version $Id$
|
@version $Id$
|
||||||
*/
|
*/
|
||||||
|
@ -378,7 +372,7 @@ class System : public Serializable
|
||||||
|
|
||||||
@return The name of the object
|
@return The name of the object
|
||||||
*/
|
*/
|
||||||
virtual string name() const { return "System"; }
|
string name() const { return "System"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Mask to apply to an address before accessing memory
|
// Mask to apply to an address before accessing memory
|
||||||
|
|
Loading…
Reference in New Issue