trunk/src/mame/drivers/starfire.c
| r19083 | r19084 | |
| 46 | 46 | |
| 47 | 47 | #include "emu.h" |
| 48 | 48 | #include "cpu/z80/z80.h" |
| 49 | #include "sound/samples.h" |
| 49 | 50 | #include "includes/starfire.h" |
| 50 | 51 | |
| 51 | 52 | |
| r19083 | r19084 | |
| 96 | 97 | |
| 97 | 98 | WRITE8_MEMBER(starfire_state::starfire_sound_w) |
| 98 | 99 | { |
| 99 | | // TODO: sound |
| 100 | // starfire sound samples (preliminary) |
| 101 | UINT8 rise = data & ~m_prev_sound; |
| 102 | m_prev_sound = data; |
| 103 | |
| 104 | // d0: rumble |
| 105 | if (rise & 1) m_samples->start(0, 0, true); |
| 106 | if (~data & 1) m_samples->stop(0); |
| 107 | |
| 108 | // d1: explosion |
| 109 | // d2: tie weapon |
| 110 | // d3: laser |
| 111 | if (rise & 2) m_samples->start(1, 1); |
| 112 | if (rise & 4) m_samples->start(2, 2); |
| 113 | if (rise & 8) m_samples->start(3, 3); |
| 114 | |
| 115 | // these are from the same generator (called "computer" in schematics) |
| 116 | // d4: track |
| 117 | // d5: lock |
| 118 | // d6: scanner |
| 119 | // d7: overheat |
| 120 | if (rise & 0x80) m_samples->start(4, 7); |
| 121 | else if (rise & 0x40) m_samples->start(4, 6); |
| 122 | else if (rise & 0x20) m_samples->start(4, 5); |
| 123 | else if (rise & 0x10) m_samples->start(4, 4); |
| 100 | 124 | } |
| 101 | 125 | |
| 102 | | WRITE8_MEMBER(starfire_state::fireone_io2_w) |
| 126 | WRITE8_MEMBER(starfire_state::fireone_sound_w) |
| 103 | 127 | { |
| 104 | 128 | // TODO: sound |
| 105 | 129 | m_fireone_select = (data & 0x8) ? 0 : 1; |
| r19083 | r19084 | |
| 111 | 135 | switch (offset & 15) |
| 112 | 136 | { |
| 113 | 137 | case 0: return ioport("DSW")->read(); |
| 114 | | case 1: return ioport("SYSTEM")->read(); /* Note: need to loopback sounds lengths on that one */ |
| 138 | case 1: |
| 139 | { |
| 140 | // d3 and d4 come from the audio circuit, how does it work exactly? |
| 141 | // tie_on sounds ok, but laser_on sounds buggy |
| 142 | UINT8 tie_on = m_samples->playing(2) ? 0x00 : 0x08; |
| 143 | UINT8 laser_on = m_samples->playing(3) ? 0x00 : 0x10; |
| 144 | UINT8 input = ioport("SYSTEM")->read() & 0xe7; |
| 145 | return input | tie_on | laser_on | 0x10; // disable laser_on for now |
| 146 | } |
| 115 | 147 | case 5: return ioport("STICKZ")->read(); |
| 116 | 148 | case 6: return ioport("STICKX")->read(); |
| 117 | 149 | case 7: return ioport("STICKY")->read(); |
| r19083 | r19084 | |
| 269 | 301 | * |
| 270 | 302 | *************************************/ |
| 271 | 303 | |
| 304 | static const char *const starfire_sample_names[] = |
| 305 | { |
| 306 | "*starfire", |
| 307 | "size", |
| 308 | "explosion", |
| 309 | "tie", |
| 310 | "laser", |
| 311 | "track", |
| 312 | "lock", |
| 313 | "scanner", |
| 314 | "overheat", |
| 315 | 0 |
| 316 | }; |
| 317 | |
| 318 | static const samples_interface starfire_samples_interface = |
| 319 | { |
| 320 | 5, /* 5 channels */ |
| 321 | starfire_sample_names |
| 322 | }; |
| 323 | |
| 324 | |
| 272 | 325 | INTERRUPT_GEN_MEMBER(starfire_state::vblank_int) |
| 273 | 326 | { |
| 274 | 327 | // starfire has a jumper for disabling NMI, used to do a complete RAM test |
| r19083 | r19084 | |
| 276 | 329 | device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 277 | 330 | } |
| 278 | 331 | |
| 279 | | static MACHINE_CONFIG_START( starfire, starfire_state ) |
| 280 | 332 | |
| 333 | static MACHINE_CONFIG_START( fireone, starfire_state ) |
| 334 | |
| 281 | 335 | /* basic machine hardware */ |
| 282 | 336 | MCFG_CPU_ADD("maincpu", Z80, STARFIRE_CPU_CLOCK) |
| 283 | 337 | MCFG_CPU_PROGRAM_MAP(main_map) |
| r19083 | r19084 | |
| 288 | 342 | MCFG_SCREEN_RAW_PARAMS(STARFIRE_PIXEL_CLOCK, STARFIRE_HTOTAL, STARFIRE_HBEND, STARFIRE_HBSTART, STARFIRE_VTOTAL, STARFIRE_VBEND, STARFIRE_VBSTART) |
| 289 | 343 | MCFG_SCREEN_UPDATE_DRIVER(starfire_state, screen_update_starfire) |
| 290 | 344 | |
| 291 | | /* audio hardware */ |
| 345 | /* sound hardware */ |
| 292 | 346 | MACHINE_CONFIG_END |
| 293 | 347 | |
| 294 | 348 | |
| 349 | static MACHINE_CONFIG_DERIVED( starfire, fireone ) |
| 295 | 350 | |
| 351 | /* sound hardware */ |
| 352 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 353 | |
| 354 | MCFG_SAMPLES_ADD("samples", starfire_samples_interface) |
| 355 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 356 | MACHINE_CONFIG_END |
| 357 | |
| 358 | |
| 359 | |
| 296 | 360 | /************************************* |
| 297 | 361 | * |
| 298 | 362 | * ROM definitions |
| r19083 | r19084 | |
| 390 | 454 | { |
| 391 | 455 | m_input_read = read8_delegate(FUNC(starfire_state::starfire_input_r),this); |
| 392 | 456 | m_io2_write = write8_delegate(FUNC(starfire_state::starfire_sound_w),this); |
| 457 | |
| 458 | /* register for state saving */ |
| 459 | save_item(NAME(m_prev_sound)); |
| 393 | 460 | } |
| 394 | 461 | |
| 395 | 462 | DRIVER_INIT_MEMBER(starfire_state,fireone) |
| 396 | 463 | { |
| 397 | 464 | m_input_read = read8_delegate(FUNC(starfire_state::fireone_input_r),this); |
| 398 | | m_io2_write = write8_delegate(FUNC(starfire_state::fireone_io2_w),this); |
| 465 | m_io2_write = write8_delegate(FUNC(starfire_state::fireone_sound_w),this); |
| 399 | 466 | |
| 400 | 467 | /* register for state saving */ |
| 401 | 468 | save_item(NAME(m_fireone_select)); |
| r19083 | r19084 | |
| 409 | 476 | * |
| 410 | 477 | *************************************/ |
| 411 | 478 | |
| 412 | | GAME( 1979, starfire, 0, starfire, starfire, starfire_state, starfire, ROT0, "Exidy", "Star Fire (set 1)", GAME_NO_SOUND | GAME_SUPPORTS_SAVE ) |
| 413 | | GAME( 1979, starfirea,starfire, starfire, starfire, starfire_state, starfire, ROT0, "Exidy", "Star Fire (set 2)", GAME_NO_SOUND | GAME_SUPPORTS_SAVE ) |
| 414 | | GAME( 1979, fireone, 0, starfire, fireone, starfire_state, fireone, ROT0, "Exidy", "Fire One", GAME_NO_SOUND | GAME_SUPPORTS_SAVE ) |
| 415 | | GAME( 1979, starfir2, 0, starfire, starfire, starfire_state, starfire, ROT0, "Exidy", "Star Fire 2", GAME_NO_SOUND | GAME_SUPPORTS_SAVE ) |
| 479 | GAME( 1979, starfire, 0, starfire, starfire, starfire_state, starfire, ROT0, "Exidy", "Star Fire (set 1)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 480 | GAME( 1979, starfirea,starfire, starfire, starfire, starfire_state, starfire, ROT0, "Exidy", "Star Fire (set 2)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 481 | GAME( 1979, fireone, 0, fireone, fireone, starfire_state, fireone, ROT0, "Exidy", "Fire One", GAME_NO_SOUND | GAME_SUPPORTS_SAVE ) |
| 482 | GAME( 1979, starfir2, 0, starfire, starfire, starfire_state, starfire, ROT0, "Exidy", "Star Fire 2", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
trunk/src/mame/includes/starfire.h
| r19083 | r19084 | |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | #include "sound/samples.h" |
| 8 | |
| 9 | |
| 7 | 10 | #define STARFIRE_MASTER_CLOCK (XTAL_20MHz) |
| 8 | 11 | #define STARFIRE_CPU_CLOCK (STARFIRE_MASTER_CLOCK / 8) |
| 9 | 12 | #define STARFIRE_PIXEL_CLOCK (STARFIRE_MASTER_CLOCK / 4) |
| r19083 | r19084 | |
| 15 | 18 | #define STARFIRE_VBSTART (0x100) |
| 16 | 19 | #define STARFIRE_NUM_PENS (0x40) |
| 17 | 20 | |
| 21 | |
| 18 | 22 | class starfire_state : public driver_device |
| 19 | 23 | { |
| 20 | 24 | public: |
| 21 | 25 | starfire_state(const machine_config &mconfig, device_type type, const char *tag) |
| 22 | 26 | : driver_device(mconfig, type, tag), |
| 23 | 27 | m_starfire_colorram(*this, "colorram"), |
| 24 | | m_starfire_videoram(*this, "videoram") |
| 28 | m_starfire_videoram(*this, "videoram"), |
| 29 | m_samples(*this, "samples") |
| 25 | 30 | { } |
| 26 | 31 | |
| 27 | 32 | required_shared_ptr<UINT8> m_starfire_colorram; |
| 28 | 33 | required_shared_ptr<UINT8> m_starfire_videoram; |
| 34 | optional_device<samples_device> m_samples; |
| 29 | 35 | |
| 36 | UINT8 m_prev_sound; |
| 30 | 37 | UINT8 m_fireone_select; |
| 31 | 38 | |
| 32 | 39 | UINT8 m_starfire_vidctrl; |
| r19083 | r19084 | |
| 44 | 51 | DECLARE_READ8_MEMBER(starfire_input_r); |
| 45 | 52 | DECLARE_READ8_MEMBER(fireone_input_r); |
| 46 | 53 | DECLARE_WRITE8_MEMBER(starfire_sound_w); |
| 47 | | DECLARE_WRITE8_MEMBER(fireone_io2_w); |
| 54 | DECLARE_WRITE8_MEMBER(fireone_sound_w); |
| 48 | 55 | DECLARE_WRITE8_MEMBER(starfire_colorram_w); |
| 49 | 56 | DECLARE_READ8_MEMBER(starfire_colorram_r); |
| 50 | 57 | DECLARE_WRITE8_MEMBER(starfire_videoram_w); |