diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index 33c12acca..edf231b0f 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -636,6 +636,30 @@ class ConcreteMachine: return keyboard_mapper_; } + // MARK: - Configuration options. + std::vector> get_options() override { + std::vector> options; + options.emplace_back(new Configurable::BooleanOption("Load Tapes Quickly", "quickload")); + return options; + } + + void set_selections(const Configurable::SelectionSet &selections_by_option) override { + auto quickload = Configurable::selection(selections_by_option, "quickload"); + if(quickload) set_use_fast_tape_hack(quickload->value); + } + + Configurable::SelectionSet get_accurate_selections() override { + Configurable::SelectionSet selection_set; + selection_set["quickload"] = std::unique_ptr(new Configurable::BooleanSelection(false)); + return selection_set; + } + + Configurable::SelectionSet get_user_friendly_selections() override { + Configurable::SelectionSet selection_set; + selection_set["quickload"] = std::unique_ptr(new Configurable::BooleanSelection(true)); + return selection_set; + } + private: CPU::MOS6502::Processor m6502_; diff --git a/Machines/Commodore/Vic-20/Vic20.hpp b/Machines/Commodore/Vic-20/Vic20.hpp index e99c34c73..a7e4f5e4b 100644 --- a/Machines/Commodore/Vic-20/Vic20.hpp +++ b/Machines/Commodore/Vic-20/Vic20.hpp @@ -9,6 +9,7 @@ #ifndef Vic20_hpp #define Vic20_hpp +#include "../../../Configurable/Configurable.hpp" #include "../../ConfigurationTarget.hpp" #include "../../CRTMachine.hpp" #include "../../KeyboardMachine.hpp" @@ -44,7 +45,8 @@ class Machine: public CRTMachine::Machine, public ConfigurationTarget::Machine, public KeyboardMachine::Machine, - public JoystickMachine::Machine { + public JoystickMachine::Machine, + public Configurable::Device { public: virtual ~Machine(); diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index 9300b71dc..8e00ed376 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -416,6 +416,7 @@ class ConcreteMachine: return keyboard_mapper_; } + // MARK: - Configuration options. std::vector> get_options() override { std::vector> options; options.emplace_back(new Configurable::BooleanOption("Load Tapes Quickly", "quickload")); @@ -446,6 +447,7 @@ class ConcreteMachine: } private: + // MARK: - Work deferral updates. inline void update_display() { if(cycles_since_display_update_ > 0) { video_output_->run_for(cycles_since_display_update_.flush()); diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index 1a67c4014..985faef52 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -427,6 +427,36 @@ class ConcreteMachine: return keyboard_mapper_; } + // MARK: - Configuration options. + std::vector> get_options() override { + std::vector> options; + options.emplace_back(new Configurable::BooleanOption("Load Tapes Quickly", "quickload")); + options.emplace_back(new Configurable::ListOption("Display", "display", {"composite", "rgb"})); + return options; + } + + void set_selections(const Configurable::SelectionSet &selections_by_option) override { + auto quickload = Configurable::selection(selections_by_option, "quickload"); + if(quickload) set_use_fast_tape_hack(quickload->value); + + auto display = Configurable::selection(selections_by_option, "display"); + if(display) get_crt()->set_output_device((display->value == "rgb") ? Outputs::CRT::OutputDevice::Monitor : Outputs::CRT::OutputDevice::Television); + } + + Configurable::SelectionSet get_accurate_selections() override { + Configurable::SelectionSet selection_set; + selection_set["quickload"] = std::unique_ptr(new Configurable::BooleanSelection(false)); + selection_set["display"] = std::unique_ptr(new Configurable::ListSelection("composite")); + return selection_set; + } + + Configurable::SelectionSet get_user_friendly_selections() override { + Configurable::SelectionSet selection_set; + selection_set["quickload"] = std::unique_ptr(new Configurable::BooleanSelection(true)); + selection_set["display"] = std::unique_ptr(new Configurable::ListSelection("rgb")); + return selection_set; + } + private: CPU::MOS6502::Processor m6502_; diff --git a/Machines/Oric/Oric.hpp b/Machines/Oric/Oric.hpp index 4e4a8c418..2aa05f46e 100644 --- a/Machines/Oric/Oric.hpp +++ b/Machines/Oric/Oric.hpp @@ -9,6 +9,7 @@ #ifndef Oric_hpp #define Oric_hpp +#include "../../Configurable/Configurable.hpp" #include "../ConfigurationTarget.hpp" #include "../CRTMachine.hpp" #include "../KeyboardMachine.hpp" @@ -28,7 +29,8 @@ enum ROM { class Machine: public CRTMachine::Machine, public ConfigurationTarget::Machine, - public KeyboardMachine::Machine { + public KeyboardMachine::Machine, + public Configurable::Device { public: virtual ~Machine(); diff --git a/Machines/ZX8081/ZX8081.cpp b/Machines/ZX8081/ZX8081.cpp index ddbb34058..97b410d02 100644 --- a/Machines/ZX8081/ZX8081.cpp +++ b/Machines/ZX8081/ZX8081.cpp @@ -308,8 +308,7 @@ template class ConcreteMachine: return true; } -// MARK: - Keyboard - + // MARK: - Keyboard void set_key_state(uint16_t key, bool isPressed) override final { if(isPressed) key_states_[key >> 8] &= static_cast(~key); @@ -321,8 +320,7 @@ template class ConcreteMachine: memset(key_states_, 0xff, 8); } -// MARK: - Tape control - + // MARK: - Tape control void set_use_fast_tape_hack(bool activate) override final { use_fast_tape_hack_ = activate; } @@ -337,8 +335,7 @@ template class ConcreteMachine: tape_player_.set_motor_control(is_playing); } -// MARK: - Typer timing - + // MARK: - Typer timing HalfCycles get_typer_delay() override final { return Cycles(7000000); } HalfCycles get_typer_frequency() override final { return Cycles(390000); } @@ -346,6 +343,36 @@ template class ConcreteMachine: return keyboard_mapper_; } + // MARK: - Configuration options. + std::vector> get_options() override { + std::vector> options; + options.emplace_back(new Configurable::BooleanOption("Load Tapes Quickly", "quickload")); + options.emplace_back(new Configurable::BooleanOption("Automatic Tape Motor Control", "autotapemotor")); + return options; + } + + void set_selections(const Configurable::SelectionSet &selections_by_option) override { + auto quickload = Configurable::selection(selections_by_option, "quickload"); + if(quickload) set_use_fast_tape_hack(quickload->value); + + auto autotapemotor = Configurable::selection(selections_by_option, "autotapemotor"); + if(autotapemotor) set_use_automatic_tape_motor_control(autotapemotor->value); + } + + Configurable::SelectionSet get_accurate_selections() override { + Configurable::SelectionSet selection_set; + selection_set["quickload"] = std::unique_ptr(new Configurable::BooleanSelection(false)); + selection_set["autotapemotor"] = std::unique_ptr(new Configurable::BooleanSelection(false)); + return selection_set; + } + + Configurable::SelectionSet get_user_friendly_selections() override { + Configurable::SelectionSet selection_set; + selection_set["quickload"] = std::unique_ptr(new Configurable::BooleanSelection(true)); + selection_set["autotapemotor"] = std::unique_ptr(new Configurable::BooleanSelection(true)); + return selection_set; + } + private: CPU::Z80::Processor z80_; @@ -383,8 +410,7 @@ template class ConcreteMachine: bool use_automatic_tape_motor_control_; HalfCycles tape_advance_delay_ = 0; -// MARK: - Video - + // MARK: - Video inline void set_vsync(bool sync) { vsync_ = sync; update_sync(); diff --git a/Machines/ZX8081/ZX8081.hpp b/Machines/ZX8081/ZX8081.hpp index ce797fbf8..3297c85ea 100644 --- a/Machines/ZX8081/ZX8081.hpp +++ b/Machines/ZX8081/ZX8081.hpp @@ -9,6 +9,7 @@ #ifndef ZX8081_hpp #define ZX8081_hpp +#include "../../Configurable/Configurable.hpp" #include "../ConfigurationTarget.hpp" #include "../CRTMachine.hpp" #include "../KeyboardMachine.hpp" @@ -25,7 +26,8 @@ enum ROMType: uint8_t { class Machine: public CRTMachine::Machine, public ConfigurationTarget::Machine, - public KeyboardMachine::Machine { + public KeyboardMachine::Machine, + public Configurable::Device { public: static Machine *ZX8081(const StaticAnalyser::Target &target_hint); virtual ~Machine();