Skip to content

Commit

Permalink
suna8: fix samples played from second rom in sparkman. Remove spuriou…
Browse files Browse the repository at this point in the history
…s samples played on reset by most games.
  • Loading branch information
LucaElia committed Jun 20, 2015
1 parent 5a7a29e commit 7700552
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
43 changes: 20 additions & 23 deletions src/mame/audio/suna8.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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;
}
5 changes: 4 additions & 1 deletion src/mame/drivers/suna8.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/mame/includes/suna8.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class suna8_state : public driver_device

// samples
INT16 *m_samplebuf;
int m_sample;
int m_sample, m_play;
int m_numsamples;

#if TILEMAPS
Expand Down

0 comments on commit 7700552

Please sign in to comment.