Memory locking is dependent on the GB hardware, not the size of the program, so allow lock ranges to be manually specified.

Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
Adrian.Conlon 2017-07-18 21:40:29 +01:00
parent 974c3353cc
commit 99e3454527
2 changed files with 5 additions and 1 deletions

View File

@ -98,6 +98,10 @@ namespace EightBit {
void loadRom(const std::string& path, uint16_t offset);
void loadRam(const std::string& path, uint16_t offset);
void lock(int address, int size) {
std::fill(m_locked.begin() + address, m_locked.begin() + address + size, true);
}
protected:
std::array<uint8_t, 0x10000> m_bus;
std::array<bool, 0x10000> m_locked;

View File

@ -35,7 +35,7 @@ void EightBit::Memory::clear() {
void EightBit::Memory::loadRom(const std::string& path, uint16_t offset) {
auto size = loadMemory(path, offset);
std::fill(m_locked.begin() + offset, m_locked.begin() + offset + size, true);
lock(offset, size);
}
void EightBit::Memory::loadRam(const std::string& path, uint16_t offset) {