diff --git a/sources/CPU/Cpu.cpp b/sources/CPU/Cpu.cpp index 680b728..397caba 100644 --- a/sources/CPU/Cpu.cpp +++ b/sources/CPU/Cpu.cpp @@ -3,3 +3,10 @@ // #include "Cpu.hpp" + +namespace ComSquare::CPU +{ + CPU::CPU(std::shared_ptr bus) + : _bus(bus) + { } +} \ No newline at end of file diff --git a/sources/CPU/Cpu.hpp b/sources/CPU/Cpu.hpp index ebcf8d7..a847226 100644 --- a/sources/CPU/Cpu.hpp +++ b/sources/CPU/Cpu.hpp @@ -6,6 +6,7 @@ #define COMSQUARE_CPU_HPP #include "../Memory/IMemory.hpp" +#include "../Memory/MemoryBus.hpp" namespace ComSquare::CPU { @@ -91,9 +92,22 @@ namespace ComSquare::CPU }; }; + //! @brief The main CPU class CPU : IMemory { private: + //! @brief All the registers of the CPU Registers _registers; + //! @brief Is the CPU running in emulation mode (in 8bits) + bool _isEmulationMode; + //! @brief The memory bus to use for read/write. + std::shared_ptr _bus; + + //! @brief Execute a single instruction and return the number of cycles tooked. + int executreInstruction(); + public: + explicit CPU(std::shared_ptr bus); + //! @brief This function continue to execute the Cartridge code and return the number of CPU cycles that elapsed. + int update(); }; }