From 4c227932f13124d4cb4a1972f216f73d7d921d6d Mon Sep 17 00:00:00 2001 From: stephena Date: Sat, 6 Apr 2013 14:09:16 +0000 Subject: [PATCH] Added F4SC/F6SC/F8SC schemes to debugger ROM tab. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2684 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/debugger/gui/CartF4SCWidget.cxx | 85 +++++++++++++++++++++++++++++ src/debugger/gui/CartF4SCWidget.hxx | 46 ++++++++++++++++ src/debugger/gui/CartF4Widget.cxx | 2 +- src/debugger/gui/CartF6SCWidget.cxx | 81 +++++++++++++++++++++++++++ src/debugger/gui/CartF6SCWidget.hxx | 46 ++++++++++++++++ src/debugger/gui/CartF6Widget.cxx | 2 +- src/debugger/gui/CartF8SCWidget.cxx | 79 +++++++++++++++++++++++++++ src/debugger/gui/CartF8SCWidget.hxx | 46 ++++++++++++++++ src/debugger/gui/CartF8Widget.cxx | 2 +- src/debugger/gui/module.mk | 3 + src/emucore/CartF4SC.hxx | 17 ++++++ src/emucore/CartF6SC.hxx | 17 ++++++ src/emucore/CartF8SC.hxx | 17 ++++++ 13 files changed, 440 insertions(+), 3 deletions(-) create mode 100644 src/debugger/gui/CartF4SCWidget.cxx create mode 100644 src/debugger/gui/CartF4SCWidget.hxx create mode 100644 src/debugger/gui/CartF6SCWidget.cxx create mode 100644 src/debugger/gui/CartF6SCWidget.hxx create mode 100644 src/debugger/gui/CartF8SCWidget.cxx create mode 100644 src/debugger/gui/CartF8SCWidget.hxx diff --git a/src/debugger/gui/CartF4SCWidget.cxx b/src/debugger/gui/CartF4SCWidget.cxx new file mode 100644 index 000000000..09f40dfb6 --- /dev/null +++ b/src/debugger/gui/CartF4SCWidget.cxx @@ -0,0 +1,85 @@ +//============================================================================ +// +// 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 "CartF4SC.hxx" +#include "PopUpWidget.hxx" +#include "CartF4SCWidget.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +CartridgeF4SCWidget::CartridgeF4SCWidget( + GuiObject* boss, const GUI::Font& font, + int x, int y, int w, int h, CartridgeF4SC& cart) + : CartDebugWidget(boss, font, x, y, w, h), + myCart(cart) +{ + uInt16 size = 8 * 4096; + + ostringstream info; + info << "Standard F4SC cartridge, eight 4K banks\n" + << "128 bytes RAM @ $F000 - $F0FF\n" + << " $F080 - $F0FF (R), $F000 - $F07F (W)\n" + << "Startup bank = " << cart.myStartBank << "\n"; + + // Eventually, we should query this from the debugger/disassembler + for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF4; i < 8; ++i, offset += 0x1000) + { + uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset]; + start -= start % 0x1000; + info << "Bank " << i << " @ $" << HEX4 << start << " - " + << "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n"; + } + + int xpos = 10, + ypos = addBaseInformation(size, "Atari", info.str()) + myLineHeight; + + StringMap items; + items.push_back("0 ($FF4)", "0"); + items.push_back("1 ($FF5)", "1"); + items.push_back("2 ($FF6)", "2"); + items.push_back("3 ($FF7)", "3"); + items.push_back("4 ($FF8)", "0"); + items.push_back("5 ($FF9)", "1"); + items.push_back("6 ($FFA)", "2"); + items.push_back("7 ($FFB)", "3"); + myBank = + new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), + myLineHeight, items, "Set bank: ", + font.getStringWidth("Set bank: "), kBankChanged); + myBank->setTarget(this); + addFocusWidget(myBank); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void CartridgeF4SCWidget::loadConfig() +{ + myBank->setSelected(myCart.myCurrentBank); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void CartridgeF4SCWidget::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/CartF4SCWidget.hxx b/src/debugger/gui/CartF4SCWidget.hxx new file mode 100644 index 000000000..57e6aa602 --- /dev/null +++ b/src/debugger/gui/CartF4SCWidget.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 CARTRIDGEF4SC_WIDGET_HXX +#define CARTRIDGEF4SC_WIDGET_HXX + +class CartridgeF4SC; +class PopUpWidget; + +#include "CartDebugWidget.hxx" + +class CartridgeF4SCWidget : public CartDebugWidget +{ + public: + CartridgeF4SCWidget(GuiObject* boss, const GUI::Font& font, + int x, int y, int w, int h, + CartridgeF4SC& cart); + virtual ~CartridgeF4SCWidget() { } + + void loadConfig(); + void handleCommand(CommandSender* sender, int cmd, int data, int id); + + private: + CartridgeF4SC& myCart; + PopUpWidget* myBank; + + enum { kBankChanged = 'bkCH' }; +}; + +#endif diff --git a/src/debugger/gui/CartF4Widget.cxx b/src/debugger/gui/CartF4Widget.cxx index d3c8588d6..736d1d2df 100644 --- a/src/debugger/gui/CartF4Widget.cxx +++ b/src/debugger/gui/CartF4Widget.cxx @@ -56,7 +56,7 @@ CartridgeF4Widget::CartridgeF4Widget( items.push_back("6 ($FFA)", "2"); items.push_back("7 ($FFB)", "3"); myBank = - new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("1 ($FF9)"), + new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), myLineHeight, items, "Set bank: ", font.getStringWidth("Set bank: "), kBankChanged); myBank->setTarget(this); diff --git a/src/debugger/gui/CartF6SCWidget.cxx b/src/debugger/gui/CartF6SCWidget.cxx new file mode 100644 index 000000000..bfeefa43e --- /dev/null +++ b/src/debugger/gui/CartF6SCWidget.cxx @@ -0,0 +1,81 @@ +//============================================================================ +// +// 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 "CartF6SC.hxx" +#include "PopUpWidget.hxx" +#include "CartF6SCWidget.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +CartridgeF6SCWidget::CartridgeF6SCWidget( + GuiObject* boss, const GUI::Font& font, + int x, int y, int w, int h, CartridgeF6SC& cart) + : CartDebugWidget(boss, font, x, y, w, h), + myCart(cart) +{ + uInt16 size = 4 * 4096; + + ostringstream info; + info << "Standard F6SC cartridge, four 4K banks\n" + << "128 bytes RAM @ $F000 - $F0FF\n" + << " $F080 - $F0FF (R), $F000 - $F07F (W)\n" + << "Startup bank = " << cart.myStartBank << "\n"; + + // Eventually, we should query this from the debugger/disassembler + for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF6; i < 4; ++i, offset += 0x1000) + { + uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset]; + start -= start % 0x1000; + info << "Bank " << i << " @ $" << HEX4 << start << " - " + << "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n"; + } + + int xpos = 10, + ypos = addBaseInformation(size, "Atari", info.str()) + myLineHeight; + + StringMap items; + items.push_back("0 ($FF6)", "0"); + items.push_back("1 ($FF7)", "1"); + items.push_back("2 ($FF8)", "2"); + items.push_back("3 ($FF9)", "3"); + myBank = + new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), + myLineHeight, items, "Set bank: ", + font.getStringWidth("Set bank: "), kBankChanged); + myBank->setTarget(this); + addFocusWidget(myBank); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void CartridgeF6SCWidget::loadConfig() +{ + myBank->setSelected(myCart.myCurrentBank); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void CartridgeF6SCWidget::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/CartF6SCWidget.hxx b/src/debugger/gui/CartF6SCWidget.hxx new file mode 100644 index 000000000..e98f5d01f --- /dev/null +++ b/src/debugger/gui/CartF6SCWidget.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 CARTRIDGEF6SC_WIDGET_HXX +#define CARTRIDGEF6SC_WIDGET_HXX + +class CartridgeF6SC; +class PopUpWidget; + +#include "CartDebugWidget.hxx" + +class CartridgeF6SCWidget : public CartDebugWidget +{ + public: + CartridgeF6SCWidget(GuiObject* boss, const GUI::Font& font, + int x, int y, int w, int h, + CartridgeF6SC& cart); + virtual ~CartridgeF6SCWidget() { } + + void loadConfig(); + void handleCommand(CommandSender* sender, int cmd, int data, int id); + + private: + CartridgeF6SC& myCart; + PopUpWidget* myBank; + + enum { kBankChanged = 'bkCH' }; +}; + +#endif diff --git a/src/debugger/gui/CartF6Widget.cxx b/src/debugger/gui/CartF6Widget.cxx index 9379b8ed4..19cd435f4 100644 --- a/src/debugger/gui/CartF6Widget.cxx +++ b/src/debugger/gui/CartF6Widget.cxx @@ -52,7 +52,7 @@ CartridgeF6Widget::CartridgeF6Widget( items.push_back("2 ($FF8)", "2"); items.push_back("3 ($FF9)", "3"); myBank = - new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FF6) "), + new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), myLineHeight, items, "Set bank: ", font.getStringWidth("Set bank: "), kBankChanged); myBank->setTarget(this); diff --git a/src/debugger/gui/CartF8SCWidget.cxx b/src/debugger/gui/CartF8SCWidget.cxx new file mode 100644 index 000000000..453ca179c --- /dev/null +++ b/src/debugger/gui/CartF8SCWidget.cxx @@ -0,0 +1,79 @@ +//============================================================================ +// +// 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 "CartF8SC.hxx" +#include "PopUpWidget.hxx" +#include "CartF8SCWidget.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +CartridgeF8SCWidget::CartridgeF8SCWidget( + GuiObject* boss, const GUI::Font& font, + int x, int y, int w, int h, CartridgeF8SC& cart) + : CartDebugWidget(boss, font, x, y, w, h), + myCart(cart) +{ + uInt16 size = 8192; + + ostringstream info; + info << "Standard F8SC cartridge, two 4K banks\n" + << "128 bytes RAM @ $F000 - $F0FF\n" + << " $F080 - $F0FF (R), $F000 - $F07F (W)\n" + << "Startup bank = " << cart.myStartBank << "\n"; + + // Eventually, we should query this from the debugger/disassembler + for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF8; i < 2; ++i, offset += 0x1000) + { + uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset]; + start -= start % 0x1000; + info << "Bank " << i << " @ $" << HEX4 << start << " - " + << "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n"; + } + + int xpos = 10, + ypos = addBaseInformation(size, "Atari", info.str()) + myLineHeight; + + StringMap items; + items.push_back("0 ($FF8)", "0"); + items.push_back("1 ($FF9)", "1"); + myBank = + new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), + myLineHeight, items, "Set bank: ", + font.getStringWidth("Set bank: "), kBankChanged); + myBank->setTarget(this); + addFocusWidget(myBank); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void CartridgeF8SCWidget::loadConfig() +{ + myBank->setSelected(myCart.myCurrentBank); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void CartridgeF8SCWidget::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/CartF8SCWidget.hxx b/src/debugger/gui/CartF8SCWidget.hxx new file mode 100644 index 000000000..80feb0af9 --- /dev/null +++ b/src/debugger/gui/CartF8SCWidget.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 CARTRIDGEF8SC_WIDGET_HXX +#define CARTRIDGEF8SC_WIDGET_HXX + +class CartridgeF8SC; +class PopUpWidget; + +#include "CartDebugWidget.hxx" + +class CartridgeF8SCWidget : public CartDebugWidget +{ + public: + CartridgeF8SCWidget(GuiObject* boss, const GUI::Font& font, + int x, int y, int w, int h, + CartridgeF8SC& cart); + virtual ~CartridgeF8SCWidget() { } + + void loadConfig(); + void handleCommand(CommandSender* sender, int cmd, int data, int id); + + private: + CartridgeF8SC& myCart; + PopUpWidget* myBank; + + enum { kBankChanged = 'bkCH' }; +}; + +#endif diff --git a/src/debugger/gui/CartF8Widget.cxx b/src/debugger/gui/CartF8Widget.cxx index 9d72b4cc1..81c79c171 100644 --- a/src/debugger/gui/CartF8Widget.cxx +++ b/src/debugger/gui/CartF8Widget.cxx @@ -50,7 +50,7 @@ CartridgeF8Widget::CartridgeF8Widget( items.push_back("0 ($FF8)", "0"); items.push_back("1 ($FF9)", "1"); myBank = - new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FF8) "), + new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), myLineHeight, items, "Set bank: ", font.getStringWidth("Set bank: "), kBankChanged); myBank->setTarget(this); diff --git a/src/debugger/gui/module.mk b/src/debugger/gui/module.mk index 61a5a0e7a..7856eb23e 100644 --- a/src/debugger/gui/module.mk +++ b/src/debugger/gui/module.mk @@ -24,6 +24,9 @@ MODULE_OBJS := \ src/debugger/gui/CartF4Widget.o \ src/debugger/gui/CartF6Widget.o \ src/debugger/gui/CartF8Widget.o \ + src/debugger/gui/CartF4SCWidget.o \ + src/debugger/gui/CartF6SCWidget.o \ + src/debugger/gui/CartF8SCWidget.o \ src/debugger/gui/JoystickWidget.o \ src/debugger/gui/PaddleWidget.o \ src/debugger/gui/BoosterWidget.o \ diff --git a/src/emucore/CartF4SC.hxx b/src/emucore/CartF4SC.hxx index 0b4556044..484a99f21 100644 --- a/src/emucore/CartF4SC.hxx +++ b/src/emucore/CartF4SC.hxx @@ -24,6 +24,9 @@ class System; #include "bspf.hxx" #include "Cart.hxx" +#ifdef DEBUGGER_SUPPORT + #include "CartF4SCWidget.hxx" +#endif /** Cartridge class used for Atari's 32K bankswitched games with @@ -34,6 +37,8 @@ class System; */ class CartridgeF4SC : public Cartridge { + friend class CartridgeF4SCWidget; + public: /** Create a new cartridge using the specified image @@ -120,6 +125,18 @@ class CartridgeF4SC : public Cartridge */ string name() const { return "CartridgeF4SC"; } + #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 CartridgeF4SCWidget(boss, font, x, y, w, h, *this); + } + #endif + public: /** Get the byte at the specified address. diff --git a/src/emucore/CartF6SC.hxx b/src/emucore/CartF6SC.hxx index 9080ac8ca..e54af6d53 100644 --- a/src/emucore/CartF6SC.hxx +++ b/src/emucore/CartF6SC.hxx @@ -24,6 +24,9 @@ class System; #include "bspf.hxx" #include "Cart.hxx" +#ifdef DEBUGGER_SUPPORT + #include "CartF6SCWidget.hxx" +#endif /** Cartridge class used for Atari's 16K bankswitched games with @@ -34,6 +37,8 @@ class System; */ class CartridgeF6SC : public Cartridge { + friend class CartridgeF6SCWidget; + public: /** Create a new cartridge using the specified image @@ -120,6 +125,18 @@ class CartridgeF6SC : public Cartridge */ string name() const { return "CartridgeF6SC"; } + #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 CartridgeF6SCWidget(boss, font, x, y, w, h, *this); + } + #endif + public: /** Get the byte at the specified address. diff --git a/src/emucore/CartF8SC.hxx b/src/emucore/CartF8SC.hxx index b664c0881..d8d51a060 100644 --- a/src/emucore/CartF8SC.hxx +++ b/src/emucore/CartF8SC.hxx @@ -24,6 +24,9 @@ class System; #include "bspf.hxx" #include "Cart.hxx" +#ifdef DEBUGGER_SUPPORT + #include "CartF8SCWidget.hxx" +#endif /** Cartridge class used for Atari's 8K bankswitched games with @@ -34,6 +37,8 @@ class System; */ class CartridgeF8SC : public Cartridge { + friend class CartridgeF8SCWidget; + public: /** Create a new cartridge using the specified image @@ -120,6 +125,18 @@ class CartridgeF8SC : public Cartridge */ string name() const { return "CartridgeF8SC"; } + #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 CartridgeF8SCWidget(boss, font, x, y, w, h, *this); + } + #endif + public: /** Get the byte at the specified address.