Previous 199869 Revisions Next

r32354 Wednesday 24th September, 2014 at 15:13:19 UTC by Osso
Fixed sslam sound missing (due to m68k changes in the 0.154 cycle?) (nw)
[src/mame/drivers]sslam.c
[src/mame/includes]sslam.h

trunk/src/mame/drivers/sslam.c
r32353r32354
8383#include "emu.h"
8484#include "cpu/m68000/m68000.h"
8585#include "cpu/mcs51/mcs51.h"
86#include "sound/okim6295.h"
8786#include "includes/sslam.h"
8887
8988
r32353r32354
246245}
247246
248247
249static void sslam_play(device_t *device, int track, int data)
248void sslam_state::sslam_play(int track, int data)
250249{
251   sslam_state *state = device->machine().driver_data<sslam_state>();
252   okim6295_device *oki = downcast<okim6295_device *>(device);
253   int status = oki->read_status();
250   int status = m_oki->read_status();
254251
255252   if (data < 0x80) {
256253      if (track) {
257         if (state->m_track != data) {
258            state->m_track  = data;
259            state->m_bar = 0;
254         if (m_track != data) {
255            m_track  = data;
256            m_bar = 0;
260257            if (status & 0x08)
261               oki->write_command(0x40);
262            oki->write_command((0x80 | data));
263            oki->write_command(0x81);
264            state->m_music_timer->adjust(attotime::from_msec(4), 0, attotime::from_hz(250));    /* 250Hz for smooth sequencing */
258               m_oki->write_command(0x40);
259            m_oki->write_command((0x80 | data));
260            m_oki->write_command(0x81);
261            m_music_timer->adjust(attotime::from_msec(4), 0, attotime::from_hz(250));    /* 250Hz for smooth sequencing */
265262         }
266263      }
267264      else {
268265         if ((status & 0x01) == 0) {
269            oki->write_command((0x80 | data));
270            oki->write_command(0x11);
266            m_oki->write_command((0x80 | data));
267            m_oki->write_command(0x11);
271268         }
272269         else if ((status & 0x02) == 0) {
273            oki->write_command((0x80 | data));
274            oki->write_command(0x21);
270            m_oki->write_command((0x80 | data));
271            m_oki->write_command(0x21);
275272         }
276273         else if ((status & 0x04) == 0) {
277            oki->write_command((0x80 | data));
278            oki->write_command(0x41);
274            m_oki->write_command((0x80 | data));
275            m_oki->write_command(0x41);
279276         }
280277      }
281278   }
282279   else {      /* use above 0x80 to turn off channels */
283280      if (track) {
284         state->m_music_timer->enable(false);
285         state->m_track = 0;
286         state->m_melody = 0;
287         state->m_bar = 0;
281         m_music_timer->enable(false);
282         m_track = 0;
283         m_melody = 0;
284         m_bar = 0;
288285      }
289286      data &= 0x7f;
290      oki->write_command(data);
287      m_oki->write_command(data);
291288   }
292289}
293290
294WRITE16_MEMBER(sslam_state::sslam_snd_w)
291WRITE8_MEMBER(sslam_state::sslam_snd_w)
295292{
296   if (ACCESSING_BITS_0_7)
297   {
298      logerror("%s Writing %04x to Sound CPU\n",machine().describe_context(),data);
299      if (data >= 0x40) {
300         if (data == 0xfe) {
301            /* This should reset the sound MCU and stop audio playback, but here, it */
302            /* chops the first coin insert. So let's only stop any playing melodies. */
303            sslam_play(m_oki, 1, (0x80 | 0x40));       /* Stop playing the melody */
304         }
305         else {
306            logerror("Unknown command (%02x) sent to the Sound controller\n",data);
307            popmessage("Unknown command (%02x) sent to the Sound controller",data);
308         }
293   logerror("%s Writing %04x to Sound CPU\n",machine().describe_context(),data);
294   if (data >= 0x40) {
295      if (data == 0xfe) {
296         /* This should reset the sound MCU and stop audio playback, but here, it */
297         /* chops the first coin insert. So let's only stop any playing melodies. */
298         sslam_play(1, (0x80 | 0x40));       /* Stop playing the melody */
309299      }
310      else if (data == 0) {
311         m_bar = 0;      /* Complete any current bars then stop sequencing */
312         m_melody = 0;
313      }
314300      else {
315         m_sound = sslam_snd_cmd[data];
301         logerror("Unknown command (%02x) sent to the Sound controller\n",data);
302         popmessage("Unknown command (%02x) sent to the Sound controller",data);
303      }
304   }
305   else if (data == 0) {
306      m_bar = 0;      /* Complete any current bars then stop sequencing */
307      m_melody = 0;
308   }
309   else {
310      m_sound = sslam_snd_cmd[data];
316311
317         if (m_sound == 0xff) {
318            popmessage("Unmapped sound command %02x on Bank %02x",data,m_snd_bank);
312      if (m_sound == 0xff) {
313         popmessage("Unmapped sound command %02x on Bank %02x",data,m_snd_bank);
314      }
315      else if (m_sound >= 0x70) {
316         /* These vocals are in bank 1, but a bug in the actual MCU doesn't set the bank */
317//          if (m_snd_bank != 1)
318//          m_oki->set_bank_base((1 * 0x40000));
319//          sslam_snd_bank = 1;
320         sslam_play(0, m_sound);
321      }
322      else if (m_sound >= 0x69) {
323         if (m_snd_bank != 2)
324            m_oki->set_bank_base(2 * 0x40000);
325         m_snd_bank = 2;
326         switch (m_sound)
327         {
328            case 0x69:  m_melody = 5; break;
329            case 0x6b:  m_melody = 6; break;
330            case 0x6c:  m_melody = 7; break;
331            default:    m_melody = 0; m_bar = 0; break; /* Invalid */
319332         }
320         else if (m_sound >= 0x70) {
321            /* These vocals are in bank 1, but a bug in the actual MCU doesn't set the bank */
322//              if (m_snd_bank != 1)
323//                  m_oki->set_bank_base((1 * 0x40000));
324//              sslam_snd_bank = 1;
325            sslam_play(m_oki, 0, m_sound);
333         sslam_play(m_melody, m_sound);
334      }
335      else if (m_sound >= 0x65) {
336         if (m_snd_bank != 1)
337            m_oki->set_bank_base(1 * 0x40000);
338         m_snd_bank = 1;
339         m_melody = 4;
340         sslam_play(m_melody, m_sound);
341      }
342      else if (m_sound >= 0x60) {
343         if (m_snd_bank != 0)
344            m_oki->set_bank_base(0 * 0x40000);
345         m_snd_bank = 0;
346         switch (m_sound)
347         {
348            case 0x60:  m_melody = 1; break;
349            case 0x63:  m_melody = 2; break;
350            case 0x64:  m_melody = 3; break;
351            default:    m_melody = 0; m_bar = 0; break; /* Invalid */
326352         }
327         else if (m_sound >= 0x69) {
328            if (m_snd_bank != 2)
329               m_oki->set_bank_base(2 * 0x40000);
330            m_snd_bank = 2;
331            switch (m_sound)
332            {
333               case 0x69:  m_melody = 5; break;
334               case 0x6b:  m_melody = 6; break;
335               case 0x6c:  m_melody = 7; break;
336               default:    m_melody = 0; m_bar = 0; break; /* Invalid */
337            }
338            sslam_play(m_oki, m_melody, m_sound);
339         }
340         else if (m_sound >= 0x65) {
341            if (m_snd_bank != 1)
342               m_oki->set_bank_base(1 * 0x40000);
343            m_snd_bank = 1;
344            m_melody = 4;
345            sslam_play(m_oki, m_melody, m_sound);
346         }
347         else if (m_sound >= 0x60) {
348            if (m_snd_bank != 0)
349               m_oki->set_bank_base(0 * 0x40000);
350            m_snd_bank = 0;
351            switch (m_sound)
352            {
353               case 0x60:  m_melody = 1; break;
354               case 0x63:  m_melody = 2; break;
355               case 0x64:  m_melody = 3; break;
356               default:    m_melody = 0; m_bar = 0; break; /* Invalid */
357            }
358            sslam_play(m_oki, m_melody, m_sound);
359         }
360         else {
361            sslam_play(m_oki, 0, m_sound);
362         }
353         sslam_play(m_melody, m_sound);
363354      }
355      else {
356         sslam_play(0, m_sound);
357      }
364358   }
365359}
366360
r32353r32354
393387   AM_RANGE(0x300018, 0x300019) AM_READ_PORT("IN4")
394388   AM_RANGE(0x30001a, 0x30001b) AM_READ_PORT("DSW2")
395389   AM_RANGE(0x30001c, 0x30001d) AM_READ_PORT("DSW1")
396   AM_RANGE(0x30001e, 0x30001f) AM_WRITE(sslam_snd_w)
390   AM_RANGE(0x30001e, 0x30001f) AM_WRITE8(sslam_snd_w, 0x00ff)
397391   AM_RANGE(0xf00000, 0xffffff) AM_RAM   /* Main RAM */
398392
399393   AM_RANGE(0x000000, 0xffffff) AM_ROM   /* I don't honestly know where the rom is mirrored .. so all unmapped reads / writes go to rom */
trunk/src/mame/includes/sslam.h
r32353r32354
55public:
66   sslam_state(const machine_config &mconfig, device_type type, const char *tag)
77      : driver_device(mconfig, type, tag),
8      m_maincpu(*this, "maincpu"),
9      m_audiocpu(*this, "audiocpu"),
10      m_oki(*this, "oki"),
11      m_gfxdecode(*this, "gfxdecode"),
12      m_palette(*this, "palette"),
813      m_bg_tileram(*this, "bg_tileram"),
914      m_md_tileram(*this, "md_tileram"),
1015      m_tx_tileram(*this, "tx_tileram"),
1116      m_regs(*this, "regs"),
12      m_spriteram(*this, "spriteram"),
13      m_maincpu(*this, "maincpu"),
14      m_audiocpu(*this, "audiocpu"),
15      m_oki(*this, "oki"),
16      m_gfxdecode(*this, "gfxdecode"),
17      m_palette(*this, "palette") { }
17      m_spriteram(*this, "spriteram") { }
1818
19   
20   required_device<cpu_device> m_maincpu;
21   required_device<cpu_device> m_audiocpu;
22   required_device<okim6295_device> m_oki;
23   required_device<gfxdecode_device> m_gfxdecode;
24   required_device<palette_device> m_palette;
25
26   required_shared_ptr<UINT16> m_bg_tileram;
27   optional_shared_ptr<UINT16> m_md_tileram;
28   optional_shared_ptr<UINT16> m_tx_tileram;
29   required_shared_ptr<UINT16> m_regs;
30   required_shared_ptr<UINT16> m_spriteram;
31   
1932   emu_timer *m_music_timer;
2033
2134   int m_sound;
r32353r32354
2437   int m_track;
2538   int m_snd_bank;
2639
27   required_shared_ptr<UINT16> m_bg_tileram;
28   optional_shared_ptr<UINT16> m_md_tileram;
29   optional_shared_ptr<UINT16> m_tx_tileram;
30   required_shared_ptr<UINT16> m_regs;
31   required_shared_ptr<UINT16> m_spriteram;
32
3340   UINT8 m_oki_control;
3441   UINT8 m_oki_command;
3542   UINT8 m_oki_bank;
r32353r32354
4754   DECLARE_WRITE16_MEMBER(sslam_md_tileram_w);
4855   DECLARE_WRITE16_MEMBER(sslam_bg_tileram_w);
4956   DECLARE_WRITE16_MEMBER(powerbls_bg_tileram_w);
50   DECLARE_WRITE16_MEMBER(sslam_snd_w);
57   DECLARE_WRITE8_MEMBER(sslam_snd_w);
5158   DECLARE_DRIVER_INIT(sslam);
5259   DECLARE_DRIVER_INIT(powerbls);
5360   TILE_GET_INFO_MEMBER(get_sslam_tx_tile_info);
r32353r32354
6067   UINT32 screen_update_powerbls(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6168   TIMER_CALLBACK_MEMBER(music_playback);
6269   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
63   required_device<cpu_device> m_maincpu;
64   required_device<cpu_device> m_audiocpu;
65   required_device<okim6295_device> m_oki;
66   required_device<gfxdecode_device> m_gfxdecode;
67   required_device<palette_device> m_palette;
70   void sslam_play(int track, int data);
6871};

Previous 199869 Revisions Next


© 1997-2024 The MAME Team