From bccdfc9e04da57ed59fa749dd53465e5a2330508 Mon Sep 17 00:00:00 2001 From: angelosa Date: Sun, 3 Nov 2024 22:42:25 +0100 Subject: [PATCH] nec/pc9821.cpp: fix refresh rate regression --- src/mame/nec/pc9821.cpp | 24 ++++++++++++++++++++++++ src/mame/nec/pc9821.h | 1 + 2 files changed, 25 insertions(+) diff --git a/src/mame/nec/pc9821.cpp b/src/mame/nec/pc9821.cpp index 672669dd5fc..17b549fa1df 100644 --- a/src/mame/nec/pc9821.cpp +++ b/src/mame/nec/pc9821.cpp @@ -329,6 +329,27 @@ void pc9821_state::pc9821_grcg_gvram0_w(offs_t offset, uint16_t data, uint16_t m grcg_gvram0_w(offset,data,mem_mask); } +void pc9821_state::pc9821_mode_ff_w(u8 data) +{ + const u8 mode_ff = data & 0xfe; + const u8 setting = BIT(data, 0); + // Monitor setting + // BA / BX / PC-H98 / PC-9821 / 98NOTE uses this f/f in place of 15/24 kHz switch + // TODO: better compose + if (mode_ff == 0x20) + { + if (!setting) + { + const XTAL screen_clock = XTAL(21'052'600) / 8; + + m_hgdc[0]->set_unscaled_clock(screen_clock); + m_hgdc[1]->set_unscaled_clock(screen_clock); + } + else + popmessage("pc9821_mode_ff_w: 31 kHz mode selected"); + } +} + void pc9821_state::pc9821_map(address_map &map) { pc9801bx2_map(map); @@ -359,6 +380,8 @@ void pc9821_state::pc9821_io(address_map &map) // map(0x0060, 0x0063).r(FUNC(pc9821_state::unk_r)).umask32(0xff00ff00); // mouse related (unmapped checking for AT keyb controller\PS/2 mouse?) // map(0x0064, 0x0064).w(FUNC(pc9821_state::vrtc_clear_w)); map(0x0068, 0x006b).w(FUNC(pc9821_state::pc9821_video_ff_w)).umask32(0x00ff00ff); //mode FF / + map(0x006c, 0x006d).w(FUNC(pc9821_state::border_color_w)).umask16(0x00ff); + map(0x006e, 0x006f).w(FUNC(pc9821_state::pc9821_mode_ff_w)).umask16(0x00ff); // map(0x0070, 0x007f).rw(m_pit, FUNC(pit8253_device::read), FUNC(pit8253_device::write)).umask32(0xff00ff00); // map(0x0070, 0x007f).rw(FUNC(pc9821_state::grcg_r), FUNC(pc9821_state::grcg_w)).umask32(0x00ff00ff); //display registers "GRCG" / i8253 pit map(0x0090, 0x0093).m(m_fdc_2hd, FUNC(upd765a_device::map)).umask32(0x00ff00ff); @@ -392,6 +415,7 @@ void pc9821_state::pc9821_io(address_map &map) // map(0x0c24, 0x0c24) cs4231 PCM board register control // map(0x0c2b, 0x0c2b) cs4231 PCM board low byte control // map(0x0c2d, 0x0c2d) cs4231 PCM board hi byte control + map(0x0ca0, 0x0ca0).lr8(NAME([] () { return 0xff; })); // high reso detection // map(0x0cc0, 0x0cc7) SCSI interface / // map(0x0cfc, 0x0cff) PCI bus map(0x1e8c, 0x1e8f).noprw(); // IDE RAM switch diff --git a/src/mame/nec/pc9821.h b/src/mame/nec/pc9821.h index 6c1b334ff14..f45d0360c33 100644 --- a/src/mame/nec/pc9821.h +++ b/src/mame/nec/pc9821.h @@ -47,6 +47,7 @@ private: void window_bank_w(offs_t offset, uint8_t data); uint8_t ext2_video_ff_r(); void ext2_video_ff_w(uint8_t data); + void pc9821_mode_ff_w(u8 data); uint8_t m_pc9821_window_bank = 0; uint8_t m_ext2_ff = 0;