2001-12-27 19:54:36 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
//
|
2014-01-12 17:23:42 +00:00
|
|
|
// Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
|
2010-04-10 21:37:23 +00:00
|
|
|
// and the Stella Team
|
2001-12-27 19:54:36 +00:00
|
|
|
//
|
2010-01-10 03:23:32 +00:00
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
2001-12-27 19:54:36 +00:00
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//
|
2009-05-13 13:55:40 +00:00
|
|
|
// $Id$
|
2001-12-27 19:54:36 +00:00
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#ifndef CARTRIDGE_HXX
|
|
|
|
#define CARTRIDGE_HXX
|
|
|
|
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
#include <fstream>
|
2009-06-16 17:17:33 +00:00
|
|
|
#include <sstream>
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
class Cartridge;
|
2006-11-08 00:09:53 +00:00
|
|
|
class Properties;
|
2013-04-04 21:38:22 +00:00
|
|
|
class CartDebugWidget;
|
|
|
|
class GuiObject;
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
#include "bspf.hxx"
|
2009-06-03 14:49:42 +00:00
|
|
|
#include "Array.hxx"
|
2001-12-27 19:54:36 +00:00
|
|
|
#include "Device.hxx"
|
2010-08-19 21:48:28 +00:00
|
|
|
#include "Settings.hxx"
|
2013-04-04 21:38:22 +00:00
|
|
|
#include "Font.hxx"
|
2001-12-27 19:54:36 +00:00
|
|
|
|
2009-11-11 20:53:57 +00:00
|
|
|
struct RamArea {
|
|
|
|
uInt16 start; uInt16 size; uInt16 roffset; uInt16 woffset;
|
|
|
|
};
|
|
|
|
typedef Common::Array<RamArea> RamAreaList;
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
/**
|
|
|
|
A cartridge is a device which contains the machine code for a
|
|
|
|
game and handles any bankswitching performed by the cartridge.
|
2010-03-05 22:02:12 +00:00
|
|
|
A 'bank' is defined as a 4K block that is visible in the
|
|
|
|
0x1000-0x2000 area (or its mirrors).
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
@author Bradford W. Mott
|
2009-05-13 13:55:40 +00:00
|
|
|
@version $Id$
|
2001-12-27 19:54:36 +00:00
|
|
|
*/
|
|
|
|
class Cartridge : public Device
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Create a new cartridge object allocated on the heap. The
|
|
|
|
type of cartridge created depends on the properties object.
|
|
|
|
|
2006-11-08 00:09:53 +00:00
|
|
|
@param image A pointer to the ROM image
|
|
|
|
@param size The size of the ROM image
|
2009-06-16 17:17:33 +00:00
|
|
|
@param md5 The md5sum for the given ROM image (can be updated)
|
2010-04-09 20:13:12 +00:00
|
|
|
@param dtype The detected bankswitch type of the ROM image
|
|
|
|
@param id Any extra info about the ROM (currently which part
|
|
|
|
of a multiload game is being accessed
|
2012-04-12 23:23:12 +00:00
|
|
|
@param system The osystem associated with the system
|
2006-11-08 00:09:53 +00:00
|
|
|
@param settings The settings associated with the system
|
|
|
|
@return Pointer to the new cartridge object allocated on the heap
|
2001-12-27 19:54:36 +00:00
|
|
|
*/
|
2009-06-16 17:17:33 +00:00
|
|
|
static Cartridge* create(const uInt8* image, uInt32 size, string& md5,
|
2012-04-12 23:23:12 +00:00
|
|
|
string& dtype, string& id,
|
|
|
|
const OSystem& system, Settings& settings);
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Create a new cartridge
|
2010-08-19 21:48:28 +00:00
|
|
|
|
|
|
|
@param settings A reference to the various settings (read-only)
|
2001-12-27 19:54:36 +00:00
|
|
|
*/
|
2010-08-19 21:48:28 +00:00
|
|
|
Cartridge(const Settings& settings);
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor
|
|
|
|
*/
|
|
|
|
virtual ~Cartridge();
|
|
|
|
|
2006-12-28 18:31:27 +00:00
|
|
|
/**
|
|
|
|
Query some information about this cartridge.
|
|
|
|
*/
|
|
|
|
static const string& about() { return myAboutString; }
|
|
|
|
|
2007-01-14 16:17:57 +00:00
|
|
|
/**
|
|
|
|
Save the internal (patched) ROM image.
|
|
|
|
|
|
|
|
@param out The output file stream to save the image
|
|
|
|
*/
|
|
|
|
bool save(ofstream& out);
|
|
|
|
|
|
|
|
/**
|
2009-11-08 16:46:10 +00:00
|
|
|
Lock/unlock bankswitching capability. The debugger will lock
|
|
|
|
the banks before querying the cart state, otherwise reading values
|
|
|
|
could inadvertantly cause a bankswitch to occur.
|
2007-01-14 16:17:57 +00:00
|
|
|
*/
|
2011-05-10 15:04:19 +00:00
|
|
|
void lockBank() { myBankLocked = true; }
|
|
|
|
void unlockBank() { myBankLocked = false; }
|
|
|
|
bool bankLocked() { return myBankLocked; }
|
2005-10-12 03:32:28 +00:00
|
|
|
|
2010-03-05 22:02:12 +00:00
|
|
|
/**
|
|
|
|
Get the default startup bank for a cart. This is the bank where
|
|
|
|
the system will look at address 0xFFFC to determine where to
|
|
|
|
start running code.
|
|
|
|
|
|
|
|
@return The startup bank
|
|
|
|
*/
|
|
|
|
uInt16 startBank();
|
|
|
|
|
2010-03-06 18:56:36 +00:00
|
|
|
/**
|
|
|
|
Answer whether the bank has changed since the last time this
|
2010-03-23 18:00:47 +00:00
|
|
|
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.
|
2010-03-06 18:56:36 +00:00
|
|
|
|
|
|
|
@return Whether the bank was changed
|
|
|
|
*/
|
2010-03-23 18:00:47 +00:00
|
|
|
virtual bool bankChanged();
|
2010-03-06 18:56:36 +00:00
|
|
|
|
2009-06-03 14:49:42 +00:00
|
|
|
const RamAreaList& ramAreas() { return myRamAreaList; }
|
Added support for accessing/modifying extended RAM (aka SuperChip) from
the debugger RAM UI. A scrollbar is now present, which can scroll
through each 128 byte 'bank'. Labels indicate the current readport,
so you can distinguish between different areas of RAM. For now,
F4SC, F6SC, F8SC, and FASC have been converted, but I'm looking into the
other schemes now.
The RAM UI takes care of all read/write port issues. From the POV of
the UI, the RAM can be treated as zero-page; translation is done
behind the scene. Searching/comparing and change-tracking are also
supported.
The 'ram' command in the debugger prompt now reflects all RAM, and
readport/writeport addresses are shown, making it easier to use the
command withot having to look up the offsets.
Debugger width has been bumped to 1050 pixels wide to accomodate the
new functionality. We'll see how much trouble this causes ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1747 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-06-02 17:25:14 +00:00
|
|
|
|
2007-01-14 16:17:57 +00:00
|
|
|
public:
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// The following methods are cart-specific and must be implemented
|
|
|
|
// in derived classes.
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
/**
|
|
|
|
Set the specified bank.
|
|
|
|
*/
|
2010-08-16 16:41:24 +00:00
|
|
|
virtual bool bank(uInt16 bank) = 0;
|
2007-01-14 16:17:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Get the current bank.
|
|
|
|
*/
|
2010-04-02 22:09:31 +00:00
|
|
|
virtual uInt16 bank() const = 0;
|
2007-01-14 16:17:57 +00:00
|
|
|
|
|
|
|
/**
|
2013-04-11 14:58:18 +00:00
|
|
|
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.
|
2007-01-14 16:17:57 +00:00
|
|
|
*/
|
2010-04-02 22:09:31 +00:00
|
|
|
virtual uInt16 bankCount() const = 0;
|
2007-01-14 16:17:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Patch the cartridge ROM.
|
|
|
|
|
|
|
|
@param address The ROM address to patch
|
|
|
|
@param value The value to place into the address
|
|
|
|
@return Success or failure of the patch operation
|
|
|
|
*/
|
|
|
|
virtual bool patch(uInt16 address, uInt8 value) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Access the internal ROM image for this cartridge.
|
|
|
|
|
|
|
|
@param size Set to the size of the internal ROM image data
|
|
|
|
@return A pointer to the internal ROM image data
|
|
|
|
*/
|
2010-04-02 22:09:31 +00:00
|
|
|
virtual const uInt8* getImage(int& size) const = 0;
|
2007-01-14 16:17:57 +00:00
|
|
|
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
/**
|
|
|
|
Save the current state of this device to the given Serializer.
|
|
|
|
|
|
|
|
@param out The Serializer object to use
|
|
|
|
@return False on any errors, else true
|
|
|
|
*/
|
|
|
|
virtual bool save(Serializer& out) const = 0;
|
|
|
|
|
|
|
|
/**
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
Load the current state of this device from the given Serializer.
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
@param in The Serializer object to use
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
@return False on any errors, else true
|
|
|
|
*/
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
virtual bool load(Serializer& in) = 0;
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Get a descriptor for the device name (used in error checking).
|
|
|
|
|
|
|
|
@return The name of the object
|
|
|
|
*/
|
|
|
|
virtual string name() const = 0;
|
|
|
|
|
2012-04-14 19:28:53 +00:00
|
|
|
/**
|
|
|
|
Informs the cartridge about the name of the ROM file used when
|
|
|
|
creating this cart.
|
|
|
|
|
|
|
|
@param name The properties file name of the ROM
|
|
|
|
*/
|
|
|
|
virtual void setRomName(const string& name) { }
|
|
|
|
|
2013-04-04 21:38:22 +00:00
|
|
|
/**
|
|
|
|
Get debugger widget responsible for accessing the inner workings
|
|
|
|
of the cart. This will need to be overridden and implemented by
|
|
|
|
each specific cart type, since the bankswitching/inner workings
|
|
|
|
of each cart type can be very different from each other.
|
|
|
|
*/
|
2013-08-26 13:01:29 +00:00
|
|
|
virtual CartDebugWidget* debugWidget(GuiObject* boss, const GUI::Font& lfont,
|
|
|
|
const GUI::Font& nfont, int x, int y, int w, int h) { return NULL; }
|
2013-04-04 21:38:22 +00:00
|
|
|
|
2005-10-12 03:32:28 +00:00
|
|
|
protected:
|
2009-06-03 14:49:42 +00:00
|
|
|
/**
|
|
|
|
Add the given area to the RamArea list for this cart.
|
|
|
|
|
|
|
|
@param start The beginning of the RAM area (0x0000 - 0x2000)
|
|
|
|
@param size Total number of bytes of area
|
|
|
|
@param roffset Offset to use when reading from RAM (read port)
|
|
|
|
@param woffset Offset to use when writing to RAM (write port)
|
|
|
|
*/
|
|
|
|
void registerRamArea(uInt16 start, uInt16 size, uInt16 roffset, uInt16 woffset);
|
2005-06-27 04:45:52 +00:00
|
|
|
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
/**
|
|
|
|
Indicate that an illegal read from a write port has occurred.
|
|
|
|
|
|
|
|
@param address The address of the illegal read
|
|
|
|
*/
|
|
|
|
void triggerReadFromWritePort(uInt16 address);
|
|
|
|
|
2010-10-03 00:23:13 +00:00
|
|
|
/**
|
|
|
|
Create an array that holds code-access information for every byte
|
|
|
|
of the ROM (indicated by 'size'). Note that this is only used by
|
|
|
|
the debugger, and is unavailable otherwise.
|
|
|
|
|
|
|
|
@param size The size of the code-access array to create
|
|
|
|
*/
|
|
|
|
void createCodeAccessBase(uInt32 size);
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
private:
|
2009-06-16 17:17:33 +00:00
|
|
|
/**
|
|
|
|
Get an image pointer and size for a ROM that is part of a larger,
|
|
|
|
multi-ROM image.
|
|
|
|
|
|
|
|
@param image A pointer to the ROM image
|
|
|
|
@param size The size of the ROM image
|
|
|
|
@param numroms The number of ROMs in the multicart
|
|
|
|
@param md5 The md5sum for the specific cart in the ROM image
|
|
|
|
@param id The ID for the specific cart in the ROM image
|
|
|
|
@param settings The settings associated with the system
|
|
|
|
@return The bankswitch type for the specific cart in the ROM image
|
|
|
|
*/
|
|
|
|
static string createFromMultiCart(const uInt8*& image, uInt32& size,
|
|
|
|
uInt32 numroms, string& md5, string& id, Settings& settings);
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
/**
|
|
|
|
Try to auto-detect the bankswitching type of the cartridge
|
|
|
|
|
2006-12-31 02:16:37 +00:00
|
|
|
@param image A pointer to the ROM image
|
|
|
|
@param size The size of the ROM image
|
2001-12-27 19:54:36 +00:00
|
|
|
@return The "best guess" for the cartridge type
|
|
|
|
*/
|
|
|
|
static string autodetectType(const uInt8* image, uInt32 size);
|
|
|
|
|
2006-12-24 17:13:10 +00:00
|
|
|
/**
|
2007-06-08 12:36:52 +00:00
|
|
|
Search the image for the specified byte signature
|
|
|
|
|
|
|
|
@param image A pointer to the ROM image
|
|
|
|
@param imagesize The size of the ROM image
|
|
|
|
@param signature The byte sequence to search for
|
|
|
|
@param sigsize The number of bytes in the signature
|
2007-06-14 13:47:50 +00:00
|
|
|
@param minhits The minimum number of times a signature is to be found
|
2007-06-08 12:36:52 +00:00
|
|
|
|
2007-06-14 13:47:50 +00:00
|
|
|
@return True if the signature was found at least 'minhits' time, else false
|
2006-12-24 17:13:10 +00:00
|
|
|
*/
|
2007-06-14 13:47:50 +00:00
|
|
|
static bool searchForBytes(const uInt8* image, uInt32 imagesize,
|
|
|
|
const uInt8* signature, uInt32 sigsize,
|
|
|
|
uInt32 minhits);
|
2006-12-24 17:13:10 +00:00
|
|
|
|
|
|
|
/**
|
2006-12-26 00:39:44 +00:00
|
|
|
Returns true if the image is probably a SuperChip (256 bytes RAM)
|
2006-12-24 17:13:10 +00:00
|
|
|
*/
|
|
|
|
static bool isProbablySC(const uInt8* image, uInt32 size);
|
|
|
|
|
2014-01-17 15:39:11 +00:00
|
|
|
/**
|
|
|
|
Returns true if the image is probably a 4K SuperChip (256 bytes RAM)
|
|
|
|
*/
|
|
|
|
static bool isProbably4KSC(const uInt8* image, uInt32 size);
|
|
|
|
|
2013-02-20 18:16:34 +00:00
|
|
|
/**
|
|
|
|
Returns true if the image probably contains ARM code in the first 1K
|
|
|
|
*/
|
|
|
|
static bool isProbablyARM(const uInt8* image, uInt32 size);
|
|
|
|
|
2003-02-17 04:59:54 +00:00
|
|
|
/**
|
2010-05-10 00:50:26 +00:00
|
|
|
Returns true if the image is probably a 0840 bankswitching cartridge
|
2003-02-17 04:59:54 +00:00
|
|
|
*/
|
2010-05-10 00:50:26 +00:00
|
|
|
static bool isProbably0840(const uInt8* image, uInt32 size);
|
2003-02-17 04:59:54 +00:00
|
|
|
|
2005-07-09 15:19:24 +00:00
|
|
|
/**
|
|
|
|
Returns true if the image is probably a 3E bankswitching cartridge
|
|
|
|
*/
|
|
|
|
static bool isProbably3E(const uInt8* image, uInt32 size);
|
2010-05-10 00:50:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns true if the image is probably a 3F bankswitching cartridge
|
|
|
|
*/
|
|
|
|
static bool isProbably3F(const uInt8* image, uInt32 size);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns true if the image is probably a 4A50 bankswitching cartridge
|
|
|
|
*/
|
|
|
|
static bool isProbably4A50(const uInt8* image, uInt32 size);
|
|
|
|
|
2012-04-29 19:43:28 +00:00
|
|
|
/**
|
|
|
|
Returns true if the image is probably a CTY bankswitching cartridge
|
|
|
|
*/
|
|
|
|
static bool isProbablyCTY(const uInt8* image, uInt32 size);
|
|
|
|
|
2010-05-10 00:50:26 +00:00
|
|
|
/**
|
|
|
|
Returns true if the image is probably a CV bankswitching cartridge
|
|
|
|
*/
|
|
|
|
static bool isProbablyCV(const uInt8* image, uInt32 size);
|
|
|
|
|
2010-05-02 22:52:59 +00:00
|
|
|
/**
|
|
|
|
Returns true if the image is probably a DPC+ bankswitching cartridge
|
|
|
|
*/
|
|
|
|
static bool isProbablyDPCplus(const uInt8* image, uInt32 size);
|
2005-07-09 15:19:24 +00:00
|
|
|
|
2006-12-26 00:39:44 +00:00
|
|
|
/**
|
|
|
|
Returns true if the image is probably a E0 bankswitching cartridge
|
|
|
|
*/
|
|
|
|
static bool isProbablyE0(const uInt8* image, uInt32 size);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns true if the image is probably a E7 bankswitching cartridge
|
|
|
|
*/
|
|
|
|
static bool isProbablyE7(const uInt8* image, uInt32 size);
|
|
|
|
|
2009-04-05 18:59:56 +00:00
|
|
|
/**
|
2013-08-09 21:53:31 +00:00
|
|
|
Returns true if the image is probably an EF/EFSC bankswitching cartridge
|
2009-04-05 18:59:56 +00:00
|
|
|
*/
|
2013-08-09 21:53:31 +00:00
|
|
|
static bool isProbablyEF(const uInt8* image, uInt32 size, const char*& type);
|
2009-04-05 18:59:56 +00:00
|
|
|
|
2014-01-17 15:39:11 +00:00
|
|
|
/**
|
|
|
|
Returns true if the image is probably a BF/BFSC bankswitching cartridge
|
|
|
|
*/
|
|
|
|
static bool isProbablyBF(const uInt8* image, uInt32 size, const char*& type);
|
|
|
|
/**
|
|
|
|
Returns true if the image is probably a DF/DFSC bankswitching cartridge
|
|
|
|
*/
|
|
|
|
static bool isProbablyDF(const uInt8* image, uInt32 size, const char*& type);
|
|
|
|
|
2007-06-08 12:36:52 +00:00
|
|
|
/**
|
2010-05-10 00:50:26 +00:00
|
|
|
Returns true if the image is probably an F6 bankswitching cartridge
|
2007-06-08 12:36:52 +00:00
|
|
|
*/
|
2010-05-10 00:50:26 +00:00
|
|
|
static bool isProbablyF6(const uInt8* image, uInt32 size);
|
2007-06-08 12:36:52 +00:00
|
|
|
|
2013-02-20 18:16:34 +00:00
|
|
|
/**
|
|
|
|
Returns true if the image is probably an FA2 bankswitching cartridge
|
|
|
|
*/
|
|
|
|
static bool isProbablyFA2(const uInt8* image, uInt32 size);
|
|
|
|
|
2007-10-12 14:45:10 +00:00
|
|
|
/**
|
2010-05-10 00:50:26 +00:00
|
|
|
Returns true if the image is probably an FE bankswitching cartridge
|
2007-10-12 14:45:10 +00:00
|
|
|
*/
|
2010-05-10 00:50:26 +00:00
|
|
|
static bool isProbablyFE(const uInt8* image, uInt32 size);
|
2007-10-12 14:45:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns true if the image is probably a SB bankswitching cartridge
|
|
|
|
*/
|
|
|
|
static bool isProbablySB(const uInt8* image, uInt32 size);
|
|
|
|
|
2008-02-27 20:13:55 +00:00
|
|
|
/**
|
2010-05-10 00:50:26 +00:00
|
|
|
Returns true if the image is probably a UA bankswitching cartridge
|
2007-06-08 12:36:52 +00:00
|
|
|
*/
|
2010-05-10 00:50:26 +00:00
|
|
|
static bool isProbablyUA(const uInt8* image, uInt32 size);
|
2007-06-08 12:36:52 +00:00
|
|
|
|
2009-06-12 21:47:03 +00:00
|
|
|
/**
|
|
|
|
Returns true if the image is probably an X07 bankswitching cartridge
|
|
|
|
*/
|
|
|
|
static bool isProbablyX07(const uInt8* image, uInt32 size);
|
|
|
|
|
2009-06-03 14:49:42 +00:00
|
|
|
protected:
|
2010-08-19 21:48:28 +00:00
|
|
|
// Settings class for the application
|
|
|
|
const Settings& mySettings;
|
|
|
|
|
2010-03-05 22:02:12 +00:00
|
|
|
// The startup bank to use (where to look for the reset vector address)
|
|
|
|
uInt16 myStartBank;
|
|
|
|
|
2010-03-06 18:56:36 +00:00
|
|
|
// Indicates if the bank has changed somehow (a bankswitch has occurred)
|
|
|
|
bool myBankChanged;
|
2009-06-03 14:49:42 +00:00
|
|
|
|
2010-10-03 00:23:13 +00:00
|
|
|
// The array containing information about every byte of ROM indicating
|
|
|
|
// whether it is used as code.
|
|
|
|
uInt8* myCodeAccessBase;
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
private:
|
2009-06-03 14:49:42 +00:00
|
|
|
// Contains RamArea entries for those carts with accessible RAM.
|
|
|
|
RamAreaList myRamAreaList;
|
2010-03-06 18:56:36 +00:00
|
|
|
|
|
|
|
// If myBankLocked is true, ignore attempts at bankswitching. This is used
|
|
|
|
// by the debugger, when disassembling/dumping ROM.
|
|
|
|
bool myBankLocked;
|
|
|
|
|
2006-12-28 18:31:27 +00:00
|
|
|
// Contains info about this cartridge in string format
|
|
|
|
static string myAboutString;
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
// Copy constructor isn't supported by cartridges so make it private
|
|
|
|
Cartridge(const Cartridge&);
|
|
|
|
|
|
|
|
// Assignment operator isn't supported by cartridges so make it private
|
|
|
|
Cartridge& operator = (const Cartridge&);
|
|
|
|
};
|
|
|
|
|
2007-01-14 16:17:57 +00:00
|
|
|
#endif
|