1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-25 18:30:07 +00:00

Adds support for installing the AP6 ROM and/or sideways RAM.

This commit is contained in:
Thomas Harte 2021-01-30 19:38:19 -05:00
parent ac95e4d758
commit 4636d8dfb7
2 changed files with 42 additions and 1 deletions

View File

@ -20,6 +20,8 @@ namespace Acorn {
struct Target: public ::Analyser::Static::Target, public Reflection::StructImpl<Target> {
bool has_adfs = false;
bool has_dfs = false;
bool has_ap6_rom = false;
bool has_sideways_ram = false;
bool should_shift_restart = false;
std::string loading_command;
@ -27,6 +29,8 @@ struct Target: public ::Analyser::Static::Target, public Reflection::StructImpl<
if(needs_declare()) {
DeclareField(has_adfs);
DeclareField(has_dfs);
DeclareField(has_ap6_rom);
DeclareField(has_sideways_ram);
}
}
};

View File

@ -72,6 +72,10 @@ class ConcreteMachine:
if(target.has_dfs) {
required_roms.emplace_back(machine_name, "the 1770 DFS ROM", "DFS-1770-2.20.rom", 16*1024, 0xf3dc9bc5);
}
const size_t ap6_rom_position = required_roms.size();
if(target.has_ap6_rom) {
required_roms.emplace_back(machine_name, "the 8kb Advanced Plus 6 ROM", "AP6v133.rom", 8*1024, 0xe0013cfc);
}
const auto roms = rom_fetcher(required_roms);
for(const auto &rom: roms) {
@ -82,6 +86,15 @@ class ConcreteMachine:
set_rom(ROM::BASIC, *roms[0], false);
set_rom(ROM::OS, *roms[1], false);
/*
ROM slot mapping applied:
* the keyboard and BASIC ROMs occupy slots 8, 9, 10 and 11;
* the DFS, if in use, occupies slot 1;
* the ADFS, if in use, occupies slots 4 and 5;
* the AP6, if in use, occupies slot 15; and
* if sideways RAM was asked for, all otherwise unused slots are populated with sideways RAM.
*/
if(target.has_dfs || target.has_adfs) {
plus3_ = std::make_unique<Plus3>();
@ -94,6 +107,18 @@ class ConcreteMachine:
}
}
if(target.has_ap6_rom) {
set_rom(ROM::Slot15, *roms[ap6_rom_position], true);
}
if(target.has_sideways_ram) {
for(int c = 0; c < 16; c++) {
if(rom_inserted_[c]) continue;
if(c >= int(ROM::Keyboard) && c < int(ROM::BASIC)+1) continue;
set_sideways_ram(ROM(c));
}
}
insert_media(target.media);
if(!target.loading_command.empty()) {
@ -517,8 +542,20 @@ class ConcreteMachine:
rom_ptr += size_to_copy;
}
if(int(slot) < 16)
if(int(slot) < 16) {
rom_inserted_[int(slot)] = true;
}
}
/*!
Enables @c slot as sideways RAM; ensures that it does not currently contain a valid ROM signature.
*/
void set_sideways_ram(ROM slot) {
std::memset(roms_[int(slot)], 0xff, 16*1024);
if(int(slot) < 16) {
rom_inserted_[int(slot)] = true;
rom_write_masks_[int(slot)] = true;
}
}
// MARK: - Work deferral updates.