From 0ecbe63a382d696817fe23d1bca2f282fc37da94 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Thu, 22 Jun 2023 00:54:38 +1000 Subject: -machine/68340.cpp, machine/scc68070.cpp: Don't mess with devcbs in device_start. -bfm/bfm_swp.cpp: Fixed ROM offset mask (it's words, not bytes). --- src/devices/machine/68340.cpp | 24 ++++++++++---- src/devices/machine/68340.h | 1 + src/devices/machine/scc68070.cpp | 72 +++++++++++++++++++++++----------------- src/devices/machine/scc68070.h | 1 + src/mame/bfm/bfm_swp.cpp | 2 +- 5 files changed, 61 insertions(+), 39 deletions(-) diff --git a/src/devices/machine/68340.cpp b/src/devices/machine/68340.cpp index eb836dd506e..84d0d698d6a 100644 --- a/src/devices/machine/68340.cpp +++ b/src/devices/machine/68340.cpp @@ -256,8 +256,6 @@ void m68340_cpu_device::set_modck(int state) void m68340_cpu_device::device_start() { - reset_cb().append(*this, FUNC(m68340_cpu_device::reset_peripherals)); - fscpu32_device::device_start(); m_m68340SIM = new m68340_sim(); @@ -273,11 +271,23 @@ void m68340_cpu_device::device_start() m_internal = &space(AS_PROGRAM); } + +void m68340_cpu_device::device_config_complete() +{ + fscpu32_device::device_config_complete(); + + reset_cb().append(*this, FUNC(m68340_cpu_device::reset_peripherals)); +} + + void m68340_cpu_device::reset_peripherals(int state) { - m_m68340SIM->module_reset(); - m_m68340DMA->module_reset(); - m_serial->module_reset(); - m_timer[0]->module_reset(); - m_timer[1]->module_reset(); + if (state) + { + m_m68340SIM->module_reset(); + m_m68340DMA->module_reset(); + m_serial->module_reset(); + m_timer[0]->module_reset(); + m_timer[1]->module_reset(); + } } diff --git a/src/devices/machine/68340.h b/src/devices/machine/68340.h index 4965066548f..848cb7d3832 100644 --- a/src/devices/machine/68340.h +++ b/src/devices/machine/68340.h @@ -46,6 +46,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; virtual void device_add_mconfig(machine_config &config) override; + virtual void device_config_complete() override; void reset_peripherals(int state); diff --git a/src/devices/machine/scc68070.cpp b/src/devices/machine/scc68070.cpp index 665ecd16979..070d82f82d1 100644 --- a/src/devices/machine/scc68070.cpp +++ b/src/devices/machine/scc68070.cpp @@ -266,8 +266,6 @@ scc68070_device::scc68070_device(const machine_config &mconfig, const char *tag, void scc68070_device::device_start() { - reset_cb().append(*this, FUNC(scc68070_device::reset_peripherals)); - scc68070_base_device::device_start(); save_item(NAME(m_ipl)); @@ -429,43 +427,55 @@ void scc68070_device::device_reset() set_timer_callback(0); } + +void scc68070_device::device_config_complete() +{ + scc68070_base_device::device_config_complete(); + + reset_cb().append(*this, FUNC(scc68070_device::reset_peripherals)); +} + + void scc68070_device::reset_peripherals(int state) { - m_lir = 0; + if (state) + { + m_lir = 0; - m_picr1 = 0; - m_picr2 = 0; - m_timer_int = false; - m_i2c_int = false; - m_uart_rx_int = false; - m_uart_tx_int = false; + m_picr1 = 0; + m_picr2 = 0; + m_timer_int = false; + m_i2c_int = false; + m_uart_rx_int = false; + m_uart_tx_int = false; - m_i2c.status_register = ISR_PIN; - m_i2c.control_register = 0; - m_i2c.clock_control_register = 0; - m_i2c.scl_out_state = true; - m_i2c.scl_in_state = true; - m_i2c.sda_out_state = true; - m_i2c.state = I2C_IDLE; - m_i2c.clock_change_state = I2C_SCL_IDLE; - m_i2c.clocks = 0; - m_uart.command_register = 0; - m_uart.receive_pointer = -1; - m_uart.transmit_pointer = -1; + m_i2c.status_register = ISR_PIN; + m_i2c.control_register = 0; + m_i2c.clock_control_register = 0; + m_i2c.scl_out_state = true; + m_i2c.scl_in_state = true; + m_i2c.sda_out_state = true; + m_i2c.state = I2C_IDLE; + m_i2c.clock_change_state = I2C_SCL_IDLE; + m_i2c.clocks = 0; + m_uart.command_register = 0; + m_uart.receive_pointer = -1; + m_uart.transmit_pointer = -1; - m_uart.mode_register = 0; - m_uart.status_register = USR_TXRDY; - m_uart.clock_select = 0; + m_uart.mode_register = 0; + m_uart.status_register = USR_TXRDY; + m_uart.clock_select = 0; - m_timers.timer_status_register = 0; - m_timers.timer_control_register = 0; + m_timers.timer_status_register = 0; + m_timers.timer_control_register = 0; - m_uart.rx_timer->adjust(attotime::never); - m_uart.tx_timer->adjust(attotime::never); - m_timers.timer0_timer->adjust(attotime::never); - m_i2c.timer->adjust(attotime::never); + m_uart.rx_timer->adjust(attotime::never); + m_uart.tx_timer->adjust(attotime::never); + m_timers.timer0_timer->adjust(attotime::never); + m_i2c.timer->adjust(attotime::never); - update_ipl(); + update_ipl(); + } } void scc68070_device::update_ipl() diff --git a/src/devices/machine/scc68070.h b/src/devices/machine/scc68070.h index a10f37b1890..c0240163e55 100644 --- a/src/devices/machine/scc68070.h +++ b/src/devices/machine/scc68070.h @@ -193,6 +193,7 @@ protected: // device_t implementation virtual void device_start() override; virtual void device_reset() override; + virtual void device_config_complete() override; // device_execute_interface implementation virtual u64 execute_clocks_to_cycles(u64 clocks) const noexcept override { return (clocks + 2 - 1) / 2; } diff --git a/src/mame/bfm/bfm_swp.cpp b/src/mame/bfm/bfm_swp.cpp index 3a67fbf9c4b..67cdbbbeeca 100644 --- a/src/mame/bfm/bfm_swp.cpp +++ b/src/mame/bfm/bfm_swp.cpp @@ -149,7 +149,7 @@ uint16_t bfm_swp_state::bfm_swp_mem_r(offs_t offset, uint16_t mem_mask) switch ( cs ) { case 1: - return m_cpuregion[offset & 0xfffff]; + return m_cpuregion[offset & 0x7ffff]; case 2: return m_mainram[offset & 0x1fff]; -- cgit v1.2.3