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
|
|
|
|
//
|
2009-01-01 18:13:40 +00:00
|
|
|
// Copyright (c) 1995-2009 by Bradford W. Mott and the Stella team
|
2001-12-27 19:54:36 +00:00
|
|
|
//
|
|
|
|
// See the file "license" for information on usage and redistribution of
|
|
|
|
// 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 CARTRIDGEAR_HXX
|
|
|
|
#define CARTRIDGEAR_HXX
|
|
|
|
|
2009-05-17 19:30:10 +00:00
|
|
|
class M6502;
|
2007-01-14 16:17:57 +00:00
|
|
|
class System;
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
#include "bspf.hxx"
|
|
|
|
#include "Cart.hxx"
|
2009-06-09 14:27:21 +00:00
|
|
|
#include "Settings.hxx"
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
This is the cartridge class for Arcadia (aka Starpath) Supercharger
|
|
|
|
games. Christopher Salomon provided most of the technical details
|
2002-04-05 02:18:23 +00:00
|
|
|
used in creating this class. A good description of the Supercharger
|
|
|
|
is provided in the Cuttle Cart's manual.
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
The Supercharger has four 2K banks. There are three banks of RAM
|
|
|
|
and one bank of ROM. All 6K of the RAM can be read and written.
|
|
|
|
|
|
|
|
@author Bradford W. Mott
|
2009-05-13 13:55:40 +00:00
|
|
|
@version $Id$
|
2001-12-27 19:54:36 +00:00
|
|
|
*/
|
|
|
|
class CartridgeAR : public Cartridge
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Create a new cartridge using the specified image and size
|
|
|
|
|
2006-11-08 00:09:53 +00:00
|
|
|
@param image Pointer to the ROM image
|
|
|
|
@param size The size of the ROM image
|
2009-06-09 14:27:21 +00:00
|
|
|
@param settings Used to query 'fastscbios' option
|
2001-12-27 19:54:36 +00:00
|
|
|
*/
|
2009-06-09 14:27:21 +00:00
|
|
|
CartridgeAR(const uInt8* image, uInt32 size, const Settings& settings);
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor
|
|
|
|
*/
|
|
|
|
virtual ~CartridgeAR();
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Reset device to its power-on state
|
|
|
|
*/
|
|
|
|
virtual void reset();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Notification method invoked by the system right before the
|
|
|
|
system resets its cycle counter to zero. It may be necessary
|
|
|
|
to override this method for devices that remember cycle counts.
|
|
|
|
*/
|
|
|
|
virtual void systemCyclesReset();
|
|
|
|
|
|
|
|
/**
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
virtual void install(System& system);
|
|
|
|
|
|
|
|
/**
|
2007-01-14 16:17:57 +00:00
|
|
|
Install pages for the specified bank in the system.
|
2001-12-27 19:54:36 +00:00
|
|
|
|
2007-01-14 16:17:57 +00:00
|
|
|
@param bank The bank that should be installed in the system
|
2001-12-27 19:54:36 +00:00
|
|
|
*/
|
2007-01-14 16:17:57 +00:00
|
|
|
virtual void bank(uInt16 bank);
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
/**
|
2007-01-14 16:17:57 +00:00
|
|
|
Get the current bank.
|
2001-12-27 19:54:36 +00:00
|
|
|
|
2007-01-14 16:17:57 +00:00
|
|
|
@return The current bank, or -1 if bankswitching not supported
|
2001-12-27 19:54:36 +00:00
|
|
|
*/
|
2007-01-14 16:17:57 +00:00
|
|
|
virtual int bank();
|
2001-12-27 19:54:36 +00:00
|
|
|
|
2007-01-14 16:17:57 +00:00
|
|
|
/**
|
|
|
|
Query the number of banks supported by the cartridge.
|
|
|
|
*/
|
|
|
|
virtual int bankCount();
|
2005-06-27 23:40:36 +00:00
|
|
|
|
2005-06-27 12:43:49 +00:00
|
|
|
/**
|
2007-01-14 16:17:57 +00:00
|
|
|
Patch the cartridge ROM.
|
2005-06-27 12:43:49 +00:00
|
|
|
|
2007-01-14 16:17:57 +00:00
|
|
|
@param address The ROM address to patch
|
|
|
|
@param value The value to place into the address
|
|
|
|
@return Success or failure of the patch operation
|
2005-06-27 12:43:49 +00:00
|
|
|
*/
|
2007-01-14 16:17:57 +00:00
|
|
|
virtual bool patch(uInt16 address, uInt8 value);
|
2005-06-27 12:43:49 +00:00
|
|
|
|
2007-01-14 16:17:57 +00:00
|
|
|
/**
|
|
|
|
Access the internal ROM image for this cartridge.
|
2005-06-27 12:43:49 +00:00
|
|
|
|
2007-01-14 16:17:57 +00:00
|
|
|
@param size Set to the size of the internal ROM image data
|
|
|
|
@return A pointer to the internal ROM image data
|
|
|
|
*/
|
2005-07-30 16:58:22 +00:00
|
|
|
virtual uInt8* getImage(int& size);
|
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
virtual bool save(Serializer& out) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Load the current state of this cart from the given Deserializer.
|
|
|
|
|
|
|
|
@param in The Deserializer object to use
|
|
|
|
@return False on any errors, else true
|
|
|
|
*/
|
|
|
|
virtual bool load(Deserializer& in);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Get a descriptor for the device name (used in error checking).
|
|
|
|
|
|
|
|
@return The name of the object
|
|
|
|
*/
|
|
|
|
virtual string name() const { return "CartridgeAR"; }
|
|
|
|
|
2007-01-14 16:17:57 +00:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Get the byte at the specified address
|
|
|
|
|
|
|
|
@return The byte at the specified address
|
|
|
|
*/
|
|
|
|
virtual uInt8 peek(uInt16 address);
|
|
|
|
|
|
|
|
/**
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
virtual void poke(uInt16 address, uInt8 value);
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
private:
|
|
|
|
// Handle a change to the bank configuration
|
|
|
|
void bankConfiguration(uInt8 configuration);
|
|
|
|
|
|
|
|
// Compute the sum of the array of bytes
|
|
|
|
uInt8 checksum(uInt8* s, uInt16 length);
|
|
|
|
|
|
|
|
// Load the specified load into SC RAM
|
|
|
|
void loadIntoRAM(uInt8 load);
|
|
|
|
|
2002-04-05 02:18:23 +00:00
|
|
|
// Sets up a "dummy" BIOS ROM in the ROM bank of the cartridge
|
2009-06-09 14:27:21 +00:00
|
|
|
void initializeROM();
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Pointer to the 6502 processor in the system
|
2009-05-17 19:30:10 +00:00
|
|
|
M6502* my6502;
|
2001-12-27 19:54:36 +00:00
|
|
|
|
2009-06-09 14:27:21 +00:00
|
|
|
// Reference to the settings object (needed for 'fastscbios'
|
|
|
|
const Settings& mySettings;
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
// Indicates the offest within the image for the corresponding bank
|
|
|
|
uInt32 myImageOffset[2];
|
|
|
|
|
|
|
|
// The 6K of RAM and 2K of ROM contained in the Supercharger
|
|
|
|
uInt8 myImage[8192];
|
|
|
|
|
|
|
|
// The 256 byte header for the current 8448 byte load
|
|
|
|
uInt8 myHeader[256];
|
|
|
|
|
|
|
|
// All of the 8448 byte loads associated with the game
|
|
|
|
uInt8* myLoadImages;
|
|
|
|
|
|
|
|
// Indicates how many 8448 loads there are
|
|
|
|
uInt8 myNumberOfLoadImages;
|
|
|
|
|
|
|
|
// Indicates if the RAM is write enabled
|
|
|
|
bool myWriteEnabled;
|
|
|
|
|
|
|
|
// Indicates if the ROM's power is on or off
|
|
|
|
bool myPower;
|
|
|
|
|
|
|
|
// Indicates when the power was last turned on
|
|
|
|
Int32 myPowerRomCycle;
|
|
|
|
|
2002-04-05 02:18:23 +00:00
|
|
|
// Data hold register used for writing
|
|
|
|
uInt8 myDataHoldRegister;
|
2001-12-27 19:54:36 +00:00
|
|
|
|
2002-04-05 02:18:23 +00:00
|
|
|
// Indicates number of distinct accesses when data hold register was set
|
2001-12-27 19:54:36 +00:00
|
|
|
uInt32 myNumberOfDistinctAccesses;
|
|
|
|
|
|
|
|
// Indicates if a write is pending or not
|
|
|
|
bool myWritePending;
|
2005-06-27 12:43:49 +00:00
|
|
|
|
|
|
|
uInt16 myCurrentBank;
|
2009-08-03 21:18:16 +00:00
|
|
|
|
|
|
|
// Fake SC-BIOS code to simulate the Supercharger load bars
|
|
|
|
static uInt8 ourDummyROMCode[294];
|
|
|
|
|
|
|
|
// Default 256-byte header to use if one isn't included in the ROM
|
|
|
|
// This data comes from z26
|
|
|
|
static uInt8 ourDefaultHeader[256];
|
2001-12-27 19:54:36 +00:00
|
|
|
};
|
|
|
|
|
2007-01-14 16:17:57 +00:00
|
|
|
#endif
|