1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-21 21:33:54 +00:00

Add vsync getter.

This commit is contained in:
Thomas Harte 2024-09-10 20:31:35 -04:00
parent a6c6a1c6da
commit e55f61deb2
2 changed files with 7 additions and 1 deletions

View File

@ -111,6 +111,10 @@ void VideoOutput::set_colour_rom(const std::vector<uint8_t> &rom) {
// }
}
bool VideoOutput::vsync() {
return counter_ >= v_sync_start_position_ && counter_ < v_sync_end_position_;
}
void VideoOutput::run_for(const Cycles cycles) {
// Horizontal: 0-39: pixels; otherwise blank; 48-53 sync, 54-56 colour burst.
// Vertical: 0-223: pixels; otherwise blank; 256-259 (50Hz) or 234-238 (60Hz) sync.
@ -123,7 +127,7 @@ void VideoOutput::run_for(const Cycles cycles) {
int h_counter = counter_ & 63;
int cycles_run_for = 0;
if(counter_ >= v_sync_start_position_ && counter_ < v_sync_end_position_) {
if(vsync()) {
// this is a sync line
cycles_run_for = v_sync_end_position_ - counter_;
clamp(crt_.output_sync((v_sync_end_position_ - v_sync_start_position_) * 6));

View File

@ -24,6 +24,8 @@ class VideoOutput {
void run_for(const Cycles cycles);
bool vsync();
void set_scan_target(Outputs::Display::ScanTarget *scan_target);
void set_display_type(Outputs::Display::DisplayType display_type);
Outputs::Display::DisplayType get_display_type() const;