summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2017-08-23 22:30:13 -0400
committer AJR <ajrhacker@users.noreply.github.com>2017-08-23 22:30:13 -0400
commita6fddf4442b6ab32d5a367984a74db49dd6349fe (patch)
treeb59ca792e7c4570351639ee365b934d5ec511749
parent2d0121d7d2bbbfb95722ebc5c964c259d7e06ac9 (diff)
tekipaki: MCU soundlatch modernization and cleanup (nw)
-rw-r--r--src/mame/drivers/toaplan2.cpp42
-rw-r--r--src/mame/includes/toaplan2.h8
2 files changed, 7 insertions, 43 deletions
diff --git a/src/mame/drivers/toaplan2.cpp b/src/mame/drivers/toaplan2.cpp
index 5a86f66fe17..e7408a9c2fa 100644
--- a/src/mame/drivers/toaplan2.cpp
+++ b/src/mame/drivers/toaplan2.cpp
@@ -410,7 +410,6 @@ To reset the NVRAM in Othello Derby, hold P1 Button 1 down while booting.
void toaplan2_state::machine_start()
{
- save_item(NAME(m_mcu_data));
save_item(NAME(m_old_p1_paddle_h));
save_item(NAME(m_old_p2_paddle_h));
save_item(NAME(m_z80_busreq));
@@ -426,8 +425,6 @@ WRITE_LINE_MEMBER(toaplan2_state::toaplan2_reset)
MACHINE_RESET_MEMBER(toaplan2_state,toaplan2)
{
- m_mcu_data = 0x00;
-
// All games execute a RESET instruction on init, presumably to reset the sound CPU.
// This is important for games with common RAM; the RAM test will fail
// when leaving service mode if the sound CPU is not reset.
@@ -668,27 +665,13 @@ WRITE16_MEMBER(toaplan2_state::shared_ram_w)
}
-WRITE16_MEMBER(toaplan2_state::toaplan2_hd647180_cpu_w)
-{
- // Command sent to secondary CPU. Support for HD647180 will be
- // required when a ROM dump becomes available for this hardware
-
- if (ACCESSING_BITS_0_7)
- {
- m_mcu_data = data & 0xff;
- logerror("PC:%08x Writing command (%04x) to secondary CPU shared port\n", space.device().safe_pcbase(), m_mcu_data);
- }
-}
-
-
CUSTOM_INPUT_MEMBER(toaplan2_state::c2map_r)
{
// For Teki Paki hardware
// bit 4 high signifies secondary CPU is ready
// bit 5 is tested low before V-Blank bit ???
- //m_mcu_data = 0xff;
- return (m_cmdavailable) ? 0x00 : 0x01;
+ return m_soundlatch->pending_r() ? 0x00 : 0x01;
}
@@ -902,7 +885,7 @@ static ADDRESS_MAP_START( tekipaki_68k_mem, AS_PROGRAM, 16, toaplan2_state )
AM_RANGE(0x180040, 0x180041) AM_WRITE(toaplan2_coin_word_w)
AM_RANGE(0x180050, 0x180051) AM_READ_PORT("IN1")
AM_RANGE(0x180060, 0x180061) AM_READ_PORT("IN2")
- AM_RANGE(0x180070, 0x180071) AM_WRITE(tekipaki_mcu_w)
+ AM_RANGE(0x180070, 0x180071) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
ADDRESS_MAP_END
@@ -1444,24 +1427,9 @@ ADDRESS_MAP_END
-WRITE16_MEMBER(toaplan2_state::tekipaki_mcu_w)
-{
- if (ACCESSING_BITS_0_7)
- {
- m_mcu_data = data & 0xff;
- m_cmdavailable = 1;
- }
-};
-
-READ8_MEMBER(toaplan2_state::tekipaki_soundlatch_r)
-{
- m_cmdavailable = 0;
- return m_mcu_data;
-};
-
READ8_MEMBER(toaplan2_state::tekipaki_cmdavailable_r)
{
- if (m_cmdavailable) return 0xff;
+ if (m_soundlatch->pending_r()) return 0xff;
else return 0x00;
};
@@ -1474,7 +1442,7 @@ static ADDRESS_MAP_START( hd647180_io_map, AS_IO, 8, toaplan2_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x60, 0x60) AM_READ(tekipaki_cmdavailable_r)
- AM_RANGE(0x84, 0x84) AM_READ(tekipaki_soundlatch_r)
+ AM_RANGE(0x84, 0x84) AM_DEVREAD("soundlatch", generic_latch_8_device, read)
AM_RANGE(0x82, 0x82) AM_DEVREADWRITE("ymsnd", ym3812_device, status_port_r, control_port_w)
AM_RANGE(0x83, 0x83) AM_DEVREADWRITE("ymsnd", ym3812_device, read_port_r, write_port_w)
@@ -3249,6 +3217,8 @@ static MACHINE_CONFIG_START( tekipaki )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
+ MCFG_GENERIC_LATCH_8_ADD("soundlatch")
+
MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_27MHz/8)
MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
diff --git a/src/mame/includes/toaplan2.h b/src/mame/includes/toaplan2.h
index 8c0c4a9f96f..c793f2b0fb8 100644
--- a/src/mame/includes/toaplan2.h
+++ b/src/mame/includes/toaplan2.h
@@ -65,11 +65,10 @@ public:
optional_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
- optional_device<generic_latch_8_device> m_soundlatch; // batrider and bgaregga and batsugun
+ optional_device<generic_latch_8_device> m_soundlatch; // tekipaki, batrider, bgaregga, batsugun
optional_device<generic_latch_8_device> m_soundlatch2;
optional_device<ticket_dispenser_device> m_hopper;
- uint16_t m_mcu_data;
int8_t m_old_p1_paddle_h; /* For Ghox */
int8_t m_old_p2_paddle_h;
uint8_t m_v25_reset_line; /* 0x20 for dogyuun/batsugun, 0x10 for vfive, 0x08 for fixeight */
@@ -87,7 +86,6 @@ public:
DECLARE_WRITE16_MEMBER(shippumd_coin_word_w);
DECLARE_READ16_MEMBER(shared_ram_r);
DECLARE_WRITE16_MEMBER(shared_ram_w);
- DECLARE_WRITE16_MEMBER(toaplan2_hd647180_cpu_w);
DECLARE_READ16_MEMBER(ghox_p1_h_analog_r);
DECLARE_READ16_MEMBER(ghox_p2_h_analog_r);
DECLARE_WRITE16_MEMBER(fixeight_subcpu_ctrl_w);
@@ -137,10 +135,6 @@ public:
DECLARE_VIDEO_START(batrider);
// Teki Paki sound
- uint8_t m_cmdavailable;
-
- DECLARE_WRITE16_MEMBER(tekipaki_mcu_w);
- DECLARE_READ8_MEMBER(tekipaki_soundlatch_r);
DECLARE_READ8_MEMBER(tekipaki_cmdavailable_r);
uint32_t screen_update_toaplan2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);