Making the ram viewer goto works with rectangle memories

This commit is contained in:
Anonymus Raccoon
2020-02-25 20:29:53 +01:00
parent 298f02890e
commit 4eff507c75
2 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -10,6 +10,7 @@ namespace ComSquare::Memory
{
uint8_t IRectangleMemory::read(uint24_t addr)
{
addr += this->getStart();
uint8_t bank = addr >> 16u;
uint16_t page = addr;
unsigned bankCount = bank - this->_startBank;
@@ -26,6 +27,7 @@ namespace ComSquare::Memory
void IRectangleMemory::write(uint24_t addr, uint8_t data)
{
addr += this->getStart();
uint8_t bank = addr >> 16u;
uint16_t page = addr;
unsigned bankCount = bank - this->_startBank;
@@ -53,7 +55,7 @@ namespace ComSquare::Memory
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)
+2 -2
View File
@@ -46,8 +46,8 @@ namespace ComSquare::Memory
//! @param addr The address to check.
//! @return True if this address is mapped to the component. False otherwise.
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..
//! @return always 0.
//! @brief Get the first address mapped to this component.
//! @return the _start value.
uint24_t getStart() override;
//! @brief Change starting and ending points of this mapped memory.
//! @param startBank The first bank mapped to this component.