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
|
|
|
|
//
|
2015-01-01 03:49:32 +00:00
|
|
|
// Copyright (c) 1995-2015 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 CARTRIDGE4K_HXX
|
|
|
|
#define CARTRIDGE4K_HXX
|
|
|
|
|
|
|
|
class System;
|
|
|
|
|
|
|
|
#include "bspf.hxx"
|
|
|
|
#include "Cart.hxx"
|
2013-04-04 21:38:22 +00:00
|
|
|
#ifdef DEBUGGER_SUPPORT
|
|
|
|
#include "Cart4KWidget.hxx"
|
|
|
|
#endif
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
This is the standard Atari 4K cartridge. These cartridges are
|
|
|
|
not bankswitched.
|
|
|
|
|
|
|
|
@author Bradford W. Mott
|
2009-05-13 13:55:40 +00:00
|
|
|
@version $Id$
|
2001-12-27 19:54:36 +00:00
|
|
|
*/
|
|
|
|
class Cartridge4K : public Cartridge
|
|
|
|
{
|
2013-04-05 13:29:54 +00:00
|
|
|
friend class Cartridge4KWidget;
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Create a new cartridge using the specified image
|
|
|
|
|
2010-08-19 21:48:28 +00:00
|
|
|
@param image Pointer to the ROM image
|
2012-01-02 20:31:42 +00:00
|
|
|
@param size The size of the ROM image
|
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
|
|
|
*/
|
2012-01-02 20:31:42 +00:00
|
|
|
Cartridge4K(const uInt8* image, uInt32 size, const Settings& settings);
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor
|
|
|
|
*/
|
|
|
|
virtual ~Cartridge4K();
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Reset cartridge to its power-on state
|
|
|
|
*/
|
2010-03-23 18:00:47 +00:00
|
|
|
void reset();
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Install cartridge in the specified system. Invoked by the system
|
|
|
|
when the cartridge is attached to it.
|
|
|
|
|
|
|
|
@param system The system the device should install itself in
|
|
|
|
*/
|
2010-03-23 18:00:47 +00:00
|
|
|
void install(System& system);
|
2001-12-27 19:54:36 +00:00
|
|
|
|
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
|
|
|
|
*/
|
2010-03-23 18:00:47 +00:00
|
|
|
bool patch(uInt16 address, uInt8 value);
|
2007-01-14 16:17:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
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
|
|
|
const uInt8* getImage(int& size) const;
|
2005-07-30 16:25:48 +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 cart to the given Serializer.
|
|
|
|
|
|
|
|
@param out The Serializer object to use
|
|
|
|
@return False on any errors, else true
|
|
|
|
*/
|
2010-03-23 18:00:47 +00:00
|
|
|
bool save(Serializer& out) const;
|
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
|
|
|
Load the current state of this cart 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
|
|
|
|
*/
|
2010-03-23 18:00:47 +00:00
|
|
|
bool load(Serializer& in);
|
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
|
|
|
|
*/
|
2010-03-23 18:00:47 +00:00
|
|
|
string name() const { return "Cartridge4K"; }
|
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
|
|
|
|
2013-04-04 21:38:22 +00:00
|
|
|
#ifdef DEBUGGER_SUPPORT
|
|
|
|
/**
|
|
|
|
Get debugger widget responsible for accessing the inner workings
|
|
|
|
of the cart.
|
|
|
|
*/
|
2013-08-26 13:01:29 +00:00
|
|
|
CartDebugWidget* debugWidget(GuiObject* boss, const GUI::Font& lfont,
|
|
|
|
const GUI::Font& nfont, int x, int y, int w, int h)
|
2013-04-04 21:38:22 +00:00
|
|
|
{
|
2013-08-26 13:01:29 +00:00
|
|
|
return new Cartridge4KWidget(boss, lfont, nfont, x, y, w, h, *this);
|
2013-04-04 21:38:22 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Get the byte at the specified address.
|
|
|
|
|
|
|
|
@return The byte at the specified address
|
|
|
|
*/
|
2010-03-23 18:00:47 +00:00
|
|
|
uInt8 peek(uInt16 address);
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Change the byte at the specified address to the given value
|
|
|
|
|
|
|
|
@param address The address where the value should be stored
|
|
|
|
@param value The value to be stored at the address
|
2010-03-28 03:13:10 +00:00
|
|
|
@return True if the poke changed the device address space, else false
|
2001-12-27 19:54:36 +00:00
|
|
|
*/
|
2010-03-28 03:13:10 +00:00
|
|
|
bool poke(uInt16 address, uInt8 value);
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// The 4K ROM image for the cartridge
|
|
|
|
uInt8 myImage[4096];
|
2015-04-26 19:02:42 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Following constructors and assignment operators not supported
|
|
|
|
Cartridge4K() = delete;
|
|
|
|
Cartridge4K(const Cartridge4K&) = delete;
|
|
|
|
Cartridge4K(Cartridge4K&&) = delete;
|
|
|
|
Cartridge4K& operator=(const Cartridge4K&) = delete;
|
|
|
|
Cartridge4K& operator=(Cartridge4K&&) = delete;
|
2001-12-27 19:54:36 +00:00
|
|
|
};
|
|
|
|
|
2007-01-14 16:17:57 +00:00
|
|
|
#endif
|