From 3da1e6f2b799e0896de9b08883b841f5921ae64b Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sun, 15 May 2022 14:17:12 +1000 Subject: exidy.cpp: Got rid of duplicate coin inputs. Partially addresses GitHub #9757. Coin 2 doesn't work for targ and spectar, but that isn't a regression (it was already broken, not sure if error in schematics, game bug, or emulation issue is to blame). DIP switches and locations are still a bit of a mess, too. --- src/mame/drivers/exidy.cpp | 52 +++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/src/mame/drivers/exidy.cpp b/src/mame/drivers/exidy.cpp index e111f474647..365671d6b5a 100644 --- a/src/mame/drivers/exidy.cpp +++ b/src/mame/drivers/exidy.cpp @@ -188,6 +188,8 @@ public: exidy_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + m_dsw(*this, "DSW"), + m_in0(*this, "IN0"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), @@ -208,7 +210,11 @@ public: void mtrap(machine_config &config); void pepper2(machine_config &config); + DECLARE_CUSTOM_INPUT_MEMBER(intsource_coins_r); + protected: + required_ioport m_dsw; + required_ioport m_in0; required_device m_maincpu; required_device m_gfxdecode; required_device m_screen; @@ -280,6 +286,9 @@ public: void rallys(machine_config &config); void phantoma(machine_config &config); + DECLARE_CUSTOM_INPUT_MEMBER(spectar_coins_r); + DECLARE_CUSTOM_INPUT_MEMBER(rallys_coin1_r); + void init_sidetrac(); void init_spectar(); @@ -388,13 +397,32 @@ private: /************************************* * - * Special Teeter Torture input + * Special inputs * *************************************/ +CUSTOM_INPUT_MEMBER(exidy_state::intsource_coins_r) +{ + uint8_t const dsw = m_dsw->read(); + uint8_t const in0 = m_in0->read(); + return (BIT(~in0, 7) << 1) | BIT(dsw, 0); +} + +CUSTOM_INPUT_MEMBER(spectar_state::spectar_coins_r) +{ + uint8_t const dsw = m_dsw->read(); + uint8_t const in0 = m_in0->read(); + return (BIT(~in0, 7) << 1) | BIT(~dsw, 0); +} + +CUSTOM_INPUT_MEMBER(spectar_state::rallys_coin1_r) +{ + return BIT(m_in0->read(), 7); +} + CUSTOM_INPUT_MEMBER(teetert_state::teetert_input_r) { - uint8_t dial = m_dial->read(); + uint8_t const dial = m_dial->read(); int result = (dial != m_last_dial) << 4; if (result != 0) @@ -639,8 +667,7 @@ static INPUT_PORTS_START( targ ) PORT_START("INTSOURCE") PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_CUSTOM ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 ) + PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(spectar_state, spectar_coins_r) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") PORT_START("IN2") @@ -710,7 +737,7 @@ static INPUT_PORTS_START( rallys ) PORT_MODIFY("INTSOURCE") PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(spectar_state, rallys_coin1_r) INPUT_PORTS_END static INPUT_PORTS_START( phantoma ) @@ -778,8 +805,7 @@ static INPUT_PORTS_START( mtrap ) */ PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_CUSTOM ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 ) + PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(exidy_state, intsource_coins_r) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") PORT_START("IN2") @@ -840,8 +866,7 @@ static INPUT_PORTS_START( venture ) PORT_DIPSETTING( 0x08, DEF_STR( Cocktail ) ) */ PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_CUSTOM ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 ) + PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(exidy_state, intsource_coins_r) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") PORT_START("IN2") @@ -896,8 +921,7 @@ static INPUT_PORTS_START( teetert ) PORT_DIPSETTING( 0x08, DEF_STR( Cocktail ) ) */ PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 ) + PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(exidy_state, intsource_coins_r) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") PORT_START("IN2") @@ -956,8 +980,7 @@ static INPUT_PORTS_START( pepper2 ) PORT_DIPSETTING( 0x08, DEF_STR( Cocktail ) ) */ PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_CUSTOM ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 ) + PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(exidy_state, intsource_coins_r) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") PORT_START("IN2") @@ -1008,8 +1031,7 @@ static INPUT_PORTS_START( fax ) PORT_DIPSETTING( 0x08, DEF_STR( Cocktail ) ) */ PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_CUSTOM ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 ) + PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(exidy_state, intsource_coins_r) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") PORT_START("IN2") -- cgit v1.2.3