diff options
author | 2017-01-17 03:52:08 +1100 | |
---|---|---|
committer | 2017-01-17 03:52:08 +1100 | |
commit | a3e60b3f3d85fe10f52ae21d865e96079bd323c0 (patch) | |
tree | ffaddd309c7690147a50ba65d4d62053b4d9f9d1 /src/mame/machine/tigeroad.cpp | |
parent | 408a8fceb44684f221214e74ab7c86983405a7b5 (diff) |
pushman: better understanding of how CPU reads MCU data/status
bballs: simplify protection MCU simulation using pushman hookup as a guide
(nw) bballs appears to use a simpler single-word arrangement for
messages from CPU to MCU, perhaps so it can use a 28-pin MCU (pushman
MCU receives the command byte on port D, which the 28-pin parts lack)
Diffstat (limited to 'src/mame/machine/tigeroad.cpp')
-rw-r--r-- | src/mame/machine/tigeroad.cpp | 98 |
1 files changed, 48 insertions, 50 deletions
diff --git a/src/mame/machine/tigeroad.cpp b/src/mame/machine/tigeroad.cpp index 92b0dbdb6fd..d433c60f52c 100644 --- a/src/mame/machine/tigeroad.cpp +++ b/src/mame/machine/tigeroad.cpp @@ -124,33 +124,36 @@ WRITE16_MEMBER(tigeroad_state::f1dream_control_w) } -READ16_MEMBER(pushman_state::mcu_data_r) +READ16_MEMBER(pushman_state::mcu_comm_r) { - return m_mcu_latch; -} - -READ16_MEMBER(pushman_state::mcu_ack_r) -{ - if (m_mcu_semaphore) - { - m_mcu_semaphore = false; - return 0x0000; - } - else + switch (offset & 0x03) { - return 0x00ff; + case 0: // read and acknowledge MCU reply + if (!space.debugger_access()) + m_mcu_semaphore = false; + return m_mcu_latch; + case 2: // expects bit 0 to be high when MCU has accepted command (other bits ignored) + return m_host_semaphore ? 0x0000 : 0x0001; + case 3: // expects bit 0 to be low when MCU has sent response (other bits ignored) + return m_mcu_semaphore ? 0x0000 : 0x0001; } + logerror("unknown MCU read offset %X & %04X\n", offset, mem_mask); + return 0x0000; } -WRITE16_MEMBER(pushman_state::mcu_data_w) +WRITE16_MEMBER(pushman_state::mcu_comm_w) { - COMBINE_DATA(&m_host_latch); -} - -WRITE16_MEMBER(pushman_state::mcu_cmd_w) -{ - m_mcu->pd_w(space, 0, data & 0x00ff); - m_mcu->set_input_line(M68705_IRQ_LINE, ASSERT_LINE); + switch (offset & 0x01) + { + case 0: + COMBINE_DATA(&m_host_latch); + break; + case 1: + m_mcu->pd_w(space, 0, data & 0x00ff); + m_host_semaphore = true; + m_mcu->set_input_line(M68705_IRQ_LINE, ASSERT_LINE); + break; + } } WRITE8_MEMBER(pushman_state::mcu_pa_w) @@ -172,6 +175,7 @@ WRITE8_MEMBER(pushman_state::mcu_pc_w) } else { + m_host_semaphore = false; 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); @@ -190,41 +194,35 @@ WRITE8_MEMBER(pushman_state::mcu_pc_w) /* ElSemi - Bouncing balls protection. */ READ16_MEMBER(bballs_state::bballs_68705_r) { - if (offset == 0) - return m_latch; - if (offset == 3 && m_new_latch) + switch (offset) { - m_new_latch = 0; - return 0; + case 0: // read and acknowledge MCU reply + if (!space.debugger_access()) + m_mcu_semaphore = false; + return m_mcu_latch; + case 2: // pretend MCU accepts command instantly + return 0x0001; + case 3: // expects bit 0 to be low when MCU has sent response (other bits ignored) + return m_mcu_semaphore ? 0x0000 : 0x0001; } - if (offset == 3 && !m_new_latch) - return 0xff; - - return (m_shared_ram[2 * offset + 1] << 8) + m_shared_ram[2 * offset]; + logerror("unknown 68705 read offset %X & %04X\n", offset, mem_mask); + return 0x0000; } WRITE16_MEMBER(bballs_state::bballs_68705_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; - - if (offset == 0) + m_mcu_latch = 0; + if ((data >> 8) <= 0x0f) { - m_latch = 0; - if (m_shared_ram[0] <= 0xf) - { - m_latch = m_shared_ram[0] << 2; - if (m_shared_ram[1]) - m_latch |= 2; - m_new_latch = 1; - } - else if (m_shared_ram[0]) - { - if (m_shared_ram[1]) - m_latch |= 2; - m_new_latch = 1; - } + m_mcu_latch = (data >> 6) & 0x03fc; + if (data & 0x00ff) + m_mcu_latch |= 2; + m_mcu_semaphore = true; + } + else if (data >> 8) + { + if (data & 0x00ff) + m_mcu_latch |= 2; + m_mcu_semaphore = true; } } |