diff --git a/src/debugger/gui/CartARWidget.cxx b/src/debugger/gui/CartARWidget.cxx new file mode 100644 index 000000000..52d7e6613 --- /dev/null +++ b/src/debugger/gui/CartARWidget.cxx @@ -0,0 +1,100 @@ +//============================================================================ +// +// 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 "CartAR.hxx" +#include "PopUpWidget.hxx" +#include "CartARWidget.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +CartridgeARWidget::CartridgeARWidget( + GuiObject* boss, const GUI::Font& font, + int x, int y, int w, int h, CartridgeAR& cart) + : CartDebugWidget(boss, font, x, y, w, h), + myCart(cart) +{ + uInt16 size = myCart.mySize; + + string info = + "Supercharger cartridge, four 2K slices (3 RAM, 1 ROM)\n" + "\nTHIS SCHEME IS NOT FULLY IMPLEMENTED OR TESTED\n"; + + int xpos = 10, + ypos = addBaseInformation(size, "Starpath", info) + myLineHeight; + + StringMap items; + items.push_back(" 0", "0"); + items.push_back(" 1", "1"); + items.push_back(" 2", "2"); + items.push_back(" 3", "3"); + items.push_back(" 4", "4"); + items.push_back(" 5", "5"); + items.push_back(" 6", "6"); + items.push_back(" 7", "7"); + items.push_back(" 8", "8"); + items.push_back(" 9", "9"); + items.push_back(" 10", "10"); + items.push_back(" 11", "11"); + items.push_back(" 12", "12"); + items.push_back(" 13", "13"); + items.push_back(" 14", "14"); + items.push_back(" 15", "15"); + items.push_back(" 16", "16"); + items.push_back(" 17", "17"); + items.push_back(" 18", "18"); + items.push_back(" 19", "19"); + items.push_back(" 20", "20"); + items.push_back(" 21", "21"); + items.push_back(" 22", "22"); + items.push_back(" 23", "23"); + items.push_back(" 24", "24"); + items.push_back(" 25", "25"); + items.push_back(" 26", "26"); + items.push_back(" 27", "27"); + items.push_back(" 28", "28"); + items.push_back(" 29", "29"); + items.push_back(" 30", "30"); + items.push_back(" 31", "31"); + myBank = + new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth(" XX "), + myLineHeight, items, "Set bank: ", + font.getStringWidth("Set bank: "), kBankChanged); + myBank->setTarget(this); + addFocusWidget(myBank); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void CartridgeARWidget::loadConfig() +{ + myBank->setSelected(myCart.myCurrentBank); + + CartDebugWidget::loadConfig(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void CartridgeARWidget::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/CartARWidget.hxx b/src/debugger/gui/CartARWidget.hxx new file mode 100644 index 000000000..e786fa8f6 --- /dev/null +++ b/src/debugger/gui/CartARWidget.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 CARTRIDGEAR_WIDGET_HXX +#define CARTRIDGEAR_WIDGET_HXX + +class CartridgeAR; +class PopUpWidget; + +#include "CartDebugWidget.hxx" + +class CartridgeARWidget : public CartDebugWidget +{ + public: + CartridgeARWidget(GuiObject* boss, const GUI::Font& font, + int x, int y, int w, int h, + CartridgeAR& cart); + virtual ~CartridgeARWidget() { } + + void loadConfig(); + void handleCommand(CommandSender* sender, int cmd, int data, int id); + + private: + CartridgeAR& myCart; + PopUpWidget* myBank; + + enum { kBankChanged = 'bkCH' }; +}; + +#endif diff --git a/src/debugger/gui/module.mk b/src/debugger/gui/module.mk index d2dda1897..a6e311816 100644 --- a/src/debugger/gui/module.mk +++ b/src/debugger/gui/module.mk @@ -25,6 +25,7 @@ MODULE_OBJS := \ src/debugger/gui/Cart3FWidget.o \ src/debugger/gui/Cart4A50Widget.o \ src/debugger/gui/Cart4KWidget.o \ + src/debugger/gui/CartARWidget.o \ src/debugger/gui/CartCMWidget.o \ src/debugger/gui/CartCVWidget.o \ src/debugger/gui/CartDPCWidget.o \ diff --git a/src/emucore/CartAR.cxx b/src/emucore/CartAR.cxx index 75b458169..aa697a065 100644 --- a/src/emucore/CartAR.cxx +++ b/src/emucore/CartAR.cxx @@ -59,10 +59,12 @@ CartridgeAR::~CartridgeAR() void CartridgeAR::reset() { // Initialize RAM +#if 0 // TODO - figure out actual behaviour of the real cart if(mySettings.getBool("ramrandom")) for(uInt32 i = 0; i < 6 * 1024; ++i) myImage[i] = mySystem->randGenerator().next(); else +#endif memset(myImage, 0, 6 * 1024); // Initialize SC BIOS ROM diff --git a/src/emucore/CartAR.hxx b/src/emucore/CartAR.hxx index 261849604..2d71dce33 100644 --- a/src/emucore/CartAR.hxx +++ b/src/emucore/CartAR.hxx @@ -25,6 +25,9 @@ class System; #include "bspf.hxx" #include "Cart.hxx" +#ifdef DEBUGGER_SUPPORT + #include "CartARWidget.hxx" +#endif /** This is the cartridge class for Arcadia (aka Starpath) Supercharger @@ -40,6 +43,8 @@ class System; */ class CartridgeAR : public Cartridge { + friend class CartridgeARWidget; + public: /** Create a new cartridge using the specified image and size @@ -133,6 +138,18 @@ class CartridgeAR : public Cartridge */ string name() const { return "CartridgeAR"; } + #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 CartridgeARWidget(boss, font, x, y, w, h, *this); + } + #endif + public: /** Get the byte at the specified address @@ -176,7 +193,7 @@ class CartridgeAR : public Cartridge // Pointer to the 6502 processor in the system M6502* my6502; - // Indicates the offest within the image for the corresponding bank + // Indicates the offset within the image for the corresponding bank uInt32 myImageOffset[2]; // The 6K of RAM and 2K of ROM contained in the Supercharger