IMemory.hpp
Go to the documentation of this file.
//
// Created by anonymus-raccoon on 1/23/20.
//
#ifndef COMSQUARE_IMEMORY_HPP
#define COMSQUARE_IMEMORY_HPP
#include <cstdint>
#include <vector>
#include "../Models/Ints.hpp"
namespace ComSquare::Memory
{
class IMemory {
private:
uint24_t _start = 0;
uint24_t _end = 0;
public:
virtual uint8_t read(uint24_t addr) = 0;
virtual void write(uint24_t addr, uint8_t data) = 0;
void setMemoryRegion(uint24_t start, uint24_t end);
virtual bool hasMemoryAt(uint24_t addr);
virtual uint24_t getStart();
};
};
#endif //COMSQUARE_IMEMORY_HPP
ComSquare::Memory::IMemory::_end
uint24_t _end
The last continuous address mapped to this components. For shadows, see the MemoryShadow class.
Definition: IMemory.hpp:21
ComSquare::Memory::IMemory::read
virtual uint8_t read(uint24_t addr)=0
Read data from the component.
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::IMemory::getStart
virtual uint24_t getStart()
Get the first address mapped to this component.
Definition: IMemory.cpp:21
ComSquare::Memory::IMemory::setMemoryRegion
void setMemoryRegion(uint24_t start, uint24_t end)
Change starting and ending points of this mapped memory.
Definition: IMemory.cpp:10
ComSquare::Memory::IMemory::_start
uint24_t _start
The starting address mapped to this component.
Definition: IMemory.hpp:19
ComSquare::Memory
Definition: IMemory.cpp:8
ComSquare::Memory::IMemory::hasMemoryAt
virtual bool hasMemoryAt(uint24_t addr)
Return true if this component has mapped the address.
Definition: IMemory.cpp:16
ComSquare::Memory::IMemory::write
virtual void write(uint24_t addr, uint8_t data)=0
Write data to this component.