Added F4/F6/F8 bankswitch schemes to the debugger ROM info tab.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2683 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2013-04-06 00:25:08 +00:00
parent fbebe17d6b
commit 3cfe7218dc
13 changed files with 442 additions and 2 deletions

View File

@ -75,6 +75,7 @@ class Debugger : public DialogContainer
// Make these friend classes, to ease communications with the debugger // Make these friend classes, to ease communications with the debugger
// Although it isn't enforced, these classes should use accessor methods // Although it isn't enforced, these classes should use accessor methods
// directly, and not touch the instance variables // directly, and not touch the instance variables
friend class CartDebugWidget;
friend class DebuggerDialog; friend class DebuggerDialog;
friend class DebuggerParser; friend class DebuggerParser;
friend class EventHandler; friend class EventHandler;

View File

@ -638,7 +638,7 @@ void DebuggerParser::executeA()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "bank" // "bank"
void DebuggerParser::executeBank() void DebuggerParser::executeBank()
{ {
int banks = debugger->cartDebug().bankCount(); int banks = debugger->cartDebug().bankCount();

View File

@ -25,6 +25,8 @@ class ButtonWidget;
#include "Font.hxx" #include "Font.hxx"
#include "Command.hxx" #include "Command.hxx"
#include "Debugger.hxx"
#include "RomWidget.hxx"
#include "Widget.hxx" #include "Widget.hxx"
#include "EditTextWidget.hxx" #include "EditTextWidget.hxx"
#include "StringListWidget.hxx" #include "StringListWidget.hxx"
@ -81,7 +83,7 @@ class CartDebugWidget : public Widget, public CommandSender
const StringList& sl = bs.stringList(); const StringList& sl = bs.stringList();
uInt32 lines = sl.size(); uInt32 lines = sl.size();
if(lines < 3) lines = 3; if(lines < 3) lines = 3;
if(lines > 6) lines = 6; // if(lines > 6) lines = 6;
new StaticTextWidget(_boss, _font, x, y, lwidth, new StaticTextWidget(_boss, _font, x, y, lwidth,
myFontHeight, "Description: ", kTextAlignLeft); myFontHeight, "Description: ", kTextAlignLeft);
@ -94,6 +96,12 @@ class CartDebugWidget : public Widget, public CommandSender
return y; return y;
} }
// Inform the ROM Widget that the underlying cart has somehow changed
void invalidate()
{
Debugger::debugger().rom().invalidate();
}
virtual void loadConfig() { }; virtual void loadConfig() { };
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id) { }; virtual void handleCommand(CommandSender* sender, int cmd, int data, int id) { };

View File

