1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 16:31:42 +00:00

Subsume vertical sync position.

This commit is contained in:
Thomas Harte 2024-01-08 22:28:46 -05:00
parent f1453d9363
commit 5f00d29297

View File

@ -108,7 +108,7 @@ template <class BusHandlerT, Personality personality, CursorType cursor_type> cl
switch(selected_register_) { switch(selected_register_) {
case 0: layout_.horizontal.total = value; break; case 0: layout_.horizontal.total = value; break;
case 1: layout_.horizontal.displayed = value; break; case 1: layout_.horizontal.displayed = value; break;
case 2: layout_.horizontal.start_blank = value; break; case 2: layout_.horizontal.start_sync = value; break;
case 3: case 3:
if constexpr (is_ega) { if constexpr (is_ega) {
} else { } else {
@ -124,12 +124,9 @@ template <class BusHandlerT, Personality personality, CursorType cursor_type> cl
layout_.vertical.total = value & 0x7f; layout_.vertical.total = value & 0x7f;
} }
break; break;
case 5: case 5: layout_.vertical.adjust = value & 0x1f; break;
layout_.vertical.adjust = value & 0x1f; case 6: layout_.vertical.displayed = value & 0x7f; break;
break; case 7: layout_.vertical.start_sync = value & 0x7f; break;
case 6:
layout_.vertical.displayed = value & 0x7f;
break;
} }
static constexpr uint8_t masks[] = { static constexpr uint8_t masks[] = {
@ -197,7 +194,7 @@ template <class BusHandlerT, Personality personality, CursorType cursor_type> cl
} }
// Check for start of horizontal sync. // Check for start of horizontal sync.
if(character_counter_ == layout_.horizontal.start_blank) { if(character_counter_ == layout_.horizontal.start_sync) {
hsync_counter_ = 0; hsync_counter_ = 0;
bus_state_.hsync = true; bus_state_.hsync = true;
} }
@ -288,7 +285,7 @@ template <class BusHandlerT, Personality personality, CursorType cursor_type> cl
line_counter_ = (line_counter_ + 1) & 0x7f; line_counter_ = (line_counter_ + 1) & 0x7f;
// Check for start of vertical sync. // Check for start of vertical sync.
if(line_counter_ == registers_[7]) { if(line_counter_ == layout_.vertical.start_sync) {
bus_state_.vsync = true; bus_state_.vsync = true;
vsync_counter_ = 0; vsync_counter_ = 0;
} }
@ -343,13 +340,14 @@ template <class BusHandlerT, Personality personality, CursorType cursor_type> cl
struct { struct {
uint8_t total; uint8_t total;
uint8_t displayed; uint8_t displayed;
uint8_t start_blank; uint8_t start_sync;
uint8_t sync_width; uint8_t sync_width;
} horizontal; } horizontal;
struct { struct {
uint8_t total; uint8_t total;
uint8_t displayed; uint8_t displayed;
uint8_t start_sync;
uint8_t sync_lines; uint8_t sync_lines;
uint8_t adjust; uint8_t adjust;
} vertical; } vertical;