diff --git a/Machines/Apple/AppleII/AppleII.cpp b/Machines/Apple/AppleII/AppleII.cpp index 8e04458d5..8a857c6ef 100644 --- a/Machines/Apple/AppleII/AppleII.cpp +++ b/Machines/Apple/AppleII/AppleII.cpp @@ -372,6 +372,14 @@ template class ConcreteMachine: } const auto roms = rom_fetcher(rom_descriptions); + // Try to install a Disk II card now, before checking the ROM list, + // to make sure that Disk II dependencies have been communicated. + if(target.disk_controller != Target::DiskController::None) { + // Apple recommended slot 6 for the (first) Disk II. + install_card(6, new Apple::II::DiskIICard(rom_fetcher, target.disk_controller == Target::DiskController::SixteenSector)); + } + + // Now, check and move the ROMs. if(!roms[0] || !roms[1]) { throw ROMMachine::Error::MissingROMs; } @@ -383,11 +391,6 @@ template class ConcreteMachine: video_.set_character_rom(*roms[0]); - if(target.disk_controller != Target::DiskController::None) { - // Apple recommended slot 6 for the (first) Disk II. - install_card(6, new Apple::II::DiskIICard(rom_fetcher, target.disk_controller == Target::DiskController::SixteenSector)); - } - // Set up the default memory blocks. On a II or II+ these values will never change. // On a IIe they'll be affected by selection of auxiliary RAM. set_main_paging(); diff --git a/Machines/Apple/AppleII/DiskIICard.cpp b/Machines/Apple/AppleII/DiskIICard.cpp index dae7b30cf..11349e1fc 100644 --- a/Machines/Apple/AppleII/DiskIICard.cpp +++ b/Machines/Apple/AppleII/DiskIICard.cpp @@ -15,7 +15,7 @@ DiskIICard::DiskIICard(const ROMMachine::ROMFetcher &rom_fetcher, bool is_16_sec if(is_16_sector) { roms = rom_fetcher({ {"DiskII", "the Disk II 16-sector boot ROM", "boot-16.rom", 256, 0xce7144f6}, - {"DiskII", "the Disk II 16-sector state machine ROM", "state-machine-16.rom", 256, { 0xce7144f6, 0xb72a2c70 } } + {"DiskII", "the Disk II 16-sector state machine ROM", "state-machine-16.rom", 256, { 0x9796a238, 0xb72a2c70 } } }); } else { roms = rom_fetcher({ @@ -23,6 +23,10 @@ DiskIICard::DiskIICard(const ROMMachine::ROMFetcher &rom_fetcher, bool is_16_sec {"DiskII", "the Disk II 13-sector state machine ROM", "state-machine-13.rom", 256, 0x62e22620 } }); } + if(!roms[0] || !roms[1]) { + throw ROMMachine::Error::MissingROMs; + } + boot_ = std::move(*roms[0]); diskii_.set_state_machine(*roms[1]); set_select_constraints(None); diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index bbeea6290..b90ce9fd8 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -241,6 +241,7 @@ template class Co rom_names.emplace_back(machine_name, "Pravetz BASIC", "pravetz.rom", 16*1024, 0x58079502); break; } + size_t diskii_state_machine_index = 0; switch(disk_interface) { default: break; case Analyser::Static::Oric::Target::DiskInterface::Microdisc: @@ -248,6 +249,9 @@ template class Co break; case Analyser::Static::Oric::Target::DiskInterface::Pravetz: rom_names.emplace_back(machine_name, "the 8DOS boot ROM", "8dos.rom", 512, 0x49a74c06); + // These ROM details are coupled with those in the DiskIICard. + diskii_state_machine_index = rom_names.size(); + rom_names.push_back({"DiskII", "the Disk II 16-sector state machine ROM", "state-machine-16.rom", 256, { 0x9796a238, 0xb72a2c70 }}); break; } @@ -272,12 +276,7 @@ template class Co pravetz_rom_ = std::move(*roms[2]); pravetz_rom_.resize(512); - // This ROM name is coupled with that in the DiskIICard. - const auto state_machine_rom = rom_fetcher({ {"DiskII", "the Disk II 16-sector state machine ROM", "state-machine-16.rom", 256, { 0xce7144f6, 0xb72a2c70 } } }); - if(!state_machine_rom[0]) { - throw ROMMachine::Error::MissingROMs; - } - diskii_.set_state_machine(*state_machine_rom[0]); + diskii_.set_state_machine(*roms[diskii_state_machine_index]); } break; }