1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-29 16:55:59 +00:00

Merge pull request #1378 from TomHarte/FastArchimedesDisks

Support FDC overclocking as 'fast loading'.
This commit is contained in:
Thomas Harte 2024-05-26 22:19:40 -04:00 committed by GitHub
commit ff78e4172d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 58 additions and 22 deletions

View File

@ -15,6 +15,8 @@
#include "MemoryController.hpp" #include "MemoryController.hpp"
#include "Sound.hpp" #include "Sound.hpp"
#include "../../../Configurable/Configurable.hpp"
#include "../../AudioProducer.hpp" #include "../../AudioProducer.hpp"
#include "../../KeyboardMachine.hpp" #include "../../KeyboardMachine.hpp"
#include "../../MediaTarget.hpp" #include "../../MediaTarget.hpp"
@ -46,7 +48,8 @@ class ConcreteMachine:
public MachineTypes::MouseMachine, public MachineTypes::MouseMachine,
public MachineTypes::TimedMachine, public MachineTypes::TimedMachine,
public MachineTypes::ScanProducer, public MachineTypes::ScanProducer,
public Activity::Source public Activity::Source,
public Configurable::Device
{ {
private: private:
Log::Logger<Log::Source::Archimedes> logger; Log::Logger<Log::Source::Archimedes> logger;
@ -127,8 +130,6 @@ class ConcreteMachine:
if(!target.media.disks.empty()) { if(!target.media.disks.empty()) {
autoload_phase_ = AutoloadPhase::WaitingForStartup; autoload_phase_ = AutoloadPhase::WaitingForStartup;
target_program_ = target.main_program; target_program_ = target.main_program;
printf("Will seek %s?\n", target_program_.c_str());
} }
fill_pipeline(0); fill_pipeline(0);
@ -254,7 +255,6 @@ class ConcreteMachine:
} break; } break;
case AutoloadPhase::WaitingForStartup: case AutoloadPhase::WaitingForStartup:
printf("%d %d %d %d\n", x1, y1, x2, y2);
if(static_cast<int32_t>(y1) == -268435472) { // VERY TEMPORARY. TODO: find better trigger. if(static_cast<int32_t>(y1) == -268435472) { // VERY TEMPORARY. TODO: find better trigger.
// Creation of any icon is used to spot that RISC OS has started up. // Creation of any icon is used to spot that RISC OS has started up.
// //
@ -274,7 +274,6 @@ class ConcreteMachine:
autoload_phase_ = AutoloadPhase::OpeningDisk; autoload_phase_ = AutoloadPhase::OpeningDisk;
} }
break; break;
// printf("Wimp_OpenWindow: %d, %d -> %d, %d\n", x1, y1, x2, y2);
} }
} break; } break;
@ -367,20 +366,23 @@ class ConcreteMachine:
} }
// MARK: - TimedMachine. // MARK: - TimedMachine.
int video_divider_ = 1; bool use_original_speed() const {
void run_for(Cycles cycles) override {
#ifndef NDEBUG #ifndef NDEBUG
// Debug mode: always run 'slowly' because that's less of a burden, and // Debug mode: always run 'slowly' because that's less of a burden, and
// because it allows me to peer at problems with greater leisure. // because it allows me to peer at problems with greater leisure.
const bool use_original_speed = true; return true;
#else #else
// As a first, blunt implementation: try to model something close // As a first, blunt implementation: try to model something close
// to original speed if there have been 10 frame rate overages in total. // to original speed if there have been 10 frame rate overages in total.
const bool use_original_speed = executor_.bus.video().frame_rate_overages() > 10; return executor_.bus.video().frame_rate_overages() > 10;
#endif #endif
}
int video_divider_ = 1;
void run_for(Cycles cycles) override {
const auto run = [&](Cycles cycles) { const auto run = [&](Cycles cycles) {
if(use_original_speed) run_for<true>(cycles); if(use_original_speed()) run_for<true>(cycles);
else run_for<false>(cycles); else run_for<false>(cycles);
}; };
@ -486,7 +488,13 @@ class ConcreteMachine:
void tick_timers() { executor_.bus.tick_timers(); } void tick_timers() { executor_.bus.tick_timers(); }
void tick_sound() { executor_.bus.sound().tick(); } void tick_sound() { executor_.bus.sound().tick(); }
void tick_video() { executor_.bus.video().tick(); } void tick_video() { executor_.bus.video().tick(); }
void tick_floppy() { executor_.bus.tick_floppy(); }
bool accelerate_loading_ = true;
void tick_floppy() {
executor_.bus.tick_floppy(
accelerate_loading_ ? (use_original_speed() ? 12 : 18) : 1
);
}
// MARK: - MediaTarget // MARK: - MediaTarget
bool insert_media(const Analyser::Static::Media &media) override { bool insert_media(const Analyser::Static::Media &media) override {
@ -499,6 +507,18 @@ class ConcreteMachine:
return true; return true;
} }
// MARK: - Configuration options.
std::unique_ptr<Reflection::Struct> get_options() final {
auto options = std::make_unique<Options>(Configurable::OptionsType::UserFriendly);
options->quickload = accelerate_loading_;
return options;
}
void set_options(const std::unique_ptr<Reflection::Struct> &str) final {
const auto options = dynamic_cast<Options *>(str.get());
accelerate_loading_ = options->quickload;
}
// MARK: - AudioProducer // MARK: - AudioProducer
Outputs::Speaker::Speaker *get_speaker() override { Outputs::Speaker::Speaker *get_speaker() override {
return executor_.bus.speaker(); return executor_.bus.speaker();

View File

@ -8,6 +8,8 @@
#pragma once #pragma once
#include "../../../Configurable/Configurable.hpp"
#include "../../../Configurable/StandardOptions.hpp"
#include "../../../Analyser/Static/StaticAnalyser.hpp" #include "../../../Analyser/Static/StaticAnalyser.hpp"
#include "../../ROMMachine.hpp" #include "../../ROMMachine.hpp"
@ -22,6 +24,17 @@ class Machine {
const Analyser::Static::Target *target, const Analyser::Static::Target *target,
const ROMMachine::ROMFetcher &rom_fetcher const ROMMachine::ROMFetcher &rom_fetcher
); );
class Options: public Reflection::StructImpl<Options>, public Configurable::QuickloadOption<Options> {
friend Configurable::QuickloadOption<Options>;
public:
Options(Configurable::OptionsType type) :
Configurable::QuickloadOption<Options>(type == Configurable::OptionsType::UserFriendly) {
if(needs_declare()) {
declare_quickload_option();
}
}
};
}; };
} }

