1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-27 18:55:48 +00:00

Switches the two sync counters to upward-going rather than downward, as a more likely match to the way the rest of the 6845 implementation.

This commit is contained in:
Thomas Harte 2017-08-25 21:26:01 -04:00
parent d77d7fdd78
commit 039aed1bd1

View File

@ -79,17 +79,15 @@ template <class T> class CRTC6845 {
int cyles_remaining = cycles.as_int();
while(cyles_remaining--) {
// check for end of horizontal sync
if(hsync_down_counter_) {
hsync_down_counter_--;
if(!hsync_down_counter_) {
bus_state_.hsync = false;
}
if(bus_state_.hsync) {
hsync_counter_++;
bus_state_.hsync = hsync_counter_ != (registers_[3] & 15);
}
// check for start of horizontal sync
if(character_counter_ == registers_[2]) {
hsync_down_counter_ = registers_[3] & 15;
if(hsync_down_counter_) bus_state_.hsync = true;
hsync_counter_ = 0;
if(registers_[3] & 15) bus_state_.hsync = true;
}
// check for end of visible characters
@ -123,9 +121,9 @@ template <class T> class CRTC6845 {
inline void do_end_of_line() {
// check for end of vertical sync
if(vsync_down_counter_) {
vsync_down_counter_--;
if(!vsync_down_counter_) {
if(bus_state_.vsync) {
vsync_counter_++;
if(vsync_counter_ == (registers_[3] >> 4)) {
bus_state_.vsync = false;
}
}
@ -156,8 +154,7 @@ template <class T> class CRTC6845 {
// check for start of vertical sync
if(line_counter_ == registers_[7]) {
bus_state_.vsync = true;
vsync_down_counter_ = registers_[3] >> 4;
if(!vsync_down_counter_) vsync_down_counter_ = 16;
vsync_counter_ = 0;
}
// check for end of visible lines
@ -194,8 +191,8 @@ template <class T> class CRTC6845 {
bool character_is_visible_, line_is_visible_;
int hsync_down_counter_;
int vsync_down_counter_;
int hsync_counter_;
int vsync_counter_;
bool is_in_adjustment_period_;
uint16_t line_address_;