From ee765bf8072e13915d3dd59571446ce882014fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Banaan=20Ananas?= Date: Mon, 11 Aug 2014 10:51:43 +0000 Subject: [PATCH] added sf analog buttons, removed the fake ones --- src/mame/drivers/sf.c | 113 +++++++++++++++-------------------------- src/mame/includes/sf.h | 2 - 2 files changed, 40 insertions(+), 75 deletions(-) diff --git a/src/mame/drivers/sf.c b/src/mame/drivers/sf.c index f14a59eddb7..aa6a5448d03 100644 --- a/src/mame/drivers/sf.c +++ b/src/mame/drivers/sf.c @@ -21,23 +21,6 @@ #include "includes/sf.h" -WRITE8_MEMBER(sf_state::sf_coin_w) -{ - coin_counter_w(machine(), 0, data & 0x01); - coin_counter_w(machine(), 1, data & 0x02); - coin_lockout_w(machine(), 0, ~data & 0x10); - coin_lockout_w(machine(), 1, ~data & 0x20); - coin_lockout_w(machine(), 2, ~data & 0x40); /* is there a third coin input? */ -} - - -WRITE8_MEMBER(sf_state::soundcmd_w) -{ - soundlatch_byte_w(space, offset, data & 0xff); - m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); -} - - /* The protection of the Japanese (and alt US) version */ /* I'd love to see someone dump the 68705 / i8751 roms */ @@ -55,9 +38,7 @@ WRITE16_MEMBER(sf_state::protection_w) { 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 }, { 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 } }; - int map; - - map = maplist + int map = maplist [space.read_byte(0xffc006)] [(space.read_byte(0xffc003) << 1) + (space.read_word(0xffc004) >> 8)]; @@ -142,29 +123,26 @@ WRITE16_MEMBER(sf_state::protection_w) } -/* The world version has analog buttons */ -/* We simulate them with 3 buttons the same way the other versions - internally do */ - -static const int scale[8] = { 0x00, 0x40, 0xe0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }; - -READ16_MEMBER(sf_state::button1_r) +WRITE8_MEMBER(sf_state::sf_coin_w) { - return (scale[ioport("AN3")->read()] << 8) | scale[ioport("AN1")->read()]; + coin_counter_w(machine(), 0, data & 0x01); + coin_counter_w(machine(), 1, data & 0x02); + coin_lockout_w(machine(), 0, ~data & 0x10); + coin_lockout_w(machine(), 1, ~data & 0x20); + coin_lockout_w(machine(), 2, ~data & 0x40); /* is there a third coin input? */ } -READ16_MEMBER(sf_state::button2_r) +WRITE8_MEMBER(sf_state::soundcmd_w) { - return (scale[ioport("AN4")->read()] << 8) | scale[ioport("AN2")->read()]; + soundlatch_byte_w(space, offset, data & 0xff); + m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } - WRITE8_MEMBER(sf_state::sound2_bank_w) { membank("bank1")->set_base(memregion("audio2")->base() + 0x8000 * (data + 1)); } - WRITE8_MEMBER(sf_state::msm1_5205_w) { m_msm1->reset_w(BIT(data, 7)); @@ -183,7 +161,6 @@ WRITE8_MEMBER(sf_state::msm2_5205_w) m_msm2->vclk_w(0); } - static ADDRESS_MAP_START( sf_map, AS_PROGRAM, 16, sf_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x000000, 0x04ffff) AM_ROM @@ -191,8 +168,8 @@ static ADDRESS_MAP_START( sf_map, AS_PROGRAM, 16, sf_state ) AM_RANGE(0xb00000, 0xb007ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("IN0") AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("IN1") - AM_RANGE(0xc00004, 0xc00005) AM_READ(button1_r) - AM_RANGE(0xc00006, 0xc00007) AM_READ(button2_r) + AM_RANGE(0xc00004, 0xc00005) AM_READ_PORT("PUNCH") + AM_RANGE(0xc00006, 0xc00007) AM_READ_PORT("KICK") AM_RANGE(0xc00008, 0xc00009) AM_READ_PORT("DSW1") AM_RANGE(0xc0000a, 0xc0000b) AM_READ_PORT("DSW2") AM_RANGE(0xc0000c, 0xc0000d) AM_READ_PORT("SYSTEM") @@ -277,6 +254,12 @@ ADDRESS_MAP_END +/*************************************************************************** + + Inputs + +***************************************************************************/ + static INPUT_PORTS_START( common ) PORT_START("DSW1") PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("DSW1.7E:1,2,3") @@ -413,45 +396,16 @@ static INPUT_PORTS_START( sfan ) PORT_MODIFY("DSW1") PORT_DIPUNUSED_DIPLOC( 0x0100, 0x0100, "DSW2.13E:1" ) // Flip Screen not available - PORT_START("AN1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + // 4 pneumatic buttons. When their pressure starts decreasing, the game will latch + // the highest measured value and respond with a low/mid/strong attack: approx. + // 0x40 for low, 0xe0 for mid, 0xfe for strong. + PORT_START("PUNCH") + PORT_BIT( 0x00ff, 0x0000, IPT_PEDAL1 ) PORT_PLAYER(1) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_NAME("P1 Punch") + PORT_BIT( 0xff00, 0x0000, IPT_PEDAL1 ) PORT_PLAYER(2) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_NAME("P2 Punch") - PORT_START("AN2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - - PORT_START("AN3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - - PORT_START("AN4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_START("KICK") + PORT_BIT( 0x00ff, 0x0000, IPT_PEDAL2 ) PORT_PLAYER(1) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_NAME("P1 Kick") + PORT_BIT( 0xff00, 0x0000, IPT_PEDAL2 ) PORT_PLAYER(2) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_NAME("P2 Kick") INPUT_PORTS_END static INPUT_PORTS_START( sfus ) @@ -516,6 +470,12 @@ INPUT_PORTS_END +/*************************************************************************** + + Machine Configs + +***************************************************************************/ + static const gfx_layout char_layout = { 8,8, @@ -636,6 +596,13 @@ static MACHINE_CONFIG_DERIVED( sfp, sf ) MACHINE_CONFIG_END + +/*************************************************************************** + + Game drivers + +***************************************************************************/ + ROM_START( sf ) ROM_REGION( 0x60000, "maincpu", 0 ) ROM_LOAD16_BYTE("sfe-19", 0x00000, 0x10000, CRC(8346c3ca) SHA1(404e26d210e453ef0f03b092d70c770106eed1d1) ) diff --git a/src/mame/includes/sf.h b/src/mame/includes/sf.h index 56279096ea7..7054fdba80e 100644 --- a/src/mame/includes/sf.h +++ b/src/mame/includes/sf.h @@ -44,8 +44,6 @@ public: DECLARE_WRITE8_MEMBER(sf_coin_w); DECLARE_WRITE8_MEMBER(soundcmd_w); DECLARE_WRITE16_MEMBER(protection_w); - DECLARE_READ16_MEMBER(button1_r); - DECLARE_READ16_MEMBER(button2_r); DECLARE_WRITE8_MEMBER(sound2_bank_w); DECLARE_WRITE16_MEMBER(sf_videoram_w); DECLARE_WRITE16_MEMBER(sf_bg_scroll_w);