From 2b7382a014ffa2925a0534fdfe39a6dd9132e77e Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 10 Sep 2024 20:59:05 -0400 Subject: [PATCH] Loop in vsync as a potential tape input. --- Machines/Oric/Oric.cpp | 17 ++++++++++++++--- Machines/Oric/Video.cpp | 15 +++++++++++++++ Machines/Oric/Video.hpp | 1 + 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index 3176ddd7e..63f574d62 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -576,7 +576,9 @@ template get_input()); + via_.set_control_line_input( + MOS::MOS6522::Port::B, MOS::MOS6522::Line::One, + tape_player_.get_motor_control() ? + !tape_player_.get_input() : + !video_->vsync() + ); } // for Utility::TypeRecipient::Delegate diff --git a/Machines/Oric/Video.cpp b/Machines/Oric/Video.cpp index a2f7db8c6..42636c636 100644 --- a/Machines/Oric/Video.cpp +++ b/Machines/Oric/Video.cpp @@ -115,6 +115,21 @@ bool VideoOutput::vsync() { return counter_ >= v_sync_start_position_ && counter_ < v_sync_end_position_; } +Cycles VideoOutput::next_sequence_point() const { + if(counter_ < v_sync_start_position_) { + return Cycles(v_sync_start_position_ - counter_); + } else if(counter_ < v_sync_end_position_) { + return Cycles(v_sync_end_position_ - counter_); + } else { + // After vsync the length of the next frame is baked in, so this is safe + // (but should probably be factored out). + return Cycles( + counter_period_ + static_cast(next_frame_is_sixty_hertz_ ? PAL60VSyncStartPosition : PAL50VSyncStartPosition) + - counter_ + ); + } +} + void VideoOutput::run_for(const Cycles cycles) { // Horizontal: 0-39: pixels; otherwise blank; 48-53 sync, 54-56 colour burst. // Vertical: 0-223: pixels; otherwise blank; 256-259 (50Hz) or 234-238 (60Hz) sync. diff --git a/Machines/Oric/Video.hpp b/Machines/Oric/Video.hpp index e00a16d69..b3bc5a2ea 100644 --- a/Machines/Oric/Video.hpp +++ b/Machines/Oric/Video.hpp @@ -23,6 +23,7 @@ class VideoOutput { void set_colour_rom(const std::vector &colour_rom); void run_for(const Cycles cycles); + Cycles next_sequence_point() const; bool vsync();