mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-25 03:32:01 +00:00
Implements install_roms on the Electron, Oric and ZX80/81.
This commit is contained in:
parent
d605022ea3
commit
35da3edf60
@ -43,7 +43,8 @@ class ConcreteMachine:
|
||||
uint8_t *target = nullptr;
|
||||
switch(slot) {
|
||||
case ROMSlotDFS: dfs_ = data; return;
|
||||
case ROMSlotADFS: adfs_ = data; return;
|
||||
case ROMSlotADFS1: adfs1_ = data; return;
|
||||
case ROMSlotADFS2: adfs2_ = data; return;
|
||||
|
||||
case ROMSlotOS: target = os_; break;
|
||||
default:
|
||||
@ -55,6 +56,28 @@ class ConcreteMachine:
|
||||
memcpy(target, &data[0], std::min(static_cast<size_t>(16384), data.size()));
|
||||
}
|
||||
|
||||
// Obtains the system ROMs.
|
||||
bool install_roms(const std::function<std::unique_ptr<std::vector<uint8_t>>(const std::string &machine, const std::string &name)> &rom_with_name) override {
|
||||
ROMSlot slots[] = {
|
||||
ROMSlotDFS,
|
||||
ROMSlotADFS1, ROMSlotADFS2,
|
||||
ROMSlotBASIC, ROMSlotOS
|
||||
};
|
||||
const char *os_files[] = {
|
||||
"DFS-1770-2.20.rom",
|
||||
"ADFS-E00_1.rom", "ADFS-E00_2.rom",
|
||||
"basic.rom", "os.rom"
|
||||
};
|
||||
|
||||
for(size_t index = 0; index < sizeof(os_files) / sizeof(*os_files); ++index) {
|
||||
auto data = rom_with_name("Electron", os_files[index]);
|
||||
if(!data) return false;
|
||||
set_rom(slots[index], *data, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void set_key_state(uint16_t key, bool isPressed) override final {
|
||||
if(key == KeyBreak) {
|
||||
m6502_.set_reset_line(isPressed);
|
||||
@ -91,8 +114,8 @@ class ConcreteMachine:
|
||||
set_rom(ROMSlot0, dfs_, true);
|
||||
}
|
||||
if(target.acorn.has_adfs) {
|
||||
set_rom(ROMSlot4, adfs_, true);
|
||||
set_rom(ROMSlot5, std::vector<uint8_t>(adfs_.begin() + 16384, adfs_.end()), true);
|
||||
set_rom(ROMSlot4, adfs1_, true);
|
||||
set_rom(ROMSlot5, adfs2_, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -435,7 +458,7 @@ class ConcreteMachine:
|
||||
uint8_t roms_[16][16384];
|
||||
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_, adfs_;
|
||||
std::vector<uint8_t> dfs_, adfs1_, adfs2_;
|
||||
|
||||
// Paging
|
||||
ROMSlot active_rom_ = ROMSlot::ROMSlot0;
|
||||
|
@ -28,7 +28,8 @@ enum ROMSlot: uint8_t {
|
||||
|
||||
ROMSlot12, ROMSlot13, ROMSlot14, ROMSlot15,
|
||||
|
||||
ROMSlotOS, ROMSlotDFS, ROMSlotADFS
|
||||
ROMSlotOS, ROMSlotDFS,
|
||||
ROMSlotADFS1, ROMSlotADFS2
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -203,6 +203,22 @@ class ConcreteMachine:
|
||||
}
|
||||
}
|
||||
|
||||
// Obtains the system ROMs.
|
||||
bool install_roms(const std::function<std::unique_ptr<std::vector<uint8_t>>(const std::string &machine, const std::string &name)> &rom_with_name) override {
|
||||
const char *os_files[] = {
|
||||
"basic10.rom", "basic11.rom",
|
||||
"microdisc.rom", "colour.rom"
|
||||
};
|
||||
|
||||
for(size_t index = 0; index < sizeof(os_files) / sizeof(*os_files); ++index) {
|
||||
auto data = rom_with_name("Oric", os_files[index]);
|
||||
if(!data) return false;
|
||||
set_rom(static_cast<ROM>(index), *data);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void set_key_state(uint16_t key, bool is_pressed) override final {
|
||||
if(key == KeyNMI) {
|
||||
m6502_.set_nmi_line(is_pressed);
|
||||
|
@ -19,7 +19,7 @@
|
||||
namespace Oric {
|
||||
|
||||
enum ROM {
|
||||
BASIC10, BASIC11, Microdisc, Colour
|
||||
BASIC10 = 0, BASIC11, Microdisc, Colour
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -297,6 +297,21 @@ template<bool is_zx81> class ConcreteMachine:
|
||||
}
|
||||
}
|
||||
|
||||
// Obtains the system ROMs.
|
||||
bool install_roms(const std::function<std::unique_ptr<std::vector<uint8_t>>(const std::string &machine, const std::string &name)> &rom_with_name) override {
|
||||
const char *os_files[] = {
|
||||
"zx80.rom", "zx81.rom",
|
||||
};
|
||||
|
||||
for(size_t index = 0; index < sizeof(os_files) / sizeof(*os_files); ++index) {
|
||||
auto data = rom_with_name("ZX8081", os_files[index]);
|
||||
if(!data) return false;
|
||||
set_rom(static_cast<ROMType>(index), *data);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma mark - Keyboard
|
||||
|
||||
void set_key_state(uint16_t key, bool isPressed) override final {
|
||||
|
@ -19,7 +19,7 @@
|
||||
namespace ZX8081 {
|
||||
|
||||
enum ROMType: uint8_t {
|
||||
ZX80, ZX81
|
||||
ZX80 = 0, ZX81
|
||||
};
|
||||
|
||||
class Machine:
|
||||
|
Loading…
Reference in New Issue
Block a user