From 5c75ff1c15b95128d181da30b80293de1158b91b Mon Sep 17 00:00:00 2001 From: stephena Date: Fri, 13 Jun 2014 16:28:28 +0000 Subject: [PATCH] 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 --- Changes.txt | 3 + src/debugger/CartDebug.cxx | 6 +- src/debugger/Debugger.cxx | 1 + src/debugger/gui/Cart3EWidget.cxx | 73 ++++ src/debugger/gui/Cart3EWidget.hxx | 17 + src/debugger/gui/Cart4KSCWidget.cxx | 75 +++- src/debugger/gui/Cart4KSCWidget.hxx | 20 + src/debugger/gui/CartBFSCWidget.cxx | 72 ++++ src/debugger/gui/CartBFSCWidget.hxx | 17 + src/debugger/gui/CartCMWidget.cxx | 69 ++++ src/debugger/gui/CartCMWidget.hxx | 12 + src/debugger/gui/CartCTYWidget.cxx | 72 ++++ src/debugger/gui/CartCTYWidget.hxx | 17 + src/debugger/gui/CartCVWidget.cxx | 76 +++- src/debugger/gui/CartCVWidget.hxx | 21 + src/debugger/gui/CartDFSCWidget.cxx | 72 ++++ src/debugger/gui/CartDFSCWidget.hxx | 17 + src/debugger/gui/CartDPCPlusWidget.cxx | 64 +++ src/debugger/gui/CartDPCPlusWidget.hxx | 12 +- src/debugger/gui/CartDebugWidget.hxx | 11 + src/debugger/gui/CartE7Widget.cxx | 78 +++- src/debugger/gui/CartE7Widget.hxx | 19 +- src/debugger/gui/CartEFSCWidget.cxx | 72 ++++ src/debugger/gui/CartEFSCWidget.hxx | 17 + src/debugger/gui/CartF4SCWidget.cxx | 72 ++++ src/debugger/gui/CartF4SCWidget.hxx | 21 +- src/debugger/gui/CartF6SCWidget.cxx | 73 ++++ src/debugger/gui/CartF6SCWidget.hxx | 18 +- src/debugger/gui/CartF8SCWidget.cxx | 72 ++++ src/debugger/gui/CartF8SCWidget.hxx | 20 +- src/debugger/gui/CartFA2Widget.cxx | 72 ++++ src/debugger/gui/CartFA2Widget.hxx | 17 + src/debugger/gui/CartFAWidget.cxx | 72 ++++ src/debugger/gui/CartFAWidget.hxx | 17 + src/debugger/gui/CartRamWidget.cxx | 513 +++++++++++++++++++++++++ src/debugger/gui/CartRamWidget.hxx | 118 ++++++ src/debugger/gui/DebuggerDialog.cxx | 14 + src/debugger/gui/DebuggerDialog.hxx | 3 + src/debugger/gui/module.mk | 1 + src/emucore/Cart.cxx | 14 - src/emucore/Cart.hxx | 16 +- src/emucore/Cart3E.cxx | 5 - src/emucore/Cart4KSC.cxx | 3 - src/emucore/CartBFSC.cxx | 3 - src/emucore/CartCM.cxx | 4 - src/emucore/CartCTY.cxx | 3 - src/emucore/CartCV.cxx | 3 - src/emucore/CartDASH.cxx | 2 + src/emucore/CartDFSC.cxx | 3 - src/emucore/CartDPCPlus.hxx | 6 +- src/emucore/CartE7.cxx | 7 - src/emucore/CartEFSC.cxx | 3 - src/emucore/CartF4SC.cxx | 3 - src/emucore/CartF6SC.cxx | 3 - src/emucore/CartF8SC.cxx | 3 - src/emucore/CartFA.cxx | 3 - src/emucore/CartFA2.cxx | 3 - 57 files changed, 2011 insertions(+), 92 deletions(-) create mode 100644 src/debugger/gui/CartRamWidget.cxx create mode 100644 src/debugger/gui/CartRamWidget.hxx diff --git a/Changes.txt b/Changes.txt index 6d004f9d4..89e4abd27 100644 --- a/Changes.txt +++ b/Changes.txt @@ -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 diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 5a1f92676..451017836 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -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 diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index d9a052443..2530f4091 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -41,6 +41,7 @@ #include "CartDebug.hxx" #include "CartDebugWidget.hxx" +#include "CartRamWidget.hxx" #include "CpuDebug.hxx" #include "RiotDebug.hxx" #include "TIADebug.hxx" diff --git a/src/debugger/gui/Cart3EWidget.cxx b/src/debugger/gui/Cart3EWidget.cxx index 3091600cf..211a9ed4f 100644 --- a/src/debugger/gui/Cart3EWidget.cxx +++ b/src/debugger/gui/Cart3EWidget.cxx @@ -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;iinternalRamSize();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;iinternalRamSize();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;iinternalRamSize();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;iinternalRamSize();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;iinternalRamSize();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;iinternalRamSize();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;iinternalRamSize();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;iinternalRamSize();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;iinternalRamSize();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;iinternalRamSize();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;iinternalRamSize();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;iinternalRamSize();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;iinternalRamSize();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;iinternalRamSize();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= 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; isetNumRows(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); +} + diff --git a/src/debugger/gui/CartRamWidget.hxx b/src/debugger/gui/CartRamWidget.hxx new file mode 100644 index 000000000..7cb9b1148 --- /dev/null +++ b/src/debugger/gui/CartRamWidget.hxx @@ -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 diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index 0855e8ead..a32d4dae7 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -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); diff --git a/src/debugger/gui/DebuggerDialog.hxx b/src/debugger/gui/DebuggerDialog.hxx index e9243048e..ece820d90 100644 --- a/src/debugger/gui/DebuggerDialog.hxx +++ b/src/debugger/gui/DebuggerDialog.hxx @@ -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; diff --git a/src/debugger/gui/module.mk b/src/debugger/gui/module.mk index e88fda9d8..76f515026 100644 --- a/src/debugger/gui/module.mk +++ b/src/debugger/gui/module.mk @@ -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 \ diff --git a/src/emucore/Cart.cxx b/src/emucore/Cart.cxx index e69de393a..bd13d4c27 100644 --- a/src/emucore/Cart.cxx +++ b/src/emucore/Cart.cxx @@ -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) { diff --git a/src/emucore/Cart.hxx b/src/emucore/Cart.hxx index cd377f291..b3285bdc8 100644 --- a/src/emucore/Cart.hxx +++ b/src/emucore/Cart.hxx @@ -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; diff --git a/src/emucore/Cart3E.cxx b/src/emucore/Cart3E.cxx index 930ca7114..4ca6d31e2 100644 --- a/src/emucore/Cart3E.cxx +++ b/src/emucore/Cart3E.cxx @@ -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; } diff --git a/src/emucore/Cart4KSC.cxx b/src/emucore/Cart4KSC.cxx index a6eb1e3e7..55a3becdd 100644 --- a/src/emucore/Cart4KSC.cxx +++ b/src/emucore/Cart4KSC.cxx @@ -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); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartBFSC.cxx b/src/emucore/CartBFSC.cxx index 256586ff0..52a7e8085 100644 --- a/src/emucore/CartBFSC.cxx +++ b/src/emucore/CartBFSC.cxx @@ -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; } diff --git a/src/emucore/CartCM.cxx b/src/emucore/CartCM.cxx index 0c2a02060..1502b973b 100644 --- a/src/emucore/CartCM.cxx +++ b/src/emucore/CartCM.cxx @@ -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; diff --git a/src/emucore/CartCTY.cxx b/src/emucore/CartCTY.cxx index 235fdfc5d..903ccf9d2 100644 --- a/src/emucore/CartCTY.cxx +++ b/src/emucore/CartCTY.cxx @@ -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; diff --git a/src/emucore/CartCV.cxx b/src/emucore/CartCV.cxx index 70e5b2ddf..e5b8ddd50 100644 --- a/src/emucore/CartCV.cxx +++ b/src/emucore/CartCV.cxx @@ -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); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartDASH.cxx b/src/emucore/CartDASH.cxx index 61f2b6208..277b8a07b 100644 --- a/src/emucore/CartDASH.cxx +++ b/src/emucore/CartDASH.cxx @@ -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. diff --git a/src/emucore/CartDFSC.cxx b/src/emucore/CartDFSC.cxx index 47bdc179a..762729f03 100644 --- a/src/emucore/CartDFSC.cxx +++ b/src/emucore/CartDFSC.cxx @@ -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; } diff --git a/src/emucore/CartDPCPlus.hxx b/src/emucore/CartDPCPlus.hxx index ca7f39457..1d0736265 100644 --- a/src/emucore/CartDPCPlus.hxx +++ b/src/emucore/CartDPCPlus.hxx @@ -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 diff --git a/src/emucore/CartE7.cxx b/src/emucore/CartE7.cxx index 8a27aa5bb..1cdbfcb7d 100644 --- a/src/emucore/CartE7.cxx +++ b/src/emucore/CartE7.cxx @@ -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; } diff --git a/src/emucore/CartEFSC.cxx b/src/emucore/CartEFSC.cxx index 73320fda8..6de5cdd6c 100644 --- a/src/emucore/CartEFSC.cxx +++ b/src/emucore/CartEFSC.cxx @@ -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; } diff --git a/src/emucore/CartF4SC.cxx b/src/emucore/CartF4SC.cxx index bb5761ff6..ced1460d7 100644 --- a/src/emucore/CartF4SC.cxx +++ b/src/emucore/CartF4SC.cxx @@ -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; } diff --git a/src/emucore/CartF6SC.cxx b/src/emucore/CartF6SC.cxx index ef70bde06..9de638944 100644 --- a/src/emucore/CartF6SC.cxx +++ b/src/emucore/CartF6SC.cxx @@ -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; } diff --git a/src/emucore/CartF8SC.cxx b/src/emucore/CartF8SC.cxx index 995cae5fa..c7cf59a07 100644 --- a/src/emucore/CartF8SC.cxx +++ b/src/emucore/CartF8SC.cxx @@ -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; } diff --git a/src/emucore/CartFA.cxx b/src/emucore/CartFA.cxx index 6e14aec96..3964064a9 100644 --- a/src/emucore/CartFA.cxx +++ b/src/emucore/CartFA.cxx @@ -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; } diff --git a/src/emucore/CartFA2.cxx b/src/emucore/CartFA2.cxx index c50cb8f3b..eaf272778 100644 --- a/src/emucore/CartFA2.cxx +++ b/src/emucore/CartFA2.cxx @@ -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; }