ComSquare
IMemory.hpp
Go to the documentation of this file.
1 //
2 // Created by anonymus-raccoon on 1/23/20.
3 //
4 
5 #ifndef COMSQUARE_IMEMORY_HPP
6 #define COMSQUARE_IMEMORY_HPP
7 
8 
9 #include <cstdint>
10 #include <vector>
11 #include "../Models/Ints.hpp"
12 
13 namespace ComSquare::Memory
14 {
16  class IMemory {
17  private:
22  public:
27  virtual uint8_t read(uint24_t addr) = 0;
32  virtual void write(uint24_t addr, uint8_t data) = 0;
37  void setMemoryRegion(uint24_t start, uint24_t end);
41  virtual bool hasMemoryAt(uint24_t addr);
44  virtual uint24_t getStart();
45  };
46 };
47 
48 
49 #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.