1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 16:31:42 +00:00

Converted the Oric's video output into a ClockReceiver.

This commit is contained in:
Thomas Harte 2017-07-22 23:11:30 -04:00
parent c2a7dffa7d
commit 6369138bd1
3 changed files with 6 additions and 4 deletions

View File

@ -142,7 +142,7 @@ void Machine::flush() {
} }
void Machine::update_video() { 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; cycles_since_video_update_ = 0;
} }

View File

@ -74,13 +74,14 @@ std::shared_ptr<Outputs::CRT::CRT> VideoOutput::get_crt() {
return crt_; return crt_;
} }
void VideoOutput::run_for_cycles(int number_of_cycles) { void VideoOutput::run_for(const Cycles &cycles) {
// Vertical: 039: pixels; otherwise blank; 4853 sync, 5456 colour burst // Vertical: 039: pixels; otherwise blank; 4853 sync, 5456 colour burst
// Horizontal: 0223: pixels; otherwise blank; 256259 sync // Horizontal: 0223: pixels; otherwise blank; 256259 sync
#define clamp(action) \ #define clamp(action) \
if(cycles_run_for <= number_of_cycles) { action; } else cycles_run_for = number_of_cycles; 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) { while(number_of_cycles) {
int h_counter = counter_ & 63; int h_counter = counter_ & 63;
int cycles_run_for = 0; int cycles_run_for = 0;

View File

@ -10,14 +10,15 @@
#define Machines_Oric_Video_hpp #define Machines_Oric_Video_hpp
#include "../../Outputs/CRT/CRT.hpp" #include "../../Outputs/CRT/CRT.hpp"
#include "../../Components/ClockReceiver.hpp"
namespace Oric { namespace Oric {
class VideoOutput { class VideoOutput: public ClockReceiver<VideoOutput> {
public: public:
VideoOutput(uint8_t *memory); VideoOutput(uint8_t *memory);
std::shared_ptr<Outputs::CRT::CRT> get_crt(); std::shared_ptr<Outputs::CRT::CRT> get_crt();
void run_for_cycles(int number_of_cycles); void run_for(const Cycles &cycles);
void set_colour_rom(const std::vector<uint8_t> &rom); void set_colour_rom(const std::vector<uint8_t> &rom);
void set_output_device(Outputs::CRT::OutputDevice output_device); void set_output_device(Outputs::CRT::OutputDevice output_device);