From 4233fa3ae40871e186c41782be1207bd7aa0f98a Mon Sep 17 00:00:00 2001 From: urchlay Date: Thu, 13 Oct 2005 00:59:30 +0000 Subject: [PATCH] RomWidget now saves cart bankswitch state before disassembly and restores it afterwards. Also, fixed the debugger "bank" command. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@827 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/debugger/Debugger.cxx | 5 ++++- stella/src/debugger/gui/RomWidget.cxx | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/stella/src/debugger/Debugger.cxx b/stella/src/debugger/Debugger.cxx index 7120f6a9d..5214c9e5d 100644 --- a/stella/src/debugger/Debugger.cxx +++ b/stella/src/debugger/Debugger.cxx @@ -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.98 2005-10-12 03:32:28 urchlay Exp $ +// $Id: Debugger.cxx,v 1.99 2005-10-13 00:59:30 urchlay Exp $ //============================================================================ #include "bspf.hxx" @@ -916,7 +916,9 @@ void Debugger::reloadROM() { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Debugger::setBank(int bank) { if(myConsole->cartridge().bankCount() > 1) { + myConsole->cartridge().unlockBank(); myConsole->cartridge().bank(bank); + myConsole->cartridge().lockBank(); return true; } return false; @@ -953,6 +955,7 @@ void Debugger::saveOldState() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Debugger::setStartState() { + cerr << "Debugger::setStartState()" << endl; // Lock the bus each time the debugger is entered, so we don't disturb anything // mySystem->lockDataBus(); lockState(); diff --git a/stella/src/debugger/gui/RomWidget.cxx b/stella/src/debugger/gui/RomWidget.cxx index f7eb8d4d5..0a9dd0dfa 100644 --- a/stella/src/debugger/gui/RomWidget.cxx +++ b/stella/src/debugger/gui/RomWidget.cxx @@ -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: RomWidget.cxx,v 1.9 2005-10-12 03:32:28 urchlay Exp $ +// $Id: RomWidget.cxx,v 1.10 2005-10-13 00:59:30 urchlay Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -43,6 +43,8 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y) mySourceAvailable(false), myCurrentBank(-1) { + cerr << "new RomWidget()" << endl; + int w = 58 * font.getMaxCharWidth(), h = 31 * font.getLineHeight(); @@ -160,6 +162,9 @@ void RomWidget::initialUpdate() Debugger& dbg = instance()->debugger(); PackedBitArray* bp = dbg.breakpoints(); + // Reading from ROM might trigger a bankswitch, so save the current bank + myCurrentBank = dbg.getBank(); + // Fill romlist the current bank of source or disassembly if(mySourceAvailable) ; // TODO - actually implement this @@ -189,6 +194,9 @@ void RomWidget::initialUpdate() myRomList->setList(label, data, disasm, state); } + + // Restore the old bank, in case we inadvertently switched while reading. + dbg.setBank(myCurrentBank); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -