The disassembly is now properly updated when performing a 'reset'

or rewind command.

Updated 'FE' bankswitch scheme to the new disassembly infrastructure;
it now properly indicates that it has two banks, and keeps track of
when the bank changes.

Some cleanups to CartXXX classes; most methods didn't need to be
virtual.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1971 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-03-23 18:00:47 +00:00
parent dc22bc6b04
commit 9c73d139de
19 changed files with 224 additions and 173 deletions

View File

@ -1097,6 +1097,7 @@ void DebuggerParser::executeRam()
void DebuggerParser::executeReset()
{
debugger->reset();
debugger->myRom->invalidate();
commandResult = "reset CPU";
}
@ -1105,7 +1106,10 @@ void DebuggerParser::executeReset()
void DebuggerParser::executeRewind()
{
if(debugger->rewindState())
{
debugger->myRom->invalidate();
commandResult = "rewind by one level";
}
else
commandResult = "no states left to rewind";
}

View File

@ -123,13 +123,15 @@ void RomWidget::loadConfig()
myListIsDirty |= cart.disassemble(myAutocode->getSelectedTag(), myListIsDirty);
if(myListIsDirty)
{
cerr << "list is dirty, re-disassembled\n";
myRomList->setList(cart.disassemblyList(), dbg.breakpoints());
myListIsDirty = false;
}
// Update romlist to point to current PC
int pcline = cart.addressToLine(dbg.cpuDebug().pc());
if(pcline > 0)
cerr << "PC = " << hex << dbg.cpuDebug().pc() << ", line = " << dec << pcline << endl;
if(pcline >= 0)
myRomList->setHighlighted(pcline);
// Set current bank and number of banks

View File

@ -40,7 +40,7 @@ class RomWidget : public Widget, public CommandSender
RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y);
virtual ~RomWidget();
void invalidate() { myListIsDirty = true; }
void invalidate() { myListIsDirty = true; loadConfig(); }
void handleCommand(CommandSender* sender, int cmd, int data, int id);
void loadConfig();

View File

@ -106,11 +106,14 @@ class Cartridge : public Device
/**
Answer whether the bank has changed since the last time this
method was called.
method was called. Each cart class is able to override this
method to deal with its specific functionality. In those cases,
the derived class is still responsible for calling this base
function.
@return Whether the bank was changed
*/
bool bankChanged();
virtual bool bankChanged();
#ifdef DEBUGGER_SUPPORT
const RamAreaList& ramAreas() { return myRamAreaList; }

View File

@ -48,7 +48,7 @@ class Cartridge0840 : public Cartridge
/**
Reset device to its power-on state
*/
virtual void reset();
void reset();
/**
Install cartridge in the specified system. Invoked by the system
@ -56,26 +56,26 @@ class Cartridge0840 : public Cartridge
@param system The system the device should install itself in
*/
virtual void install(System& system);
void install(System& system);
/**
Install pages for the specified bank in the system.
@param bank The bank that should be installed in the system
*/
virtual void bank(uInt16 bank);
void bank(uInt16 bank);
/**
Get the current bank.
@return The current bank, or -1 if bankswitching not supported
*/
virtual int bank();
int bank();
/**
Query the number of banks supported by the cartridge.
*/
virtual int bankCount();
int bankCount();
/**
Patch the cartridge ROM.
@ -84,7 +84,7 @@ class Cartridge0840 : public Cartridge
@param value The value to place into the address
@return Success or failure of the patch operation
*/
virtual bool patch(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Access the internal ROM image for this cartridge.
@ -92,7 +92,7 @@ class Cartridge0840 : public Cartridge
@param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data
*/
virtual uInt8* getImage(int& size);
uInt8* getImage(int& size);
/**
Save the current state of this cart to the given Serializer.
@ -100,7 +100,7 @@ class Cartridge0840 : public Cartridge
@param out The Serializer object to use
@return False on any errors, else true
*/
virtual bool save(Serializer& out) const;
bool save(Serializer& out) const;
/**
Load the current state of this cart from the given Serializer.
@ -108,14 +108,14 @@ class Cartridge0840 : public Cartridge
@param in The Serializer object to use
@return False on any errors, else true
*/
virtual bool load(Serializer& in);
bool load(Serializer& in);
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
virtual string name() const { return "Cartridge0840"; }
string name() const { return "Cartridge0840"; }
public:
/**
@ -123,7 +123,7 @@ class Cartridge0840 : public Cartridge
@return The byte at the specified address
*/
virtual uInt8 peek(uInt16 address);
uInt8 peek(uInt16 address);
/**
Change the byte at the specified address to the given value
@ -131,7 +131,7 @@ class Cartridge0840 : public Cartridge
@param address The address where the value should be stored
@param value The value to be stored at the address
*/
virtual void poke(uInt16 address, uInt8 value);
void poke(uInt16 address, uInt8 value);
private:
// The 8K ROM image of the cartridge

View File

@ -52,7 +52,7 @@ class Cartridge2K : public Cartridge
/**
Reset cartridge to its power-on state
*/
virtual void reset();
void reset();
/**
Install cartridge in the specified system. Invoked by the system
@ -60,26 +60,26 @@ class Cartridge2K : public Cartridge
@param system The system the device should install itself in
*/
virtual void install(System& system);
void install(System& system);
/**
Install pages for the specified bank in the system.
@param bank The bank that should be installed in the system
*/
virtual void bank(uInt16 bank);
void bank(uInt16 bank);
/**
Get the current bank.
@return The current bank, or -1 if bankswitching not supported
*/
virtual int bank();
int bank();
/**
Query the number of banks supported by the cartridge.
*/
virtual int bankCount();
int bankCount();
/**
Patch the cartridge ROM.
@ -88,7 +88,7 @@ class Cartridge2K : public Cartridge
@param value The value to place into the address
@return Success or failure of the patch operation
*/
virtual bool patch(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Access the internal ROM image for this cartridge.
@ -96,7 +96,7 @@ class Cartridge2K : public Cartridge
@param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data
*/
virtual uInt8* getImage(int& size);
uInt8* getImage(int& size);
/**
Save the current state of this cart to the given Serializer.
@ -104,7 +104,7 @@ class Cartridge2K : public Cartridge
@param out The Serializer object to use
@return False on any errors, else true
*/
virtual bool save(Serializer& out) const;
bool save(Serializer& out) const;
/**
Load the current state of this cart from the given Serializer.
@ -112,14 +112,14 @@ class Cartridge2K : public Cartridge
@param in The Serializer object to use
@return False on any errors, else true
*/
virtual bool load(Serializer& in);
bool load(Serializer& in);
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
virtual string name() const { return "Cartridge2K"; }
string name() const { return "Cartridge2K"; }
public:
/**
@ -127,7 +127,7 @@ class Cartridge2K : public Cartridge
@return The byte at the specified address
*/
virtual uInt8 peek(uInt16 address);
uInt8 peek(uInt16 address);
/**
Change the byte at the specified address to the given value
@ -135,7 +135,7 @@ class Cartridge2K : public Cartridge
@param address The address where the value should be stored
@param value The value to be stored at the address
*/
virtual void poke(uInt16 address, uInt8 value);
void poke(uInt16 address, uInt8 value);
private:
// Pointer to a dynamically allocated ROM image of the cartridge

View File

@ -57,7 +57,7 @@ class Cartridge3F : public Cartridge
/**
Reset device to its power-on state
*/
virtual void reset();
void reset();
/**
Install cartridge in the specified system. Invoked by the system
@ -65,26 +65,26 @@ class Cartridge3F : public Cartridge
@param system The system the device should install itself in
*/
virtual void install(System& system);
void install(System& system);
/**
Install pages for the specified bank in the system.
@param bank The bank that should be installed in the system
*/
virtual void bank(uInt16 bank);
void bank(uInt16 bank);
/**
Get the current bank.
@return The current bank, or -1 if bankswitching not supported
*/
virtual int bank();
int bank();
/**
Query the number of banks supported by the cartridge.
*/
virtual int bankCount();
int bankCount();
/**
Patch the cartridge ROM.
@ -93,7 +93,7 @@ class Cartridge3F : public Cartridge
@param value The value to place into the address
@return Success or failure of the patch operation
*/
virtual bool patch(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Access the internal ROM image for this cartridge.
@ -101,7 +101,7 @@ class Cartridge3F : public Cartridge
@param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data
*/
virtual uInt8* getImage(int& size);
uInt8* getImage(int& size);
/**
Save the current state of this cart to the given Serializer.
@ -109,7 +109,7 @@ class Cartridge3F : public Cartridge
@param out The Serializer object to use
@return False on any errors, else true
*/
virtual bool save(Serializer& out) const;
bool save(Serializer& out) const;
/**
Load the current state of this cart from the given Serializer.
@ -117,14 +117,14 @@ class Cartridge3F : public Cartridge
@param in The Serializer object to use
@return False on any errors, else true
*/
virtual bool load(Serializer& in);
bool load(Serializer& in);
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
virtual string name() const { return "Cartridge3F"; }
string name() const { return "Cartridge3F"; }
public:
/**
@ -132,7 +132,7 @@ class Cartridge3F : public Cartridge
@return The byte at the specified address
*/
virtual uInt8 peek(uInt16 address);
uInt8 peek(uInt16 address);
/**
Change the byte at the specified address to the given value
@ -140,7 +140,7 @@ class Cartridge3F : public Cartridge
@param address The address where the value should be stored
@param value The value to be stored at the address
*/
virtual void poke(uInt16 address, uInt8 value);
void poke(uInt16 address, uInt8 value);
private:
// Indicates which bank is currently active for the first segment

View File

@ -50,7 +50,7 @@ class Cartridge4K : public Cartridge
/**
Reset cartridge to its power-on state
*/
virtual void reset();
void reset();
/**
Install cartridge in the specified system. Invoked by the system
@ -58,26 +58,26 @@ class Cartridge4K : public Cartridge
@param system The system the device should install itself in
*/
virtual void install(System& system);
void install(System& system);
/**
Install pages for the specified bank in the system.
@param bank The bank that should be installed in the system
*/
virtual void bank(uInt16 bank);
void bank(uInt16 bank);
/**
Get the current bank.
@return The current bank, or -1 if bankswitching not supported
*/
virtual int bank();
int bank();
/**
Query the number of banks supported by the cartridge.
*/
virtual int bankCount();
int bankCount();
/**
Patch the cartridge ROM.
@ -86,7 +86,7 @@ class Cartridge4K : public Cartridge
@param value The value to place into the address
@return Success or failure of the patch operation
*/
virtual bool patch(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Access the internal ROM image for this cartridge.
@ -94,7 +94,7 @@ class Cartridge4K : public Cartridge
@param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data
*/
virtual uInt8* getImage(int& size);
uInt8* getImage(int& size);
/**
Save the current state of this cart to the given Serializer.
@ -102,7 +102,7 @@ class Cartridge4K : public Cartridge
@param out The Serializer object to use
@return False on any errors, else true
*/
virtual bool save(Serializer& out) const;
bool save(Serializer& out) const;
/**
Load the current state of this cart from the given Serializer.
@ -110,14 +110,14 @@ class Cartridge4K : public Cartridge
@param in The Serializer object to use
@return False on any errors, else true
*/
virtual bool load(Serializer& in);
bool load(Serializer& in);
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
virtual string name() const { return "Cartridge4K"; }
string name() const { return "Cartridge4K"; }
public:
/**
@ -125,7 +125,7 @@ class Cartridge4K : public Cartridge
@return The byte at the specified address
*/
virtual uInt8 peek(uInt16 address);
uInt8 peek(uInt16 address);
/**
Change the byte at the specified address to the given value
@ -133,7 +133,7 @@ class Cartridge4K : public Cartridge
@param address The address where the value should be stored
@param value The value to be stored at the address
*/
virtual void poke(uInt16 address, uInt8 value);
void poke(uInt16 address, uInt8 value);
private:
// The 4K ROM image for the cartridge

View File

@ -54,7 +54,7 @@ class CartridgeEF : public Cartridge
/**
Reset device to its power-on state
*/
virtual void reset();
void reset();
/**
Install cartridge in the specified system. Invoked by the system
@ -62,26 +62,26 @@ class CartridgeEF : public Cartridge
@param system The system the device should install itself in
*/
virtual void install(System& system);
void install(System& system);
/**
Install pages for the specified bank in the system.
@param bank The bank that should be installed in the system
*/
virtual void bank(uInt16 bank);
void bank(uInt16 bank);
/**
Get the current bank.
@return The current bank, or -1 if bankswitching not supported
*/
virtual int bank();
int bank();
/**
Query the number of banks supported by the cartridge.
*/
virtual int bankCount();
int bankCount();
/**
Patch the cartridge ROM.
@ -90,7 +90,7 @@ class CartridgeEF : public Cartridge
@param value The value to place into the address
@return Success or failure of the patch operation
*/
virtual bool patch(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Access the internal ROM image for this cartridge.
@ -98,7 +98,7 @@ class CartridgeEF : public Cartridge
@param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data
*/
virtual uInt8* getImage(int& size);
uInt8* getImage(int& size);
/**
Save the current state of this cart to the given Serializer.
@ -106,7 +106,7 @@ class CartridgeEF : public Cartridge
@param out The Serializer object to use
@return False on any errors, else true
*/
virtual bool save(Serializer& out) const;
bool save(Serializer& out) const;
/**
Load the current state of this cart from the given Serializer.
@ -114,14 +114,14 @@ class CartridgeEF : public Cartridge
@param in The Serializer object to use
@return False on any errors, else true
*/
virtual bool load(Serializer& in);
bool load(Serializer& in);
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
virtual string name() const { return "CartridgeEF"; }
string name() const { return "CartridgeEF"; }
public:
/**
@ -129,7 +129,7 @@ class CartridgeEF : public Cartridge
@return The byte at the specified address
*/
virtual uInt8 peek(uInt16 address);
uInt8 peek(uInt16 address);
/**
Change the byte at the specified address to the given value
@ -137,7 +137,7 @@ class CartridgeEF : public Cartridge
@param address The address where the value should be stored
@param value The value to be stored at the address
*/
virtual void poke(uInt16 address, uInt8 value);
void poke(uInt16 address, uInt8 value);
private:
// Indicates which bank is currently active

View File

@ -51,7 +51,7 @@ class CartridgeF0 : public Cartridge
/**
Reset device to its power-on state
*/
virtual void reset();
void reset();
/**
Install cartridge in the specified system. Invoked by the system
@ -59,26 +59,26 @@ class CartridgeF0 : public Cartridge
@param system The system the device should install itself in
*/
virtual void install(System& system);
void install(System& system);
/**
Install pages for the specified bank in the system.
@param bank The bank that should be installed in the system
*/
virtual void bank(uInt16 bank);
void bank(uInt16 bank);
/**
Get the current bank.
@return The current bank, or -1 if bankswitching not supported
*/
virtual int bank();
int bank();
/**
Query the number of banks supported by the cartridge.
*/
virtual int bankCount();
int bankCount();
/**
Patch the cartridge ROM.
@ -87,7 +87,7 @@ class CartridgeF0 : public Cartridge
@param value The value to place into the address
@return Success or failure of the patch operation
*/
virtual bool patch(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Access the internal ROM image for this cartridge.
@ -95,7 +95,7 @@ class CartridgeF0 : public Cartridge
@param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data
*/
virtual uInt8* getImage(int& size);
uInt8* getImage(int& size);
/**
Save the current state of this cart to the given Serializer.
@ -103,7 +103,7 @@ class CartridgeF0 : public Cartridge
@param out The Serializer object to use
@return False on any errors, else true
*/
virtual bool save(Serializer& out) const;
bool save(Serializer& out) const;
/**
Load the current state of this cart from the given Serializer.
@ -111,14 +111,14 @@ class CartridgeF0 : public Cartridge
@param in The Serializer object to use
@return False on any errors, else true
*/
virtual bool load(Serializer& in);
bool load(Serializer& in);
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
virtual string name() const { return "CartridgeF0"; }
string name() const { return "CartridgeF0"; }
public:
/**
@ -126,7 +126,7 @@ class CartridgeF0 : public Cartridge
@return The byte at the specified address
*/
virtual uInt8 peek(uInt16 address);
uInt8 peek(uInt16 address);
/**
Change the byte at the specified address to the given value
@ -134,7 +134,7 @@ class CartridgeF0 : public Cartridge
@param address The address where the value should be stored
@param value The value to be stored at the address
*/
virtual void poke(uInt16 address, uInt8 value);
void poke(uInt16 address, uInt8 value);
private:
/**

View File

@ -50,7 +50,7 @@ class CartridgeF4 : public Cartridge
/**
Reset device to its power-on state
*/
virtual void reset();
void reset();
/**
Install cartridge in the specified system. Invoked by the system
@ -58,26 +58,26 @@ class CartridgeF4 : public Cartridge
@param system The system the device should install itself in
*/
virtual void install(System& system);
void install(System& system);
/**
Install pages for the specified bank in the system.
@param bank The bank that should be installed in the system
*/
virtual void bank(uInt16 bank);
void bank(uInt16 bank);
/**
Get the current bank.
@return The current bank, or -1 if bankswitching not supported
*/
virtual int bank();
int bank();
/**
Query the number of banks supported by the cartridge.
*/
virtual int bankCount();
int bankCount();
/**
Patch the cartridge ROM.
@ -86,7 +86,7 @@ class CartridgeF4 : public Cartridge
@param value The value to place into the address
@return Success or failure of the patch operation
*/
virtual bool patch(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Access the internal ROM image for this cartridge.
@ -94,7 +94,7 @@ class CartridgeF4 : public Cartridge
@param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data
*/
virtual uInt8* getImage(int& size);
uInt8* getImage(int& size);
/**
Save the current state of this cart to the given Serializer.
@ -102,7 +102,7 @@ class CartridgeF4 : public Cartridge
@param out The Serializer object to use
@return False on any errors, else true
*/
virtual bool save(Serializer& out) const;
bool save(Serializer& out) const;
/**
Load the current state of this cart from the given Serializer.
@ -110,14 +110,14 @@ class CartridgeF4 : public Cartridge
@param in The Serializer object to use
@return False on any errors, else true
*/
virtual bool load(Serializer& in);
bool load(Serializer& in);
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
virtual string name() const { return "CartridgeF4"; }
string name() const { return "CartridgeF4"; }
public:
/**
@ -125,7 +125,7 @@ class CartridgeF4 : public Cartridge
@return The byte at the specified address
*/
virtual uInt8 peek(uInt16 address);
uInt8 peek(uInt16 address);
/**
Change the byte at the specified address to the given value
@ -133,7 +133,7 @@ class CartridgeF4 : public Cartridge
@param address The address where the value should be stored
@param value The value to be stored at the address
*/
virtual void poke(uInt16 address, uInt8 value);
void poke(uInt16 address, uInt8 value);
private:
// Indicates which bank is currently active

View File

@ -50,7 +50,7 @@ class CartridgeF6 : public Cartridge
/**
Reset device to its power-on state
*/
virtual void reset();
void reset();
/**
Install cartridge in the specified system. Invoked by the system
@ -58,26 +58,26 @@ class CartridgeF6 : public Cartridge
@param system The system the device should install itself in
*/
virtual void install(System& system);
void install(System& system);
/**
Install pages for the specified bank in the system.
@param bank The bank that should be installed in the system
*/
virtual void bank(uInt16 bank);
void bank(uInt16 bank);
/**
Get the current bank.
@return The current bank, or -1 if bankswitching not supported
*/
virtual int bank();
int bank();
/**
Query the number of banks supported by the cartridge.
*/
virtual int bankCount();
int bankCount();
/**
Patch the cartridge ROM.
@ -86,7 +86,7 @@ class CartridgeF6 : public Cartridge
@param value The value to place into the address
@return Success or failure of the patch operation
*/
virtual bool patch(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Access the internal ROM image for this cartridge.
@ -94,7 +94,7 @@ class CartridgeF6 : public Cartridge
@param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data
*/
virtual uInt8* getImage(int& size);
uInt8* getImage(int& size);
/**
Save the current state of this cart to the given Serializer.
@ -102,7 +102,7 @@ class CartridgeF6 : public Cartridge
@param out The Serializer object to use
@return False on any errors, else true
*/
virtual bool save(Serializer& out) const;
bool save(Serializer& out) const;
/**
Load the current state of this cart from the given Serializer.
@ -110,14 +110,14 @@ class CartridgeF6 : public Cartridge
@param in The Serializer object to use
@return False on any errors, else true
*/
virtual bool load(Serializer& in);
bool load(Serializer& in);
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
virtual string name() const { return "CartridgeF6"; }
string name() const { return "CartridgeF6"; }
public:
/**
@ -125,7 +125,7 @@ class CartridgeF6 : public Cartridge
@return The byte at the specified address
*/
virtual uInt8 peek(uInt16 address);
uInt8 peek(uInt16 address);
/**
Change the byte at the specified address to the given value
@ -133,7 +133,7 @@ class CartridgeF6 : public Cartridge
@param address The address where the value should be stored
@param value The value to be stored at the address
*/
virtual void poke(uInt16 address, uInt8 value);
void poke(uInt16 address, uInt8 value);
private:
// Indicates which bank is currently active

View File

@ -51,7 +51,7 @@ class CartridgeF8 : public Cartridge
/**
Reset device to its power-on state
*/
virtual void reset();
void reset();
/**
Install cartridge in the specified system. Invoked by the system
@ -59,26 +59,26 @@ class CartridgeF8 : public Cartridge
@param system The system the device should install itself in
*/
virtual void install(System& system);
void install(System& system);
/**
Install pages for the specified bank in the system.
@param bank The bank that should be installed in the system
*/
virtual void bank(uInt16 bank);
void bank(uInt16 bank);
/**
Get the current bank.
@return The current bank, or -1 if bankswitching not supported
*/
virtual int bank();
int bank();
/**
Query the number of banks supported by the cartridge.
*/
virtual int bankCount();
int bankCount();
/**
Patch the cartridge ROM.
@ -87,7 +87,7 @@ class CartridgeF8 : public Cartridge
@param value The value to place into the address
@return Success or failure of the patch operation
*/
virtual bool patch(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Access the internal ROM image for this cartridge.
@ -95,7 +95,7 @@ class CartridgeF8 : public Cartridge
@param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data
*/
virtual uInt8* getImage(int& size);
uInt8* getImage(int& size);
/**
Save the current state of this cart to the given Serializer.
@ -103,7 +103,7 @@ class CartridgeF8 : public Cartridge
@param out The Serializer object to use
@return False on any errors, else true
*/
virtual bool save(Serializer& out) const;
bool save(Serializer& out) const;
/**
Load the current state of this cart from the given Serializer.
@ -111,14 +111,14 @@ class CartridgeF8 : public Cartridge
@param in The Serializer object to use
@return False on any errors, else true
*/
virtual bool load(Serializer& in);
bool load(Serializer& in);
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
virtual string name() const { return "CartridgeF8"; }
string name() const { return "CartridgeF8"; }
public:
/**
@ -126,7 +126,7 @@ class CartridgeF8 : public Cartridge
@return The byte at the specified address
*/
virtual uInt8 peek(uInt16 address);
uInt8 peek(uInt16 address);
/**
Change the byte at the specified address to the given value
@ -134,7 +134,7 @@ class CartridgeF8 : public Cartridge
@param address The address where the value should be stored
@param value The value to be stored at the address
*/
virtual void poke(uInt16 address, uInt8 value);
void poke(uInt16 address, uInt8 value);
private:
// Indicates which bank is currently active

View File

@ -22,11 +22,11 @@
#include "System.hxx"
#include "CartFE.hxx"
// TODO - Port to new CartDebug/disassembler scheme
// Add bankchanged code
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeFE::CartridgeFE(const uInt8* image)
: myLastAddress1(0),
myLastAddress2(0),
myLastAddressChanged(false)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 8192);
@ -67,6 +67,12 @@ void CartridgeFE::install(System& system)
uInt8 CartridgeFE::peek(uInt16 address)
{
// The bank is determined by A13 of the processor
// We keep track of the two most recent accesses to determine which bank
// we're in, and when the values actually changed
myLastAddress2 = myLastAddress1;
myLastAddress1 = address;
myLastAddressChanged = true;
return myImage[(address & 0x0FFF) + (((address & 0x2000) == 0) ? 4096 : 0)];
}
@ -79,37 +85,54 @@ void CartridgeFE::poke(uInt16, uInt8)
void CartridgeFE::bank(uInt16 b)
{
// Doesn't support bankswitching in the normal sense
// TODO - add support for debugger
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeFE::bank()
{
// Doesn't support bankswitching in the normal sense
// TODO - add support for debugger
return 0;
// The current bank depends on the last address accessed
return ((myLastAddress1 & 0x2000) == 0) ? 1 : 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeFE::bankCount()
{
// Doesn't support bankswitching in the normal sense
// TODO - add support for debugger
return 1;
return 2;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeFE::bankChanged()
{
if(myLastAddressChanged)
{
// A bankswitch occurs when the addresses transition from state to another
bool a1 = ((myLastAddress1 & 0x2000) == 0),
a2 = ((myLastAddress2 & 0x2000) == 0);
myBankChanged = (a1 && !a2) || (a2 && !a1);
myLastAddressChanged = false;
}
else
{
myBankChanged = false;
}
// In any event, let the base class know about it
return Cartridge::bankChanged();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeFE::patch(uInt16 address, uInt8 value)
{
myImage[(address & 0x0FFF) + (((address & 0x2000) == 0) ? 4096 : 0)] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* CartridgeFE::getImage(int& size)
{
size = 8192;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -120,6 +143,8 @@ bool CartridgeFE::save(Serializer& out) const
try
{
out.putString(cart);
out.putInt(myLastAddress1);
out.putInt(myLastAddress2);
}
catch(const char* msg)
{
@ -139,6 +164,9 @@ bool CartridgeFE::load(Serializer& in)
{
if(in.getString() != cart)
return false;
myLastAddress1 = (uInt16)in.getInt();
myLastAddress2 = (uInt16)in.getInt();
}
catch(const char* msg)
{

View File

@ -62,7 +62,7 @@ class CartridgeFE : public Cartridge
/**
Reset device to its power-on state
*/
virtual void reset();
void reset();
/**
Install cartridge in the specified system. Invoked by the system
@ -70,26 +70,34 @@ class CartridgeFE : public Cartridge
@param system The system the device should install itself in
*/
virtual void install(System& system);
void install(System& system);
/**
Install pages for the specified bank in the system.
@param bank The bank that should be installed in the system
*/
virtual void bank(uInt16 bank);
void bank(uInt16 bank);
/**
Get the current bank.
@return The current bank, or -1 if bankswitching not supported
*/
virtual int bank();
int bank();
/**
Query the number of banks supported by the cartridge.
*/
virtual int bankCount();
int bankCount();
/**
Answer whether the bank has changed since the last time this
method was called.
@return Whether the bank was changed
*/
bool bankChanged();
/**
Patch the cartridge ROM.
@ -98,7 +106,7 @@ class CartridgeFE : public Cartridge
@param value The value to place into the address
@return Success or failure of the patch operation
*/
virtual bool patch(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Access the internal ROM image for this cartridge.
@ -106,7 +114,7 @@ class CartridgeFE : public Cartridge
@param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data
*/
virtual uInt8* getImage(int& size);
uInt8* getImage(int& size);
/**
Save the current state of this cart to the given Serializer.
@ -114,7 +122,7 @@ class CartridgeFE : public Cartridge
@param out The Serializer object to use
@return False on any errors, else true
*/
virtual bool save(Serializer& out) const;
bool save(Serializer& out) const;
/**
Load the current state of this cart from the given Serializer.
@ -122,14 +130,14 @@ class CartridgeFE : public Cartridge
@param in The Serializer object to use
@return False on any errors, else true
*/
virtual bool load(Serializer& in);
bool load(Serializer& in);
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
virtual string name() const { return "CartridgeFE"; }
string name() const { return "CartridgeFE"; }
public:
/**
@ -137,7 +145,7 @@ class CartridgeFE : public Cartridge
@return The byte at the specified address
*/
virtual uInt8 peek(uInt16 address);
uInt8 peek(uInt16 address);
/**
Change the byte at the specified address to the given value
@ -145,11 +153,17 @@ class CartridgeFE : public Cartridge
@param address The address where the value should be stored
@param value The value to be stored at the address
*/
virtual void poke(uInt16 address, uInt8 value);
void poke(uInt16 address, uInt8 value);
private:
// The 8K ROM image of the cartridge
uInt8 myImage[8192];
// Previous two addresses accessed by peek()
uInt16 myLastAddress1, myLastAddress2;
// Last two addresses have been modified by peek()
bool myLastAddressChanged;
};
#endif

View File

@ -48,7 +48,7 @@ class CartridgeSB : public Cartridge
/**
Reset device to its power-on state
*/
virtual void reset();
void reset();
/**
Install cartridge in the specified system. Invoked by the system
@ -56,26 +56,26 @@ class CartridgeSB : public Cartridge
@param system The system the device should install itself in
*/
virtual void install(System& system);
void install(System& system);
/**
Install pages for the specified bank in the system.
@param bank The bank that should be installed in the system
*/
virtual void bank(uInt16 bank);
void bank(uInt16 bank);
/**
Get the current bank.
@return The current bank, or -1 if bankswitching not supported
*/
virtual int bank();
int bank();
/**
Query the number of banks supported by the cartridge.
*/
virtual int bankCount();
int bankCount();
/**
Patch the cartridge ROM.
@ -84,7 +84,7 @@ class CartridgeSB : public Cartridge
@param value The value to place into the address
@return Success or failure of the patch operation
*/
virtual bool patch(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Access the internal ROM image for this cartridge.
@ -92,7 +92,7 @@ class CartridgeSB : public Cartridge
@param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data
*/
virtual uInt8* getImage(int& size);
uInt8* getImage(int& size);
/**
Save the current state of this cart to the given Serializer.
@ -100,7 +100,7 @@ class CartridgeSB : public Cartridge
@param out The Serializer object to use
@return False on any errors, else true
*/
virtual bool save(Serializer& out) const;
bool save(Serializer& out) const;
/**
Load the current state of this cart from the given Serializer.
@ -108,14 +108,14 @@ class CartridgeSB : public Cartridge
@param in The Serializer object to use
@return False on any errors, else true
*/
virtual bool load(Serializer& in);
bool load(Serializer& in);
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
virtual string name() const { return "CartridgeSB"; }
string name() const { return "CartridgeSB"; }
public:
/**
@ -123,7 +123,7 @@ class CartridgeSB : public Cartridge
@return The byte at the specified address
*/
virtual uInt8 peek(uInt16 address);
uInt8 peek(uInt16 address);
/**
Change the byte at the specified address to the given value
@ -131,7 +131,7 @@ class CartridgeSB : public Cartridge
@param address The address where the value should be stored
@param value The value to be stored at the address
*/
virtual void poke(uInt16 address, uInt8 value);
void poke(uInt16 address, uInt8 value);
private:
// The 128-256K ROM image and size of the cartridge

View File

@ -51,7 +51,7 @@ class CartridgeUA : public Cartridge
/**
Reset device to its power-on state
*/
virtual void reset();
void reset();
/**
Install cartridge in the specified system. Invoked by the system
@ -59,26 +59,26 @@ class CartridgeUA : public Cartridge
@param system The system the device should install itself in
*/
virtual void install(System& system);
void install(System& system);
/**
Install pages for the specified bank in the system.
@param bank The bank that should be installed in the system
*/
virtual void bank(uInt16 bank);
void bank(uInt16 bank);
/**
Get the current bank.
@return The current bank, or -1 if bankswitching not supported
*/
virtual int bank();
int bank();
/**
Query the number of banks supported by the cartridge.
*/
virtual int bankCount();
int bankCount();
/**
Patch the cartridge ROM.
@ -87,7 +87,7 @@ class CartridgeUA : public Cartridge
@param value The value to place into the address
@return Success or failure of the patch operation
*/
virtual bool patch(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Access the internal ROM image for this cartridge.
@ -95,7 +95,7 @@ class CartridgeUA : public Cartridge
@param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data
*/
virtual uInt8* getImage(int& size);
uInt8* getImage(int& size);
/**
Save the current state of this cart to the given Serializer.
@ -103,7 +103,7 @@ class CartridgeUA : public Cartridge
@param out The Serializer object to use
@return False on any errors, else true
*/
virtual bool save(Serializer& out) const;
bool save(Serializer& out) const;
/**
Load the current state of this cart from the given Serializer.
@ -111,14 +111,14 @@ class CartridgeUA : public Cartridge
@param in The Serializer object to use
@return False on any errors, else true
*/
virtual bool load(Serializer& in);
bool load(Serializer& in);
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
virtual string name() const { return "CartridgeUA"; }
string name() const { return "CartridgeUA"; }
public:
/**
@ -126,7 +126,7 @@ class CartridgeUA : public Cartridge
@return The byte at the specified address
*/
virtual uInt8 peek(uInt16 address);
uInt8 peek(uInt16 address);
/**
Change the byte at the specified address to the given value
@ -134,7 +134,7 @@ class CartridgeUA : public Cartridge
@param address The address where the value should be stored
@param value The value to be stored at the address
*/
virtual void poke(uInt16 address, uInt8 value);
void poke(uInt16 address, uInt8 value);
private:
// Indicates which bank is currently active

View File

@ -60,7 +60,7 @@ class CartridgeX07 : public Cartridge
/**
Reset device to its power-on state
*/
virtual void reset();
void reset();
/**
Install cartridge in the specified system. Invoked by the system
@ -68,26 +68,26 @@ class CartridgeX07 : public Cartridge
@param system The system the device should install itself in
*/
virtual void install(System& system);
void install(System& system);
/**
Install pages for the specified bank in the system.
@param bank The bank that should be installed in the system
*/
virtual void bank(uInt16 bank);
void bank(uInt16 bank);
/**
Get the current bank.
@return The current bank, or -1 if bankswitching not supported
*/
virtual int bank();
int bank();
/**
Query the number of banks supported by the cartridge.
*/
virtual int bankCount();
int bankCount();
/**
Patch the cartridge ROM.
@ -96,7 +96,7 @@ class CartridgeX07 : public Cartridge
@param value The value to place into the address
@return Success or failure of the patch operation
*/
virtual bool patch(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Access the internal ROM image for this cartridge.
@ -104,7 +104,7 @@ class CartridgeX07 : public Cartridge
@param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data
*/
virtual uInt8* getImage(int& size);
uInt8* getImage(int& size);
/**
Save the current state of this cart to the given Serializer.
@ -112,7 +112,7 @@ class CartridgeX07 : public Cartridge
@param out The Serializer object to use
@return False on any errors, else true
*/
virtual bool save(Serializer& out) const;
bool save(Serializer& out) const;
/**
Load the current state of this cart from the given Serializer.
@ -120,14 +120,14 @@ class CartridgeX07 : public Cartridge
@param in The Serializer object to use
@return False on any errors, else true
*/
virtual bool load(Serializer& in);
bool load(Serializer& in);
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
virtual string name() const { return "CartridgeX07"; }
string name() const { return "CartridgeX07"; }
public:
/**
@ -135,7 +135,7 @@ class CartridgeX07 : public Cartridge
@return The byte at the specified address
*/
virtual uInt8 peek(uInt16 address);
uInt8 peek(uInt16 address);
/**
Change the byte at the specified address to the given value
@ -143,7 +143,7 @@ class CartridgeX07 : public Cartridge
@param address The address where the value should be stored
@param value The value to be stored at the address
*/
virtual void poke(uInt16 address, uInt8 value);
void poke(uInt16 address, uInt8 value);
private:
// Indicates which bank is currently active

View File

@ -1817,7 +1817,7 @@
2D91752309BA903B0026E9FF /* Deployment */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
FRAMEWORK_SEARCH_PATHS = (
.,
"$(HOME)/Library/Frameworks",