1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-18 01:30:56 +00:00

Expands visible area and adds a few more safety barriers.

This commit is contained in:
Thomas Harte 2019-11-09 15:00:42 -05:00
parent 8c736a639a
commit 70c6010fe0
2 changed files with 9 additions and 5 deletions

View File

@ -91,7 +91,9 @@ struct Checker {
Video::Video() : Video::Video() :
crt_(1024, 1, Outputs::Display::Type::PAL50, Outputs::Display::InputDataType::Red4Green4Blue4) { crt_(1024, 1, Outputs::Display::Type::PAL50, Outputs::Display::InputDataType::Red4Green4Blue4) {
crt_.set_visible_area(crt_.get_rect_for_area(43, 240, 220, 784, 4.0f / 3.0f)); // Show a total of 260 lines; a little short for PAL but a compromise between that and the ST's
// usual output height of 200 lines.
crt_.set_visible_area(crt_.get_rect_for_area(33, 260, 188, 850, 4.0f / 3.0f));
} }
void Video::set_ram(uint16_t *ram, size_t size) { void Video::set_ram(uint16_t *ram, size_t size) {
@ -172,7 +174,7 @@ void Video::run_for(HalfCycles duration) {
} }
} }
} break; } break;
default: default: {
// There will be pixels this line, subject to the shifter pipeline. // There will be pixels this line, subject to the shifter pipeline.
// Divide into 8-[half-]cycle windows; at the start of each window fetch a word, // Divide into 8-[half-]cycle windows; at the start of each window fetch a word,
// and during the rest of the window, shift out. // and during the rest of the window, shift out.
@ -210,7 +212,7 @@ void Video::run_for(HalfCycles duration) {
shift_out((x_ + run_length) & 7); shift_out((x_ + run_length) & 7);
} }
} }
break; } break;
} }
// Check for whether line length should have been latched during this run. // Check for whether line length should have been latched during this run.
@ -334,6 +336,7 @@ void Video::shift_out(int length) {
} break; } break;
default: default:
case OutputBpp::Four: case OutputBpp::Four:
assert(!(length & 1));
pixel_buffer_.pixels_output += length >> 1; pixel_buffer_.pixels_output += length >> 1;
if(pixel_buffer_.pixel_pointer) { if(pixel_buffer_.pixel_pointer) {
while(length) { while(length) {
@ -358,7 +361,8 @@ void Video::shift_out(int length) {
// Check for buffer being full. Buffers are allocated as 328 pixels, and this method is // Check for buffer being full. Buffers are allocated as 328 pixels, and this method is
// never called for more than 8 pixels, so there's no chance of overrun. // never called for more than 8 pixels, so there's no chance of overrun.
if(pixel_buffer_.pixels_output >= 320) pixel_buffer_.flush(crt_); if(pixel_buffer_.pixel_pointer && pixel_buffer_.pixels_output >= 320)
pixel_buffer_.flush(crt_);
} }
void Video::output_border(int duration) { void Video::output_border(int duration) {

View File

@ -115,7 +115,7 @@ class Video {
} }
void allocate(Outputs::CRT::CRT &crt) { void allocate(Outputs::CRT::CRT &crt) {
flush(crt); flush(crt);
pixel_pointer = reinterpret_cast<uint16_t *>(crt.begin_data(328)); pixel_pointer = reinterpret_cast<uint16_t *>(crt.begin_data(320 + 32));
} }
} pixel_buffer_; } pixel_buffer_;
}; };