mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-05-28 16:43:35 +00:00
The code is now Coplien Compilent
This commit is contained in:
+4
-4
@@ -31,8 +31,8 @@ add_executable(unit_tests
|
||||
sources/APU/APU.cpp
|
||||
sources/Exceptions/InvalidAddress.hpp
|
||||
sources/Exceptions/InvalidRom.hpp
|
||||
sources/Models/Ints.hpp
|
||||
sources/Models/Ints.hpp
|
||||
sources/Models/Int24.hpp
|
||||
sources/Models/Int24.hpp
|
||||
sources/Ram/Ram.cpp
|
||||
sources/Ram/Ram.hpp
|
||||
sources/Memory/MemoryShadow.cpp
|
||||
@@ -93,8 +93,8 @@ add_executable(ComSquare
|
||||
sources/APU/APU.cpp
|
||||
sources/Exceptions/InvalidAddress.hpp
|
||||
sources/Exceptions/InvalidRom.hpp
|
||||
sources/Models/Ints.hpp
|
||||
sources/Models/Ints.hpp
|
||||
sources/Models/Int24.hpp
|
||||
sources/Models/Int24.hpp
|
||||
sources/Ram/Ram.cpp
|
||||
sources/Ram/Ram.hpp
|
||||
sources/Memory/MemoryShadow.cpp
|
||||
|
||||
@@ -114,6 +114,9 @@ namespace ComSquare::APU
|
||||
std::shared_ptr<DSP::DSP> _dsp;
|
||||
public:
|
||||
explicit APU();
|
||||
APU(const APU &) = default;
|
||||
APU &operator=(const APU &) = default;
|
||||
~APU() = default;
|
||||
|
||||
//! @brief Read from the internal APU register.
|
||||
//! @param addr The address to read from. The address 0xF0 should refer to the first byte of the register.
|
||||
|
||||
@@ -112,6 +112,9 @@ namespace ComSquare::APU::DSP
|
||||
std::array<Channel, 8> _channels{};
|
||||
public:
|
||||
explicit DSP();
|
||||
DSP(const DSP &) = default;
|
||||
DSP &operator=(const DSP &) = default;
|
||||
~DSP() = default;
|
||||
|
||||
//! @brief Read from the internal DSP register.
|
||||
//! @param addr The address to read from. The address 0x0 should refer to the first byte of the register.
|
||||
|
||||
+4
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "../Memory/IMemory.hpp"
|
||||
#include "../Memory/MemoryBus.hpp"
|
||||
#include "../Models/Ints.hpp"
|
||||
#include "../Models/Int24.hpp"
|
||||
#include "Instructions/CommonInstructions.hpp"
|
||||
#include "../Cartridge/Cartridge.hpp"
|
||||
|
||||
@@ -344,6 +344,9 @@ namespace ComSquare::CPU
|
||||
void LDA(uint24_t addr);
|
||||
public:
|
||||
explicit CPU(std::shared_ptr<Memory::MemoryBus> bus, Cartridge::Header &cartridgeHeader);
|
||||
CPU(const CPU &) = default;
|
||||
CPU &operator=(const CPU &) = delete;
|
||||
~CPU() = default;
|
||||
//! @brief This function continue to execute the Cartridge code.
|
||||
//! @return The number of CPU cycles that elapsed
|
||||
unsigned update();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <string>
|
||||
#include "../Memory/IMemory.hpp"
|
||||
#include "../Models/Ints.hpp"
|
||||
#include "../Models/Int24.hpp"
|
||||
#include "../Memory/IRectangleMemory.hpp"
|
||||
#include "InterruptVectors.hpp"
|
||||
|
||||
@@ -57,6 +57,9 @@ namespace ComSquare::Cartridge
|
||||
InterruptVectors emulationInterrupts{};
|
||||
|
||||
Header() = default;
|
||||
Header(const Header &) = default;
|
||||
Header &operator=(const Header &) = default;
|
||||
~Header() = default;
|
||||
};
|
||||
|
||||
//! @brief Contains the rom's memory/instructions.
|
||||
@@ -86,6 +89,10 @@ namespace ComSquare::Cartridge
|
||||
public:
|
||||
//! @brief Load a rom from it's path.
|
||||
explicit Cartridge(const std::string &romPath);
|
||||
//! @brief The cartridge can't be copied.
|
||||
Cartridge(const Cartridge &) = delete;
|
||||
//! @brief The cartridge can't be assigned.
|
||||
Cartridge &operator=(const Cartridge &) = delete;
|
||||
//! @brief Destructor that free the cartridge data.
|
||||
~Cartridge();
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include "../Models/Ints.hpp"
|
||||
#include "../Models/Int24.hpp"
|
||||
|
||||
namespace ComSquare::Memory
|
||||
{
|
||||
|
||||
@@ -36,6 +36,11 @@ namespace ComSquare
|
||||
inline void _mirrorComponents(SNES &console, unsigned i);
|
||||
|
||||
public:
|
||||
MemoryBus() = default;
|
||||
MemoryBus(const MemoryBus &) = default;
|
||||
MemoryBus &operator=(const MemoryBus &) = default;
|
||||
~MemoryBus() = default;
|
||||
|
||||
//! @brief Read data at a global address.
|
||||
//! @param addr The address to read from.
|
||||
//! @return The value that the component returned for this address. If the address was mapped to ram, it simply returned the value. If the address was mapped to a register the component returned the register.
|
||||
|
||||
@@ -17,6 +17,9 @@ namespace ComSquare::Memory
|
||||
public:
|
||||
//! @brief Create a shadow for the memory given as parameter.
|
||||
explicit MemoryShadow(std::shared_ptr<IMemory> initial, uint24_t start, uint24_t end);
|
||||
MemoryShadow(const MemoryShadow &) = default;
|
||||
MemoryShadow &operator=(const MemoryShadow &) = default;
|
||||
~MemoryShadow() = default;
|
||||
|
||||
//! @brief Read from the initial IMemory given.
|
||||
//! @param addr The address to read from. The address 0x0 should refer to the first byte of the initial IMemory.
|
||||
|
||||
@@ -20,6 +20,9 @@ namespace ComSquare::Memory
|
||||
public:
|
||||
//! @brief Create a shadow for the memory given as parameter.
|
||||
explicit RectangleShadow(std::shared_ptr<IRectangleMemory> initial, uint8_t startBank, uint8_t endBank, uint16_t startPage, uint16_t endPage);
|
||||
RectangleShadow(const RectangleShadow &) = default;
|
||||
RectangleShadow &operator=(const RectangleShadow &) = default;
|
||||
~RectangleShadow() = default;
|
||||
|
||||
//! @brief Internal component read. Implement this as you would implement a basic IMemory's read.
|
||||
//! @param addr The local address to read from. 0x0 refer to the first byte of your data and the address is in the component's space. That means that you can consider this address as continuous
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
//
|
||||
// Created by anonymus-raccoon on 1/28/20.
|
||||
//
|
||||
|
||||
#ifndef COMSQUARE_INT24_HPP
|
||||
#define COMSQUARE_INT24_HPP
|
||||
|
||||
typedef unsigned uint24_t;
|
||||
|
||||
#endif //COMSQUARE_INT24_HPP
|
||||
@@ -1,10 +0,0 @@
|
||||
//
|
||||
// Created by anonymus-raccoon on 1/28/20.
|
||||
//
|
||||
|
||||
#ifndef COMSQUARE_INTS_HPP
|
||||
#define COMSQUARE_INTS_HPP
|
||||
|
||||
typedef unsigned uint24_t;
|
||||
|
||||
#endif //COMSQUARE_INTS_HPP
|
||||
@@ -521,6 +521,10 @@ namespace ComSquare::PPU
|
||||
uint16_t *_vram;
|
||||
public:
|
||||
PPU(const std::shared_ptr<Memory::MemoryBus> &bus, Renderer::IRenderer &renderer);
|
||||
PPU(const PPU &) = default;
|
||||
PPU &operator=(const PPU &) = delete;
|
||||
~PPU() = default;
|
||||
|
||||
//! @brief Read data from the component.
|
||||
//! @param addr The local address to read from (0x0 should refer to the first byte of this component).
|
||||
//! @throw This function should thrown an InvalidAddress for address that are not mapped to the component.
|
||||
|
||||
@@ -18,6 +18,10 @@ namespace ComSquare::Ram
|
||||
public:
|
||||
//! @brief Load a rom from it's path.
|
||||
explicit Ram(size_t size);
|
||||
//! @brief The ram can't be copied.
|
||||
Ram(const Ram &) = delete;
|
||||
//! @brief The ram can't be assigned.
|
||||
Ram &operator=(Ram &) = delete;
|
||||
//! @brief Destructor that free the ram.
|
||||
~Ram();
|
||||
//! @brief Read from the ram.
|
||||
|
||||
@@ -29,6 +29,9 @@ namespace ComSquare::Renderer
|
||||
//! @param width width of the window.
|
||||
//! @param maxFPS the number of maximum FPS for the window.
|
||||
NoRenderer(unsigned int height, unsigned int width, int maxFPS);
|
||||
NoRenderer(const NoRenderer &) = default;
|
||||
NoRenderer &operator=(const NoRenderer &) = default;
|
||||
~NoRenderer() = default;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,9 @@ namespace ComSquare::Renderer
|
||||
//! @param width width of the window.
|
||||
//! @param maxFPS the number of maximum FPS for the window.
|
||||
SFRenderer(unsigned int height, unsigned int width, int maxFPS);
|
||||
SFRenderer(const SFRenderer &) = delete;
|
||||
SFRenderer &operator=(const SFRenderer &) = delete;
|
||||
~SFRenderer() = default;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@ namespace ComSquare
|
||||
std::shared_ptr<Ram::Ram> sram;
|
||||
//! @brief Create all the components using a common memory bus for all of them.
|
||||
SNES(const std::shared_ptr<Memory::MemoryBus> &bus, const std::string &ramPath, Renderer::IRenderer &renderer);
|
||||
SNES(const SNES &) = default;
|
||||
SNES &operator=(const SNES &) = default;
|
||||
~SNES() = default;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user