trunk/src/mame/drivers/sf.c
| r31605 | r31606 | |
| 21 | 21 | #include "includes/sf.h" |
| 22 | 22 | |
| 23 | 23 | |
| 24 | | WRITE8_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 | | |
| 34 | | WRITE8_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 | | |
| 41 | 24 | /* The protection of the Japanese (and alt US) version */ |
| 42 | 25 | /* I'd love to see someone dump the 68705 / i8751 roms */ |
| 43 | 26 | |
| r31605 | r31606 | |
| 55 | 38 | { 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 }, |
| 56 | 39 | { 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 } |
| 57 | 40 | }; |
| 58 | | int map; |
| 59 | | |
| 60 | | map = maplist |
| 41 | int map = maplist |
| 61 | 42 | [space.read_byte(0xffc006)] |
| 62 | 43 | [(space.read_byte(0xffc003) << 1) + (space.read_word(0xffc004) >> 8)]; |
| 63 | 44 | |
| r31605 | r31606 | |
| 142 | 123 | } |
| 143 | 124 | |
| 144 | 125 | |
| 145 | | /* The world version has analog buttons */ |
| 146 | | /* We simulate them with 3 buttons the same way the other versions |
| 147 | | internally do */ |
| 148 | | |
| 149 | | static const int scale[8] = { 0x00, 0x40, 0xe0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }; |
| 150 | | |
| 151 | | READ16_MEMBER(sf_state::button1_r) |
| 126 | WRITE8_MEMBER(sf_state::sf_coin_w) |
| 152 | 127 | { |
| 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? */ |
| 154 | 133 | } |
| 155 | 134 | |
| 156 | | READ16_MEMBER(sf_state::button2_r) |
| 135 | WRITE8_MEMBER(sf_state::soundcmd_w) |
| 157 | 136 | { |
| 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); |
| 159 | 139 | } |
| 160 | 140 | |
| 161 | | |
| 162 | 141 | WRITE8_MEMBER(sf_state::sound2_bank_w) |
| 163 | 142 | { |
| 164 | 143 | membank("bank1")->set_base(memregion("audio2")->base() + 0x8000 * (data + 1)); |
| 165 | 144 | } |
| 166 | 145 | |
| 167 | | |
| 168 | 146 | WRITE8_MEMBER(sf_state::msm1_5205_w) |
| 169 | 147 | { |
| 170 | 148 | m_msm1->reset_w(BIT(data, 7)); |
| r31605 | r31606 | |
| 183 | 161 | m_msm2->vclk_w(0); |
| 184 | 162 | } |
| 185 | 163 | |
| 186 | | |
| 187 | 164 | static ADDRESS_MAP_START( sf_map, AS_PROGRAM, 16, sf_state ) |
| 188 | 165 | ADDRESS_MAP_UNMAP_HIGH |
| 189 | 166 | AM_RANGE(0x000000, 0x04ffff) AM_ROM |
| r31605 | r31606 | |
| 191 | 168 | AM_RANGE(0xb00000, 0xb007ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 192 | 169 | AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("IN0") |
| 193 | 170 | 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") |
| 196 | 173 | AM_RANGE(0xc00008, 0xc00009) AM_READ_PORT("DSW1") |
| 197 | 174 | AM_RANGE(0xc0000a, 0xc0000b) AM_READ_PORT("DSW2") |
| 198 | 175 | AM_RANGE(0xc0000c, 0xc0000d) AM_READ_PORT("SYSTEM") |
| r31605 | r31606 | |
| 277 | 254 | |
| 278 | 255 | |
| 279 | 256 | |
| 257 | /*************************************************************************** |
| 258 | |
| 259 | Inputs |
| 260 | |
| 261 | ***************************************************************************/ |
| 262 | |
| 280 | 263 | static INPUT_PORTS_START( common ) |
| 281 | 264 | PORT_START("DSW1") |
| 282 | 265 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("DSW1.7E:1,2,3") |
| r31605 | r31606 | |
| 413 | 396 | PORT_MODIFY("DSW1") |
| 414 | 397 | PORT_DIPUNUSED_DIPLOC( 0x0100, 0x0100, "DSW2.13E:1" ) // Flip Screen not available |
| 415 | 398 | |
| 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") |
| 425 | 405 | |
| 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") |
| 455 | 409 | INPUT_PORTS_END |
| 456 | 410 | |
| 457 | 411 | static INPUT_PORTS_START( sfus ) |
| r31605 | r31606 | |
| 516 | 470 | |
| 517 | 471 | |
| 518 | 472 | |
| 473 | /*************************************************************************** |
| 474 | |
| 475 | Machine Configs |
| 476 | |
| 477 | ***************************************************************************/ |
| 478 | |
| 519 | 479 | static const gfx_layout char_layout = |
| 520 | 480 | { |
| 521 | 481 | 8,8, |
| r31605 | r31606 | |
| 636 | 596 | MACHINE_CONFIG_END |
| 637 | 597 | |
| 638 | 598 | |
| 599 | |
| 600 | /*************************************************************************** |
| 601 | |
| 602 | Game drivers |
| 603 | |
| 604 | ***************************************************************************/ |
| 605 | |
| 639 | 606 | ROM_START( sf ) |
| 640 | 607 | ROM_REGION( 0x60000, "maincpu", 0 ) |
| 641 | 608 | ROM_LOAD16_BYTE("sfe-19", 0x00000, 0x10000, CRC(8346c3ca) SHA1(404e26d210e453ef0f03b092d70c770106eed1d1) ) |