2001-12-30 18:43:30 +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-30 18:43:30 +00:00
|
|
|
//
|
2010-01-10 03:23:32 +00:00
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
2001-12-30 18:43:30 +00:00
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//
|
2009-05-13 13:55:40 +00:00
|
|
|
// $Id$
|
2001-12-30 18:43:30 +00:00
|
|
|
//============================================================================
|
|
|
|
|
2009-05-25 17:51:52 +00:00
|
|
|
#include <cstring>
|
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-30 18:43:30 +00:00
|
|
|
#include "System.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 "CartDPC.hxx"
|
2002-03-28 01:48:28 +00:00
|
|
|
|
2001-12-30 18:43:30 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-08-19 21:48:28 +00:00
|
|
|
CartridgeDPC::CartridgeDPC(const uInt8* image, uInt32 size,
|
|
|
|
const Settings& settings)
|
|
|
|
: Cartridge(settings),
|
2013-04-18 16:57:33 +00:00
|
|
|
mySize(size),
|
2010-08-19 21:48:28 +00:00
|
|
|
mySystemCycles(0),
|
2010-04-02 18:56:50 +00:00
|
|
|
myFractionalClocks(0.0)
|
2001-12-30 18:43:30 +00:00
|
|
|
{
|
2010-05-02 22:52:59 +00:00
|
|
|
// Make a copy of the entire image
|
2013-04-18 16:57:33 +00:00
|
|
|
memcpy(myImage, image, BSPF_min(size, 8192u + 2048u + 256u));
|
2010-10-03 18:19:09 +00:00
|
|
|
createCodeAccessBase(8192);
|
2005-07-30 19:14:35 +00:00
|
|
|
|
2010-05-02 22:52:59 +00:00
|
|
|
// Pointer to the program ROM (8K @ 0 byte offset)
|
|
|
|
myProgramImage = myImage;
|
2001-12-30 18:43:30 +00:00
|
|
|
|
2010-05-02 22:52:59 +00:00
|
|
|
// Pointer to the display ROM (2K @ 8K offset)
|
|
|
|
myDisplayImage = myProgramImage + 8192;
|
2001-12-30 18:43:30 +00:00
|
|
|
|
|
|
|
// Initialize the DPC data fetcher registers
|
2013-04-20 22:23:42 +00:00
|
|
|
for(int i = 0; i < 8; ++i)
|
2002-11-19 04:29:21 +00:00
|
|
|
myTops[i] = myBottoms[i] = myCounters[i] = myFlags[i] = 0;
|
2001-12-30 18:43:30 +00:00
|
|
|
|
2002-11-19 04:29:21 +00:00
|
|
|
// None of the data fetchers are in music mode
|
|
|
|
myMusicMode[0] = myMusicMode[1] = myMusicMode[2] = false;
|
|
|
|
|
2001-12-30 18:43:30 +00:00
|
|
|
// Initialize the DPC's random number generator register (must be non-zero)
|
|
|
|
myRandomNumber = 1;
|
2002-11-19 04:29:21 +00:00
|
|
|
|
2010-03-05 22:02:12 +00:00
|
|
|
// Remember startup bank
|
|
|
|
myStartBank = 1;
|
2001-12-30 18:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
CartridgeDPC::~CartridgeDPC()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartridgeDPC::reset()
|
|
|
|
{
|
2002-11-19 04:29:21 +00:00
|
|
|
// Update cycles to the current system cycles
|
|
|
|
mySystemCycles = mySystem->cycles();
|
|
|
|
myFractionalClocks = 0.0;
|
|
|
|
|
2010-03-05 22:02:12 +00:00
|
|
|
// Upon reset we switch to the startup bank
|
|
|
|
bank(myStartBank);
|
2001-12-30 18:43:30 +00:00
|
|
|
}
|
|
|
|
|
2002-11-19 04:29:21 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartridgeDPC::systemCyclesReset()
|
|
|
|
{
|
|
|
|
// Get the current system cycle
|
|
|
|
uInt32 cycles = mySystem->cycles();
|
|
|
|
|
|
|
|
// Adjust the cycle counter so that it reflects the new value
|
|
|
|
mySystemCycles -= cycles;
|
|
|
|
}
|
|
|
|
|
2001-12-30 18:43:30 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartridgeDPC::install(System& system)
|
|
|
|
{
|
|
|
|
mySystem = &system;
|
2010-04-12 19:56:14 +00:00
|
|
|
|
2001-12-30 18:43:30 +00:00
|
|
|
// Set the page accessing method for the DPC reading & writing pages
|
2014-10-26 00:40:27 +00:00
|
|
|
System::PageAccess access(this, System::PA_READWRITE);
|
|
|
|
for(uInt32 j = 0x1000; j < 0x1080; j += (1 << System::PAGE_SHIFT))
|
|
|
|
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
|
2001-12-30 18:43:30 +00:00
|
|
|
|
2010-03-28 03:13:10 +00:00
|
|
|
// Install pages for the startup bank
|
|
|
|
bank(myStartBank);
|
2001-12-30 18:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
inline void CartridgeDPC::clockRandomNumberGenerator()
|
|
|
|
{
|
|
|
|
// Table for computing the input bit of the random number generator's
|
|
|
|
// shift register (it's the NOT of the EOR of four bits)
|
2002-11-19 04:29:21 +00:00
|
|
|
static const uInt8 f[16] = {
|
2001-12-30 18:43:30 +00:00
|
|
|
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1
|
|
|
|
};
|
|
|
|
|
|
|
|
// Using bits 7, 5, 4, & 3 of the shift register compute the input
|
|
|
|
// bit for the shift register
|
|
|
|
uInt8 bit = f[((myRandomNumber >> 3) & 0x07) |
|
|
|
|
((myRandomNumber & 0x80) ? 0x08 : 0x00)];
|
|
|
|
|
|
|
|
// Update the shift register
|
|
|
|
myRandomNumber = (myRandomNumber << 1) | bit;
|
|
|
|
}
|
|
|
|
|
2002-11-19 04:29:21 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
inline void CartridgeDPC::updateMusicModeDataFetchers()
|
|
|
|
{
|
|
|
|
// Calculate the number of cycles since the last update
|
|
|
|
Int32 cycles = mySystem->cycles() - mySystemCycles;
|
|
|
|
mySystemCycles = mySystem->cycles();
|
|
|
|
|
|
|
|
// Calculate the number of DPC OSC clocks since the last update
|
2009-05-01 11:25:07 +00:00
|
|
|
double clocks = ((20000.0 * cycles) / 1193191.66666667) + myFractionalClocks;
|
2002-11-19 04:29:21 +00:00
|
|
|
Int32 wholeClocks = (Int32)clocks;
|
|
|
|
myFractionalClocks = clocks - (double)wholeClocks;
|
|
|
|
|
|
|
|
if(wholeClocks <= 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Let's update counters and flags of the music mode data fetchers
|
|
|
|
for(int x = 5; x <= 7; ++x)
|
|
|
|
{
|
|
|
|
// Update only if the data fetcher is in music mode
|
|
|
|
if(myMusicMode[x - 5])
|
|
|
|
{
|
|
|
|
Int32 top = myTops[x] + 1;
|
|
|
|
Int32 newLow = (Int32)(myCounters[x] & 0x00ff);
|
|
|
|
|
|
|
|
if(myTops[x] != 0)
|
|
|
|
{
|
|
|
|
newLow -= (wholeClocks % top);
|
|
|
|
if(newLow < 0)
|
|
|
|
{
|
|
|
|
newLow += top;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
newLow = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update flag register for this data fetcher
|
|
|
|
if(newLow <= myBottoms[x])
|
|
|
|
{
|
|
|
|
myFlags[x] = 0x00;
|
|
|
|
}
|
|
|
|
else if(newLow <= myTops[x])
|
|
|
|
{
|
|
|
|
myFlags[x] = 0xff;
|
|
|
|
}
|
|
|
|
|
|
|
|
myCounters[x] = (myCounters[x] & 0x0700) | (uInt16)newLow;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-30 18:43:30 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
uInt8 CartridgeDPC::peek(uInt16 address)
|
|
|
|
{
|
2009-05-01 11:25:07 +00:00
|
|
|
address &= 0x0FFF;
|
2001-12-30 18:43:30 +00:00
|
|
|
|
2010-04-02 18:56:50 +00:00
|
|
|
// In debugger/bank-locked mode, we ignore all hotspots and in general
|
|
|
|
// anything that can change the internal state of the cart
|
|
|
|
if(bankLocked())
|
|
|
|
return myProgramImage[(myCurrentBank << 12) + address];
|
|
|
|
|
2001-12-30 18:43:30 +00:00
|
|
|
// Clock the random number generator. This should be done for every
|
|
|
|
// cartridge access, however, we're only doing it for the DPC and
|
|
|
|
// hot-spot accesses to save time.
|
|
|
|
clockRandomNumberGenerator();
|
|
|
|
|
|
|
|
if(address < 0x0040)
|
|
|
|
{
|
2002-11-19 04:29:21 +00:00
|
|
|
uInt8 result = 0;
|
|
|
|
|
2001-12-30 18:43:30 +00:00
|
|
|
// Get the index of the data fetcher that's being accessed
|
|
|
|
uInt32 index = address & 0x07;
|
|
|
|
uInt32 function = (address >> 3) & 0x07;
|
|
|
|
|
2002-11-19 04:29:21 +00:00
|
|
|
// Update flag register for selected data fetcher
|
2001-12-30 18:43:30 +00:00
|
|
|
if((myCounters[index] & 0x00ff) == myTops[index])
|
|
|
|
{
|
|
|
|
myFlags[index] = 0xff;
|
|
|
|
}
|
|
|
|
else if((myCounters[index] & 0x00ff) == myBottoms[index])
|
|
|
|
{
|
|
|
|
myFlags[index] = 0x00;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(function)
|
|
|
|
{
|
|
|
|
case 0x00:
|
|
|
|
{
|
|
|
|
// Is this a random number read
|
|
|
|
if(index < 4)
|
|
|
|
{
|
2002-11-19 04:29:21 +00:00
|
|
|
result = myRandomNumber;
|
2001-12-30 18:43:30 +00:00
|
|
|
}
|
2002-11-19 04:29:21 +00:00
|
|
|
// No, it's a music read
|
2001-12-30 18:43:30 +00:00
|
|
|
else
|
|
|
|
{
|
2002-11-19 04:29:21 +00:00
|
|
|
static const uInt8 musicAmplitudes[8] = {
|
|
|
|
0x00, 0x04, 0x05, 0x09, 0x06, 0x0a, 0x0b, 0x0f
|
|
|
|
};
|
|
|
|
|
|
|
|
// Update the music data fetchers (counter & flag)
|
|
|
|
updateMusicModeDataFetchers();
|
|
|
|
|
|
|
|
uInt8 i = 0;
|
|
|
|
if(myMusicMode[0] && myFlags[5])
|
|
|
|
{
|
|
|
|
i |= 0x01;
|
|
|
|
}
|
|
|
|
if(myMusicMode[1] && myFlags[6])
|
|
|
|
{
|
|
|
|
i |= 0x02;
|
|
|
|
}
|
|
|
|
if(myMusicMode[2] && myFlags[7])
|
|
|
|
{
|
|
|
|
i |= 0x04;
|
|
|
|
}
|
|
|
|
|
|
|
|
result = musicAmplitudes[i];
|
2001-12-30 18:43:30 +00:00
|
|
|
}
|
2002-11-19 04:29:21 +00:00
|
|
|
break;
|
2001-12-30 18:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// DFx display data read
|
|
|
|
case 0x01:
|
|
|
|
{
|
2002-11-19 04:29:21 +00:00
|
|
|
result = myDisplayImage[2047 - myCounters[index]];
|
|
|
|
break;
|
2001-12-30 18:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// DFx display data read AND'd w/flag
|
|
|
|
case 0x02:
|
|
|
|
{
|
2002-11-19 04:29:21 +00:00
|
|
|
result = myDisplayImage[2047 - myCounters[index]] & myFlags[index];
|
|
|
|
break;
|
2001-12-30 18:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// DFx flag
|
|
|
|
case 0x07:
|
|
|
|
{
|
2002-11-19 04:29:21 +00:00
|
|
|
result = myFlags[index];
|
|
|
|
break;
|
2001-12-30 18:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
2002-11-19 04:29:21 +00:00
|
|
|
result = 0;
|
2001-12-30 18:43:30 +00:00
|
|
|
}
|
|
|
|
}
|
2002-11-19 04:29:21 +00:00
|
|
|
|
|
|
|
// Clock the selected data fetcher's counter if needed
|
|
|
|
if((index < 5) || ((index >= 5) && (!myMusicMode[index - 5])))
|
|
|
|
{
|
|
|
|
myCounters[index] = (myCounters[index] - 1) & 0x07ff;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
2001-12-30 18:43:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Switch banks if necessary
|
|
|
|
switch(address)
|
|
|
|
{
|
|
|
|
case 0x0FF8:
|
|
|
|
// Set the current bank to the lower 4k bank
|
|
|
|
bank(0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x0FF9:
|
|
|
|
// Set the current bank to the upper 4k bank
|
|
|
|
bank(1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2010-03-28 03:13:10 +00:00
|
|
|
return myProgramImage[(myCurrentBank << 12) + address];
|
2001-12-30 18:43:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-03-28 03:13:10 +00:00
|
|
|
bool CartridgeDPC::poke(uInt16 address, uInt8 value)
|
2001-12-30 18:43:30 +00:00
|
|
|
{
|
2009-05-01 11:25:07 +00:00
|
|
|
address &= 0x0FFF;
|
2001-12-30 18:43:30 +00:00
|
|
|
|
|
|
|
// Clock the random number generator. This should be done for every
|
|
|
|
// cartridge access, however, we're only doing it for the DPC and
|
|
|
|
// hot-spot accesses to save time.
|
|
|
|
clockRandomNumberGenerator();
|
|
|
|
|
|
|
|
if((address >= 0x0040) && (address < 0x0080))
|
|
|
|
{
|
|
|
|
// Get the index of the data fetcher that's being accessed
|
|
|
|
uInt32 index = address & 0x07;
|
|
|
|
uInt32 function = (address >> 3) & 0x07;
|
|
|
|
|
|
|
|
switch(function)
|
|
|
|
{
|
|
|
|
// DFx top count
|
|
|
|
case 0x00:
|
|
|
|
{
|
|
|
|
myTops[index] = value;
|
2002-11-19 04:29:21 +00:00
|
|
|
myFlags[index] = 0x00;
|
2001-12-30 18:43:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// DFx bottom count
|
|
|
|
case 0x01:
|
|
|
|
{
|
|
|
|
myBottoms[index] = value;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// DFx counter low
|
|
|
|
case 0x02:
|
|
|
|
{
|
2002-11-19 04:29:21 +00:00
|
|
|
if((index >= 5) && myMusicMode[index - 5])
|
|
|
|
{
|
2010-03-30 20:36:13 +00:00
|
|
|
// Data fetcher is in music mode so its low counter value
|
2002-11-19 04:29:21 +00:00
|
|
|
// should be loaded from the top register not the poked value
|
|
|
|
myCounters[index] = (myCounters[index] & 0x0700) |
|
|
|
|
(uInt16)myTops[index];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-03-30 20:36:13 +00:00
|
|
|
// Data fetcher is either not a music mode data fetcher or it
|
2002-11-19 04:29:21 +00:00
|
|
|
// isn't in music mode so it's low counter value should be loaded
|
|
|
|
// with the poked value
|
|
|
|
myCounters[index] = (myCounters[index] & 0x0700) | (uInt16)value;
|
|
|
|
}
|
2001-12-30 18:43:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// DFx counter high
|
|
|
|
case 0x03:
|
|
|
|
{
|
|
|
|
myCounters[index] = (((uInt16)value & 0x07) << 8) |
|
|
|
|
(myCounters[index] & 0x00ff);
|
2002-11-19 04:29:21 +00:00
|
|
|
|
|
|
|
// Execute special code for music mode data fetchers
|
|
|
|
if(index >= 5)
|
|
|
|
{
|
|
|
|
myMusicMode[index - 5] = (value & 0x10);
|
|
|
|
|
|
|
|
// NOTE: We are not handling the clock source input for
|
|
|
|
// the music mode data fetchers. We're going to assume
|
|
|
|
// they always use the OSC input.
|
|
|
|
}
|
2001-12-30 18:43:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Random Number Generator Reset
|
|
|
|
case 0x06:
|
|
|
|
{
|
|
|
|
myRandomNumber = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Switch banks if necessary
|
|
|
|
switch(address)
|
|
|
|
{
|
|
|
|
case 0x0FF8:
|
|
|
|
// Set the current bank to the lower 4k bank
|
|
|
|
bank(0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x0FF9:
|
|
|
|
// Set the current bank to the upper 4k bank
|
|
|
|
bank(1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-03-28 03:13:10 +00:00
|
|
|
return false;
|
2001-12-30 18:43:30 +00:00
|
|
|
}
|
|
|
|
|
2002-05-13 19:17:32 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-08-16 16:41:24 +00:00
|
|
|
bool CartridgeDPC::bank(uInt16 bank)
|
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-08-16 16:41:24 +00:00
|
|
|
if(bankLocked()) 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
|
|
|
|
|
|
|
// Remember what bank we're in
|
|
|
|
myCurrentBank = bank;
|
2010-03-30 20:36:13 +00:00
|
|
|
uInt16 offset = myCurrentBank << 12;
|
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
|
|
|
|
2014-07-24 16:24:27 +00:00
|
|
|
System::PageAccess access(this, System::PA_READ);
|
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
|
|
|
|
The emulation core now tracks access to DATA areas (currently, any address
used as a peek operand). Still TODO is deal with poke areas, which would
be relevant in carts with extended RAM.
The interaction between the internal tracking and Distella is now much
tighter, in that knowledge gained by Distella is used in the core code,
and vice versa. This allows the best of both worlds, where the internal
tracking finds stuff at runtime (that couldn't be found in a static
analysis), and Distella tracks potential paths (that haven't occurred at
runtime yet).
Added 'type' debugger prompt command, which basically queries an address
for its disassembly type (CODE/GFX/DATA, etc).
Added debugger commands to query the last address used in an operation
for various registers, but they're only stubs at the moment.
Updated the bankswitch schemes to deal with accesses in and around the
hotspot areas. Previously, peek accesses in these areas weren't being
recorded as DATA areas.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2145 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-10-10 20:24:22 +00:00
|
|
|
// Set the page accessing methods for the hot spots
|
2014-10-26 00:40:27 +00:00
|
|
|
for(uInt32 i = (0x1FF8 & ~System::PAGE_MASK); i < 0x2000;
|
|
|
|
i += (1 << System::PAGE_SHIFT))
|
The emulation core now tracks access to DATA areas (currently, any address
used as a peek operand). Still TODO is deal with poke areas, which would
be relevant in carts with extended RAM.
The interaction between the internal tracking and Distella is now much
tighter, in that knowledge gained by Distella is used in the core code,
and vice versa. This allows the best of both worlds, where the internal
tracking finds stuff at runtime (that couldn't be found in a static
analysis), and Distella tracks potential paths (that haven't occurred at
runtime yet).
Added 'type' debugger prompt command, which basically queries an address
for its disassembly type (CODE/GFX/DATA, etc).
Added debugger commands to query the last address used in an operation
for various registers, but they're only stubs at the moment.
Updated the bankswitch schemes to deal with accesses in and around the
hotspot areas. Previously, peek accesses in these areas weren't being
recorded as DATA areas.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2145 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-10-10 20:24:22 +00:00
|
|
|
{
|
|
|
|
access.codeAccessBase = &myCodeAccessBase[offset + (i & 0x0FFF)];
|
2014-10-26 00:40:27 +00:00
|
|
|
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
|
The emulation core now tracks access to DATA areas (currently, any address
used as a peek operand). Still TODO is deal with poke areas, which would
be relevant in carts with extended RAM.
The interaction between the internal tracking and Distella is now much
tighter, in that knowledge gained by Distella is used in the core code,
and vice versa. This allows the best of both worlds, where the internal
tracking finds stuff at runtime (that couldn't be found in a static
analysis), and Distella tracks potential paths (that haven't occurred at
runtime yet).
Added 'type' debugger prompt command, which basically queries an address
for its disassembly type (CODE/GFX/DATA, etc).
Added debugger commands to query the last address used in an operation
for various registers, but they're only stubs at the moment.
Updated the bankswitch schemes to deal with accesses in and around the
hotspot areas. Previously, peek accesses in these areas weren't being
recorded as DATA areas.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2145 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-10-10 20:24:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Setup the page access methods for the current bank
|
2014-10-26 00:40:27 +00:00
|
|
|
for(uInt32 address = 0x1080; address < (0x1FF8U & ~System::PAGE_MASK);
|
|
|
|
address += (1 << System::PAGE_SHIFT))
|
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
|
|
|
{
|
|
|
|
access.directPeekBase = &myProgramImage[offset + (address & 0x0FFF)];
|
2010-10-03 18:19:09 +00:00
|
|
|
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x0FFF)];
|
2014-10-26 00:40:27 +00:00
|
|
|
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
|
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-08-16 16:41:24 +00:00
|
|
|
return myBankChanged = true;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-07-28 13:40:37 +00:00
|
|
|
uInt16 CartridgeDPC::getBank() 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
|
|
|
{
|
|
|
|
return myCurrentBank;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-04-02 22:09:31 +00:00
|
|
|
uInt16 CartridgeDPC::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
|
|
|
return 2;
|
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 CartridgeDPC::patch(uInt16 address, uInt8 value)
|
|
|
|
{
|
2010-03-30 20:36:13 +00:00
|
|
|
address &= 0x0FFF;
|
|
|
|
|
|
|
|
// For now, we ignore attempts to patch the DPC address space
|
|
|
|
if(address >= 0x0080)
|
|
|
|
{
|
|
|
|
myProgramImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
|
|
|
|
return myBankChanged = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
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
|
|
|
const uInt8* CartridgeDPC::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
|
|
|
{
|
2013-04-18 16:57:33 +00:00
|
|
|
size = mySize;
|
2010-05-02 22:52:59 +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 CartridgeDPC::save(Serializer& out) const
|
2002-05-13 19:17:32 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2010-05-10 00:50:26 +00:00
|
|
|
out.putString(name());
|
2002-05-13 19:17:32 +00:00
|
|
|
|
|
|
|
// Indicates which bank is currently active
|
2012-05-20 14:23:48 +00:00
|
|
|
out.putShort(myCurrentBank);
|
2002-05-13 19:17:32 +00:00
|
|
|
|
2002-11-19 04:29:21 +00:00
|
|
|
// The top registers for the data fetchers
|
2012-05-20 14:23:48 +00:00
|
|
|
out.putByteArray(myTops, 8);
|
2002-11-19 04:29:21 +00:00
|
|
|
|
2002-05-13 19:17:32 +00:00
|
|
|
// The bottom registers for the data fetchers
|
2012-05-20 14:23:48 +00:00
|
|
|
out.putByteArray(myBottoms, 8);
|
2002-05-13 19:17:32 +00:00
|
|
|
|
|
|
|
// The counter registers for the data fetchers
|
2012-05-20 14:23:48 +00:00
|
|
|
out.putShortArray(myCounters, 8);
|
2002-05-13 19:17:32 +00:00
|
|
|
|
|
|
|
// The flag registers for the data fetchers
|
2012-05-20 14:23:48 +00:00
|
|
|
out.putByteArray(myFlags, 8);
|
2002-05-13 19:17:32 +00:00
|
|
|
|
2002-11-19 04:29:21 +00:00
|
|
|
// The music mode flags for the data fetchers
|
2012-05-20 14:23:48 +00:00
|
|
|
for(int i = 0; i < 3; ++i)
|
2002-11-19 04:29:21 +00:00
|
|
|
out.putBool(myMusicMode[i]);
|
|
|
|
|
2002-05-13 19:17:32 +00:00
|
|
|
// The random number generator register
|
2012-05-20 14:23:48 +00:00
|
|
|
out.putByte(myRandomNumber);
|
2002-05-13 19:17:32 +00:00
|
|
|
|
2005-12-17 01:23:07 +00:00
|
|
|
out.putInt(mySystemCycles);
|
|
|
|
out.putInt((uInt32)(myFractionalClocks * 100000000.0));
|
2002-05-13 19:17:32 +00:00
|
|
|
}
|
2012-05-25 12:41:19 +00:00
|
|
|
catch(...)
|
2002-05-13 19:17:32 +00:00
|
|
|
{
|
2012-05-25 12:41:19 +00:00
|
|
|
cerr << "ERROR: CartridgeDPC::save" << endl;
|
2002-05-13 19:17:32 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
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 CartridgeDPC::load(Serializer& in)
|
2002-05-13 19:17:32 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2010-05-10 00:50:26 +00:00
|
|
|
if(in.getString() != name())
|
2002-05-13 19:17:32 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
// Indicates which bank is currently active
|
2012-05-20 14:23:48 +00:00
|
|
|
myCurrentBank = in.getShort();
|
2002-05-13 19:17:32 +00:00
|
|
|
|
2002-11-19 04:29:21 +00:00
|
|
|
// The top registers for the data fetchers
|
2012-05-20 14:23:48 +00:00
|
|
|
in.getByteArray(myTops, 8);
|
2002-11-19 04:29:21 +00:00
|
|
|
|
2002-05-13 19:17:32 +00:00
|
|
|
// The bottom registers for the data fetchers
|
2012-05-20 14:23:48 +00:00
|
|
|
in.getByteArray(myBottoms, 8);
|
2002-05-13 19:17:32 +00:00
|
|
|
|
|
|
|
// The counter registers for the data fetchers
|
2012-05-20 14:23:48 +00:00
|
|
|
in.getShortArray(myCounters, 8);
|
2002-05-13 19:17:32 +00:00
|
|
|
|
|
|
|
// The flag registers for the data fetchers
|
2012-05-20 14:23:48 +00:00
|
|
|
in.getByteArray(myFlags, 8);
|
2002-05-13 19:17:32 +00:00
|
|
|
|
2002-11-19 04:29:21 +00:00
|
|
|
// The music mode flags for the data fetchers
|
2012-05-20 14:23:48 +00:00
|
|
|
for(int i = 0; i < 3; ++i)
|
2002-11-19 04:29:21 +00:00
|
|
|
myMusicMode[i] = in.getBool();
|
|
|
|
|
2002-05-13 19:17:32 +00:00
|
|
|
// The random number generator register
|
2012-05-20 14:23:48 +00:00
|
|
|
myRandomNumber = in.getByte();
|
2002-05-13 19:17:32 +00:00
|
|
|
|
2002-11-19 04:29:21 +00:00
|
|
|
// Get system cycles and fractional clocks
|
2012-05-20 14:23:48 +00:00
|
|
|
mySystemCycles = (Int32)in.getInt();
|
2005-12-17 01:23:07 +00:00
|
|
|
myFractionalClocks = (double)in.getInt() / 100000000.0;
|
2002-05-13 19:17:32 +00:00
|
|
|
}
|
2012-05-25 12:41:19 +00:00
|
|
|
catch(...)
|
2002-05-13 19:17:32 +00:00
|
|
|
{
|
2012-05-25 12:41:19 +00:00
|
|
|
cerr << "ERROR: CartridgeDPC::load" << endl;
|
2002-05-13 19:17:32 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Now, go to the current bank
|
|
|
|
bank(myCurrentBank);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|