Previous 199869 Revisions Next

r31606 Monday 11th August, 2014 at 10:51:43 UTC by hap
added sf analog buttons, removed the fake ones
[src/mame/drivers]sf.c
[src/mame/includes]sf.h

trunk/src/mame/drivers/sf.c
r31605r31606
2121#include "includes/sf.h"
2222
2323
24WRITE8_MEMBER(sf_state::sf_coin_w)
25{
26   coin_counter_w(machine(), 0,  data & 0x01);
27   coin_counter_w(machine(), 1,  data & 0x02);
28   coin_lockout_w(machine(), 0, ~data & 0x10);
29   coin_lockout_w(machine(), 1, ~data & 0x20);
30   coin_lockout_w(machine(), 2, ~data & 0x40); /* is there a third coin input? */
31}
32
33
34WRITE8_MEMBER(sf_state::soundcmd_w)
35{
36   soundlatch_byte_w(space, offset, data & 0xff);
37   m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
38}
39
40
4124/* The protection of the Japanese (and alt US) version */
4225/* I'd love to see someone dump the 68705 / i8751 roms */
4326
r31605r31606
5538      { 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 },
5639      { 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 }
5740   };
58   int map;
59
60   map = maplist
41   int map = maplist
6142      [space.read_byte(0xffc006)]
6243      [(space.read_byte(0xffc003) << 1) + (space.read_word(0xffc004) >> 8)];
6344
r31605r31606
142123}
143124
144125
145/* The world version has analog buttons */
146/* We simulate them with 3 buttons the same way the other versions
147   internally do */
148
149static const int scale[8] = { 0x00, 0x40, 0xe0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe };
150
151READ16_MEMBER(sf_state::button1_r)
126WRITE8_MEMBER(sf_state::sf_coin_w)
152127{
153   return (scale[ioport("AN3")->read()] << 8) | scale[ioport("AN1")->read()];
128   coin_counter_w(machine(), 0,  data & 0x01);
129   coin_counter_w(machine(), 1,  data & 0x02);
130   coin_lockout_w(machine(), 0, ~data & 0x10);
131   coin_lockout_w(machine(), 1, ~data & 0x20);
132   coin_lockout_w(machine(), 2, ~data & 0x40); /* is there a third coin input? */
154133}
155134
156READ16_MEMBER(sf_state::button2_r)
135WRITE8_MEMBER(sf_state::soundcmd_w)
157136{
158   return (scale[ioport("AN4")->read()] << 8) | scale[ioport("AN2")->read()];
137   soundlatch_byte_w(space, offset, data & 0xff);
138   m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
159139}
160140
161
162141WRITE8_MEMBER(sf_state::sound2_bank_w)
163142{
164143   membank("bank1")->set_base(memregion("audio2")->base() + 0x8000 * (data + 1));
165144}
166145
167
168146WRITE8_MEMBER(sf_state::msm1_5205_w)
169147{
170148   m_msm1->reset_w(BIT(data, 7));
r31605r31606
183161   m_msm2->vclk_w(0);
184162}
185163
186
187164static ADDRESS_MAP_START( sf_map, AS_PROGRAM, 16, sf_state )
188165   ADDRESS_MAP_UNMAP_HIGH
189166   AM_RANGE(0x000000, 0x04ffff) AM_ROM
r31605r31606
191168   AM_RANGE(0xb00000, 0xb007ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
192169   AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("IN0")
193170   AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("IN1")
194   AM_RANGE(0xc00004, 0xc00005) AM_READ(button1_r)
195   AM_RANGE(0xc00006, 0xc00007) AM_READ(button2_r)
171   AM_RANGE(0xc00004, 0xc00005) AM_READ_PORT("PUNCH")
172   AM_RANGE(0xc00006, 0xc00007) AM_READ_PORT("KICK")
196173   AM_RANGE(0xc00008, 0xc00009) AM_READ_PORT("DSW1")
197174   AM_RANGE(0xc0000a, 0xc0000b) AM_READ_PORT("DSW2")
198175   AM_RANGE(0xc0000c, 0xc0000d) AM_READ_PORT("SYSTEM")
r31605r31606
277254
278255
279256
257/***************************************************************************
258
259  Inputs
260
261***************************************************************************/
262
280263static INPUT_PORTS_START( common )
281264   PORT_START("DSW1")
282265   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )               PORT_DIPLOCATION("DSW1.7E:1,2,3")
r31605r31606
413396   PORT_MODIFY("DSW1")
414397   PORT_DIPUNUSED_DIPLOC( 0x0100, 0x0100, "DSW2.13E:1" ) // Flip Screen not available
415398
416   PORT_START("AN1")
417   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
418   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)
419   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1)
420   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
421   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
422   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
423   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
424   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
399   // 4 pneumatic buttons. When their pressure starts decreasing, the game will latch
400   // the highest measured value and respond with a low/mid/strong attack: approx.
401   // 0x40 for low, 0xe0 for mid, 0xfe for strong.
402   PORT_START("PUNCH")
403   PORT_BIT( 0x00ff, 0x0000, IPT_PEDAL1 ) PORT_PLAYER(1) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_NAME("P1 Punch")
404   PORT_BIT( 0xff00, 0x0000, IPT_PEDAL1 ) PORT_PLAYER(2) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_NAME("P2 Punch")
425405
426   PORT_START("AN2")
427   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1)
428   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1)
429   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1)
430   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
431   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
432   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
433   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
434   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
435
436   PORT_START("AN3")
437   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
438   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)
439   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2)
440   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
441   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
442   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
443   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
444   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
445
446   PORT_START("AN4")
447   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2)
448   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2)
449   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2)
450   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
451   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
452   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
453   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
454   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
406   PORT_START("KICK")
407   PORT_BIT( 0x00ff, 0x0000, IPT_PEDAL2 ) PORT_PLAYER(1) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_NAME("P1 Kick")
408   PORT_BIT( 0xff00, 0x0000, IPT_PEDAL2 ) PORT_PLAYER(2) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_NAME("P2 Kick")
455409INPUT_PORTS_END
456410
457411static INPUT_PORTS_START( sfus )
r31605r31606
516470
517471
518472
473/***************************************************************************
474
475  Machine Configs
476
477***************************************************************************/
478
519479static const gfx_layout char_layout =
520480{
521481   8,8,
r31605r31606
636596MACHINE_CONFIG_END
637597
638598
599
600/***************************************************************************
601
602  Game drivers
603
604***************************************************************************/
605
639606ROM_START( sf )
640607   ROM_REGION( 0x60000, "maincpu", 0 )
641608   ROM_LOAD16_BYTE("sfe-19", 0x00000, 0x10000, CRC(8346c3ca) SHA1(404e26d210e453ef0f03b092d70c770106eed1d1) )
trunk/src/mame/includes/sf.h
r31605r31606
4444   DECLARE_WRITE8_MEMBER(sf_coin_w);
4545   DECLARE_WRITE8_MEMBER(soundcmd_w);
4646   DECLARE_WRITE16_MEMBER(protection_w);
47   DECLARE_READ16_MEMBER(button1_r);
48   DECLARE_READ16_MEMBER(button2_r);
4947   DECLARE_WRITE8_MEMBER(sound2_bank_w);
5048   DECLARE_WRITE16_MEMBER(sf_videoram_w);
5149   DECLARE_WRITE16_MEMBER(sf_bg_scroll_w);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team