diff --git a/src/debugger/gui/Cart0840Widget.cxx b/src/debugger/gui/Cart0840Widget.cxx index 907f2a072..cf0124401 100644 --- a/src/debugger/gui/Cart0840Widget.cxx +++ b/src/debugger/gui/Cart0840Widget.cxx @@ -31,7 +31,7 @@ Cartridge0840Widget::Cartridge0840Widget( uInt16 size = 2 * 4096; ostringstream info; - info << "0840 Econobanking, two 4K banks\n" + info << "0840 ECONObanking, two 4K banks\n" << "Startup bank = " << cart.myStartBank << "\n"; // Eventually, we should query this from the debugger/disassembler diff --git a/src/debugger/gui/Cart3FWidget.cxx b/src/debugger/gui/Cart3FWidget.cxx new file mode 100644 index 000000000..0b00445c3 --- /dev/null +++ b/src/debugger/gui/Cart3FWidget.cxx @@ -0,0 +1,82 @@ +//============================================================================ +// +// 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-2013 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 "Cart3F.hxx" +#include "PopUpWidget.hxx" +#include "Cart3FWidget.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Cartridge3FWidget::Cartridge3FWidget( + GuiObject* boss, const GUI::Font& font, + int x, int y, int w, int h, Cartridge3F& cart) + : CartDebugWidget(boss, font, x, y, w, h), + myCart(cart) +{ + uInt32 size = cart.mySize; + + ostringstream info; + info << "Tigervision 3F cartridge, 2-256 2K banks\n" + << "Startup bank = " << cart.myStartBank << "\n" + << "First 2K bank selected by writing to $3F\n" + << "Last 2K always points to last 2K of ROM\n"; + + // Eventually, we should query this from the debugger/disassembler + uInt16 start = (cart.myImage[size-3] << 8) | cart.myImage[size-4]; + start -= start % 0x1000; + info << "Bank RORG" << " = $" << HEX4 << start << "\n"; + + int xpos = 10, + ypos = addBaseInformation(size, "TigerVision", info.str()) + myLineHeight; + + StringMap items; + for(uInt16 i = 0; i < cart.bankCount(); ++i) + { + const string& b = BSPF_toString(i); + items.push_back(b + " ($3F)", b); + } + ostringstream label; + label << "Set bank ($" << HEX4 << start << " - $" << (start+0x7FF) << "): "; + myBank = + new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($3F) "), + myLineHeight, items, label.str(), + font.getStringWidth(label.str()), kBankChanged); + myBank->setTarget(this); + addFocusWidget(myBank); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Cartridge3FWidget::loadConfig() +{ + myBank->setSelected(myCart.myCurrentBank); + + CartDebugWidget::loadConfig(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Cartridge3FWidget::handleCommand(CommandSender* sender, + int cmd, int data, int id) +{ + if(cmd == kBankChanged) + { + myCart.unlockBank(); + myCart.bank(myBank->getSelected()); + myCart.lockBank(); + invalidate(); + } +} diff --git a/src/debugger/gui/Cart3FWidget.hxx b/src/debugger/gui/Cart3FWidget.hxx new file mode 100644 index 000000000..77fbb6b93 --- /dev/null +++ b/src/debugger/gui/Cart3FWidget.hxx @@ -0,0 +1,46 @@ +//============================================================================ +// +// 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-2013 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 CARTRIDGE3F_WIDGET_HXX +#define CARTRIDGE3F_WIDGET_HXX + +class Cartridge3F; +class PopUpWidget; + +#include "CartDebugWidget.hxx" + +class Cartridge3FWidget : public CartDebugWidget +{ + public: + Cartridge3FWidget(GuiObject* boss, const GUI::Font& font, + int x, int y, int w, int h, + Cartridge3F& cart); + virtual ~Cartridge3FWidget() { } + + void loadConfig(); + void handleCommand(CommandSender* sender, int cmd, int data, int id); + + private: + Cartridge3F& myCart; + PopUpWidget* myBank; + + enum { kBankChanged = 'bkCH' }; +}; + +#endif diff --git a/src/debugger/gui/module.mk b/src/debugger/gui/module.mk index afa92c844..3e67d0252 100644 --- a/src/debugger/gui/module.mk +++ b/src/debugger/gui/module.mk @@ -21,6 +21,7 @@ MODULE_OBJS := \ src/debugger/gui/ToggleWidget.o \ src/debugger/gui/Cart0840Widget.o \ src/debugger/gui/Cart2KWidget.o \ + src/debugger/gui/Cart3FWidget.o \ src/debugger/gui/Cart4KWidget.o \ src/debugger/gui/CartCVWidget.o \ src/debugger/gui/CartEFWidget.o \ diff --git a/src/emucore/Cart3E.hxx b/src/emucore/Cart3E.hxx index f2472dc7b..670bec8e1 100644 --- a/src/emucore/Cart3E.hxx +++ b/src/emucore/Cart3E.hxx @@ -47,7 +47,7 @@ class System; instead, store the RAM bank number into $3E. This implementation of 3E bankswitching numbers the ROM banks 0 to - 256, and the RAM banks 256 to 287. This is done because the public + 255, and the RAM banks 256 to 287. This is done because the public bankswitching interface requires us to use one bank number, not one bank number plus the knowledge of whether it's RAM or ROM. diff --git a/src/emucore/Cart3F.hxx b/src/emucore/Cart3F.hxx index 280e34a60..8de6ad462 100644 --- a/src/emucore/Cart3F.hxx +++ b/src/emucore/Cart3F.hxx @@ -24,6 +24,9 @@ class System; #include "bspf.hxx" #include "Cart.hxx" +#ifdef DEBUGGER_SUPPORT + #include "Cart3FWidget.hxx" +#endif /** This is the cartridge class for Tigervision's bankswitched @@ -40,6 +43,8 @@ class System; */ class Cartridge3F : public Cartridge { + friend class Cartridge3FWidget; + public: /** Create a new cartridge using the specified image and size @@ -126,6 +131,18 @@ class Cartridge3F : public Cartridge */ string name() const { return "Cartridge3F"; } + #ifdef DEBUGGER_SUPPORT + /** + Get debugger widget responsible for accessing the inner workings + of the cart. + */ + CartDebugWidget* debugWidget(GuiObject* boss, + const GUI::Font& font, int x, int y, int w, int h) + { + return new Cartridge3FWidget(boss, font, x, y, w, h, *this); + } + #endif + public: /** Get the byte at the specified address