From d86b09dbb689a89cc852e95c81a74a7bf70c6267 Mon Sep 17 00:00:00 2001
From: AnonymusRaccoon
Date: Wed, 5 Feb 2020 16:15:45 +0100
Subject: [PATCH] Creating a common CPU class
---
CMakeLists.txt | 4 ++--
sources/CPU/CPU.hpp | 3 ++-
sources/CPU/CommonCpu.cpp | 10 ++++++++++
sources/CPU/CommonCpu.hpp | 16 ++++++++++++++++
4 files changed, 30 insertions(+), 3 deletions(-)
create mode 100644 sources/CPU/CommonCpu.cpp
create mode 100644 sources/CPU/CommonCpu.hpp
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 77bbd3a..1e1f96a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,7 +41,7 @@ add_executable(unit_tests
sources/APU/DSP/DSP.hpp
sources/Memory/RectangleShadow.cpp
sources/Memory/RectangleShadow.hpp
-)
+ sources/CPU/CommonCpu.cpp sources/CPU/CommonCpu.hpp)
# include criterion & coverage
target_link_libraries(unit_tests criterion -lgcov)
@@ -84,7 +84,7 @@ add_executable(ComSquare
sources/Cartridge/InterruptVectors.hpp
sources/Memory/RectangleShadow.cpp
sources/Memory/RectangleShadow.hpp
-)
+ sources/CPU/CommonCpu.cpp sources/CPU/CommonCpu.hpp)
target_link_libraries(ComSquare
sfml-graphics
diff --git a/sources/CPU/CPU.hpp b/sources/CPU/CPU.hpp
index 18660e2..0c8d9ee 100644
--- a/sources/CPU/CPU.hpp
+++ b/sources/CPU/CPU.hpp
@@ -8,6 +8,7 @@
#include "../Memory/IMemory.hpp"
#include "../Memory/MemoryBus.hpp"
#include "../Models/Ints.hpp"
+#include "CommonCpu.hpp"
namespace ComSquare::CPU
{
@@ -174,7 +175,7 @@ namespace ComSquare::CPU
};
//! @brief The main CPU
- class CPU : public Memory::IMemory {
+ class CPU : public CommonCPU, public Memory::IMemory {
private:
//! @brief All the registers of the CPU
Registers _registers{};
diff --git a/sources/CPU/CommonCpu.cpp b/sources/CPU/CommonCpu.cpp
new file mode 100644
index 0000000..732c482
--- /dev/null
+++ b/sources/CPU/CommonCpu.cpp
@@ -0,0 +1,10 @@
+//
+// Created by anonymus-raccoon on 2/5/20.
+//
+
+#include "CommonCpu.hpp"
+
+namespace ComSquare::CPU
+{
+
+}
\ No newline at end of file
diff --git a/sources/CPU/CommonCpu.hpp b/sources/CPU/CommonCpu.hpp
new file mode 100644
index 0000000..03ba660
--- /dev/null
+++ b/sources/CPU/CommonCpu.hpp
@@ -0,0 +1,16 @@
+//
+// Created by anonymus-raccoon on 2/5/20.
+//
+
+#ifndef COMSQUARE_COMMONCPU_HPP
+#define COMSQUARE_COMMONCPU_HPP
+
+namespace ComSquare::CPU
+{
+ //! @brief The shared states of the Main's CPU and the APU's CPU.
+ class CommonCPU {
+
+ };
+}
+
+#endif //COMSQUARE_COMMONCPU_HPP