From 0422077dbd519b1b7a52ff6a5f92c4e16f23e9bb Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Wed, 21 Jun 2017 23:50:40 +1000 Subject: taitosj: add the other mode for MCU interrupts (not used by anything yet) --- src/mame/drivers/taitosj.cpp | 1 + src/mame/machine/taito68705interface.h | 18 +++++++++--------- src/mame/machine/taitosjsec.cpp | 19 +++++++++++++------ src/mame/machine/taitosjsec.h | 15 ++++++++++++--- 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/src/mame/drivers/taitosj.cpp b/src/mame/drivers/taitosj.cpp index 004a1a4ec4b..b29e3dd5d3c 100644 --- a/src/mame/drivers/taitosj.cpp +++ b/src/mame/drivers/taitosj.cpp @@ -1814,6 +1814,7 @@ static MACHINE_CONFIG_DERIVED( mcu, nomcu ) MCFG_CPU_PROGRAM_MAP(taitosj_main_mcu_map) MCFG_CPU_ADD("bmcu", TAITO_SJ_SECURITY_MCU, XTAL_3MHz) /* xtal is 3MHz, divided by 4 internally */ + MCFG_TAITO_SJ_SECURITY_MCU_INT_MODE(LATCH) MCFG_TAITO_SJ_SECURITY_MCU_68READ_CB(READ8(taitosj_state, mcu_mem_r)) MCFG_TAITO_SJ_SECURITY_MCU_68WRITE_CB(WRITE8(taitosj_state, mcu_mem_w)) MCFG_TAITO_SJ_SECURITY_MCU_68INTRQ_CB(WRITELINE(taitosj_state, mcu_intrq_w)) diff --git a/src/mame/machine/taito68705interface.h b/src/mame/machine/taito68705interface.h index c806ffae13a..7d7365bc8bd 100644 --- a/src/mame/machine/taito68705interface.h +++ b/src/mame/machine/taito68705interface.h @@ -17,8 +17,8 @@ DECLARE_DEVICE_TYPE(ARKANOID_68705P5, arkanoid_68705p5_device) class taito68705_mcu_device_base : public device_t { public: - template static devcb_base &set_semaphore_cb(device_t &device, Obj &&object) - { return downcast(device).m_semaphore_cb.set_callback(std::forward(object)); } + template static devcb_base &set_semaphore_cb(device_t &device, Obj &&cb) + { return downcast(device).m_semaphore_cb.set_callback(std::forward(cb)); } // host interface DECLARE_READ8_MEMBER(data_r); @@ -64,13 +64,13 @@ private: #define MCFG_TAITO_M68705_AUX_STROBE_CB(cb) \ - taito68705_mcu_device::set_aux_strobe_cb(*device, DEVCB_##cb); + devcb = &taito68705_mcu_device::set_aux_strobe_cb(*device, DEVCB_##cb); class taito68705_mcu_device : public taito68705_mcu_device_base { public: - template static devcb_base &set_aux_strobe_cb(device_t &device, Obj &&object) - { return downcast(device).m_aux_strobe_cb.set_callback(std::forward(object)); } + template static devcb_base &set_aux_strobe_cb(device_t &device, Obj &&cb) + { return downcast(device).m_aux_strobe_cb.set_callback(std::forward(cb)); } taito68705_mcu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); @@ -100,16 +100,16 @@ protected: #define MCFG_ARKANOID_MCU_SEMAPHORE_CB(cb) \ - arkanoid_mcu_device_base::set_semaphore_cb(*device, DEVCB_##cb); + devcb = &arkanoid_mcu_device_base::set_semaphore_cb(*device, DEVCB_##cb); #define MCFG_ARKANOID_MCU_PORTB_R_CB(cb) \ - arkanoid_mcu_device_base::set_portb_r_cb(*device, DEVCB_##cb); + devcb = &arkanoid_mcu_device_base::set_portb_r_cb(*device, DEVCB_##cb); class arkanoid_mcu_device_base : public taito68705_mcu_device_base { public: - template static devcb_base &set_portb_r_cb(device_t &device, Obj &&object) - { return downcast(device).m_portb_r_cb.set_callback(std::forward(object)); } + template static devcb_base &set_portb_r_cb(device_t &device, Obj &&cb) + { return downcast(device).m_portb_r_cb.set_callback(std::forward(cb)); } protected: arkanoid_mcu_device_base( diff --git a/src/mame/machine/taitosjsec.cpp b/src/mame/machine/taitosjsec.cpp index bb077be0d20..c2dbd5b0ae0 100644 --- a/src/mame/machine/taitosjsec.cpp +++ b/src/mame/machine/taitosjsec.cpp @@ -13,6 +13,7 @@ taito_sj_security_mcu_device::taito_sj_security_mcu_device( u32 clock) : device_t(mconfig,TAITO_SJ_SECURITY_MCU, tag, owner, clock) , m_mcu(*this, "mcu") + , m_int_mode(int_mode::NONE) , m_68read_cb(*this) , m_68write_cb(*this) , m_68intrq_cb(*this) @@ -54,7 +55,10 @@ WRITE8_MEMBER(taito_sj_security_mcu_device::data_w) if (BIT(offset, 0)) { // ZINTRQ - // FIXME: this can be jumpered to /INT on the MCU + // if jumpered this way, the Z80 write strobe pulses the MCU interrupt line + // should be PULSE_LINE because it's edge sensitive, but diexec only allows PULSE_LINE on reset and NMI + if (int_mode::WRITE == m_int_mode) + m_mcu->set_input_line(M68705_IRQ_LINE, HOLD_LINE); } else { @@ -77,7 +81,8 @@ WRITE_LINE_MEMBER(taito_sj_security_mcu_device::reset_w) { m_zaccept = true; m_zready = false; - m_mcu->set_input_line(M68705_IRQ_LINE, CLEAR_LINE); + if (int_mode::LATCH == m_int_mode) + m_mcu->set_input_line(M68705_IRQ_LINE, CLEAR_LINE); } m_mcu->set_input_line(INPUT_LINE_RESET, state); } @@ -112,7 +117,8 @@ void taito_sj_security_mcu_device::device_reset() { m_zaccept = true; m_zready = false; - m_mcu->set_input_line(M68705_IRQ_LINE, CLEAR_LINE); + if (int_mode::LATCH == m_int_mode) + m_mcu->set_input_line(M68705_IRQ_LINE, CLEAR_LINE); } MACHINE_CONFIG_MEMBER(taito_sj_security_mcu_device::device_add_mconfig) @@ -158,7 +164,8 @@ WRITE8_MEMBER(taito_sj_security_mcu_device::mcu_pb_w) if (BIT(diff & data, 1)) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(taito_sj_security_mcu_device::do_mcu_read), this)); - m_mcu->set_input_line(M68705_IRQ_LINE, CLEAR_LINE); + if (int_mode::LATCH == m_int_mode) + m_mcu->set_input_line(M68705_IRQ_LINE, CLEAR_LINE); } // 68LWR @@ -218,7 +225,7 @@ TIMER_CALLBACK_MEMBER(taito_sj_security_mcu_device::do_host_write) if (!m_reset) { m_zready = true; - // FIXME: this can be jumpered off if ZINTRQ is being used - m_mcu->set_input_line(M68705_IRQ_LINE, ASSERT_LINE); + if (int_mode::LATCH == m_int_mode) + m_mcu->set_input_line(M68705_IRQ_LINE, ASSERT_LINE); } } diff --git a/src/mame/machine/taitosjsec.h b/src/mame/machine/taitosjsec.h index 2835459bf7f..98132067428 100644 --- a/src/mame/machine/taitosjsec.h +++ b/src/mame/machine/taitosjsec.h @@ -7,12 +7,11 @@ #include "cpu/m6805/m68705.h" -// TODO: there should be a device representing the whole security board with both the Z80 and 68705 - DECLARE_DEVICE_TYPE(TAITO_SJ_SECURITY_MCU, taito_sj_security_mcu_device) - +#define MCFG_TAITO_SJ_SECURITY_MCU_INT_MODE(mode) \ + taito_sj_security_mcu_device::set_int_mode(*device, taito_sj_security_mcu_device::int_mode::mode); #define MCFG_TAITO_SJ_SECURITY_MCU_68READ_CB(cb) \ devcb = &taito_sj_security_mcu_device::set_68read_cb(*device, DEVCB_##cb); #define MCFG_TAITO_SJ_SECURITY_MCU_68WRITE_CB(cb) \ @@ -25,6 +24,15 @@ DECLARE_DEVICE_TYPE(TAITO_SJ_SECURITY_MCU, taito_sj_security_mcu_device) class taito_sj_security_mcu_device : public device_t { public: + enum class int_mode + { + NONE, + LATCH, + WRITE + }; + + static void set_int_mode(device_t &device, int_mode mode) + { downcast(device).m_int_mode = mode; } template static devcb_base &set_68read_cb(device_t &device, Obj &&cb) { return downcast(device).m_68read_cb.set_callback(std::forward(cb)); } template static devcb_base &set_68write_cb(device_t &device, Obj &&cb) @@ -67,6 +75,7 @@ private: required_device m_mcu; + int_mode m_int_mode; devcb_read8 m_68read_cb; devcb_write8 m_68write_cb; devcb_write_line m_68intrq_cb; -- cgit v1.2.3