1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Allows multiple ROMs to be inserted into the Electron.

This commit is contained in:
Thomas Harte 2018-04-18 18:13:30 -04:00
parent f22c23cb4c
commit a167e3849b

View File

@ -86,6 +86,7 @@ class ConcreteMachine:
std::memcpy(&target[rom_ptr], data.data(), size_to_copy);
rom_ptr += size_to_copy;
}
rom_inserted_[slot] = true;
}
// Obtains the system ROMs.
@ -158,6 +159,7 @@ class ConcreteMachine:
if(!media.tapes.empty()) {
tape_.set_tape(media.tapes.front());
}
set_use_fast_tape_hack();
if(!media.disks.empty() && plus3_) {
plus3_->set_disk(media.disks.front(), 0);
@ -165,11 +167,14 @@ class ConcreteMachine:
ROMSlot slot = ROMSlot12;
for(std::shared_ptr<Storage::Cartridge::Cartridge> cartridge : media.cartridges) {
const ROMSlot first_slot_tried = slot;
while(rom_inserted_[slot]) {
slot = static_cast<ROMSlot>((static_cast<int>(slot) + 1)&15);
if(slot == first_slot_tried) return false;
}
set_rom(slot, cartridge->get_segments().front().data, false);
slot = static_cast<ROMSlot>((static_cast<int>(slot) + 1)&15);
}
set_use_fast_tape_hack();
return !media.tapes.empty() || !media.disks.empty() || !media.cartridges.empty();
}
@ -513,6 +518,7 @@ class ConcreteMachine:
// Things that directly constitute the memory map.
uint8_t roms_[16][16384];
bool rom_inserted_[16] = {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
bool rom_write_masks_[16] = {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
uint8_t os_[16384], ram_[32768];
std::vector<uint8_t> dfs_, adfs1_, adfs2_;