mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-05-31 17:33:07 +00:00
Reworking the memory management & fixing a bug in the memory viewer goto
This commit is contained in:
+4
-13
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user