diff --git a/ClockReceiver/JustInTime.hpp b/ClockReceiver/JustInTime.hpp index 35edfae7f..273f79bcd 100644 --- a/ClockReceiver/JustInTime.hpp +++ b/ClockReceiver/JustInTime.hpp @@ -136,6 +136,11 @@ template class ConcreteMachine: } void set_scan_target(Outputs::Display::ScanTarget *scan_target) final { - video_->set_scan_target(scan_target); + video_.last_valid()->set_scan_target(scan_target); } Outputs::Display::ScanStatus get_scaled_scan_status() const final { - return video_->get_scaled_scan_status(); + return video_.last_valid()->get_scaled_scan_status(); } void set_display_type(Outputs::Display::DisplayType display_type) final { - video_->set_display_type(display_type); + video_.last_valid()->set_display_type(display_type); } Outputs::Display::DisplayType get_display_type() const final { - return video_->get_display_type(); + return video_.last_valid()->get_display_type(); } Outputs::Speaker::Speaker *get_speaker() final { diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index 5e1993463..78fa44595 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -34,6 +34,8 @@ #include "../../Analyser/Static/Oric/Target.hpp" +#include "../../ClockReceiver/JustInTime.hpp" + #include #include #include @@ -217,7 +219,6 @@ template rom_names = { {machine_name, "the Oric colour ROM", "colour.rom", 128, 0xd50fca65} }; switch(target.rom) { @@ -292,7 +289,7 @@ template set_colour_rom(*roms[0]); rom_ = std::move(*roms[1]); switch(disk_interface) { @@ -313,7 +310,7 @@ template set_state_machine(*roms[diskii_state_machine_index]); } break; } @@ -402,7 +399,7 @@ template read_address(address); + if(!isWriteOperation(operation) && disk_value != Apple::DiskII::DidNotLoad) *value = uint8_t(disk_value); } break; } @@ -485,7 +481,7 @@ template = 0x9800 && address <= 0xc000) update_video(); + if(address >= 0x9800 && address <= 0xc000) video_.flush(); ram_[address] = *value; } } @@ -508,7 +504,7 @@ template set_data_input(*value); } + diskii_ += Cycles(2); // i.e. effective clock rate of 2Mhz. break; } - cycles_since_video_update_++; + video_ += Cycles(1); return Cycles(1); } forceinline void flush() { - update_video(); + video_.flush(); via_.flush(); - flush_diskii(); + diskii_.flush(); } // to satisfy CRTMachine::Machine void set_scan_target(Outputs::Display::ScanTarget *scan_target) final { - video_output_.set_scan_target(scan_target); + video_.last_valid()->set_scan_target(scan_target); } Outputs::Display::ScanStatus get_scaled_scan_status() const final { - return video_output_.get_scaled_scan_status(); + return video_.last_valid()->get_scaled_scan_status(); } void set_display_type(Outputs::Display::DisplayType display_type) final { - video_output_.set_display_type(display_type); + video_.last_valid()->set_display_type(display_type); } Outputs::Display::DisplayType get_display_type() const final { - return video_output_.get_display_type(); + return video_.last_valid()->get_display_type(); } Outputs::Speaker::Speaker *get_speaker() final { @@ -644,15 +638,11 @@ template set_activity_observer(observer); break; } } - void set_component_prefers_clocking(ClockingHint::Source *, ClockingHint::Preference) final { - diskii_clocking_preference_ = diskii_.preferred_clocking(); - } - private: const uint16_t basic_invisible_ram_top_ = 0xffff; const uint16_t basic_visible_ram_top_ = 0xbfff; @@ -662,17 +652,13 @@ template rom_, disk_rom_; uint8_t ram_[65536]; - Cycles cycles_since_video_update_; - inline void update_video() { - video_output_.run_for(cycles_since_video_update_.flush()); - } // ROM bookkeeping uint16_t tape_get_byte_address_ = 0, tape_speed_address_ = 0; int keyboard_read_count_ = 0; // Outputs - VideoOutput video_output_; + JustInTimeActor video_; Concurrency::DeferringAsyncTaskQueue audio_queue_; GI::AY38910::AY38910 ay8910_; @@ -700,14 +686,9 @@ template ()); - } + JustInTimeActor diskii_; std::vector pravetz_rom_; std::size_t pravetz_rom_base_pointer_ = 0; - ClockingHint::Preference diskii_clocking_preference_ = ClockingHint::Preference::RealTime; // Overlay RAM uint16_t ram_top_ = basic_visible_ram_top_;