trunk/src/mame/drivers/gp_1.c
| r31568 | r31569 | |
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | ToDo: |
| 16 | | - Family Fun / Star Trip / Vegas, the chimes have been replaced by a SN76477, |
| 17 | | not yet emulated. |
| 16 | - Mechanical |
| 18 | 17 | |
| 19 | 18 | ********************************************************************************/ |
| 20 | 19 | |
| r31568 | r31569 | |
| 23 | 22 | #include "cpu/z80/z80daisy.h" |
| 24 | 23 | #include "machine/i8255.h" |
| 25 | 24 | #include "machine/z80ctc.h" |
| 25 | #include "sound/sn76477.h" |
| 26 | 26 | #include "gp_1.lh" |
| 27 | 27 | |
| 28 | 28 | class gp_1_state : public genpin_class |
| r31568 | r31569 | |
| 32 | 32 | : genpin_class(mconfig, type, tag) |
| 33 | 33 | , m_maincpu(*this, "maincpu") |
| 34 | 34 | , m_ctc(*this, "ctc") |
| 35 | , m_sn(*this, "snsnd") |
| 35 | 36 | , m_io_dsw0(*this, "DSW0") |
| 36 | 37 | , m_io_dsw1(*this, "DSW1") |
| 37 | 38 | , m_io_dsw2(*this, "DSW2") |
| r31568 | r31569 | |
| 45 | 46 | |
| 46 | 47 | DECLARE_DRIVER_INIT(gp_1); |
| 47 | 48 | DECLARE_WRITE8_MEMBER(porta_w); |
| 49 | DECLARE_WRITE8_MEMBER(portas_w); |
| 48 | 50 | DECLARE_WRITE8_MEMBER(portc_w); |
| 49 | 51 | DECLARE_READ8_MEMBER(portb_r); |
| 50 | 52 | TIMER_DEVICE_CALLBACK_MEMBER(zero_timer); |
| r31568 | r31569 | |
| 55 | 57 | virtual void machine_reset(); |
| 56 | 58 | required_device<cpu_device> m_maincpu; |
| 57 | 59 | required_device<z80ctc_device> m_ctc; |
| 60 | optional_device<sn76477_device> m_sn; |
| 58 | 61 | required_ioport m_io_dsw0; |
| 59 | 62 | required_ioport m_io_dsw1; |
| 60 | 63 | required_ioport m_io_dsw2; |
| r31568 | r31569 | |
| 197 | 200 | PORT_DIPSETTING( 0x80, DEF_STR( On )) |
| 198 | 201 | |
| 199 | 202 | PORT_START("DSW3") |
| 200 | | PORT_DIPNAME( 0x07, 0x07, "Max number of credits") |
| 203 | PORT_DIPNAME( 0x07, 0x02, "Max number of credits") |
| 201 | 204 | PORT_DIPSETTING( 0x00, "5" ) |
| 202 | 205 | PORT_DIPSETTING( 0x01, "10") |
| 203 | 206 | PORT_DIPSETTING( 0x02, "15") |
| r31568 | r31569 | |
| 206 | 209 | PORT_DIPSETTING( 0x05, "30") |
| 207 | 210 | PORT_DIPSETTING( 0x06, "35") |
| 208 | 211 | PORT_DIPSETTING( 0x07, "40") |
| 209 | | PORT_DIPNAME( 0x08, 0x08, "Balls") |
| 212 | PORT_DIPNAME( 0x08, 0x00, "Balls") |
| 210 | 213 | PORT_DIPSETTING( 0x00, "3") |
| 211 | 214 | PORT_DIPSETTING( 0x08, "5") |
| 212 | 215 | PORT_DIPNAME( 0x10, 0x10, "Award") |
| r31568 | r31569 | |
| 294 | 297 | switch (data) |
| 295 | 298 | { |
| 296 | 299 | case 0x10: // chime c |
| 297 | | m_samples->start(0, 3); |
| 300 | m_samples->start(3, 3); |
| 298 | 301 | break; |
| 299 | 302 | case 0x11: // chime b |
| 300 | | m_samples->start(0, 2); |
| 303 | m_samples->start(2, 2); |
| 301 | 304 | break; |
| 302 | 305 | case 0x12: // knocker |
| 303 | 306 | m_samples->start(0, 6); |
| r31568 | r31569 | |
| 306 | 309 | case 0x14: // not used |
| 307 | 310 | break; |
| 308 | 311 | case 0x15: // chime a |
| 309 | | m_samples->start(0, 1); |
| 312 | m_samples->start(1, 1); |
| 310 | 313 | break; |
| 311 | 314 | case 0x16: // chime d |
| 312 | 315 | m_samples->start(0, 4); |
| r31568 | r31569 | |
| 349 | 352 | } |
| 350 | 353 | } |
| 351 | 354 | |
| 355 | WRITE8_MEMBER( gp_1_state::portas_w ) |
| 356 | { |
| 357 | m_u14 = data >> 4; |
| 358 | if (m_u14 == 1) switch (data) |
| 359 | { |
| 360 | case 0x10: // chime c |
| 361 | m_sn->vco_voltage_w(0.45); |
| 362 | m_sn->enable_w(0); |
| 363 | data = 0x1f; |
| 364 | break; |
| 365 | case 0x11: // chime b |
| 366 | m_sn->vco_voltage_w(0.131); |
| 367 | m_sn->enable_w(0); |
| 368 | data = 0x1f; |
| 369 | break; |
| 370 | case 0x15: // chime a |
| 371 | m_sn->vco_voltage_w(0.07); |
| 372 | m_sn->enable_w(0); |
| 373 | data = 0x1f; |
| 374 | break; |
| 375 | case 0x16: // chime d |
| 376 | m_sn->vco_voltage_w(2.25); |
| 377 | m_sn->enable_w(0); |
| 378 | data = 0x1f; |
| 379 | break; |
| 380 | default: |
| 381 | m_sn->enable_w(1); |
| 382 | } |
| 383 | |
| 384 | porta_w(space, offset, data); |
| 385 | } |
| 386 | |
| 352 | 387 | WRITE8_MEMBER( gp_1_state::portc_w ) |
| 353 | 388 | { |
| 354 | 389 | output_set_value("led0", !BIT(data, 3)); |
| r31568 | r31569 | |
| 400 | 435 | MCFG_TIMER_DRIVER_ADD_PERIODIC("gp1", gp_1_state, zero_timer, attotime::from_hz(120)) // mains freq*2 |
| 401 | 436 | MACHINE_CONFIG_END |
| 402 | 437 | |
| 438 | static const sn76477_interface sn76477_intf = |
| 439 | { |
| 440 | 0, /* 4 noise_res (N/C) */ |
| 441 | 0, /* 5 filter_res (N/C) */ |
| 442 | 0, /* 6 filter_cap (N/C) */ |
| 443 | 0, /* 7 decay_res (N/C) */ |
| 444 | 0, /* 8 attack_decay_cap (N/C) */ |
| 445 | 0, /* 10 attack_res (nc) */ |
| 446 | RES_K(220), /* 11 amplitude_res */ |
| 447 | RES_K(47), /* 12 feedback_res */ |
| 448 | 0, /* 16 vco_voltage (N/C) */ |
| 449 | CAP_U(0.1), /* 17 vco_cap */ |
| 450 | RES_K(56), /* 18 vco_res */ |
| 451 | 5.0, /* 19 pitch_voltage */ |
| 452 | RES_K(220), /* 20 slf_res */ |
| 453 | CAP_U(1.0), /* 21 slf_cap */ |
| 454 | 0, /* 23 oneshot_cap (N/C) */ |
| 455 | 0, /* 24 oneshot_res (N/C) */ |
| 456 | 0, /* 22 vco (nc) */ |
| 457 | 0, /* 26 mixer A (nc) */ |
| 458 | 0, /* 25 mixer B (nc) */ |
| 459 | 0, /* 27 mixer C (nc) */ |
| 460 | 0, /* 1 envelope 1 (nc) */ |
| 461 | 1, /* 28 envelope 2 */ |
| 462 | 1 /* 9 enable (variable) 1=off */ |
| 463 | }; |
| 403 | 464 | |
| 465 | static MACHINE_CONFIG_DERIVED( gp_1s, gp_1 ) |
| 466 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 467 | MCFG_SOUND_ADD("snsnd", SN76477, 0) |
| 468 | MCFG_SOUND_CONFIG(sn76477_intf) |
| 469 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 470 | |
| 471 | MCFG_DEVICE_REMOVE("ppi") |
| 472 | MCFG_DEVICE_ADD("ppi", I8255A, 0 ) |
| 473 | MCFG_I8255_OUT_PORTA_CB(WRITE8(gp_1_state, portas_w)) |
| 474 | MCFG_I8255_IN_PORTB_CB(READ8(gp_1_state, portb_r)) |
| 475 | MCFG_I8255_OUT_PORTC_CB(WRITE8(gp_1_state, portc_w)) |
| 476 | MACHINE_CONFIG_END |
| 477 | |
| 478 | |
| 404 | 479 | ROM_START( gp_110 ) |
| 405 | 480 | ROM_REGION(0x1000, "roms", 0) |
| 406 | 481 | ROM_LOAD( "a-110.u12", 0x0000, 0x0800, CRC(ed0d518b) SHA1(8f3ca8792ad907c660d9149a1aa3a3528c7573e3)) |
| r31568 | r31569 | |
| 468 | 543 | GAME(1978, real, gp_110, gp_1, gp_1, driver_device, 0, ROT0, "Game Plan", "Real", GAME_MECHANICAL) |
| 469 | 544 | GAME(1978, rio, gp_110, gp_1, gp_1, driver_device, 0, ROT0, "Game Plan", "Rio", GAME_MECHANICAL) |
| 470 | 545 | GAME(1978, chucklck, gp_110, gp_1, gp_1, driver_device, 0, ROT0, "Game Plan", "Chuck-A-Luck", GAME_MECHANICAL) |
| 471 | | GAME(1979, famlyfun, 0, gp_1, gp_1, driver_device, 0, ROT0, "Game Plan", "Family Fun!", GAME_MECHANICAL | GAME_IMPERFECT_SOUND ) |
| 472 | | GAME(1979, startrip, 0, gp_1, gp_1, driver_device, 0, ROT0, "Game Plan", "Star Trip", GAME_MECHANICAL | GAME_IMPERFECT_SOUND ) |
| 473 | | GAME(1979, vegasgp, 0, gp_1, gp_1, driver_device, 0, ROT0, "Game Plan", "Vegas (Game Plan)", GAME_MECHANICAL | GAME_IMPERFECT_SOUND ) |
| 546 | GAME(1979, famlyfun, 0, gp_1s, gp_1, driver_device, 0, ROT0, "Game Plan", "Family Fun!", GAME_MECHANICAL) |
| 547 | GAME(1979, startrip, 0, gp_1s, gp_1, driver_device, 0, ROT0, "Game Plan", "Star Trip", GAME_MECHANICAL) |
| 548 | GAME(1979, vegasgp, 0, gp_1s, gp_1, driver_device, 0, ROT0, "Game Plan", "Vegas (Game Plan)", GAME_MECHANICAL) |