mirror of https://github.com/stella-emu/stella.git
Added cart debugger tab for 'MDM'.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2981 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
04ee72521d
commit
ddafc3a650
|
@ -0,0 +1,90 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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-2014 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 "CartMDM.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "CartMDMWidget.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeMDMWidget::CartridgeMDMWidget(
|
||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
int x, int y, int w, int h, CartridgeMDM& cart)
|
||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||
myCart(cart)
|
||||
{
|
||||
uInt32 size = myCart.mySize;
|
||||
|
||||
ostringstream info;
|
||||
info << "Menu Driven Megacart, containing up to 128 4K banks\n"
|
||||
<< "Startup bank = " << cart.myStartBank << "\n"
|
||||
<< "\nBanks are selected by reading from $800 - $FFF, where the lower "
|
||||
"byte determines the 4K bank to use.";
|
||||
|
||||
int xpos = 10,
|
||||
ypos = addBaseInformation(size, "Edwin Blink", info.str(), 15) + myLineHeight;
|
||||
|
||||
VariantList items;
|
||||
for(uInt32 i = 0x800; i < 0x800 + myCart.bankCount(); ++i)
|
||||
{
|
||||
info.str("");
|
||||
info << dec << (i & 0xFF) << " ($" << Common::Base::HEX4 << i << ")";
|
||||
items.push_back(info.str());
|
||||
}
|
||||
|
||||
myBank =
|
||||
new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("xxx ($0FFF) "),
|
||||
myLineHeight, items, "Set bank: ",
|
||||
_font.getStringWidth("Set bank: "), kBankChanged);
|
||||
myBank->setTarget(this);
|
||||
addFocusWidget(myBank);
|
||||
|
||||
xpos += myBank->getWidth() + 30;
|
||||
myBankDisabled = new CheckboxWidget(boss, _font, xpos, ypos,
|
||||
"Bankswitching is locked/disabled",
|
||||
kBankDisabled);
|
||||
myBankDisabled->setTarget(this);
|
||||
addFocusWidget(myBankDisabled);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeMDMWidget::loadConfig()
|
||||
{
|
||||
myBank->setSelectedIndex(myCart.myCurrentBank);
|
||||
myBankDisabled->setState(myCart.myBankingDisabled);
|
||||
|
||||
CartDebugWidget::loadConfig();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeMDMWidget::handleCommand(CommandSender* sender,
|
||||
int cmd, int data, int id)
|
||||
{
|
||||
if(cmd == kBankChanged)
|
||||
{
|
||||
myCart.unlockBank();
|
||||
myCart.bank(myBank->getSelected());
|
||||
myCart.lockBank();
|
||||
invalidate();
|
||||
}
|
||||
else if(cmd == kBankDisabled)
|
||||
{
|
||||
myCart.myBankingDisabled = myBankDisabled->getState();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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-2014 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 CARTRIDGEMDM_WIDGET_HXX
|
||||
#define CARTRIDGEMDM_WIDGET_HXX
|
||||
|
||||
class CartridgeMDM;
|
||||
class CheckboxWidget;
|
||||
class PopUpWidget;
|
||||
|
||||
#include "CartDebugWidget.hxx"
|
||||
|
||||
class CartridgeMDMWidget : public CartDebugWidget
|
||||
{
|
||||
public:
|
||||
CartridgeMDMWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||
const GUI::Font& nfont,
|
||||
int x, int y, int w, int h,
|
||||
CartridgeMDM& cart);
|
||||
virtual ~CartridgeMDMWidget() { }
|
||||
|
||||
void loadConfig();
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||
|
||||
private:
|
||||
CartridgeMDM& myCart;
|
||||
PopUpWidget* myBank;
|
||||
CheckboxWidget* myBankDisabled;
|
||||
|
||||
enum { kBankChanged = 'bkCH', kBankDisabled = 'bkDI' };
|
||||
};
|
||||
|
||||
#endif
|
|
@ -54,6 +54,7 @@ MODULE_OBJS := \
|
|||
src/debugger/gui/CartFA2Widget.o \
|
||||
src/debugger/gui/CartFEWidget.o \
|
||||
src/debugger/gui/CartMCWidget.o \
|
||||
src/debugger/gui/CartMDMWidget.o \
|
||||
src/debugger/gui/CartSBWidget.o \
|
||||
src/debugger/gui/CartUAWidget.o \
|
||||
src/debugger/gui/CartX07Widget.o \
|
||||
|
|
|
@ -114,13 +114,7 @@ bool CartridgeMDM::poke(uInt16 address, uInt8 value)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeMDM::bank(uInt16 bank)
|
||||
{
|
||||
if(bankLocked()) return false;
|
||||
|
||||
// Accesses above bank 127 disable further bankswitching; we're only
|
||||
// concerned with the lower byte
|
||||
myBankingDisabled = myBankingDisabled || bank > 127;
|
||||
if(myBankingDisabled)
|
||||
return false;
|
||||
if(bankLocked() || myBankingDisabled) return false;
|
||||
|
||||
// Remember what bank we're in
|
||||
// Wrap around to a valid bank number if necessary
|
||||
|
@ -138,6 +132,10 @@ bool CartridgeMDM::bank(uInt16 bank)
|
|||
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x0FFF)];
|
||||
mySystem->setPageAccess(address >> shift, access);
|
||||
}
|
||||
|
||||
// Accesses above bank 127 disable further bankswitching; we're only
|
||||
// concerned with the lower byte
|
||||
myBankingDisabled = myBankingDisabled || bank > 127;
|
||||
return myBankChanged = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "Cart.hxx"
|
||||
#include "System.hxx"
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
// #include "CartMDMWidget.hxx"
|
||||
#include "CartMDMWidget.hxx"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -141,7 +141,7 @@ class CartridgeMDM : public Cartridge
|
|||
CartDebugWidget* debugWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||
const GUI::Font& nfont, int x, int y, int w, int h)
|
||||
{
|
||||
return 0;//new CartridgeMDMWidget(boss, lfont, nfont, x, y, w, h, *this);
|
||||
return new CartridgeMDMWidget(boss, lfont, nfont, x, y, w, h, *this);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue