1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-09 17:29:36 +00:00

Merge pull request #339 from TomHarte/AcornROMs

Allows the Electron to load 8kb ROMs.
This commit is contained in:
Thomas Harte 2018-01-15 18:28:19 -08:00 committed by GitHub
commit cdae0fa593
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -66,7 +66,13 @@ class ConcreteMachine:
break;
}
std::memcpy(target, &data[0], std::min(static_cast<std::size_t>(16384), data.size()));
// Copy in, with mirroring.
std::size_t rom_ptr = 0;
while(rom_ptr < 16384) {
std::size_t size_to_copy = std::min(16384 - rom_ptr, data.size());
std::memcpy(&target[rom_ptr], data.data(), size_to_copy);
rom_ptr += size_to_copy;
}
}
// Obtains the system ROMs.

View File

@ -23,9 +23,9 @@ static std::list<std::shared_ptr<Storage::Cartridge::Cartridge>>
// only one mapped item is allowed
if(segments.size() != 1) continue;
// which must be 16 kb in size
// which must be 8 or 16 kb in size
Storage::Cartridge::Cartridge::Segment segment = segments.front();
if(segment.data.size() != 0x4000) continue;
if(segment.data.size() != 0x4000 && segment.data.size() != 0x2000) continue;
// is a copyright string present?
uint8_t copyright_offset = segment.data[7];