mirror of
https://github.com/zoriya/ComSquare.git
synced 2025-12-21 14:45:10 +00:00
merge master into PPU
This commit is contained in:
@@ -3,53 +3,64 @@
|
||||
//
|
||||
|
||||
#include "RectangleShadow.hpp"
|
||||
#include "../Utility/Utility.hpp"
|
||||
|
||||
#include <utility>
|
||||
#include <iostream>
|
||||
|
||||
namespace ComSquare::Memory
|
||||
{
|
||||
RectangleShadow::RectangleShadow(std::shared_ptr<ARectangleMemory> initial, uint8_t startBank, uint8_t endBank, uint16_t startPage, uint16_t endPage)
|
||||
RectangleShadow::RectangleShadow(std::shared_ptr<IMemory> initial,
|
||||
uint8_t startBank,
|
||||
uint8_t endBank,
|
||||
uint16_t startPage,
|
||||
uint16_t endPage)
|
||||
: _initial(std::move(initial))
|
||||
{
|
||||
this->setMemoryRegion(startBank, endBank, startPage, endPage);
|
||||
}
|
||||
|
||||
uint8_t RectangleShadow::read_internal(uint24_t addr)
|
||||
uint24_t RectangleShadow::getRelativeAddress(uint24_t addr) const
|
||||
{
|
||||
addr += this->_bankOffset * (this->_endPage - this->_startPage);
|
||||
return this->_initial->read_internal(addr);
|
||||
uint24_t base = ARectangleMemory::getRelativeAddress(addr);
|
||||
return base + this->_bankOffset * (1 + this->_endPage - this->_startPage);
|
||||
}
|
||||
|
||||
void RectangleShadow::write_internal(uint24_t addr, uint8_t data)
|
||||
uint8_t RectangleShadow::read(uint24_t addr)
|
||||
{
|
||||
addr += this->_bankOffset * (this->_endPage - this->_startPage);
|
||||
this->_initial->write_internal(addr, data);
|
||||
return this->_initial->read(addr);
|
||||
}
|
||||
|
||||
RectangleShadow *RectangleShadow::setBankOffset(uint8_t bankOffset)
|
||||
void RectangleShadow::write(uint24_t addr, uint8_t data)
|
||||
{
|
||||
return this->_initial->write(addr, data);
|
||||
}
|
||||
|
||||
RectangleShadow *RectangleShadow::setBankOffset(int bankOffset)
|
||||
{
|
||||
this->_bankOffset = bankOffset;
|
||||
return this;
|
||||
}
|
||||
|
||||
bool RectangleShadow::isMirror()
|
||||
uint24_t RectangleShadow::getSize() const
|
||||
{
|
||||
return this->_initial->getSize();
|
||||
}
|
||||
|
||||
bool RectangleShadow::isMirror() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::shared_ptr<AMemory> RectangleShadow::getMirrored()
|
||||
std::shared_ptr<IMemory> RectangleShadow::getMirrored() const
|
||||
{
|
||||
return this->_initial;
|
||||
}
|
||||
|
||||
std::string RectangleShadow::getName()
|
||||
std::string RectangleShadow::getName() const
|
||||
{
|
||||
return this->_initial->getName();
|
||||
}
|
||||
|
||||
Component RectangleShadow::getComponent()
|
||||
Component RectangleShadow::getComponent() const
|
||||
{
|
||||
return this->_initial->getComponent();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user