diff options
author | Aaron Giles <aaron@aarongiles.com> | 2008-08-14 05:17:39 +0000 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2008-08-14 05:17:39 +0000 |
commit | 3b76b8e25ec2ad0947c8e9e26a6ffd092a4f99ac (patch) | |
tree | 27fb3f405e03b4a5aa2c50ca4bb8282dd8c93737 /src/mame/drivers/jack.c | |
parent | 15893eeed0ae869cd2f31a38946ff1318349751d (diff) |
From: Fabio Priuli [mailto:doge.fabio@gmail.com]
Subject: some more input clean-ups
Hi,
attached please find a few patches against u4. These diffs improve
input ports for drivers starting with F->L. In particular: they add
AM_READ_PORT whenever suitable, they make inputs fully 32bit where
needed, they remove indexed input read handlers from INITs, they
replace many read handlers with appropriate CUSTOM_INPUTs.
Additional improvements:
* added dip switches and locations to go2000 (even if they were
partially documented in the source)
* fixed artmagic protection (it used a wrong tag, which probably
I added somewhere in 0.125uX); even if I haven't experienced any
problems due to the bug since the regression now it's fixed
More details on the patches:
* u4_clean01 -> u4_clean07: these are standard changes like the
one I submitted previously (no custom inputs involved)
* u4_custom01 -> u4_custom04: here there are also changes involving
custom inputs (they mainly deal with eeprom reads, but a few were a
bit more interesting); I separated these from the other ones in
case you want to check them more in detail
* itech8.diff: this patch improves ports & their handling in itech8.c.
In particular, it replaces the 'special' handlers with a single
custom input and I would like a confirmation that it was the right
choice in this case.
Patches are independent one from the other and should apply with
no problems. Let me know if this is not the case.
Regards,
Fabio
Diffstat (limited to 'src/mame/drivers/jack.c')
-rw-r--r-- | src/mame/drivers/jack.c | 169 |
1 files changed, 77 insertions, 92 deletions
diff --git a/src/mame/drivers/jack.c b/src/mame/drivers/jack.c index c9087e77486..8dc48b9ea91 100644 --- a/src/mame/drivers/jack.c +++ b/src/mame/drivers/jack.c @@ -87,12 +87,12 @@ static WRITE8_HANDLER( joinem_misc_w ) joinem_snd_bit = data & 1; } -static READ8_HANDLER( joinem_input1_r ) +static CUSTOM_INPUT( sound_check_r ) { - UINT8 ret = input_port_read(machine, "DSW2") & ~0x20; + UINT8 ret = 0; - if((input_port_read(machine, "IN2") & 0x80) && !joinem_snd_bit) - ret |= 0x20; + if((input_port_read(field->port->machine, "IN2") & 0x80) && !joinem_snd_bit) + ret = 1; return ret; } @@ -171,7 +171,7 @@ static ADDRESS_MAP_START( joinem_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0xb000, 0xb0ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_RANGE(0xb400, 0xb400) AM_WRITE(jack_sh_command_w) AM_RANGE(0xb500, 0xb500) AM_READ_PORT("DSW1") - AM_RANGE(0xb501, 0xb501) AM_READ(joinem_input1_r) + AM_RANGE(0xb501, 0xb501) AM_READ_PORT("DSW2") AM_RANGE(0xb502, 0xb502) AM_READ_PORT("IN0") AM_RANGE(0xb503, 0xb503) AM_READ_PORT("IN1") AM_RANGE(0xb504, 0xb504) AM_READ_PORT("IN2") @@ -205,57 +205,6 @@ static ADDRESS_MAP_START( sound_writeport, ADDRESS_SPACE_IO, 8 ) AM_RANGE(0x40, 0x40) AM_WRITE(ay8910_write_port_0_w) ADDRESS_MAP_END -#define COMMON_REMAINDER1\ - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Lives ) )\ - PORT_DIPSETTING( 0x00, "3" )\ - PORT_DIPSETTING( 0x10, "5" )\ - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Bonus_Life ) )\ - PORT_DIPSETTING( 0x00, "Every 10000" )\ - PORT_DIPSETTING( 0x20, "10000 Only" )\ - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Difficulty ) )\ - PORT_DIPSETTING( 0x00, "Start on Level 1" )\ - PORT_DIPSETTING( 0x40, "Start on Level 13" )\ - PORT_DIPNAME( 0x80, 0x00, "Bullets per Bean Collected" )\ - PORT_DIPSETTING( 0x00, "1" )\ - PORT_DIPSETTING( 0x80, "2" ) - -#define COMMON_REMAINDER2\ - PORT_START("DSW2")\ - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )\ - PORT_DIPSETTING( 0x01, DEF_STR( Upright ) )\ - PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) )\ - PORT_BIT( 0x1e, IP_ACTIVE_HIGH, IPT_UNUSED )\ - PORT_SERVICE( 0x20, IP_ACTIVE_HIGH )\ - PORT_DIPNAME( 0x40, 0x00, "Invulnerability (Cheat)")\ - PORT_DIPSETTING( 0x00, DEF_STR( Off ) )\ - PORT_DIPSETTING( 0x40, DEF_STR( On ) )\ - PORT_DIPNAME( 0x80, 0x00, "255 Lives (Cheat)")\ - PORT_DIPSETTING( 0x00, DEF_STR( Off ) )\ - PORT_DIPSETTING( 0x80, DEF_STR( On ) )\ - PORT_START("IN0")\ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )\ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )\ - PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_UNUSED )\ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )\ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 )\ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )\ - PORT_START("IN1")\ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY\ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY\ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY\ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY\ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL\ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL\ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL\ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL\ - PORT_START("IN2")\ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )\ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 )\ - PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED )\ - PORT_START("IN3")\ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL\ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL\ - PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED ) static INPUT_PORTS_START( jack ) PORT_START("DSW1") @@ -269,13 +218,66 @@ static INPUT_PORTS_START( jack ) PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x0c, DEF_STR( 4C_3C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) - COMMON_REMAINDER1 - COMMON_REMAINDER2 + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Lives ) ) + PORT_DIPSETTING( 0x00, "3" ) + PORT_DIPSETTING( 0x10, "5" ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Bonus_Life ) ) + PORT_DIPSETTING( 0x00, "Every 10000" ) + PORT_DIPSETTING( 0x20, "10000 Only" ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Difficulty ) ) + PORT_DIPSETTING( 0x00, "Start on Level 1" ) + PORT_DIPSETTING( 0x40, "Start on Level 13" ) + PORT_DIPNAME( 0x80, 0x00, "Bullets per Bean Collected" ) + PORT_DIPSETTING( 0x00, "1" ) + PORT_DIPSETTING( 0x80, "2" ) + + PORT_START("DSW2") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Upright ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) + PORT_BIT( 0x1e, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_SERVICE( 0x20, IP_ACTIVE_HIGH ) + PORT_DIPNAME( 0x40, 0x00, "Invulnerability (Cheat)") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, "255 Lives (Cheat)") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) + + PORT_START("IN0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 ) + PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL + + PORT_START("IN2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) + PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL + PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END /* Same as 'jack', but different coinage */ static INPUT_PORTS_START( jack2 ) - PORT_START("DSW1") + PORT_INCLUDE( jack ) + + PORT_MODIFY("DSW1") PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) ) PORT_DIPSETTING( 0x03, DEF_STR( 4C_3C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) @@ -286,13 +288,13 @@ static INPUT_PORTS_START( jack2 ) PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x0c, DEF_STR( 4C_3C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) -COMMON_REMAINDER1 -COMMON_REMAINDER2 INPUT_PORTS_END /* Same as 'jack', but another different coinage */ static INPUT_PORTS_START( jack3 ) - PORT_START("DSW1") + PORT_INCLUDE( jack ) + + PORT_MODIFY("DSW1") PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) ) @@ -303,36 +305,19 @@ static INPUT_PORTS_START( jack3 ) PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) -COMMON_REMAINDER1 -COMMON_REMAINDER2 INPUT_PORTS_END /* Same as 'jack', but different "Bullets per Bean Collected" and "Difficulty" Dip Switches */ static INPUT_PORTS_START( treahunt ) - PORT_START("DSW1") - PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) ) - PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x03, DEF_STR( 4C_3C ) ) - PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x02, DEF_STR( 1C_3C ) ) - PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coin_A ) ) - PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) - PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x0c, DEF_STR( 4C_3C ) ) - PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Lives ) ) - PORT_DIPSETTING( 0x00, "3" ) - PORT_DIPSETTING( 0x10, "5" ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Bonus_Life ) ) - PORT_DIPSETTING( 0x00, "Every 10000" ) - PORT_DIPSETTING( 0x20, "10000 Only" ) + PORT_INCLUDE( jack ) + + PORT_MODIFY("DSW1") PORT_DIPNAME( 0x40, 0x00, DEF_STR( Difficulty ) ) PORT_DIPSETTING( 0x00, "Start on Level 1" ) PORT_DIPSETTING( 0x40, "Start on Level 6" ) PORT_DIPNAME( 0x80, 0x00, "Bullets per Bean Collected" ) PORT_DIPSETTING( 0x00, "5" ) PORT_DIPSETTING( 0x80, "20" ) -COMMON_REMAINDER2 INPUT_PORTS_END static INPUT_PORTS_START( zzyzzyxx ) @@ -651,7 +636,7 @@ static INPUT_PORTS_START( joinem ) PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) // sound check + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(sound_check_r, NULL) // sound check PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x40, DEF_STR( On ) ) @@ -686,7 +671,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( loverboy ) PORT_START("DSW1") - PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) ) + PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coinage ) ) PORT_DIPSETTING( 0x0c, DEF_STR( 4C_1C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) PORT_DIPSETTING( 0x0d, DEF_STR( 4C_2C ) ) @@ -779,14 +764,14 @@ static INPUT_PORTS_START( striv ) PORT_DIPSETTING( 0x02, "Horizontal" ) PORT_DIPSETTING( 0x00, "Vertical" ) PORT_DIPNAME( 0x05, 0x05, "Gaming Option Number" ) - PORT_DIPSETTING( 0x01, "2" ) PORT_CONDITION("DSW1",0x20,PORTCOND_EQUALS,0x20) - PORT_DIPSETTING( 0x05, "3" ) PORT_CONDITION("DSW1",0x20,PORTCOND_EQUALS,0x20) - PORT_DIPSETTING( 0x00, "4" ) PORT_CONDITION("DSW1",0x20,PORTCOND_EQUALS,0x20) - PORT_DIPSETTING( 0x04, "5" ) PORT_CONDITION("DSW1",0x20,PORTCOND_EQUALS,0x20) - PORT_DIPSETTING( 0x01, "4" ) PORT_CONDITION("DSW1",0x20,PORTCOND_NOTEQUALS,0x20) - PORT_DIPSETTING( 0x05, "5" ) PORT_CONDITION("DSW1",0x20,PORTCOND_NOTEQUALS,0x20) - PORT_DIPSETTING( 0x00, "6" ) PORT_CONDITION("DSW1",0x20,PORTCOND_NOTEQUALS,0x20) - PORT_DIPSETTING( 0x04, "7" ) PORT_CONDITION("DSW1",0x20,PORTCOND_NOTEQUALS,0x20) + PORT_DIPSETTING( 0x01, "2" ) PORT_CONDITION("DSW1", 0x20, PORTCOND_EQUALS, 0x20) + PORT_DIPSETTING( 0x05, "3" ) PORT_CONDITION("DSW1", 0x20, PORTCOND_EQUALS, 0x20) + PORT_DIPSETTING( 0x00, "4" ) PORT_CONDITION("DSW1", 0x20, PORTCOND_EQUALS, 0x20) + PORT_DIPSETTING( 0x04, "5" ) PORT_CONDITION("DSW1", 0x20, PORTCOND_EQUALS, 0x20) + PORT_DIPSETTING( 0x01, "4" ) PORT_CONDITION("DSW1", 0x20, PORTCOND_NOTEQUALS, 0x20) + PORT_DIPSETTING( 0x05, "5" ) PORT_CONDITION("DSW1", 0x20, PORTCOND_NOTEQUALS, 0x20) + PORT_DIPSETTING( 0x00, "6" ) PORT_CONDITION("DSW1", 0x20, PORTCOND_NOTEQUALS, 0x20) + PORT_DIPSETTING( 0x04, "7" ) PORT_CONDITION("DSW1", 0x20, PORTCOND_NOTEQUALS, 0x20) PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ) ) PORT_DIPSETTING( 0x08, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) |