1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-21 17:16:44 +00:00

Differentiate unmapped and mapped-for-handler.

This commit is contained in:
Thomas Harte
2023-01-16 19:52:40 -05:00
parent a5b9bdc18c
commit 055e9cdf8d
4 changed files with 24 additions and 10 deletions
+15 -5
View File
@@ -16,10 +16,7 @@ PrimarySlot::PrimarySlot(MemorySlotChangeHandler &handler) :
subslots_{handler, handler, handler, handler} {}
MemorySlot::MemorySlot(MemorySlotChangeHandler &handler) : handler_(handler) {
for(int region = 0; region < 8; region++) {
read_pointers_[region] = unmapped.data();
write_pointers_[region] = scratch.data();
}
unmap(0x0000, 0x10000);
}
void PrimarySlot::set_secondary_paging(uint8_t value) {
@@ -85,7 +82,7 @@ void MemorySlot::map(std::size_t source_address, uint16_t destination_address, s
handler_.did_page();
}
void MemorySlot::unmap(uint16_t destination_address, std::size_t length) {
void MemorySlot::map_handler(uint16_t destination_address, std::size_t length) {
assert(!(destination_address & 8191));
assert(!(length & 8191));
assert(size_t(destination_address) + length <= 65536);
@@ -97,6 +94,19 @@ void MemorySlot::unmap(uint16_t destination_address, std::size_t length) {
handler_.did_page();
}
void MemorySlot::unmap(uint16_t destination_address, std::size_t length) {
assert(!(destination_address & 8191));
assert(!(length & 8191));
assert(size_t(destination_address) + length <= 65536);
for(std::size_t c = 0; c < (length >> 13); ++c) {
read_pointers_[(destination_address >> 13) + c] = unmapped.data();
write_pointers_[(destination_address >> 13) + c] = scratch.data();
}
handler_.did_page();
}
MemorySlot &PrimarySlot::subslot(int slot) {
return subslots_[slot];
}