ComSquare
Public Member Functions | List of all members
ComSquare::Memory::IMemory Class Referenceabstract

Common interface implemented by all components mapping memory. More...

#include <IMemory.hpp>

Inheritance diagram for ComSquare::Memory::IMemory:
Collaboration diagram for ComSquare::Memory::IMemory:

Public Member Functions

virtual uint8_t read (uint24_t addr)=0
 Read data from the component. More...
 
virtual void write (uint24_t addr, uint8_t data)=0
 Write data to this component. More...
 
virtual bool hasMemoryAt (uint24_t addr) const =0
 Return true if this component has mapped the address. More...
 
virtual uint24_t getRelativeAddress (uint24_t addr) const =0
 Translate an absolute address to a relative address. More...
 
virtual uint24_t getSize () const =0
 Get the size of the data. This size can be lower than the mapped data. More...
 
virtual std::string getName () const =0
 Get the name of this accessor (used for debug purpose) More...
 
virtual Component getComponent () const =0
 Get the component of this accessor (used for debug purpose) More...
 
virtual std::string getValueName (uint24_t addr) const =0
 Get the name of the data at the address. More...
 
virtual ~IMemory ()=default
 A virtual default destructor. More...
 

Detailed Description

Common interface implemented by all components mapping memory.

Constructor & Destructor Documentation

◆ ~IMemory()

virtual ComSquare::Memory::IMemory::~IMemory ( )
virtualdefault

A virtual default destructor.

Member Function Documentation

◆ getComponent()

virtual Component ComSquare::Memory::IMemory::getComponent ( ) const
pure virtual

◆ getName()

virtual std::string ComSquare::Memory::IMemory::getName ( ) const
pure virtual

◆ getRelativeAddress()

virtual uint24_t ComSquare::Memory::IMemory::getRelativeAddress ( uint24_t  addr) const
pure virtual

Translate an absolute address to a relative address.

Parameters
addrThe absolute address (in the 24 bit bus)
Returns
The local address (0 refers to the first byte of this component).
Exceptions
InvalidAddressis thrown if the address is not mapped by this component.

Implemented in ComSquare::Memory::RectangleShadow, ComSquare::Memory::ARectangleMemory, and ComSquare::Memory::AMemory.

◆ getSize()

virtual uint24_t ComSquare::Memory::IMemory::getSize ( ) const
pure virtual

Get the size of the data. This size can be lower than the mapped data.

Returns
The number of bytes inside this memory.

Implemented in ComSquare::CPU::CPU, ComSquare::APU::APU, ComSquare::Cartridge::Cartridge, ComSquare::PPU::PPU, ComSquare::APU::IPL::IPL, ComSquare::Ram::Ram, ComSquare::Memory::RectangleShadow, and ComSquare::Memory::MemoryShadow.

◆ getValueName()

virtual std::string ComSquare::Memory::IMemory::getValueName ( uint24_t  addr) const
pure virtual

Get the name of the data at the address.

Parameters
addrThe address (in local space)

Implemented in ComSquare::CPU::CPU, ComSquare::APU::APU, ComSquare::PPU::PPU, ComSquare::APU::IPL::IPL, ComSquare::Memory::MemoryShadow, and ComSquare::Memory::ARectangleMemory.

◆ hasMemoryAt()

virtual bool ComSquare::Memory::IMemory::hasMemoryAt ( uint24_t  addr) const
pure virtual

Return true if this component has mapped the address.

Parameters
addrThe address to check.
Returns
True if this address is mapped to the component. False otherwise.

Implemented in ComSquare::Memory::AMemory, and ComSquare::Memory::ARectangleMemory.

◆ read()

virtual uint8_t ComSquare::Memory::IMemory::read ( uint24_t  addr)
pure virtual

Read data from the component.

Parameters
addrThe local address to read from (0x0 should refer to the first byte of this component).
Exceptions
Thisfunction should thrown an InvalidAddress for address that are not mapped to the component.
Returns
Return the data at the address given as parameter.

Implemented in ComSquare::CPU::CPU, ComSquare::APU::APU, ComSquare::Cartridge::Cartridge, ComSquare::PPU::PPU, ComSquare::APU::IPL::IPL, ComSquare::Memory::RectangleShadow, ComSquare::Ram::Ram, and ComSquare::Memory::MemoryShadow.

◆ write()

virtual void ComSquare::Memory::IMemory::write ( uint24_t  addr,
uint8_t  data 
)
pure virtual

Write data to this component.

Parameters
addrThe local address to write data (0x0 should refer to the first byte of this component).
dataThe new data to write.
Exceptions
Thisfunction should thrown an InvalidAddress for address that are not mapped to the component.

Implemented in ComSquare::CPU::CPU, ComSquare::APU::APU, ComSquare::Cartridge::Cartridge, ComSquare::PPU::PPU, ComSquare::APU::IPL::IPL, ComSquare::Memory::RectangleShadow, ComSquare::Ram::Ram, and ComSquare::Memory::MemoryShadow.


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