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

View File

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

View File

@ -143,14 +143,16 @@ uInt8 CartridgeDASH::peek(uInt16 address) {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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'
// There are NO mirrored hotspots.
if (address == BANK_SWITCH_HOTSPOT_RAM)
myBankChanged = bankRAM(value);
changed = bankRAM(value);
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
// 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...
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
segmentInUse[(bank >> BANK_BITS) & 3] = bank | BITMASK_ROMRAM;
#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;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -253,29 +234,7 @@ bool CartridgeDASH::bankROM(uInt8 bank) {
// Remember that this hotspot was accessed for ROM
segmentInUse[(bank >> BANK_BITS) & 3] = bank;
#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;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -