mirror of https://github.com/stella-emu/stella.git
Bare beginnings of bankswitching support for the debugger.
Unfortunately every single Cart class will have to be touched to make this work, and there are 20 of them. Currently only CartF8 has the necessary methods. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@568 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
865416aacd
commit
8ad0d445c3
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Debugger.cxx,v 1.35 2005-06-25 17:26:32 stephena Exp $
|
// $Id: Debugger.cxx,v 1.36 2005-06-27 04:45:35 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
@ -687,3 +687,27 @@ void Debugger::addLabel(string label, int address) {
|
||||||
void Debugger::reloadROM() {
|
void Debugger::reloadROM() {
|
||||||
myOSystem->createConsole( myOSystem->romFile() );
|
myOSystem->createConsole( myOSystem->romFile() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool Debugger::setBank(int bank) {
|
||||||
|
if(myConsole->cartridge().bankCount() > 1) {
|
||||||
|
myConsole->cartridge().bank(bank);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
int Debugger::getBank() {
|
||||||
|
return myConsole->cartridge().bank();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
int Debugger::bankCount() {
|
||||||
|
return myConsole->cartridge().bankCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
const char *Debugger::getCartType() {
|
||||||
|
return myConsole->cartridge().name();
|
||||||
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Debugger.hxx,v 1.32 2005-06-27 03:32:50 urchlay Exp $
|
// $Id: Debugger.hxx,v 1.33 2005-06-27 04:45:52 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef DEBUGGER_HXX
|
#ifndef DEBUGGER_HXX
|
||||||
|
@ -51,7 +51,7 @@ enum {
|
||||||
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: Debugger.hxx,v 1.32 2005-06-27 03:32:50 urchlay Exp $
|
@version $Id: Debugger.hxx,v 1.33 2005-06-27 04:45:52 urchlay Exp $
|
||||||
*/
|
*/
|
||||||
class Debugger : public DialogContainer
|
class Debugger : public DialogContainer
|
||||||
{
|
{
|
||||||
|
@ -229,6 +229,12 @@ class Debugger : public DialogContainer
|
||||||
PackedBitArray *writetraps() { return writeTraps; }
|
PackedBitArray *writetraps() { return writeTraps; }
|
||||||
|
|
||||||
DebuggerParser *parser() { return myParser; }
|
DebuggerParser *parser() { return myParser; }
|
||||||
|
|
||||||
|
bool setBank(int bank);
|
||||||
|
int bankCount();
|
||||||
|
int getBank();
|
||||||
|
const char *getCartType();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Console* myConsole;
|
Console* myConsole;
|
||||||
System* mySystem;
|
System* mySystem;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: DebuggerParser.cxx,v 1.37 2005-06-27 03:32:51 urchlay Exp $
|
// $Id: DebuggerParser.cxx,v 1.38 2005-06-27 04:45:52 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
@ -33,6 +33,14 @@ Command DebuggerParser::commands[] = {
|
||||||
&DebuggerParser::executeA
|
&DebuggerParser::executeA
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"bank",
|
||||||
|
"Show # of banks (with no args), Switch to bank (with 1 arg)",
|
||||||
|
false,
|
||||||
|
{ kARG_BYTE, kARG_END_ARGS },
|
||||||
|
&DebuggerParser::executeBank
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"base",
|
"base",
|
||||||
"Set default base (hex, dec, or bin)",
|
"Set default base (hex, dec, or bin)",
|
||||||
|
@ -886,6 +894,27 @@ void DebuggerParser::executeA() {
|
||||||
debugger->setA(args[0]);
|
debugger->setA(args[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// "bank"
|
||||||
|
void DebuggerParser::executeBank() {
|
||||||
|
if(argCount == 0) {
|
||||||
|
int banks = debugger->bankCount();
|
||||||
|
commandResult += debugger->getCartType();
|
||||||
|
commandResult += ": ";
|
||||||
|
if(banks < 2)
|
||||||
|
commandResult += "bankswitching not supported by this cartridge";
|
||||||
|
else {
|
||||||
|
commandResult += debugger->valueToString(debugger->getBank());
|
||||||
|
commandResult += "/";
|
||||||
|
commandResult += debugger->valueToString(banks);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(debugger->setBank(args[0]))
|
||||||
|
commandResult += "switched bank OK";
|
||||||
|
else
|
||||||
|
commandResult += "invalid bank number for cartridge";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// "base"
|
// "base"
|
||||||
void DebuggerParser::executeBase() {
|
void DebuggerParser::executeBase() {
|
||||||
if(args[0] == 2 || argStrings[0] == "bin")
|
if(args[0] == 2 || argStrings[0] == "bin")
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: DebuggerParser.hxx,v 1.19 2005-06-27 03:32:51 urchlay Exp $
|
// $Id: DebuggerParser.hxx,v 1.20 2005-06-27 04:45:52 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef DEBUGGER_PARSER_HXX
|
#ifndef DEBUGGER_PARSER_HXX
|
||||||
|
@ -87,6 +87,7 @@ class DebuggerParser
|
||||||
string compPrefix;
|
string compPrefix;
|
||||||
|
|
||||||
void executeA();
|
void executeA();
|
||||||
|
void executeBank();
|
||||||
void executeBase();
|
void executeBase();
|
||||||
void executeBreak();
|
void executeBreak();
|
||||||
void executeC();
|
void executeC();
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Cart.cxx,v 1.9 2005-06-16 00:55:57 stephena Exp $
|
// $Id: Cart.cxx,v 1.10 2005-06-27 04:45:52 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -266,3 +266,28 @@ Cartridge& Cartridge::operator = (const Cartridge&)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// default implementations of bankswitching-related methods.
|
||||||
|
// These are suitable to be inherited by a cart type that
|
||||||
|
// doesn't support bankswitching at all.
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
int Cartridge::bank() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Cartridge::bank(uInt16 b) {
|
||||||
|
// do nothing.
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
int Cartridge::bankCount() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool Cartridge::patch(int address, int value) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Cart.hxx,v 1.3 2005-06-16 00:55:57 stephena Exp $
|
// $Id: Cart.hxx,v 1.4 2005-06-27 04:45:52 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef CARTRIDGE_HXX
|
#ifndef CARTRIDGE_HXX
|
||||||
|
@ -31,7 +31,7 @@ class System;
|
||||||
game and handles any bankswitching performed by the cartridge.
|
game and handles any bankswitching performed by the cartridge.
|
||||||
|
|
||||||
@author Bradford W. Mott
|
@author Bradford W. Mott
|
||||||
@version $Id: Cart.hxx,v 1.3 2005-06-16 00:55:57 stephena Exp $
|
@version $Id: Cart.hxx,v 1.4 2005-06-27 04:45:52 urchlay Exp $
|
||||||
*/
|
*/
|
||||||
class Cartridge : public Device
|
class Cartridge : public Device
|
||||||
{
|
{
|
||||||
|
@ -59,6 +59,11 @@ class Cartridge : public Device
|
||||||
*/
|
*/
|
||||||
virtual ~Cartridge();
|
virtual ~Cartridge();
|
||||||
|
|
||||||
|
virtual int bank(); // get current bank (-1 if no bankswitching supported)
|
||||||
|
virtual void bank(uInt16 b); // set bank
|
||||||
|
virtual int bankCount(); // count # of banks
|
||||||
|
virtual bool patch(int address, int value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
Try to auto-detect the bankswitching type of the cartridge
|
Try to auto-detect the bankswitching type of the cartridge
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: CartF8.cxx,v 1.4 2005-06-16 01:11:26 stephena Exp $
|
// $Id: CartF8.cxx,v 1.5 2005-06-27 04:45:52 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -146,6 +146,16 @@ void CartridgeF8::bank(uInt16 bank)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
int CartridgeF8::bank() {
|
||||||
|
return myCurrentBank;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
int CartridgeF8::bankCount() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool CartridgeF8::save(Serializer& out)
|
bool CartridgeF8::save(Serializer& out)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: CartF8.hxx,v 1.3 2005-06-16 01:11:26 stephena Exp $
|
// $Id: CartF8.hxx,v 1.4 2005-06-27 04:45:52 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef CARTRIDGEF8_HXX
|
#ifndef CARTRIDGEF8_HXX
|
||||||
|
@ -31,7 +31,7 @@ class Deserializer;
|
||||||
are two 4K banks.
|
are two 4K banks.
|
||||||
|
|
||||||
@author Bradford W. Mott
|
@author Bradford W. Mott
|
||||||
@version $Id: CartF8.hxx,v 1.3 2005-06-16 01:11:26 stephena Exp $
|
@version $Id: CartF8.hxx,v 1.4 2005-06-27 04:45:52 urchlay Exp $
|
||||||
*/
|
*/
|
||||||
class CartridgeF8 : public Cartridge
|
class CartridgeF8 : public Cartridge
|
||||||
{
|
{
|
||||||
|
@ -101,13 +101,14 @@ class CartridgeF8 : public Cartridge
|
||||||
*/
|
*/
|
||||||
virtual void poke(uInt16 address, uInt8 value);
|
virtual void poke(uInt16 address, uInt8 value);
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
/**
|
||||||
Install pages for the specified bank in the system
|
Install pages for the specified bank in the system
|
||||||
|
|
||||||
@param bank The bank that should be installed in the system
|
@param bank The bank that should be installed in the system
|
||||||
*/
|
*/
|
||||||
void bank(uInt16 bank);
|
void bank(uInt16 bank);
|
||||||
|
int bank();
|
||||||
|
int bankCount();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Indicates which bank is currently active
|
// Indicates which bank is currently active
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Console.cxx,v 1.60 2005-06-25 17:26:32 stephena Exp $
|
// $Id: Console.cxx,v 1.61 2005-06-27 04:45:52 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -153,6 +153,7 @@ Console::Console(const uInt8* image, uInt32 size, OSystem* osystem)
|
||||||
// Remember what my media source is
|
// Remember what my media source is
|
||||||
myMediaSource = tia;
|
myMediaSource = tia;
|
||||||
myTIAdebugger = new TIADebug(tia);
|
myTIAdebugger = new TIADebug(tia);
|
||||||
|
myCart = cartridge;
|
||||||
|
|
||||||
// Reset, the system to its power-on state
|
// Reset, the system to its power-on state
|
||||||
mySystem->reset();
|
mySystem->reset();
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Console.hxx,v 1.33 2005-06-21 04:30:49 urchlay Exp $
|
// $Id: Console.hxx,v 1.34 2005-06-27 04:45:52 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef CONSOLE_HXX
|
#ifndef CONSOLE_HXX
|
||||||
|
@ -31,12 +31,13 @@ class System;
|
||||||
#include "Props.hxx"
|
#include "Props.hxx"
|
||||||
#include "TIA.hxx"
|
#include "TIA.hxx"
|
||||||
#include "TIADebug.hxx"
|
#include "TIADebug.hxx"
|
||||||
|
#include "Cart.hxx"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class represents the entire game console.
|
This class represents the entire game console.
|
||||||
|
|
||||||
@author Bradford W. Mott
|
@author Bradford W. Mott
|
||||||
@version $Id: Console.hxx,v 1.33 2005-06-21 04:30:49 urchlay Exp $
|
@version $Id: Console.hxx,v 1.34 2005-06-27 04:45:52 urchlay Exp $
|
||||||
*/
|
*/
|
||||||
class Console
|
class Console
|
||||||
{
|
{
|
||||||
|
@ -102,6 +103,8 @@ class Console
|
||||||
*/
|
*/
|
||||||
System& system() const { return *mySystem; }
|
System& system() const { return *mySystem; }
|
||||||
|
|
||||||
|
Cartridge& cartridge() const { return *myCart; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Overloaded assignment operator
|
Overloaded assignment operator
|
||||||
|
@ -228,6 +231,9 @@ class Console
|
||||||
|
|
||||||
// Pointer to TIADebug
|
// Pointer to TIADebug
|
||||||
TIADebug *myTIAdebugger;
|
TIADebug *myTIAdebugger;
|
||||||
|
|
||||||
|
// Pointer to the Cartridge (the debugger needs it)
|
||||||
|
Cartridge *myCart;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue