diff --git a/Machines/AmstradCPC/AmstradCPC.cpp b/Machines/AmstradCPC/AmstradCPC.cpp index e5c230886..023894542 100644 --- a/Machines/AmstradCPC/AmstradCPC.cpp +++ b/Machines/AmstradCPC/AmstradCPC.cpp @@ -24,8 +24,18 @@ #include "../../ClockReceiver/ForceInline.hpp" +#include +#include + namespace AmstradCPC { +enum ROMType: int { + OS464 = 0, BASIC464, + OS664, BASIC664, + OS6128, BASIC6128, + AMSDOS +}; + /*! Models the CPC's interrupt timer. Inputs are vsync, hsync, interrupt acknowledge and reset, and its output is simply yes or no on whether an interupt is currently requested. Internally it uses a counter with a period @@ -920,7 +930,7 @@ class ConcreteMachine: } // See header; provides the system ROMs. - void set_rom(ROMType type, const std::vector &data) override final { + void set_rom(ROMType type, const std::vector &data) { roms_[static_cast(type)] = data; } diff --git a/Machines/AmstradCPC/AmstradCPC.hpp b/Machines/AmstradCPC/AmstradCPC.hpp index 27c48c6df..faed26573 100644 --- a/Machines/AmstradCPC/AmstradCPC.hpp +++ b/Machines/AmstradCPC/AmstradCPC.hpp @@ -13,18 +13,8 @@ #include "../CRTMachine.hpp" #include "../KeyboardMachine.hpp" -#include -#include - namespace AmstradCPC { -enum ROMType: int { - OS464 = 0, BASIC464, - OS664, BASIC664, - OS6128, BASIC6128, - AMSDOS -}; - /*! Models an Amstrad CPC. */ @@ -37,9 +27,6 @@ class Machine: /// Creates and returns an Amstrad CPC. static Machine *AmstradCPC(); - - /// Sets the contents of rom @c type to @c data. Assumed to be a setup step; has no effect once a machine is running. - virtual void set_rom(ROMType type, const std::vector &data) = 0; }; } diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index f8c4dc00b..22051d711 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -27,10 +27,18 @@ #include "../../../Configurable/StandardOptions.hpp" #include +#include namespace Commodore { namespace Vic20 { +enum ROMSlot { + Kernel = 0, + BASIC, + Characters, + Drive +}; + std::vector> get_options() { return Configurable::standard_options(Configurable::QuickLoadTape); } @@ -304,7 +312,7 @@ class ConcreteMachine: delete[] rom_; } - void set_rom(ROMSlot slot, const std::vector &data) override final { + void set_rom(ROMSlot slot, const std::vector &data) { } // Obtains the system ROMs. @@ -502,7 +510,7 @@ class ConcreteMachine: } } - void set_use_fast_tape_hack(bool activate) override final { + void set_use_fast_tape_hack(bool activate) { use_fast_tape_hack_ = activate; } diff --git a/Machines/Commodore/Vic-20/Vic20.hpp b/Machines/Commodore/Vic-20/Vic20.hpp index ee52e03e7..d4cd280d6 100644 --- a/Machines/Commodore/Vic-20/Vic20.hpp +++ b/Machines/Commodore/Vic-20/Vic20.hpp @@ -15,18 +15,9 @@ #include "../../KeyboardMachine.hpp" #include "../../JoystickMachine.hpp" -#include - namespace Commodore { namespace Vic20 { -enum ROMSlot { - Kernel = 0, - BASIC, - Characters, - Drive -}; - enum MemorySize { Default, ThreeKB, @@ -56,17 +47,11 @@ class Machine: /// Creates and returns a Vic-20. static Machine *Vic20(); - /// Sets the contents of the rom in @c slot to the buffer @c data of length @c length. - virtual void set_rom(ROMSlot slot, const std::vector &data) = 0; - /// Sets the memory size of this Vic-20. virtual void set_memory_size(MemorySize size) = 0; /// Sets the region of this Vic-20. virtual void set_region(Region region) = 0; - - /// Enables or disables turbo-speed tape loading. - virtual void set_use_fast_tape_hack(bool activate) = 0; }; } diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index b20b42a5f..40ca3ce11 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -103,7 +103,7 @@ class ConcreteMachine: if(is_holding_shift_) set_key_state(KeyShift, true); } - void set_use_fast_tape_hack(bool activate) override final { + void set_use_fast_tape_hack(bool activate) { use_fast_tape_hack_ = activate; } diff --git a/Machines/Electron/Electron.hpp b/Machines/Electron/Electron.hpp index fbea6a3ce..2342f431d 100644 --- a/Machines/Electron/Electron.hpp +++ b/Machines/Electron/Electron.hpp @@ -58,9 +58,6 @@ class Machine: is enabled — it acts as if it were sideways RAM. Otherwise the slot is modelled as containing ROM. */ virtual void set_rom(ROMSlot slot, const std::vector &data, bool is_writeable) = 0; - - /// Enables or disables turbo-speed tape loading. - virtual void set_use_fast_tape_hack(bool activate) = 0; }; } diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index e75ae27c8..ac0b3a08a 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -25,10 +25,16 @@ #include "../../ClockReceiver/ForceInline.hpp" #include "../../Configurable/StandardOptions.hpp" +#include #include +#include namespace Oric { +enum ROM { + BASIC10 = 0, BASIC11, Microdisc, Colour +}; + std::vector> get_options() { return Configurable::standard_options( static_cast(Configurable::DisplayRGBComposite | Configurable::QuickLoadTape) @@ -198,7 +204,7 @@ class ConcreteMachine: Memory::Fuzz(ram_, sizeof(ram_)); } - void set_rom(ROM rom, const std::vector &data) override final { + 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; @@ -240,11 +246,11 @@ class ConcreteMachine: keyboard_.clear_all_keys(); } - void set_use_fast_tape_hack(bool activate) override final { + void set_use_fast_tape_hack(bool activate) { use_fast_tape_hack_ = activate; } - void set_output_device(Outputs::CRT::OutputDevice output_device) override final { + void set_output_device(Outputs::CRT::OutputDevice output_device) { video_output_->set_output_device(output_device); } diff --git a/Machines/Oric/Oric.hpp b/Machines/Oric/Oric.hpp index 6bba6eb93..e808b9ff8 100644 --- a/Machines/Oric/Oric.hpp +++ b/Machines/Oric/Oric.hpp @@ -14,15 +14,8 @@ #include "../CRTMachine.hpp" #include "../KeyboardMachine.hpp" -#include -#include - namespace Oric { -enum ROM { - BASIC10 = 0, BASIC11, Microdisc, Colour -}; - /// @returns The options available for an Oric. std::vector> get_options(); @@ -39,15 +32,6 @@ class Machine: /// Creates and returns an Oric. static Machine *Oric(); - - /// Sets the contents of @c rom to @c data. Assumed to be a setup step; has no effect once a machine is running. - virtual void set_rom(ROM rom, const std::vector &data) = 0; - - /// Enables or disables turbo-speed tape loading. - virtual void set_use_fast_tape_hack(bool activate) = 0; - - /// Sets the type of display the Oric is connected to. - virtual void set_output_device(Outputs::CRT::OutputDevice output_device) = 0; }; } diff --git a/Machines/ZX8081/ZX8081.cpp b/Machines/ZX8081/ZX8081.cpp index 197dd8911..470bd0afd 100644 --- a/Machines/ZX8081/ZX8081.cpp +++ b/Machines/ZX8081/ZX8081.cpp @@ -21,7 +21,9 @@ #include "Keyboard.hpp" #include "Video.hpp" +#include #include +#include namespace { // The clock rate is 3.25Mhz. @@ -30,6 +32,10 @@ namespace { namespace ZX8081 { +enum ROMType: uint8_t { + ZX80 = 0, ZX81 +}; + std::vector> get_options() { return Configurable::standard_options( static_cast(Configurable::AutomaticTapeMotorControl | Configurable::QuickLoadTape) @@ -291,7 +297,7 @@ template class ConcreteMachine: Utility::TypeRecipient::set_typer_for_string(string, std::move(mapper)); } - void set_rom(ROMType type, const std::vector &data) override final { + void set_rom(ROMType type, const std::vector &data) { switch(type) { case ZX80: zx80_rom_ = data; break; case ZX81: zx81_rom_ = data; break; @@ -328,11 +334,11 @@ template class ConcreteMachine: } // MARK: - Tape control - void set_use_fast_tape_hack(bool activate) override final { + void set_use_fast_tape_hack(bool activate) { use_fast_tape_hack_ = activate; } - void set_use_automatic_tape_motor_control(bool enabled) override final { + void set_use_automatic_tape_motor_control(bool enabled) { use_automatic_tape_motor_control_ = enabled; if(!enabled) { tape_player_.set_motor_control(false); diff --git a/Machines/ZX8081/ZX8081.hpp b/Machines/ZX8081/ZX8081.hpp index b79830f65..6f70a03c1 100644 --- a/Machines/ZX8081/ZX8081.hpp +++ b/Machines/ZX8081/ZX8081.hpp @@ -14,15 +14,8 @@ #include "../CRTMachine.hpp" #include "../KeyboardMachine.hpp" -#include -#include - namespace ZX8081 { -enum ROMType: uint8_t { - ZX80 = 0, ZX81 -}; - /// @returns The options available for a ZX80 or ZX81. std::vector> get_options(); @@ -32,14 +25,11 @@ class Machine: public KeyboardMachine::Machine, public Configurable::Device { public: - static Machine *ZX8081(const StaticAnalyser::Target &target_hint); virtual ~Machine(); - virtual void set_rom(ROMType type, const std::vector &data) = 0; + static Machine *ZX8081(const StaticAnalyser::Target &target_hint); - virtual void set_use_fast_tape_hack(bool activate) = 0; virtual void set_tape_is_playing(bool is_playing) = 0; - virtual void set_use_automatic_tape_motor_control(bool enabled) = 0; }; } diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSElectron.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSElectron.mm index 4fbebb477..f2f497b8f 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSElectron.mm +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSElectron.mm @@ -9,7 +9,7 @@ #import "CSElectron.h" #include "Electron.hpp" - +#include "StandardOptions.hpp" @implementation CSElectron { std::unique_ptr _electron; @@ -34,14 +34,20 @@ - (void)setUseFastLoadingHack:(BOOL)useFastLoadingHack { @synchronized(self) { _useFastLoadingHack = useFastLoadingHack; - _electron->set_use_fast_tape_hack(useFastLoadingHack ? true : false); + + Configurable::SelectionSet selection_set; + append_quick_load_tape_selection(selection_set, useFastLoadingHack ? true : false); + _electron->set_selections(selection_set); } } - (void)setUseTelevisionOutput:(BOOL)useTelevisionOutput { @synchronized(self) { _useTelevisionOutput = useTelevisionOutput; - _electron->get_crt()->set_output_device(useTelevisionOutput ? Outputs::CRT::OutputDevice::Television : Outputs::CRT::OutputDevice::Monitor); + + Configurable::SelectionSet selection_set; + append_display_selection(selection_set, useTelevisionOutput ? Configurable::Display::Composite : Configurable::Display::RGB); + _electron->set_selections(selection_set); } } @end diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSOric.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSOric.mm index b3739bc8c..de0ba39d2 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSOric.mm +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSOric.mm @@ -9,6 +9,7 @@ #import "CSOric.h" #include "Oric.hpp" +#include "StandardOptions.hpp" @implementation CSOric { std::unique_ptr _oric; @@ -29,14 +30,20 @@ - (void)setUseFastLoadingHack:(BOOL)useFastLoadingHack { @synchronized(self) { _useFastLoadingHack = useFastLoadingHack; - _oric->set_use_fast_tape_hack(useFastLoadingHack ? true : false); + + Configurable::SelectionSet selection_set; + append_quick_load_tape_selection(selection_set, useFastLoadingHack ? true : false); + _oric->set_selections(selection_set); } } - (void)setUseCompositeOutput:(BOOL)useCompositeOutput { @synchronized(self) { _useCompositeOutput = useCompositeOutput; - _oric->set_output_device(useCompositeOutput ? Outputs::CRT::OutputDevice::Television : Outputs::CRT::OutputDevice::Monitor); + + Configurable::SelectionSet selection_set; + append_display_selection(selection_set, useCompositeOutput ? Configurable::Display::Composite : Configurable::Display::RGB); + _oric->set_selections(selection_set); } } diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSVic20.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSVic20.mm index 0e4977b9b..eb2edb83c 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSVic20.mm +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSVic20.mm @@ -9,6 +9,7 @@ #import "CSVic20.h" #include "Vic20.hpp" +#include "StandardOptions.hpp" using namespace Commodore::Vic20; @@ -47,7 +48,9 @@ using namespace Commodore::Vic20; - (void)setUseFastLoadingHack:(BOOL)useFastLoadingHack { _useFastLoadingHack = useFastLoadingHack; @synchronized(self) { - _vic20->set_use_fast_tape_hack(useFastLoadingHack ? true : false); + Configurable::SelectionSet selection_set; + append_quick_load_tape_selection(selection_set, useFastLoadingHack ? true : false); + _vic20->set_selections(selection_set); } } diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm index 800c1b6f7..fad9e8116 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm @@ -9,6 +9,7 @@ #import "CSZX8081.h" #include "ZX8081.hpp" +#include "StandardOptions.hpp" @implementation CSZX8081 { std::unique_ptr _zx8081; @@ -31,7 +32,10 @@ - (void)setUseFastLoadingHack:(BOOL)useFastLoadingHack { @synchronized(self) { _useFastLoadingHack = useFastLoadingHack; - _zx8081->set_use_fast_tape_hack(useFastLoadingHack ? true : false); + + Configurable::SelectionSet selection_set; + append_quick_load_tape_selection(selection_set, useFastLoadingHack ? true : false); + _zx8081->set_selections(selection_set); } } @@ -45,7 +49,10 @@ - (void)setUseAutomaticTapeMotorControl:(BOOL)useAutomaticTapeMotorControl { @synchronized(self) { _useAutomaticTapeMotorControl = useAutomaticTapeMotorControl; - _zx8081->set_use_automatic_tape_motor_control(useAutomaticTapeMotorControl ? true : false); + + Configurable::SelectionSet selection_set; + append_automatic_tape_motor_control_selection(selection_set, useAutomaticTapeMotorControl ? true : false); + _zx8081->set_selections(selection_set); } }