From 789114cc7dcd80e9729bb33db1e0524dc2914eed Mon Sep 17 00:00:00 2001 From: joevt Date: Fri, 2 Feb 2024 01:44:03 -0800 Subject: [PATCH] control: Save CNT_TST and MON_SENSE. These are writable registers that should return what was written to them. --- devices/video/control.cpp | 9 ++++++++- devices/video/control.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/devices/video/control.cpp b/devices/video/control.cpp index a73a53e..bc77f34 100644 --- a/devices/video/control.cpp +++ b/devices/video/control.cpp @@ -325,7 +325,8 @@ uint32_t ControlVideo::read(uint32_t rgn_start, uint32_t offset, int size) value = this->row_words; break; case ControlRegs::MON_SENSE: - value = this->cur_mon_id << 6; + value = (this->cur_mon_id << 6) | this->mon_sense; + LOG_F(CONTROL, "%s: read MON_SENSE %03x.%c = %0*x", this->name.c_str(), offset, SIZE_ARG(size), size * 2, value); break; case ControlRegs::MISC_ENABLES: value = this->enables; @@ -474,6 +475,7 @@ void ControlVideo::write(uint32_t rgn_start, uint32_t offset, uint32_t value, in } break; case ControlRegs::CNTTST: + this->cnt_tst = value & 0xFFF; if (value) LOG_F(WARNING, "%s: CNTTST set to 0x%X", this->name.c_str(), value); break; @@ -512,8 +514,13 @@ void ControlVideo::write(uint32_t rgn_start, uint32_t offset, uint32_t value, in } break; case ControlRegs::MON_SENSE: { + if (value & ~0x3F) + LOG_F(ERROR, "%s: write MON_SENSE %03x.%c = %0*x", this->name.c_str(), offset, SIZE_ARG(size), size * 2, value); + else + LOG_F(CONTROL, "%s: write MON_SENSE %03x.%c = %0*x", this->name.c_str(), offset, SIZE_ARG(size), size * 2, value); uint8_t dirs = ((value >> 3) & 7) ^ 7; uint8_t levels = ((value & 7) & dirs) | (dirs ^ 7); + this->mon_sense = value & 0x3F; this->cur_mon_id = this->display_id->read_monitor_sense(levels, dirs); } break; diff --git a/devices/video/control.h b/devices/video/control.h index 948b2d5..5af6e6e 100644 --- a/devices/video/control.h +++ b/devices/video/control.h @@ -152,9 +152,11 @@ private: uint32_t row_words = 0; uint32_t fb_base = 0; uint16_t swatch_params[16]; + uint16_t cnt_tst = 0; int strobe_counter = 0; uint8_t vram_banks = 0; uint8_t cur_mon_id = 0; + uint8_t mon_sense = 0; uint16_t enables = 0; uint8_t int_enable = 0; uint8_t int_status = 0;