Skip to content

Commit

Permalink
taitosj: add the other mode for MCU interrupts (not used by anything …
Browse files Browse the repository at this point in the history
…yet)
  • Loading branch information
cuavas committed Jun 21, 2017
1 parent a716e67 commit 0422077
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/mame/drivers/taitosj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
18 changes: 9 additions & 9 deletions src/mame/machine/taito68705interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ DECLARE_DEVICE_TYPE(ARKANOID_68705P5, arkanoid_68705p5_device)
class taito68705_mcu_device_base : public device_t
{
public:
template <typename Obj> static devcb_base &set_semaphore_cb(device_t &device, Obj &&object)
{ return downcast<taito68705_mcu_device_base &>(device).m_semaphore_cb.set_callback(std::forward<Obj>(object)); }
template <typename Obj> static devcb_base &set_semaphore_cb(device_t &device, Obj &&cb)
{ return downcast<taito68705_mcu_device_base &>(device).m_semaphore_cb.set_callback(std::forward<Obj>(cb)); }

// host interface
DECLARE_READ8_MEMBER(data_r);
Expand Down Expand Up @@ -64,13 +64,13 @@ class taito68705_mcu_device_base : public device_t


#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 <typename Obj> static devcb_base &set_aux_strobe_cb(device_t &device, Obj &&object)
{ return downcast<taito68705_mcu_device &>(device).m_aux_strobe_cb.set_callback(std::forward<Obj>(object)); }
template <typename Obj> static devcb_base &set_aux_strobe_cb(device_t &device, Obj &&cb)
{ return downcast<taito68705_mcu_device &>(device).m_aux_strobe_cb.set_callback(std::forward<Obj>(cb)); }

taito68705_mcu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

Expand Down Expand Up @@ -100,16 +100,16 @@ class taito68705_mcu_tiger_device : public taito68705_mcu_device


#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 <typename Obj> static devcb_base &set_portb_r_cb(device_t &device, Obj &&object)
{ return downcast<arkanoid_mcu_device_base &>(device).m_portb_r_cb.set_callback(std::forward<Obj>(object)); }
template <typename Obj> static devcb_base &set_portb_r_cb(device_t &device, Obj &&cb)
{ return downcast<arkanoid_mcu_device_base &>(device).m_portb_r_cb.set_callback(std::forward<Obj>(cb)); }

protected:
arkanoid_mcu_device_base(
Expand Down
19 changes: 13 additions & 6 deletions src/mame/machine/taitosjsec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
{
Expand All @@ -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);
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}
15 changes: 12 additions & 3 deletions src/mame/machine/taitosjsec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand All @@ -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<taito_sj_security_mcu_device &>(device).m_int_mode = mode; }
template <typename Obj> static devcb_base &set_68read_cb(device_t &device, Obj &&cb)
{ return downcast<taito_sj_security_mcu_device &>(device).m_68read_cb.set_callback(std::forward<Obj>(cb)); }
template <typename Obj> static devcb_base &set_68write_cb(device_t &device, Obj &&cb)
Expand Down Expand Up @@ -67,6 +75,7 @@ class taito_sj_security_mcu_device : public device_t

required_device<m68705p_device> m_mcu;

int_mode m_int_mode;
devcb_read8 m_68read_cb;
devcb_write8 m_68write_cb;
devcb_write_line m_68intrq_cb;
Expand Down

0 comments on commit 0422077

Please sign in to comment.