diff --git a/devices/video/atimach64gx.cpp b/devices/video/atimach64gx.cpp index dc3be86..1e701e2 100644 --- a/devices/video/atimach64gx.cpp +++ b/devices/video/atimach64gx.cpp @@ -362,6 +362,15 @@ uint32_t AtiMach64Gx::read_reg(uint32_t reg_offset, uint32_t size) return static_cast(result); } +#define WRITE_VALUE_AND_LOG() \ + do { \ + this->regs[reg_num] = new_value; \ + LOG_F(9, "%s: write %s %04x.%c = %0*x = %08x", this->name.c_str(), \ + get_reg_name(reg_num), reg_offset, SIZE_ARG(size), size * 2, \ + (uint32_t)extract_bits(value, offset * 8, size * 8), new_value \ + ); \ + } while (0) + void AtiMach64Gx::write_reg(uint32_t reg_offset, uint32_t value, uint32_t size) { uint32_t reg_num = reg_offset >> 2; @@ -389,6 +398,7 @@ void AtiMach64Gx::write_reg(uint32_t reg_offset, uint32_t value, uint32_t size) break; case ATI_CRTC_OFF_PITCH: new_value = value; + WRITE_VALUE_AND_LOG(); this->crtc_update(); return; case ATI_CRTC_INT_CNTL: @@ -506,6 +516,7 @@ void AtiMach64Gx::write_reg(uint32_t reg_offset, uint32_t value, uint32_t size) case ATI_OVR_WID_LEFT_RIGHT: case ATI_OVR_WID_TOP_BOTTOM: new_value = value; + WRITE_VALUE_AND_LOG(); if (value != 0) { LOG_F(ERROR, "%s: Unhandled value 0x%08x.", this->name.c_str(), value); } @@ -515,12 +526,14 @@ void AtiMach64Gx::write_reg(uint32_t reg_offset, uint32_t value, uint32_t size) new_value = value; this->cursor_dirty = true; draw_fb = true; + WRITE_VALUE_AND_LOG(); return; case ATI_CUR_OFFSET: new_value = value; if (old_value != new_value) this->cursor_dirty = true; draw_fb = true; + WRITE_VALUE_AND_LOG(); return; case ATI_CUR_HORZ_VERT_OFF: new_value = value; @@ -530,10 +543,12 @@ void AtiMach64Gx::write_reg(uint32_t reg_offset, uint32_t value, uint32_t size) ) this->cursor_dirty = true; draw_fb = true; + WRITE_VALUE_AND_LOG(); return; case ATI_CUR_HORZ_VERT_POSN: new_value = value; draw_fb = true; + WRITE_VALUE_AND_LOG(); return; case ATI_DAC_REGS: new_value = old_value; // no change