diff options
author | Michaël Banaan Ananas <happppp@users.noreply.github.com> | 2014-05-22 22:25:56 +0000 |
---|---|---|
committer | Michaël Banaan Ananas <happppp@users.noreply.github.com> | 2014-05-22 22:25:56 +0000 |
commit | 8b287ecf2b45740f4d5eb37cefd9ec259416c959 (patch) | |
tree | 3129195e8948139a687da3c88ae72a90e454c666 /src/mame/drivers/astinvad.c | |
parent | 36d137083410f9998be5f414d9df3f3fa3035b69 (diff) |
fix astinvad red screen flashing
Diffstat (limited to 'src/mame/drivers/astinvad.c')
-rw-r--r-- | src/mame/drivers/astinvad.c | 74 |
1 files changed, 64 insertions, 10 deletions
diff --git a/src/mame/drivers/astinvad.c b/src/mame/drivers/astinvad.c index 0290220a8ca..44f2650fab8 100644 --- a/src/mame/drivers/astinvad.c +++ b/src/mame/drivers/astinvad.c @@ -82,8 +82,11 @@ public: DECLARE_WRITE8_MEMBER(spaceint_sound1_w); DECLARE_WRITE8_MEMBER(spaceint_sound2_w); DECLARE_INPUT_CHANGED_MEMBER(spaceint_coin_inserted); - DECLARE_WRITE8_MEMBER(astinvad_sound1_w); - DECLARE_WRITE8_MEMBER(astinvad_sound2_w); + DECLARE_WRITE8_MEMBER(kamikaze_sound1_w); + DECLARE_WRITE8_MEMBER(kamikaze_sound2_w); + DECLARE_WRITE8_MEMBER(spcking2_sound1_w); + DECLARE_WRITE8_MEMBER(spcking2_sound2_w); + DECLARE_WRITE8_MEMBER(spcking2_sound3_w); DECLARE_DRIVER_INIT(kamikaze); DECLARE_DRIVER_INIT(spcking2); DECLARE_MACHINE_START(kamikaze); @@ -324,8 +327,17 @@ WRITE8_MEMBER(astinvad_state::kamikaze_ppi_w) * *************************************/ -WRITE8_MEMBER(astinvad_state::astinvad_sound1_w) +// Kamikaze +WRITE8_MEMBER(astinvad_state::kamikaze_sound1_w) { + // d0: ufo sound generator + // d1: fire sound generator + // d2: tank explosion sound generator + // d3: invader destroyed sound generator + // d4: bonus sound generator + // d5: sound enabled + // other bits: unused + int bits_gone_hi = data & ~m_sound_state[0]; m_sound_state[0] = data; @@ -334,13 +346,46 @@ WRITE8_MEMBER(astinvad_state::astinvad_sound1_w) if (bits_gone_hi & 0x02) m_samples->start(1, SND_SHOT); if (bits_gone_hi & 0x04) m_samples->start(2, SND_BASEHIT); if (bits_gone_hi & 0x08) m_samples->start(3, SND_INVADERHIT); - + if (bits_gone_hi & 0x10) m_samples->start(3, SND_INVADERHIT); + machine().sound().system_enable(data & 0x20); - m_screen_red = data & 0x04; } +WRITE8_MEMBER(astinvad_state::kamikaze_sound2_w) +{ + // d0: red screen -> to video board + // d1: invaders advancing sound generator + // d4: ufo destroyed sound generator + // d5: flip screen -> to video board + // other bits: unused + + int bits_gone_hi = data & ~m_sound_state[1]; + m_sound_state[1] = data; + + if (bits_gone_hi & 0x02) m_samples->start(5, SND_FLEET1); + if (bits_gone_hi & 0x10) m_samples->start(4, SND_UFOHIT); + + m_screen_flip = (ioport("CABINET")->read() & data & 0x20) ? 0xff : 0x00; + m_screen_red = data & 0x01; +} -WRITE8_MEMBER(astinvad_state::astinvad_sound2_w) +// Space King 2 +WRITE8_MEMBER(astinvad_state::spcking2_sound1_w) +{ + int bits_gone_hi = data & ~m_sound_state[0]; + m_sound_state[0] = data; + + if (bits_gone_hi & 0x01) m_samples->start(0, SND_UFO, true); + if (!(data & 0x01)) m_samples->stop(0); + if (bits_gone_hi & 0x02) m_samples->start(1, SND_SHOT); + if (bits_gone_hi & 0x04) m_samples->start(2, SND_BASEHIT); + if (bits_gone_hi & 0x08) m_samples->start(3, SND_INVADERHIT); + + machine().sound().system_enable(data & 0x20); + m_screen_red = data & 0x04; // ? +} + +WRITE8_MEMBER(astinvad_state::spcking2_sound2_w) { int bits_gone_hi = data & ~m_sound_state[1]; m_sound_state[1] = data; @@ -354,7 +399,12 @@ WRITE8_MEMBER(astinvad_state::astinvad_sound2_w) m_screen_flip = (ioport("CABINET")->read() & data & 0x20) ? 0xff : 0x00; } +WRITE8_MEMBER(astinvad_state::spcking2_sound3_w) +{ + // ? +} +// Space Intruder WRITE8_MEMBER(astinvad_state::spaceint_sound1_w) { int bits_gone_hi = data & ~m_sound_state[0]; @@ -372,7 +422,6 @@ WRITE8_MEMBER(astinvad_state::spaceint_sound1_w) if (bits_gone_hi & 0x80) m_samples->start(5, SND_FLEET4); } - WRITE8_MEMBER(astinvad_state::spaceint_sound2_w) { int bits_gone_hi = data & ~m_sound_state[1]; @@ -599,9 +648,8 @@ static MACHINE_CONFIG_START( kamikaze, astinvad_state ) MCFG_I8255_IN_PORTC_CB(IOPORT("IN2")) MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(astinvad_state, astinvad_sound1_w)) - MCFG_I8255_IN_PORTB_CB(IOPORT("CABINET")) - MCFG_I8255_OUT_PORTB_CB(WRITE8(astinvad_state, astinvad_sound2_w)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(astinvad_state, kamikaze_sound1_w)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(astinvad_state, kamikaze_sound2_w)) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -619,6 +667,12 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( spcking2, kamikaze ) /* basic machine hardware */ + MCFG_DEVICE_MODIFY("ppi8255_1") + MCFG_I8255_OUT_PORTA_CB(WRITE8(astinvad_state, spcking2_sound1_w)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(astinvad_state, spcking2_sound2_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(astinvad_state, spcking2_sound3_w)) + + /* video hardware */ MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_RAW_PARAMS(VIDEO_CLOCK, 320, 0, 256, 256, 16, 240) MACHINE_CONFIG_END |