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
|
|
|
|
//
|
2013-01-04 19:49:01 +00:00
|
|
|
// Copyright (c) 1995-2013 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
|
|
|
//============================================================================
|
|
|
|
|
2007-01-14 16:17:57 +00:00
|
|
|
#include <cassert>
|
2008-08-25 23:22:22 +00:00
|
|
|
#include <cstring>
|
2007-01-14 16:17:57 +00:00
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
#include "System.hxx"
|
2007-01-14 16:17:57 +00:00
|
|
|
#include "CartMC.hxx"
|
2001-12-27 19:54:36 +00:00
|
|
|
|
2009-11-08 16:46:10 +00:00
|
|
|
// TODO - much more testing of this scheme is required
|
|
|
|
// No test ROMs exist as of 2009-11-08, so we can't be sure how
|
|
|
|
// accurate the emulation is
|
2010-03-28 03:13:10 +00:00
|
|
|
// Bankchange and RAM modification cannot be completed until
|
|
|
|
// adequate test ROMs are available
|
2010-10-03 18:19:09 +00:00
|
|
|
// TODO (2010-10-03) - support CodeAccessBase functionality somehow
|
2009-11-08 01:39:05 +00:00
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-08-19 21:48:28 +00:00
|
|
|
CartridgeMC::CartridgeMC(const uInt8* image, uInt32 size,
|
|
|
|
const Settings& settings)
|
|
|
|
: Cartridge(settings),
|
|
|
|
mySlot3Locked(false)
|
2001-12-27 19:54:36 +00:00
|
|
|
{
|
|
|
|
// Make sure size is reasonable
|
2008-08-01 12:16:00 +00:00
|
|
|
assert(size <= 131072);
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
// Set the contents of the entire ROM to 0
|
2008-08-01 12:16:00 +00:00
|
|
|
memset(myImage, 0, 131072);
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
// Copy the ROM image to the end of the ROM buffer
|
2008-08-01 12:16:00 +00:00
|
|
|
memcpy(myImage + 131072 - size, image, size);
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
CartridgeMC::~CartridgeMC()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartridgeMC::reset()
|
|
|
|
{
|
2010-08-19 21:48:28 +00:00
|
|
|
// Initialize RAM
|
|
|
|
if(mySettings.getBool("ramrandom"))
|
|
|
|
for(uInt32 i = 0; i < 32768; ++i)
|
|
|
|
myRAM[i] = mySystem->randGenerator().next();
|
|
|
|
else
|
|
|
|
memset(myRAM, 0, 32768);
|
2010-03-28 03:13:10 +00:00
|
|
|
|
|
|
|
myBankChanged = true;
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartridgeMC::install(System& system)
|
|
|
|
{
|
|
|
|
mySystem = &system;
|
|
|
|
uInt16 shift = mySystem->pageShift();
|
|
|
|
uInt16 mask = mySystem->pageMask();
|
|
|
|
|
|
|
|
// Make sure the system we're being installed in has a page size that'll work
|
|
|
|
assert(((0x1000 & mask) == 0) && ((0x1400 & mask) == 0) &&
|
|
|
|
((0x1800 & mask) == 0) && ((0x1C00 & mask) == 0));
|
|
|
|
|
|
|
|
// Set the page accessing methods for the hot spots in the TIA. For
|
|
|
|
// correct emulation I would need to chain any accesses below 0x40 to
|
|
|
|
// the TIA but for now I'll just forget about them.
|
|
|
|
//
|
|
|
|
// TODO: These TIA accesses may need to be chained, however, at this
|
|
|
|
// point Chris isn't sure if the hardware will allow it or not
|
|
|
|
//
|
2010-10-03 18:19:09 +00:00
|
|
|
System::PageAccess access(0, 0, 0, this, System::PA_READWRITE);
|
2010-10-03 00:23:13 +00:00
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
for(uInt32 i = 0x00; i < 0x40; i += (1 << shift))
|
|
|
|
mySystem->setPageAccess(i >> shift, access);
|
|
|
|
|
|
|
|
// Map the cartridge into the system
|
2010-04-14 22:35:46 +00:00
|
|
|
access.type = System::PA_READ; // We don't yet indicate RAM areas
|
2001-12-27 19:54:36 +00:00
|
|
|
for(uInt32 j = 0x1000; j < 0x2000; j += (1 << shift))
|
|
|
|
mySystem->setPageAccess(j >> shift, access);
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
uInt8 CartridgeMC::peek(uInt16 address)
|
|
|
|
{
|
2010-03-28 03:13:10 +00:00
|
|
|
uInt16 peekAddress = address;
|
2009-05-01 11:25:07 +00:00
|
|
|
address &= 0x1FFF;
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
// Accessing the RESET vector so lets handle the powerup special case
|
|
|
|
if((address == 0x1FFC) || (address == 0x1FFD))
|
|
|
|
{
|
|
|
|
// Indicate that slot 3 is locked for now
|
|
|
|
mySlot3Locked = true;
|
|
|
|
}
|
|
|
|
// Should we unlock slot 3?
|
|
|
|
else if(mySlot3Locked && (address >= 0x1000) && (address <= 0x1BFF))
|
|
|
|
{
|
|
|
|
// Indicate that slot 3 is unlocked now
|
|
|
|
mySlot3Locked = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Handle reads made to the TIA addresses
|
|
|
|
if(address < 0x1000)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
uInt8 block;
|
|
|
|
|
|
|
|
if(mySlot3Locked && ((address & 0x0C00) == 0x0C00))
|
|
|
|
{
|
|
|
|
block = 0xFF;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
block = myCurrentBlock[(address & 0x0C00) >> 10];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Is this a RAM or a ROM access
|
|
|
|
if(block & 0x80)
|
|
|
|
{
|
|
|
|
// ROM access
|
2009-05-25 17:51:52 +00:00
|
|
|
return myImage[(uInt32)((block & 0x7F) << 10) + (address & 0x03FF)];
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// This is a RAM access, however, is it to the read or write port?
|
|
|
|
if(address & 0x0200)
|
|
|
|
{
|
|
|
|
// Reading from the read port of the RAM block
|
2009-05-25 17:51:52 +00:00
|
|
|
return myRAM[(uInt32)((block & 0x3F) << 9) + (address & 0x01FF)];
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Oops, reading from the write port of the RAM block!
|
2009-11-08 16:46:10 +00:00
|
|
|
// Reading from the write port triggers an unwanted write
|
|
|
|
uInt8 value = mySystem->getDataBusState(0xFF);
|
|
|
|
|
2010-03-28 03:13:10 +00:00
|
|
|
if(bankLocked())
|
|
|
|
return value;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
triggerReadFromWritePort(peekAddress);
|
|
|
|
return myRAM[(uInt32)((block & 0x3F) << 9) + (address & 0x01FF)] = value;
|
|
|
|
}
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-03-28 03:13:10 +00:00
|
|
|
bool CartridgeMC::poke(uInt16 address, uInt8 value)
|
2001-12-27 19:54:36 +00:00
|
|
|
{
|
2009-05-01 11:25:07 +00:00
|
|
|
address &= 0x1FFF;
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
// Accessing the RESET vector so lets handle the powerup special case
|
|
|
|
if((address == 0x1FFC) || (address == 0x1FFD))
|
|
|
|
{
|
|
|
|
// Indicate that slot 3 is locked for now
|
|
|
|
mySlot3Locked = true;
|
|
|
|
}
|
|
|
|
// Should we unlock slot 3?
|
|
|
|
else if(mySlot3Locked && (address >= 0x1000) && (address <= 0x1BFF))
|
|
|
|
{
|
|
|
|
// Indicate that slot 3 is unlocked now
|
|
|
|
mySlot3Locked = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Handle bank-switching writes
|
|
|
|
if((address >= 0x003C) && (address <= 0x003F))
|
|
|
|
{
|
|
|
|
myCurrentBlock[address - 0x003C] = value;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
uInt8 block;
|
|
|
|
|
|
|
|
if(mySlot3Locked && ((address & 0x0C00) == 0x0C00))
|
|
|
|
{
|
|
|
|
block = 0xFF;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
block = myCurrentBlock[(address & 0x0C00) >> 10];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Is this a RAM write access
|
|
|
|
if(!(block & 0x80) && !(address & 0x0200))
|
|
|
|
{
|
|
|
|
// Handle the write to RAM
|
2009-05-25 17:51:52 +00:00
|
|
|
myRAM[(uInt32)((block & 0x3F) << 9) + (address & 0x01FF)] = value;
|
2010-03-28 03:13:10 +00:00
|
|
|
return true;
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
}
|
2010-03-28 03:13:10 +00:00
|
|
|
return false;
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
|
2002-05-13 19:17:32 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-08-16 16:41:24 +00:00
|
|
|
bool CartridgeMC::bank(uInt16 b)
|
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
|
|
|
{
|
2010-03-28 03:13:10 +00:00
|
|
|
// Doesn't support bankswitching in the normal sense
|
2010-08-16 16:41:24 +00:00
|
|
|
return false;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-04-02 22:09:31 +00:00
|
|
|
uInt16 CartridgeMC::bank() 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
|
|
|
{
|
2009-06-17 17:04:55 +00:00
|
|
|
// TODO - add support for debugger
|
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 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-04-02 22:09:31 +00:00
|
|
|
uInt16 CartridgeMC::bankCount() 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
|
|
|
{
|
2009-06-17 17:04:55 +00:00
|
|
|
// TODO - add support for debugger
|
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 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
bool CartridgeMC::patch(uInt16 address, uInt8 value)
|
|
|
|
{
|
2009-06-17 17:04:55 +00:00
|
|
|
// TODO - add support for debugger
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-04-02 22:09:31 +00:00
|
|
|
const uInt8* CartridgeMC::getImage(int& size) 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
|
|
|
{
|
2010-04-08 21:22:15 +00:00
|
|
|
size = 128 * 1024;
|
2010-03-28 03:13:10 +00:00
|
|
|
return myImage;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
bool CartridgeMC::save(Serializer& out) const
|
2002-05-13 19:17:32 +00:00
|
|
|
{
|
2002-12-01 15:59:47 +00:00
|
|
|
try
|
|
|
|
{
|
2010-05-10 00:50:26 +00:00
|
|
|
out.putString(name());
|
2002-12-01 15:59:47 +00:00
|
|
|
|
|
|
|
// The currentBlock array
|
2012-05-20 14:23:48 +00:00
|
|
|
out.putByteArray(myCurrentBlock, 4);
|
2002-12-01 15:59:47 +00:00
|
|
|
|
|
|
|
// The 32K of RAM
|
2012-05-20 14:23:48 +00:00
|
|
|
out.putByteArray(myRAM, 32 * 1024);
|
2002-12-01 15:59:47 +00:00
|
|
|
}
|
2012-05-25 12:41:19 +00:00
|
|
|
catch(...)
|
2002-12-01 15:59:47 +00:00
|
|
|
{
|
2012-05-25 12:41:19 +00:00
|
|
|
cerr << "ERROR: CartridgeMC::save" << endl;
|
2002-12-01 15:59:47 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2002-05-13 19:17:32 +00:00
|
|
|
return 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
|
|
|
bool CartridgeMC::load(Serializer& in)
|
2002-05-13 19:17:32 +00:00
|
|
|
{
|
2002-12-01 15:59:47 +00:00
|
|
|
try
|
|
|
|
{
|
2010-05-10 00:50:26 +00:00
|
|
|
if(in.getString() != name())
|
2002-12-01 15:59:47 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
// The currentBlock array
|
2012-05-20 14:23:48 +00:00
|
|
|
in.getByteArray(myCurrentBlock, 4);
|
2002-12-01 15:59:47 +00:00
|
|
|
|
|
|
|
// The 32K of RAM
|
2012-05-20 14:23:48 +00:00
|
|
|
in.getByteArray(myRAM, 32 * 1024);
|
2002-12-01 15:59:47 +00:00
|
|
|
}
|
2012-05-25 12:41:19 +00:00
|
|
|
catch(...)
|
2002-12-01 15:59:47 +00:00
|
|
|
{
|
2012-05-25 12:41:19 +00:00
|
|
|
cerr << "ERROR: CartridgeMC::load" << endl;
|
2002-12-01 15:59:47 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2002-05-13 19:17:32 +00:00
|
|
|
return true;
|
|
|
|
}
|