mirror of
https://github.com/TomHarte/CLK.git
synced 2025-04-09 15:39:08 +00:00
Goes some way towards wiring up Spectrum options.
This commit is contained in:
parent
bb0d35e3d0
commit
2ee478b4c4
@ -39,6 +39,7 @@ namespace ZXSpectrum {
|
||||
|
||||
using Model = Analyser::Static::ZXSpectrum::Target::Model;
|
||||
template<Model model> class ConcreteMachine:
|
||||
public Configurable::Device,
|
||||
public Machine,
|
||||
public MachineTypes::MappedKeyboardMachine,
|
||||
public MachineTypes::MediaTarget,
|
||||
@ -101,14 +102,18 @@ template<Model model> class ConcreteMachine:
|
||||
|
||||
// MARK: - ScanProducer
|
||||
|
||||
void set_scan_target(Outputs::Display::ScanTarget *scan_target) final {
|
||||
void set_scan_target(Outputs::Display::ScanTarget *scan_target) override {
|
||||
video_->set_scan_target(scan_target);
|
||||
}
|
||||
|
||||
Outputs::Display::ScanStatus get_scaled_scan_status() const final {
|
||||
Outputs::Display::ScanStatus get_scaled_scan_status() const override {
|
||||
return video_->get_scaled_scan_status();
|
||||
}
|
||||
|
||||
void set_display_type(Outputs::Display::DisplayType display_type) override {
|
||||
video_->set_display_type(display_type);
|
||||
}
|
||||
|
||||
// MARK: - BusHandler
|
||||
|
||||
forceinline HalfCycles perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
|
||||
@ -279,6 +284,40 @@ template<Model model> class ConcreteMachine:
|
||||
return !media.tapes.empty();
|
||||
}
|
||||
|
||||
// MARK: - Tape control
|
||||
|
||||
void set_use_automatic_tape_motor_control(bool enabled) {
|
||||
use_automatic_tape_motor_control_ = enabled;
|
||||
if(!enabled) {
|
||||
tape_player_.set_motor_control(false);
|
||||
}
|
||||
}
|
||||
|
||||
void set_tape_is_playing(bool is_playing) final {
|
||||
tape_player_.set_motor_control(is_playing);
|
||||
}
|
||||
|
||||
bool get_tape_is_playing() final {
|
||||
return tape_player_.get_motor_control();
|
||||
}
|
||||
|
||||
// MARK: - Configuration options.
|
||||
|
||||
std::unique_ptr<Reflection::Struct> get_options() override {
|
||||
auto options = std::make_unique<Options>(Configurable::OptionsType::UserFriendly); // OptionsType is arbitrary, but not optional.
|
||||
options->automatic_tape_motor_control = use_automatic_tape_motor_control_;
|
||||
options->quickload = allow_fast_tape_hack_;
|
||||
return options;
|
||||
}
|
||||
|
||||
void set_options(const std::unique_ptr<Reflection::Struct> &str) override {
|
||||
const auto options = dynamic_cast<Options *>(str.get());
|
||||
set_video_signal_configurable(options->output);
|
||||
set_use_automatic_tape_motor_control(options->automatic_tape_motor_control);
|
||||
allow_fast_tape_hack_ = options->quickload;
|
||||
set_use_fast_tape();
|
||||
}
|
||||
|
||||
private:
|
||||
CPU::Z80::Processor<ConcreteMachine, false, false> z80_;
|
||||
|
||||
@ -381,6 +420,14 @@ template<Model model> class ConcreteMachine:
|
||||
|
||||
// MARK: - Tape and disc.
|
||||
Storage::Tape::BinaryTapePlayer tape_player_;
|
||||
|
||||
bool use_automatic_tape_motor_control_ = false;
|
||||
HalfCycles cycles_since_tape_input_read_;
|
||||
|
||||
bool allow_fast_tape_hack_ = false;
|
||||
void set_use_fast_tape() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -22,8 +22,28 @@ namespace ZXSpectrum {
|
||||
class Machine {
|
||||
public:
|
||||
virtual ~Machine();
|
||||
|
||||
static Machine *ZXSpectrum(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher);
|
||||
|
||||
virtual void set_tape_is_playing(bool is_playing) = 0;
|
||||
virtual bool get_tape_is_playing() = 0;
|
||||
|
||||
class Options: public Reflection::StructImpl<Options>, public Configurable::DisplayOption<Options>, public Configurable::QuickloadOption<Options> {
|
||||
friend Configurable::DisplayOption<Options>;
|
||||
friend Configurable::QuickloadOption<Options>;
|
||||
public:
|
||||
bool automatic_tape_motor_control;
|
||||
|
||||
Options(Configurable::OptionsType type) :
|
||||
Configurable::DisplayOption<Options>(type == Configurable::OptionsType::UserFriendly ? Configurable::Display::RGB : Configurable::Display::CompositeColour),
|
||||
Configurable::QuickloadOption<Options>(type == Configurable::OptionsType::UserFriendly)
|
||||
{
|
||||
if(needs_declare()) {
|
||||
DeclareField(automatic_tape_motor_control);
|
||||
declare_display_option();
|
||||
declare_quickload_option();
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "../../Analyser/Static/Oric/Target.hpp"
|
||||
#include "../../Analyser/Static/Sega/Target.hpp"
|
||||
#include "../../Analyser/Static/ZX8081/Target.hpp"
|
||||
#include "../../Analyser/Static/ZXSpectrum/Target.hpp"
|
||||
|
||||
#include "../../Analyser/Dynamic/MultiMachine/MultiMachine.hpp"
|
||||
#include "TypedDynamicMachine.hpp"
|
||||
@ -132,6 +133,7 @@ std::string Machine::ShortNameForTargetMachine(const Analyser::Machine machine)
|
||||
case Analyser::Machine::Oric: return "Oric";
|
||||
case Analyser::Machine::Vic20: return "Vic20";
|
||||
case Analyser::Machine::ZX8081: return "ZX8081";
|
||||
case Analyser::Machine::ZXSpectrum: return "ZXSpectrum";
|
||||
|
||||
default: return "";
|
||||
}
|
||||
@ -152,6 +154,7 @@ std::string Machine::LongNameForTargetMachine(Analyser::Machine machine) {
|
||||
case Analyser::Machine::Oric: return "Oric";
|
||||
case Analyser::Machine::Vic20: return "Vic 20";
|
||||
case Analyser::Machine::ZX8081: return "ZX80/81";
|
||||
case Analyser::Machine::ZXSpectrum: return "ZX Spectrum";
|
||||
|
||||
default: return "";
|
||||
}
|
||||
@ -203,6 +206,7 @@ std::map<std::string, std::unique_ptr<Reflection::Struct>> Machine::AllOptionsBy
|
||||
Emplace(Oric, Oric::Machine);
|
||||
Emplace(Vic20, Commodore::Vic20::Machine);
|
||||
Emplace(ZX8081, Sinclair::ZX8081::Machine);
|
||||
Emplace(ZXSpectrum, Sinclair::ZXSpectrum::Machine);
|
||||
|
||||
#undef Emplace
|
||||
|
||||
@ -226,6 +230,7 @@ std::map<std::string, std::unique_ptr<Analyser::Static::Target>> Machine::Target
|
||||
Add(Oric);
|
||||
AddMapped(Vic20, Commodore);
|
||||
Add(ZX8081);
|
||||
Add(ZXSpectrum);
|
||||
|
||||
if(!meaningful_without_media_only) {
|
||||
Add(Atari2600);
|
||||
@ -234,7 +239,7 @@ std::map<std::string, std::unique_ptr<Analyser::Static::Target>> Machine::Target
|
||||
}
|
||||
|
||||
#undef Add
|
||||
#undef AddTwo
|
||||
#undef AddMapped
|
||||
|
||||
return options;
|
||||
}
|
||||
|
@ -263,6 +263,7 @@ static Analyser::Static::ZX8081::Target::MemoryModel ZX8081MemoryModelFromSize(K
|
||||
case Analyser::Machine::Oric: return @"OricOptions";
|
||||
case Analyser::Machine::Vic20: return @"QuickLoadCompositeOptions";
|
||||
case Analyser::Machine::ZX8081: return @"ZX8081Options";
|
||||
case Analyser::Machine::ZXSpectrum: return @"QuickLoadCompositeOptions"; // TODO: @"ZXSpectrumOptions";
|
||||
default: return nil;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user