mirror of https://github.com/stella-emu/stella.git
refactored CartWDWidget and CartX07Widget
improved cart info formatting
This commit is contained in:
parent
faaf83b4ab
commit
2e2471db68
|
@ -51,7 +51,7 @@ string CartridgeE0Widget::romDescription()
|
|||
<< Common::Base::HEX4 << (ADDR_BASE | segmentOffset)
|
||||
<< " - $" << (ADDR_BASE | segmentOffset + /*myCart.myBankSize - 1*/ 0x3FF) << ",\n";
|
||||
if (seg < 3)
|
||||
info << " Hotspots " << hotspotStr(0, seg) << " - " << hotspotStr(7, seg) << "\n";
|
||||
info << " Hotspots " << hotspotStr(0, seg, true) << " - " << hotspotStr(7, seg, true) << "\n";
|
||||
else
|
||||
info << " Always points to last 1K bank of ROM\n";
|
||||
}
|
||||
|
@ -61,15 +61,14 @@ string CartridgeE0Widget::romDescription()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeE0Widget::hotspotStr(int bank, int segment)
|
||||
string CartridgeE0Widget::hotspotStr(int bank, int segment, bool noBrackets)
|
||||
{
|
||||
ostringstream info;
|
||||
uInt16 hotspot = myCart.hotspot();
|
||||
|
||||
if(hotspot & 0x1000)
|
||||
hotspot |= ADDR_BASE;
|
||||
|
||||
info << (noBrackets ? "" : "(");
|
||||
info << "$" << Common::Base::HEX1 << (hotspot + bank + segment * 8);
|
||||
info << (noBrackets ? "" : ")");
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class CartridgeE0Widget : public CartEnhancedWidget
|
|||
|
||||
string romDescription() override;
|
||||
|
||||
string hotspotStr(int bank, int segment) override;
|
||||
string hotspotStr(int bank, int segment, bool noBrackets = false) override;
|
||||
|
||||
int bankSegs() override { return 3; }
|
||||
|
||||
|
|
|
@ -96,18 +96,23 @@ string CartEnhancedWidget::romDescription()
|
|||
{
|
||||
uInt16 start = (image[offset + 1] << 8) | image[offset];
|
||||
start -= start % 0x1000;
|
||||
string hash = myCart.romBankCount() > 10 && bank < 10 ? " #" : "#";
|
||||
|
||||
info << "Bank #" << std::dec << bank << " @ $"
|
||||
<< Common::Base::HEX4 << (start + myCart.myRomOffset) << " - $" << (start + 0xFFF)
|
||||
<< " (hotspot " << hotspotStr(bank) << ")\n";
|
||||
info << "Bank " << hash << std::dec << bank << " @ $"
|
||||
<< Common::Base::HEX4 << (start + myCart.myRomOffset) << " - $" << (start + 0xFFF);
|
||||
if(myCart.hotspot() != 0)
|
||||
info << " " << hotspotStr(bank, 0, true);
|
||||
info << "\n";
|
||||
}
|
||||
info << "Startup bank = #" << std::dec << myCart.startBank() << " or undetermined\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
uInt16 start = (image[myCart.mySize - 3] << 8) | image[myCart.mySize - 4];
|
||||
uInt16 end;
|
||||
|
||||
start -= start % std::min(int(size), 0x1000);
|
||||
end = start + uInt16(myCart.mySize) - 1;
|
||||
// special check for ROMs where the extra RAM is not included in the image (e.g. CV).
|
||||
if((start & 0xFFF) < size)
|
||||
{
|
||||
|
@ -115,7 +120,7 @@ string CartEnhancedWidget::romDescription()
|
|||
}
|
||||
info << "ROM accessible @ $"
|
||||
<< Common::Base::HEX4 << start << " - $"
|
||||
<< Common::Base::HEX4 << (start + myCart.mySize - 1);
|
||||
<< Common::Base::HEX4 << end;
|
||||
}
|
||||
|
||||
return info.str();
|
||||
|
@ -133,7 +138,6 @@ void CartEnhancedWidget::bankSelect(int& ypos)
|
|||
for(int seg = 0; seg < bankSegs(); ++seg)
|
||||
{
|
||||
// fill bank and hotspot list
|
||||
uInt16 hotspot = myCart.hotspot();
|
||||
VariantList items;
|
||||
int pw = 0;
|
||||
|
||||
|
@ -142,8 +146,9 @@ void CartEnhancedWidget::bankSelect(int& ypos)
|
|||
ostringstream buf;
|
||||
|
||||
buf << std::setw(bank < 10 ? 2 : 1) << "#" << std::dec << bank;
|
||||
if(hotspot >= 0x100 && myHotspotDelta > 0)
|
||||
buf << " (" << hotspotStr(bank, seg) << ")";
|
||||
//if(myCart.hotspot() >= 0x100 && myHotspotDelta > 0)
|
||||
if(myCart.hotspot() != 0 && myHotspotDelta > 0)
|
||||
buf << " " << hotspotStr(bank, seg);
|
||||
VarList::push_back(items, buf.str());
|
||||
pw = std::max(pw, _font.getStringWidth(buf.str()));
|
||||
}
|
||||
|
@ -198,16 +203,17 @@ string CartEnhancedWidget::bankState()
|
|||
else if (hasRamBanks)
|
||||
buf << " ROM";
|
||||
|
||||
if(hotspot >= 0x100)
|
||||
buf << " (" << (bankSegs() < 3 ? "hotspot " : "") << hotspotStr(bank) << ")";
|
||||
//if(hotspot >= 0x100)
|
||||
if(hotspot != 0 && myHotspotDelta > 0)
|
||||
buf << " " << hotspotStr(bank, 0, bankSegs() < 3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
buf << "Bank #" << std::dec << myCart.getBank();
|
||||
|
||||
//if(hotspot >= 0x100)
|
||||
buf << " (hotspot " << hotspotStr(myCart.getSegmentBank()) << ")";
|
||||
if(hotspot != 0 && myHotspotDelta > 0)
|
||||
buf << " " << hotspotStr(myCart.getBank(), 0, true);
|
||||
}
|
||||
return buf.str();
|
||||
}
|
||||
|
@ -215,7 +221,7 @@ string CartEnhancedWidget::bankState()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartEnhancedWidget::hotspotStr(int bank, int segment)
|
||||
string CartEnhancedWidget::hotspotStr(int bank, int segment, bool prefix)
|
||||
{
|
||||
ostringstream info;
|
||||
uInt16 hotspot = myCart.hotspot();
|
||||
|
@ -223,7 +229,9 @@ string CartEnhancedWidget::hotspotStr(int bank, int segment)
|
|||
if(hotspot & 0x1000)
|
||||
hotspot |= ADDR_BASE;
|
||||
|
||||
info << "(" << (prefix ? "hotspot " : "");
|
||||
info << "$" << Common::Base::HEX1 << (hotspot + bank * myHotspotDelta);
|
||||
info << ")";
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
@ -242,8 +250,11 @@ void CartEnhancedWidget::saveOldState()
|
|||
myOldState.internalRam.push_back(myCart.myRAM[i]);
|
||||
|
||||
myOldState.banks.clear();
|
||||
for(int seg = 0; seg < bankSegs(); ++seg)
|
||||
myOldState.banks.push_back(myCart.getSegmentBank(seg));
|
||||
if (bankSegs() > 1)
|
||||
for(int seg = 0; seg < bankSegs(); ++seg)
|
||||
myOldState.banks.push_back(myCart.getSegmentBank(seg));
|
||||
else
|
||||
myOldState.banks.push_back(myCart.getBank());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -251,9 +262,13 @@ void CartEnhancedWidget::loadConfig()
|
|||
{
|
||||
if(myBankWidgets != nullptr)
|
||||
{
|
||||
for(int seg = 0; seg < bankSegs(); ++seg)
|
||||
myBankWidgets[seg]->setSelectedIndex(myCart.getSegmentBank(seg),
|
||||
myCart.getSegmentBank(seg) != myOldState.banks[seg]);
|
||||
if (bankSegs() > 1)
|
||||
for(int seg = 0; seg < bankSegs(); ++seg)
|
||||
myBankWidgets[seg]->setSelectedIndex(myCart.getSegmentBank(seg),
|
||||
myCart.getSegmentBank(seg) != myOldState.banks[seg]);
|
||||
else
|
||||
myBankWidgets[0]->setSelectedIndex(myCart.getBank(),
|
||||
myCart.getBank() != myOldState.banks[0]);
|
||||
}
|
||||
CartDebugWidget::loadConfig();
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class CartEnhancedWidget : public CartDebugWidget
|
|||
|
||||
virtual void bankSelect(int& ypos);
|
||||
|
||||
virtual string hotspotStr(int bank = 0, int segment = 0);
|
||||
virtual string hotspotStr(int bank = 0, int segment = 0, bool prefix = false);
|
||||
|
||||
virtual int bankSegs(); // { return myCart.myBankSegs; }
|
||||
|
||||
|
|
|
@ -41,12 +41,14 @@ string CartridgeUAWidget::description()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeUAWidget::hotspotStr(int bank, int)
|
||||
string CartridgeUAWidget::hotspotStr(int bank, int, bool prefix)
|
||||
{
|
||||
ostringstream info;
|
||||
uInt16 hotspot = myCart.hotspot() + (bank ^ (mySwappedHotspots ? 1 : 0)) * myHotspotDelta;
|
||||
|
||||
info << "(" << (prefix ? "hotspot " : "");
|
||||
info << "$" << Common::Base::HEX1 << hotspot << ", $" << (hotspot | 0x80);
|
||||
info << ")";
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class CartridgeUAWidget : public CartEnhancedWidget
|
|||
|
||||
string description() override;
|
||||
|
||||
string hotspotStr(int bank, int) override;
|
||||
string hotspotStr(int bank, int seg, bool prefix = false) override;
|
||||
|
||||
private:
|
||||
const bool mySwappedHotspots;
|
||||
|
|
|
@ -15,157 +15,45 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include "Debugger.hxx"
|
||||
#include "CartDebug.hxx"
|
||||
#include "CartWD.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "CartWDWidget.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeWDWidget::CartridgeWDWidget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, CartridgeWD& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart)
|
||||
: CartEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||
{
|
||||
string info =
|
||||
"This scheme has eight 1K slices, which can be mapped into four 1K "
|
||||
"segments in various combinations. Each 'bank' selects a predefined "
|
||||
"segment arrangement (indicated in square brackets)\n"
|
||||
"In the third (uppermost) segment the byte at $3FC is overwritten with 0.\n\n"
|
||||
"64 bytes RAM @ $F000 - $F080\n"
|
||||
" $F000 - $F03F (R), $F040 - $F07F (W)\n";
|
||||
|
||||
int xpos = 2,
|
||||
ypos = addBaseInformation(myCart.mySize, "Wickstead Design", info, 12) + myLineHeight;
|
||||
|
||||
VariantList items;
|
||||
VarList::push_back(items, "0 ($30) [0,0,1,3]", 0);
|
||||
VarList::push_back(items, "1 ($31) [0,1,2,3]", 1);
|
||||
VarList::push_back(items, "2 ($32) [4,5,6,7]", 2);
|
||||
VarList::push_back(items, "3 ($33) [7,4,2,3]", 3);
|
||||
VarList::push_back(items, "4 ($34) [0,0,6,7]", 4);
|
||||
VarList::push_back(items, "5 ($35) [0,1,7,6]", 5);
|
||||
VarList::push_back(items, "6 ($36) [2,3,4,5]", 6);
|
||||
VarList::push_back(items, "7 ($37) [6,0,5,1]", 7);
|
||||
VarList::push_back(items, "8 ($38) [0,0,1,3]", 8);
|
||||
VarList::push_back(items, "9 ($39) [0,1,2,3]", 9);
|
||||
VarList::push_back(items, "10 ($3A) [4,5,6,7]", 10);
|
||||
VarList::push_back(items, "11 ($3B) [7,4,2,3]", 11);
|
||||
VarList::push_back(items, "12 ($3C) [0,0,6,7]", 12);
|
||||
VarList::push_back(items, "13 ($3D) [0,1,7,6]", 13);
|
||||
VarList::push_back(items, "14 ($3E) [2,3,4,5]", 14);
|
||||
VarList::push_back(items, "15 ($3F) [6,0,5,1]", 15);
|
||||
myBank = new PopUpWidget(boss, _font, xpos, ypos-2,
|
||||
_font.getStringWidth("15 ($3F) [6,0,5,1]"),
|
||||
myLineHeight, items, "Set bank ",
|
||||
0, kBankChanged);
|
||||
myBank->setTarget(this);
|
||||
addFocusWidget(myBank);
|
||||
initialize();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeWDWidget::saveOldState()
|
||||
string CartridgeWDWidget::description()
|
||||
{
|
||||
myOldState.internalram.clear();
|
||||
ostringstream info;
|
||||
|
||||
for(uInt32 i = 0; i < internalRamSize(); ++i)
|
||||
myOldState.internalram.push_back(myCart.myRAM[i]);
|
||||
info << "8K + RAM Wickstead Design cartridge, \n"
|
||||
<< " eight 1K banks, mapped into four segments\n"
|
||||
<< "Hotspots $" << Common::Base::HEX1 << myCart.hotspot() << " - $" << (myCart.hotspot() + 7) << ", "
|
||||
<< "each hotspot selects a [predefined bank mapping]\n";
|
||||
info << ramDescription();
|
||||
|
||||
myOldState.bank = myCart.getBank();
|
||||
return info.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeWDWidget::loadConfig()
|
||||
string CartridgeWDWidget::hotspotStr(int bank, int segment, bool prefix)
|
||||
{
|
||||
myBank->setSelectedIndex(myCart.getBank(), myCart.getBank() != myOldState.bank);
|
||||
ostringstream info;
|
||||
CartridgeWD& cart = dynamic_cast<CartridgeWD&>(myCart);
|
||||
CartridgeWD::BankOrg banks = cart.ourBankOrg[bank];
|
||||
|
||||
CartDebugWidget::loadConfig();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeWDWidget::handleCommand(CommandSender* sender,
|
||||
int cmd, int data, int id)
|
||||
{
|
||||
if(cmd == kBankChanged)
|
||||
{
|
||||
myCart.unlockBank();
|
||||
myCart.bank(myBank->getSelected());
|
||||
myCart.lockBank();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeWDWidget::bankState()
|
||||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static constexpr std::array<const char*, 8> segments = {
|
||||
"[0,0,1,3]", "[0,1,2,3]", "[4,5,6,7]", "[7,4,2,3]",
|
||||
"[0,0,6,7]", "[0,1,7,6]", "[2,3,4,5]", "[6,0,5,1]"
|
||||
};
|
||||
uInt16 bank = myCart.getBank();
|
||||
buf << "Bank = " << std::dec << bank << ", segments = " << segments[bank & 0x7];
|
||||
|
||||
return buf.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 CartridgeWDWidget::internalRamSize()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 CartridgeWDWidget::internalRamRPort(int start)
|
||||
{
|
||||
return 0xF000 + start;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeWDWidget::internalRamDescription()
|
||||
{
|
||||
ostringstream desc;
|
||||
desc << "$F000 - $F03F used for Read Access\n"
|
||||
<< "$F040 - $F07F used for Write Access";
|
||||
|
||||
return desc.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const ByteArray& CartridgeWDWidget::internalRamOld(int start, int count)
|
||||
{
|
||||
myRamOld.clear();
|
||||
for(int i = 0; i < count; ++i)
|
||||
myRamOld.push_back(myOldState.internalram[start + i]);
|
||||
return myRamOld;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const ByteArray& CartridgeWDWidget::internalRamCurrent(int start, int count)
|
||||
{
|
||||
myRamCurrent.clear();
|
||||
for(int i = 0; i < count; ++i)
|
||||
myRamCurrent.push_back(myCart.myRAM[start + i]);
|
||||
return myRamCurrent;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeWDWidget::internalRamSetValue(int addr, uInt8 value)
|
||||
{
|
||||
myCart.myRAM[addr] = value;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 CartridgeWDWidget::internalRamGetValue(int addr)
|
||||
{
|
||||
return myCart.myRAM[addr];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeWDWidget::internalRamLabel(int addr)
|
||||
{
|
||||
CartDebug& dbg = instance().debugger().cartDebug();
|
||||
return dbg.getLabel(addr + 0xF000, false);
|
||||
info << "(" << (prefix ? "hotspot " : "")
|
||||
<< "$" << Common::Base::HEX1 << (myCart.hotspot() + bank) << ") ["
|
||||
<< uInt16(banks.zero) << ", "
|
||||
<< uInt16(banks.one) << ", "
|
||||
<< uInt16(banks.two) << ", "
|
||||
<< uInt16(banks.three) << "]";
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
|
|
@ -19,11 +19,10 @@
|
|||
#define CARTRIDGEWD_WIDGET_HXX
|
||||
|
||||
class CartridgeWD;
|
||||
class PopUpWidget;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
|
||||
class CartridgeWDWidget : public CartDebugWidget
|
||||
class CartridgeWDWidget : public CartEnhancedWidget
|
||||
{
|
||||
public:
|
||||
CartridgeWDWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -33,35 +32,15 @@ class CartridgeWDWidget : public CartDebugWidget
|
|||
virtual ~CartridgeWDWidget() = default;
|
||||
|
||||
private:
|
||||
CartridgeWD& myCart;
|
||||
PopUpWidget* myBank{nullptr};
|
||||
string manufacturer() override { return "Wickstead Design"; }
|
||||
|
||||
struct CartState {
|
||||
ByteArray internalram;
|
||||
uInt16 bank{0}; // Current banking layout
|
||||
};
|
||||
CartState myOldState;
|
||||
string description() override;
|
||||
|
||||
enum { kBankChanged = 'bkCH' };
|
||||
string hotspotStr(int bank, int seg = 0, bool prefix = false) override;
|
||||
|
||||
int bankSegs() override { return 1; }
|
||||
|
||||
private:
|
||||
void saveOldState() override;
|
||||
void loadConfig() override;
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||
|
||||
string bankState() override;
|
||||
|
||||
// start of functions for Cartridge RAM tab
|
||||
uInt32 internalRamSize() override;
|
||||
uInt32 internalRamRPort(int start) override;
|
||||
string internalRamDescription() override;
|
||||
const ByteArray& internalRamOld(int start, int count) override;
|
||||
const ByteArray& internalRamCurrent(int start, int count) override;
|
||||
void internalRamSetValue(int addr, uInt8 value) override;
|
||||
uInt8 internalRamGetValue(int addr) override;
|
||||
string internalRamLabel(int addr) override;
|
||||
// end of functions for Cartridge RAM tab
|
||||
|
||||
// Following constructors and assignment operators not supported
|
||||
CartridgeWDWidget() = delete;
|
||||
CartridgeWDWidget(const CartridgeWDWidget&) = delete;
|
||||
|
|
|
@ -16,94 +16,26 @@
|
|||
//============================================================================
|
||||
|
||||
#include "CartX07.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "CartX07Widget.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeX07Widget::CartridgeX07Widget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, CartridgeX07& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart)
|
||||
: CartEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||
{
|
||||
uInt32 size = 16 * 4096;
|
||||
initialize();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeX07Widget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
|
||||
info << "64K X07 cartridge, 16 4K banks\n"
|
||||
<< "Startup bank = " << cart.startBank() << "\n"
|
||||
<< "Multiple hotspots, all below $1000\n"
|
||||
<< "See documentation for further details\n";
|
||||
info << CartEnhancedWidget::description();
|
||||
|
||||
// Eventually, we should query this from the debugger/disassembler
|
||||
for(uInt32 i = 0, offset = 0xFFC; i < 16; ++i, offset += 0x1000)
|
||||
{
|
||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||
start -= start % 0x1000;
|
||||
info << "Bank " << std::dec << i << " @ $" << Common::Base::HEX4 << start
|
||||
<< " - " << "$" << (start + 0xFFF) << "\n";
|
||||
}
|
||||
|
||||
int xpos = 2,
|
||||
ypos = addBaseInformation(size, "AtariAge / John Payson / Fred Quimby",
|
||||
info.str()) + myLineHeight;
|
||||
|
||||
VariantList items;
|
||||
VarList::push_back(items, " 0");
|
||||
VarList::push_back(items, " 1");
|
||||
VarList::push_back(items, " 2");
|
||||
VarList::push_back(items, " 3");
|
||||
VarList::push_back(items, " 4");
|
||||
VarList::push_back(items, " 5");
|
||||
VarList::push_back(items, " 6");
|
||||
VarList::push_back(items, " 7");
|
||||
VarList::push_back(items, " 8");
|
||||
VarList::push_back(items, " 9");
|
||||
VarList::push_back(items, " 10");
|
||||
VarList::push_back(items, " 11");
|
||||
VarList::push_back(items, " 12");
|
||||
VarList::push_back(items, " 13");
|
||||
VarList::push_back(items, " 14");
|
||||
VarList::push_back(items, " 15");
|
||||
myBank =
|
||||
new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth(" 15"),
|
||||
myLineHeight, items, "Set bank ",
|
||||
0, kBankChanged);
|
||||
myBank->setTarget(this);
|
||||
addFocusWidget(myBank);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeX07Widget::loadConfig()
|
||||
{
|
||||
Debugger& dbg = instance().debugger();
|
||||
CartDebug& cart = dbg.cartDebug();
|
||||
const CartState& state = static_cast<const CartState&>(cart.getState());
|
||||
const CartState& oldstate = static_cast<const CartState&>(cart.getOldState());
|
||||
|
||||
myBank->setSelectedIndex(myCart.getBank(), state.bank != oldstate.bank);
|
||||
|
||||
CartDebugWidget::loadConfig();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeX07Widget::handleCommand(CommandSender* sender,
|
||||
int cmd, int data, int id)
|
||||
{
|
||||
if(cmd == kBankChanged)
|
||||
{
|
||||
myCart.unlockBank();
|
||||
myCart.bank(myBank->getSelected());
|
||||
myCart.lockBank();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeX07Widget::bankState()
|
||||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
buf << "Bank = " << std::dec << myCart.getBank();
|
||||
|
||||
return buf.str();
|
||||
return info.str();
|
||||
}
|
||||
|
|
|
@ -19,11 +19,10 @@
|
|||
#define CARTRIDGEX07_WIDGET_HXX
|
||||
|
||||
class CartridgeX07;
|
||||
class PopUpWidget;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
|
||||
class CartridgeX07Widget : public CartDebugWidget
|
||||
class CartridgeX07Widget : public CartEnhancedWidget
|
||||
{
|
||||
public:
|
||||
CartridgeX07Widget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -33,17 +32,11 @@ class CartridgeX07Widget : public CartDebugWidget
|
|||
virtual ~CartridgeX07Widget() = default;
|
||||
|
||||
private:
|
||||
CartridgeX07& myCart;
|
||||
PopUpWidget* myBank{nullptr};
|
||||
string manufacturer() override { return "AtariAge / John Payson / Fred Quimby"; }
|
||||
|
||||
enum { kBankChanged = 'bkCH' };
|
||||
string description() override;
|
||||
|
||||
private:
|
||||
void loadConfig() override;
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||
|
||||
string bankState() override;
|
||||
|
||||
// Following constructors and assignment operators not supported
|
||||
CartridgeX07Widget() = delete;
|
||||
CartridgeX07Widget(const CartridgeX07Widget&) = delete;
|
||||
|
|
|
@ -153,6 +153,8 @@ class CartridgeWD : public CartridgeEnhanced
|
|||
private:
|
||||
bool checkSwitchBank(uInt16, uInt8 = 0) override { return false; }
|
||||
|
||||
uInt16 hotspot() const override { return 0x0030; }
|
||||
|
||||
private:
|
||||
// Indicates the cycle at which a bankswitch was initiated
|
||||
uInt64 myCyclesAtBankswitchInit{0};
|
||||
|
|
Loading…
Reference in New Issue