Added FA2 scheme to ROM debugger tab (loading/saving RAM to

Harmony flash with hotspot $FF4 is mentioned, but currently
unsupported).

Implemented changing banks for MC scheme (although no test ROMs
exist, so we don't even know if the scheme works).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2696 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2013-04-17 19:59:05 +00:00
parent a7566af776
commit fb0df96cfe
9 changed files with 185 additions and 6 deletions

View File

@ -50,7 +50,7 @@ class CartDebugWidget : public Widget, public CommandSender
public:
int addBaseInformation(int bytes, const string& manufacturer,
const string& desc)
const string& desc, const uInt16 maxlines = 10)
{
const int lwidth = _font.getStringWidth("Manufacturer: "),
fwidth = _w - lwidth - 20;
@ -82,7 +82,7 @@ class CartDebugWidget : public Widget, public CommandSender
const StringList& sl = bs.stringList();
uInt32 lines = sl.size();
if(lines < 3) lines = 3;
if(lines > 10) lines = 10;
if(lines > maxlines) lines = maxlines;
new StaticTextWidget(_boss, _font, x, y, lwidth,
myFontHeight, "Description: ", kTextAlignLeft);

View File

@ -50,7 +50,7 @@ CartridgeE7Widget::CartridgeE7Widget(
info << "Bank RORG" << " = $" << HEX4 << start << "\n";
#endif
int xpos = 10,
ypos = addBaseInformation(size, "M-Network", info.str()) + myLineHeight;
ypos = addBaseInformation(size, "M-Network", info.str(), 15) + myLineHeight;
StringMap items0, items1;
items0.push_back("0 - ROM ($FE0)", "0");

View File

@ -46,7 +46,7 @@ CartridgeF4SCWidget::CartridgeF4SCWidget(
}
int xpos = 10,
ypos = addBaseInformation(size, "Atari", info.str()) + myLineHeight;
ypos = addBaseInformation(size, "Atari", info.str(), 15) + myLineHeight;
StringMap items;
items.push_back("0 ($FF4)", "0");

View File

@ -44,7 +44,7 @@ CartridgeF4Widget::CartridgeF4Widget(
}
int xpos = 10,
ypos = addBaseInformation(size, "Atari", info.str()) + myLineHeight;
ypos = addBaseInformation(size, "Atari", info.str(), 15) + myLineHeight;
StringMap items;
items.push_back("0 ($FF4)", "0");

View File

@ -0,0 +1,92 @@
//============================================================================
//
// 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 "CartFA2.hxx"
#include "PopUpWidget.hxx"
#include "CartFA2Widget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeFA2Widget::CartridgeFA2Widget(
GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, CartridgeFA2& cart)
: CartDebugWidget(boss, font, x, y, w, h),
myCart(cart)
{
uInt16 size = cart.mySize;
ostringstream info;
info << "Modified FA RAM+, six or seven 4K banks\n"
<< "256 bytes RAM @ $F000 - $F1FF\n"
<< " $F100 - $F1FF (R), $F000 - $F0FF (W)\n"
<< "RAM can be loaded/saved to Harmony flash by accessing $FF4 "
"(not currently accessible)\n"
<< "Startup bank = " << cart.myStartBank << "\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF5; i < cart.bankCount();
++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, "Chris D. Walton (Star Castle 2600)",
info.str(), 15) + myLineHeight;
StringMap items;
items.push_back("0 ($FF5)", "0");
items.push_back("1 ($FF6)", "1");
items.push_back("2 ($FF7)", "2");
items.push_back("3 ($FF8)", "3");
items.push_back("4 ($FF9)", "4");
items.push_back("5 ($FFA)", "5");
if(cart.bankCount() == 7)
items.push_back("6 ($FFB)", "6");
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 CartridgeFA2Widget::loadConfig()
{
myBank->setSelected(myCart.myCurrentBank);
CartDebugWidget::loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeFA2Widget::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 CARTRIDGEFA2_WIDGET_HXX
#define CARTRIDGEFA2_WIDGET_HXX
class CartridgeFA2;
class PopUpWidget;
#include "CartDebugWidget.hxx"
class CartridgeFA2Widget : public CartDebugWidget
{
public:
CartridgeFA2Widget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h,
CartridgeFA2& cart);
virtual ~CartridgeFA2Widget() { }
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
private:
CartridgeFA2& myCart;
PopUpWidget* myBank;
enum { kBankChanged = 'bkCH' };
};
#endif

View File

@ -115,5 +115,24 @@ void CartridgeMCWidget::loadConfig()
void CartridgeMCWidget::handleCommand(CommandSender* sender,
int cmd, int data, int id)
{
// TODO - implement this
myCart.unlockBank();
switch(cmd)
{
case kSlice0Changed:
myCart.myCurrentBlock[0] = atoi(mySlice0->getSelectedTag().c_str());
break;
case kSlice1Changed:
myCart.myCurrentBlock[1] = atoi(mySlice1->getSelectedTag().c_str());
break;
case kSlice2Changed:
myCart.myCurrentBlock[2] = atoi(mySlice2->getSelectedTag().c_str());
break;
case kSlice3Changed:
myCart.myCurrentBlock[3] = atoi(mySlice3->getSelectedTag().c_str());
break;
}
myCart.lockBank();
invalidate();
}

View File

@ -37,6 +37,7 @@ MODULE_OBJS := \
src/debugger/gui/CartF6SCWidget.o \
src/debugger/gui/CartF8SCWidget.o \
src/debugger/gui/CartFAWidget.o \
src/debugger/gui/CartFA2Widget.o \
src/debugger/gui/CartFEWidget.o \
src/debugger/gui/CartMCWidget.o \
src/debugger/gui/CartSBWidget.o \

View File

@ -24,6 +24,9 @@ class System;
#include "bspf.hxx"
#include "Cart.hxx"
#ifdef DEBUGGER_SUPPORT
#include "CartFA2Widget.hxx"
#endif
/**
This is an extended version of the CBS RAM Plus bankswitching scheme
@ -33,11 +36,17 @@ class System;
of RAM can be loaded/saved to Harmony cart flash, which is emulated by
storing in a file.
For 29K versions of the scheme, the first 1K is ARM code
(implements actual bankswitching on the Harmony cart), which is
completely ignored by the emulator.
@author Chris D. Walton
@version $Id$
*/
class CartridgeFA2 : public Cartridge
{
friend class CartridgeFA2Widget;
public:
/**
Create a new cartridge using the specified image
@ -132,6 +141,18 @@ class CartridgeFA2 : public Cartridge
*/
void setRomName(const string& name);
#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 CartridgeFA2Widget(boss, font, x, y, w, h, *this);
}
#endif
public:
/**
Get the byte at the specified address.