mirror of
https://github.com/TomHarte/CLK.git
synced 2024-10-04 01:57:54 +00:00
Simplifies banks $02+ to a single region.
This commit is contained in:
parent
267e28e012
commit
8604b1786e
@ -130,32 +130,11 @@ class MemoryMap {
|
|||||||
0xffff
|
0xffff
|
||||||
});
|
});
|
||||||
|
|
||||||
// Banks $02–[end of RAM]: all locations potentially affected by shadowing.
|
// Banks $02–[end of RAM]: a single region.
|
||||||
const uint8_t fast_ram_bank_count = uint8_t((ram.size() - 0x02'0000) / 0x01'0000);
|
const auto fast_region = region();
|
||||||
if(fast_ram_bank_count > 2) {
|
const uint8_t fast_ram_bank_limit = uint8_t(ram.size() / 0x01'0000);
|
||||||
const std::vector<uint8_t> evens = {
|
for(uint8_t bank = 0x02; bank < fast_ram_bank_limit; bank++) {
|
||||||
region(), // 0x0000 – 0x0400.
|
set_region(bank, 0x0000, 0xffff, fast_region);
|
||||||
region(), // 0x0400 – 0x0800.
|
|
||||||
region(), // 0x0800 – 0x0c00.
|
|
||||||
region(), // 0x0c00 – 0x2000.
|
|
||||||
region(), // 0x2000 – 0x4000.
|
|
||||||
region(), // 0x4000 – 0x6000.
|
|
||||||
region(), // 0x6000 – [end].
|
|
||||||
};
|
|
||||||
const std::vector<uint8_t> odds = {
|
|
||||||
region(), // 0x0000 – 0x0400.
|
|
||||||
region(), // 0x0400 – 0x0800.
|
|
||||||
region(), // 0x0800 – 0x0c00.
|
|
||||||
region(), // 0x0c00 – 0x2000.
|
|
||||||
region(), // 0x2000 – 0x4000.
|
|
||||||
region(), // 0x4000 – 0x6000.
|
|
||||||
region(), // 0x6000 – 0xa000.
|
|
||||||
region(), // 0xa000 – [end].
|
|
||||||
};
|
|
||||||
for(uint8_t bank = 0x02; bank < fast_ram_bank_count; bank += 2) {
|
|
||||||
set_regions(bank, {0x0400, 0x0800, 0x0c00, 0x2000, 0x4000, 0x6000, 0xffff}, evens);
|
|
||||||
set_regions(bank+1, {0x0400, 0x0800, 0x0c00, 0x2000, 0x4000, 0x6000, 0xa000, 0xffff}, odds);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// [Banks $80–$e0: empty].
|
// [Banks $80–$e0: empty].
|
||||||
@ -430,15 +409,6 @@ class MemoryMap {
|
|||||||
//
|
//
|
||||||
// Completely distinct from the auxiliary and language card switches.
|
// Completely distinct from the auxiliary and language card switches.
|
||||||
void set_shadowing() {
|
void set_shadowing() {
|
||||||
// Disables shadowing for the region starting from @c zone if @c flag is true;
|
|
||||||
// otherwise enables it.
|
|
||||||
#define apply(disable, zone) \
|
|
||||||
if(disable) { \
|
|
||||||
regions[region_map[zone]].flags &= ~Region::IsShadowed; \
|
|
||||||
} else { \
|
|
||||||
regions[region_map[zone]].flags |= Region::IsShadowed; \
|
|
||||||
}
|
|
||||||
|
|
||||||
// Relevant bits:
|
// Relevant bits:
|
||||||
//
|
//
|
||||||
// b5: inhibit shadowing, text page 2 [if ROM 03; as if always set otherwise]
|
// b5: inhibit shadowing, text page 2 [if ROM 03; as if always set otherwise]
|
||||||
@ -492,8 +462,6 @@ class MemoryMap {
|
|||||||
for(size_t c = 0x6000 >> shadow_shift; c < 0xa000 >> shadow_shift; c++) {
|
for(size_t c = 0x6000 >> shadow_shift; c < 0xa000 >> shadow_shift; c++) {
|
||||||
is_shadowed[c+auxiliary_offset] = !(shadow_register_ & 0x08);
|
is_shadowed[c+auxiliary_offset] = !(shadow_register_ & 0x08);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef apply
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cf. the AuxiliarySwitches; establishes whether main or auxiliary RAM
|
// Cf. the AuxiliarySwitches; establishes whether main or auxiliary RAM
|
||||||
@ -594,7 +562,7 @@ class MemoryMap {
|
|||||||
// Contains a flag for every page in the final 128kb of memory, indicating whether it is
|
// Contains a flag for every page in the final 128kb of memory, indicating whether it is
|
||||||
// currently subject to shadowing.
|
// currently subject to shadowing.
|
||||||
std::bitset<128> is_shadowed;
|
std::bitset<128> is_shadowed;
|
||||||
bool enable_all_pages_shadowing = true;
|
bool enable_all_pages_shadowing = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: branching below on region.read/write is predicated on the idea that extra scratch space
|
// TODO: branching below on region.read/write is predicated on the idea that extra scratch space
|
||||||
|
Loading…
Reference in New Issue
Block a user