diff --git a/Machines/AmstradCPC/AmstradCPC.cpp b/Machines/AmstradCPC/AmstradCPC.cpp index 023894542..6622ae584 100644 --- a/Machines/AmstradCPC/AmstradCPC.cpp +++ b/Machines/AmstradCPC/AmstradCPC.cpp @@ -929,11 +929,6 @@ class ConcreteMachine: return !media.tapes.empty() || (!media.disks.empty() && has_fdc_); } - // See header; provides the system ROMs. - void set_rom(ROMType type, const std::vector &data) { - roms_[static_cast(type)] = data; - } - // Obtains the system ROMs. bool set_rom_fetcher(const std::function>>(const std::string &machine, const std::vector &names)> &roms_with_names) override { auto roms = roms_with_names( @@ -948,7 +943,8 @@ class ConcreteMachine: for(std::size_t index = 0; index < roms.size(); ++index) { auto &data = roms[index]; if(!data) return false; - set_rom(static_cast(index), *data); + roms_[static_cast(index)] = std::move(*data); + roms_[static_cast(index)].resize(16384); } return true; diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index 22051d711..2416efed8 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -335,8 +335,14 @@ class ConcreteMachine: for(std::size_t index = 0; index < roms.size(); ++index) { auto &data = roms[index]; if(!data) return false; - if(index < 9) roms_[index] = *data; else basic_rom_ = *data; + if(index < 9) roms_[index] = std::move(*data); else basic_rom_ = std::move(*data); } + + // Characters ROMs should be 4kb. + for(std::size_t index = 0; index < 4; ++index) roms_[index].resize(4096); + // Kernel ROMs and the BASIC ROM should be 8kb. + for(std::size_t index = 4; index < roms.size(); ++index) roms_[index].resize(8192); + return true; } diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index ac0b3a08a..5d3db3ce5 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -204,18 +204,6 @@ class ConcreteMachine: Memory::Fuzz(ram_, sizeof(ram_)); } - void set_rom(ROM rom, const std::vector &data) { - switch(rom) { - case BASIC11: basic11_rom_ = std::move(data); break; - case BASIC10: basic10_rom_ = std::move(data); break; - case Microdisc: microdisc_rom_ = std::move(data); break; - case Colour: - colour_rom_ = std::move(data); - if(video_output_) video_output_->set_colour_rom(colour_rom_); - break; - } - } - // Obtains the system ROMs. bool set_rom_fetcher(const std::function>>(const std::string &machine, const std::vector &names)> &roms_with_names) override { auto roms = roms_with_names( @@ -226,10 +214,20 @@ class ConcreteMachine: }); for(std::size_t index = 0; index < roms.size(); ++index) { - auto &data = roms[index]; - if(!data) return false; - set_rom(static_cast(index), *data); + if(!roms[index]) return false; } + + basic10_rom_ = std::move(*roms[0]); + basic11_rom_ = std::move(*roms[1]); + microdisc_rom_ = std::move(*roms[2]); + colour_rom_ = std::move(*roms[3]); + + basic10_rom_.resize(16384); + basic11_rom_.resize(16384); + microdisc_rom_.resize(8192); + colour_rom_.resize(128); + + if(video_output_) video_output_->set_colour_rom(colour_rom_); return true; } diff --git a/Machines/ZX8081/ZX8081.cpp b/Machines/ZX8081/ZX8081.cpp index 470bd0afd..731d56871 100644 --- a/Machines/ZX8081/ZX8081.cpp +++ b/Machines/ZX8081/ZX8081.cpp @@ -297,13 +297,6 @@ template class ConcreteMachine: Utility::TypeRecipient::set_typer_for_string(string, std::move(mapper)); } - void set_rom(ROMType type, const std::vector &data) { - switch(type) { - case ZX80: zx80_rom_ = data; break; - case ZX81: zx81_rom_ = data; break; - } - } - // Obtains the system ROMs. bool set_rom_fetcher(const std::function>>(const std::string &machine, const std::vector &names)> &roms_with_names) override { auto roms = roms_with_names( @@ -313,11 +306,14 @@ template class ConcreteMachine: }); for(std::size_t index = 0; index < roms.size(); ++index) { - auto &data = roms[index]; - if(!data) return false; - set_rom(static_cast(index), *data); + if(!roms[index]) return false; } + zx80_rom_ = std::move(*roms[0]); + zx81_rom_ = std::move(*roms[1]); + zx80_rom_.resize(4096); + zx81_rom_.resize(8192); + return true; }