Solving a bug with the Rectangle memory

This commit is contained in:
AnonymusRaccoon
2020-02-05 16:42:38 +01:00
parent bc65afb405
commit be33c33e07
2 changed files with 4 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
// Created by anonymus-raccoon on 1/29/20. // Created by anonymus-raccoon on 1/29/20.
// //
#include <iostream>
#include "IRectangleMemory.hpp" #include "IRectangleMemory.hpp"
#include "../Exceptions/InvalidAddress.hpp" #include "../Exceptions/InvalidAddress.hpp"
@@ -44,8 +45,8 @@ namespace ComSquare::Memory
uint8_t bank = addr >> 16u; uint8_t bank = addr >> 16u;
uint16_t page = addr; uint16_t page = addr;
if (this->_startBank <= bank && bank < this->_endBank) if (this->_startBank <= bank && bank <= this->_endBank)
if (this->_startPage <= page && page < this->_endPage) if (this->_startPage <= page && page <= this->_endPage)
return true; return true;
return false; return false;
} }

View File

@@ -15,6 +15,7 @@ namespace ComSquare::Memory
{ {
auto it = std::find_if(this->_memoryAccessors.begin(), this->_memoryAccessors.end(), [addr](std::shared_ptr<IMemory> &accessor) auto it = std::find_if(this->_memoryAccessors.begin(), this->_memoryAccessors.end(), [addr](std::shared_ptr<IMemory> &accessor)
{ {
// std::cout << "Accessor: " << std::hex << accessor->getStart() << " Has access:: " << accessor->hasMemoryAt(addr) << std::endl;
return accessor->hasMemoryAt(addr); return accessor->hasMemoryAt(addr);
}); });
if (it == this->_memoryAccessors.end()) if (it == this->_memoryAccessors.end())