From 0b5a79834331533f47592a80b0abd4727c0c1915 Mon Sep 17 00:00:00 2001 From: joevt Date: Wed, 28 Feb 2024 15:23:31 -0800 Subject: [PATCH] atimach64gx: Fix ATI_CRTC_GEN_CNTL. Add call to crtc_update. Maybe consider AK and EN bits (placeholder for now). --- devices/video/atimach64gx.cpp | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/devices/video/atimach64gx.cpp b/devices/video/atimach64gx.cpp index 078881c..fe91fe8 100644 --- a/devices/video/atimach64gx.cpp +++ b/devices/video/atimach64gx.cpp @@ -451,7 +451,32 @@ void AtiMach64Gx::write_reg(uint32_t reg_offset, uint32_t value, uint32_t size) } case ATI_CRTC_GEN_CNTL: { - new_value = value; + uint32_t bits_AK = +#if 1 +#else + (1 << ATI_CRTC_VSYNC_INT_AK) | + (1 << ATI_CRTC2_VSYNC_INT_AK) | +#endif + 0; +/* + uint32_t bits_EN = +#if 1 +#else + (1 << ATI_CRTC_VSYNC_INT_EN) | + (1 << ATI_CRTC2_VSYNC_INT_EN) | +#endif + 0; +*/ + uint32_t bits_AKed = bits_AK & value; // AK bits that are to be AKed + uint32_t bits_not_AKed = bits_AK & ~value; // AK bits that are not to be AKed + + new_value = value & ~bits_AKed; // clear the AKed bits + uint32_t bits_read_only = bits_not_AKed; // the not AKed bits will remain unchanged + + new_value = (old_value & bits_read_only) | (new_value & ~bits_read_only); + + this->regs[reg_num] = new_value; + if (bit_changed(old_value, new_value, ATI_CRTC_DISPLAY_DIS)) { if (bit_set(new_value, ATI_CRTC_DISPLAY_DIS)) { this->blank_on = true; @@ -462,12 +487,7 @@ void AtiMach64Gx::write_reg(uint32_t reg_offset, uint32_t value, uint32_t size) } if (bit_changed(old_value, new_value, ATI_CRTC_ENABLE)) { - if (!bit_set(new_value, ATI_CRTC_ENABLE)) { - this->blank_on = true; - this->blank_display(); - } else { - this->blank_on = false; - } + this->crtc_update(); } break; }