From c1658675f37f0015a7760e33e312cfbd17178b4f Mon Sep 17 00:00:00 2001 From: stephh Date: Fri, 11 Apr 2008 17:18:07 +0000 Subject: [PATCH] Fixed bug ID 01571. Fixed Dip Switches. Used port tags instead of port numbers. --- src/mame/drivers/stadhero.c | 97 ++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 54 deletions(-) diff --git a/src/mame/drivers/stadhero.c b/src/mame/drivers/stadhero.c index 25bade84089..e9773a69a65 100644 --- a/src/mame/drivers/stadhero.c +++ b/src/mame/drivers/stadhero.c @@ -32,13 +32,13 @@ static READ16_HANDLER( stadhero_control_r ) switch (offset<<1) { case 0: /* Player 1 & 2 joystick & buttons */ - return (input_port_read_indexed(machine, 0) + (input_port_read_indexed(machine, 1) << 8)); + return (input_port_read(machine, "P1") | (input_port_read(machine, "P2") << 8)); case 2: /* Credits, start buttons */ - return input_port_read_indexed(machine, 2) | (input_port_read_indexed(machine, 2)<<8); + return (input_port_read(machine, "COIN") | (input_port_read(machine, "COIN") << 8)); - case 4: /* Byte 4: Dipswitch bank 2, Byte 5: Dipswitch Bank 1 */ - return (input_port_read_indexed(machine, 3) + (input_port_read_indexed(machine, 4) << 8)); + case 4: /* Dip switches */ + return (input_port_read(machine, "DSW1") | (input_port_read(machine, "DSW2") << 8)); } logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n",activecpu_get_pc(),0x30c000+offset); @@ -114,37 +114,37 @@ ADDRESS_MAP_END /******************************************************************************/ static INPUT_PORTS_START( stadhero ) - PORT_START /* Player 1 controls */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) + PORT_START_TAG("P1") /* 0x30c001 : Player 1 controls */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) - PORT_START /* Player 2 controls */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) + PORT_START_TAG("P2") /* 0x30c000 : Player 2 controls */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) - PORT_START /* Credits, start buttons */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) + PORT_START_TAG("COIN") /* 0x30c002 & 0x30c003 : Credits, start buttons */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* related to music/sound */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* related to music/sound */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* related to music/sound */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* related to music/sound */ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 ) /* Service */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK ) - PORT_START /* Dip switch bank 1 */ + PORT_START_TAG("DSW1") /* 0x30c005 : Dip switch bank 1 */ PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) ) PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) ) @@ -155,44 +155,33 @@ static INPUT_PORTS_START( stadhero ) PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW ) PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x20, DEF_STR( On ) ) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) ) PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) - PORT_START /* Dip switch bank 2 */ - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_START_TAG("DSW2") /* 0x30c004 : Dip switch bank 2 */ + PORT_DIPNAME( 0x03, 0x03, "Time (1P Vs CPU)" ) /* Table at 0x0014f6 */ + PORT_DIPSETTING( 0x02, "600" ) + PORT_DIPSETTING( 0x03, "500" ) + PORT_DIPSETTING( 0x01, "450" ) + PORT_DIPSETTING( 0x00, "400" ) + PORT_DIPNAME( 0x0c, 0x0c, "Time (1P Vs 2P)" ) /* Table at 0x0014fe */ + PORT_DIPSETTING( 0x08, "270" ) + PORT_DIPSETTING( 0x0c, "210" ) + PORT_DIPSETTING( 0x04, "180" ) + PORT_DIPSETTING( 0x00, "120" ) + PORT_DIPNAME( 0x30, 0x30, "Final Set" ) /* Table at 0x00078c */ + PORT_DIPSETTING( 0x20, "3 Credits" ) + PORT_DIPSETTING( 0x30, "4 Credits" ) + PORT_DIPSETTING( 0x10, "5 Credits" ) + PORT_DIPSETTING( 0x00, "6 Credits" ) + PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) + PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) INPUT_PORTS_END /******************************************************************************/