diff --git a/src/mame/audio/suna8.c b/src/mame/audio/suna8.c index 1f0ea7fc597..5fe1ad7cbfe 100644 --- a/src/mame/audio/suna8.c +++ b/src/mame/audio/suna8.c @@ -29,7 +29,7 @@ SAMPLES_START_CB_MEMBER(suna8_state::sh_start) WRITE8_MEMBER(suna8_state::suna8_samples_number_w) { - m_sample = data & 0xf; + m_sample = data; logerror("%s: sample number = %02X\n", machine().describe_context(), data); } @@ -49,30 +49,27 @@ void suna8_state::play_sample(int index) WRITE8_MEMBER(suna8_state::suna8_play_samples_w) { logerror("%s: play sample = %02X\n", machine().describe_context(), data); - if ( data ) - { - if ( ~data & 0x10 ) - { - play_sample(m_sample); - } - else if ( ~data & 0x08 ) - { - play_sample((m_sample & 3) + 7); - } - else if ( ~data & 0x40 ) // sparkman, second sample rom - { - play_sample(m_sample + 0x10); - } - } + + // At boot: ff (ay reset) -> 00 (game writes ay enable) -> f9 (game writes to port A). + // Then game writes f9 -> f1 -> f9. Is bit 3 stop/reset? + + if ( m_play == 0xe9 && data == 0xf9 ) + play_sample(m_sample & 0x0f); + else if ( m_play == 0xb9 && data == 0xf9 ) // second sample rom + play_sample(((m_sample >> 4) & 0x0f) + 0x10); + + m_play = data; } WRITE8_MEMBER(suna8_state::rranger_play_samples_w) { - if (data) - { - if (( m_sample != 0 ) && ( ~data & 0x30 )) // don't play sample zero when those bits are active - { - play_sample(m_sample); - } - } + logerror("%s: play sample = %02X\n", machine().describe_context(), data); + + // At boot: ff (ay reset) -> 00 (game writes ay enable) -> 30 (game writes to port A). + // Is bit 6 stop/reset? + + if ( m_play == 0x60 && data == 0x70 ) + play_sample(m_sample & 0x0f); + + m_play = data; } diff --git a/src/mame/drivers/suna8.c b/src/mame/drivers/suna8.c index 00089cb4cc3..5b1259e6e16 100644 --- a/src/mame/drivers/suna8.c +++ b/src/mame/drivers/suna8.c @@ -2165,7 +2165,7 @@ static MACHINE_CONFIG_START( sparkman, suna8_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MCFG_SOUND_ADD("aysnd", AY8910, SUNA8_MASTER_CLOCK / 16) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(suna8_state, suna8_play_samples_w)) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(suna8_state, suna8_play_samples_w)) // two sample roms MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(suna8_state, suna8_samples_number_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) @@ -2218,6 +2218,9 @@ Sound processor - Z80 ***************************************************************************/ +// The sample rom is from srange with 1 byte changed (first byte is FF here, instead of 77) +// (laugh sound used when scoring a goal at the end of level 1) + ROM_START( hardhead ) ROM_REGION( 0x48000, "maincpu", 0 ) /* Main Z80 Code */ ROM_LOAD( "p1", 0x00000, 0x8000, CRC(c6147926) SHA1(8d1609aaeac344c6aec102e92d34caab22a8ec64) ) // 1988,9,14 diff --git a/src/mame/includes/suna8.h b/src/mame/includes/suna8.h index 41ff298e1ab..8b57fd158e3 100644 --- a/src/mame/includes/suna8.h +++ b/src/mame/includes/suna8.h @@ -63,7 +63,7 @@ public: // samples INT16 *m_samplebuf; - int m_sample; + int m_sample, m_play; int m_numsamples; #if TILEMAPS