From 5ed763b982096b53049c81bf56b7025868a7bd38 Mon Sep 17 00:00:00 2001 From: angelosa Date: Mon, 16 Dec 2024 15:21:46 +0100 Subject: video/pc_vga_cirrus: replace cirrus_define_video_mode with VGA arch recompute_params --- src/devices/video/pc_vga.h | 2 +- src/devices/video/pc_vga_cirrus.cpp | 21 +++++++++++++-------- src/devices/video/pc_vga_cirrus.h | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/devices/video/pc_vga.h b/src/devices/video/pc_vga.h index a95642b6e93..d982163bbb0 100644 --- a/src/devices/video/pc_vga.h +++ b/src/devices/video/pc_vga.h @@ -38,7 +38,7 @@ public: // $46e8, $56e8, $66e8, $76e8 for ISA bus void mode_setup_w(offs_t offset, uint8_t data); - // $102 / $3c3, MCA bus + // $102 ISA bus / $3c3 MCA bus //void wakeup_w(offs_t offset, uint8_t data); virtual uint8_t mem_r(offs_t offset); diff --git a/src/devices/video/pc_vga_cirrus.cpp b/src/devices/video/pc_vga_cirrus.cpp index 1d669e5d62a..a33eb1edf28 100644 --- a/src/devices/video/pc_vga_cirrus.cpp +++ b/src/devices/video/pc_vga_cirrus.cpp @@ -22,8 +22,9 @@ #define LOG_BLIT (1U << 2) #define LOG_HDAC (1U << 3) // log hidden DAC #define LOG_BANK (1U << 4) // log offset registers +#define LOG_PLL (1U << 5) -#define VERBOSE (LOG_GENERAL | LOG_HDAC | LOG_REG) +#define VERBOSE (LOG_GENERAL | LOG_HDAC | LOG_REG | LOG_PLL) //#define LOG_OUTPUT_FUNC osd_printf_info #include "logmacro.h" @@ -101,7 +102,7 @@ void cirrus_gd5428_vga_device::ramdac_hidden_mask_w(offs_t offset, u8 data) // TODO: '5428 reads do not lock the Hidden DAC m_hidden_dac_mode = data; m_hidden_dac_phase = 0; - cirrus_define_video_mode(); + recompute_params(); LOGMASKED(LOG_HDAC, "CL: Hidden DAC write %02x\n", data); return; } @@ -182,7 +183,7 @@ void cirrus_gd5428_vga_device::crtc_map(address_map &map) NAME([this] (offs_t offset, u8 data) { vga.crtc.vert_blank_end &= ~0x00ff; vga.crtc.vert_blank_end |= data; - cirrus_define_video_mode(); + recompute_params(); }) ); map(0x19, 0x19).lrw8( @@ -203,7 +204,7 @@ void cirrus_gd5428_vga_device::crtc_map(address_map &map) m_cr1a = data; vga.crtc.horz_blank_end = (vga.crtc.horz_blank_end & 0xff3f) | ((data & 0x30) << 2); vga.crtc.vert_blank_end = (vga.crtc.vert_blank_end & 0xfcff) | ((data & 0xc0) << 2); - cirrus_define_video_mode(); + recompute_params(); }) ); map(0x1b, 0x1b).lrw8( @@ -217,7 +218,7 @@ void cirrus_gd5428_vga_device::crtc_map(address_map &map) vga.crtc.start_addr_latch |= ((data & 0x01) << 16); vga.crtc.start_addr_latch |= ((data & 0x0c) << 15); vga.crtc.offset = (vga.crtc.offset & 0x00ff) | ((data & 0x10) << 4); - cirrus_define_video_mode(); + recompute_params(); }) ); // map(0x25, 0x25) PSR Part Status (r/o, "factory testing and internal tracking only") @@ -513,7 +514,7 @@ void cirrus_gd5428_vga_device::sequencer_map(address_map &map) gc_locked = (data & 0x17) != 0x12; LOG("Cirrus register extensions %s\n", gc_locked ? "unlocked" : "locked"); m_lock_reg = data & 0x17; - cirrus_define_video_mode(); + recompute_params(); }) ); map(0x07, 0x07).lw8( @@ -522,7 +523,7 @@ void cirrus_gd5428_vga_device::sequencer_map(address_map &map) if((data & 0xf0) != 0) popmessage("pc_vga_cirrus: 1MB framebuffer window enabled at %iMB (%02x)",data >> 4,data); vga.sequencer.data[0x07] = data; - cirrus_define_video_mode(); + recompute_params(); }) ); // TODO: check me @@ -549,6 +550,7 @@ void cirrus_gd5428_vga_device::sequencer_map(address_map &map) }), NAME([this] (offs_t offset, u8 data) { m_vclk_num[offset] = data; + recompute_params(); }) ); map(0x0f, 0x0f).lrw8( @@ -616,6 +618,7 @@ void cirrus_gd5428_vga_device::sequencer_map(address_map &map) }), NAME([this] (offs_t offset, u8 data) { m_vclk_denom[offset] = data; + recompute_params(); }) ); } @@ -759,10 +762,11 @@ uint32_t cirrus_gd5428_vga_device::screen_update(screen_device &screen, bitmap_r return 0; } -void cirrus_gd5428_vga_device::cirrus_define_video_mode() +void cirrus_gd5428_vga_device::recompute_params() { uint8_t divisor = 1; float clock; + // TODO: coming from OSC, expose as this->clock() const XTAL xtal = XTAL(14'318'181); uint8_t clocksel = (vga.miscellaneous_output & 0xc) >> 2; @@ -774,6 +778,7 @@ void cirrus_gd5428_vga_device::cirrus_define_video_mode() int denominator = (m_vclk_denom[clocksel] & 0x3e) >> 1; int mul = m_vclk_denom[clocksel] & 0x01 ? 2 : 1; clock = (xtal * numerator / denominator / mul).dvalue(); + LOGMASKED(LOG_PLL, "CL: PLL setting %d num %d denom %d mul %d -> %f\n", clocksel, numerator, denominator, mul, clock); } svga.rgb8_en = svga.rgb15_en = svga.rgb16_en = svga.rgb24_en = svga.rgb32_en = 0; diff --git a/src/devices/video/pc_vga_cirrus.h b/src/devices/video/pc_vga_cirrus.h index 13c2053dbfa..b9ed9f225c8 100644 --- a/src/devices/video/pc_vga_cirrus.h +++ b/src/devices/video/pc_vga_cirrus.h @@ -97,9 +97,9 @@ protected: virtual bool get_interlace_mode() override { return BIT(m_cr1a, 0); } uint8_t offset_select(offs_t offset); + virtual void recompute_params() override; private: - void cirrus_define_video_mode(); void start_bitblt(); void start_reverse_bitblt(); -- cgit v1.2.3