diff --git a/.vscode/settings.json b/.vscode/settings.json index b3b08a7c4..6cd07c62c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,9 @@ { "clang.cxxflags": [ "-std=c++11", - "-I/home/cnspeckn/git/stella/src/common" + "-I/home/cnspeckn/git/stella/src/common", + "-I/home/cnspeckn/git/stella/src/emucore", + "-I/home/cnspeckn/git/stella/src/emucore/tia/default_core" ], "editor.tabSize": 2, "files.trimTrailingWhitespace": false, diff --git a/Makefile b/Makefile index 7a17d530c..4cd52ccc7 100644 --- a/Makefile +++ b/Makefile @@ -94,6 +94,7 @@ MODULES := $(MODULES) # After the game specific modules follow the shared modules MODULES += \ src/emucore \ + src/emucore/tia/core_default \ src/gui \ src/common \ src/common/tv_filters diff --git a/configure b/configure index 618fe789d..53bc1317e 100755 --- a/configure +++ b/configure @@ -672,6 +672,7 @@ find_sdlconfig SRC="src" CORE="$SRC/emucore" +TIA_CORE_DEFAULT="$SRC/emucore/tia/core_default" COMMON="$SRC/common" TV="$SRC/common/tv_filters" GUI="$SRC/gui" @@ -682,7 +683,7 @@ CHEAT="$SRC/cheat" LIBPNG="$SRC/libpng" ZLIB="$SRC/zlib" -INCLUDES="-I$CORE -I$COMMON -I$TV -I$GUI" +INCLUDES="-I$CORE -I$COMMON -I$TV -I$GUI -I$TIA_CORE_DEFAULT" INCLUDES="$INCLUDES `$_sdlconfig --cflags`" if test "$_build_static" = yes ; then diff --git a/src/emucore/AbstractTIA.hxx b/src/emucore/AbstractTIA.hxx index 7259f0046..da8b23ee3 100644 --- a/src/emucore/AbstractTIA.hxx +++ b/src/emucore/AbstractTIA.hxx @@ -23,6 +23,7 @@ #include "bspf.hxx" #include "Device.hxx" #include "Serializer.hxx" +#include "System.hxx" #include "TIATypes.hxx" class AbstractTIA: public Device @@ -31,6 +32,8 @@ class AbstractTIA: public Device virtual ~AbstractTIA() = default; + virtual void installDelegate(System& system, Device& device) = 0; + virtual void frameReset() = 0; virtual bool saveDisplay(Serializer& out) const = 0; diff --git a/src/emucore/Cart3E.cxx b/src/emucore/Cart3E.cxx index da4cf8408..f9de1390b 100644 --- a/src/emucore/Cart3E.cxx +++ b/src/emucore/Cart3E.cxx @@ -18,7 +18,7 @@ //============================================================================ #include "System.hxx" -#include "TIA.hxx" +#include "AbstractTIA.hxx" #include "Cart3E.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/Cart3EPlus.cxx b/src/emucore/Cart3EPlus.cxx index 020dbc1d3..3318a5a23 100644 --- a/src/emucore/Cart3EPlus.cxx +++ b/src/emucore/Cart3EPlus.cxx @@ -18,7 +18,7 @@ //============================================================================ #include "System.hxx" -#include "TIA.hxx" +#include "AbstractTIA.hxx" #include "Cart3EPlus.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/Cart3F.cxx b/src/emucore/Cart3F.cxx index f9ffb3412..f58da3d79 100644 --- a/src/emucore/Cart3F.cxx +++ b/src/emucore/Cart3F.cxx @@ -18,7 +18,7 @@ //============================================================================ #include "System.hxx" -#include "TIA.hxx" +#include "AbstractTIA.hxx" #include "Cart3F.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/Cart4A50.cxx b/src/emucore/Cart4A50.cxx index 9c2d17c15..d7fdca5d7 100644 --- a/src/emucore/Cart4A50.cxx +++ b/src/emucore/Cart4A50.cxx @@ -19,7 +19,7 @@ #include "System.hxx" #include "M6532.hxx" -#include "TIA.hxx" +#include "AbstractTIA.hxx" #include "Cart4A50.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -80,8 +80,8 @@ void Cartridge4A50::install(System& system) // Mirror all access in TIA and RIOT; by doing so we're taking responsibility // for that address space in peek and poke below. - mySystem->tia().install(system, *this); - mySystem->m6532().install(system, *this); + mySystem->tia().installDelegate(system, *this); + mySystem->m6532().installDelegate(system, *this); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartCM.cxx b/src/emucore/CartCM.cxx index 1d14130de..52c8e84d7 100644 --- a/src/emucore/CartCM.cxx +++ b/src/emucore/CartCM.cxx @@ -52,7 +52,7 @@ void CartridgeCM::install(System& system) // Mirror all access in RIOT; by doing so we're taking responsibility // for that address space in peek and poke below. - mySystem->m6532().install(system, *this); + mySystem->m6532().installDelegate(system, *this); // Install pages for the startup bank bank(myStartBank); diff --git a/src/emucore/CartCVPlus.cxx b/src/emucore/CartCVPlus.cxx index 2769a937c..d57d3a02f 100644 --- a/src/emucore/CartCVPlus.cxx +++ b/src/emucore/CartCVPlus.cxx @@ -18,7 +18,7 @@ //============================================================================ #include "System.hxx" -#include "TIA.hxx" +#include "AbstractTIA.hxx" #include "CartCVPlus.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartDASH.cxx b/src/emucore/CartDASH.cxx index cc27a6d59..59f0a6f59 100644 --- a/src/emucore/CartDASH.cxx +++ b/src/emucore/CartDASH.cxx @@ -18,7 +18,7 @@ //============================================================================ #include "System.hxx" -#include "TIA.hxx" +#include "AbstractTIA.hxx" #include "CartDASH.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartWD.cxx b/src/emucore/CartWD.cxx index bbd901b32..5d96a7efc 100644 --- a/src/emucore/CartWD.cxx +++ b/src/emucore/CartWD.cxx @@ -17,7 +17,7 @@ // $Id$ //============================================================================ -#include "TIA.hxx" +#include "AbstractTIA.hxx" #include "M6502.hxx" #include "System.hxx" #include "CartWD.hxx" @@ -76,7 +76,7 @@ void CartridgeWD::install(System& system) // Mirror all access in TIA; by doing so we're taking responsibility // for that address space in peek and poke below. - mySystem->tia().install(system, *this); + mySystem->tia().installDelegate(system, *this); // Setup segments to some default slices bank(myStartBank); diff --git a/src/emucore/CartX07.cxx b/src/emucore/CartX07.cxx index 67fdff71e..2c60f1193 100644 --- a/src/emucore/CartX07.cxx +++ b/src/emucore/CartX07.cxx @@ -19,7 +19,7 @@ #include "System.hxx" #include "M6532.hxx" -#include "TIA.hxx" +#include "AbstractTIA.hxx" #include "CartX07.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/Console.hxx b/src/emucore/Console.hxx index bd97fd97a..4013e8a9a 100644 --- a/src/emucore/Console.hxx +++ b/src/emucore/Console.hxx @@ -23,7 +23,7 @@ class Event; class Switches; class System; -class TIA; +class AbstractTIA; class M6502; class M6532; class Cartridge; @@ -33,7 +33,7 @@ class Debugger; #include "bspf.hxx" #include "Control.hxx" #include "Props.hxx" -#include "TIATables.hxx" +#include "TIATypes.hxx" #include "FrameBuffer.hxx" #include "Serializable.hxx" #include "NTSCFilter.hxx" @@ -91,7 +91,7 @@ class Console : public Serializable @return The TIA */ - TIA& tia() const { return *myTIA; } + AbstractTIA& tia() const { return *myTIA; } /** Get the properties being used by the game @@ -340,7 +340,7 @@ class Console : public Serializable unique_ptr myRiot; // Pointer to the TIA object - unique_ptr myTIA; + unique_ptr myTIA; // Pointer to the Cartridge (the debugger needs it) unique_ptr myCart; diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 801886c4a..d5420bf59 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -35,7 +35,7 @@ #include "Menu.hxx" #include "OSystem.hxx" #include "Settings.hxx" -#include "TIA.hxx" +#include "AbstractTIA.hxx" #include "FBSurface.hxx" #include "TIASurface.hxx" diff --git a/src/emucore/M6532.cxx b/src/emucore/M6532.cxx index e2ff3a032..4813ea88e 100644 --- a/src/emucore/M6532.cxx +++ b/src/emucore/M6532.cxx @@ -107,11 +107,11 @@ void M6532::update() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void M6532::install(System& system) { - install(system, *this); + installDelegate(system, *this); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void M6532::install(System& system, Device& device) +void M6532::installDelegate(System& system, Device& device) { // Remember which system I'm installed in mySystem = &system; diff --git a/src/emucore/M6532.hxx b/src/emucore/M6532.hxx index 887459a92..6ae3a4985 100644 --- a/src/emucore/M6532.hxx +++ b/src/emucore/M6532.hxx @@ -92,7 +92,7 @@ class M6532 : public Device @param system The system the device should install itself in @param device The device responsible for this address space */ - void install(System& system, Device& device); + void installDelegate(System& system, Device& device); /** Save the current state of this device to the given Serializer. diff --git a/src/emucore/System.cxx b/src/emucore/System.cxx index a4bfb7f9e..2b9fca739 100644 --- a/src/emucore/System.cxx +++ b/src/emucore/System.cxx @@ -23,13 +23,13 @@ #include "Device.hxx" #include "M6502.hxx" #include "M6532.hxx" -#include "TIA.hxx" +#include "AbstractTIA.hxx" #include "Cart.hxx" #include "System.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - System::System(const OSystem& osystem, M6502& m6502, M6532& m6532, - TIA& mTIA, Cartridge& mCart) + AbstractTIA& mTIA, Cartridge& mCart) : myOSystem(osystem), myM6502(m6502), myM6532(m6532), diff --git a/src/emucore/System.hxx b/src/emucore/System.hxx index 9b6cfc414..e6580a94a 100644 --- a/src/emucore/System.hxx +++ b/src/emucore/System.hxx @@ -23,7 +23,7 @@ class Device; class M6502; class M6532; -class TIA; +class AbstractTIA; class NullDevice; #include "bspf.hxx" @@ -53,7 +53,7 @@ class System : public Serializable pages of 2^6 bytes. */ System(const OSystem& osystem, M6502& m6502, M6532& m6532, - TIA& mTIA, Cartridge& mCart); + AbstractTIA& mTIA, Cartridge& mCart); virtual ~System() = default; // Mask to apply to an address before accessing memory @@ -109,7 +109,7 @@ class System : public Serializable @return The attached TIA device */ - TIA& tia() const { return myTIA; } + AbstractTIA& tia() const { return myTIA; } /** Answer the random generator attached to the system. @@ -389,7 +389,7 @@ class System : public Serializable M6532& myM6532; // TIA device attached to the system - TIA& myTIA; + AbstractTIA& myTIA; // Cartridge device attached to the system Cartridge& myCart; diff --git a/src/emucore/TIASnd.cxx b/src/emucore/TIASnd.cxx index c79336630..74b2ba94b 100644 --- a/src/emucore/TIASnd.cxx +++ b/src/emucore/TIASnd.cxx @@ -18,7 +18,7 @@ //============================================================================ #include "System.hxx" -#include "TIATables.hxx" +#include "TIATypes.hxx" #include "TIASnd.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/TIASurface.cxx b/src/emucore/TIASurface.cxx index 20584d9f3..81d0fdca8 100644 --- a/src/emucore/TIASurface.cxx +++ b/src/emucore/TIASurface.cxx @@ -23,7 +23,7 @@ #include "Settings.hxx" #include "OSystem.hxx" #include "Console.hxx" -#include "TIA.hxx" +#include "AbstractTIA.hxx" #include "TIASurface.hxx" diff --git a/src/emucore/TIASurface.hxx b/src/emucore/TIASurface.hxx index 88b23befe..68b012f35 100644 --- a/src/emucore/TIASurface.hxx +++ b/src/emucore/TIASurface.hxx @@ -20,7 +20,7 @@ #ifndef TIASURFACE_HXX #define TIASURFACE_HXX -class TIA; +class AbstractTIA; class Console; class OSystem; class FrameBuffer; @@ -137,7 +137,7 @@ class TIASurface private: OSystem& myOSystem; FrameBuffer& myFB; - TIA* myTIA; + AbstractTIA* myTIA; shared_ptr myTiaSurface, mySLineSurface, myBaseTiaSurface; diff --git a/src/emucore/TrackBall.cxx b/src/emucore/TrackBall.cxx index ddd1c07b9..b153ef0d0 100644 --- a/src/emucore/TrackBall.cxx +++ b/src/emucore/TrackBall.cxx @@ -21,7 +21,7 @@ #include "Event.hxx" #include "System.hxx" -#include "TIA.hxx" +#include "AbstractTIA.hxx" #include "TrackBall.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/module.mk b/src/emucore/module.mk index 211fbf4d9..fd36e3fee 100644 --- a/src/emucore/module.mk +++ b/src/emucore/module.mk @@ -72,9 +72,7 @@ MODULE_OBJS := \ src/emucore/Switches.o \ src/emucore/StateManager.o \ src/emucore/System.o \ - src/emucore/TIA.o \ src/emucore/TIASnd.o \ - src/emucore/TIATables.o \ src/emucore/TIASurface.o \ src/emucore/TrackBall.o \ src/emucore/Thumbulator.o diff --git a/src/emucore/TIA.cxx b/src/emucore/tia/core_default/TIA.cxx similarity index 99% rename from src/emucore/TIA.cxx rename to src/emucore/tia/core_default/TIA.cxx index 83ae98bf2..de8fc52a9 100644 --- a/src/emucore/TIA.cxx +++ b/src/emucore/tia/core_default/TIA.cxx @@ -230,11 +230,11 @@ void TIA::systemCyclesReset() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TIA::install(System& system) { - install(system, *this); + installDelegate(system, *this); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TIA::install(System& system, Device& device) +void TIA::installDelegate(System& system, Device& device) { // Remember which system I'm installed in mySystem = &system; diff --git a/src/emucore/TIA.hxx b/src/emucore/tia/core_default/TIA.hxx similarity index 99% rename from src/emucore/TIA.hxx rename to src/emucore/tia/core_default/TIA.hxx index 146e28cdb..7a8b97ac4 100644 --- a/src/emucore/TIA.hxx +++ b/src/emucore/tia/core_default/TIA.hxx @@ -94,7 +94,7 @@ class TIA : public AbstractTIA @param system The system the device should install itself in @param device The device responsible for this address space */ - void install(System& system, Device& device); + void installDelegate(System& system, Device& device) override; /** Save the current state of this device to the given Serializer. diff --git a/src/emucore/TIATables.cxx b/src/emucore/tia/core_default/TIATables.cxx similarity index 100% rename from src/emucore/TIATables.cxx rename to src/emucore/tia/core_default/TIATables.cxx diff --git a/src/emucore/TIATables.hxx b/src/emucore/tia/core_default/TIATables.hxx similarity index 100% rename from src/emucore/TIATables.hxx rename to src/emucore/tia/core_default/TIATables.hxx diff --git a/src/emucore/tia/core_default/module.mk b/src/emucore/tia/core_default/module.mk new file mode 100644 index 000000000..f66658626 --- /dev/null +++ b/src/emucore/tia/core_default/module.mk @@ -0,0 +1,11 @@ +MODULE := src/emucore/tia/core_default + +MODULE_OBJS := \ + src/emucore/tia/core_default/TIA.o \ + src/emucore/tia/core_default/TIATables.o + +MODULE_DIRS += \ + src/emucore/tia/core_default + +# Include common rules +include $(srcdir)/common.rules