Turned variable into static constant in M6502, since it has never changed

since Stella was created.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3033 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-11-03 13:22:57 +00:00
parent 49bc759bee
commit a21f3be6e4
3 changed files with 12 additions and 17 deletions

View File

@ -97,7 +97,7 @@ Console::Console(OSystem& osystem, Cartridge& cart, const Properties& props)
myControllers[0] = new Joystick(Controller::Left, myEvent, *mySystem);
myControllers[1] = new Joystick(Controller::Right, myEvent, *mySystem);
M6502* m6502 = new M6502(1, myOSystem.settings());
M6502* m6502 = new M6502(myOSystem.settings());
myRiot = new M6532(*this, myOSystem.settings());
myTIA = new TIA(*this, myOSystem.sound(), myOSystem.settings());

View File

@ -47,11 +47,10 @@
#include "M6502.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M6502::M6502(uInt32 systemCyclesPerProcessorCycle, const Settings& settings)
M6502::M6502(const Settings& settings)
: myExecutionStatus(0),
mySystem(0),
mySettings(settings),
mySystemCyclesPerProcessorCycle(systemCyclesPerProcessorCycle),
myLastAccessWasRead(true),
myTotalInstructionCount(0),
myNumberOfDistinctAccesses(0),
@ -77,7 +76,7 @@ M6502::M6502(uInt32 systemCyclesPerProcessorCycle, const Settings& settings)
for(uInt32 t = 0; t < 256; ++t)
{
myInstructionSystemCycleTable[t] = ourInstructionCycleTable[t] *
mySystemCyclesPerProcessorCycle;
SYSTEM_CYCLES_PER_CPU;
}
#ifdef DEBUG_OUTPUT
@ -147,7 +146,7 @@ inline uInt8 M6502::peek(uInt16 address, uInt8 flags)
myLastAddress = address;
}
////////////////////////////////////////////////
mySystem->incrementCycles(mySystemCyclesPerProcessorCycle);
mySystem->incrementCycles(SYSTEM_CYCLES_PER_CPU);
#ifdef DEBUGGER_SUPPORT
if(myReadTraps != NULL && myReadTraps->isSet(address))
@ -176,7 +175,7 @@ inline void M6502::poke(uInt16 address, uInt8 value)
myLastAddress = address;
}
////////////////////////////////////////////////
mySystem->incrementCycles(mySystemCyclesPerProcessorCycle);
mySystem->incrementCycles(SYSTEM_CYCLES_PER_CPU);
#ifdef DEBUGGER_SUPPORT
if(myWriteTraps != NULL && myWriteTraps->isSet(address))
@ -306,7 +305,7 @@ void M6502::interruptHandler()
// Handle the interrupt
if((myExecutionStatus & MaskableInterruptBit) && !I)
{
mySystem->incrementCycles(7 * mySystemCyclesPerProcessorCycle);
mySystem->incrementCycles(7 * SYSTEM_CYCLES_PER_CPU);
mySystem->poke(0x0100 + SP--, (PC - 1) >> 8);
mySystem->poke(0x0100 + SP--, (PC - 1) & 0x00ff);
mySystem->poke(0x0100 + SP--, PS() & (~0x10));
@ -316,7 +315,7 @@ void M6502::interruptHandler()
}
else if(myExecutionStatus & NonmaskableInterruptBit)
{
mySystem->incrementCycles(7 * mySystemCyclesPerProcessorCycle);
mySystem->incrementCycles(7 * SYSTEM_CYCLES_PER_CPU);
mySystem->poke(0x0100 + SP--, (PC - 1) >> 8);
mySystem->poke(0x0100 + SP--, (PC - 1) & 0x00ff);
mySystem->poke(0x0100 + SP--, PS() & (~0x10));

View File

@ -56,13 +56,9 @@ class M6502 : public Serializable
public:
/**
Create a new 6502 microprocessor with the specified cycle
multiplier. The cycle multiplier is the number of system cycles
per processor cycle.
@param systemCyclesPerProcessorCycle The cycle multiplier
Create a new 6502 microprocessor.
*/
M6502(uInt32 systemCyclesPerProcessorCycle, const Settings& settings);
M6502(const Settings& settings);
/**
Destructor
@ -324,9 +320,6 @@ class M6502 : public Serializable
/// Reference to the settings
const Settings& mySettings;
/// Indicates the number of system cycles per processor cycle
const uInt32 mySystemCyclesPerProcessorCycle;
/// Table of system cycles for each instruction
uInt32 myInstructionSystemCycleTable[256];
@ -357,6 +350,9 @@ class M6502 : public Serializable
/// is set to zero
uInt16 myDataAddressForPoke;
/// Indicates the number of system cycles per processor cycle
static const uInt32 SYSTEM_CYCLES_PER_CPU = 1;
#ifdef DEBUGGER_SUPPORT
/// Pointer to the debugger for this processor or the null pointer
Debugger* myDebugger;