Reworking the memory management & fixing a bug in the memory viewer goto

This commit is contained in:
Zoe Roux
2021-02-03 23:43:07 +01:00
parent 0b28719f41
commit 874c21b0fd
29 changed files with 295 additions and 307 deletions
+4 -13
View File
@@ -27,29 +27,20 @@ namespace ComSquare::Ram
delete[] this->_data;
}
uint8_t Ram::read_internal(uint24_t addr)
uint8_t Ram::read(uint24_t addr)
{
if (addr >= this->_size)
throw InvalidAddress("Ram read", addr);
throw InvalidAddress(this->getName() + " read", addr);
return this->_data[addr];
}
void Ram::write_internal(uint24_t addr, uint8_t data)
void Ram::write(uint24_t addr, uint8_t data)
{
if (addr >= this->_size)
throw InvalidAddress("Ram write", addr);
throw InvalidAddress(this->getName() + " write", addr);
this->_data[addr] = data;
}
void Ram::memset(uint24_t start, uint24_t end, uint8_t value)
{
if (end >= this->_size)
throw InvalidAddress("Ram memset end", end);
if (start >= end)
throw InvalidAddress("Ram memset start", start);
std::memset(&this->_data[start], value, sizeof(uint8_t) * (end - start));
}
size_t Ram::getSize()
{
return this->_size;