summaryrefslogtreecommitdiffstats
path: root/src/mame/machine/tigeroad.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2017-01-16 18:35:32 +1100
committer Vas Crabb <vas@vastheman.com>2017-01-16 23:12:44 +1100
commit5ae669c1958dc1d56e2700ca43438fa7513b6f6d (patch)
treef33a981920197f16ee8b654d18e176c124fbb8a5 /src/mame/machine/tigeroad.cpp
parent650ca8b573ecbf408c837eeb91f6cbe3ac07e34e (diff)
tstrike, ddungeon, darktowr: use new MC68705P3 core
tigeroad.cpp: cleanup and modernisation * split out bballs and pushman state classes * use new MC68705R3 core for pushman (this one uses port D - another test case) * make pushman MCU hookup believable (internal registers can't be in shared RAM) * use derived memory maps rather than installing handlers in init members
Diffstat (limited to 'src/mame/machine/tigeroad.cpp')
-rw-r--r--src/mame/machine/tigeroad.cpp88
1 files changed, 52 insertions, 36 deletions
diff --git a/src/mame/machine/tigeroad.cpp b/src/mame/machine/tigeroad.cpp
index d19b4e11dba..92b0dbdb6fd 100644
--- a/src/mame/machine/tigeroad.cpp
+++ b/src/mame/machine/tigeroad.cpp
@@ -124,39 +124,71 @@ WRITE16_MEMBER(tigeroad_state::f1dream_control_w)
}
-READ16_MEMBER(tigeroad_state::pushman_68705_r)
+READ16_MEMBER(pushman_state::mcu_data_r)
{
- if (offset == 0)
- return m_latch;
+ return m_mcu_latch;
+}
- if (offset == 3 && m_new_latch)
+READ16_MEMBER(pushman_state::mcu_ack_r)
+{
+ if (m_mcu_semaphore)
{
- m_new_latch = 0;
- return 0;
+ m_mcu_semaphore = false;
+ return 0x0000;
}
- if (offset == 3 && !m_new_latch)
- return 0xff;
+ else
+ {
+ return 0x00ff;
+ }
+}
- return (m_shared_ram[2 * offset + 1] << 8) + m_shared_ram[2 * offset];
+WRITE16_MEMBER(pushman_state::mcu_data_w)
+{
+ COMBINE_DATA(&m_host_latch);
}
-WRITE16_MEMBER(tigeroad_state::pushman_68705_w)
+WRITE16_MEMBER(pushman_state::mcu_cmd_w)
{
- if (ACCESSING_BITS_8_15)
- m_shared_ram[2 * offset] = data >> 8;
- if (ACCESSING_BITS_0_7)
- m_shared_ram[2 * offset + 1] = data & 0xff;
+ m_mcu->pd_w(space, 0, data & 0x00ff);
+ m_mcu->set_input_line(M68705_IRQ_LINE, ASSERT_LINE);
+}
+
+WRITE8_MEMBER(pushman_state::mcu_pa_w)
+{
+ m_mcu_output = (m_mcu_output & 0xff00) | (u16(data) & 0x00ff);
+}
- if (offset == 1)
+WRITE8_MEMBER(pushman_state::mcu_pb_w)
+{
+ m_mcu_output = (m_mcu_output & 0x00ff) | (u16(data) << 8);
+}
+
+WRITE8_MEMBER(pushman_state::mcu_pc_w)
+{
+ if (BIT(data, 0))
{
- m_mcu->set_input_line(M68705_IRQ_LINE, HOLD_LINE);
- space.device().execute().spin();
- m_new_latch = 0;
+ m_mcu->pa_w(space, 0, 0xff);
+ m_mcu->pb_w(space, 0, 0xff);
}
+ else
+ {
+ m_mcu->set_input_line(M68705_IRQ_LINE, CLEAR_LINE);
+ m_mcu->pa_w(space, 0, (m_host_latch >> 8) & 0x00ff);
+ m_mcu->pb_w(space, 0, (m_host_latch >> 0) & 0x00ff);
+ }
+
+ if (BIT(m_mcu_latch_ctl, 1) && !BIT(data, 1))
+ {
+ m_mcu_latch = m_mcu_output & (BIT(m_mcu_latch_ctl, 0) ? 0xffff : m_host_latch);
+ m_mcu_semaphore = true;
+ }
+
+ m_mcu_latch_ctl = data;
}
+
/* ElSemi - Bouncing balls protection. */
-READ16_MEMBER(tigeroad_state::bballs_68705_r)
+READ16_MEMBER(bballs_state::bballs_68705_r)
{
if (offset == 0)
return m_latch;
@@ -171,7 +203,7 @@ READ16_MEMBER(tigeroad_state::bballs_68705_r)
return (m_shared_ram[2 * offset + 1] << 8) + m_shared_ram[2 * offset];
}
-WRITE16_MEMBER(tigeroad_state::bballs_68705_w)
+WRITE16_MEMBER(bballs_state::bballs_68705_w)
{
if (ACCESSING_BITS_8_15)
m_shared_ram[2 * offset] = data >> 8;
@@ -196,19 +228,3 @@ WRITE16_MEMBER(tigeroad_state::bballs_68705_w)
}
}
}
-
-
-READ8_MEMBER(tigeroad_state::pushman_68000_r)
-{
- return m_shared_ram[offset];
-}
-
-WRITE8_MEMBER(tigeroad_state::pushman_68000_w)
-{
- if (offset == 2 && (m_shared_ram[2] & 2) == 0 && data & 2)
- {
- m_latch = (m_shared_ram[1] << 8) | m_shared_ram[0];
- m_new_latch = 1;
- }
- m_shared_ram[offset] = data;
-}