ComSquare
Public Member Functions | Private Attributes | List of all members
ComSquare::Ram::Ram Class Reference

#include <Ram.hpp>

Inheritance diagram for ComSquare::Ram::Ram:
Inheritance graph
Collaboration diagram for ComSquare::Ram::Ram:
Collaboration graph

Public Member Functions

 Ram (size_t size)
 Load a rom from it's path. More...
 
 ~Ram ()
 Destructor that free the ram. More...
 
uint8_t read (uint24_t addr) override
 Read from the ram. More...
 
void write (uint24_t addr, uint8_t data) override
 Write data to the ram. More...
 
- Public Member Functions inherited from ComSquare::Memory::IMemory
void setMemoryRegion (uint24_t start, uint24_t end)
 Change starting and ending points of this mapped memory. More...
 
virtual bool hasMemoryAt (uint24_t addr)
 Return true if this component has mapped the address. More...
 
virtual uint24_t getStart ()
 Get the first address mapped to this component. More...
 

Private Attributes

uint8_t * _data
 The ram. (Can be used for WRam, SRam, VRam etc) More...
 
size_t _size
 The size of the ram. More...
 

Constructor & Destructor Documentation

◆ Ram()

ComSquare::Ram::Ram::Ram ( size_t  size)
explicit

Load a rom from it's path.

◆ ~Ram()

ComSquare::Ram::Ram::~Ram ( )

Destructor that free the ram.

Member Function Documentation

◆ read()

uint8_t ComSquare::Ram::Ram::read ( uint24_t  addr)
overridevirtual

Read from the ram.

Parameters
addrThe address to read from. The address 0x0 should refer to the first byte of this ram.
Exceptions
InvalidAddresswill be thrown if the address is more than the size of the ram.
Returns
Return the data at the address.

Implements ComSquare::Memory::IMemory.

◆ write()

void ComSquare::Ram::Ram::write ( uint24_t  addr,
uint8_t  data 
)
overridevirtual

Write data to the ram.

Parameters
addrThe address to write to. The address 0x0 should refer to the first byte of this ram.
dataThe data to write.
Exceptions
InvalidAddresswill be thrown if the address is more than the size of the ram.

Implements ComSquare::Memory::IMemory.

Member Data Documentation

◆ _data

uint8_t* ComSquare::Ram::Ram::_data
private

The ram. (Can be used for WRam, SRam, VRam etc)

◆ _size

size_t ComSquare::Ram::Ram::_size
private

The size of the ram.


The documentation for this class was generated from the following files: