2009-04-05 18:59:56 +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
|
2009-04-05 18:59:56 +00:00
|
|
|
//
|
2010-01-10 03:23:32 +00:00
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
2009-04-05 18:59:56 +00:00
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//
|
2009-05-13 13:55:40 +00:00
|
|
|
// $Id$
|
2009-04-05 18:59:56 +00:00
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#ifndef CARTRIDGEEF_HXX
|
|
|
|
#define CARTRIDGEEF_HXX
|
|
|
|
|
|
|
|
class System;
|
|
|
|
|
|
|
|
#include "bspf.hxx"
|
|
|
|
#include "Cart.hxx"
|
2013-04-06 21:04:11 +00:00
|
|
|
#ifdef DEBUGGER_SUPPORT
|
|
|
|
#include "CartEFWidget.hxx"
|
|
|
|
#endif
|
2009-04-05 18:59:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Cartridge class used for Homestar Runner by Paul Slocum.
|
|
|
|
There are 16 4K banks (total of 64K ROM).
|
|
|
|
Accessing $1FE0 - $1FEF switches to each bank.
|
|
|
|
|
|
|
|
This interpretation is based on analysis of the z26 assembly code,
|
|
|
|
as this scheme doesn't seem to be documented anywhere.
|
|
|
|
|
|
|
|
@author Stephen Anthony
|
2009-05-13 13:55:40 +00:00
|
|
|
@version $Id$
|
2009-04-05 18:59:56 +00:00
|
|
|
*/
|
|
|
|
class CartridgeEF : public Cartridge
|
|
|
|
{
|
2013-04-06 21:04:11 +00:00
|
|
|
friend class CartridgeEFWidget;
|
|
|
|
|
2009-04-05 18:59:56 +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)
|
2009-04-05 18:59:56 +00:00
|
|
|
*/
|
2012-01-02 20:31:42 +00:00
|
|
|
CartridgeEF(const uInt8* image, uInt32 size, const Settings& settings);
|
2009-04-05 18:59:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor
|
|
|
|
*/
|
|
|
|
virtual ~CartridgeEF();
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Reset device to its power-on state
|
|
|
|
*/
|
2015-07-10 18:59:03 +00:00
|
|
|
void reset() override;
|
2009-04-05 18:59:56 +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
|
|
|
|
*/
|
2015-07-10 18:59:03 +00:00
|
|
|
void install(System& system) override;
|
2009-04-05 18:59:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Install pages for the specified bank in the system.
|
|
|
|
|
|
|
|
@param bank The bank that should be installed in the system
|
|
|
|
*/
|
2015-07-10 18:59:03 +00:00
|
|
|
bool bank(uInt16 bank) override;
|
2009-04-05 18:59:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Get the current bank.
|
|
|
|
*/
|
2015-07-10 18:59:03 +00:00
|
|
|
uInt16 getBank() const override;
|
2009-04-05 18:59:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Query the number of banks supported by the cartridge.
|
|
|
|
*/
|
2015-07-10 18:59:03 +00:00
|
|
|
uInt16 bankCount() const override;
|
2009-04-05 18:59:56 +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
|
|
|
|
*/
|
2015-07-10 18:59:03 +00:00
|
|
|
bool patch(uInt16 address, uInt8 value) override;
|
2009-04-05 18:59:56 +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
|
|
|
|
*/
|
2015-07-10 18:59:03 +00:00
|
|
|
const uInt8* getImage(int& size) const override;
|
2009-04-05 18:59:56 +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
|
|
|
|
*/
|
2015-07-10 18:59:03 +00:00
|
|
|
bool save(Serializer& out) const override;
|
2009-04-05 18:59:56 +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.
|
2009-04-05 18:59:56 +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
|
2009-04-05 18:59:56 +00:00
|
|
|
@return False on any errors, else true
|
|
|
|
*/
|
2015-07-10 18:59:03 +00:00
|
|
|
bool load(Serializer& in) override;
|
2009-04-05 18:59:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Get a descriptor for the device name (used in error checking).
|
|
|
|
|
|
|
|
@return The name of the object
|
|
|
|
*/
|
2015-07-10 18:59:03 +00:00
|
|
|
string name() const override { return "CartridgeEF"; }
|
2009-04-05 18:59:56 +00:00
|
|
|
|
2013-04-06 21:04:11 +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,
|
2015-07-10 18:59:03 +00:00
|
|
|
const GUI::Font& nfont, int x, int y, int w, int h) override
|
2013-04-06 21:04:11 +00:00
|
|
|
{
|
2013-08-26 13:01:29 +00:00
|
|
|
return new CartridgeEFWidget(boss, lfont, nfont, x, y, w, h, *this);
|
2013-04-06 21:04:11 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-04-05 18:59:56 +00:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Get the byte at the specified address.
|
|
|
|
|
|
|
|
@return The byte at the specified address
|
|
|
|
*/
|
2015-07-10 18:59:03 +00:00
|
|
|
uInt8 peek(uInt16 address) override;
|
2009-04-05 18:59:56 +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
|
2009-04-05 18:59:56 +00:00
|
|
|
*/
|
2015-07-10 18:59:03 +00:00
|
|
|
bool poke(uInt16 address, uInt8 value) override;
|
2009-04-05 18:59:56 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Indicates which bank is currently active
|
|
|
|
uInt16 myCurrentBank;
|
|
|
|
|
|
|
|
// The 64K ROM image of the cartridge
|
|
|
|
uInt8 myImage[65536];
|
2015-04-26 19:02:42 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Following constructors and assignment operators not supported
|
|
|
|
CartridgeEF() = delete;
|
|
|
|
CartridgeEF(const CartridgeEF&) = delete;
|
|
|
|
CartridgeEF(CartridgeEF&&) = delete;
|
|
|
|
CartridgeEF& operator=(const CartridgeEF&) = delete;
|
|
|
|
CartridgeEF& operator=(CartridgeEF&&) = delete;
|
2009-04-05 18:59:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|