View File

@ -130,9 +130,9 @@ struct InputOutputController: public ClockingHint::Observer {
} }
} }
void tick_floppy() { void tick_floppy(int clock_multiplier) {
if(floppy_clocking_ != ClockingHint::Preference::None) { if(floppy_clocking_ != ClockingHint::Preference::None) {
floppy_.run_for(Cycles(1)); floppy_.run_for(Cycles(clock_multiplier));
} }
} }

View File

@ -214,7 +214,9 @@ struct MemoryController {
// Expose various IOC-owned things. // Expose various IOC-owned things.
// //
void tick_timers() { ioc_.tick_timers(); } void tick_timers() { ioc_.tick_timers(); }
void tick_floppy() { ioc_.tick_floppy(); } void tick_floppy(int clock_multiplier) {
ioc_.tick_floppy(clock_multiplier);
}
void set_disk(std::shared_ptr<Storage::Disk::Disk> disk, size_t drive) { void set_disk(std::shared_ptr<Storage::Disk::Disk> disk, size_t drive) {
ioc_.set_disk(disk, drive); ioc_.set_disk(disk, drive);
} }

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies> <dependencies>
<deployment identifier="macosx"/> <deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22690"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<objects> <objects>

View File

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies> <dependencies>
<deployment identifier="macosx"/> <deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22690"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<objects> <objects>
<customObject id="-2" userLabel="File's Owner" customClass="MachineDocument" customModule="Clock_Signal" customModuleProvider="target"> <customObject id="-2" userLabel="File's Owner" customClass="MachineDocument" customModule="Clock_Signal" customModuleProvider="target">
<connections> <connections>
<outlet property="optionsController" destination="cWS-AS-crO" id="KeQ-V1-s46"/> <outlet property="optionsController" destination="cWS-AS-crO" id="KeQ-V1-s46"/>
<outlet property="optionsView" destination="e1J-pw-zGw" id="ALr-SV-afm"/> <outlet property="optionsView" destination="tpZ-0B-QQu" id="Hhq-RT-HTv"/>
</connections> </connections>
</customObject> </customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/> <customObject id="-3" userLabel="Application" customClass="NSObject"/>
<visualEffectView wantsLayer="YES" appearanceType="vibrantDark" blendingMode="withinWindow" material="HUDWindow" state="followsWindowActiveState" translatesAutoresizingMaskIntoConstraints="NO" id="tpZ-0B-QQu"> <visualEffectView hidden="YES" wantsLayer="YES" appearanceType="vibrantDark" blendingMode="withinWindow" material="HUDWindow" state="followsWindowActiveState" translatesAutoresizingMaskIntoConstraints="NO" id="tpZ-0B-QQu">
<rect key="frame" x="0.0" y="0.0" width="200" height="44"/> <rect key="frame" x="0.0" y="0.0" width="200" height="44"/>
<subviews> <subviews>
<button translatesAutoresizingMaskIntoConstraints="NO" id="e1J-pw-zGw"> <button translatesAutoresizingMaskIntoConstraints="NO" id="e1J-pw-zGw">

View File

@ -191,7 +191,8 @@ class MachineDocument:
// Attach an options panel if one is available. // Attach an options panel if one is available.
if let optionsNibName = self.machineDescription?.optionsNibName { if let optionsNibName = self.machineDescription?.optionsNibName {
Bundle.main.loadNibNamed(optionsNibName, owner: self, topLevelObjects: nil) let didLoad = Bundle.main.loadNibNamed(optionsNibName, owner: self, topLevelObjects: nil)
assert(didLoad)
if let optionsController = self.optionsController { if let optionsController = self.optionsController {
optionsController.machine = machine optionsController.machine = machine
optionsController.establishStoredOptions() optionsController.establishStoredOptions()

View File

@ -380,8 +380,8 @@ static Analyser::Static::ZX8081::Target::MemoryModel ZX8081MemoryModelFromSize(K
- (NSString *)optionsNibName { - (NSString *)optionsNibName {
switch(_targets.front()->machine) { switch(_targets.front()->machine) {
// case Analyser::Machine::AmstradCPC: return @"QuickLoadCompositeOptions";
case Analyser::Machine::AmstradCPC: return @"CompositeOptions"; case Analyser::Machine::AmstradCPC: return @"CompositeOptions";
case Analyser::Machine::Archimedes: return @"QuickLoadOptions";
case Analyser::Machine::AppleII: return @"AppleIIOptions"; case Analyser::Machine::AppleII: return @"AppleIIOptions";
case Analyser::Machine::Atari2600: return @"Atari2600Options"; case Analyser::Machine::Atari2600: return @"Atari2600Options";
case Analyser::Machine::AtariST: return @"CompositeOptions"; case Analyser::Machine::AtariST: return @"CompositeOptions";