Improved DASH bank state display in the debugger; it now shows info from

all 8 'slots'.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2973 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-08-09 01:04:46 +00:00
parent 4bc632644c
commit a7aece9d36
2 changed files with 49 additions and 24 deletions

View File

@ -181,24 +181,62 @@ void CartridgeDASHWidget::handleCommand(CommandSender* sender,
string CartridgeDASHWidget::bankState() string CartridgeDASHWidget::bankState()
{ {
ostringstream& buf = buffer(); ostringstream& buf = buffer();
int lastROMBank = -1;
bool lastSlotRAM = false;
for(int i = 0; i < 4; ++i) for(int i = 0; i < 8; ++i)
{ {
uInt16 segment = myCart.segmentInUse[i]; uInt16 bank = myCart.bankInUse[i];
if(segment == myCart.BANK_UNDEFINED) if(bank == myCart.BANK_UNDEFINED) // never accessed
{ {
buf << "undefined"; buf << " U!";
} }
else else
{ {
int number = segment & myCart.BIT_BANK_MASK; int bankno = bank & myCart.BIT_BANK_MASK;
const char* type = segment & myCart.BITMASK_ROMRAM ? "RAM" : "ROM";
buf << type << " " << number; if(bank & myCart.BITMASK_ROMRAM) // was RAM mapped here?
{
// RAM will always need a '+' placed somewhere, since it always
// consists of 512B segments
bool inFirstSlot = (i % 2 == 0);
if(!(inFirstSlot || lastSlotRAM))
{
lastSlotRAM = false;
buf << " +";
}
if(bank & myCart.BITMASK_LOWERUPPER) // upper is write port
buf << " RAM " << bankno << "W";
else
buf << " RAM " << bankno << "R";
if(inFirstSlot)
{
buf << " +";
lastSlotRAM = true;
}
}
else
{
// ROM can be contiguous, since 2 512B segments can form a single
// 1K bank; in this case we only show the info once
bool highBankSame = (i % 2 == 1) && (bankno == lastROMBank);
if(!highBankSame)
{
buf << " ROM " << bankno;
lastROMBank = bankno;
}
else
lastROMBank = -1;
lastSlotRAM = false;
}
} }
if(i < 3)
buf << " / "; if((i+1) % 2 == 0 && i < 7)
buf << " /";
} }
return buf.str(); return buf.str();
@ -273,19 +311,6 @@ void CartridgeDASHWidget::updateUIState()
} }
} }
} }
#if 0
if(myCart.myCurrentBank < 256)
{
myROMBank->setSelectedIndex(myCart.myCurrentBank % myNumRomBanks);
myRAMBank->setSelectedMax();
}
else
{
myROMBank->setSelectedMax();
myRAMBank->setSelectedIndex(myCart.myCurrentBank - 256);
}
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -46,9 +46,9 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
// Show current bank state // Show current bank state
xpos = x; ypos = y + 7; xpos = x; ypos = y + 7;
t = new StaticTextWidget(boss, lfont, xpos, ypos, t = new StaticTextWidget(boss, lfont, xpos, ypos,
lfont.getStringWidth("Bank state: "), lfont.getStringWidth("Bank:"),
lfont.getFontHeight(), lfont.getFontHeight(),
"Bank state: ", kTextAlignLeft); "Bank:", kTextAlignLeft);
xpos += t->getWidth() + 5; xpos += t->getWidth() + 5;
myBank = new EditTextWidget(boss, nfont, xpos, ypos-1, myBank = new EditTextWidget(boss, nfont, xpos, ypos-1,