1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-26 09:29:45 +00:00

Ensures proper propagation of video choice through the Oric.

This commit is contained in:
Thomas Harte 2018-04-04 19:14:42 -04:00
parent c0b4dd65da
commit 36e0cb29c0
4 changed files with 25 additions and 14 deletions

View File

@ -67,6 +67,10 @@ class Machine: public ROMMachine::Machine {
return clock_rate_;
}
/*!
Maps from Configurable::Display to Outputs::CRT::VideoSignal and calls
@c set_video_signal with the result.
*/
void set_video_signal_configurable(Configurable::Display type) {
Outputs::CRT::VideoSignal signal;
switch(type) {
@ -81,7 +85,14 @@ class Machine: public ROMMachine::Machine {
signal = Outputs::CRT::VideoSignal::Composite;
break;
}
get_crt()->set_video_signal(signal);
set_video_signal(signal);
}
/*!
Forwards the video signal to the CRT returned by get_crt().
*/
virtual void set_video_signal(Outputs::CRT::VideoSignal video_signal) {
get_crt()->set_video_signal(video_signal);
}
private:

View File

@ -263,10 +263,6 @@ class ConcreteMachine:
use_fast_tape_hack_ = activate;
}
void set_output_device(Outputs::CRT::VideoSignal output_device) {
video_output_->set_output_device(output_device);
}
// to satisfy ConfigurationTarget::Machine
void configure_as_target(const Analyser::Static::Target *target) override final {
auto *const oric_target = dynamic_cast<const Analyser::Static::Oric::Target *>(target);
@ -392,7 +388,7 @@ class ConcreteMachine:
video_output_.reset(new VideoOutput(ram_));
if(!colour_rom_.empty()) video_output_->set_colour_rom(colour_rom_);
set_output_device(Outputs::CRT::VideoSignal::RGB);
set_video_signal(Outputs::CRT::VideoSignal::RGB);
}
void close_output() override final {
@ -469,6 +465,10 @@ class ConcreteMachine:
}
}
void set_video_signal(Outputs::CRT::VideoSignal video_signal) override {
video_output_->set_video_signal(video_signal);
}
Configurable::SelectionSet get_accurate_selections() override {
Configurable::SelectionSet selection_set;
Configurable::append_quick_load_tape_selection(selection_set, false);

View File

@ -41,13 +41,13 @@ VideoOutput::VideoOutput(uint8_t *memory) :
);
crt_->set_composite_function_type(Outputs::CRT::CRT::CompositeSourceType::DiscreteFourSamplesPerCycle, 0.0f);
set_output_device(Outputs::CRT::VideoSignal::Composite);
set_video_signal(Outputs::CRT::VideoSignal::Composite);
crt_->set_visible_area(crt_->get_rect_for_area(53, 224, 16 * 6, 40 * 6, 4.0f / 3.0f));
}
void VideoOutput::set_output_device(Outputs::CRT::VideoSignal output_device) {
output_device_ = output_device;
crt_->set_video_signal(output_device);
void VideoOutput::set_video_signal(Outputs::CRT::VideoSignal video_signal) {
video_signal_ = video_signal;
crt_->set_video_signal(video_signal);
}
void VideoOutput::set_colour_rom(const std::vector<uint8_t> &rom) {
@ -129,7 +129,7 @@ void VideoOutput::run_for(const Cycles cycles) {
if(control_byte & 0x60) {
if(pixel_target_) {
uint16_t colours[2];
if(output_device_ == Outputs::CRT::VideoSignal::RGB) {
if(video_signal_ == Outputs::CRT::VideoSignal::RGB) {
colours[0] = static_cast<uint8_t>(paper_ ^ inverse_mask);
colours[1] = static_cast<uint8_t>(ink_ ^ inverse_mask);
} else {
@ -183,7 +183,7 @@ void VideoOutput::run_for(const Cycles cycles) {
pixel_target_[0] = pixel_target_[1] =
pixel_target_[2] = pixel_target_[3] =
pixel_target_[4] = pixel_target_[5] =
(output_device_ == Outputs::CRT::VideoSignal::RGB) ? paper_ ^ inverse_mask : colour_forms_[paper_ ^ inverse_mask];
(video_signal_ == Outputs::CRT::VideoSignal::RGB) ? paper_ ^ inverse_mask : colour_forms_[paper_ ^ inverse_mask];
}
}
if(pixel_target_) pixel_target_ += 6;

View File

@ -20,7 +20,7 @@ class VideoOutput {
Outputs::CRT::CRT *get_crt();
void run_for(const Cycles cycles);
void set_colour_rom(const std::vector<uint8_t> &rom);
void set_output_device(Outputs::CRT::VideoSignal output_device);
void set_video_signal(Outputs::CRT::VideoSignal output_device);
private:
uint8_t *ram_;
@ -33,7 +33,7 @@ class VideoOutput {
// Output target and device
uint16_t *pixel_target_;
uint16_t colour_forms_[8];
Outputs::CRT::VideoSignal output_device_;
Outputs::CRT::VideoSignal video_signal_;
// Registers
uint8_t ink_, paper_;