mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-06-03 02:23:49 +00:00
Making the ram viewer goto works with rectangle memories
This commit is contained in:
@@ -10,6 +10,7 @@ namespace ComSquare::Memory
|
|||||||
{
|
{
|
||||||
uint8_t IRectangleMemory::read(uint24_t addr)
|
uint8_t IRectangleMemory::read(uint24_t addr)
|
||||||
{
|
{
|
||||||
|
addr += this->getStart();
|
||||||
uint8_t bank = addr >> 16u;
|
uint8_t bank = addr >> 16u;
|
||||||
uint16_t page = addr;
|
uint16_t page = addr;
|
||||||
unsigned bankCount = bank - this->_startBank;
|
unsigned bankCount = bank - this->_startBank;
|
||||||
@@ -26,6 +27,7 @@ namespace ComSquare::Memory
|
|||||||
|
|
||||||
void IRectangleMemory::write(uint24_t addr, uint8_t data)
|
void IRectangleMemory::write(uint24_t addr, uint8_t data)
|
||||||
{
|
{
|
||||||
|
addr += this->getStart();
|
||||||
uint8_t bank = addr >> 16u;
|
uint8_t bank = addr >> 16u;
|
||||||
uint16_t page = addr;
|
uint16_t page = addr;
|
||||||
unsigned bankCount = bank - this->_startBank;
|
unsigned bankCount = bank - this->_startBank;
|
||||||
@@ -53,7 +55,7 @@ namespace ComSquare::Memory
|
|||||||
|
|
||||||
uint24_t IRectangleMemory::getStart()
|
uint24_t IRectangleMemory::getStart()
|
||||||
{
|
{
|
||||||
return 0;
|
return (this->_startBank << 16u) + this->_startPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IRectangleMemory::setMemoryRegion(uint8_t startBank, uint8_t endBank, uint16_t startPage, uint16_t endPage)
|
void IRectangleMemory::setMemoryRegion(uint8_t startBank, uint8_t endBank, uint16_t startPage, uint16_t endPage)
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ namespace ComSquare::Memory
|
|||||||
//! @param addr The address to check.
|
//! @param addr The address to check.
|
||||||
//! @return True if this address is mapped to the component. False otherwise.
|
//! @return True if this address is mapped to the component. False otherwise.
|
||||||
bool hasMemoryAt(uint24_t addr) override;
|
bool hasMemoryAt(uint24_t addr) override;
|
||||||
//! @brief This override the getStart of the IMemory to return 0 since the read and write of the rectangle memory take a 24 bit global address and not a component's address..
|
//! @brief Get the first address mapped to this component.
|
||||||
//! @return always 0.
|
//! @return the _start value.
|
||||||
uint24_t getStart() override;
|
uint24_t getStart() override;
|
||||||
//! @brief Change starting and ending points of this mapped memory.
|
//! @brief Change starting and ending points of this mapped memory.
|
||||||
//! @param startBank The first bank mapped to this component.
|
//! @param startBank The first bank mapped to this component.
|
||||||
|
|||||||
Reference in New Issue
Block a user