Finally added a large patch from SpiceWare which adds an extended

cart RAM tab to the debugger.  This is tailored to each respective
cart bankswitch type, allowing much more information to be shown than
you'd see in the normal RAM area.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2921 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-06-13 16:28:28 +00:00
parent 791c908d8c
commit 5c75ff1c15
57 changed files with 2011 additions and 92 deletions

View File

@ -14,6 +14,9 @@
3.9.3 to 4.0: (xxxx xx, 2014)
* Added a much more detailed view of cart RAM to a new debugger tab.
Special thanks to SpiceWare for this implementation.
* Added preliminary support for 'DASH' bankswitching scheme by A. Davie.
* Added 'savesnap' debugger prompt command, and also associated

View File

@ -31,6 +31,7 @@
#include "Version.hxx"
#include "CartDebug.hxx"
#include "CartDebugWidget.hxx"
#include "CartRamWidget.hxx"
using namespace Common;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -44,11 +45,6 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
// Zero-page RAM is always present
addRamArea(0x80, 128, 0, 0);
// Add extended RAM
const RamAreaList& areas = console.cartridge().ramAreas();
for(RamAreaList::const_iterator i = areas.begin(); i != areas.end(); ++i)
addRamArea(i->start, i->size, i->roffset, i->woffset);
// Create bank information for each potential bank, and an extra one for ZP RAM
// Banksizes greater than 4096 indicate multi-bank ROMs, but we handle only
// 4K pieces at a time

View File

@ -41,6 +41,7 @@
#include "CartDebug.hxx"
#include "CartDebugWidget.hxx"
#include "CartRamWidget.hxx"
#include "CpuDebug.hxx"
#include "RiotDebug.hxx"
#include "TIADebug.hxx"

View File

