mirror of https://github.com/stella-emu/stella.git
added a few more FORCE_INLINE and inline hints
This commit is contained in:
parent
50d2155d1b
commit
b1f100147f
|
@ -64,7 +64,7 @@ class BreakpointMap
|
||||||
|
|
||||||
BreakpointMap() = default;
|
BreakpointMap() = default;
|
||||||
|
|
||||||
bool isInitialized() const { return myInitialized; }
|
inline bool isInitialized() const { return myInitialized; }
|
||||||
|
|
||||||
/** Add new breakpoint */
|
/** Add new breakpoint */
|
||||||
void add(const Breakpoint& breakpoint, const uInt32 flags = 0);
|
void add(const Breakpoint& breakpoint, const uInt32 flags = 0);
|
||||||
|
|
|
@ -139,7 +139,7 @@ class TimerMap
|
||||||
|
|
||||||
explicit TimerMap() = default;
|
explicit TimerMap() = default;
|
||||||
|
|
||||||
bool isInitialized() const { return myList.size(); }
|
inline bool isInitialized() const { return myList.size(); }
|
||||||
|
|
||||||
/** Add new timer */
|
/** Add new timer */
|
||||||
uInt32 add(uInt16 fromAddr, uInt16 toAddr,
|
uInt32 add(uInt16 fromAddr, uInt16 toAddr,
|
||||||
|
|
|
@ -25,8 +25,8 @@ class TrapArray
|
||||||
public:
|
public:
|
||||||
TrapArray() = default;
|
TrapArray() = default;
|
||||||
|
|
||||||
bool isSet(const uInt16 address) const { return myCount[address]; }
|
inline bool isSet(const uInt16 address) const { return myCount[address]; }
|
||||||
bool isClear(const uInt16 address) const { return myCount[address] == 0; }
|
inline bool isClear(const uInt16 address) const { return myCount[address] == 0; }
|
||||||
|
|
||||||
void add(const uInt16 address) { myCount[address]++; }
|
void add(const uInt16 address) { myCount[address]++; }
|
||||||
void remove(const uInt16 address) { myCount[address]--; }
|
void remove(const uInt16 address) { myCount[address]--; }
|
||||||
|
@ -39,7 +39,7 @@ class TrapArray
|
||||||
}
|
}
|
||||||
void clearAll() { myInitialized = false; myCount.fill(0); }
|
void clearAll() { myInitialized = false; myCount.fill(0); }
|
||||||
|
|
||||||
bool isInitialized() const { return myInitialized; }
|
inline bool isInitialized() const { return myInitialized; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The actual counts
|
// The actual counts
|
||||||
|
|
|
@ -165,7 +165,7 @@ class Cartridge : public Device
|
||||||
|
|
||||||
@return Address of illegal access if one occurred, else 0
|
@return Address of illegal access if one occurred, else 0
|
||||||
*/
|
*/
|
||||||
uInt16 getIllegalRAMReadAccess() const {
|
inline uInt16 getIllegalRAMReadAccess() const {
|
||||||
return myRamReadAccesses.size() > 0 ? myRamReadAccesses[0] : 0;
|
return myRamReadAccesses.size() > 0 ? myRamReadAccesses[0] : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ class Cartridge : public Device
|
||||||
|
|
||||||
@return Address of illegal access if one occurred, else 0
|
@return Address of illegal access if one occurred, else 0
|
||||||
*/
|
*/
|
||||||
uInt16 getIllegalRAMWriteAccess() const { return myRamWriteAccess; }
|
inline uInt16 getIllegalRAMWriteAccess() const { return myRamWriteAccess; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Query the access counters
|
Query the access counters
|
||||||
|
|
|
@ -101,14 +101,14 @@ class System : public Serializable
|
||||||
|
|
||||||
@return The attached 6532 microprocessor
|
@return The attached 6532 microprocessor
|
||||||
*/
|
*/
|
||||||
M6532& m6532() const { return myM6532; }
|
inline M6532& m6532() const { return myM6532; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Answer the TIA device attached to the system.
|
Answer the TIA device attached to the system.
|
||||||
|
|
||||||
@return The attached TIA device
|
@return The attached TIA device
|
||||||
*/
|
*/
|
||||||
TIA& tia() const { return myTIA; }
|
inline TIA& tia() const { return myTIA; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Answer the Cart attached to the system.
|
Answer the Cart attached to the system.
|
||||||
|
@ -140,14 +140,14 @@ class System : public Serializable
|
||||||
|
|
||||||
@return The number of system cycles which have passed
|
@return The number of system cycles which have passed
|
||||||
*/
|
*/
|
||||||
uInt64 cycles() const { return myCycles; }
|
inline uInt64 cycles() const { return myCycles; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Increment the system cycles by the specified number of cycles.
|
Increment the system cycles by the specified number of cycles.
|
||||||
|
|
||||||
@param amount The amount to add to the system cycles counter
|
@param amount The amount to add to the system cycles counter
|
||||||
*/
|
*/
|
||||||
void incrementCycles(uInt32 amount) { myCycles += amount; }
|
inline void incrementCycles(uInt32 amount) { myCycles += amount; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Informs all attached devices that the console type has changed.
|
Informs all attached devices that the console type has changed.
|
||||||
|
|
|
@ -61,28 +61,6 @@ void Audio::setAudioQueue(const shared_ptr<AudioQueue>& queue)
|
||||||
mySampleIndex = 0;
|
mySampleIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void Audio::tick()
|
|
||||||
{
|
|
||||||
switch (myCounter) {
|
|
||||||
case 9:
|
|
||||||
case 81:
|
|
||||||
myChannel0.phase0();
|
|
||||||
myChannel1.phase0();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 37:
|
|
||||||
case 149:
|
|
||||||
phase1();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (++myCounter == 228) myCounter = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Audio::phase1()
|
void Audio::phase1()
|
||||||
{
|
{
|
||||||
|
@ -117,18 +95,6 @@ void Audio::addSample(uInt8 sample0, uInt8 sample1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
AudioChannel& Audio::channel0()
|
|
||||||
{
|
|
||||||
return myChannel0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
AudioChannel& Audio::channel1()
|
|
||||||
{
|
|
||||||
return myChannel1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool Audio::save(Serializer& out) const
|
bool Audio::save(Serializer& out) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,11 +44,11 @@ class Audio : public Serializable
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void tick();
|
FORCE_INLINE void tick();
|
||||||
|
|
||||||
AudioChannel& channel0();
|
inline AudioChannel& channel0() { return myChannel0; }
|
||||||
|
|
||||||
AudioChannel& channel1();
|
inline AudioChannel& channel1() { return myChannel1; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Serializable methods (see that class for more information).
|
Serializable methods (see that class for more information).
|
||||||
|
@ -85,4 +85,30 @@ class Audio : public Serializable
|
||||||
Audio& operator=(Audio&&) = delete;
|
Audio& operator=(Audio&&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ############################################################################
|
||||||
|
// Implementation
|
||||||
|
// ############################################################################
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Audio::tick()
|
||||||
|
{
|
||||||
|
switch (myCounter) {
|
||||||
|
case 9:
|
||||||
|
case 81:
|
||||||
|
myChannel0.phase0();
|
||||||
|
myChannel1.phase0();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 37:
|
||||||
|
case 149:
|
||||||
|
phase1();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (++myCounter == 228) myCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // TIA_AUDIO_HXX
|
#endif // TIA_AUDIO_HXX
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Background : public Serializable
|
||||||
|
|
||||||
void applyColorLoss();
|
void applyColorLoss();
|
||||||
|
|
||||||
uInt8 getColor() const { return myColor; }
|
inline uInt8 getColor() const { return myColor; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Serializable methods (see that class for more information).
|
Serializable methods (see that class for more information).
|
||||||
|
|
|
@ -123,12 +123,12 @@ class Ball : public Serializable
|
||||||
Is the ball visible? This is determined by looking at bit 15
|
Is the ball visible? This is determined by looking at bit 15
|
||||||
of the collision mask.
|
of the collision mask.
|
||||||
*/
|
*/
|
||||||
bool isOn() const { return (collision & 0x8000); }
|
inline bool isOn() const { return (collision & 0x8000); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the current color.
|
Get the current color.
|
||||||
*/
|
*/
|
||||||
uInt8 getColor() const { return myColor; }
|
inline uInt8 getColor() const { return myColor; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Shuffle the enabled flag. This is called in VDELBL mode when GRP1 is
|
Shuffle the enabled flag. This is called in VDELBL mode when GRP1 is
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Missile : public Serializable
|
||||||
|
|
||||||
void toggleEnabled(bool enabled);
|
void toggleEnabled(bool enabled);
|
||||||
|
|
||||||
bool isOn() const { return (collision & 0x8000); }
|
inline bool isOn() const { return (collision & 0x8000); }
|
||||||
uInt8 getColor() const;
|
uInt8 getColor() const;
|
||||||
|
|
||||||
uInt8 getPosition() const;
|
uInt8 getPosition() const;
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Player : public Serializable
|
||||||
|
|
||||||
uInt8 getClock() const { return myCounter; }
|
uInt8 getClock() const { return myCounter; }
|
||||||
|
|
||||||
bool isOn() const { return (collision & 0x8000); }
|
inline bool isOn() const { return (collision & 0x8000); }
|
||||||
uInt8 getColor() const;
|
uInt8 getColor() const;
|
||||||
|
|
||||||
void shufflePatterns();
|
void shufflePatterns();
|
||||||
|
|
|
@ -118,7 +118,7 @@ class Playfield : public Serializable
|
||||||
Is the playfield visible? This is determined by looking at bit 15
|
Is the playfield visible? This is determined by looking at bit 15
|
||||||
of the collision mask.
|
of the collision mask.
|
||||||
*/
|
*/
|
||||||
bool isOn() const { return (collision & 0x8000); }
|
inline bool isOn() const { return (collision & 0x8000); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the current color.
|
Get the current color.
|
||||||
|
|
|
@ -1591,7 +1591,7 @@ void TIA::scheduleCollisionUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void TIA::updateCollision()
|
FORCE_INLINE void TIA::updateCollision()
|
||||||
{
|
{
|
||||||
myCollisionMask |= (
|
myCollisionMask |= (
|
||||||
myPlayer0.collision &
|
myPlayer0.collision &
|
||||||
|
@ -1604,7 +1604,7 @@ void TIA::updateCollision()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void TIA::renderPixel(uInt32 x, uInt32 y)
|
FORCE_INLINE void TIA::renderPixel(uInt32 x, uInt32 y)
|
||||||
{
|
{
|
||||||
if (x >= TIAConstants::H_PIXEL) return;
|
if (x >= TIAConstants::H_PIXEL) return;
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ class AbstractFrameManager : public Serializable
|
||||||
* Should the TIA render its frame? This is buffered in a flag for
|
* Should the TIA render its frame? This is buffered in a flag for
|
||||||
* performance reasons; descendants must update the flag.
|
* performance reasons; descendants must update the flag.
|
||||||
*/
|
*/
|
||||||
bool isRendering() const { return myIsRendering; }
|
inline bool isRendering() const { return myIsRendering; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is vsync on?
|
* Is vsync on?
|
||||||
|
@ -88,7 +88,7 @@ class AbstractFrameManager : public Serializable
|
||||||
/**
|
/**
|
||||||
* Is vblank on?
|
* Is vblank on?
|
||||||
*/
|
*/
|
||||||
bool vblank() const { return myVblank; }
|
inline bool vblank() const { return myVblank; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of scanlines in the last finished frame.
|
* The number of scanlines in the last finished frame.
|
||||||
|
|
Loading…
Reference in New Issue