Changing banks in the DASH debugger tab is now working.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2968 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-07-31 17:05:21 +00:00
parent af254b3d85
commit 05f455789e
3 changed files with 27 additions and 86 deletions

View File

@ -74,14 +74,12 @@ CartridgeDASHWidget::CartridgeDASHWidget(
new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("Slot "), new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("Slot "),
myLineHeight, bankno, "Slot ", myLineHeight, bankno, "Slot ",
6*_font.getMaxCharWidth()); 6*_font.getMaxCharWidth());
myBankNumber[i]->setTarget(this);
addFocusWidget(myBankNumber[i]); addFocusWidget(myBankNumber[i]);
xpos += myBankNumber[i]->getWidth(); xpos += myBankNumber[i]->getWidth();
myBankType[i] = myBankType[i] =
new PopUpWidget(boss, _font, xpos, ypos-2, 5*_font.getMaxCharWidth(), new PopUpWidget(boss, _font, xpos, ypos-2, 5*_font.getMaxCharWidth(),
myLineHeight, banktype, " of ", _font.getStringWidth(" of ")); myLineHeight, banktype, " of ", _font.getStringWidth(" of "));
myBankType[i]->setTarget(this);
addFocusWidget(myBankType[i]); addFocusWidget(myBankType[i]);
xpos += myBankType[i]->getWidth() + 10; xpos += myBankType[i]->getWidth() + 10;
@ -142,58 +140,41 @@ void CartridgeDASHWidget::loadConfig()
void CartridgeDASHWidget::handleCommand(CommandSender* sender, void CartridgeDASHWidget::handleCommand(CommandSender* sender,
int cmd, int data, int id) int cmd, int data, int id)
{ {
uInt8 bank = 0x00; uInt16 segment = 0;
switch(cmd) switch(cmd)
{ {
case kBank0Changed: case kBank0Changed:
cerr << " 0" << endl; segment = 0;
break; break;
case kBank1Changed: case kBank1Changed:
cerr << " 1" << endl; segment = 1;
break; break;
case kBank2Changed: case kBank2Changed:
cerr << " 2" << endl; segment = 2;
break; break;
case kBank3Changed: case kBank3Changed:
cerr << " 3" << endl; segment = 3;
break; break;
} }
#if 0 // Ignore bank if either number or type hasn't been selected
if(cmd == kROMBankChanged) if(myBankNumber[segment]->getSelected() < 0 ||
{ myBankType[segment]->getSelected() < 0)
if(myROMBank->getSelected() < (int)myNumRomBanks) return;
{
bank = myROMBank->getSelected(); uInt8 bank = (segment << myCart.BANK_BITS) |
myRAMBank->setSelectedMax(); (myBankNumber[segment]->getSelected() & myCart.BIT_BANK_MASK);
}
else
{
bank = 256; // default to first RAM bank
myRAMBank->setSelectedIndex(0);
}
}
else if(cmd == kRAMBankChanged)
{
if(myRAMBank->getSelected() < (int)myNumRamBanks)
{
myROMBank->setSelectedMax();
bank = myRAMBank->getSelected() + 256;
}
else
{
bank = 0; // default to first ROM bank
myROMBank->setSelectedIndex(0);
}
}
myCart.unlockBank(); myCart.unlockBank();
myCart.bank(bank);
if(myBankType[segment]->getSelectedTag() == "ROM")
myCart.bankROM(bank);
else
myCart.bankRAM(bank);
myCart.lockBank(); myCart.lockBank();
invalidate(); invalidate();
updateUIState(); updateUIState();
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -153,7 +153,8 @@ void DebuggerDialog::handleCommand(CommandSender* sender, int cmd,
break; break;
case RomWidget::kInvalidateListing: case RomWidget::kInvalidateListing:
myRom->invalidate(); // Only do a full redraw if the disassembly tab is actually showing
myRom->invalidate(myRomTab->getActiveTab() == 0);
break; break;
default: default:

View File

@ -143,14 +143,16 @@ uInt8 CartridgeDASH::peek(uInt16 address) {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeDASH::poke(uInt16 address, uInt8 value) { bool CartridgeDASH::poke(uInt16 address, uInt8 value) {
bool changed = false;
// Check for write to the bank switch address. RAM/ROM and bank # are encoded in 'value' // Check for write to the bank switch address. RAM/ROM and bank # are encoded in 'value'
// There are NO mirrored hotspots. // There are NO mirrored hotspots.
if (address == BANK_SWITCH_HOTSPOT_RAM) if (address == BANK_SWITCH_HOTSPOT_RAM)
myBankChanged = bankRAM(value); changed = bankRAM(value);
else if (address == BANK_SWITCH_HOTSPOT_ROM) else if (address == BANK_SWITCH_HOTSPOT_ROM)
myBankChanged = bankROM(value); changed = bankROM(value);
// Pass the poke through to the TIA. In a real Atari, both the cart and the // Pass the poke through to the TIA. In a real Atari, both the cart and the
// TIA see the address lines, and both react accordingly. In Stella, each // TIA see the address lines, and both react accordingly. In Stella, each
@ -158,7 +160,7 @@ bool CartridgeDASH::poke(uInt16 address, uInt8 value) {
// don't chain the poke to the TIA, then the TIA can't see it... // don't chain the poke to the TIA, then the TIA can't see it...
mySystem->tia().poke(address, value); mySystem->tia().poke(address, value);
return myBankChanged; return changed;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -174,28 +176,7 @@ bool CartridgeDASH::bankRAM(uInt8 bank) {
// Remember that this hotspot was accessed for RAM // Remember that this hotspot was accessed for RAM
segmentInUse[(bank >> BANK_BITS) & 3] = bank | BITMASK_ROMRAM; segmentInUse[(bank >> BANK_BITS) & 3] = bank | BITMASK_ROMRAM;
#if 0 return myBankChanged = true;
cerr << "\nBANK CONTENTS: -------------------------------------\n";
for (uInt32 b = 0; b < 8; b++)
{
//cerr << (int)bankInUse[b] << endl;
if(bankInUse[b] == BANK_UNDEFINED)
cerr << "bankInUse[" << b << "] -> " << dec << (int)BANK_UNDEFINED << endl;
else
{
cerr << "bankInUse[" << b << "] -> " << Common::Base::HEX4 << (int)bankInUse[b] << " "
<< Common::Base::toString(bankInUse[b], Common::Base::F_2_16);
if(bankInUse[b] & BITMASK_ROMRAM)
cerr << " (RAM) " << ((bankInUse[b] & BITMASK_LOWERUPPER) ? "(write)" : "(read)") << endl;
else
cerr << " (ROM) " << ((bankInUse[b] & BITMASK_LOWERUPPER) ? "(upper)" : "(lower)") << endl;
}
}
cerr << "----------------------------------------------------\n\n";
#endif
return true;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -253,29 +234,7 @@ bool CartridgeDASH::bankROM(uInt8 bank) {
// Remember that this hotspot was accessed for ROM // Remember that this hotspot was accessed for ROM
segmentInUse[(bank >> BANK_BITS) & 3] = bank; segmentInUse[(bank >> BANK_BITS) & 3] = bank;
return myBankChanged = true;
#if 0
cerr << "\nBANK CONTENTS: -------------------------------------\n";
for (uInt32 b = 0; b < 8; b++)
{
//cerr << (int)bankInUse[b] << endl;
if(bankInUse[b] == BANK_UNDEFINED)
cerr << "bankInUse[" << b << "] -> " << dec << (int)BANK_UNDEFINED << endl;
else
{
cerr << "bankInUse[" << b << "] -> " << Common::Base::HEX4 << (int)bankInUse[b] << " "
<< Common::Base::toString(bankInUse[b], Common::Base::F_2_16);
if(bankInUse[b] & BITMASK_ROMRAM)
cerr << " (RAM) " << ((bankInUse[b] & BITMASK_LOWERUPPER) ? "(write)" : "(read)") << endl;
else
cerr << " (ROM) " << ((bankInUse[b] & BITMASK_LOWERUPPER) ? "(upper)" : "(lower)") << endl;
}
}
cerr << "----------------------------------------------------\n\n";
#endif
return true;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -