ComSquare
Public Member Functions | Protected Attributes | List of all members
ComSquare::Memory::ARectangleMemory Class Reference

Base memory class to map non continuous rectangle to the memory. (A rectangle that spam across more than one bank but that does not start at $0000 or end at $FFFF). More...

#include <ARectangleMemory.hpp>

Inheritance diagram for ComSquare::Memory::ARectangleMemory:
Collaboration diagram for ComSquare::Memory::ARectangleMemory:

Public Member Functions

uint24_t getRelativeAddress (uint24_t addr) const override
 Translate an absolute address to a relative address. More...
 
bool hasMemoryAt (uint24_t addr) const override
 Return true if this component has mapped the address. More...
 
void setMemoryRegion (uint8_t startBank, uint8_t endBank, uint16_t startPage, uint16_t endPage)
 Change starting and ending points of this mapped memory. More...
 
std::string getValueName (uint24_t addr) const override
 Get the name of the data at the address. More...
 
 ~ARectangleMemory () override=default
 A default destructor. More...
 
- Public Member Functions inherited from ComSquare::Memory::IMemory
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 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 ~IMemory ()=default
 A virtual default destructor. More...
 

Protected Attributes

uint8_t _startBank = 0
 The first bank to map to. More...
 
uint8_t _endBank = 0
 The last bank to map to. More...
 
uint16_t _startPage = 0
 The first address of each bank to map. More...
 
uint16_t _endPage = 0
 The last address of each bank to map. More...
 

Detailed Description

Base memory class to map non continuous rectangle to the memory. (A rectangle that spam across more than one bank but that does not start at $0000 or end at $FFFF).

Constructor & Destructor Documentation

◆ ~ARectangleMemory()

ComSquare::Memory::ARectangleMemory::~ARectangleMemory ( )
overridedefault

A default destructor.

Member Function Documentation

◆ getRelativeAddress()

uint24_t ComSquare::Memory::ARectangleMemory::getRelativeAddress ( uint24_t  addr) const
overridevirtual

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.

Implements ComSquare::Memory::IMemory.

Reimplemented in ComSquare::Memory::RectangleShadow.

◆ getValueName()

std::string ComSquare::Memory::ARectangleMemory::getValueName ( uint24_t  addr) const
overridevirtual

Get the name of the data at the address.

Parameters
addrThe address (in local space)

Implements ComSquare::Memory::IMemory.

◆ hasMemoryAt()

bool ComSquare::Memory::ARectangleMemory::hasMemoryAt ( uint24_t  addr) const
overridevirtual

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.

Implements ComSquare::Memory::IMemory.

◆ setMemoryRegion()

void ComSquare::Memory::ARectangleMemory::setMemoryRegion ( uint8_t  startBank,
uint8_t  endBank,
uint16_t  startPage,
uint16_t  endPage 
)

Change starting and ending points of this mapped memory.

Parameters
startBankThe first bank mapped to this component.
endBankThe last bank mapped to this component.
startPageThe first page mapped to this component (every mapped banks will have this page mapped)
endPageThe end page mapped to this component (every mapped banks will have this pages lower than this mapped)
Warning
The start/end address should be a rectangle. To mirror memory, use the MemoryShadow class and not this one.

Member Data Documentation

◆ _endBank

uint8_t ComSquare::Memory::ARectangleMemory::_endBank = 0
protected

The last bank to map to.

◆ _endPage

uint16_t ComSquare::Memory::ARectangleMemory::_endPage = 0
protected

The last address of each bank to map.

◆ _startBank

uint8_t ComSquare::Memory::ARectangleMemory::_startBank = 0
protected

The first bank to map to.

◆ _startPage

uint16_t ComSquare::Memory::ARectangleMemory::_startPage = 0
protected

The first address of each bank to map.


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