mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Stabilises display, albeit that top border mode now appears to be off.
This commit is contained in:
parent
6a7eb832cc
commit
6c9dacbe89
@ -105,6 +105,18 @@ void Nick::run_for(HalfCycles duration) {
|
|||||||
++fetch_spot;
|
++fetch_spot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Special: set mode as soon as it's known. It'll be needed at the end of HSYNC.
|
||||||
|
if(!window) {
|
||||||
|
mode_ = Mode((line_parameters_[1] >> 1)&7);
|
||||||
|
if(mode_ == Mode::Vsync) {
|
||||||
|
state_ = State::Blank;
|
||||||
|
} else {
|
||||||
|
// The first ten windows are occupied by the horizontal sync and
|
||||||
|
// colour burst; if left signalled before then, begin in pixels.
|
||||||
|
state_ = left_margin_ > 10 ? State::Border : State::Pixels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If all parameters have been loaded, set appropriate fields.
|
// If all parameters have been loaded, set appropriate fields.
|
||||||
if(fetch_spot == 8) {
|
if(fetch_spot == 8) {
|
||||||
should_reload_line_parameters_ = false;
|
should_reload_line_parameters_ = false;
|
||||||
@ -117,21 +129,13 @@ void Nick::run_for(HalfCycles duration) {
|
|||||||
line_data_pointer_[1] = uint16_t(line_parameters_[6] | (line_parameters_[7] << 8));
|
line_data_pointer_[1] = uint16_t(line_parameters_[6] | (line_parameters_[7] << 8));
|
||||||
|
|
||||||
// Set the output mode and margin.
|
// Set the output mode and margin.
|
||||||
mode_ = Mode((line_parameters_[1] >> 1)&7);
|
|
||||||
left_margin_ = line_parameters_[2] & 0x3f;
|
left_margin_ = line_parameters_[2] & 0x3f;
|
||||||
right_margin_ = line_parameters_[3] & 0x3f;
|
right_margin_ = line_parameters_[3] & 0x3f;
|
||||||
|
|
||||||
if(mode_ == Mode::Vsync) {
|
|
||||||
state_ = State::Blank;
|
|
||||||
} else {
|
|
||||||
// The first ten windows are occupied by the horizontal sync and
|
|
||||||
// colour burst; if left signalled before then, begin in pixels.
|
|
||||||
state_ = left_margin_ > 10 ? State::Border : State::Pixels;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// HSYNC is signalled for four windows at the start of the line.
|
// HSYNC is signalled for four windows at the start of the line.
|
||||||
|
// I currently belive this happens regardless of Vsync mode.
|
||||||
if(window < 4 && end_window >= 4) {
|
if(window < 4 && end_window >= 4) {
|
||||||
crt_.output_sync(4);
|
crt_.output_sync(4);
|
||||||
window = 4;
|
window = 4;
|
||||||
@ -139,6 +143,7 @@ void Nick::run_for(HalfCycles duration) {
|
|||||||
|
|
||||||
// Deal with vsync mode out here.
|
// Deal with vsync mode out here.
|
||||||
if(mode_ == Mode::Vsync) {
|
if(mode_ == Mode::Vsync) {
|
||||||
|
if(window >= 4) {
|
||||||
while(window < end_window) {
|
while(window < end_window) {
|
||||||
int next_event = end_window;
|
int next_event = end_window;
|
||||||
if(window < left_margin_) next_event = std::min(next_event, left_margin_);
|
if(window < left_margin_) next_event = std::min(next_event, left_margin_);
|
||||||
@ -154,6 +159,7 @@ void Nick::run_for(HalfCycles duration) {
|
|||||||
if(window == left_margin_) state_ = State::Sync;
|
if(window == left_margin_) state_ = State::Sync;
|
||||||
if(window == right_margin_) state_ = State::Blank;
|
if(window == right_margin_) state_ = State::Blank;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// If present then the colour burst is output for the period from
|
// If present then the colour burst is output for the period from
|
||||||
// the start of window 6 to the end of window 10.
|
// the start of window 6 to the end of window 10.
|
||||||
@ -163,6 +169,7 @@ void Nick::run_for(HalfCycles duration) {
|
|||||||
window = 10;
|
window = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(window >= 10) {
|
||||||
while(window < end_window) {
|
while(window < end_window) {
|
||||||
int next_event = end_window;
|
int next_event = end_window;
|
||||||
if(window < left_margin_) next_event = std::min(next_event, left_margin_);
|
if(window < left_margin_) next_event = std::min(next_event, left_margin_);
|
||||||
@ -190,6 +197,7 @@ void Nick::run_for(HalfCycles duration) {
|
|||||||
// TODO: probably output pixels here?
|
// TODO: probably output pixels here?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Finish up the line.
|
// Finish up the line.
|
||||||
if(!horizontal_counter_) {
|
if(!horizontal_counter_) {
|
||||||
|
Loading…
Reference in New Issue
Block a user