1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

Merge branch 'master' into MSX

This commit is contained in:
Thomas Harte 2017-11-25 08:19:24 -05:00
commit f90b3f06aa
4 changed files with 28 additions and 32 deletions

View File

@ -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<uint8_t> &data) {
roms_[static_cast<int>(type)] = data;
}
// Obtains the system ROMs.
bool set_rom_fetcher(const std::function<std::vector<std::unique_ptr<std::vector<uint8_t>>>(const std::string &machine, const std::vector<std::string> &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<ROMType>(index), *data);
roms_[static_cast<int>(index)] = std::move(*data);
roms_[static_cast<int>(index)].resize(16384);
}
return true;

View File

@ -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;
}

View File

@ -204,18 +204,6 @@ class ConcreteMachine:
Memory::Fuzz(ram_, sizeof(ram_));
}
void set_rom(ROM rom, const std::vector<uint8_t> &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<std::vector<std::unique_ptr<std::vector<uint8_t>>>(const std::string &machine, const std::vector<std::string> &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<ROM>(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;
}

View File

@ -297,13 +297,6 @@ template<bool is_zx81> class ConcreteMachine:
Utility::TypeRecipient::set_typer_for_string(string, std::move(mapper));
}
void set_rom(ROMType type, const std::vector<uint8_t> &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<std::vector<std::unique_ptr<std::vector<uint8_t>>>(const std::string &machine, const std::vector<std::string> &names)> &roms_with_names) override {
auto roms = roms_with_names(
@ -313,11 +306,14 @@ template<bool is_zx81> class ConcreteMachine:
});
for(std::size_t index = 0; index < roms.size(); ++index) {
auto &data = roms[index];
if(!data) return false;
set_rom(static_cast<ROMType>(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;
}