From 2d93087e5f411f72037fd2d153713dbb60c40399 Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Sun, 16 Sep 2018 17:54:53 +0100 Subject: [PATCH] Correct the hex loader, using the new mapping mechanism. Signed-off-by: Adrian Conlon --- src/Bus.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Bus.cpp b/src/Bus.cpp index 04106aa..787d1e3 100644 --- a/src/Bus.cpp +++ b/src/Bus.cpp @@ -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); } }