@ -0,0 +1,83 @@
//============================================================================
//
// 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 "CartF4.hxx"
#include "PopUpWidget.hxx"
#include "CartF4Widget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF4Widget::CartridgeF4Widget(
GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, CartridgeF4& cart)
: CartDebugWidget(boss, font, x, y, w, h),
myCart(cart)
{
uInt16 size = 8 * 4096;
ostringstream info;
info << "Standard F4 cartridge, eight 4K banks\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("1 ($FF9)"),
myLineHeight, items, "Set bank: ",
font.getStringWidth("Set bank: "), kBankChanged);
myBank->setTarget(this);
addFocusWidget(myBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF4Widget::loadConfig()
{
myBank->setSelected(myCart.myCurrentBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF4Widget::handleCommand(CommandSender* sender,
int cmd, int data, int id)
{
if(cmd == kBankChanged)
{
myCart.unlockBank();
myCart.bank(myBank->getSelected());
myCart.lockBank();
invalidate();
}
}

View File

@ -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 CARTRIDGEF4_WIDGET_HXX
#define CARTRIDGEF4_WIDGET_HXX
class CartridgeF4;
class PopUpWidget;
#include "CartDebugWidget.hxx"
class CartridgeF4Widget : public CartDebugWidget
{
public:
CartridgeF4Widget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h,
CartridgeF4& cart);
virtual ~CartridgeF4Widget() { }
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
private:
CartridgeF4& myCart;
PopUpWidget* myBank;
enum { kBankChanged = 'bkCH' };
};
#endif

View File

@ -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 "CartF6.hxx"
#include "PopUpWidget.hxx"
#include "CartF6Widget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF6Widget::CartridgeF6Widget(
GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, CartridgeF6& cart)
: CartDebugWidget(boss, font, x, y, w, h),
myCart(cart)
{
uInt16 size = 4 * 4096;
ostringstream info;
info << "Standard F6 cartridge, four 4K banks\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 ($FF6) "),
myLineHeight, items, "Set bank: ",
font.getStringWidth("Set bank: "), kBankChanged);
myBank->setTarget(this);
addFocusWidget(myBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF6Widget::loadConfig()
{
myBank->setSelected(myCart.myCurrentBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF6Widget::handleCommand(CommandSender* sender,
int cmd, int data, int id)
{
if(cmd == kBankChanged)
{
myCart.unlockBank();
myCart.bank(myBank->getSelected());
myCart.lockBank();
invalidate();
}
}

View File

@ -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 CARTRIDGEF6_WIDGET_HXX
#define CARTRIDGEF6_WIDGET_HXX
class CartridgeF6;
class PopUpWidget;
#include "CartDebugWidget.hxx"
class CartridgeF6Widget : public CartDebugWidget
{
public:
CartridgeF6Widget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h,
CartridgeF6& cart);
virtual ~CartridgeF6Widget() { }
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
private:
CartridgeF6& myCart;
PopUpWidget* myBank;
enum { kBankChanged = 'bkCH' };
};
#endif

View File

@ -0,0 +1,77 @@
//============================================================================
//
// 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 "CartF8.hxx"
#include "PopUpWidget.hxx"
#include "CartF8Widget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF8Widget::CartridgeF8Widget(
GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, CartridgeF8& cart)
: CartDebugWidget(boss, font, x, y, w, h),
myCart(cart)
{
uInt16 size = 8192;
ostringstream info;
info << "Standard F8 cartridge, two 4K banks\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 ($FF8) "),
myLineHeight, items, "Set bank: ",
font.getStringWidth("Set bank: "), kBankChanged);
myBank->setTarget(this);
addFocusWidget(myBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF8Widget::loadConfig()
{
myBank->setSelected(myCart.myCurrentBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF8Widget::handleCommand(CommandSender* sender,
int cmd, int data, int id)
{
if(cmd == kBankChanged)
{
myCart.unlockBank();
myCart.bank(myBank->getSelected());
myCart.lockBank();
invalidate();
}
}

View File

@ -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 CARTRIDGEF8_WIDGET_HXX
#define CARTRIDGEF8_WIDGET_HXX
class CartridgeF8;
class PopUpWidget;
#include "CartDebugWidget.hxx"
class CartridgeF8Widget : public CartDebugWidget
{
public:
CartridgeF8Widget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h,
CartridgeF8& cart);
virtual ~CartridgeF8Widget() { }
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
private:
CartridgeF8& myCart;
PopUpWidget* myBank;
enum { kBankChanged = 'bkCH' };
};
#endif

View File

@ -21,6 +21,9 @@ MODULE_OBJS := \
src/debugger/gui/ToggleWidget.o \ src/debugger/gui/ToggleWidget.o \
src/debugger/gui/Cart2KWidget.o \ src/debugger/gui/Cart2KWidget.o \
src/debugger/gui/Cart4KWidget.o \ src/debugger/gui/Cart4KWidget.o \
src/debugger/gui/CartF4Widget.o \
src/debugger/gui/CartF6Widget.o \
src/debugger/gui/CartF8Widget.o \
src/debugger/gui/JoystickWidget.o \ src/debugger/gui/JoystickWidget.o \
src/debugger/gui/PaddleWidget.o \ src/debugger/gui/PaddleWidget.o \
src/debugger/gui/BoosterWidget.o \ src/debugger/gui/BoosterWidget.o \

View File

@ -24,6 +24,9 @@ class System;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
#ifdef DEBUGGER_SUPPORT
#include "CartF4Widget.hxx"
#endif
/** /**
Cartridge class used for Atari's 32K bankswitched games. There Cartridge class used for Atari's 32K bankswitched games. There
@ -34,6 +37,8 @@ class System;
*/ */
class CartridgeF4 : public Cartridge class CartridgeF4 : public Cartridge
{ {
friend class CartridgeF4Widget;
public: public:
/** /**
Create a new cartridge using the specified image Create a new cartridge using the specified image
@ -120,6 +125,18 @@ class CartridgeF4 : public Cartridge
*/ */
string name() const { return "CartridgeF4"; } string name() const { return "CartridgeF4"; }
#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 CartridgeF4Widget(boss, font, x, y, w, h, *this);
}
#endif
public: public:
/** /**
Get the byte at the specified address. Get the byte at the specified address.

View File

@ -24,6 +24,9 @@ class System;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
#ifdef DEBUGGER_SUPPORT
#include "CartF6Widget.hxx"
#endif
/** /**
Cartridge class used for Atari's 16K bankswitched games. There Cartridge class used for Atari's 16K bankswitched games. There
@ -34,6 +37,8 @@ class System;
*/ */
class CartridgeF6 : public Cartridge class CartridgeF6 : public Cartridge
{ {
friend class CartridgeF6Widget;
public: public:
/** /**
Create a new cartridge using the specified image Create a new cartridge using the specified image
@ -120,6 +125,18 @@ class CartridgeF6 : public Cartridge
*/ */
string name() const { return "CartridgeF6"; } string name() const { return "CartridgeF6"; }
#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 CartridgeF6Widget(boss, font, x, y, w, h, *this);
}
#endif
public: public:
/** /**
Get the byte at the specified address. Get the byte at the specified address.

View File

@ -24,6 +24,9 @@ class System;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
#ifdef DEBUGGER_SUPPORT
#include "CartF8Widget.hxx"
#endif
/** /**
Cartridge class used for Atari's 8K bankswitched games. There Cartridge class used for Atari's 8K bankswitched games. There
@ -34,6 +37,8 @@ class System;
*/ */
class CartridgeF8 : public Cartridge class CartridgeF8 : public Cartridge
{ {
friend class CartridgeF8Widget;
public: public:
/** /**
Create a new cartridge using the specified image Create a new cartridge using the specified image
@ -122,6 +127,18 @@ class CartridgeF8 : public Cartridge
*/ */
string name() const { return "CartridgeF8"; } string name() const { return "CartridgeF8"; }
#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 CartridgeF8Widget(boss, font, x, y, w, h, *this);
}
#endif
public: public:
/** /**
Get the byte at the specified address. Get the byte at the specified address.