From c2a7dffa7d21f0f5d6369ab69f4e0ca91c57f1a5 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 22 Jul 2017 23:02:28 -0400 Subject: [PATCH] Converted the ZX80/81 video component into a ClockReceiver. As it happens, it's most convenient to take the half-cycle bus here. --- Machines/ZX8081/Video.cpp | 4 ++-- Machines/ZX8081/Video.hpp | 7 ++++--- Machines/ZX8081/ZX8081.cpp | 10 +++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Machines/ZX8081/Video.cpp b/Machines/ZX8081/Video.cpp index 5531e7dee..766c6a1f6 100644 --- a/Machines/ZX8081/Video.cpp +++ b/Machines/ZX8081/Video.cpp @@ -29,9 +29,9 @@ Video::Video() : crt_->set_visible_area(Outputs::CRT::Rect(0.1f, 0.1f, 0.8f, 0.8f)); } -void Video::run_for_cycles(int number_of_cycles) { +void Video::run_for(const HalfCycles &half_cycles) { // Just keep a running total of the amount of time that remains owed to the CRT. - cycles_since_update_ += (unsigned int)number_of_cycles << 1; + cycles_since_update_ += (unsigned int)int(half_cycles); } void Video::flush() { diff --git a/Machines/ZX8081/Video.hpp b/Machines/ZX8081/Video.hpp index 9c63021ba..9ae254b8d 100644 --- a/Machines/ZX8081/Video.hpp +++ b/Machines/ZX8081/Video.hpp @@ -10,6 +10,7 @@ #define Machines_ZX8081_Video_hpp #include "../../Outputs/CRT/CRT.hpp" +#include "../../Components/ClockReceiver.hpp" namespace ZX8081 { @@ -23,15 +24,15 @@ namespace ZX8081 { a 1-bit graphic and output over the next 4 cycles, picking between the white level and the black level. */ -class Video { +class Video: public ClockReceiver