Fixed sslam sound missing (due to m68k changes in the 0.154 cycle?) (nw)

This commit is contained in:
Ivan Vangelista 2014-09-24 15:13:19 +00:00
parent f137016156
commit b09c35e155
2 changed files with 102 additions and 105 deletions

View File

@ -83,7 +83,6 @@ Notes:
#include "emu.h"
#include "cpu/m68000/m68000.h"
#include "cpu/mcs51/mcs51.h"
#include "sound/okim6295.h"
#include "includes/sslam.h"
@ -246,120 +245,115 @@ TIMER_CALLBACK_MEMBER(sslam_state::music_playback)
}
static void sslam_play(device_t *device, int track, int data)
void sslam_state::sslam_play(int track, int data)
{
sslam_state *state = device->machine().driver_data<sslam_state>();
okim6295_device *oki = downcast<okim6295_device *>(device);
int status = oki->read_status();
int status = m_oki->read_status();
if (data < 0x80) {
if (track) {
if (state->m_track != data) {
state->m_track = data;
state->m_bar = 0;
if (m_track != data) {
m_track = data;
m_bar = 0;
if (status & 0x08)
oki->write_command(0x40);
oki->write_command((0x80 | data));
oki->write_command(0x81);
state->m_music_timer->adjust(attotime::from_msec(4), 0, attotime::from_hz(250)); /* 250Hz for smooth sequencing */
m_oki->write_command(0x40);
m_oki->write_command((0x80 | data));
m_oki->write_command(0x81);
m_music_timer->adjust(attotime::from_msec(4), 0, attotime::from_hz(250)); /* 250Hz for smooth sequencing */
}
}
else {
if ((status & 0x01) == 0) {
oki->write_command((0x80 | data));
oki->write_command(0x11);
m_oki->write_command((0x80 | data));
m_oki->write_command(0x11);
}
else if ((status & 0x02) == 0) {
oki->write_command((0x80 | data));
oki->write_command(0x21);
m_oki->write_command((0x80 | data));
m_oki->write_command(0x21);
}
else if ((status & 0x04) == 0) {
oki->write_command((0x80 | data));
oki->write_command(0x41);
m_oki->write_command((0x80 | data));
m_oki->write_command(0x41);
}
}
}
else { /* use above 0x80 to turn off channels */
if (track) {
state->m_music_timer->enable(false);
state->m_track = 0;
state->m_melody = 0;
state->m_bar = 0;
m_music_timer->enable(false);
m_track = 0;
m_melody = 0;
m_bar = 0;
}
data &= 0x7f;
oki->write_command(data);
m_oki->write_command(data);
}
}
WRITE16_MEMBER(sslam_state::sslam_snd_w)
WRITE8_MEMBER(sslam_state::sslam_snd_w)
{
if (ACCESSING_BITS_0_7)
{
logerror("%s Writing %04x to Sound CPU\n",machine().describe_context(),data);
if (data >= 0x40) {
if (data == 0xfe) {
/* This should reset the sound MCU and stop audio playback, but here, it */
/* chops the first coin insert. So let's only stop any playing melodies. */
sslam_play(m_oki, 1, (0x80 | 0x40)); /* Stop playing the melody */
}
else {
logerror("Unknown command (%02x) sent to the Sound controller\n",data);
popmessage("Unknown command (%02x) sent to the Sound controller",data);
}
}
else if (data == 0) {
m_bar = 0; /* Complete any current bars then stop sequencing */
m_melody = 0;
logerror("%s Writing %04x to Sound CPU\n",machine().describe_context(),data);
if (data >= 0x40) {
if (data == 0xfe) {
/* This should reset the sound MCU and stop audio playback, but here, it */
/* chops the first coin insert. So let's only stop any playing melodies. */
sslam_play(1, (0x80 | 0x40)); /* Stop playing the melody */
}
else {
m_sound = sslam_snd_cmd[data];
logerror("Unknown command (%02x) sent to the Sound controller\n",data);
popmessage("Unknown command (%02x) sent to the Sound controller",data);
}
}
else if (data == 0) {
m_bar = 0; /* Complete any current bars then stop sequencing */
m_melody = 0;
}
else {
m_sound = sslam_snd_cmd[data];
if (m_sound == 0xff) {
popmessage("Unmapped sound command %02x on Bank %02x",data,m_snd_bank);
if (m_sound == 0xff) {
popmessage("Unmapped sound command %02x on Bank %02x",data,m_snd_bank);
}
else if (m_sound >= 0x70) {
/* These vocals are in bank 1, but a bug in the actual MCU doesn't set the bank */
// if (m_snd_bank != 1)
// m_oki->set_bank_base((1 * 0x40000));
// sslam_snd_bank = 1;
sslam_play(0, m_sound);
}
else if (m_sound >= 0x69) {
if (m_snd_bank != 2)
m_oki->set_bank_base(2 * 0x40000);
m_snd_bank = 2;
switch (m_sound)
{
case 0x69: m_melody = 5; break;
case 0x6b: m_melody = 6; break;
case 0x6c: m_melody = 7; break;
default: m_melody = 0; m_bar = 0; break; /* Invalid */
}
else if (m_sound >= 0x70) {
/* These vocals are in bank 1, but a bug in the actual MCU doesn't set the bank */
// if (m_snd_bank != 1)
// m_oki->set_bank_base((1 * 0x40000));
// sslam_snd_bank = 1;
sslam_play(m_oki, 0, m_sound);
}
else if (m_sound >= 0x69) {
if (m_snd_bank != 2)
m_oki->set_bank_base(2 * 0x40000);
m_snd_bank = 2;
switch (m_sound)
{
case 0x69: m_melody = 5; break;
case 0x6b: m_melody = 6; break;
case 0x6c: m_melody = 7; break;
default: m_melody = 0; m_bar = 0; break; /* Invalid */
}
sslam_play(m_oki, m_melody, m_sound);
}
else if (m_sound >= 0x65) {
if (m_snd_bank != 1)
m_oki->set_bank_base(1 * 0x40000);
m_snd_bank = 1;
m_melody = 4;
sslam_play(m_oki, m_melody, m_sound);
}
else if (m_sound >= 0x60) {
if (m_snd_bank != 0)
m_oki->set_bank_base(0 * 0x40000);
m_snd_bank = 0;
switch (m_sound)
{
case 0x60: m_melody = 1; break;
case 0x63: m_melody = 2; break;
case 0x64: m_melody = 3; break;
default: m_melody = 0; m_bar = 0; break; /* Invalid */
}
sslam_play(m_oki, m_melody, m_sound);
}
else {
sslam_play(m_oki, 0, m_sound);
sslam_play(m_melody, m_sound);
}
else if (m_sound >= 0x65) {
if (m_snd_bank != 1)
m_oki->set_bank_base(1 * 0x40000);
m_snd_bank = 1;
m_melody = 4;
sslam_play(m_melody, m_sound);
}
else if (m_sound >= 0x60) {
if (m_snd_bank != 0)
m_oki->set_bank_base(0 * 0x40000);
m_snd_bank = 0;
switch (m_sound)
{
case 0x60: m_melody = 1; break;
case 0x63: m_melody = 2; break;
case 0x64: m_melody = 3; break;
default: m_melody = 0; m_bar = 0; break; /* Invalid */
}
sslam_play(m_melody, m_sound);
}
else {
sslam_play(0, m_sound);
}
}
}
@ -393,7 +387,7 @@ static ADDRESS_MAP_START( sslam_program_map, AS_PROGRAM, 16, sslam_state )
AM_RANGE(0x300018, 0x300019) AM_READ_PORT("IN4")
AM_RANGE(0x30001a, 0x30001b) AM_READ_PORT("DSW2")
AM_RANGE(0x30001c, 0x30001d) AM_READ_PORT("DSW1")
AM_RANGE(0x30001e, 0x30001f) AM_WRITE(sslam_snd_w)
AM_RANGE(0x30001e, 0x30001f) AM_WRITE8(sslam_snd_w, 0x00ff)
AM_RANGE(0xf00000, 0xffffff) AM_RAM /* Main RAM */
AM_RANGE(0x000000, 0xffffff) AM_ROM /* I don't honestly know where the rom is mirrored .. so all unmapped reads / writes go to rom */

View File

@ -5,17 +5,30 @@ class sslam_state : public driver_device
public:
sslam_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_bg_tileram(*this, "bg_tileram"),
m_md_tileram(*this, "md_tileram"),
m_tx_tileram(*this, "tx_tileram"),
m_regs(*this, "regs"),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_oki(*this, "oki"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette") { }
m_palette(*this, "palette"),
m_bg_tileram(*this, "bg_tileram"),
m_md_tileram(*this, "md_tileram"),
m_tx_tileram(*this, "tx_tileram"),
m_regs(*this, "regs"),
m_spriteram(*this, "spriteram") { }
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<okim6295_device> m_oki;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_shared_ptr<UINT16> m_bg_tileram;
optional_shared_ptr<UINT16> m_md_tileram;
optional_shared_ptr<UINT16> m_tx_tileram;
required_shared_ptr<UINT16> m_regs;
required_shared_ptr<UINT16> m_spriteram;
emu_timer *m_music_timer;
int m_sound;
@ -24,12 +37,6 @@ public:
int m_track;
int m_snd_bank;
required_shared_ptr<UINT16> m_bg_tileram;
optional_shared_ptr<UINT16> m_md_tileram;
optional_shared_ptr<UINT16> m_tx_tileram;
required_shared_ptr<UINT16> m_regs;
required_shared_ptr<UINT16> m_spriteram;
UINT8 m_oki_control;
UINT8 m_oki_command;
UINT8 m_oki_bank;
@ -47,7 +54,7 @@ public:
DECLARE_WRITE16_MEMBER(sslam_md_tileram_w);
DECLARE_WRITE16_MEMBER(sslam_bg_tileram_w);
DECLARE_WRITE16_MEMBER(powerbls_bg_tileram_w);
DECLARE_WRITE16_MEMBER(sslam_snd_w);
DECLARE_WRITE8_MEMBER(sslam_snd_w);
DECLARE_DRIVER_INIT(sslam);
DECLARE_DRIVER_INIT(powerbls);
TILE_GET_INFO_MEMBER(get_sslam_tx_tile_info);
@ -60,9 +67,5 @@ public:
UINT32 screen_update_powerbls(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(music_playback);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<okim6295_device> m_oki;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
void sslam_play(int track, int data);
};