From 837b9499d50e4d58fac0ee090e7cfa5755e61827 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 4 Apr 2021 20:43:16 -0400 Subject: [PATCH 1/2] Translates Oric video and Disk II into JustInTimeActors. --- ClockReceiver/JustInTime.hpp | 10 ++++++ Machines/Oric/Oric.cpp | 67 +++++++++++++----------------------- 2 files changed, 34 insertions(+), 43 deletions(-) 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 #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_; From 57b32d9537ca4d21ee776bf73e3b70c8cfac69e1 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 4 Apr 2021 20:48:15 -0400 Subject: [PATCH 2/2] Avoid adding additional threading constraints. --- Machines/Electron/Electron.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index edc0c9807..e76566a2d 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -521,19 +521,19 @@ 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 {