@ -87,6 +87,17 @@ Cartridge3EWidget::Cartridge3EWidget(
addFocusWidget(myRAMBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3EWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
myOldState.internalram.push_back(myCart.myRAM[i]);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3EWidget::loadConfig()
{
@ -157,3 +168,65 @@ string Cartridge3EWidget::bankState()
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge3EWidget::internalRam()
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 Cartridge3EWidget::internalRamSize()
{
return 32*1024;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Cartridge3EWidget::internalRamDescription()
{
ostringstream desc;
desc << "Accessible 1K at a time via:\n"
<< " F000-F3FF used for Read Access\n"
<< " F400-F7FF used for Write Access";
return desc.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray Cartridge3EWidget::internalRamOld(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myOldState.internalram[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray Cartridge3EWidget::internalRamCurrent(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myCart.myRAM[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3EWidget::internalRamSetValue(int addr, uInt8 value)
{
myCart.myRAM[addr] = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 Cartridge3EWidget::internalRamGetValue(int addr)
{
return myCart.myRAM[addr];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Cartridge3EWidget::internalRamLabel(int addr)
{
CartDebug& dbg = instance().debugger().cartDebug();
return dbg.getLabel(addr + 0x1080, false);
}

View File

@ -34,16 +34,33 @@ class Cartridge3EWidget : public CartDebugWidget
Cartridge3E& cart);
virtual ~Cartridge3EWidget() { }
void saveOldState();
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
string bankState();
// start of functions for Cartridge RAM tab
bool internalRam();
uInt32 internalRamSize();
string internalRamDescription();
ByteArray internalRamOld(int start, int count);
ByteArray internalRamCurrent(int start, int count);
void internalRamSetValue(int addr, uInt8 value);
uInt8 internalRamGetValue(int addr);
string internalRamLabel(int addr);
// end of functions for Cartridge RAM tab
private:
Cartridge3E& myCart;
const uInt32 myNumRomBanks;
const uInt32 myNumRamBanks;
PopUpWidget *myROMBank, *myRAMBank;
struct CartState {
ByteArray internalram;
};
CartState myOldState;
enum {
kROMBankChanged = 'rmCH',

View File

@ -24,7 +24,8 @@
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)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
myCart(cart)
{
// Eventually, we should query this from the debugger/disassembler
uInt16 start = (cart.myImage[0xFFD] << 8) | cart.myImage[0xFFC];
@ -39,3 +40,75 @@ Cartridge4KSCWidget::Cartridge4KSCWidget(
addBaseInformation(4096, "homebrew intermediate format", info.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge4KSCWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
myOldState.internalram.push_back(myCart.myRAM[i]);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge4KSCWidget::internalRam()
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 Cartridge4KSCWidget::internalRamSize()
{
return 128;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Cartridge4KSCWidget::internalRamDescription()
{
ostringstream desc;
desc << "F000-F07F used for Write Access\n"
<< "F080-F0FF used for Read Access";
return desc.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray Cartridge4KSCWidget::internalRamOld(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myOldState.internalram[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray Cartridge4KSCWidget::internalRamCurrent(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myCart.myRAM[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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 + 0x1080, false);
}

View File

@ -35,6 +35,26 @@ class Cartridge4KSCWidget : public CartDebugWidget
// No implementation for non-bankswitched ROMs
void loadConfig() { }
void handleCommand(CommandSender* sender, int cmd, int data, int id) { }
void saveOldState();
// start of functions for Cartridge RAM tab
bool internalRam();
uInt32 internalRamSize();
string internalRamDescription();
ByteArray internalRamOld(int start, int count);
ByteArray internalRamCurrent(int start, int count);
void internalRamSetValue(int addr, uInt8 value);
uInt8 internalRamGetValue(int addr);
string internalRamLabel(int addr);
// end of functions for Cartridge RAM tab
private:
Cartridge4KSC& myCart;
struct CartState {
ByteArray internalram;
};
CartState myOldState;
};
#endif

View File

@ -122,6 +122,17 @@ CartridgeBFSCWidget::CartridgeBFSCWidget(
addFocusWidget(myBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeBFSCWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
myOldState.internalram.push_back(myCart.myRAM[i]);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeBFSCWidget::loadConfig()
{
@ -163,3 +174,64 @@ string CartridgeBFSCWidget::bankState()
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeBFSCWidget::internalRam()
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeBFSCWidget::internalRamSize()
{
return 128;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeBFSCWidget::internalRamDescription()
{
ostringstream desc;
desc << "F000-F07F used for Write Access\n"
<< "F080-F0FF used for Read Access";
return desc.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeBFSCWidget::internalRamOld(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myOldState.internalram[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeBFSCWidget::internalRamCurrent(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myCart.myRAM[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeBFSCWidget::internalRamSetValue(int addr, uInt8 value)
{
myCart.myRAM[addr] = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeBFSCWidget::internalRamGetValue(int addr)
{
return myCart.myRAM[addr];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeBFSCWidget::internalRamLabel(int addr)
{
CartDebug& dbg = instance().debugger().cartDebug();
return dbg.getLabel(addr + 0x1080, false);
}

View File

@ -34,14 +34,31 @@ class CartridgeBFSCWidget : public CartDebugWidget
CartridgeBFSC& cart);
virtual ~CartridgeBFSCWidget() { }
void saveOldState();
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
string bankState();
// start of functions for Cartridge RAM tab
bool internalRam();
uInt32 internalRamSize();
string internalRamDescription();
ByteArray internalRamOld(int start, int count);
ByteArray internalRamCurrent(int start, int count);
void internalRamSetValue(int addr, uInt8 value);
uInt8 internalRamGetValue(int addr);
string internalRamLabel(int addr);
// end of functions for Cartridge RAM tab
private:
CartridgeBFSC& myCart;
PopUpWidget* myBank;
struct CartState {
ByteArray internalram;
};
CartState myOldState;
enum { kBankChanged = 'bkCH' };
};

View File

@ -151,6 +151,13 @@ void CartridgeCMWidget::saveOldState()
{
myOldState.swcha = myCart.mySWCHA;
myOldState.column = myCart.myColumn;
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
myOldState.internalram.push_back(myCart.myRAM[i]);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -223,3 +230,65 @@ string CartridgeCMWidget::bankState()
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeCMWidget::internalRam()
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeCMWidget::internalRamSize()
{
return 2048;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeCMWidget::internalRamDescription()
{
ostringstream desc;
desc << "F800-FFFF used for Exclusive Read\n"
<< " or Exclusive Write Access";
return desc.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeCMWidget::internalRamOld(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myOldState.internalram[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeCMWidget::internalRamCurrent(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myCart.myRAM[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCMWidget::internalRamSetValue(int addr, uInt8 value)
{
myCart.myRAM[addr] = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeCMWidget::internalRamGetValue(int addr)
{
return myCart.myRAM[addr];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeCMWidget::internalRamLabel(int addr)
{
CartDebug& dbg = instance().debugger().cartDebug();
return dbg.getLabel(addr + 0x1080, false);
}

View File

@ -44,11 +44,23 @@ class CartridgeCMWidget : public CartDebugWidget
void handleCommand(CommandSender* sender, int cmd, int data, int id);
string bankState();
// start of functions for Cartridge RAM tab
bool internalRam();
uInt32 internalRamSize();
string internalRamDescription();
ByteArray internalRamOld(int start, int count);
ByteArray internalRamCurrent(int start, int count);
void internalRamSetValue(int addr, uInt8 value);
uInt8 internalRamGetValue(int addr);
string internalRamLabel(int addr);
// end of functions for Cartridge RAM tab
private:
struct CartState {
uInt8 swcha;
uInt8 column;
ByteArray internalram;
};
private:

View File

@ -55,6 +55,17 @@ CartridgeCTYWidget::CartridgeCTYWidget(
addFocusWidget(myBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCTYWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
myOldState.internalram.push_back(myCart.myRAM[i]);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCTYWidget::loadConfig()
{
@ -89,3 +100,64 @@ string CartridgeCTYWidget::bankState()
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeCTYWidget::internalRam()
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeCTYWidget::internalRamSize()
{
return 64;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeCTYWidget::internalRamDescription()
{
ostringstream desc;
desc << "F000-F03F used for Write Access\n"
<< "F040-F07F used for Read Access";
return desc.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeCTYWidget::internalRamOld(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myOldState.internalram[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeCTYWidget::internalRamCurrent(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myCart.myRAM[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCTYWidget::internalRamSetValue(int addr, uInt8 value)
{
myCart.myRAM[addr] = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeCTYWidget::internalRamGetValue(int addr)
{
return myCart.myRAM[addr];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeCTYWidget::internalRamLabel(int addr)
{
CartDebug& dbg = instance().debugger().cartDebug();
return dbg.getLabel(addr + 0x1080, false);
}

View File

@ -34,14 +34,31 @@ class CartridgeCTYWidget : public CartDebugWidget
CartridgeCTY& cart);
virtual ~CartridgeCTYWidget() { }
void saveOldState();
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
string bankState();
// start of functions for Cartridge RAM tab
bool internalRam();
uInt32 internalRamSize();
string internalRamDescription();
ByteArray internalRamOld(int start, int count);
ByteArray internalRamCurrent(int start, int count);
void internalRamSetValue(int addr, uInt8 value);
uInt8 internalRamGetValue(int addr);
string internalRamLabel(int addr);
// end of functions for Cartridge RAM tab
private:
CartridgeCTY& myCart;
PopUpWidget* myBank;
struct CartState {
ByteArray internalram;
};
CartState myOldState;
enum { kBankChanged = 'bkCH' };
};

View File

@ -24,7 +24,8 @@
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)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
myCart(cart)
{
// Eventually, we should query this from the debugger/disassembler
uInt16 size = 2048;
@ -40,3 +41,76 @@ CartridgeCVWidget::CartridgeCVWidget(
addBaseInformation(cart.mySize, "CommaVid", info.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCVWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
myOldState.internalram.push_back(myCart.myRAM[i]);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeCVWidget::internalRam()
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeCVWidget::internalRamSize()
{
return 1024;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeCVWidget::internalRamDescription()
{
ostringstream desc;
desc << "F000-F3FF used for Read Access\n"
<< "F400-F7FF used for Write Access";
return desc.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeCVWidget::internalRamOld(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myOldState.internalram[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeCVWidget::internalRamCurrent(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myCart.myRAM[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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 + 0x1080, false);
}

View File

@ -35,6 +35,27 @@ class CartridgeCVWidget : public CartDebugWidget
// No implementation for non-bankswitched ROMs
void loadConfig() { }
void handleCommand(CommandSender* sender, int cmd, int data, int id) { }
void saveOldState();
// start of functions for Cartridge RAM tab
bool internalRam();
uInt32 internalRamSize();
string internalRamDescription();
ByteArray internalRamOld(int start, int count);
ByteArray internalRamCurrent(int start, int count);
void internalRamSetValue(int addr, uInt8 value);
uInt8 internalRamGetValue(int addr);
string internalRamLabel(int addr);
// end of functions for Cartridge RAM tab
private:
CartridgeCV& myCart;
struct CartState {
ByteArray internalram;
};
CartState myOldState;
};
#endif

View File

@ -90,6 +90,17 @@ CartridgeDFSCWidget::CartridgeDFSCWidget(
addFocusWidget(myBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeDFSCWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
myOldState.internalram.push_back(myCart.myRAM[i]);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeDFSCWidget::loadConfig()
{
@ -127,3 +138,64 @@ string CartridgeDFSCWidget::bankState()
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeDFSCWidget::internalRam()
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeDFSCWidget::internalRamSize()
{
return 128;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeDFSCWidget::internalRamDescription()
{
ostringstream desc;
desc << "F000-F07F used for Write Access\n"
<< "F080-F0FF used for Read Access";
return desc.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeDFSCWidget::internalRamOld(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myOldState.internalram[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeDFSCWidget::internalRamCurrent(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myCart.myRAM[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeDFSCWidget::internalRamSetValue(int addr, uInt8 value)
{
myCart.myRAM[addr] = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeDFSCWidget::internalRamGetValue(int addr)
{
return myCart.myRAM[addr];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeDFSCWidget::internalRamLabel(int addr)
{
CartDebug& dbg = instance().debugger().cartDebug();
return dbg.getLabel(addr + 0x1080, false);
}

View File

@ -34,14 +34,31 @@ class CartridgeDFSCWidget : public CartDebugWidget
CartridgeDFSC& cart);
virtual ~CartridgeDFSCWidget() { }
void saveOldState();
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
string bankState();
// start of functions for Cartridge RAM tab
bool internalRam();
uInt32 internalRamSize();
string internalRamDescription();
ByteArray internalRamOld(int start, int count);
ByteArray internalRamCurrent(int start, int count);
void internalRamSetValue(int addr, uInt8 value);
uInt8 internalRamGetValue(int addr);
string internalRamLabel(int addr);
// end of functions for Cartridge RAM tab
private:
CartridgeDFSC& myCart;
PopUpWidget* myBank;
struct CartState {
ByteArray internalram;
};
CartState myOldState;
enum { kBankChanged = 'bkCH' };
};

View File

@ -193,6 +193,7 @@ void CartridgeDPCPlusWidget::saveOldState()
myOldState.mcounters.clear();
myOldState.mfreqs.clear();
myOldState.mwaves.clear();
myOldState.internalram.clear();
for(int i = 0; i < 8; ++i)
{
@ -211,6 +212,11 @@ void CartridgeDPCPlusWidget::saveOldState()
}
myOldState.random = myCart.myRandomNumber;
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
myOldState.internalram.push_back(myCart.myDisplayImage[i]);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -330,3 +336,61 @@ string CartridgeDPCPlusWidget::bankState()
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeDPCPlusWidget::internalRam()
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeDPCPlusWidget::internalRamSize()
{
return 5*1024;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeDPCPlusWidget::internalRamDescription()
{
ostringstream desc;
desc << "0000-0FFF - 4K display data\n"
<< " indirectly accessible to 6507\n"
<< " via DPC+'s Data Fetcher registers\n"
<< "1000-13FF - 1K frequency table,\n"
<< " C variables and C stack\n"
<< " not accessible to 6507";
return desc.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeDPCPlusWidget::internalRamOld(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myOldState.internalram[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeDPCPlusWidget::internalRamCurrent(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myCart.myDisplayImage[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeDPCPlusWidget::internalRamSetValue(int addr, uInt8 value)
{
myCart.myDisplayImage[addr] = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeDPCPlusWidget::internalRamGetValue(int addr)
{
return myCart.myDisplayImage[addr];
}

View File

@ -42,7 +42,16 @@ class CartridgeDPCPlusWidget : public CartDebugWidget
void handleCommand(CommandSender* sender, int cmd, int data, int id);
string bankState();
bool internalRam();
uInt32 internalRamSize();
string internalRamDescription();
ByteArray internalRamOld(int start, int count);
ByteArray internalRamCurrent(int start, int count);
void internalRamSetValue(int addr, uInt8 value);
uInt8 internalRamGetValue(int addr);
//string internalRamLabel(int addr); not needed for DPC+
private:
struct CartState {
ByteArray tops;
@ -55,6 +64,7 @@ class CartridgeDPCPlusWidget : public CartDebugWidget
IntArray mfreqs;
IntArray mwaves;
uInt32 random;
ByteArray internalram;
};
private:

View File

@ -112,6 +112,17 @@ class CartDebugWidget : public Widget, public CommandSender
// Query internal state of the cart (usually just bankswitching info)
virtual string bankState() { return "0 (non-bankswitched)"; }
// to make the Cartridge RAM show up in the debugger, implement
// the following 8 functions for cartridges with internal RAM
virtual bool internalRam() { return false; }
virtual uInt32 internalRamSize() { return 0; }
virtual string internalRamDescription() { return ""; }
virtual ByteArray internalRamOld(int start, int count) { ByteArray ba; return ba; }
virtual ByteArray internalRamCurrent(int start, int count) { ByteArray ba; return ba; }
virtual void internalRamSetValue(int addr, uInt8 value) { };
virtual uInt8 internalRamGetValue(int addr) { return 0; };
virtual string internalRamLabel(int addr) { CartDebug& dbg = instance().debugger().cartDebug(); return dbg.getLabel(addr, false);}
protected:
// Font used for 'normal' text; _font is for 'label' text

View File

@ -46,7 +46,7 @@ CartridgeE7Widget::CartridgeE7Widget(
<< " $F400 - $F7FF (R), $F000 - $F3FF (W)\n"
<< "256B RAM accessible @ $F800 - $F9FF\n"
<< " Hotspots $FE8 - $FEB (256B of RAM slice 1)\n"
<< " $F400 - $F7FF (R), $F000 - $F3FF (W)\n"
<< " $F900 - $F9FF (R), $F800 - $F8FF (W)\n"
<< "Upper 1.5K ROM accessible @ $FA00 - $FFFF\n"
<< " Always points to last 1.5K of ROM\n"
<< "Startup slices = " << cart.myStartBank << " / 0\n";
@ -83,6 +83,17 @@ CartridgeE7Widget::CartridgeE7Widget(
addFocusWidget(myUpper256B);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE7Widget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
myOldState.internalram.push_back(myCart.myRAM[i]);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE7Widget::loadConfig()
{
@ -123,3 +134,68 @@ string CartridgeE7Widget::bankState()
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeE7Widget::internalRam()
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeE7Widget::internalRamSize()
{
return 2048;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeE7Widget::internalRamDescription()
{
ostringstream desc;
desc << "First 1K accessible via:\n"
<< " F000-F3FF used for Write Access\n"
<< " F400-F7FF used for Read Access\n"
<< "256K of second 1K accessible via:\n"
<< " F800-F8FF used for Write Access\n"
<< " F900-F9FF used for Read Access" ;
return desc.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeE7Widget::internalRamOld(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myOldState.internalram[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeE7Widget::internalRamCurrent(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myCart.myRAM[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE7Widget::internalRamSetValue(int addr, uInt8 value)
{
myCart.myRAM[addr] = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeE7Widget::internalRamGetValue(int addr)
{
return myCart.myRAM[addr];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeE7Widget::internalRamLabel(int addr)
{
CartDebug& dbg = instance().debugger().cartDebug();
return dbg.getLabel(addr + 0x1080, false);
}

View File

@ -33,16 +33,33 @@ class CartridgeE7Widget : public CartDebugWidget
int x, int y, int w, int h,
CartridgeE7& cart);
virtual ~CartridgeE7Widget() { }
void saveOldState();
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
string bankState();
// start of functions for Cartridge RAM tab
bool internalRam();
uInt32 internalRamSize();
string internalRamDescription();
ByteArray internalRamOld(int start, int count);
ByteArray internalRamCurrent(int start, int count);
void internalRamSetValue(int addr, uInt8 value);
uInt8 internalRamGetValue(int addr);
string internalRamLabel(int addr);
// end of functions for Cartridge RAM tab
private:
CartridgeE7& myCart;
PopUpWidget *myLower2K, *myUpper256B;
struct CartState {
ByteArray internalram;
};
CartState myOldState;
enum {
kLowerChanged = 'lwCH',
kUpperChanged = 'upCH'

View File

@ -74,6 +74,17 @@ CartridgeEFSCWidget::CartridgeEFSCWidget(
addFocusWidget(myBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeEFSCWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
myOldState.internalram.push_back(myCart.myRAM[i]);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeEFSCWidget::loadConfig()
{
@ -109,3 +120,64 @@ string CartridgeEFSCWidget::bankState()
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeEFSCWidget::internalRam()
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeEFSCWidget::internalRamSize()
{
return 128;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeEFSCWidget::internalRamDescription()
{
ostringstream desc;
desc << "F000-F07F used for Write Access\n"
<< "F080-F0FF used for Read Access";
return desc.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeEFSCWidget::internalRamOld(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myOldState.internalram[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeEFSCWidget::internalRamCurrent(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myCart.myRAM[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeEFSCWidget::internalRamSetValue(int addr, uInt8 value)
{
myCart.myRAM[addr] = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeEFSCWidget::internalRamGetValue(int addr)
{
return myCart.myRAM[addr];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeEFSCWidget::internalRamLabel(int addr)
{
CartDebug& dbg = instance().debugger().cartDebug();
return dbg.getLabel(addr + 0x1080, false);
}

View File

@ -34,15 +34,32 @@ class CartridgeEFSCWidget : public CartDebugWidget
CartridgeEFSC& cart);
virtual ~CartridgeEFSCWidget() { }
void saveOldState();
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
string bankState();
// start of functions for Cartridge RAM tab
bool internalRam();
uInt32 internalRamSize();
string internalRamDescription();
ByteArray internalRamOld(int start, int count);
ByteArray internalRamCurrent(int start, int count);
void internalRamSetValue(int addr, uInt8 value);
uInt8 internalRamGetValue(int addr);
string internalRamLabel(int addr);
// end of functions for Cartridge RAM tab
private:
CartridgeEFSC& myCart;
PopUpWidget* myBank;
struct CartState {
ByteArray internalram;
};
CartState myOldState;
enum { kBankChanged = 'bkCH' };
};

View File

@ -65,6 +65,17 @@ CartridgeF4SCWidget::CartridgeF4SCWidget(
addFocusWidget(myBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF4SCWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
myOldState.internalram.push_back(myCart.myRAM[i]);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF4SCWidget::loadConfig()
{
@ -99,3 +110,64 @@ string CartridgeF4SCWidget::bankState()
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF4SCWidget::internalRam()
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeF4SCWidget::internalRamSize()
{
return 128;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeF4SCWidget::internalRamDescription()
{
ostringstream desc;
desc << "F000-F07F used for Write Access\n"
<< "F080-F0FF used for Read Access";
return desc.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeF4SCWidget::internalRamOld(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myOldState.internalram[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeF4SCWidget::internalRamCurrent(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myCart.myRAM[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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 + 0x1080, false);
}

View File

@ -33,15 +33,34 @@ class CartridgeF4SCWidget : public CartDebugWidget
int x, int y, int w, int h,
CartridgeF4SC& cart);
virtual ~CartridgeF4SCWidget() { }
void saveOldState();
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
string bankState();
// start of functions for Cartridge RAM tab
bool internalRam();
uInt32 internalRamSize();
string internalRamDescription();
ByteArray internalRamOld(int start, int count);
ByteArray internalRamCurrent(int start, int count);
void internalRamSetValue(int addr, uInt8 value);
uInt8 internalRamGetValue(int addr);
string internalRamLabel(int addr);
// end of functions for Cartridge RAM tab
private:
CartridgeF4SC& myCart;
PopUpWidget* myBank;
struct CartState {
ByteArray internalram;
};
CartState myOldState;
enum { kBankChanged = 'bkCH' };
};

View File

@ -61,6 +61,17 @@ CartridgeF6SCWidget::CartridgeF6SCWidget(
addFocusWidget(myBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF6SCWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
myOldState.internalram.push_back(myCart.myRAM[i]);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF6SCWidget::loadConfig()
{
@ -93,3 +104,65 @@ string CartridgeF6SCWidget::bankState()
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF6SCWidget::internalRam()
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeF6SCWidget::internalRamSize()
{
return 128;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeF6SCWidget::internalRamDescription()
{
ostringstream desc;
desc << "F000-F07F used for Write Access\n"
<< "F080-F0FF used for Read Access";
return desc.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeF6SCWidget::internalRamOld(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myOldState.internalram[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeF6SCWidget::internalRamCurrent(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myCart.myRAM[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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 + 0x1080, false);
}

View File

@ -34,15 +34,31 @@ class CartridgeF6SCWidget : public CartDebugWidget
CartridgeF6SC& cart);
virtual ~CartridgeF6SCWidget() { }
void saveOldState();
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
string bankState();
// start of functions for Cartridge RAM tab
bool internalRam();
uInt32 internalRamSize();
string internalRamDescription();
ByteArray internalRamOld(int start, int count);
ByteArray internalRamCurrent(int start, int count);
void internalRamSetValue(int addr, uInt8 value);
uInt8 internalRamGetValue(int addr);
string internalRamLabel(int addr);
// end of functions for Cartridge RAM tab
private:
struct CartState {
ByteArray internalram;
};
CartridgeF6SC& myCart;
PopUpWidget* myBank;
CartState myOldState;
enum { kBankChanged = 'bkCH' };
};

View File

@ -59,6 +59,17 @@ CartridgeF8SCWidget::CartridgeF8SCWidget(
addFocusWidget(myBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF8SCWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
myOldState.internalram.push_back(myCart.myRAM[i]);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF8SCWidget::loadConfig()
{
@ -91,3 +102,64 @@ string CartridgeF8SCWidget::bankState()
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF8SCWidget::internalRam()
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeF8SCWidget::internalRamSize()
{
return 128;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeF8SCWidget::internalRamDescription()
{
ostringstream desc;
desc << "F000-F07F used for Write Access\n"
<< "F080-F0FF used for Read Access";
return desc.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeF8SCWidget::internalRamOld(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myOldState.internalram[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeF8SCWidget::internalRamCurrent(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myCart.myRAM[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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 + 0x1080, false);
}

View File

@ -33,15 +33,33 @@ class CartridgeF8SCWidget : public CartDebugWidget
int x, int y, int w, int h,
CartridgeF8SC& cart);
virtual ~CartridgeF8SCWidget() { }
void saveOldState();
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
string bankState();
// start of functions for Cartridge RAM tab
bool internalRam();
uInt32 internalRamSize();
string internalRamDescription();
ByteArray internalRamOld(int start, int count);
ByteArray internalRamCurrent(int start, int count);
void internalRamSetValue(int addr, uInt8 value);
uInt8 internalRamGetValue(int addr);
string internalRamLabel(int addr);
// end of functions for Cartridge RAM tab
private:
CartridgeF8SC& myCart;
PopUpWidget* myBank;
struct CartState {
ByteArray internalram;
};
CartState myOldState;
enum { kBankChanged = 'bkCH' };
};

View File

@ -97,6 +97,17 @@ CartridgeFA2Widget::CartridgeFA2Widget(
addFocusWidget(myFlashSave);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeFA2Widget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
myOldState.internalram.push_back(myCart.myRAM[i]);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeFA2Widget::loadConfig()
{
@ -145,3 +156,64 @@ string CartridgeFA2Widget::bankState()
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeFA2Widget::internalRam()
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeFA2Widget::internalRamSize()
{
return 256;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeFA2Widget::internalRamDescription()
{
ostringstream desc;
desc << "F000-F0FF used for Write Access\n"
<< "F100-F1FF used for Read Access";
return desc.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeFA2Widget::internalRamOld(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myOldState.internalram[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeFA2Widget::internalRamCurrent(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myCart.myRAM[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeFA2Widget::internalRamSetValue(int addr, uInt8 value)
{
myCart.myRAM[addr] = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeFA2Widget::internalRamGetValue(int addr)
{
return myCart.myRAM[addr];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeFA2Widget::internalRamLabel(int addr)
{
CartDebug& dbg = instance().debugger().cartDebug();
return dbg.getLabel(addr + 0x1080, false);
}

View File

@ -35,15 +35,32 @@ class CartridgeFA2Widget : public CartDebugWidget
CartridgeFA2& cart);
virtual ~CartridgeFA2Widget() { }
void saveOldState();
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
string bankState();
// start of functions for Cartridge RAM tab
bool internalRam();
uInt32 internalRamSize();
string internalRamDescription();
ByteArray internalRamOld(int start, int count);
ByteArray internalRamCurrent(int start, int count);
void internalRamSetValue(int addr, uInt8 value);
uInt8 internalRamGetValue(int addr);
string internalRamLabel(int addr);
// end of functions for Cartridge RAM tab
private:
CartridgeFA2& myCart;
PopUpWidget* myBank;
ButtonWidget *myFlashErase, *myFlashLoad, *myFlashSave;
struct CartState {
ByteArray internalram;
};
CartState myOldState;
enum {
kBankChanged = 'bkCH',

View File

@ -60,6 +60,17 @@ CartridgeFAWidget::CartridgeFAWidget(
addFocusWidget(myBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeFAWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
myOldState.internalram.push_back(myCart.myRAM[i]);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeFAWidget::loadConfig()
{
@ -92,3 +103,64 @@ string CartridgeFAWidget::bankState()
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeFAWidget::internalRam()
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeFAWidget::internalRamSize()
{
return 256;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeFAWidget::internalRamDescription()
{
ostringstream desc;
desc << "F000-F0FF used for Write Access\n"
<< "F100-F1FF used for Read Access";
return desc.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeFAWidget::internalRamOld(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myOldState.internalram[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteArray CartridgeFAWidget::internalRamCurrent(int start, int count)
{
ByteArray ram;
ram.clear();
for (int i = 0;i<count;i++)
ram.push_back(myCart.myRAM[start + i]);
return ram;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeFAWidget::internalRamSetValue(int addr, uInt8 value)
{
myCart.myRAM[addr] = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeFAWidget::internalRamGetValue(int addr)
{
return myCart.myRAM[addr];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeFAWidget::internalRamLabel(int addr)
{
CartDebug& dbg = instance().debugger().cartDebug();
return dbg.getLabel(addr + 0x1080, false);
}

View File

@ -34,14 +34,31 @@ class CartridgeFAWidget : public CartDebugWidget
CartridgeFA& cart);
virtual ~CartridgeFAWidget() { }
void saveOldState();
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
string bankState();
// start of functions for Cartridge RAM tab
bool internalRam();
uInt32 internalRamSize();
string internalRamDescription();
ByteArray internalRamOld(int start, int count);
ByteArray internalRamCurrent(int start, int count);
void internalRamSetValue(int addr, uInt8 value);
uInt8 internalRamGetValue(int addr);
string internalRamLabel(int addr);
// end of functions for Cartridge RAM tab
private:
CartridgeFA& myCart;
PopUpWidget* myBank;
struct CartState {
ByteArray internalram;
};
CartState myOldState;
enum { kBankChanged = 'bkCH' };
};

View File

@ -0,0 +1,513 @@
//============================================================================
//
// 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-2014 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.
//
// $Id$
//============================================================================
#include "PopUpWidget.hxx"
#include "InputTextDialog.hxx"
#include "CartRamWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartRamWidget::CartRamWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartDebugWidget& cartDebug)
: Widget(boss, lfont, x, y, w, h),
CommandSender(boss),
_nfont(nfont),
myFontWidth(lfont.getMaxCharWidth()),
myFontHeight(lfont.getFontHeight()),
myLineHeight(lfont.getLineHeight()),
myButtonHeight(myLineHeight + 4),
myCart(cartDebug),
myCurrentRamBank(0)
{
int lwidth = lfont.getStringWidth("Description: "),
fwidth = w - lwidth - 20;
const int bwidth = lfont.getStringWidth("Compare "),
bheight = myLineHeight + 2;
EditTextWidget* etw = 0;
ostringstream buf;
int xpos = 2, ypos = 5;
// Add RAM size
myRamSize = myCart.internalRamSize();
new StaticTextWidget(_boss, _font, xpos, ypos, lwidth,
myFontHeight, "RAM Size: ", kTextAlignLeft);
buf << myRamSize << " bytes";
if(myRamSize >= 1024)
buf << " / " << (myRamSize/1024) << "KB";
etw = new EditTextWidget(boss, nfont, xpos+lwidth, ypos,
fwidth, myLineHeight, buf.str());
etw->setEditable(false);
ypos += myLineHeight + 4;
// Add Description
const string& desc = myCart.internalRamDescription();
const uInt16 maxlines = 6;
StringParser bs(desc, (fwidth - kScrollBarWidth) / myFontWidth);
const StringList& sl = bs.stringList();
uInt32 lines = sl.size();
if(lines < 3) lines = 3;
if(lines > maxlines) lines = maxlines;
new StaticTextWidget(_boss, _font, xpos, ypos, lwidth,
myFontHeight, "Description: ", kTextAlignLeft);
myDesc = new StringListWidget(boss, nfont, xpos+lwidth, ypos,
fwidth, lines * myLineHeight, false);
myDesc->setEditable(false);
myDesc->setList(sl);
addFocusWidget(myDesc);
ypos += myDesc->getHeight() + myLineHeight + 4;
// Add RAM grid
xpos = _font.getStringWidth("xxxx");
int maxrow = myRamSize / 16;
if (maxrow > 16) maxrow = 16;
myPageSize = maxrow * 16;
myRamGrid = new DataGridWidget(_boss, _nfont, xpos, ypos,
16, maxrow, 2, 8, Common::Base::F_16, true);
myRamGrid->setTarget(this);
addFocusWidget(myRamGrid);
// Create actions buttons to the left of the RAM grid
int bx = xpos + myRamGrid->getWidth() + 4;
int by = ypos;
myUndoButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Undo", kUndoCmd);
myUndoButton->setTarget(this);
by += bheight + 4;
myRevertButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Revert", kRevertCmd);
myRevertButton->setTarget(this);
by += 2 * bheight + 2;
mySearchButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Search", kSearchCmd);
mySearchButton->setTarget(this);
by += bheight + 4;
myCompareButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Compare", kCmpCmd);
myCompareButton->setTarget(this);
by += bheight + 4;
myRestartButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Reset", kRestartCmd);
myRestartButton->setTarget(this);
// Labels for RAM grid
for(int col = 0; col < 16; ++col)
{
new StaticTextWidget(_boss, _font, xpos + col*myRamGrid->colWidth() + 8,
ypos - myLineHeight,
myFontWidth, myFontHeight,
Common::Base::toString(col, Common::Base::F_16_1),
kTextAlignLeft);
}
// xpos = 02 + lwidth - _font.getStringWidth("xxxx ");
myRamStart =
new StaticTextWidget(_boss, _font, xpos - _font.getStringWidth("xxxx"), ypos - myLineHeight,
_font.getStringWidth("xxxx"), myFontHeight,
"00xx", kTextAlignLeft);
// xpos = 2 + lwidth - _font.getStringWidth("xxx ");
int row;
for(row = 0; row < maxrow; ++row)
{
new StaticTextWidget(_boss, _font, xpos - _font.getStringWidth("x "), ypos + row*myLineHeight + 2,
3*myFontWidth, myFontHeight,
Common::Base::toString(row*16, Common::Base::F_16_1),
kTextAlignLeft);
}
// for smaller grids, make sure RAM cell detail fields are below the RESET button
if (maxrow < 8)
row = 8 + 1;
else
row = maxrow + 1;
ypos += myLineHeight * row;
// We need to define these widgets from right to left since the leftmost
// one resizes as much as possible
// Add Binary display of selected RAM cell
xpos = w - 13*myFontWidth - 20;
new StaticTextWidget(boss, lfont, xpos, ypos, 4*myFontWidth, myFontHeight,
"Bin:", kTextAlignLeft);
myBinValue = new EditTextWidget(boss, nfont, xpos + 4*myFontWidth + 5,
ypos-2, 9*myFontWidth, myLineHeight, "");
myBinValue->setEditable(false);
// Add Decimal display of selected RAM cell
xpos -= 8*myFontWidth + 5 + 20;
new StaticTextWidget(boss, lfont, xpos, ypos, 4*myFontWidth, myFontHeight,
"Dec:", kTextAlignLeft);
myDecValue = new EditTextWidget(boss, nfont, xpos + 4*myFontWidth + 5, ypos-2,
4*myFontWidth, myLineHeight, "");
myDecValue->setEditable(false);
// Add Label of selected RAM cell
int xpos_r = xpos - 20;
xpos = x + 10;
new StaticTextWidget(boss, lfont, xpos, ypos, 6*myFontWidth, myFontHeight,
"Label:", kTextAlignLeft);
xpos += 6*myFontWidth + 5;
myLabel = new EditTextWidget(boss, nfont, xpos, ypos-2, xpos_r-xpos,
myLineHeight, "");
myLabel->setEditable(false);
// Inputbox which will pop up when searching RAM
StringList labels;
labels.push_back("Search: ");
myInputBox = new InputTextDialog(boss, lfont, nfont, labels);
myInputBox->setTarget(this);
// Start with these buttons disabled
myCompareButton->clearFlags(WIDGET_ENABLED);
myRestartButton->clearFlags(WIDGET_ENABLED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartRamWidget::loadConfig()
{
fillGrid(true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartRamWidget::fillGrid(bool updateOld)
{
IntArray alist;
IntArray vlist;
BoolArray changed;
uInt32 start = myCurrentRamBank * myPageSize;
ByteArray oldRam = myCart.internalRamOld(start, myPageSize);
ByteArray currentRam = myCart.internalRamCurrent(start, myPageSize);
for(uInt32 i=0; i<myPageSize;i++)
{
alist.push_back(i+start);
vlist.push_back(currentRam[i]);
changed.push_back(currentRam[i] != oldRam[i]);
}
if(updateOld)
{
myOldValueList.clear();
myOldValueList = myCart.internalRamCurrent(start, myCart.internalRamSize());
}
myRamGrid->setNumRows(myRamSize / myPageSize);
myRamGrid->setList(alist, vlist, changed);
if(updateOld)
{
myRevertButton->setEnabled(false);
myUndoButton->setEnabled(false);
}
// Update RAM labels
char buf[5];
BSPF_snprintf(buf, 5, "%04X", start);
buf[2] = buf[3] = 'x';
myRamStart->setLabel(buf);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartRamWidget::showInputBox(int cmd)
{
// Add inputbox in the middle of the RAM widget
uInt32 x = getAbsX() + ((getWidth() - myInputBox->getWidth()) >> 1);
uInt32 y = getAbsY() + ((getHeight() - myInputBox->getHeight()) >> 1);
myInputBox->show(x, y);
myInputBox->setText("");
myInputBox->setTitle("");
myInputBox->setFocus(0);
myInputBox->setEmitSignal(cmd);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartRamWidget::doSearch(const string& str)
{
bool comparisonSearch = true;
if(str.length() == 0)
{
// An empty field means return all memory locations
comparisonSearch = false;
}
else if(str.find_first_of("+-", 0) != string::npos)
{
// Don't accept these characters here, only in compare
return "Invalid input +|-";
}
int searchVal = instance().debugger().stringToValue(str);
// Clear the search array of previous items
mySearchAddr.clear();
mySearchValue.clear();
mySearchState.clear();
// Now, search all memory locations for this value, and add it to the
// search array
bool hitfound = false;
// CartDebug& dbg = instance().debugger().cartDebug();
// const CartState& state = (CartState&) dbg.getState();
ByteArray currentRam = myCart.internalRamCurrent(0, myCart.internalRamSize());
for(uInt32 addr = 0; addr < myCart.internalRamSize(); ++addr)
{
int value = currentRam[addr];
if(comparisonSearch && searchVal != value)
{
mySearchState.push_back(false);
}
else
{
mySearchAddr.push_back(addr);
mySearchValue.push_back(value);
mySearchState.push_back(true);
hitfound = true;
}
}
// If we have some hits, enable the comparison methods
if(hitfound)
{
mySearchButton->setEnabled(false);
myCompareButton->setEnabled(true);
myRestartButton->setEnabled(true);
}
// Finally, show the search results in the list
showSearchResults();
return "";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartRamWidget::doCompare(const string& str)
{
bool comparitiveSearch = false;
int searchVal = 0, offset = 0;
if(str.length() == 0)
return "Enter an absolute or comparitive value";
// Do some pre-processing on the string
string::size_type pos = str.find_first_of("+-", 0);
if(pos > 0 && pos != string::npos)
{
// Only accept '+' or '-' at the start of the string
return "Input must be [+|-]NUM";
}
// A comparitive search searches memory for locations that have changed by
// the specified amount, vs. for exact values
if(str[0] == '+' || str[0] == '-')
{
comparitiveSearch = true;
bool negative = false;
if(str[0] == '-')
negative = true;
string tmp = str;
tmp.erase(0, 1); // remove the operator
offset = instance().debugger().stringToValue(tmp);
if(negative)
offset = -offset;
}
else
searchVal = instance().debugger().stringToValue(str);
// Now, search all memory locations previously 'found' for this value
bool hitfound = false;
ByteArray currentRam = myCart.internalRamCurrent(0, myCart.internalRamSize());
IntArray tempAddrList, tempValueList;
mySearchState.clear();
for(uInt32 i = 0; i < myCart.internalRamSize(); ++i)
mySearchState.push_back(false);
for(unsigned int i = 0; i < mySearchAddr.size(); ++i)
{
if(comparitiveSearch)
{
searchVal = mySearchValue[i] + offset;
if(searchVal < 0 || searchVal > 255)
continue;
}
int addr = mySearchAddr[i];
if(currentRam[addr] == searchVal)
{
tempAddrList.push_back(addr);
tempValueList.push_back(searchVal);
mySearchState[addr] = hitfound = true;
}
}
// Update the searchArray for the new addresses and data
mySearchAddr = tempAddrList;
mySearchValue = tempValueList;
// If we have some hits, enable the comparison methods
if(hitfound)
{
myCompareButton->setEnabled(true);
myRestartButton->setEnabled(true);
}
// Finally, show the search results in the list
showSearchResults();
return "";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartRamWidget::handleCommand(CommandSender* sender,
int cmd, int data, int id)
{
// We simply change the values in the DataGridWidget
// It will then send the 'kDGItemDataChangedCmd' signal to change the actual
// memory location
int addr, value;
switch(cmd)
{
case DataGridWidget::kItemDataChangedCmd:
{
addr = myRamGrid->getSelectedAddr();
value = myRamGrid->getSelectedValue();
uInt8 oldval = myCart.internalRamGetValue(addr);
myCart.internalRamSetValue(addr, value);
myUndoAddress = addr;
myUndoValue = oldval;
myDecValue->setText(Common::Base::toString(value, Common::Base::F_10));
myBinValue->setText(Common::Base::toString(value, Common::Base::F_2));
myRevertButton->setEnabled(true);
myUndoButton->setEnabled(true);
break;
}
case DataGridWidget::kSelectionChangedCmd:
{
addr = myRamGrid->getSelectedAddr();
value = myRamGrid->getSelectedValue();
myLabel->setText(myCart.internalRamLabel(addr));
myDecValue->setText(Common::Base::toString(value, Common::Base::F_10));
myBinValue->setText(Common::Base::toString(value, Common::Base::F_2));
break;
}
case kRevertCmd:
for(uInt32 i = 0; i < myOldValueList.size(); ++i)
myCart.internalRamSetValue(i, myOldValueList[i]);
fillGrid(true);
break;
case kUndoCmd:
myCart.internalRamSetValue(myUndoAddress, myUndoValue);
myUndoButton->setEnabled(false);
fillGrid(false);
break;
case kSearchCmd:
showInputBox(kSValEntered);
break;
case kCmpCmd:
showInputBox(kCValEntered);
break;
case kRestartCmd:
doRestart();
break;
case kSValEntered:
{
const string& result = doSearch(myInputBox->getResult());
if(result != "")
myInputBox->setTitle(result);
else
myInputBox->close();
break;
}
case kCValEntered:
{
const string& result = doCompare(myInputBox->getResult());
if(result != "")
myInputBox->setTitle(result);
else
myInputBox->close();
break;
}
case kSetPositionCmd:
myCurrentRamBank = data;
showSearchResults();
fillGrid(false);
break;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartRamWidget::doRestart()
{
// Erase all search buffers, reset to start mode
mySearchAddr.clear();
mySearchValue.clear();
mySearchState.clear();
showSearchResults();
mySearchButton->setEnabled(true);
myCompareButton->setEnabled(false);
myRestartButton->setEnabled(false);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartRamWidget::showSearchResults()
{
// Only update the search results for the bank currently being shown
BoolArray temp;
uInt32 start = myCurrentRamBank * myPageSize;
if(mySearchState.size() == 0 || start > mySearchState.size())
{
for(uInt32 i = 0; i < myPageSize; ++i)
temp.push_back(false);
}
else
{
for(uInt32 i = start; i < start + myPageSize; ++i)
temp.push_back(mySearchState[i]);
}
myRamGrid->setHiliteList(temp);
}

View File

@ -0,0 +1,118 @@
//============================================================================
//
// 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-2014 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.
//
// $Id$
//============================================================================
#ifndef CART_RAM_WIDGET_HXX
#define CART_RAM_WIDGET_HXX
class GuiObject;
class InputTextDialog;
class ButtonWidget;
class DataGridWidget;
#include "Base.hxx"
#include "Font.hxx"
#include "CartDebugWidget.hxx"
#include "Command.hxx"
#include "DataGridWidget.hxx"
#include "Debugger.hxx"
#include "RomWidget.hxx"
#include "Widget.hxx"
#include "EditTextWidget.hxx"
#include "StringListWidget.hxx"
#include "StringParser.hxx"
class CartRamWidget : public Widget, public CommandSender
{
public:
CartRamWidget(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont,
int x, int y, int w, int h, CartDebugWidget& cartDebug);
virtual ~CartRamWidget() { };
public:
// Inform the ROM Widget that the underlying cart has somehow changed
void invalidate()
{
sendCommand(RomWidget::kInvalidateListing, -1, -1);
}
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
void fillGrid(bool updateOld);
void showInputBox(int cmd);
string doSearch(const string& str);
string doCompare(const string& str);
void doRestart();
void showSearchResults();
protected:
// Font used for 'normal' text; _font is for 'label' text
const GUI::Font& _nfont;
// These will be needed by most of the child classes;
// we may as well make them protected variables
int myFontWidth, myFontHeight, myLineHeight, myButtonHeight;
ostringstream& buffer() { myBuffer.str(""); return myBuffer; }
DataGridWidget* myRamGrid;
StaticTextWidget* myRamStart;
private:
enum {
kUndoCmd = 'RWud',
kRevertCmd = 'RWrv',
kSearchCmd = 'RWse',
kCmpCmd = 'RWcp',
kRestartCmd = 'RWrs',
kSValEntered = 'RWsv',
kCValEntered = 'RWcv'
};
int myUndoAddress;
int myUndoValue;
CartDebugWidget& myCart;
StringListWidget* myDesc;
ostringstream myBuffer;
EditTextWidget* myBinValue;
EditTextWidget* myDecValue;
EditTextWidget* myLabel;
int myCurrentRamBank;
uInt32 myRamSize;
uInt32 myPageSize;
ButtonWidget* myRevertButton;
ButtonWidget* myUndoButton;
ButtonWidget* mySearchButton;
ButtonWidget* myCompareButton;
ButtonWidget* myRestartButton;
InputTextDialog* myInputBox;
ByteArray myOldValueList;
IntArray mySearchAddr;
IntArray mySearchValue;
BoolArray mySearchState;
};
#endif

View File

@ -31,6 +31,7 @@
#include "RomWidget.hxx"
#include "TiaWidget.hxx"
#include "CartDebugWidget.hxx"
#include "CartRamWidget.hxx"
#include "DataGridOpsWidget.hxx"
#include "EditTextWidget.hxx"
#include "MessageBox.hxx"
@ -436,6 +437,19 @@ void DebuggerDialog::addRomArea()
{
myRomTab->setParentWidget(tabID, myCartDebug);
addToFocusList(myCartDebug->getFocusList(), myRomTab, tabID);
// The cartridge RAM tab
if (myCartDebug->internalRam())
{
tabID = myRomTab->addTab(" Cartridge RAM ");
myCartRam = new CartRamWidget(myRomTab, *myLFont, *myNFont, 2, 2, tabWidth - 1,
tabHeight - myRomTab->getTabHeight() - 2, *myCartDebug);
if(myCartRam) // TODO - make this always non-null
{
myRomTab->setParentWidget(tabID, myCartRam);
addToFocusList(myCartRam->getFocusList(), myRomTab, tabID);
}
}
}
myRomTab->setActiveTab(0);

View File

@ -34,6 +34,7 @@ class TiaInfoWidget;
class TiaOutputWidget;
class TiaZoomWidget;
class CartDebugWidget;
class CartRamWidget;
#include "Dialog.hxx"
#include "MessageBox.hxx"
@ -60,6 +61,7 @@ class DebuggerDialog : public Dialog
TiaZoomWidget& tiaZoom() const { return *myTiaZoom; }
RomWidget& rom() const { return *myRom; }
CartDebugWidget& cartDebug() const { return *myCartDebug; }
CartRamWidget& cartRam() const { return *myCartRam; }
EditTextWidget& message() const { return *myMessageBox; }
ButtonWidget& rewindButton() const { return *myRewindButton; }
@ -112,6 +114,7 @@ class DebuggerDialog : public Dialog
RamWidget* myRam;
RomWidget* myRom;
CartDebugWidget* myCartDebug;
CartRamWidget* myCartRam;
EditTextWidget* myMessageBox;
ButtonWidget* myRewindButton;
GUI::MessageBox* myFatalError;

View File

@ -20,6 +20,7 @@ MODULE_OBJS := \
src/debugger/gui/ToggleBitWidget.o \
src/debugger/gui/TogglePixelWidget.o \
src/debugger/gui/ToggleWidget.o \
src/debugger/gui/CartRamWidget.o \
src/debugger/gui/Cart0840Widget.o \
src/debugger/gui/Cart2KWidget.o \
src/debugger/gui/Cart3EWidget.o \

View File

@ -343,20 +343,6 @@ bool Cartridge::bankChanged()
return changed;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge::registerRamArea(uInt16 start, uInt16 size,
uInt16 roffset, uInt16 woffset)
{
#ifdef DEBUGGER_SUPPORT
RamArea area;
area.start = start;
area.size = size;
area.roffset = roffset;
area.woffset = woffset;
myRamAreaList.push_back(area);
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge::triggerReadFromWritePort(uInt16 address)
{

View File

@ -26,6 +26,7 @@
class Cartridge;
class Properties;
class CartDebugWidget;
class CartRamWidget;
class GuiObject;
#include "bspf.hxx"
@ -122,8 +123,6 @@ class Cartridge : public Device
*/
virtual bool bankChanged();
const RamAreaList& ramAreas() { return myRamAreaList; }
public:
//////////////////////////////////////////////////////////////////////
// The following methods are cart-specific and must be implemented
@ -212,16 +211,6 @@ class Cartridge : public Device
const GUI::Font& nfont, int x, int y, int w, int h) { return NULL; }
protected:
/**
Add the given area to the RamArea list for this cart.
@param start The beginning of the RAM area (0x0000 - 0x2000)
@param size Total number of bytes of area
@param roffset Offset to use when reading from RAM (read port)
@param woffset Offset to use when writing to RAM (write port)
*/
void registerRamArea(uInt16 start, uInt16 size, uInt16 roffset, uInt16 woffset);
/**
Indicate that an illegal read from a write port has occurred.
@ -402,9 +391,6 @@ class Cartridge : public Device
uInt8* myCodeAccessBase;
private:
// Contains RamArea entries for those carts with accessible RAM.
RamAreaList myRamAreaList;
// If myBankLocked is true, ignore attempts at bankswitching. This is used
// by the debugger, when disassembling/dumping ROM.
bool myBankLocked;

View File

@ -37,11 +37,6 @@ Cartridge3E::Cartridge3E(const uInt8* image, uInt32 size,
memcpy(myImage, image, mySize);
createCodeAccessBase(mySize + 32768);
// This cart can address a 1024 byte bank of RAM @ 0x1000
// However, it may not be addressable all the time (it may be swapped out)
// so probably most of the time, the area will point to ROM instead
registerRamArea(0x1000, 1024, 0x00, 0x400); // 1024 bytes RAM @ 0x1000
// Remember startup bank
myStartBank = 0;
}

View File

@ -30,9 +30,6 @@ Cartridge4KSC::Cartridge4KSC(const uInt8* image, uInt32 size, const Settings& se
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(4096u, size));
createCodeAccessBase(4096);
// This cart contains 128 bytes extended RAM @ 0x1000
registerRamArea(0x1000, 128, 0x80, 0x00);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -31,9 +31,6 @@ CartridgeBFSC::CartridgeBFSC(const uInt8* image, uInt32 size, const Settings& se
memcpy(myImage, image, BSPF_min(262144u, size));
createCodeAccessBase(262144);
// This cart contains 128 bytes extended RAM @ 0x1000
registerRamArea(0x1000, 128, 0x80, 0x00);
// Remember startup bank
myStartBank = 15;
}

View File

@ -32,10 +32,6 @@ CartridgeCM::CartridgeCM(const uInt8* image, uInt32 size, const Settings& settin
memcpy(myImage, image, BSPF_min(16384u, size));
createCodeAccessBase(16384);
// This cart contains 2048 bytes extended RAM @ 0x1800
// This RAM scheme is unique in that it doesn't require separate read/write ports
registerRamArea(0x1800, 2048, 0x00, 0x00);
// On powerup, portA is all 1's, so the last bank of ROM is enabled and
// RAM is disabled
mySWCHA = 0xff;

View File

@ -42,9 +42,6 @@ CartridgeCTY::CartridgeCTY(const uInt8* image, uInt32 size, const OSystem& osyst
memcpy(myImage, image, BSPF_min(32768u, size));
createCodeAccessBase(32768);
// This cart contains 64 bytes extended RAM @ 0x1000
registerRamArea(0x1000, 64, 0x40, 0x00);
// Point to the first tune
myFrequencyImage = CartCTYTunes;

View File

@ -48,9 +48,6 @@ CartridgeCV::CartridgeCV(const uInt8* image, uInt32 size,
memcpy(myInitialRAM, image, 1024);
}
createCodeAccessBase(2048+1024);
// This cart contains 1024 bytes extended RAM @ 0x1000
registerRamArea(0x1000, 1024, 0x00, 0x400);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -38,10 +38,12 @@ CartridgeDASH::CartridgeDASH(const uInt8* image, uInt32 size, const Settings& se
// This cart can address 4 banks of RAM, each 512 bytes @ 1000, 1200, 1400, 1600
// However, it may not be addressable all the time (it may be swapped out)
#if 0
registerRamArea(0x1000, RAM_BANK_SIZE, 0x00, RAM_WRITE_OFFSET); // 512 bytes RAM @ 0x1000
registerRamArea(0x1200, RAM_BANK_SIZE, 0x00, RAM_WRITE_OFFSET); // 512 bytes RAM @ 0x1200
registerRamArea(0x1400, RAM_BANK_SIZE, 0x00, RAM_WRITE_OFFSET); // 512 bytes RAM @ 0x1400
registerRamArea(0x1600, RAM_BANK_SIZE, 0x00, RAM_WRITE_OFFSET); // 512 bytes RAM @ 0x1600
#endif
// Remember startup bank (0 per spec, rather than last per 3E scheme).
// Set this to go to 3rd 1K Bank.

View File

@ -31,9 +31,6 @@ CartridgeDFSC::CartridgeDFSC(const uInt8* image, uInt32 size, const Settings& se
memcpy(myImage, image, BSPF_min(131072u, size));
createCodeAccessBase(131072);
// This cart contains 128 bytes extended RAM @ 0x1000
registerRamArea(0x1000, 128, 0x80, 0x00);
// Remember startup bank
myStartBank = 15;
}

View File

@ -46,6 +46,7 @@ class Thumbulator;
class CartridgeDPCPlus : public Cartridge
{
friend class CartridgeDPCPlusWidget;
friend class CartridgeRamDPCPlusWidget;
public:
/**
@ -207,7 +208,10 @@ class CartridgeDPCPlus : public Cartridge
// Pointer to the 4K display ROM image of the cartridge
uInt8* myDisplayImage;
// The DPC 8k RAM image
// The DPC 8k RAM image, used as:
// 3K DPC+ driver
// 4K Display Data
// 1K Frequency Data
uInt8 myDPCRAM[8192];
#ifdef THUMB_SUPPORT

View File

@ -31,13 +31,6 @@ CartridgeE7::CartridgeE7(const uInt8* image, uInt32 size, const Settings& settin
memcpy(myImage, image, BSPF_min(16384u, size));
createCodeAccessBase(16384 + 2048);
// This cart can address a 1024 byte bank of RAM @ 0x1000
// and 256 bytes @ 0x1800
// However, it may not be addressable all the time (it may be swapped out)
// so probably most of the time, the area will point to ROM instead
registerRamArea(0x1000, 1024, 0x400, 0x00); // 1024 bytes RAM @ 0x1000
registerRamArea(0x1800, 256, 0x100, 0x00); // 256 bytes RAM @ 0x1800
// Remember startup bank
myStartBank = 0;
}

View File

@ -31,9 +31,6 @@ CartridgeEFSC::CartridgeEFSC(const uInt8* image, uInt32 size, const Settings& se
memcpy(myImage, image, BSPF_min(65536u, size));
createCodeAccessBase(65536);
// This cart contains 128 bytes extended RAM @ 0x1000
registerRamArea(0x1000, 128, 0x80, 0x00);
// Remember startup bank
myStartBank = 15;
}

View File

@ -31,9 +31,6 @@ CartridgeF4SC::CartridgeF4SC(const uInt8* image, uInt32 size, const Settings& se
memcpy(myImage, image, BSPF_min(32768u, size));
createCodeAccessBase(32768);
// This cart contains 128 bytes extended RAM @ 0x1000
registerRamArea(0x1000, 128, 0x80, 0x00);
// Remember startup bank
myStartBank = 0;
}

View File

@ -31,9 +31,6 @@ CartridgeF6SC::CartridgeF6SC(const uInt8* image, uInt32 size, const Settings& se
memcpy(myImage, image, BSPF_min(16384u, size));
createCodeAccessBase(16384);
// This cart contains 128 bytes extended RAM @ 0x1000
registerRamArea(0x1000, 128, 0x80, 0x00);
// Remember startup bank
myStartBank = 0;
}

View File

@ -31,9 +31,6 @@ CartridgeF8SC::CartridgeF8SC(const uInt8* image, uInt32 size, const Settings& se
memcpy(myImage, image, BSPF_min(8192u, size));
createCodeAccessBase(8192);
// This cart contains 128 bytes extended RAM @ 0x1000
registerRamArea(0x1000, 128, 0x80, 0x00);
// Remember startup bank
myStartBank = 1;
}

View File

@ -31,9 +31,6 @@ CartridgeFA::CartridgeFA(const uInt8* image, uInt32 size, const Settings& settin
memcpy(myImage, image, BSPF_min(12288u, size));
createCodeAccessBase(12288);
// This cart contains 256 bytes extended RAM @ 0x1000
registerRamArea(0x1000, 256, 0x100, 0x00);
// Remember startup bank
myStartBank = 2;
}

View File

@ -46,9 +46,6 @@ CartridgeFA2::CartridgeFA2(const uInt8* image, uInt32 size, const OSystem& osyst
memcpy(myImage, image, mySize);
createCodeAccessBase(mySize);
// This cart contains 256 bytes extended RAM @ 0x1000
registerRamArea(0x1000, 256, 0x100, 0x00);
// Remember startup bank
myStartBank = 0;
}