mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Attempts to stabilise image horizontally.
This commit is contained in:
parent
d37ba62343
commit
228d901253
@ -24,7 +24,7 @@ constexpr auto FinalColumn = CyclesPerLine / CyclesPerTick;
|
|||||||
|
|
||||||
VideoBase::VideoBase() :
|
VideoBase::VideoBase() :
|
||||||
VideoSwitches<Cycles>(true, Cycles(2), [this] (Cycles cycles) { advance(cycles); }),
|
VideoSwitches<Cycles>(true, Cycles(2), [this] (Cycles cycles) { advance(cycles); }),
|
||||||
crt_(130, 1, Outputs::Display::Type::NTSC60, Outputs::Display::InputDataType::Red4Green4Blue4) {
|
crt_(CyclesPerLine - 1, 1, Outputs::Display::Type::NTSC60, Outputs::Display::InputDataType::Red4Green4Blue4) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoBase::set_scan_target(Outputs::Display::ScanTarget *scan_target) {
|
void VideoBase::set_scan_target(Outputs::Display::ScanTarget *scan_target) {
|
||||||
@ -123,38 +123,48 @@ void VideoBase::output_row(int row, int start, int end) {
|
|||||||
|
|
||||||
// Output left border as far as currently known.
|
// Output left border as far as currently known.
|
||||||
if(start >= start_of_left_border && start < start_of_pixels) {
|
if(start >= start_of_left_border && start < start_of_pixels) {
|
||||||
const int duration = std::max(left_border_ticks, end - start_of_left_border);
|
const int end_of_period = std::min(start_of_pixels, end);
|
||||||
start += duration;
|
|
||||||
|
|
||||||
// TODO: output real border colour.
|
// TODO: output real border colour.
|
||||||
crt_.output_blank(duration * CyclesPerTick);
|
crt_.output_blank((end_of_period - start) * CyclesPerTick);
|
||||||
|
|
||||||
|
start = end_of_period;
|
||||||
|
if(start == end) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output left border as far as currently known.
|
// Output left border as far as currently known.
|
||||||
if(start >= start_of_pixels && start < start_of_right_border) {
|
if(start >= start_of_pixels && start < start_of_right_border) {
|
||||||
const int duration = std::max(pixel_ticks, end - start_of_pixels);
|
const int end_of_period = std::min(start_of_right_border, end);
|
||||||
start += duration;
|
|
||||||
|
|
||||||
// TODO: output real pixels.
|
// TODO: output real pixels.
|
||||||
uint16_t *const pixel = reinterpret_cast<uint16_t *>(crt_.begin_data(2, 2));
|
uint16_t *const pixel = reinterpret_cast<uint16_t *>(crt_.begin_data(2, 2));
|
||||||
if(pixel) *pixel = 0xffff;
|
if(pixel) *pixel = 0xffff;
|
||||||
crt_.output_data(duration * CyclesPerTick, 1);
|
crt_.output_data((end_of_period - start) * CyclesPerTick, 1);
|
||||||
|
|
||||||
|
start = end_of_period;
|
||||||
|
if(start == end) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output left border as far as currently known.
|
// Output left border as far as currently known.
|
||||||
if(start >= start_of_right_border && start < start_of_sync) {
|
if(start >= start_of_right_border && start < start_of_sync) {
|
||||||
const int duration = std::max(right_border_ticks, end - start_of_right_border);
|
const int end_of_period = std::min(start_of_sync, end);
|
||||||
start += duration;
|
|
||||||
|
|
||||||
// TODO: output real border colour.
|
// TODO: output real border colour.
|
||||||
crt_.output_blank(duration * CyclesPerTick);
|
crt_.output_blank((end_of_period - start) * CyclesPerTick);
|
||||||
|
|
||||||
|
start = end_of_period;
|
||||||
|
if(start == end) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output sync if the moment has arrived.
|
// Output sync if the moment has arrived.
|
||||||
if(end == FinalColumn) {
|
if(end == FinalColumn) {
|
||||||
crt_.output_sync(sync_period);
|
crt_.output_sync(sync_period);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VideoBase::get_is_vertical_blank() {
|
bool VideoBase::get_is_vertical_blank() {
|
||||||
|
Loading…
Reference in New Issue
Block a user