From 35e781022fe54a2ad88ca276e2acaebfcb8748b6 Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 15 Apr 2019 19:04:02 -0400 Subject: m68705: Use NVI for internal map to prevent segmentation fault (nw) --- src/devices/cpu/m6805/m68705.cpp | 32 ++++++++++++++++---------------- src/devices/cpu/m6805/m68705.h | 17 +++++++++-------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/devices/cpu/m6805/m68705.cpp b/src/devices/cpu/m6805/m68705.cpp index 1b2e043b86b..fbac7b282fe 100644 --- a/src/devices/cpu/m6805/m68705.cpp +++ b/src/devices/cpu/m6805/m68705.cpp @@ -584,9 +584,9 @@ template void m6805_hmos_device::add_port_ddr_state() state_add(M68705_DDRA + N, util::string_format("DDR%c", 'A' + N).c_str(), m_port_ddr[N]).mask(~m_port_mask[N] & 0xff); } -void m68705_device::map(address_map &map) +void m68705_device::internal_map(address_map &map) { - m6805_hmos_device::map(map); + m6805_hmos_device::internal_map(map); map(0x000b, 0x000b).rw(FUNC(m68705_device::pcr_r), FUNC(m68705_device::pcr_w)); } @@ -595,9 +595,9 @@ void m68705_device::map(address_map &map) * M68705Px family ****************************************************************************/ -void m68705p_device::map(address_map &map) +void m68705p_device::internal_map(address_map &map) { - m68705_device::map(map); + m68705_device::internal_map(map); map(0x0080, 0x0784).rw(FUNC(m68705p_device::eprom_r<0x0080>), FUNC(m68705p_device::eprom_w<0x0080>)); // User EPROM map(0x0785, 0x07f7).rom().region("bootstrap", 0); @@ -629,9 +629,9 @@ std::unique_ptr m68705p_device::create_disassembler() * M68705Ux family ****************************************************************************/ -void m68705u_device::map(address_map &map) +void m68705u_device::internal_map(address_map &map) { - m68705_device::map(map); + m68705_device::internal_map(map); map(0x0080, 0x0f38).rw(FUNC(m68705u_device::eprom_r<0x0080>), FUNC(m68705u_device::eprom_w<0x0080>)); // User EPROM // 0x0f39-0x0f7f not used @@ -662,9 +662,9 @@ std::unique_ptr m68705u_device::create_disassembler() * M68705Rx family ****************************************************************************/ -void m68705r_device::map(address_map &map) +void m68705r_device::internal_map(address_map &map) { - m68705_device::map(map); + m68705_device::internal_map(map); map(0x000e, 0x000e).rw(FUNC(m68705r_device::acr_r), FUNC(m68705r_device::acr_w)); map(0x000f, 0x000f).rw(FUNC(m68705r_device::arr_r), FUNC(m68705r_device::arr_w)); @@ -814,7 +814,7 @@ m6805u3_device::m6805u3_device(machine_config const &mconfig, char const *tag, d m_timer.set_options(m6805_timer::TIMER_PGM); } -void m6805_hmos_device::map(address_map &map) +void m6805_hmos_device::internal_map(address_map &map) { map.unmap_value_high(); @@ -833,15 +833,15 @@ void m6805_hmos_device::map(address_map &map) if (m_port_mask[3] != 0xff) { map(0x0003, 0x0003).rw(FUNC(m6805_hmos_device::port_r<3>), FUNC(m6805_hmos_device::port_latch_w<3>)); - map(0x000a, 0x000a).rw(FUNC(m6805u3_device::misc_r), FUNC(m6805u3_device::misc_w)); + map(0x000a, 0x000a).rw(FUNC(m6805_hmos_device::misc_r), FUNC(m6805_hmos_device::misc_w)); } map(0x80 - m_ram_size, 0x007f).ram(); } -void m6805_mrom_device::map(address_map &map) +void m6805_mrom_device::internal_map(address_map &map) { - m6805_hmos_device::map(map); + m6805_hmos_device::internal_map(map); /* * Mask ROM devices have address ranges defined as follows: @@ -865,17 +865,17 @@ void m6805_mrom_device::map(address_map &map) map(0x0080, end).rom().region(tag(), 0x80); } -void m6805r2_device::map(address_map &map) +void m6805r2_device::internal_map(address_map &map) { - m6805_hmos_device::map(map); + m6805_hmos_device::internal_map(map); map(0x000e, 0x000e).rw(FUNC(m6805r2_device::acr_r), FUNC(m6805r2_device::acr_w)); map(0x000f, 0x000f).rw(FUNC(m6805r2_device::arr_r), FUNC(m6805r2_device::arr_w)); } -void m6805r3_device::map(address_map &map) +void m6805r3_device::internal_map(address_map &map) { - m6805_hmos_device::map(map); + m6805_hmos_device::internal_map(map); map(0x000e, 0x000e).rw(FUNC(m6805r3_device::acr_r), FUNC(m6805r3_device::acr_w)); map(0x000f, 0x000f).rw(FUNC(m6805r3_device::arr_r), FUNC(m6805r3_device::arr_w)); diff --git a/src/devices/cpu/m6805/m68705.h b/src/devices/cpu/m6805/m68705.h index ca4689e0214..ba3dc1645fc 100644 --- a/src/devices/cpu/m6805/m68705.h +++ b/src/devices/cpu/m6805/m68705.h @@ -162,7 +162,8 @@ protected: m6805_hmos_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock, device_type type, u32 addr_width, unsigned ram_size); - virtual void map(address_map &map); + void map(address_map &map) { internal_map(map); } + virtual void internal_map(address_map &map); template void set_port_open_drain(bool value); template void set_port_mask(u8 mask); @@ -225,7 +226,7 @@ protected: { } - virtual void map(address_map &map) override; + virtual void internal_map(address_map &map) override; }; class m68705_device : public m6805_hmos_device, public device_nvram_interface @@ -241,7 +242,7 @@ public: }; protected: - virtual void map(address_map &map) override; + virtual void internal_map(address_map &map) override; m68705_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock, device_type type, u32 addr_width, unsigned ram_size); @@ -283,7 +284,7 @@ public: DECLARE_WRITE8_MEMBER(pc_w) { port_input_w<2>(space, offset, data, mem_mask); } protected: - virtual void map(address_map &map) override; + virtual void internal_map(address_map &map) override; m68705p_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock, device_type type); @@ -301,7 +302,7 @@ public: DECLARE_WRITE8_MEMBER(pd_w) { port_input_w<3>(space, offset, data, mem_mask); } // TODO: PD6 is also /INT2 protected: - virtual void map(address_map &map) override; + virtual void internal_map(address_map &map) override; m68705u_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock, device_type type); @@ -316,7 +317,7 @@ public: // TODO: voltage inputs for ADC (shared with digital port D pins) protected: - virtual void map(address_map &map) override; + virtual void internal_map(address_map &map) override; m68705r_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock, device_type type); @@ -344,7 +345,7 @@ public: m6805r2_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); protected: - virtual void map(address_map &map) override; + virtual void internal_map(address_map &map) override; }; class m6805r3_device : public m6805_mrom_device @@ -353,7 +354,7 @@ public: m6805r3_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); protected: - virtual void map(address_map &map) override; + virtual void internal_map(address_map &map) override; }; class m6805u2_device : public m6805_mrom_device -- cgit v1.2.3