mirror of https://github.com/stella-emu/stella.git
refactored multiple CartXXWidget classes
This commit is contained in:
parent
c8d7937a46
commit
70cdfe6c13
|
@ -16,80 +16,25 @@
|
|||
//============================================================================
|
||||
|
||||
#include "Cart0840.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "Cart0840Widget.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Cartridge0840Widget::Cartridge0840Widget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, Cartridge0840& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart)
|
||||
: CartEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||
{
|
||||
uInt16 size = 2 * 4096;
|
||||
myHotspotDelta = 0x40;
|
||||
initialize();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string Cartridge0840Widget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
info << "0840 ECONObanking, two 4K banks\n"
|
||||
<< "Startup bank = " << cart.startBank() << "\n";
|
||||
|
||||
// Eventually, we should query this from the debugger/disassembler
|
||||
for(uInt32 i = 0, offset = 0xFFC, spot = 0x800; i < 2;
|
||||
++i, offset += 0x1000, spot += 0x40)
|
||||
{
|
||||
uInt16 start = uInt16((cart.myImage[offset+1] << 8) | cart.myImage[offset]);
|
||||
start -= start % 0x1000;
|
||||
info << "Bank " << i << " @ $" << Common::Base::HEX4 << start << " - "
|
||||
<< "$" << (start + 0xFFF) << " (hotspot = $" << spot << ")\n";
|
||||
}
|
||||
|
||||
int xpos = 2,
|
||||
ypos = addBaseInformation(size, "Fred X. Quimby", info.str()) + myLineHeight;
|
||||
|
||||
VariantList items;
|
||||
VarList::push_back(items, "0 ($800)");
|
||||
VarList::push_back(items, "1 ($840)");
|
||||
myBank =
|
||||
new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("0 ($800)"),
|
||||
myLineHeight, items, "Set bank ",
|
||||
0, kBankChanged);
|
||||
myBank->setTarget(this);
|
||||
addFocusWidget(myBank);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Cartridge0840Widget::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 Cartridge0840Widget::handleCommand(CommandSender* sender,
|
||||
int cmd, int data, int id)
|
||||
{
|
||||
if(cmd == kBankChanged)
|
||||
{
|
||||
myCart.unlockBank();
|
||||
myCart.bank(myBank->getSelected());
|
||||
myCart.lockBank();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string Cartridge0840Widget::bankState()
|
||||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const std::array<string, 2> spot = { "$800", "$840" };
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", hotspot = " << spot[myCart.getBank()];
|
||||
|
||||
return buf.str();
|
||||
info << "0840 ECONObanking, two 4K banks\n";
|
||||
info << CartEnhancedWidget::description();
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
|
|
@ -19,11 +19,10 @@
|
|||
#define CARTRIDGE0840_WIDGET_HXX
|
||||
|
||||
class Cartridge0840;
|
||||
class PopUpWidget;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
|
||||
class Cartridge0840Widget : public CartDebugWidget
|
||||
class Cartridge0840Widget : public CartEnhancedWidget
|
||||
{
|
||||
public:
|
||||
Cartridge0840Widget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -33,17 +32,11 @@ class Cartridge0840Widget : public CartDebugWidget
|
|||
virtual ~Cartridge0840Widget() = default;
|
||||
|
||||
private:
|
||||
Cartridge0840& myCart;
|
||||
PopUpWidget* myBank{nullptr};
|
||||
string manufacturer() override { return "Fred X. 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
|
||||
Cartridge0840Widget() = delete;
|
||||
Cartridge0840Widget(const Cartridge0840Widget&) = delete;
|
||||
|
|
|
@ -22,18 +22,18 @@
|
|||
Cartridge2KWidget::Cartridge2KWidget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, Cartridge2K& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h)
|
||||
: CartEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||
{
|
||||
// Eventually, we should query this from the debugger/disassembler
|
||||
size_t size;
|
||||
|
||||
cart.getImage(size);
|
||||
|
||||
uInt16 start = (cart.myImage[size-3] << 8) | cart.myImage[size-4];
|
||||
start -= start % size;
|
||||
|
||||
ostringstream info;
|
||||
info << "Standard 2K cartridge, non-bankswitched\n"
|
||||
<< "Accessible @ $" << Common::Base::HEX4 << start << " - " << "$" << (start + size - 1);
|
||||
addBaseInformation(size, "Atari", info.str());
|
||||
initialize();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string Cartridge2KWidget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
|
||||
info << "Standard 2K cartridge, non-bankswitched\n";
|
||||
info << CartEnhancedWidget::description();
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
class Cartridge2K;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
|
||||
class Cartridge2KWidget : public CartDebugWidget
|
||||
class Cartridge2KWidget : public CartEnhancedWidget
|
||||
{
|
||||
public:
|
||||
Cartridge2KWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -32,10 +32,11 @@ class Cartridge2KWidget : public CartDebugWidget
|
|||
virtual ~Cartridge2KWidget() = default;
|
||||
|
||||
private:
|
||||
// No implementation for non-bankswitched ROMs
|
||||
void loadConfig() override { }
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override { }
|
||||
string manufacturer() override { return "Atari"; }
|
||||
|
||||
string description() override;
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
Cartridge2KWidget() = delete;
|
||||
Cartridge2KWidget(const Cartridge2KWidget&) = delete;
|
||||
|
|
|
@ -161,7 +161,7 @@ string Cartridge3EWidget::bankState()
|
|||
if(bank < myCart.romBankCount())
|
||||
buf << "ROM bank #" << std::dec << bank % myNumRomBanks << ", RAM inactive";
|
||||
else
|
||||
buf << "ROM inactive, RAM bank #" << std::dec << bank % myNumRomBanks;
|
||||
buf << "ROM inactive, RAM bank #" << std::dec << bank % myNumRamBanks;
|
||||
|
||||
return buf.str();
|
||||
}
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include "Debugger.hxx"
|
||||
#include "CartDebug.hxx"
|
||||
#include "Cart4KSC.hxx"
|
||||
#include "Cart4KSCWidget.hxx"
|
||||
|
||||
|
@ -24,87 +22,18 @@
|
|||
Cartridge4KSCWidget::Cartridge4KSCWidget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, Cartridge4KSC& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart)
|
||||
: CartEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||
{
|
||||
// Eventually, we should query this from the debugger/disassembler
|
||||
uInt16 start = (cart.myImage[0xFFD] << 8) | cart.myImage[0xFFC];
|
||||
start -= start % 0x1000;
|
||||
initialize();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string Cartridge4KSCWidget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
info << "4KSC cartridge, non-bankswitched\n"
|
||||
<< "128 bytes RAM @ $F000 - $F0FF\n"
|
||||
<< " $F080 - $F0FF (R), $F000 - $F07F (W)\n"
|
||||
<< "Accessible @ $" << Common::Base::HEX4 << start << " - "
|
||||
<< "$" << (start + 0xFFF);
|
||||
|
||||
addBaseInformation(4096, "homebrew intermediate format", info.str());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Cartridge4KSCWidget::saveOldState()
|
||||
{
|
||||
myOldState.internalram.clear();
|
||||
|
||||
for(uInt32 i = 0; i < internalRamSize(); ++i)
|
||||
myOldState.internalram.push_back(myCart.myRAM[i]);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 Cartridge4KSCWidget::internalRamSize()
|
||||
{
|
||||
return 128;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 Cartridge4KSCWidget::internalRamRPort(int start)
|
||||
{
|
||||
return 0xF080 + start;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string Cartridge4KSCWidget::internalRamDescription()
|
||||
{
|
||||
ostringstream desc;
|
||||
desc << "$F000 - $F07F used for Write Access\n"
|
||||
<< "$F080 - $F0FF used for Read Access";
|
||||
|
||||
return desc.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const ByteArray& Cartridge4KSCWidget::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& Cartridge4KSCWidget::internalRamCurrent(int start, int count)
|
||||
{
|
||||
myRamCurrent.clear();
|
||||
for(int i = 0; i < count; i++)
|
||||
myRamCurrent.push_back(myCart.myRAM[start + i]);
|
||||
return myRamCurrent;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Cartridge4KSCWidget::internalRamSetValue(int addr, uInt8 value)
|
||||
{
|
||||
myCart.myRAM[addr] = value;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 Cartridge4KSCWidget::internalRamGetValue(int addr)
|
||||
{
|
||||
return myCart.myRAM[addr];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string Cartridge4KSCWidget::internalRamLabel(int addr)
|
||||
{
|
||||
CartDebug& dbg = instance().debugger().cartDebug();
|
||||
return dbg.getLabel(addr + 0xF080, false);
|
||||
info << "4KSC cartridge, non-bankswitched\n";
|
||||
info << CartEnhancedWidget::description();
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
class Cartridge4KSC;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
|
||||
class Cartridge4KSCWidget : public CartDebugWidget
|
||||
class Cartridge4KSCWidget : public CartEnhancedWidget
|
||||
{
|
||||
public:
|
||||
Cartridge4KSCWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -32,30 +32,11 @@ class Cartridge4KSCWidget : public CartDebugWidget
|
|||
virtual ~Cartridge4KSCWidget() = default;
|
||||
|
||||
private:
|
||||
Cartridge4KSC& myCart;
|
||||
struct CartState {
|
||||
ByteArray internalram;
|
||||
};
|
||||
CartState myOldState;
|
||||
string manufacturer() override { return "homebrew intermediate format"; }
|
||||
|
||||
string description() override;
|
||||
|
||||
private:
|
||||
// No implementation for non-bankswitched ROMs
|
||||
void loadConfig() override { }
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override { }
|
||||
|
||||
void saveOldState() 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
|
||||
Cartridge4KSCWidget() = delete;
|
||||
Cartridge4KSCWidget(const Cartridge4KSCWidget&) = delete;
|
||||
|
|
|
@ -22,15 +22,29 @@
|
|||
Cartridge4KWidget::Cartridge4KWidget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, Cartridge4K& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h)
|
||||
: CartEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||
{
|
||||
// Eventually, we should query this from the debugger/disassembler
|
||||
uInt16 start = (cart.myImage[0xFFD] << 8) | cart.myImage[0xFFC];
|
||||
start -= start % 0x1000;
|
||||
initialize();
|
||||
|
||||
ostringstream info;
|
||||
info << "Standard 4K cartridge, non-bankswitched\n"
|
||||
<< "Accessible @ $" << Common::Base::HEX4 << start << " - "
|
||||
<< "$" << (start + 0xFFF);
|
||||
addBaseInformation(4096, "Atari", info.str());
|
||||
//// Eventually, we should query this from the debugger/disassembler
|
||||
//uInt16 start = (cart.myImage[0xFFD] << 8) | cart.myImage[0xFFC];
|
||||
//start -= start % 0x1000;
|
||||
|
||||
//ostringstream info;
|
||||
//info << "Standard 4K cartridge, non-bankswitched\n"
|
||||
// << "Accessible @ $" << Common::Base::HEX4 << start << " - "
|
||||
// << "$" << (start + 0xFFF);
|
||||
//addBaseInformation(4096, "Atari", info.str());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string Cartridge4KWidget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
|
||||
info << "Standard 4K cartridge, non-bankswitched\n";
|
||||
info << CartEnhancedWidget::description();
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
class Cartridge4K;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
#include "CartEnhanced.hxx"
|
||||
|
||||
class Cartridge4KWidget : public CartDebugWidget
|
||||
class Cartridge4KWidget : public CartEnhancedWidget
|
||||
{
|
||||
public:
|
||||
Cartridge4KWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -32,10 +32,11 @@ class Cartridge4KWidget : public CartDebugWidget
|
|||
virtual ~Cartridge4KWidget() = default;
|
||||
|
||||
private:
|
||||
// No implementation for non-bankswitched ROMs
|
||||
void loadConfig() override { }
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override { }
|
||||
string manufacturer() override { return "Atari"; }
|
||||
|
||||
string description() override;
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
Cartridge4KWidget() = delete;
|
||||
Cartridge4KWidget(const Cartridge4KWidget&) = delete;
|
||||
|
|
|
@ -24,88 +24,101 @@
|
|||
CartridgeCVWidget::CartridgeCVWidget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, CartridgeCV& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart)
|
||||
: CartEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||
{
|
||||
// Eventually, we should query this from the debugger/disassembler
|
||||
uInt16 size = 2048;
|
||||
uInt16 start = (cart.myImage[size-3] << 8) | cart.myImage[size-4];
|
||||
start -= start % size;
|
||||
initialize();
|
||||
|
||||
//// Eventually, we should query this from the debugger/disassembler
|
||||
//uInt16 size = 2048;
|
||||
//uInt16 start = (cart.myImage[size-3] << 8) | cart.myImage[size-4];
|
||||
//start -= start % size;
|
||||
|
||||
//ostringstream info;
|
||||
//info << "CV 2K ROM + 1K RAM , non-bankswitched\n"
|
||||
// << "1024 bytes RAM @ $F000 - $F7FF\n"
|
||||
// << " $F000 - $F3FF (R), $F400 - $F7FF (W)\n"
|
||||
// << "ROM accessible @ $" << Common::Base::HEX4 << start << " - "
|
||||
// << "$" << (start + size - 1);
|
||||
|
||||
//addBaseInformation(cart.mySize, "CommaVid", info.str());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeCVWidget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
info << "CV 2K ROM + 1K RAM , non-bankswitched\n"
|
||||
<< "1024 bytes RAM @ $F000 - $F7FF\n"
|
||||
<< " $F000 - $F3FF (R), $F400 - $F7FF (W)\n"
|
||||
<< "ROM accessible @ $" << Common::Base::HEX4 << start << " - "
|
||||
<< "$" << (start + size - 1);
|
||||
|
||||
addBaseInformation(cart.mySize, "CommaVid", info.str());
|
||||
info << "CV 2K ROM + 1K RAM , non-bankswitched\n";
|
||||
info << CartEnhancedWidget::description();
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeCVWidget::saveOldState()
|
||||
{
|
||||
myOldState.internalram.clear();
|
||||
|
||||
for(uInt32 i = 0; i < internalRamSize(); ++i)
|
||||
myOldState.internalram.push_back(myCart.myRAM[i]);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 CartridgeCVWidget::internalRamSize()
|
||||
{
|
||||
return 1024;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 CartridgeCVWidget::internalRamRPort(int start)
|
||||
{
|
||||
return 0xF000 + start;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeCVWidget::internalRamDescription()
|
||||
{
|
||||
ostringstream desc;
|
||||
desc << "$F000 - $F3FF used for Read Access\n"
|
||||
<< "$F400 - $F7FF used for Write Access";
|
||||
|
||||
return desc.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const ByteArray& CartridgeCVWidget::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& CartridgeCVWidget::internalRamCurrent(int start, int count)
|
||||
{
|
||||
myRamCurrent.clear();
|
||||
for(int i = 0; i < count; i++)
|
||||
myRamCurrent.push_back(myCart.myRAM[start + i]);
|
||||
return myRamCurrent;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeCVWidget::internalRamSetValue(int addr, uInt8 value)
|
||||
{
|
||||
myCart.myRAM[addr] = value;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 CartridgeCVWidget::internalRamGetValue(int addr)
|
||||
{
|
||||
return myCart.myRAM[addr];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeCVWidget::internalRamLabel(int addr)
|
||||
{
|
||||
CartDebug& dbg = instance().debugger().cartDebug();
|
||||
return dbg.getLabel(addr + 0xF000, false);
|
||||
}
|
||||
//// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
//void CartridgeCVWidget::saveOldState()
|
||||
//{
|
||||
// myOldState.internalram.clear();
|
||||
//
|
||||
// for(uInt32 i = 0; i < internalRamSize(); ++i)
|
||||
// myOldState.internalram.push_back(myCart.myRAM[i]);
|
||||
//}
|
||||
//
|
||||
//// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
//uInt32 CartridgeCVWidget::internalRamSize()
|
||||
//{
|
||||
// return 1024;
|
||||
//}
|
||||
//
|
||||
//// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
//uInt32 CartridgeCVWidget::internalRamRPort(int start)
|
||||
//{
|
||||
// return 0xF000 + start;
|
||||
//}
|
||||
//
|
||||
//// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
//string CartridgeCVWidget::internalRamDescription()
|
||||
//{
|
||||
// ostringstream desc;
|
||||
// desc << "$F000 - $F3FF used for Read Access\n"
|
||||
// << "$F400 - $F7FF used for Write Access";
|
||||
//
|
||||
// return desc.str();
|
||||
//}
|
||||
//
|
||||
//// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
//const ByteArray& CartridgeCVWidget::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& CartridgeCVWidget::internalRamCurrent(int start, int count)
|
||||
//{
|
||||
// myRamCurrent.clear();
|
||||
// for(int i = 0; i < count; i++)
|
||||
// myRamCurrent.push_back(myCart.myRAM[start + i]);
|
||||
// return myRamCurrent;
|
||||
//}
|
||||
//
|
||||
//// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
//void CartridgeCVWidget::internalRamSetValue(int addr, uInt8 value)
|
||||
//{
|
||||
// myCart.myRAM[addr] = value;
|
||||
//}
|
||||
//
|
||||
//// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
//uInt8 CartridgeCVWidget::internalRamGetValue(int addr)
|
||||
//{
|
||||
// return myCart.myRAM[addr];
|
||||
//}
|
||||
//
|
||||
//// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
//string CartridgeCVWidget::internalRamLabel(int addr)
|
||||
//{
|
||||
// CartDebug& dbg = instance().debugger().cartDebug();
|
||||
// return dbg.getLabel(addr + 0xF000, false);
|
||||
//}
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
class CartridgeCV;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
|
||||
class CartridgeCVWidget : public CartDebugWidget
|
||||
class CartridgeCVWidget : public CartEnhancedWidget
|
||||
{
|
||||
public:
|
||||
CartridgeCVWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -32,30 +32,35 @@ class CartridgeCVWidget : public CartDebugWidget
|
|||
virtual ~CartridgeCVWidget() = default;
|
||||
|
||||
private:
|
||||
CartridgeCV& myCart;
|
||||
struct CartState {
|
||||
ByteArray internalram;
|
||||
};
|
||||
CartState myOldState;
|
||||
//CartridgeCV& myCart;
|
||||
//struct CartState {
|
||||
// ByteArray internalram;
|
||||
//};
|
||||
//CartState myOldState;
|
||||
|
||||
private:
|
||||
// No implementation for non-bankswitched ROMs
|
||||
void loadConfig() override { }
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override { }
|
||||
string manufacturer() override { return "CommaVid"; }
|
||||
|
||||
void saveOldState() override;
|
||||
string description() 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
|
||||
//// No implementation for non-bankswitched ROMs
|
||||
//void loadConfig() override { }
|
||||
//void handleCommand(CommandSender* sender, int cmd, int data, int id) override { }
|
||||
|
||||
//void saveOldState() 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
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
CartridgeCVWidget() = delete;
|
||||
CartridgeCVWidget(const CartridgeCVWidget&) = delete;
|
||||
|
|
|
@ -65,7 +65,7 @@ int CartDebugWidget::addBaseInformation(size_t bytes, const string& manufacturer
|
|||
w->setEditable(false);
|
||||
y += myLineHeight + 4;
|
||||
|
||||
StringParser bs(desc, (fwidth - kScrollBarWidth) / myFontWidth - 4);
|
||||
StringParser bs(desc, (fwidth - kScrollBarWidth - 4) / myFontWidth);
|
||||
const StringList& sl = bs.stringList();
|
||||
uInt32 lines = uInt32(sl.size());
|
||||
if(lines < 3) lines = 3;
|
||||
|
|
|
@ -16,129 +16,60 @@
|
|||
//============================================================================
|
||||
|
||||
#include "CartE0.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "CartE0Widget.hxx"
|
||||
|
||||
static constexpr std::array<const char*, 8> seg0 = {
|
||||
"0 ($FFE0)", "1 ($FFE1)", "2 ($FFE2)", "3 ($FFE3)",
|
||||
"4 ($FFE4)", "5 ($FFE5)", "6 ($FFE6)", "7 ($FFE7)"
|
||||
};
|
||||
static constexpr std::array<const char*, 8> seg1 = {
|
||||
"0 ($FFE8)", "1 ($FFE9)", "2 ($FFEA)", "3 ($FFEB)",
|
||||
"4 ($FFEC)", "5 ($FFED)", "6 ($FFEE)", "7 ($FFEF)"
|
||||
};
|
||||
static constexpr std::array<const char*, 8> seg2 = {
|
||||
"0 ($FFF0)", "1 ($FFF1)", "2 ($FFF2)", "3 ($FFF3)",
|
||||
"4 ($FFF4)", "5 ($FFF5)", "6 ($FFF6)", "7 ($FFF7)"
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeE0Widget::CartridgeE0Widget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, CartridgeE0& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart)
|
||||
: CartEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||
{
|
||||
uInt32 size = 8 * 1024;
|
||||
|
||||
string info =
|
||||
"E0 cartridge, eight 1K slices\n"
|
||||
"Segment 0 accessible @ $F000 - $F3FF\n"
|
||||
" Hotspots $FE0 to $FE7\n"
|
||||
"Segment 1 accessible @ $F400 - $F7FF\n"
|
||||
" Hotspots $FE8 to $FEF\n"
|
||||
"Segment 2 accessible @ $F800 - $FBFF\n"
|
||||
" Hotspots $FF0 to $FF7\n"
|
||||
"Segment 3 accessible @ $FC00 - $FFFF\n"
|
||||
" Always points to last 1K of ROM\n"
|
||||
"Startup slices = 4 / 5 / 6 or undetermined\n";
|
||||
|
||||
#if 0
|
||||
// Eventually, we should query this from the debugger/disassembler
|
||||
uInt16 start = (cart.myImage[size-3] << 8) | cart.myImage[size-4];
|
||||
start -= start % 0x1000;
|
||||
info << "Bank RORG" << " = $" << HEX4 << start << "\n";
|
||||
#endif
|
||||
int xpos = 2,
|
||||
ypos = addBaseInformation(size, "Parker Brothers", info) + myLineHeight;
|
||||
|
||||
VariantList items0, items1, items2;
|
||||
for(int i = 0; i < 8; ++i)
|
||||
{
|
||||
VarList::push_back(items0, seg0[i]);
|
||||
VarList::push_back(items1, seg1[i]);
|
||||
VarList::push_back(items2, seg2[i]);
|
||||
}
|
||||
|
||||
const int lwidth = _font.getStringWidth("Set slice for segment X ");
|
||||
mySlice0 =
|
||||
new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("7 ($FFF7)"),
|
||||
myLineHeight, items0, "Set slice for segment 0 ",
|
||||
lwidth, kSlice0Changed);
|
||||
mySlice0->setTarget(this);
|
||||
addFocusWidget(mySlice0);
|
||||
ypos += mySlice0->getHeight() + 4;
|
||||
|
||||
mySlice1 =
|
||||
new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("7 ($FFF7)"),
|
||||
myLineHeight, items1, "Set slice for segment 1 ",
|
||||
lwidth, kSlice1Changed);
|
||||
mySlice1->setTarget(this);
|
||||
addFocusWidget(mySlice1);
|
||||
ypos += mySlice1->getHeight() + 4;
|
||||
|
||||
mySlice2 =
|
||||
new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("7 ($FFF7)"),
|
||||
myLineHeight, items2, "Set slice for segment 2 ",
|
||||
lwidth, kSlice2Changed);
|
||||
mySlice2->setTarget(this);
|
||||
addFocusWidget(mySlice2);
|
||||
initialize();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeE0Widget::loadConfig()
|
||||
string CartridgeE0Widget::description()
|
||||
{
|
||||
mySlice0->setSelectedIndex(myCart.getSegmentBank(0));
|
||||
mySlice1->setSelectedIndex(myCart.getSegmentBank(1));
|
||||
mySlice2->setSelectedIndex(myCart.getSegmentBank(2));
|
||||
ostringstream info;
|
||||
|
||||
CartDebugWidget::loadConfig();
|
||||
info << "E0 cartridge,\n eight 1K banks mapped into four segments\n";
|
||||
info << CartEnhancedWidget::description();
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeE0Widget::handleCommand(CommandSender* sender,
|
||||
int cmd, int data, int id)
|
||||
string CartridgeE0Widget::romDescription()
|
||||
{
|
||||
myCart.unlockBank();
|
||||
ostringstream info;
|
||||
|
||||
switch(cmd)
|
||||
for(int seg = 0; seg < 4; ++seg)
|
||||
{
|
||||
case kSlice0Changed:
|
||||
myCart.bank(mySlice0->getSelected(), 0);
|
||||
break;
|
||||
case kSlice1Changed:
|
||||
myCart.bank(mySlice1->getSelected(), 1);
|
||||
break;
|
||||
case kSlice2Changed:
|
||||
myCart.bank(mySlice2->getSelected(), 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
uInt16 segmentOffset = seg << 10; // myCart.myBankShift;
|
||||
|
||||
info << "Segment #" << seg << " accessible @ $"
|
||||
<< 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";
|
||||
else
|
||||
info << " Always points to last 1K bank of ROM\n";
|
||||
}
|
||||
info << "Startup banks = 4 / 5 / 6 or undetermined";
|
||||
|
||||
myCart.lockBank();
|
||||
invalidate();
|
||||
return info.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeE0Widget::bankState()
|
||||
string CartridgeE0Widget::hotspotStr(int bank, int segment)
|
||||
{
|
||||
ostringstream& buf = buffer();
|
||||
ostringstream info;
|
||||
uInt16 hotspot = myCart.hotspot();
|
||||
|
||||
buf << "Slices: " << std::dec
|
||||
<< seg0[myCart.getSegmentBank(0)] << " / "
|
||||
<< seg1[myCart.getSegmentBank(1)] << " / "
|
||||
<< seg2[myCart.getSegmentBank(2)];
|
||||
if(hotspot & 0x1000)
|
||||
hotspot |= ADDR_BASE;
|
||||
|
||||
return buf.str();
|
||||
info << "$" << Common::Base::HEX1 << (hotspot + bank + segment * 8);
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
|
|
@ -19,11 +19,10 @@
|
|||
#define CARTRIDGEE0_WIDGET_HXX
|
||||
|
||||
class CartridgeE0;
|
||||
class PopUpWidget;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
|
||||
class CartridgeE0Widget : public CartDebugWidget
|
||||
class CartridgeE0Widget : public CartEnhancedWidget
|
||||
{
|
||||
public:
|
||||
CartridgeE0Widget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -33,21 +32,16 @@ class CartridgeE0Widget : public CartDebugWidget
|
|||
virtual ~CartridgeE0Widget() = default;
|
||||
|
||||
private:
|
||||
CartridgeE0& myCart;
|
||||
PopUpWidget *mySlice0{nullptr}, *mySlice1{nullptr}, *mySlice2{nullptr};
|
||||
string manufacturer() override { return "Parker Brothers"; }
|
||||
|
||||
enum {
|
||||
kSlice0Changed = 's0CH',
|
||||
kSlice1Changed = 's1CH',
|
||||
kSlice2Changed = 's2CH'
|
||||
};
|
||||
string description() override;
|
||||
|
||||
string romDescription() override;
|
||||
|
||||
string hotspotStr(int bank, int segment) override;
|
||||
|
||||
int bankSegs() override { return 3; }
|
||||
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
|
||||
CartridgeE0Widget() = delete;
|
||||
CartridgeE0Widget(const CartridgeE0Widget&) = delete;
|
||||
|
|
|
@ -0,0 +1,344 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2020 by Bradford W. Mott, Stephen Anthony
|
||||
// and the Stella Team
|
||||
//
|
||||
// See the file "License.txt" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "CartEnhanced.hxx"
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartEnhancedWidget::CartEnhancedWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||
const GUI::Font& nfont,
|
||||
int x, int y, int w, int h,
|
||||
CartridgeEnhanced& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart)
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartEnhancedWidget::initialize()
|
||||
{
|
||||
int ypos = addBaseInformation(size(), manufacturer(), description(), descriptionLines())
|
||||
+ myLineHeight;
|
||||
|
||||
bankSelect(ypos);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
size_t CartEnhancedWidget::size()
|
||||
{
|
||||
size_t size;
|
||||
|
||||
myCart.getImage(size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartEnhancedWidget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
|
||||
if (myCart.myRamSize > 0)
|
||||
info << ramDescription();
|
||||
info << romDescription();
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int CartEnhancedWidget::descriptionLines()
|
||||
{
|
||||
return 20; // should be enough for almost all types
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartEnhancedWidget::ramDescription()
|
||||
{
|
||||
ostringstream info;
|
||||
|
||||
info << myCart.myRamSize << " bytes RAM @ "
|
||||
<< "$" << Common::Base::HEX4 << ADDR_BASE << " - "
|
||||
<< "$" << (ADDR_BASE | (myCart.myRamSize * 2 - 1)) << "\n"
|
||||
<< " $" << (ADDR_BASE | myCart.myReadOffset)
|
||||
<< " - $" << (ADDR_BASE | (myCart.myReadOffset + myCart.myRamSize - 1)) << " (R)"
|
||||
<< ", $" << (ADDR_BASE | myCart.myWriteOffset)
|
||||
<< " - $" << (ADDR_BASE | (myCart.myWriteOffset + myCart.myRamSize - 1)) << " (W)\n";
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartEnhancedWidget::romDescription()
|
||||
{
|
||||
ostringstream info;
|
||||
size_t size;
|
||||
const uInt8* image = myCart.getImage(size);
|
||||
|
||||
if(myCart.romBankCount() > 1)
|
||||
{
|
||||
info << "Startup bank = #" << myCart.startBank() << " or undetermined\n";
|
||||
for(int bank = 0, offset = 0xFFC; bank < myCart.romBankCount(); ++bank, offset += 0x1000)
|
||||
{
|
||||
uInt16 start = (image[offset + 1] << 8) | image[offset];
|
||||
start -= start % 0x1000;
|
||||
|
||||
info << "Bank #" << bank << " @ $"
|
||||
<< Common::Base::HEX4 << (start + myCart.myRomOffset) << " - $" << (start + 0xFFF)
|
||||
<< " (hotspot " << hotspotStr(bank) << ")\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uInt16 start = (image[myCart.mySize - 3] << 8) | image[myCart.mySize - 4];
|
||||
start -= start % std::min(int(size), 0x1000);
|
||||
|
||||
info << "ROM accessible @ $"
|
||||
<< Common::Base::HEX4 << (start + myCart.myRomOffset) << " - "
|
||||
<< "$" << Common::Base::HEX4 << (start + myCart.mySize - 1);
|
||||
}
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartEnhancedWidget::bankSelect(int& ypos)
|
||||
{
|
||||
if(myCart.romBankCount() > 1)
|
||||
{
|
||||
int xpos = 2;
|
||||
|
||||
myBankWidgets = make_unique<PopUpWidget* []>(bankSegs());
|
||||
|
||||
for(int seg = 0; seg < bankSegs(); ++seg)
|
||||
{
|
||||
// fill bank and hotspot list
|
||||
uInt16 hotspot = myCart.hotspot();
|
||||
VariantList items;
|
||||
int pw = 0;
|
||||
|
||||
for(int bank = 0; bank < myCart.romBankCount(); ++bank)
|
||||
{
|
||||
ostringstream buf;
|
||||
|
||||
buf << std::setw(bank < 10 ? 2 : 1) << "#" << std::dec << bank;
|
||||
if(hotspot >= 0x100 && myHotspotDelta > 0)
|
||||
buf << " (" << hotspotStr(bank, seg) << ")";
|
||||
VarList::push_back(items, buf.str());
|
||||
pw = std::max(pw, _font.getStringWidth(buf.str()));
|
||||
}
|
||||
|
||||
// create widgets
|
||||
ostringstream buf;
|
||||
|
||||
buf << "Set bank";
|
||||
if(bankSegs() > 1)
|
||||
buf << " for segment #" << seg << " ";
|
||||
else
|
||||
buf << " "; // align with info
|
||||
|
||||
myBankWidgets[seg] = new PopUpWidget(_boss, _font, xpos, ypos - 2,
|
||||
pw, myLineHeight, items, buf.str(),
|
||||
0, kBankChanged);
|
||||
myBankWidgets[seg]->setTarget(this);
|
||||
myBankWidgets[seg]->setID(seg);
|
||||
addFocusWidget(myBankWidgets[seg]);
|
||||
|
||||
ypos += myBankWidgets[seg]->getHeight() + 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartEnhancedWidget::bankState()
|
||||
{
|
||||
if(myCart.romBankCount() > 1)
|
||||
{
|
||||
ostringstream& buf = buffer();
|
||||
uInt16 hotspot = myCart.hotspot();
|
||||
bool hasRamBanks = myCart.myRamBankCount > 0;
|
||||
|
||||
if(bankSegs() > 1)
|
||||
{
|
||||
buf << "Segments: ";
|
||||
|
||||
for(int seg = 0; seg < bankSegs(); ++seg)
|
||||
{
|
||||
int bank = myCart.getSegmentBank(seg);
|
||||
bool isRamBank = (bank >= myCart.romBankCount());
|
||||
|
||||
|
||||
if(seg > 0)
|
||||
buf << " / ";
|
||||
|
||||
buf << "#" << std::dec << (bank - (isRamBank ? myCart.romBankCount() : 0));
|
||||
|
||||
if(isRamBank) // was RAM mapped here?
|
||||
buf << " RAM";
|
||||
else if (hasRamBanks)
|
||||
buf << " ROM";
|
||||
|
||||
if(hotspot >= 0x100)
|
||||
buf << " (" << (bankSegs() < 3 ? "hotspot " : "") << hotspotStr(bank) << ")";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
buf << "Bank #" << std::dec << myCart.getBank();
|
||||
|
||||
if(hotspot >= 0x100)
|
||||
buf << " (hotspot " << hotspotStr(myCart.getSegmentBank()) << ")";
|
||||
}
|
||||
return buf.str();
|
||||
}
|
||||
return "0 (non-bankswitched)";
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartEnhancedWidget::hotspotStr(int bank, int segment)
|
||||
{
|
||||
ostringstream info;
|
||||
uInt16 hotspot = myCart.hotspot();
|
||||
|
||||
if(hotspot & 0x1000)
|
||||
hotspot |= ADDR_BASE;
|
||||
|
||||
info << "$" << Common::Base::HEX1 << (hotspot + bank * myHotspotDelta);
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int CartEnhancedWidget::bankSegs()
|
||||
{
|
||||
return myCart.myBankSegs;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartEnhancedWidget::saveOldState()
|
||||
{
|
||||
myOldState.internalRam.clear();
|
||||
for(uInt32 i = 0; i < myCart.myRamSize; ++i)
|
||||
myOldState.internalRam.push_back(myCart.myRAM[i]);
|
||||
|
||||
myOldState.banks.clear();
|
||||
for(int seg = 0; seg < bankSegs(); ++seg)
|
||||
myOldState.banks.push_back(myCart.getSegmentBank(seg));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
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]);
|
||||
}
|
||||
CartDebugWidget::loadConfig();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartEnhancedWidget::handleCommand(CommandSender* sender,
|
||||
int cmd, int data, int id)
|
||||
{
|
||||
if(cmd == kBankChanged)
|
||||
{
|
||||
myCart.unlockBank();
|
||||
myCart.bank(myBankWidgets[id]->getSelected(), id);
|
||||
myCart.lockBank();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 CartEnhancedWidget::internalRamSize()
|
||||
{
|
||||
return myCart.myRamSize;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 CartEnhancedWidget::internalRamRPort(int start)
|
||||
{
|
||||
return ADDR_BASE + myCart.myReadOffset + start;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartEnhancedWidget::internalRamDescription()
|
||||
{
|
||||
ostringstream desc;
|
||||
|
||||
// order RW by addresses
|
||||
if(myCart.myReadOffset <= myCart.myWriteOffset)
|
||||
{
|
||||
desc << "$" << Common::Base::HEX4 << (ADDR_BASE | myCart.myReadOffset)
|
||||
<< " - $" << (ADDR_BASE | (myCart.myReadOffset + myCart.myRamSize - 1))
|
||||
<< " used for Read Access\n";
|
||||
}
|
||||
|
||||
desc
|
||||
<< "$" << Common::Base::HEX4 << (ADDR_BASE | myCart.myWriteOffset)
|
||||
<< " - $" << (ADDR_BASE | (myCart.myWriteOffset + myCart.myRamSize - 1))
|
||||
<< " used for Write Access";
|
||||
|
||||
if(myCart.myReadOffset > myCart.myWriteOffset)
|
||||
{
|
||||
desc << "\n$" << Common::Base::HEX4 << (ADDR_BASE | myCart.myReadOffset)
|
||||
<< " - $" << (ADDR_BASE | (myCart.myReadOffset + myCart.myRamSize - 1))
|
||||
<< " used for Read Access";
|
||||
}
|
||||
|
||||
return desc.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const ByteArray& CartEnhancedWidget::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& CartEnhancedWidget::internalRamCurrent(int start, int count)
|
||||
{
|
||||
myRamCurrent.clear();
|
||||
for(int i = 0; i < count; i++)
|
||||
myRamCurrent.push_back(myCart.myRAM[start + i]);
|
||||
return myRamCurrent;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartEnhancedWidget::internalRamSetValue(int addr, uInt8 value)
|
||||
{
|
||||
myCart.myRAM[addr] = value;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 CartEnhancedWidget::internalRamGetValue(int addr)
|
||||
{
|
||||
return myCart.myRAM[addr];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartEnhancedWidget::internalRamLabel(int addr)
|
||||
{
|
||||
CartDebug& dbg = instance().debugger().cartDebug();
|
||||
return dbg.getLabel(addr + ADDR_BASE + myCart.myReadOffset, false);
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2020 by Bradford W. Mott, Stephen Anthony
|
||||
// and the Stella Team
|
||||
//
|
||||
// See the file "License.txt" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#ifndef CART_ENHANCED_WIDGET_HXX
|
||||
#define CART_ENHANCED_WIDGET_HXX
|
||||
|
||||
class CartridgeEnhanced;
|
||||
class PopUpWidget;
|
||||
|
||||
namespace GUI {
|
||||
class Font;
|
||||
}
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
|
||||
class CartEnhancedWidget : public CartDebugWidget
|
||||
{
|
||||
public:
|
||||
CartEnhancedWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||
const GUI::Font& nfont,
|
||||
int x, int y, int w, int h,
|
||||
CartridgeEnhanced& cart);
|
||||
virtual ~CartEnhancedWidget() = default;
|
||||
|
||||
protected:
|
||||
void initialize();
|
||||
|
||||
virtual size_t size();
|
||||
|
||||
virtual string manufacturer() = 0;
|
||||
|
||||
virtual string description();
|
||||
|
||||
virtual int descriptionLines();
|
||||
|
||||
virtual string ramDescription();
|
||||
|
||||
virtual string romDescription();
|
||||
|
||||
virtual void bankSelect(int& ypos);
|
||||
|
||||
virtual string hotspotStr(int bank, int segment = 0);
|
||||
|
||||
virtual int bankSegs(); // { return myCart.myBankSegs; }
|
||||
|
||||
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
|
||||
|
||||
protected:
|
||||
enum { kBankChanged = 'bkCH' };
|
||||
|
||||
struct CartState {
|
||||
ByteArray internalRam;
|
||||
ByteArray banks;
|
||||
};
|
||||
CartState myOldState;
|
||||
|
||||
CartridgeEnhanced& myCart;
|
||||
|
||||
// Distance between two hotspots
|
||||
int myHotspotDelta{1};
|
||||
|
||||
std::unique_ptr<PopUpWidget* []> myBankWidgets{nullptr};
|
||||
|
||||
|
||||
// Display all addresses based on this
|
||||
static constexpr uInt16 ADDR_BASE = 0xF000;
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
CartEnhancedWidget() = delete;
|
||||
CartEnhancedWidget(const CartEnhancedWidget&) = delete;
|
||||
CartEnhancedWidget(CartEnhancedWidget&&) = delete;
|
||||
CartEnhancedWidget& operator=(const CartEnhancedWidget&) = delete;
|
||||
CartEnhancedWidget& operator=(CartEnhancedWidget&&) = delete;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -16,85 +16,28 @@
|
|||
//============================================================================
|
||||
|
||||
#include "CartF0.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "CartF0Widget.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeF0Widget::CartridgeF0Widget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, CartridgeF0& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart)
|
||||
: CartEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||
{
|
||||
uInt32 size = 16 * 4096;
|
||||
myHotspotDelta = 0;
|
||||
initialize();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF0Widget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
info << "64K Megaboy F0 cartridge, 16 4K banks\n"
|
||||
<< "Startup bank = #" << cart.startBank() << " or undetermined\n"
|
||||
<< "Bankswitch triggered by accessing $1FF0\n";
|
||||
|
||||
// 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";
|
||||
}
|
||||
info << "Megaboy F0 cartridge, 16 4K banks\n"
|
||||
<< "Startup bank = #" << myCart.startBank() << " or undetermined\n"
|
||||
<< "Bankswitch triggered by accessing $" << Common::Base::HEX4 << 0xFFF0 << "\n";
|
||||
|
||||
int xpos = 2,
|
||||
ypos = addBaseInformation(size, "Dynacom Megaboy",
|
||||
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 CartridgeF0Widget::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 CartridgeF0Widget::handleCommand(CommandSender* sender,
|
||||
int cmd, int data, int id)
|
||||
{
|
||||
if(cmd == kBankChanged)
|
||||
{
|
||||
myCart.unlockBank();
|
||||
myCart.bank(myBank->getSelected());
|
||||
myCart.lockBank();
|
||||
invalidate();
|
||||
}
|
||||
return info.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -102,7 +45,8 @@ string CartridgeF0Widget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
buf << "Bank = #" << std::dec << myCart.getBank() << ", hotspot = $FFF0";
|
||||
buf << "Bank #" << std::dec << myCart.getBank()
|
||||
<< " (hotspot $" << Common::Base::HEX4 << 0xFFF0 << ")";
|
||||
|
||||
return buf.str();
|
||||
}
|
||||
|
|
|
@ -19,11 +19,10 @@
|
|||
#define CARTRIDGEF0_WIDGET_HXX
|
||||
|
||||
class CartridgeF0;
|
||||
class PopUpWidget;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
|
||||
class CartridgeF0Widget : public CartDebugWidget
|
||||
class CartridgeF0Widget : public CartEnhancedWidget
|
||||
{
|
||||
public:
|
||||
CartridgeF0Widget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -33,17 +32,13 @@ class CartridgeF0Widget : public CartDebugWidget
|
|||
virtual ~CartridgeF0Widget() = default;
|
||||
|
||||
private:
|
||||
CartridgeF0& myCart;
|
||||
PopUpWidget* myBank{nullptr};
|
||||
string manufacturer() override { return "Dynacom Megaboy"; }
|
||||
|
||||
enum { kBankChanged = 'bkCH' };
|
||||
|
||||
private:
|
||||
void loadConfig() override;
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||
string description() override;
|
||||
|
||||
string bankState() override;
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
CartridgeF0Widget() = delete;
|
||||
CartridgeF0Widget(const CartridgeF0Widget&) = delete;
|
||||
|
|
|
@ -15,157 +15,25 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include "Debugger.hxx"
|
||||
#include "CartDebug.hxx"
|
||||
#include "CartF4SC.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "CartF4SCWidget.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeF4SCWidget::CartridgeF4SCWidget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, CartridgeF4SC& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart)
|
||||
: CartEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||
{
|
||||
uInt16 size = 8 * 4096;
|
||||
initialize();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF4SCWidget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
info << "Standard F4SC cartridge, eight 4K banks\n"
|
||||
<< "128 bytes RAM @ $F000 - $F0FF\n"
|
||||
<< " $F080 - $F0FF (R), $F000 - $F07F (W)\n"
|
||||
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
|
||||
|
||||
// Eventually, we should query this from the debugger/disassembler
|
||||
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF4; i < 8; ++i, offset += 0x1000)
|
||||
{
|
||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||
start -= start % 0x1000;
|
||||
info << "Bank " << i << " @ $" << Common::Base::HEX4 << (start + 0x100) << " - "
|
||||
<< "$" << (start + 0xFFF) << " (hotspot = $F" << (spot+i) << ")\n";
|
||||
}
|
||||
|
||||
int xpos = 2,
|
||||
ypos = addBaseInformation(size, "Atari", info.str(), 15) + myLineHeight;
|
||||
|
||||
VariantList items;
|
||||
VarList::push_back(items, "0 ($FFF4)");
|
||||
VarList::push_back(items, "1 ($FFF5)");
|
||||
VarList::push_back(items, "2 ($FFF6)");
|
||||
VarList::push_back(items, "3 ($FFF7)");
|
||||
VarList::push_back(items, "4 ($FFF8)");
|
||||
VarList::push_back(items, "5 ($FFF9)");
|
||||
VarList::push_back(items, "6 ($FFFA)");
|
||||
VarList::push_back(items, "7 ($FFFB)");
|
||||
myBank =
|
||||
new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("0 ($FFFx)"),
|
||||
myLineHeight, items, "Set bank ",
|
||||
0, kBankChanged);
|
||||
myBank->setTarget(this);
|
||||
addFocusWidget(myBank);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeF4SCWidget::saveOldState()
|
||||
{
|
||||
myOldState.internalram.clear();
|
||||
|
||||
for(uInt32 i = 0; i < internalRamSize(); ++i)
|
||||
myOldState.internalram.push_back(myCart.myRAM[i]);
|
||||
|
||||
myOldState.bank = myCart.getBank();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeF4SCWidget::loadConfig()
|
||||
{
|
||||
myBank->setSelectedIndex(myCart.getBank(), myCart.getBank() != myOldState.bank);
|
||||
|
||||
CartDebugWidget::loadConfig();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeF4SCWidget::handleCommand(CommandSender* sender,
|
||||
int cmd, int data, int id)
|
||||
{
|
||||
if(cmd == kBankChanged)
|
||||
{
|
||||
myCart.unlockBank();
|
||||
myCart.bank(myBank->getSelected());
|
||||
myCart.lockBank();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF4SCWidget::bankState()
|
||||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static constexpr std::array<const char*, 8> spot = {
|
||||
"$FFF4", "$FFF5", "$FFF6", "$FFF7", "$FFF8", "$FFF9", "$FFFA", "$FFFB"
|
||||
};
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", hotspot = " << spot[myCart.getBank()];
|
||||
|
||||
return buf.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 CartridgeF4SCWidget::internalRamSize()
|
||||
{
|
||||
return 128;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 CartridgeF4SCWidget::internalRamRPort(int start)
|
||||
{
|
||||
return 0xF080 + start;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF4SCWidget::internalRamDescription()
|
||||
{
|
||||
ostringstream desc;
|
||||
desc << "$F000 - $F07F used for Write Access\n"
|
||||
<< "$F080 - $F0FF used for Read Access";
|
||||
|
||||
return desc.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const ByteArray& CartridgeF4SCWidget::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& CartridgeF4SCWidget::internalRamCurrent(int start, int count)
|
||||
{
|
||||
myRamCurrent.clear();
|
||||
for(int i = 0; i < count; i++)
|
||||
myRamCurrent.push_back(myCart.myRAM[start + i]);
|
||||
return myRamCurrent;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeF4SCWidget::internalRamSetValue(int addr, uInt8 value)
|
||||
{
|
||||
myCart.myRAM[addr] = value;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 CartridgeF4SCWidget::internalRamGetValue(int addr)
|
||||
{
|
||||
return myCart.myRAM[addr];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF4SCWidget::internalRamLabel(int addr)
|
||||
{
|
||||
CartDebug& dbg = instance().debugger().cartDebug();
|
||||
return dbg.getLabel(addr + 0xF080, false);
|
||||
info << "Standard F4SC cartridge, eight 4K banks\n";
|
||||
info << CartEnhancedWidget::description();
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
|
|
@ -19,11 +19,10 @@
|
|||
#define CARTRIDGEF4SC_WIDGET_HXX
|
||||
|
||||
class CartridgeF4SC;
|
||||
class PopUpWidget;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
|
||||
class CartridgeF4SCWidget : public CartDebugWidget
|
||||
class CartridgeF4SCWidget : public CartEnhancedWidget
|
||||
{
|
||||
public:
|
||||
CartridgeF4SCWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -33,36 +32,11 @@ class CartridgeF4SCWidget : public CartDebugWidget
|
|||
virtual ~CartridgeF4SCWidget() = default;
|
||||
|
||||
private:
|
||||
CartridgeF4SC& myCart;
|
||||
PopUpWidget* myBank{nullptr};
|
||||
string manufacturer() override { return "Atari"; }
|
||||
|
||||
struct CartState {
|
||||
ByteArray internalram;
|
||||
uInt16 bank{0};
|
||||
};
|
||||
CartState myOldState;
|
||||
|
||||
|
||||
enum { kBankChanged = 'bkCH' };
|
||||
string description() override;
|
||||
|
||||
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
|
||||
CartridgeF4SCWidget() = delete;
|
||||
CartridgeF4SCWidget(const CartridgeF4SCWidget&) = delete;
|
||||
|
|
|
@ -16,87 +16,24 @@
|
|||
//============================================================================
|
||||
|
||||
#include "CartF4.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "CartF4Widget.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeF4Widget::CartridgeF4Widget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, CartridgeF4& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart)
|
||||
: CartEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||
{
|
||||
uInt16 size = 8 * 4096;
|
||||
initialize();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF4Widget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
info << "Standard F4 cartridge, eight 4K banks\n"
|
||||
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
|
||||
|
||||
// Eventually, we should query this from the debugger/disassembler
|
||||
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF4; i < 8; ++i, offset += 0x1000)
|
||||
{
|
||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||
start -= start % 0x1000;
|
||||
info << "Bank " << i << " @ $" << Common::Base::HEX4 << start << " - "
|
||||
<< "$" << (start + 0xFFF) << " (hotspot = $F" << (spot+i) << ")\n";
|
||||
}
|
||||
|
||||
int xpos = 2,
|
||||
ypos = addBaseInformation(size, "Atari", info.str(), 15) + myLineHeight;
|
||||
|
||||
VariantList items;
|
||||
VarList::push_back(items, "0 ($FFF4)");
|
||||
VarList::push_back(items, "1 ($FFF5)");
|
||||
VarList::push_back(items, "2 ($FFF6)");
|
||||
VarList::push_back(items, "3 ($FFF7)");
|
||||
VarList::push_back(items, "4 ($FFF8)");
|
||||
VarList::push_back(items, "5 ($FFF9)");
|
||||
VarList::push_back(items, "6 ($FFFA)");
|
||||
VarList::push_back(items, "7 ($FFFB)");
|
||||
myBank =
|
||||
new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("0 ($FFFx)"),
|
||||
myLineHeight, items, "Set bank ",
|
||||
0, kBankChanged);
|
||||
myBank->setTarget(this);
|
||||
addFocusWidget(myBank);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeF4Widget::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 CartridgeF4Widget::handleCommand(CommandSender* sender,
|
||||
int cmd, int data, int id)
|
||||
{
|
||||
if(cmd == kBankChanged)
|
||||
{
|
||||
myCart.unlockBank();
|
||||
myCart.bank(myBank->getSelected());
|
||||
myCart.lockBank();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF4Widget::bankState()
|
||||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static constexpr std::array<const char*, 8> spot = {
|
||||
"$FFF4", "$FFF5", "$FFF6", "$FFF7", "$FFF8", "$FFF9", "$FFFA", "$FFFB"
|
||||
};
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", hotspot = " << spot[myCart.getBank()];
|
||||
|
||||
return buf.str();
|
||||
info << "Standard F4 cartridge, eight 4K banks\n";
|
||||
info << CartEnhancedWidget::description();
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
|
|
@ -19,11 +19,10 @@
|
|||
#define CARTRIDGEF4_WIDGET_HXX
|
||||
|
||||
class CartridgeF4;
|
||||
class PopUpWidget;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
|
||||
class CartridgeF4Widget : public CartDebugWidget
|
||||
class CartridgeF4Widget : public CartEnhancedWidget
|
||||
{
|
||||
public:
|
||||
CartridgeF4Widget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -33,17 +32,11 @@ class CartridgeF4Widget : public CartDebugWidget
|
|||
virtual ~CartridgeF4Widget() = default;
|
||||
|
||||
private:
|
||||
CartridgeF4& myCart;
|
||||
PopUpWidget* myBank{nullptr};
|
||||
string manufacturer() override { return "Atari"; }
|
||||
|
||||
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
|
||||
CartridgeF4Widget() = delete;
|
||||
CartridgeF4Widget(const CartridgeF4Widget&) = delete;
|
||||
|
|
|
@ -15,151 +15,25 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include "Debugger.hxx"
|
||||
#include "CartDebug.hxx"
|
||||
#include "CartF6SC.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "CartF6SCWidget.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeF6SCWidget::CartridgeF6SCWidget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, CartridgeF6SC& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart)
|
||||
: CartEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||
{
|
||||
uInt16 size = 4 * 4096;
|
||||
initialize();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF6SCWidget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
info << "Standard F6SC cartridge, four 4K banks\n"
|
||||
<< "128 bytes RAM @ $F000 - $F0FF\n"
|
||||
<< " $F080 - $F0FF (R), $F000 - $F07F (W)\n"
|
||||
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
|
||||
|
||||
// Eventually, we should query this from the debugger/disassembler
|
||||
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF6; i < 4; ++i, offset += 0x1000)
|
||||
{
|
||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||
start -= start % 0x1000;
|
||||
info << "Bank " << i << " @ $" << Common::Base::HEX4 << (start + 0x100) << " - "
|
||||
<< "$" << (start + 0xFFF) << " (hotspot = $F" << (spot+i) << ")\n";
|
||||
}
|
||||
|
||||
int xpos = 2,
|
||||
ypos = addBaseInformation(size, "Atari", info.str()) + myLineHeight;
|
||||
|
||||
VariantList items;
|
||||
VarList::push_back(items, "0 ($FFF6)");
|
||||
VarList::push_back(items, "1 ($FFF7)");
|
||||
VarList::push_back(items, "2 ($FFF8)");
|
||||
VarList::push_back(items, "3 ($FFF9)");
|
||||
myBank =
|
||||
new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("0 ($FFFx)"),
|
||||
myLineHeight, items, "Set bank ",
|
||||
0, kBankChanged);
|
||||
myBank->setTarget(this);
|
||||
addFocusWidget(myBank);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeF6SCWidget::saveOldState()
|
||||
{
|
||||
myOldState.internalram.clear();
|
||||
|
||||
for(uInt32 i = 0; i < internalRamSize(); ++i)
|
||||
myOldState.internalram.push_back(myCart.myRAM[i]);
|
||||
|
||||
myOldState.bank = myCart.getBank();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeF6SCWidget::loadConfig()
|
||||
{
|
||||
myBank->setSelectedIndex(myCart.getBank(), myCart.getBank() != myOldState.bank);
|
||||
|
||||
CartDebugWidget::loadConfig();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeF6SCWidget::handleCommand(CommandSender* sender,
|
||||
int cmd, int data, int id)
|
||||
{
|
||||
if(cmd == kBankChanged)
|
||||
{
|
||||
myCart.unlockBank();
|
||||
myCart.bank(myBank->getSelected());
|
||||
myCart.lockBank();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF6SCWidget::bankState()
|
||||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static constexpr std::array<const char*, 4> spot = { "$FFF6", "$FFF7", "$FFF8", "$FFF9" };
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", hotspot = " << spot[myCart.getBank()];
|
||||
|
||||
return buf.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 CartridgeF6SCWidget::internalRamSize()
|
||||
{
|
||||
return 128;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 CartridgeF6SCWidget::internalRamRPort(int start)
|
||||
{
|
||||
return 0xF080 + start;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF6SCWidget::internalRamDescription()
|
||||
{
|
||||
ostringstream desc;
|
||||
desc << "$F000 - $F07F used for Write Access\n"
|
||||
<< "$F080 - $F0FF used for Read Access";
|
||||
|
||||
return desc.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const ByteArray& CartridgeF6SCWidget::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& CartridgeF6SCWidget::internalRamCurrent(int start, int count)
|
||||
{
|
||||
myRamCurrent.clear();
|
||||
for(int i = 0; i < count; i++)
|
||||
myRamCurrent.push_back(myCart.myRAM[start + i]);
|
||||
return myRamCurrent;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeF6SCWidget::internalRamSetValue(int addr, uInt8 value)
|
||||
{
|
||||
myCart.myRAM[addr] = value;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 CartridgeF6SCWidget::internalRamGetValue(int addr)
|
||||
{
|
||||
return myCart.myRAM[addr];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF6SCWidget::internalRamLabel(int addr)
|
||||
{
|
||||
CartDebug& dbg = instance().debugger().cartDebug();
|
||||
return dbg.getLabel(addr + 0xF080, false);
|
||||
info << "Standard F6SC cartridge, four 4K banks\n";
|
||||
info << CartEnhancedWidget::description();
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
|
|
@ -19,11 +19,10 @@
|
|||
#define CARTRIDGEF6SC_WIDGET_HXX
|
||||
|
||||
class CartridgeF6SC;
|
||||
class PopUpWidget;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
|
||||
class CartridgeF6SCWidget : public CartDebugWidget
|
||||
class CartridgeF6SCWidget : public CartEnhancedWidget
|
||||
{
|
||||
public:
|
||||
CartridgeF6SCWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -33,34 +32,11 @@ class CartridgeF6SCWidget : public CartDebugWidget
|
|||
virtual ~CartridgeF6SCWidget() = default;
|
||||
|
||||
private:
|
||||
struct CartState {
|
||||
ByteArray internalram;
|
||||
uInt16 bank{0};
|
||||
};
|
||||
CartridgeF6SC& myCart;
|
||||
PopUpWidget* myBank{nullptr};
|
||||
CartState myOldState;
|
||||
string manufacturer() override { return "Atari"; }
|
||||
|
||||
enum { kBankChanged = 'bkCH' };
|
||||
string description() override;
|
||||
|
||||
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
|
||||
CartridgeF6SCWidget() = delete;
|
||||
CartridgeF6SCWidget(const CartridgeF6SCWidget&) = delete;
|
||||
|
|
|
@ -16,81 +16,24 @@
|
|||
//============================================================================
|
||||
|
||||
#include "CartF6.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "CartF6Widget.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeF6Widget::CartridgeF6Widget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, CartridgeF6& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart)
|
||||
: CartEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||
{
|
||||
uInt16 size = 4 * 4096;
|
||||
initialize();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF6Widget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
info << "Standard F6 cartridge, four 4K banks\n"
|
||||
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
|
||||
|
||||
// Eventually, we should query this from the debugger/disassembler
|
||||
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF6; i < 4; ++i, offset += 0x1000)
|
||||
{
|
||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||
start -= start % 0x1000;
|
||||
info << "Bank " << i << " @ $" << Common::Base::HEX4 << start << " - "
|
||||
<< "$" << (start + 0xFFF) << " (hotspot = $F" << (spot+i) << ")\n";
|
||||
}
|
||||
|
||||
int xpos = 2,
|
||||
ypos = addBaseInformation(size, "Atari", info.str()) + myLineHeight;
|
||||
|
||||
VariantList items;
|
||||
VarList::push_back(items, "0 ($FFF6)");
|
||||
VarList::push_back(items, "1 ($FFF7)");
|
||||
VarList::push_back(items, "2 ($FFF8)");
|
||||
VarList::push_back(items, "3 ($FFF9)");
|
||||
myBank =
|
||||
new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("0 ($FFFx) "),
|
||||
myLineHeight, items, "Set bank ",
|
||||
0, kBankChanged);
|
||||
myBank->setTarget(this);
|
||||
addFocusWidget(myBank);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeF6Widget::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 CartridgeF6Widget::handleCommand(CommandSender* sender,
|
||||
int cmd, int data, int id)
|
||||
{
|
||||
if(cmd == kBankChanged)
|
||||
{
|
||||
myCart.unlockBank();
|
||||
myCart.bank(myBank->getSelected());
|
||||
myCart.lockBank();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF6Widget::bankState()
|
||||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static constexpr std::array<const char*, 4> spot = { "$FFF6", "$FFF7", "$FFF8", "$FFF9" };
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", hotspot = " << spot[myCart.getBank()];
|
||||
|
||||
return buf.str();
|
||||
info << "Standard F6 cartridge, four 4K banks\n";
|
||||
info << CartEnhancedWidget::description();
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
|
|
@ -19,11 +19,10 @@
|
|||
#define CARTRIDGEF6_WIDGET_HXX
|
||||
|
||||
class CartridgeF6;
|
||||
class PopUpWidget;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
|
||||
class CartridgeF6Widget : public CartDebugWidget
|
||||
class CartridgeF6Widget : public CartEnhancedWidget
|
||||
{
|
||||
public:
|
||||
CartridgeF6Widget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -33,17 +32,11 @@ class CartridgeF6Widget : public CartDebugWidget
|
|||
virtual ~CartridgeF6Widget() = default;
|
||||
|
||||
private:
|
||||
CartridgeF6& myCart;
|
||||
PopUpWidget* myBank{nullptr};
|
||||
string manufacturer() override { return "Atari"; }
|
||||
|
||||
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
|
||||
CartridgeF6Widget() = delete;
|
||||
CartridgeF6Widget(const CartridgeF6Widget&) = delete;
|
||||
|
|
|
@ -15,149 +15,25 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include "Debugger.hxx"
|
||||
#include "CartDebug.hxx"
|
||||
#include "CartF8SC.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "CartF8SCWidget.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeF8SCWidget::CartridgeF8SCWidget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, CartridgeF8SC& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart)
|
||||
: CartEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||
{
|
||||
uInt16 size = 8192;
|
||||
initialize();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF8SCWidget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
info << "Standard F8SC cartridge, two 4K banks\n"
|
||||
<< "128 bytes RAM @ $F000 - $F0FF\n"
|
||||
<< " $F080 - $F0FF (R), $F000 - $F07F (W)\n"
|
||||
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
|
||||
|
||||
// Eventually, we should query this from the debugger/disassembler
|
||||
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF8; i < 2; ++i, offset += 0x1000)
|
||||
{
|
||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||
start -= start % 0x1000;
|
||||
info << "Bank " << i << " @ $" << Common::Base::HEX4 << (start + 0x100) << " - "
|
||||
<< "$" << (start + 0xFFF) << " (hotspot = $F" << (spot+i) << ")\n";
|
||||
}
|
||||
|
||||
int xpos = 2,
|
||||
ypos = addBaseInformation(size, "Atari", info.str()) + myLineHeight;
|
||||
|
||||
VariantList items;
|
||||
VarList::push_back(items, "0 ($FFF8)");
|
||||
VarList::push_back(items, "1 ($FFF9)");
|
||||
myBank =
|
||||
new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("0 ($FFFx)"),
|
||||
myLineHeight, items, "Set bank ",
|
||||
0, kBankChanged);
|
||||
myBank->setTarget(this);
|
||||
addFocusWidget(myBank);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeF8SCWidget::saveOldState()
|
||||
{
|
||||
myOldState.internalram.clear();
|
||||
|
||||
for(uInt32 i = 0; i < internalRamSize(); ++i)
|
||||
myOldState.internalram.push_back(myCart.myRAM[i]);
|
||||
|
||||
myOldState.bank = myCart.getBank();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeF8SCWidget::loadConfig()
|
||||
{
|
||||
myBank->setSelectedIndex(myCart.getBank(), myCart.getBank() != myOldState.bank);
|
||||
|
||||
CartDebugWidget::loadConfig();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeF8SCWidget::handleCommand(CommandSender* sender,
|
||||
int cmd, int data, int id)
|
||||
{
|
||||
if(cmd == kBankChanged)
|
||||
{
|
||||
myCart.unlockBank();
|
||||
myCart.bank(myBank->getSelected());
|
||||
myCart.lockBank();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF8SCWidget::bankState()
|
||||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static constexpr std::array<const char*, 2> spot = { "$FFF8", "$FFF9" };
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", hotspot = " << spot[myCart.getBank()];
|
||||
|
||||
return buf.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 CartridgeF8SCWidget::internalRamSize()
|
||||
{
|
||||
return 128;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 CartridgeF8SCWidget::internalRamRPort(int start)
|
||||
{
|
||||
return 0xF080 + start;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF8SCWidget::internalRamDescription()
|
||||
{
|
||||
ostringstream desc;
|
||||
desc << "$F000 - $F07F used for Write Access\n"
|
||||
<< "$F080 - $F0FF used for Read Access";
|
||||
|
||||
return desc.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const ByteArray& CartridgeF8SCWidget::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& CartridgeF8SCWidget::internalRamCurrent(int start, int count)
|
||||
{
|
||||
myRamCurrent.clear();
|
||||
for(int i = 0; i < count; i++)
|
||||
myRamCurrent.push_back(myCart.myRAM[start + i]);
|
||||
return myRamCurrent;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeF8SCWidget::internalRamSetValue(int addr, uInt8 value)
|
||||
{
|
||||
myCart.myRAM[addr] = value;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 CartridgeF8SCWidget::internalRamGetValue(int addr)
|
||||
{
|
||||
return myCart.myRAM[addr];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF8SCWidget::internalRamLabel(int addr)
|
||||
{
|
||||
CartDebug& dbg = instance().debugger().cartDebug();
|
||||
return dbg.getLabel(addr + 0xF080, false);
|
||||
info << "Standard F8SC cartridge, two 4K banks\n";
|
||||
info << CartEnhancedWidget::description();
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
|
|
@ -19,11 +19,10 @@
|
|||
#define CARTRIDGEF8SC_WIDGET_HXX
|
||||
|
||||
class CartridgeF8SC;
|
||||
class PopUpWidget;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
|
||||
class CartridgeF8SCWidget : public CartDebugWidget
|
||||
class CartridgeF8SCWidget : public CartEnhancedWidget
|
||||
{
|
||||
public:
|
||||
CartridgeF8SCWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -33,35 +32,11 @@ class CartridgeF8SCWidget : public CartDebugWidget
|
|||
virtual ~CartridgeF8SCWidget() = default;
|
||||
|
||||
private:
|
||||
CartridgeF8SC& myCart;
|
||||
PopUpWidget* myBank{nullptr};
|
||||
string manufacturer() override { return "Atari"; }
|
||||
|
||||
struct CartState {
|
||||
ByteArray internalram;
|
||||
uInt16 bank{0};
|
||||
};
|
||||
CartState myOldState;
|
||||
|
||||
enum { kBankChanged = 'bkCH' };
|
||||
string description() override;
|
||||
|
||||
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
|
||||
CartridgeF8SCWidget() = delete;
|
||||
CartridgeF8SCWidget(const CartridgeF8SCWidget&) = delete;
|
||||
|
|
|
@ -16,79 +16,24 @@
|
|||
//============================================================================
|
||||
|
||||
#include "CartF8.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "CartF8Widget.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeF8Widget::CartridgeF8Widget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, CartridgeF8& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart)
|
||||
: CartEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||
{
|
||||
uInt16 size = 2 * 4096;
|
||||
initialize();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF8Widget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
info << "Standard F8 cartridge, two 4K banks\n"
|
||||
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
|
||||
|
||||
// Eventually, we should query this from the debugger/disassembler
|
||||
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF8; i < 2; ++i, offset += 0x1000)
|
||||
{
|
||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||
start -= start % 0x1000;
|
||||
info << "Bank " << i << " @ $" << Common::Base::HEX4 << start << " - "
|
||||
<< "$" << (start + 0xFFF) << " (hotspot = $F" << (spot+i) << ")\n";
|
||||
}
|
||||
|
||||
int xpos = 2,
|
||||
ypos = addBaseInformation(size, "Atari", info.str()) + myLineHeight;
|
||||
|
||||
VariantList items;
|
||||
VarList::push_back(items, "0 ($FFF8)");
|
||||
VarList::push_back(items, "1 ($FFF9)");
|
||||
myBank =
|
||||
new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("0 ($FFFx)"),
|
||||
myLineHeight, items, "Set bank ",
|
||||
0, kBankChanged);
|
||||
myBank->setTarget(this);
|
||||
addFocusWidget(myBank);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeF8Widget::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 CartridgeF8Widget::handleCommand(CommandSender* sender,
|
||||
int cmd, int data, int id)
|
||||
{
|
||||
if(cmd == kBankChanged)
|
||||
{
|
||||
myCart.unlockBank();
|
||||
myCart.bank(myBank->getSelected());
|
||||
myCart.lockBank();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeF8Widget::bankState()
|
||||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static constexpr std::array<const char*, 2> spot = { "$FFF8", "$FFF9" };
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", hotspot = " << spot[myCart.getBank()];
|
||||
|
||||
return buf.str();
|
||||
info << "Standard F8 cartridge, two 4K banks\n";
|
||||
info << CartEnhancedWidget::description();
|
||||
|
||||
return info.str();
|
||||
}
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
class CartridgeF8;
|
||||
class PopUpWidget;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
|
||||
class CartridgeF8Widget : public CartDebugWidget
|
||||
class CartridgeF8Widget : public CartEnhancedWidget
|
||||
{
|
||||
public:
|
||||
CartridgeF8Widget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -33,17 +33,11 @@ class CartridgeF8Widget : public CartDebugWidget
|
|||
virtual ~CartridgeF8Widget() = default;
|
||||
|
||||
private:
|
||||
CartridgeF8& myCart;
|
||||
PopUpWidget* myBank{nullptr};
|
||||
string manufacturer() override { return "Atari"; }
|
||||
|
||||
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
|
||||
CartridgeF8Widget() = delete;
|
||||
CartridgeF8Widget(const CartridgeF8Widget&) = delete;
|
||||
|
|
|
@ -16,89 +16,37 @@
|
|||
//============================================================================
|
||||
|
||||
#include "CartUA.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "CartUAWidget.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeUAWidget::CartridgeUAWidget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, CartridgeUA& cart, bool swapHotspots)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart),
|
||||
: CartEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart),
|
||||
mySwappedHotspots(swapHotspots)
|
||||
{
|
||||
uInt16 size = 2 * 4096;
|
||||
myHotspotDelta = 0x20;
|
||||
initialize();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeUAWidget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
info << "8K UA cartridge" << (mySwappedHotspots ? " (swapped banks)" : "") << ", two 4K banks\n"
|
||||
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
|
||||
|
||||
// Eventually, we should query this from the debugger/disassembler
|
||||
for(uInt32 i = 0, offset = 0xFFC, spot = mySwappedHotspots ? 0x240 : 0x220; i < 2;
|
||||
++i, offset += 0x1000, spot += mySwappedHotspots ? -0x20 : 0x20)
|
||||
{
|
||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||
start -= start % 0x1000;
|
||||
info << "Bank " << i << " @ $" << Common::Base::HEX4 << start << " - "
|
||||
<< "$" << (start + 0xFFF) << " (hotspots = $" << spot << ", $" << (spot | 0x80) << ")\n";
|
||||
}
|
||||
info << "8K UA cartridge" << (mySwappedHotspots ? " (swapped banks)" : "") << ", two 4K banks\n";
|
||||
info << CartEnhancedWidget::description();
|
||||
|
||||
int xpos = 2,
|
||||
ypos = addBaseInformation(size, "UA Limited", info.str()) + myLineHeight;
|
||||
|
||||
VariantList items;
|
||||
if (swapHotspots)
|
||||
{
|
||||
VarList::push_back(items, "0 ($240, $2C0)");
|
||||
VarList::push_back(items, "1 ($220, $2A0)");
|
||||
}
|
||||
else
|
||||
{
|
||||
VarList::push_back(items, "0 ($220, $2A0)");
|
||||
VarList::push_back(items, "1 ($240, $2C0)");
|
||||
}
|
||||
myBank =
|
||||
new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("0 ($FFx, $FFx)"),
|
||||
myLineHeight, items, "Set bank ",
|
||||
0, kBankChanged);
|
||||
myBank->setTarget(this);
|
||||
addFocusWidget(myBank);
|
||||
return info.str();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeUAWidget::loadConfig()
|
||||
string CartridgeUAWidget::hotspotStr(int bank, int)
|
||||
{
|
||||
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());
|
||||
ostringstream info;
|
||||
uInt16 hotspot = myCart.hotspot() + (bank ^ (mySwappedHotspots ? 1 : 0)) * myHotspotDelta;
|
||||
|
||||
myBank->setSelectedIndex(myCart.getBank(), state.bank != oldstate.bank);
|
||||
info << "$" << Common::Base::HEX1 << hotspot << ", $" << (hotspot | 0x80);
|
||||
|
||||
CartDebugWidget::loadConfig();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeUAWidget::handleCommand(CommandSender* sender,
|
||||
int cmd, int data, int id)
|
||||
{
|
||||
if(cmd == kBankChanged)
|
||||
{
|
||||
myCart.unlockBank();
|
||||
myCart.bank(myBank->getSelected());
|
||||
myCart.lockBank();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartridgeUAWidget::bankState()
|
||||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static constexpr std::array<const char*, 2> spot = { "$220, $2A0", "$240, $2C0" };
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", hotspots = " << spot[myCart.getBank() ^ (mySwappedHotspots ? 1U : 0U)];
|
||||
|
||||
return buf.str();
|
||||
return info.str();
|
||||
}
|
||||
|
|
|
@ -19,11 +19,10 @@
|
|||
#define CARTRIDGEUA_WIDGET_HXX
|
||||
|
||||
class CartridgeUA;
|
||||
class PopUpWidget;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
|
||||
class CartridgeUAWidget : public CartDebugWidget
|
||||
class CartridgeUAWidget : public CartEnhancedWidget
|
||||
{
|
||||
public:
|
||||
CartridgeUAWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||
|
@ -33,19 +32,16 @@ class CartridgeUAWidget : public CartDebugWidget
|
|||
virtual ~CartridgeUAWidget() = default;
|
||||
|
||||
private:
|
||||
CartridgeUA& myCart;
|
||||
PopUpWidget* myBank{nullptr};
|
||||
string manufacturer() override { return "UA Limited"; }
|
||||
|
||||
bool mySwappedHotspots;
|
||||
string description() override;
|
||||
|
||||
enum { kBankChanged = 'bkCH' };
|
||||
string hotspotStr(int bank, int) override;
|
||||
|
||||
private:
|
||||
void loadConfig() override;
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||
|
||||
string bankState() override;
|
||||
const bool mySwappedHotspots;
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
CartridgeUAWidget() = delete;
|
||||
CartridgeUAWidget(const CartridgeUAWidget&) = delete;
|
||||
|
|
|
@ -28,6 +28,7 @@ MODULE_OBJS := \
|
|||
src/debugger/gui/CartDPCPlusWidget.o \
|
||||
src/debugger/gui/CartDPCWidget.o \
|
||||
src/debugger/gui/CartE0Widget.o \
|
||||
src/debugger/gui/CartEnhancedWidget.o \
|
||||
src/debugger/gui/CartMNetworkWidget.o \
|
||||
src/debugger/gui/CartE7Widget.o \
|
||||
src/debugger/gui/CartE78KWidget.o \
|
||||
|
|
|
@ -23,5 +23,4 @@ Cartridge4K::Cartridge4K(const ByteBuffer& image, size_t size,
|
|||
const string& md5, const Settings& settings)
|
||||
: CartridgeEnhanced(image, size, md5, settings)
|
||||
{
|
||||
cerr << "Cartridge4K" << endl;
|
||||
}
|
||||
|
|
|
@ -205,7 +205,7 @@ bool CartridgeEnhanced::bank(uInt16 bank, uInt16 segment)
|
|||
// for ROMs < 4_KB, the whole address space will be mapped.
|
||||
uInt16 toAddr = (ROM_OFFSET + segmentOffset + (mySize < 4_KB ? 4_KB : myBankSize)) & ~System::PAGE_MASK;
|
||||
|
||||
if(hotspot != 0)
|
||||
if(hotspot & 0x1000)
|
||||
hotSpotAddr = (hotspot & ~System::PAGE_MASK);
|
||||
else
|
||||
hotSpotAddr = 0xFFFF; // none
|
||||
|
|
|
@ -22,6 +22,9 @@ class System;
|
|||
|
||||
#include "bspf.hxx"
|
||||
#include "Cart.hxx"
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
#include "CartEnhancedWidget.hxx"
|
||||
#endif
|
||||
|
||||
/**
|
||||
Enhanced cartridge base class used for multiple cart types.
|
||||
|
@ -30,6 +33,8 @@ class System;
|
|||
*/
|
||||
class CartridgeEnhanced : public Cartridge
|
||||
{
|
||||
friend class CartEnhancedWidget;
|
||||
|
||||
public:
|
||||
/**
|
||||
Create a new cartridge using the specified image
|
||||
|
@ -142,7 +147,6 @@ class CartridgeEnhanced : public Cartridge
|
|||
*/
|
||||
bool load(Serializer& in) override;
|
||||
|
||||
public:
|
||||
/**
|
||||
Get the byte at the specified address.
|
||||
|
||||
|
@ -159,19 +163,25 @@ class CartridgeEnhanced : public Cartridge
|
|||
*/
|
||||
bool poke(uInt16 address, uInt8 value) override;
|
||||
|
||||
/**
|
||||
Get the hotspot in ROM address space.
|
||||
|
||||
@return The first hotspot address (ususally in ROM) space or 0
|
||||
*/
|
||||
virtual uInt16 hotspot() const { return 0; }
|
||||
// TODO: handle cases where there the hotspots cover multiple pages
|
||||
|
||||
protected:
|
||||
// The '2 ^ N = bank segment size' exponent
|
||||
uInt16 myBankShift{BANK_SHIFT}; // default 12 (-> one 4K segment)
|
||||
|
||||
// The size of a bank's segment
|
||||
uInt16 myBankSize{0};
|
||||
uInt16 myBankSize{uInt16(4_KB)};
|
||||
|
||||
// The mask for a bank segment
|
||||
uInt16 myBankMask{0};
|
||||
|
||||
// The number of segments a bank is split into
|
||||
uInt16 myBankSegs{0};
|
||||
uInt16 myBankMask{ROM_MASK};
|
||||
|
||||
protected:
|
||||
// The extra RAM size
|
||||
uInt16 myRamSize{RAM_SIZE}; // default 0
|
||||
|
||||
|
@ -181,6 +191,9 @@ class CartridgeEnhanced : public Cartridge
|
|||
// The mask for the extra RAM
|
||||
uInt16 myRamMask{0}; // RAM_SIZE - 1, but doesn't matter when RAM_SIZE is 0
|
||||
|
||||
// The number of segments a bank is split into (default 1)
|
||||
uInt16 myBankSegs{1};
|
||||
|
||||
// The offset into ROM space for reading from ROM
|
||||
// This is zero for types without RAM and with banked RAM
|
||||
// - xxSC = 0x0100
|
||||
|
@ -259,14 +272,6 @@ class CartridgeEnhanced : public Cartridge
|
|||
*/
|
||||
virtual uInt16 getStartBank() const { return 0; }
|
||||
|
||||
/**
|
||||
Get the hotspot in ROM address space.
|
||||
|
||||
@return The first hotspot address (ususally in ROM) space or 0
|
||||
*/
|
||||
virtual uInt16 hotspot() const { return 0; }
|
||||
// TODO: handle cases where there the hotspots cover multiple pages
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
CartridgeEnhanced() = delete;
|
||||
|
|
|
@ -100,6 +100,8 @@ class CartridgeUA : public CartridgeEnhanced
|
|||
private:
|
||||
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
|
||||
|
||||
uInt16 hotspot() const override { return 0x0220; }
|
||||
|
||||
private:
|
||||
// Previous Device's page access
|
||||
std::array<System::PageAccess, 2> myHotSpotPageAccess;
|
||||
|
|
|
@ -618,6 +618,7 @@
|
|||
<ClCompile Include="..\debugger\gui\CartEFWidget.cxx">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\debugger\gui\CartEnhancedWidget.cxx" />
|
||||
<ClCompile Include="..\debugger\gui\CartF0Widget.cxx">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
@ -1621,6 +1622,7 @@
|
|||
<ClInclude Include="..\debugger\gui\CartEFWidget.hxx">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\debugger\gui\CartEnhancedWidget.hxx" />
|
||||
<ClInclude Include="..\debugger\gui\CartF0Widget.hxx">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
|
|
|
@ -996,6 +996,9 @@
|
|||
<ClCompile Include="..\emucore\CartEnhanced.cxx">
|
||||
<Filter>Source Files\emucore</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\debugger\gui\CartEnhancedWidget.cxx">
|
||||
<Filter>Source Files\debugger</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\common\bspf.hxx">
|
||||
|
@ -2045,6 +2048,9 @@
|
|||
<ClInclude Include="..\emucore\CartEnhanced.hxx">
|
||||
<Filter>Header Files\emucore</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\debugger\gui\CartEnhancedWidget.hxx">
|
||||
<Filter>Header Files\debugger</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="stella.ico">
|
||||
|
|
Loading…
Reference in New Issue