2001-12-27 19:54:36 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// MM MM 6666 555555 0000 2222
|
|
|
|
// MMMM MMMM 66 66 55 00 00 22 22
|
|
|
|
// MM MMM MM 66 55 00 00 22
|
|
|
|
// MM M MM 66666 55555 00 00 22222 -- "A 6502 Microprocessor Emulator"
|
|
|
|
// MM MM 66 66 55 00 00 22
|
|
|
|
// MM MM 66 66 55 55 00 00 22
|
|
|
|
// MM MM 6666 5555 0000 222222
|
|
|
|
//
|
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-27 19:54:36 +00:00
|
|
|
//
|
2010-01-10 03:23:32 +00:00
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
2001-12-27 19:54:36 +00:00
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//
|
2009-05-13 13:55:40 +00:00
|
|
|
// $Id$
|
2001-12-27 19:54:36 +00:00
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#ifndef SYSTEM_HXX
|
|
|
|
#define SYSTEM_HXX
|
|
|
|
|
|
|
|
class Device;
|
|
|
|
class M6502;
|
2008-02-19 12:33:07 +00:00
|
|
|
class M6532;
|
2005-07-09 12:52:46 +00:00
|
|
|
class TIA;
|
2001-12-27 19:54:36 +00:00
|
|
|
class NullDevice;
|
|
|
|
|
|
|
|
#include "bspf.hxx"
|
|
|
|
#include "Device.hxx"
|
|
|
|
#include "NullDev.hxx"
|
2009-11-08 01:39:05 +00:00
|
|
|
#include "Random.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 "Serializable.hxx"
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
This class represents a system consisting of a 6502 microprocessor
|
|
|
|
and a set of devices. The devices are mapped into an addressing
|
|
|
|
space of 2^n bytes (1 <= n <= 16). The addressing space is broken
|
|
|
|
into 2^m byte pages (1 <= m <= n), where a page is the smallest unit
|
|
|
|
a device can use when installing itself in the system.
|
|
|
|
|
|
|
|
In general the addressing space will be 8192 (2^13) bytes for a
|
|
|
|
6507 based system and 65536 (2^16) bytes for a 6502 based system.
|
|
|
|
|
|
|
|
@author Bradford W. Mott
|
2009-05-13 13:55:40 +00:00
|
|
|
@version $Id$
|
2001-12-27 19:54:36 +00:00
|
|
|
*/
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
class System : public Serializable
|
2001-12-27 19:54:36 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2014-10-26 00:40:27 +00:00
|
|
|
Create a new system with an addressing space of 2^13 bytes and
|
|
|
|
pages of 2^6 bytes.
|
2001-12-27 19:54:36 +00:00
|
|
|
*/
|
2014-11-03 16:24:05 +00:00
|
|
|
System(const OSystem& osystem, M6502& m6502, M6532& m6532,
|
|
|
|
TIA& mTIA, Cartridge& mCart);
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor
|
|
|
|
*/
|
|
|
|
virtual ~System();
|
|
|
|
|
2014-10-26 00:40:27 +00:00
|
|
|
// Mask to apply to an address before accessing memory
|
|
|
|
static const uInt16 ADDRESS_MASK = (1 << 13) - 1;
|
|
|
|
|
|
|
|
// Amount to shift an address by to determine what page it's on
|
|
|
|
static const uInt16 PAGE_SHIFT = 6;
|
|
|
|
|
|
|
|
// Mask to apply to an address to obtain its page offset
|
|
|
|
static const uInt16 PAGE_MASK = (1 << PAGE_SHIFT) - 1;
|
|
|
|
|
|
|
|
// Number of pages in the system
|
|
|
|
static const uInt16 NUM_PAGES = 1 << (13 - PAGE_SHIFT);
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
public:
|
2014-11-03 16:24:05 +00:00
|
|
|
/**
|
|
|
|
Initialize system and all attached devices to known state.
|
|
|
|
*/
|
|
|
|
void initialize();
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
/**
|
|
|
|
Reset the system cycle counter, the attached devices, and the
|
|
|
|
attached processor of the system.
|
2011-05-24 16:04:48 +00:00
|
|
|
|
|
|
|
@param autodetect A hint to devices that the system is currently
|
|
|
|
in autodetect mode. That is, the system is being
|
|
|
|
run to autodetect certain device settings before
|
|
|
|
actual emulation will begin. Certain devices may
|
|
|
|
use this hint to act differently under those
|
|
|
|
circumstances.
|
2001-12-27 19:54:36 +00:00
|
|
|
*/
|
2011-05-24 16:04:48 +00:00
|
|
|
void reset(bool autodetect = false);
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Answer the 6502 microprocessor attached to the system. If a
|
|
|
|
processor has not been attached calling this function will fail.
|
|
|
|
|
|
|
|
@return The attached 6502 microprocessor
|
|
|
|
*/
|
2014-11-03 16:24:05 +00:00
|
|
|
M6502& m6502() const { return myM6502; }
|
2001-12-27 19:54:36 +00:00
|
|
|
|
2008-02-19 12:33:07 +00:00
|
|
|
/**
|
|
|
|
Answer the 6532 processor attached to the system. If a
|
|
|
|
processor has not been attached calling this function will fail.
|
|
|
|
|
|
|
|
@return The attached 6532 microprocessor
|
|
|
|
*/
|
2014-11-03 16:24:05 +00:00
|
|
|
M6532& m6532() const { return myM6532; }
|
2008-02-19 12:33:07 +00:00
|
|
|
|
2005-07-09 12:52:46 +00:00
|
|
|
/**
|
|
|
|
Answer the TIA device attached to the system.
|
|
|
|
|
|
|
|
@return The attached TIA device
|
|
|
|
*/
|
2014-11-03 16:24:05 +00:00
|
|
|
TIA& tia() const { return myTIA; }
|
2005-07-09 12:52:46 +00:00
|
|
|
|
2009-11-08 01:39:05 +00:00
|
|
|
/**
|
|
|
|
Answer the random generator attached to the system.
|
|
|
|
|
|
|
|
@return The random generator
|
|
|
|
*/
|
2014-10-26 15:54:02 +00:00
|
|
|
Random& randGenerator() const { return myOSystem.random(); }
|
2009-11-08 01:39:05 +00:00
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
/**
|
|
|
|
Get the null device associated with the system. Every system
|
|
|
|
has a null device associated with it that's used by pages which
|
|
|
|
aren't mapped to "real" devices.
|
|
|
|
|
|
|
|
@return The null device associated with the system
|
|
|
|
*/
|
2014-10-21 23:02:20 +00:00
|
|
|
const NullDevice& nullDevice() const { return myNullDevice; }
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Get the number of system cycles which have passed since the last
|
|
|
|
time cycles were reset or the system was reset.
|
|
|
|
|
|
|
|
@return The number of system cycles which have passed
|
|
|
|
*/
|
2011-05-10 15:04:19 +00:00
|
|
|
uInt32 cycles() const { return myCycles; }
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Increment the system cycles by the specified number of cycles.
|
|
|
|
|
|
|
|
@param amount The amount to add to the system cycles counter
|
|
|
|
*/
|
2013-05-30 16:07:19 +00:00
|
|
|
void incrementCycles(uInt32 amount) { myCycles += amount; }
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Reset the system cycle count to zero. The first thing that
|
|
|
|
happens is that all devices are notified of the reset by invoking
|
|
|
|
their systemCyclesReset method then the system cycle count is
|
|
|
|
reset to zero.
|
|
|
|
*/
|
|
|
|
void resetCycles();
|
|
|
|
|
2011-05-24 16:04:48 +00:00
|
|
|
/**
|
|
|
|
Answers whether the system is currently in device autodetect mode.
|
|
|
|
*/
|
2012-06-03 18:05:14 +00:00
|
|
|
bool autodetectMode() const { return mySystemInAutodetect; }
|
2011-05-24 16:04:48 +00:00
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
public:
|
2001-12-30 18:36:02 +00:00
|
|
|
/**
|
|
|
|
Get the current state of the data bus in the system. The current
|
|
|
|
state is the last data that was accessed by the system.
|
|
|
|
|
2009-11-08 01:39:05 +00:00
|
|
|
@return The data bus state
|
2001-12-30 18:36:02 +00:00
|
|
|
*/
|
2011-05-10 15:04:19 +00:00
|
|
|
uInt8 getDataBusState() const { return myDataBusState; }
|
2001-12-30 18:36:02 +00:00
|
|
|
|
2009-11-08 01:39:05 +00:00
|
|
|
/**
|
|
|
|
Get the current state of the data bus in the system, taking into
|
|
|
|
account that certain bits are in Z-state (undriven). In those
|
|
|
|
cases, the bits are floating, but will usually be the same as the
|
|
|
|
last data bus value (the 'usually' is emulated by randomly driving
|
|
|
|
certain bits high).
|
|
|
|
|
|
|
|
However, some CMOS EPROM chips always drive Z-state bits high.
|
|
|
|
This is emulated by hmask, which specifies to push a specific
|
|
|
|
Z-state bit high.
|
|
|
|
|
|
|
|
@param zmask The bits which are in Z-state
|
|
|
|
@param hmask The bits which should always be driven high
|
|
|
|
@return The data bus state
|
|
|
|
*/
|
2011-05-10 15:04:19 +00:00
|
|
|
uInt8 getDataBusState(uInt8 zmask, uInt8 hmask = 0x00)
|
2009-11-08 01:39:05 +00:00
|
|
|
{
|
|
|
|
// For the pins that are floating, randomly decide which are high or low
|
|
|
|
// Otherwise, they're specifically driven high
|
2014-10-26 15:54:02 +00:00
|
|
|
return (myDataBusState | (randGenerator().next() | hmask)) & zmask;
|
2009-11-08 01:39:05 +00:00
|
|
|
}
|
|
|
|
|
2001-12-30 18:36:02 +00:00
|
|
|
/**
|
2001-12-27 19:54:36 +00:00
|
|
|
Get the byte at the specified address. No masking of the
|
|
|
|
address occurs before it's sent to the device mapped at
|
|
|
|
the address.
|
|
|
|
|
2010-10-03 00:23:13 +00:00
|
|
|
@param address The address from which the value should be loaded
|
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
|
|
|
@param flags Indicates that this address has the given flags
|
|
|
|
for type of access (CODE, DATA, GFX, etc)
|
2010-10-03 00:23:13 +00:00
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
@return The byte at the specified address
|
|
|
|
*/
|
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
|
|
|
uInt8 peek(uInt16 address, uInt8 flags = 0);
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Change the byte at the specified address to the given value.
|
|
|
|
No masking of the address occurs before it's sent to the device
|
|
|
|
mapped at the address.
|
|
|
|
|
2010-03-28 03:13:10 +00:00
|
|
|
This method sets the 'page dirty' if the write succeeds. In the
|
|
|
|
case of direct-access pokes, the write always succeeds. Otherwise,
|
|
|
|
if the device is handling the poke, we depend on its return value
|
|
|
|
for this information.
|
2010-03-26 00:59:56 +00:00
|
|
|
|
2010-10-03 00:23:13 +00:00
|
|
|
@param address The address where the value should be stored
|
|
|
|
@param value The value to be stored at the address
|
2001-12-27 19:54:36 +00:00
|
|
|
*/
|
|
|
|
void poke(uInt16 address, uInt8 value);
|
|
|
|
|
2005-07-09 23:44:08 +00:00
|
|
|
/**
|
|
|
|
Lock/unlock the data bus. When the bus is locked, peek() and
|
|
|
|
poke() don't update the bus state. The bus should be unlocked
|
|
|
|
while the CPU is running (normal emulation, or when the debugger
|
|
|
|
is stepping/advancing). It should be locked while the debugger
|
|
|
|
is active but not running the CPU. This is so the debugger can
|
|
|
|
use System.peek() to examine memory/registers without changing
|
|
|
|
the state of the system.
|
|
|
|
*/
|
2014-10-21 22:12:50 +00:00
|
|
|
void lockDataBus() { myDataBusLocked = true; }
|
|
|
|
void unlockDataBus() { myDataBusLocked = false; }
|
2005-07-09 23:44:08 +00:00
|
|
|
|
2010-10-03 00:23:13 +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
|
|
|
Access and modify the disassembly type flags for the given
|
|
|
|
address. Note that while any flag can be used, the disassembly
|
2013-03-10 22:12:37 +00:00
|
|
|
only really acts on CODE/GFX/PGFX/DATA/ROW.
|
2010-10-03 00:23:13 +00:00
|
|
|
*/
|
2014-10-21 22:12:50 +00:00
|
|
|
uInt8 getAccessFlags(uInt16 address) const;
|
2010-11-12 18:54:08 +00:00
|
|
|
void setAccessFlags(uInt16 address, uInt8 flags);
|
2010-10-03 00:23:13 +00:00
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
public:
|
2010-04-14 23:49:02 +00:00
|
|
|
/**
|
|
|
|
Describes how a page can be accessed
|
|
|
|
*/
|
2010-04-14 22:35:46 +00:00
|
|
|
enum PageAccessType {
|
|
|
|
PA_READ = 1 << 0,
|
|
|
|
PA_WRITE = 1 << 1,
|
|
|
|
PA_READWRITE = PA_READ | PA_WRITE
|
2010-04-14 23:49:02 +00:00
|
|
|
};
|
2010-04-12 19:56:14 +00:00
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
/**
|
|
|
|
Structure used to specify access methods for a page
|
|
|
|
*/
|
|
|
|
struct PageAccess
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
Pointer to a block of memory or the null pointer. The null pointer
|
|
|
|
indicates that the device's peek method should be invoked for reads
|
|
|
|
to this page, while other values are the base address of an array
|
|
|
|
to directly access for reads to this page.
|
|
|
|
*/
|
|
|
|
uInt8* directPeekBase;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Pointer to a block of memory or the null pointer. The null pointer
|
|
|
|
indicates that the device's poke method should be invoked for writes
|
|
|
|
to this page, while other values are the base address of an array
|
|
|
|
to directly access for pokes to this page.
|
|
|
|
*/
|
|
|
|
uInt8* directPokeBase;
|
|
|
|
|
2010-10-03 00:23:13 +00:00
|
|
|
/**
|
|
|
|
Pointer to a lookup table for marking an address as CODE. A CODE
|
|
|
|
section is defined as any address that appears in the program
|
|
|
|
counter. Currently, this is used by the debugger/disassembler to
|
|
|
|
conclusively determine if a section of address space is CODE, even
|
|
|
|
if the disassembler failed to mark it as such.
|
|
|
|
*/
|
|
|
|
uInt8* codeAccessBase;
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
/**
|
|
|
|
Pointer to the device associated with this page or to the system's
|
2010-04-12 19:56:14 +00:00
|
|
|
null device if the page hasn't been mapped to a device.
|
2001-12-27 19:54:36 +00:00
|
|
|
*/
|
|
|
|
Device* device;
|
2010-04-12 19:56:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
The manner in which the pages are accessed by the system
|
2010-04-14 22:35:46 +00:00
|
|
|
(READ, WRITE, READWRITE)
|
2010-04-12 19:56:14 +00:00
|
|
|
*/
|
2010-04-14 22:35:46 +00:00
|
|
|
PageAccessType type;
|
2010-10-03 00:23:13 +00:00
|
|
|
|
|
|
|
// Constructors
|
|
|
|
PageAccess()
|
|
|
|
: directPeekBase(0),
|
|
|
|
directPokeBase(0),
|
|
|
|
codeAccessBase(0),
|
|
|
|
device(0),
|
|
|
|
type(System::PA_READ) { }
|
|
|
|
|
2014-07-24 16:24:27 +00:00
|
|
|
PageAccess(Device* dev, PageAccessType access)
|
|
|
|
: directPeekBase(0),
|
|
|
|
directPokeBase(0),
|
|
|
|
codeAccessBase(0),
|
2010-10-03 00:23:13 +00:00
|
|
|
device(dev),
|
|
|
|
type(access) { }
|
|
|
|
};
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Set the page accessing method for the specified page.
|
|
|
|
|
|
|
|
@param page The page accessing methods should be set for
|
|
|
|
@param access The accessing methods to be used by the page
|
|
|
|
*/
|
|
|
|
void setPageAccess(uInt16 page, const PageAccess& access);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Get the page accessing method for the specified page.
|
|
|
|
|
|
|
|
@param page The page to get accessing methods for
|
|
|
|
@return The accessing methods used by the page
|
|
|
|
*/
|
2010-03-26 01:33:40 +00:00
|
|
|
const PageAccess& getPageAccess(uInt16 page) const;
|
2001-12-27 19:54:36 +00:00
|
|
|
|
2010-04-12 19:56:14 +00:00
|
|
|
/**
|
|
|
|
Get the page type for the given address.
|
|
|
|
|
|
|
|
@param addr The address contained in the page in questions
|
|
|
|
@return The type of page that contains the given address
|
|
|
|
*/
|
2010-04-14 22:35:46 +00:00
|
|
|
System::PageAccessType getPageAccessType(uInt16 addr) const;
|
2010-04-12 19:56:14 +00:00
|
|
|
|
2010-03-26 00:59:56 +00:00
|
|
|
/**
|
|
|
|
Mark the page containing this address as being dirty.
|
|
|
|
|
|
|
|
@param addr Determines the page that is dirty
|
|
|
|
*/
|
2010-03-26 01:33:40 +00:00
|
|
|
void setDirtyPage(uInt16 addr);
|
2010-03-26 00:59:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Answer whether any pages in given range of addresses have been
|
|
|
|
marked as dirty.
|
|
|
|
|
|
|
|
@param start_addr The start address; determines the start page
|
|
|
|
@param end_addr The end address; determines the end page
|
|
|
|
*/
|
2010-03-26 01:33:40 +00:00
|
|
|
bool isPageDirty(uInt16 start_addr, uInt16 end_addr) const;
|
2010-03-26 00:59:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Mark all pages as clean (ie, turn off the dirty flag).
|
|
|
|
*/
|
2010-03-26 01:33:40 +00:00
|
|
|
void clearDirtyPages();
|
2010-03-26 00:59:56 +00:00
|
|
|
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
/**
|
|
|
|
Save the current state of this system to the given Serializer.
|
|
|
|
|
|
|
|
@param out The Serializer object to use
|
|
|
|
@return False on any errors, else true
|
|
|
|
*/
|
|
|
|
bool save(Serializer& out) const;
|
|
|
|
|
|
|
|
/**
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
Load the current state of this system from the given Serializer.
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
@param in The Serializer object to use
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
@return False on any errors, else true
|
|
|
|
*/
|
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 load(Serializer& in);
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Get a descriptor for the device name (used in error checking).
|
|
|
|
|
|
|
|
@return The name of the object
|
|
|
|
*/
|
2010-03-29 02:21:32 +00:00
|
|
|
string name() const { return "System"; }
|
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-27 19:54:36 +00:00
|
|
|
private:
|
2014-10-26 15:54:02 +00:00
|
|
|
const OSystem& myOSystem;
|
|
|
|
|
2014-11-03 16:24:05 +00:00
|
|
|
// 6502 processor attached to the system
|
|
|
|
M6502& myM6502;
|
2001-12-27 19:54:36 +00:00
|
|
|
|
2014-11-03 16:24:05 +00:00
|
|
|
// 6532 processor attached to the system
|
|
|
|
M6532& myM6532;
|
2001-12-27 19:54:36 +00:00
|
|
|
|
2014-11-03 16:24:05 +00:00
|
|
|
// TIA device attached to the system
|
|
|
|
TIA& myTIA;
|
2008-02-19 12:33:07 +00:00
|
|
|
|
2014-11-03 16:24:05 +00:00
|
|
|
// Cartridge device attached to the system
|
|
|
|
Cartridge& myCart;
|
2005-07-09 12:52:46 +00:00
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
// Number of system cycles executed since the last reset
|
|
|
|
uInt32 myCycles;
|
|
|
|
|
|
|
|
// Null device to use for page which are not installed
|
|
|
|
NullDevice myNullDevice;
|
|
|
|
|
2014-11-03 16:24:05 +00:00
|
|
|
// Pointer to a dynamically allocated array of PageAccess structures
|
|
|
|
PageAccess* myPageAccessTable;
|
|
|
|
|
|
|
|
// Pointer to a dynamically allocated array for dirty pages
|
|
|
|
bool* myPageIsDirtyTable;
|
|
|
|
|
2001-12-30 18:36:02 +00:00
|
|
|
// The current state of the Data Bus
|
|
|
|
uInt8 myDataBusState;
|
|
|
|
|
2005-07-09 23:44:08 +00:00
|
|
|
// Whether or not peek() updates the data bus state. This
|
|
|
|
// is true during normal emulation, and false when the
|
|
|
|
// debugger is active.
|
|
|
|
bool myDataBusLocked;
|
|
|
|
|
2011-05-24 16:04:48 +00:00
|
|
|
// Whether autodetection is currently running (ie, the emulation
|
|
|
|
// core is attempting to autodetect display settings, cart modes, etc)
|
|
|
|
// Some parts of the codebase need to act differently in such a case
|
|
|
|
bool mySystemInAutodetect;
|
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
private:
|
2014-10-26 19:51:02 +00:00
|
|
|
// Copy constructor and assignment operator not supported
|
2001-12-27 19:54:36 +00:00
|
|
|
System(const System&);
|
|
|
|
System& operator = (const System&);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|