From 1b0163f8d2cae5fe9ce8e9849b418a2ed68d96b6 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Sat, 12 Nov 2022 11:51:19 +0100 Subject: [PATCH] mview: Don't forget to select the correct page when installing handlers, especially dynamically. --- src/devices/bus/msx_slot/disk.cpp | 13 +------------ src/emu/emumem_mview.cpp | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/devices/bus/msx_slot/disk.cpp b/src/devices/bus/msx_slot/disk.cpp index ddb3ee4f444..623a1a36274 100644 --- a/src/devices/bus/msx_slot/disk.cpp +++ b/src/devices/bus/msx_slot/disk.cpp @@ -172,8 +172,6 @@ void msx_slot_disk1_base_device::device_start() if (page_configured(2)) { - // TODO No idea why, but without this the other handlers do not get recognized - page(2)->install_rom(0xbff8,0xbff8, rom_base()); page(2)->install_read_handler(0xbff8, 0xbff8, read8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::status_r))); page(2)->install_read_handler(0xbff9, 0xbff9, read8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::track_r))); page(2)->install_read_handler(0xbffa, 0xbffa, read8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::sector_r))); @@ -380,8 +378,6 @@ void msx_slot_disk2_base_device::device_start() page(1)->install_write_handler(0x7fbb, 0x7fbb, write8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::data_w))); page(1)->install_write_handler(0x7fbc, 0x7fbc, write8smo_delegate(*this, FUNC(msx_slot_disk2_base_device::set_control))); - // TODO No idea why, but without this the other handlers do not get recognized - page(2)->install_rom(0xbfb8,0xbfb8, rom_base()); page(2)->install_read_handler(0xbfb8, 0xbfb8, read8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::status_r))); page(2)->install_read_handler(0xbfb9, 0xbfb9, read8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::track_r))); page(2)->install_read_handler(0xbfba, 0xbfba, read8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::sector_r))); @@ -538,8 +534,7 @@ void msx_slot_disk3_tc8566_device::device_start() page(1)->install_write_handler(0x7ff8, 0x7ff8, write8smo_delegate(*m_fdc, FUNC(tc8566af_device::dor_w))); page(1)->install_write_handler(0x7ff9, 0x7ff9, write8smo_delegate(*m_fdc, FUNC(tc8566af_device::cr1_w))); page(1)->install_write_handler(0x7ffb, 0x7ffb, write8smo_delegate(*m_fdc, FUNC(tc8566af_device::fifo_w))); - // TODO No idea why, but without this the other handlers do not get recognized - page(2)->install_rom(0xbffa,0xbffa, rom_base()); + page(2)->install_read_handler(0xbffa, 0xbffa, read8smo_delegate(*m_fdc, FUNC(tc8566af_device::msr_r))); page(2)->install_read_handler(0xbffb, 0xbffb, read8smo_delegate(*m_fdc, FUNC(tc8566af_device::fifo_r))); page(2)->install_write_handler(0xbff8, 0xbff8, write8smo_delegate(*m_fdc, FUNC(tc8566af_device::dor_w))); @@ -835,8 +830,6 @@ void msx_slot_disk7_mb8877_device::device_start() page(1)->install_write_handler(0x7ffb, 0x7ffb, write8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::data_w))); page(1)->install_write_handler(0x7ffc, 0x7ffc, write8smo_delegate(*this, FUNC(msx_slot_disk7_mb8877_device::side_motor_w))); - // TODO No idea why, but without this the other handlers do not get recognized - page(2)->install_rom(0xbff8, 0xbff8, rom_base()); page(2)->install_read_handler(0xbff8, 0xbff8, read8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::status_r))); page(2)->install_read_handler(0xbff9, 0xbff9, read8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::track_r))); page(2)->install_read_handler(0xbffa, 0xbffa, read8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::sector_r))); @@ -942,8 +935,6 @@ void msx_slot_disk8_mb8877_device::device_start() page(1)->install_write_handler(0x7f83, 0x7f83, write8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::data_w))); page(1)->install_write_handler(0x7f84, 0x7f84, write8smo_delegate(*this, FUNC(msx_slot_disk8_mb8877_device::set_control))); - // TODO No idea why, but without this the other handlers do not get recognized - page(2)->install_rom(0xbf80,0xbf80, rom_base()); page(2)->install_read_handler(0xbf80, 0xbf80, read8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::status_r))); page(2)->install_read_handler(0xbf81, 0xbf81, read8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::track_r))); page(2)->install_read_handler(0xbf82, 0xbf82, read8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::sector_r))); @@ -1238,8 +1229,6 @@ void msx_slot_disk11_wd2793_device::device_start() page(1)->install_write_handler(0x7ffc, 0x7ffc, write8smo_delegate(*this, FUNC(msx_slot_disk11_wd2793_device::side_control_w))); page(1)->install_write_handler(0x7ffd, 0x7ffd, write8smo_delegate(*this, FUNC(msx_slot_disk11_wd2793_device::control_w))); - // TODO No idea why, but without this the other handlers do not get recognized - page(2)->install_rom(0xbff8, 0xbff8, rom_base()); page(2)->install_read_handler(0xbff8, 0xbff8, read8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::status_r))); page(2)->install_read_handler(0xbff9, 0xbff9, read8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::track_r))); page(2)->install_read_handler(0xbffa, 0xbffa, read8smo_delegate(*m_fdc, FUNC(wd_fdc_analog_device_base::sector_r))); diff --git a/src/emu/emumem_mview.cpp b/src/emu/emumem_mview.cpp index becf9fcf7d8..9fc7a0e0f6e 100644 --- a/src/emu/emumem_mview.cpp +++ b/src/emu/emumem_mview.cpp @@ -339,6 +339,9 @@ public: 8 << Width, 8 << AccessWidth, handler_r.name(), data_width() / 4, unitmask); + r()->select_u(m_id); + w()->select_u(m_id); + offs_t nstart, nend, nmask, nmirror; u64 nunitmask; int ncswidth; @@ -372,6 +375,9 @@ public: 8 << Width, 8 << AccessWidth, handler_w.name(), data_width() / 4, unitmask); + r()->select_u(m_id); + w()->select_u(m_id); + offs_t nstart, nend, nmask, nmirror; u64 nunitmask; int ncswidth; @@ -406,6 +412,9 @@ public: 8 << Width, 8 << AccessWidth, handler_r.name(), handler_w.name(), data_width() / 4, unitmask); + r()->select_u(m_id); + w()->select_u(m_id); + offs_t nstart, nend, nmask, nmirror; u64 nunitmask; int ncswidth; @@ -484,10 +493,6 @@ memory_view::memory_view_entry &memory_view::operator[](int slot) m_entries.resize(id+1); m_entries[id].reset(e); m_entry_mapping[slot] = id; - if (m_handler_read) { - m_handler_read->select_u(id); - m_handler_write->select_u(id); - } return *e; } else @@ -959,6 +964,10 @@ template memory_passthrough_handler memory_ template void memory_view_entry_specific::install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_constructor &delegate, u64 unitmask, int cswidth, u16 flags) { check_range_address("install_device_delegate", addrstart, addrend); + + r()->select_u(m_id); + w()->select_u(m_id); + address_map map(*m_view.m_space, addrstart, addrend, unitmask, cswidth, flags, m_view.m_device, delegate); map.import_submaps(m_manager.machine(), device, data_width(), endianness(), addr_shift()); prepare_device_map(map);