MemoryShadow.hpp
Go to the documentation of this file.
//
// Created by anonymus-raccoon on 1/28/20.
//
#ifndef COMSQUARE_MEMORYSHADOW_HPP
#define COMSQUARE_MEMORYSHADOW_HPP
#include <memory>
#include "IMemory.hpp"
namespace ComSquare::Memory
{
class MemoryShadow : public IMemory {
private:
std::shared_ptr<IMemory> _initial;
public:
explicit MemoryShadow(std::shared_ptr<IMemory> initial, uint24_t start, uint24_t end);
static std::shared_ptr<IMemory> createShadow(std::shared_ptr<IMemory> initial, uint24_t start, uint24_t end);
uint8_t read(uint24_t addr) override;
void write(uint24_t addr, uint8_t data) override;
};
}
#endif //COMSQUARE_MEMORYSHADOW_HPP
ComSquare::Memory::MemoryShadow::read
uint8_t read(uint24_t addr) override
Read from the initial IMemory given.
Definition: MemoryShadow.cpp:22
ComSquare::Memory::MemoryShadow
Definition: MemoryShadow.hpp:13
ComSquare::Memory::MemoryShadow::write
void write(uint24_t addr, uint8_t data) override
Write data to the ram.
Definition: MemoryShadow.cpp:27
ComSquare::Memory::MemoryShadow::createShadow
static std::shared_ptr< IMemory > createShadow(std::shared_ptr< IMemory > initial, uint24_t start, uint24_t end)
Definition: MemoryShadow.cpp:17
ComSquare::Memory::MemoryShadow::_initial
std::shared_ptr< IMemory > _initial
Memory to shadow from.
Definition: MemoryShadow.hpp:16
uint24_t
unsigned uint24_t
Definition: Ints.hpp:8
ComSquare::Memory::IMemory
Common interface implemented by all components mapping memory.
Definition: IMemory.hpp:16
ComSquare::Memory
Definition: IMemory.cpp:8
IMemory.hpp
ComSquare::Memory::MemoryShadow::MemoryShadow
MemoryShadow(std::shared_ptr< IMemory > initial, uint24_t start, uint24_t end)
Create a shadow for the memory given as parameter.
Definition: MemoryShadow.cpp:11