1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Merge branch 'master' into Z80

This commit is contained in:
Thomas Harte 2017-05-16 21:05:00 -04:00
commit 2562306802
5 changed files with 34 additions and 3 deletions

View File

@ -137,7 +137,7 @@ void TIA::set_output_mode(Atari2600::TIA::OutputMode output_mode) {
"uint y = c & 14u;"
"uint iPhase = (c >> 4);"
"float phaseOffset = 6.283185308 * (float(iPhase) + 3.0) / 13.0 + 5.074880441076923;"
"float phaseOffset = 6.283185308 * float(iPhase) / 13.0 + 5.074880441076923;"
"return mix(float(y) / 14.0, step(1, iPhase) * cos(phase + phaseOffset), amplitude);"
"}");
display_type = Outputs::CRT::DisplayType::NTSC60;

View File

@ -42,6 +42,7 @@ VideoOutput::VideoOutput(uint8_t *memory) :
"return (float(texValue) - 4.0) / 20.0;"
"}"
);
crt_->set_composite_function_type(Outputs::CRT::CRT::CompositeSourceType::DiscreteFourSamplesPerCycle, 0.0f);
set_output_device(Outputs::CRT::Television);
crt_->set_visible_area(crt_->get_rect_for_area(50, 224, 16 * 6, 40 * 6, 4.0f / 3.0f));

View File

@ -62,6 +62,14 @@ void CRT::set_new_display_type(unsigned int cycles_per_line, DisplayType display
}
}
void CRT::set_composite_function_type(CompositeSourceType type, float offset_of_first_sample) {
if(type == DiscreteFourSamplesPerCycle) {
colour_burst_phase_adjustment_ = (uint8_t)(offset_of_first_sample * 256.0f) & 63;
} else {
colour_burst_phase_adjustment_ = 0xff;
}
}
CRT::CRT(unsigned int common_output_divisor, unsigned int buffer_depth) :
sync_capacitor_charge_level_(0),
is_receiving_sync_(false),
@ -272,7 +280,8 @@ void CRT::output_scan(const Scan *const scan) {
colour_burst_phase_ = (position_phase + scan->phase) & 255;
colour_burst_amplitude_ = scan->amplitude;
colour_burst_phase_ = (colour_burst_phase_ & ~63) + 32;
if(colour_burst_phase_adjustment_ != 0xff)
colour_burst_phase_ = (colour_burst_phase_ & ~63) + colour_burst_phase_adjustment_;
}
}

View File

@ -59,7 +59,7 @@ class CRT {
};
void output_scan(const Scan *scan);
uint8_t colour_burst_phase_, colour_burst_amplitude_;
uint8_t colour_burst_phase_, colour_burst_amplitude_, colour_burst_phase_adjustment_;
bool is_writing_composite_run_;
unsigned int phase_denominator_, phase_numerator_, colour_cycle_numerator_;
@ -252,6 +252,26 @@ class CRT {
});
}
enum CompositeSourceType {
/// The composite function provides continuous output.
Continuous,
/// The composite function provides discrete output with four unique values per colour cycle.
DiscreteFourSamplesPerCycle
};
/*! Provides information about the type of output the composite sampling function provides — discrete or continuous.
This is necessary because the CRT implementation samples discretely and therefore can use fewer intermediate
samples if it can exactly duplicate the sampling rate and placement of the composite sampling function.
A continuous function is assumed by default.
@param type The type of output provided by the function supplied to `set_composite_sampling_function`.
@param offset_of_first_sample The relative position within a full cycle of the colour subcarrier at which the
first sample falls. E.g. 0.125 means "at 1/8th of the way through the complete cycle".
*/
void set_composite_function_type(CompositeSourceType type, float offset_of_first_sample = 0.0f);
/*! Sets a function that will map from whatever data the machine provided to an RGB signal.
If the output mode is composite then a default mapping from RGB to the display's composite

View File

@ -24,6 +24,7 @@ class CommodoreGCRParser: public Storage::Disk::Controller {
CommodoreGCRParser() : Storage::Disk::Controller(4000000, 1, 300), shift_register_(0), track_(1) {
drive.reset(new Storage::Disk::Drive);
set_drive(drive);
set_motor_on(true);
}
struct Sector {