From af254b3d85f231cd26d186900ea66c1674f7e261 Mon Sep 17 00:00:00 2001 From: stephena Date: Thu, 31 Jul 2014 15:54:14 +0000 Subject: [PATCH] Fixed DASH bug when changing banks; the debugger didn't recognize the change, and hence didn't re-disassemble. Fixed long-standing bug in the debugger disassembly; addresses marked as $F000 (or equivalent) were never being highlighted in the disassembly view. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2967 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- Changes.txt | 3 +++ src/debugger/CartDebug.cxx | 4 ++-- src/debugger/gui/CartDASHWidget.cxx | 4 ++-- src/emucore/Cart.cxx | 3 +-- src/emucore/CartDASH.cxx | 19 ++++++++----------- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Changes.txt b/Changes.txt index 9db281c31..a60cc533d 100644 --- a/Changes.txt +++ b/Changes.txt @@ -18,6 +18,9 @@ with certain bankswitch types. The bankswitch UI should now be used to query/set bank state. + * Fixed bug in disassembly output; instructions at $F000 were never + being highlighted during execution. + * The UNIX configure script now supports newer versions of Hurd. Special thanks to Stephen Kitt for the patch. diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 38e418fe6..efe956c13 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -316,8 +316,8 @@ bool CartDebug::fillDisassemblyList(BankInfo& info, uInt16 search) const DisassemblyTag& tag = myDisassembly.list[i]; const uInt16 address = tag.address & 0xFFF; - // Addresses marked as 'ROW' normally won't have an address - if(address) + // Exclude 'ROW'; they don't have a valid address + if(tag.type != CartDebug::ROW) { // Create a mapping from addresses to line numbers myAddrToLineList.insert(make_pair(address, i)); diff --git a/src/debugger/gui/CartDASHWidget.cxx b/src/debugger/gui/CartDASHWidget.cxx index 3094d4ee8..8b626163d 100644 --- a/src/debugger/gui/CartDASHWidget.cxx +++ b/src/debugger/gui/CartDASHWidget.cxx @@ -140,9 +140,9 @@ void CartridgeDASHWidget::loadConfig() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeDASHWidget::handleCommand(CommandSender* sender, - int cmd, int data, int id) + int cmd, int data, int id) { -// uInt8 bank = 0x00; + uInt8 bank = 0x00; switch(cmd) { diff --git a/src/emucore/Cart.cxx b/src/emucore/Cart.cxx index 7662ae786..50aae20fd 100644 --- a/src/emucore/Cart.cxx +++ b/src/emucore/Cart.cxx @@ -323,8 +323,7 @@ bool Cartridge::save(ofstream& out) return false; } - for(int i=0; i> BANK_BITS) & 3; - segmentInUse[bankNumber] = bank | BITMASK_ROMRAM; + segmentInUse[(bank >> BANK_BITS) & 3] = bank | BITMASK_ROMRAM; +#if 0 cerr << "\nBANK CONTENTS: -------------------------------------\n"; for (uInt32 b = 0; b < 8; b++) { @@ -194,7 +192,7 @@ bool CartridgeDASH::bankRAM(uInt8 bank) { } } cerr << "----------------------------------------------------\n\n"; - +#endif return true; @@ -209,8 +207,7 @@ void CartridgeDASH::bankRAMSlot(uInt16 bank) { uInt16 currentBank = bank & BIT_BANK_MASK; // Wrap around/restrict to valid range bool upper = bank & BITMASK_LOWERUPPER; // is this the read or write port - uInt32 startCurrentBank = currentBank << RAM_BANK_TO_POWER; // Effectively * 512 bytes - uInt32 blockSize = 1 << shift; + uInt32 startCurrentBank = currentBank << RAM_BANK_TO_POWER; // Effectively * 512 bytes // Setup the page access methods for the current bank System::PageAccess access(this, System::PA_READ); @@ -230,7 +227,7 @@ void CartridgeDASH::bankRAMSlot(uInt16 bank) { uInt32 start = 0x1000 + (bankNumber << RAM_BANK_TO_POWER) + (upper ? RAM_WRITE_OFFSET : 0); uInt32 end = start + RAM_BANK_SIZE - 1; - for (uInt32 address = start; address <= end; address += blockSize) { + for (uInt32 address = start; address <= end; address += (1 << shift)) { if(upper) access.directPokeBase = &myRAM[startCurrentBank + (address & (RAM_BANK_SIZE - 1))]; else @@ -254,10 +251,10 @@ bool CartridgeDASH::bankROM(uInt8 bank) { bankROMSlot(bank | BITMASK_LOWERUPPER); // Remember that this hotspot was accessed for ROM - uInt8 bankNumber = (bank >> BANK_BITS) & 3; - segmentInUse[bankNumber] = bank; + segmentInUse[(bank >> BANK_BITS) & 3] = bank; +#if 0 cerr << "\nBANK CONTENTS: -------------------------------------\n"; for (uInt32 b = 0; b < 8; b++) { @@ -275,7 +272,7 @@ bool CartridgeDASH::bankROM(uInt8 bank) { } } cerr << "----------------------------------------------------\n\n"; - +#endif return true;