mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-05-28 16:43:35 +00:00
Finishing the CPU header
This commit is contained in:
@@ -3,3 +3,10 @@
|
||||
//
|
||||
|
||||
#include "Cpu.hpp"
|
||||
|
||||
namespace ComSquare::CPU
|
||||
{
|
||||
CPU::CPU(std::shared_ptr<ComSquare::MemoryBus> bus)
|
||||
: _bus(bus)
|
||||
{ }
|
||||
}
|
||||
@@ -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<MemoryBus> _bus;
|
||||
|
||||
//! @brief Execute a single instruction and return the number of cycles tooked.
|
||||
int executreInstruction();
|
||||
public:
|
||||
explicit CPU(std::shared_ptr<MemoryBus> bus);
|
||||
//! @brief This function continue to execute the Cartridge code and return the number of CPU cycles that elapsed.
|
||||
int update();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user