8
8
// MM MM 66 66 55 55 00 00 22
9
9
// MM MM 6666 5555 0000 222222
11
// Copyright (c) 1995-2002 by Bradford W. Mott
11
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
13
13
// See the file "license" for information on usage and redistribution of
14
14
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
16
// $Id: System.hxx,v 1.3 2002/05/13 19:10:25 stephena Exp $
16
// $Id: System.hxx,v 1.14 2006/02/10 13:14:20 stephena Exp $
17
17
//============================================================================
106
107
void attach(M6502* m6502);
110
Attach the specified TIA device and claim ownership of it. The device
111
will be asked to install itself.
113
@param tia The TIA device to attach to the system
115
void attach(TIA* tia);
109
118
Saves the current state of Stella to the given file. Calls
110
119
save on every device and CPU attached to this system.
112
@param out The serializer device to save to.
113
@return The result of the save. Error codes as follows:
115
2 file could not be opened for read/write
121
@param md5sum MD5 of the current ROM
122
@param out The serializer device to save to
124
@return False on any errors, else true
118
int saveState(string& fileName, string& md5sum);
126
bool saveState(const string& md5sum, Serializer& out);
121
129
Loads the current state of Stella from the given file. Calls
122
130
load on every device and CPU attached to this system.
124
@param in The deserializer device to load from.
125
@return The result of the load. Error codes as follows:
127
2 file could not be opened for read/write
132
@param md5sum MD5 of the current ROM
133
@param in The deserializer device to load from
135
@return False on any errors, else true
130
int loadState(string& fileName, string& md5sum);
137
bool loadState(const string& md5sum, Deserializer& in);
152
Answer the TIA device attached to the system.
154
@return The attached TIA device
145
162
Get the null device associated with the system. Every system
146
163
has a null device associated with it that's used by pages which
147
164
aren't mapped to "real" devices.
242
259
void poke(uInt16 address, uInt8 value);
262
Lock/unlock the data bus. When the bus is locked, peek() and
263
poke() don't update the bus state. The bus should be unlocked
264
while the CPU is running (normal emulation, or when the debugger
265
is stepping/advancing). It should be locked while the debugger
266
is active but not running the CPU. This is so the debugger can
267
use System.peek() to examine memory/registers without changing
268
the state of the system.
271
void unlockDataBus();
246
275
Structure used to specify access methods for a page
320
352
// The current state of the Data Bus
321
353
uInt8 myDataBusState;
323
// The serializer for the system. Used to save state.
324
Serializer* serializer;
326
// The deserializer for the system. Used to load state.
327
Deserializer* deserializer;
355
// Whether or not peek() updates the data bus state. This
356
// is true during normal emulation, and false when the
357
// debugger is active.
358
bool myDataBusLocked;
330
361
// Copy constructor isn't supported by this class so make it private
340
371
return myDataBusState;
343
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
344
inline uInt8 System::peek(uInt16 addr)
346
PageAccess& access = myPageAccessTable[(addr & myAddressMask) >> myPageShift];
350
// See if this page uses direct accessing or not
351
if(access.directPeekBase != 0)
353
result = *(access.directPeekBase + (addr & myPageMask));
357
result = access.device->peek(addr);
360
myDataBusState = result;
365
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
366
inline void System::poke(uInt16 addr, uInt8 value)
368
PageAccess& access = myPageAccessTable[(addr & myAddressMask) >> myPageShift];
370
// See if this page uses direct accessing or not
371
if(access.directPokeBase != 0)
373
*(access.directPokeBase + (addr & myPageMask)) = value;
377
access.device->poke(addr, value);
380
myDataBusState = value;