diff --git a/src/debugger/TIADebug.cxx b/src/debugger/TIADebug.cxx index b561cb299..2af04264f 100644 --- a/src/debugger/TIADebug.cxx +++ b/src/debugger/TIADebug.cxx @@ -549,10 +549,8 @@ uInt8 TIADebug::grP1(int newVal) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt8 TIADebug::posP0(int newVal) { -#if 0 // FIXME if(newVal > -1) - myTIA.myPOSP0 = newVal; -#endif + myTIA.myPlayer0.setPosition(newVal); return myTIA.myPlayer0.getPosition(); } @@ -560,10 +558,8 @@ uInt8 TIADebug::posP0(int newVal) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt8 TIADebug::posP1(int newVal) { -#if 0 // FIXME if(newVal > -1) - myTIA.myPOSP1 = newVal; -#endif + myTIA.myPlayer1.setPosition(newVal); return myTIA.myPlayer1.getPosition(); } diff --git a/src/emucore/tia/Player.cxx b/src/emucore/tia/Player.cxx index 21ed1cd53..898461d32 100644 --- a/src/emucore/tia/Player.cxx +++ b/src/emucore/tia/Player.cxx @@ -369,7 +369,15 @@ uInt8 Player::getPosition() const const uInt8 shift = myDivider == 1 ? 0 : 1; // Mind the sign of renderCounterOffset: it's defined negative above - return (316 - myCounter - Count::renderCounterOffset + shift + myPositioningProvider->getPosition()) % 160; + return (316 - myCounter - Count::renderCounterOffset + shift + myPlayfieldPositionProvider->getPosition()) % 160; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Player::setPosition(uInt8 newPosition) +{ + const uInt8 shift = myDivider == 1 ? 0 : 1; + + myCounter = (316 - newPosition - Count::renderCounterOffset + shift + myPlayfieldPositionProvider->getPosition()) % 160; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/tia/Player.hxx b/src/emucore/tia/Player.hxx index 264425718..44d4cda71 100644 --- a/src/emucore/tia/Player.hxx +++ b/src/emucore/tia/Player.hxx @@ -20,7 +20,7 @@ #include "bspf.hxx" #include "Serializable.hxx" -#include "PositioningProvider.hxx" +#include "PlayfieldPositionProvider.hxx" class Player : public Serializable { @@ -29,8 +29,8 @@ class Player : public Serializable public: - void setPositioningProvider(PositioningProvider* positioningProvider) { - myPositioningProvider = positioningProvider; + void setPlayfieldPositionProvider(PlayfieldPositionProvider* playfieldPositionProvider) { + myPlayfieldPositionProvider = playfieldPositionProvider; } void reset(); @@ -74,6 +74,7 @@ class Player : public Serializable uInt8 getRespClock() const; uInt8 getPosition() const; + void setPosition(uInt8 newPosition); /** Serializable methods (see that class for more information). @@ -125,7 +126,7 @@ class Player : public Serializable bool myIsReflected; bool myIsDelaying; - PositioningProvider *myPositioningProvider; + PlayfieldPositionProvider *myPlayfieldPositionProvider; private: Player(const Player&) = delete; diff --git a/src/emucore/tia/PositioningProvider.hxx b/src/emucore/tia/PlayfieldPositionProvider.hxx similarity index 86% rename from src/emucore/tia/PositioningProvider.hxx rename to src/emucore/tia/PlayfieldPositionProvider.hxx index 55e987016..4027c15f1 100644 --- a/src/emucore/tia/PositioningProvider.hxx +++ b/src/emucore/tia/PlayfieldPositionProvider.hxx @@ -15,8 +15,8 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. //============================================================================ -#ifndef TIA_POSITIONING_PROVIDER -#define TIA_POSITIONING_PROVIDER +#ifndef TIA_PLAYFIELD_PROVIDER +#define TIA_PLAYFIELD_PROVIDER #include "bspf.hxx" @@ -27,7 +27,7 @@ @author Christian Speckner (DirtyHairy) and Stephen Anthony */ -class PositioningProvider +class PlayfieldPositionProvider { public: @@ -38,7 +38,7 @@ class PositioningProvider protected: - ~PositioningProvider() = default; + ~PlayfieldPositionProvider() = default; }; diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index 640247bc2..3bf8fd9c1 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -95,8 +95,8 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings) myTIAPinsDriven = mySettings.getBool("tiadriven"); - myPlayer0.setPositioningProvider(this); - myPlayer1.setPositioningProvider(this); + myPlayer0.setPlayfieldPositionProvider(this); + myPlayer1.setPlayfieldPositionProvider(this); reset(); } diff --git a/src/emucore/tia/TIA.hxx b/src/emucore/tia/TIA.hxx index be47fde59..88a394e42 100644 --- a/src/emucore/tia/TIA.hxx +++ b/src/emucore/tia/TIA.hxx @@ -35,7 +35,7 @@ #include "Ball.hxx" #include "LatchedInput.hxx" #include "PaddleReader.hxx" -#include "PositioningProvider.hxx" +#include "PlayfieldPositionProvider.hxx" /** This class is a device that emulates the Television Interface Adaptor @@ -50,7 +50,7 @@ @author Christian Speckner (DirtyHairy) and Stephen Anthony */ -class TIA : public Device, public PositioningProvider +class TIA : public Device, public PlayfieldPositionProvider { public: friend class TIADebug;