mirror of https://github.com/stella-emu/stella.git
Added 3E scheme to debugger ROM tab. This is the start of the more
esoteric schemes (ie, the ones that no longer follow the '4K per bank' design). Arguably, this is the entire point of adding the cart-specific debugger ROM tab; to make it easier to work with such schemes. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2689 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
2e81f9e842
commit
88c7d39b96
|
@ -0,0 +1,149 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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 "Cart3E.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "Cart3EWidget.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Cartridge3EWidget::Cartridge3EWidget(
|
||||
GuiObject* boss, const GUI::Font& font,
|
||||
int x, int y, int w, int h, Cartridge3E& cart)
|
||||
: CartDebugWidget(boss, font, x, y, w, h),
|
||||
myCart(cart),
|
||||
myNumRomBanks(cart.mySize >> 11),
|
||||
myNumRamBanks(32)
|
||||
{
|
||||
uInt32 size = cart.mySize;
|
||||
|
||||
ostringstream info;
|
||||
info << "Tigervision 3E cartridge - (3E + RAM)\n"
|
||||
<< " 2-256 2K ROM (currently " << myNumRomBanks << "), 32 1K RAM\n"
|
||||
<< "(ROM) First 2K selected by writing to $3F\n"
|
||||
<< "(RAM) First 2K selected by writing to $3E\n"
|
||||
<< " $F000 - $F3FF (R), $F400 - $F7FF (W)\n"
|
||||
<< "Last 2K always points to last 2K of ROM\n";
|
||||
if(cart.myStartBank < myNumRomBanks)
|
||||
info << "Startup bank = " << cart.myStartBank << " (ROM)\n";
|
||||
else
|
||||
info << "Startup bank = " << (cart.myStartBank-myNumRomBanks) << " (RAM)\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 romitems;
|
||||
for(uInt32 i = 0; i < myNumRomBanks; ++i)
|
||||
{
|
||||
const string& b = BSPF_toString(i);
|
||||
romitems.push_back(b, b);
|
||||
}
|
||||
romitems.push_back("Inactive", "");
|
||||
|
||||
StringMap ramitems;
|
||||
for(uInt32 i = 0; i < myNumRamBanks; ++i)
|
||||
{
|
||||
const string& b = BSPF_toString(i);
|
||||
ramitems.push_back(b, b);
|
||||
}
|
||||
ramitems.push_back("Inactive", "");
|
||||
|
||||
ostringstream label;
|
||||
label << "Set bank ($" << HEX4 << start << " - $" << (start+0x7FF) << "): ";
|
||||
|
||||
new StaticTextWidget(_boss, _font, xpos, ypos, font.getStringWidth(label.str()),
|
||||
myFontHeight, label.str(), kTextAlignLeft);
|
||||
ypos += myLineHeight + 8;
|
||||
|
||||
xpos += 40;
|
||||
myROMBank =
|
||||
new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($3E) "),
|
||||
myLineHeight, romitems, "ROM ($3F): ",
|
||||
font.getStringWidth("ROM ($3F): "), kROMBankChanged);
|
||||
myROMBank->setTarget(this);
|
||||
addFocusWidget(myROMBank);
|
||||
|
||||
xpos += myROMBank->getWidth() + 20;
|
||||
myRAMBank =
|
||||
new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($3E) "),
|
||||
myLineHeight, ramitems, "RAM ($3E): ",
|
||||
font.getStringWidth("RAM ($3E): "), kRAMBankChanged);
|
||||
myRAMBank->setTarget(this);
|
||||
addFocusWidget(myRAMBank);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Cartridge3EWidget::loadConfig()
|
||||
{
|
||||
if(myCart.myCurrentBank < 256)
|
||||
{
|
||||
myROMBank->setSelected(myCart.myCurrentBank % myNumRomBanks);
|
||||
myRAMBank->setSelectedMax();
|
||||
}
|
||||
else
|
||||
{
|
||||
myROMBank->setSelectedMax();
|
||||
myRAMBank->setSelected(myCart.myCurrentBank - 256);
|
||||
}
|
||||
|
||||
CartDebugWidget::loadConfig();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Cartridge3EWidget::handleCommand(CommandSender* sender,
|
||||
int cmd, int data, int id)
|
||||
{
|
||||
int bank = -1;
|
||||
|
||||
if(cmd == kROMBankChanged)
|
||||
{
|
||||
if(myROMBank->getSelected() < (int)myNumRomBanks)
|
||||
{
|
||||
bank = myROMBank->getSelected();
|
||||
myRAMBank->setSelectedMax();
|
||||
}
|
||||
else
|
||||
{
|
||||
bank = 256; // default to first RAM bank
|
||||
myRAMBank->setSelected(0);
|
||||
}
|
||||
}
|
||||
else if(cmd == kRAMBankChanged)
|
||||
{
|
||||
if(myRAMBank->getSelected() < (int)myNumRamBanks)
|
||||
{
|
||||
myROMBank->setSelectedMax();
|
||||
bank = myRAMBank->getSelected() + 256;
|
||||
}
|
||||
else
|
||||
{
|
||||
bank = 0; // default to first ROM bank
|
||||
myROMBank->setSelected(0);
|
||||
}
|
||||
}
|
||||
|
||||
myCart.unlockBank();
|
||||
myCart.bank(bank);
|
||||
myCart.lockBank();
|
||||
invalidate();
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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 CARTRIDGE3E_WIDGET_HXX
|
||||
#define CARTRIDGE3E_WIDGET_HXX
|
||||
|
||||
class Cartridge3E;
|
||||
class PopUpWidget;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
|
||||
class Cartridge3EWidget : public CartDebugWidget
|
||||
{
|
||||
public:
|
||||
Cartridge3EWidget(GuiObject* boss, const GUI::Font& font,
|
||||
int x, int y, int w, int h,
|
||||
Cartridge3E& cart);
|
||||
virtual ~Cartridge3EWidget() { }
|
||||
|
||||
void loadConfig();
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||
|
||||
private:
|
||||
Cartridge3E& myCart;
|
||||
const uInt32 myNumRomBanks;
|
||||
const uInt32 myNumRamBanks;
|
||||
PopUpWidget *myROMBank, *myRAMBank;
|
||||
|
||||
enum {
|
||||
kROMBankChanged = 'rmCH',
|
||||
kRAMBankChanged = 'raCH'
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -21,6 +21,7 @@ MODULE_OBJS := \
|
|||
src/debugger/gui/ToggleWidget.o \
|
||||
src/debugger/gui/Cart0840Widget.o \
|
||||
src/debugger/gui/Cart2KWidget.o \
|
||||
src/debugger/gui/Cart3EWidget.o \
|
||||
src/debugger/gui/Cart3FWidget.o \
|
||||
src/debugger/gui/Cart4KWidget.o \
|
||||
src/debugger/gui/CartCVWidget.o \
|
||||
|
|
|
@ -141,12 +141,17 @@ class Cartridge : public Device
|
|||
virtual uInt16 bank() const = 0;
|
||||
|
||||
/**
|
||||
Query the number of banks supported by the cartridge. Note that
|
||||
we're counting the number of 4K 'blocks' that can be swapped into
|
||||
the 4K address space in the 2600. As such, it's possible to have
|
||||
a ROM that is larger than 4K *but* only consists of 1 bank.
|
||||
Such cases occur when pages of ROM can be swapped in and out,
|
||||
yet the 4K image is considered the same.
|
||||
Query the number of 'banks' supported by the cartridge. Note that
|
||||
this information is cart-specific, where each cart basically defines
|
||||
what a 'bank' is.
|
||||
|
||||
For the normal Atari-manufactured carts, a standard bank is a 4K
|
||||
block that is directly accessible in the 4K address space. In other
|
||||
cases where ROMs have 2K blocks in some preset area, the bankCount
|
||||
is the number of such blocks. Finally, in some esoteric schemes,
|
||||
the number of ways that the addressing can change (multiple ROM and
|
||||
RAM slices at multiple access points) is so complicated that the
|
||||
cart will report having only one 'virtual' bank.
|
||||
*/
|
||||
virtual uInt16 bankCount() const = 0;
|
||||
|
||||
|
|
|
@ -24,6 +24,9 @@ class System;
|
|||
|
||||
#include "bspf.hxx"
|
||||
#include "Cart.hxx"
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
#include "Cart3EWidget.hxx"
|
||||
#endif
|
||||
|
||||
/**
|
||||
This is the cartridge class for Tigervision's bankswitched
|
||||
|
@ -63,6 +66,8 @@ class System;
|
|||
|
||||
class Cartridge3E : public Cartridge
|
||||
{
|
||||
friend class Cartridge3EWidget;
|
||||
|
||||
public:
|
||||
/**
|
||||
Create a new cartridge using the specified image and size
|
||||
|
@ -149,6 +154,18 @@ class Cartridge3E : public Cartridge
|
|||
*/
|
||||
string name() const { return "Cartridge3E"; }
|
||||
|
||||
#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 Cartridge3EWidget(boss, font, x, y, w, h, *this);
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
/**
|
||||
Get the byte at the specified address
|
||||
|
|
Loading…
Reference in New Issue