From 6369138bd1fa0af009d7a833c09a426f29086f79 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 22 Jul 2017 23:11:30 -0400 Subject: [PATCH] Converted the Oric's video output into a `ClockReceiver`. --- Machines/Oric/Oric.cpp | 2 +- Machines/Oric/Video.cpp | 3 ++- Machines/Oric/Video.hpp | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index d82639d54..8c4a6d52f 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -142,7 +142,7 @@ void Machine::flush() { } void Machine::update_video() { - video_output_->run_for_cycles(cycles_since_video_update_); + video_output_->run_for(Cycles(cycles_since_video_update_)); cycles_since_video_update_ = 0; } diff --git a/Machines/Oric/Video.cpp b/Machines/Oric/Video.cpp index a4107101a..4acf619af 100644 --- a/Machines/Oric/Video.cpp +++ b/Machines/Oric/Video.cpp @@ -74,13 +74,14 @@ std::shared_ptr VideoOutput::get_crt() { return crt_; } -void VideoOutput::run_for_cycles(int number_of_cycles) { +void VideoOutput::run_for(const Cycles &cycles) { // Vertical: 0–39: pixels; otherwise blank; 48–53 sync, 54–56 colour burst // Horizontal: 0–223: pixels; otherwise blank; 256–259 sync #define clamp(action) \ if(cycles_run_for <= number_of_cycles) { action; } else cycles_run_for = number_of_cycles; + int number_of_cycles = int(cycles); while(number_of_cycles) { int h_counter = counter_ & 63; int cycles_run_for = 0; diff --git a/Machines/Oric/Video.hpp b/Machines/Oric/Video.hpp index 992d73470..a6ba51a7d 100644 --- a/Machines/Oric/Video.hpp +++ b/Machines/Oric/Video.hpp @@ -10,14 +10,15 @@ #define Machines_Oric_Video_hpp #include "../../Outputs/CRT/CRT.hpp" +#include "../../Components/ClockReceiver.hpp" namespace Oric { -class VideoOutput { +class VideoOutput: public ClockReceiver { public: VideoOutput(uint8_t *memory); std::shared_ptr get_crt(); - void run_for_cycles(int number_of_cycles); + void run_for(const Cycles &cycles); void set_colour_rom(const std::vector &rom); void set_output_device(Outputs::CRT::OutputDevice output_device);