Correct the hex loader, using the new mapping mechanism.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2018-09-16 17:54:53 +01:00
parent fe3794e011
commit 2d93087e5f

View File

@ -31,10 +31,9 @@ void EightBit::Bus::loadHexFile(const std::string path) {
for (const auto& chunk : chunks) {
const auto address = chunk.first;
const auto content = chunk.second;
for (size_t i = 0; i != content.size(); ++i)
write((uint16_t)(address + i), content[i]);
const auto mapped = mapping(address);
mapped.memory.load(content, address - mapped.begin);
const uint16_t offset = address - mapped.begin;
mapped.memory.load(content, offset);
}
}