ComSquare
Ram.hpp
Go to the documentation of this file.
1 //
2 // Created by anonymus-raccoon on 1/28/20.
3 //
4 
5 #ifndef COMSQUARE_RAM_HPP
6 #define COMSQUARE_RAM_HPP
7 
8 #include "../Memory/IMemory.hpp"
9 
10 namespace ComSquare::Ram
11 {
12  class Ram : public Memory::IMemory {
13  private:
15  uint8_t *_data;
17  size_t _size;
18  public:
20  explicit Ram(size_t size);
22  ~Ram();
27  uint8_t read(uint24_t addr) override;
32  void write(uint24_t addr, uint8_t data) override;
33  };
34 }
35 
36 #endif //COMSQUARE_RAM_HPP
ComSquare::Ram::Ram
Definition: Ram.hpp:12
ComSquare::Ram
Definition: Ram.cpp:8
ComSquare::Ram::Ram::Ram
Ram(size_t size)
Load a rom from it's path.
Definition: Ram.cpp:10
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::Ram::Ram::_data
uint8_t * _data
The ram. (Can be used for WRam, SRam, VRam etc)
Definition: Ram.hpp:15
ComSquare::Ram::Ram::_size
size_t _size
The size of the ram.
Definition: Ram.hpp:17
ComSquare::Ram::Ram::write
void write(uint24_t addr, uint8_t data) override
Write data to the ram.
Definition: Ram.cpp:28
ComSquare::Ram::Ram::read
uint8_t read(uint24_t addr) override
Read from the ram.
Definition: Ram.cpp:21
ComSquare::Ram::Ram::~Ram
~Ram()
Destructor that free the ram.
Definition: Ram.cpp:16