few small msm5205 adpcm lookup cleanups (nw)

This commit is contained in:
Miodrag Milanovic 2013-04-16 10:06:16 +00:00
parent c5973296bb
commit 08c897ba42
9 changed files with 54 additions and 46 deletions

View File

@ -87,7 +87,8 @@ class chinagat_state : public ddragon_state
{
public:
chinagat_state(const machine_config &mconfig, device_type type, const char *tag)
: ddragon_state(mconfig, type, tag) { };
: ddragon_state(mconfig, type, tag),
m_adpcm(*this, "adpcm") { };
TIMER_DEVICE_CALLBACK_MEMBER(chinagat_scanline);
DECLARE_DRIVER_INIT(chinagat);
@ -106,6 +107,7 @@ public:
DECLARE_READ8_MEMBER( saiyugoub1_m5205_irq_r );
DECLARE_WRITE_LINE_MEMBER(saiyugoub1_m5205_irq_w);
DECLARE_WRITE_LINE_MEMBER(chinagat_irq_handler);
optional_device<msm5205_device> m_adpcm;
};
@ -237,8 +239,7 @@ WRITE8_MEMBER(chinagat_state::saiyugoub1_adpcm_rom_addr_w )
}
WRITE8_MEMBER(chinagat_state::saiyugoub1_adpcm_control_w )
{
device_t *device = machine().device("adpcm");
{
/* i8748 Port 2 write */
UINT8 *saiyugoub1_adpcm_rom = memregion("adpcm")->base();
@ -246,7 +247,7 @@ WRITE8_MEMBER(chinagat_state::saiyugoub1_adpcm_control_w )
{
logerror("ADPCM output disabled\n");
m_pcm_nibble = 0x0f;
msm5205_reset_w(device, 1);
msm5205_reset_w(m_adpcm, 1);
}
else
{
@ -275,7 +276,7 @@ WRITE8_MEMBER(chinagat_state::saiyugoub1_adpcm_control_w )
if (((m_i8748_P2 & 0xc) >= 8) && ((data & 0xc) == 4))
{
msm5205_data_w (device, m_pcm_nibble);
msm5205_data_w (m_adpcm, m_pcm_nibble);
logerror("Writing %02x to m5205\n", m_pcm_nibble);
}
logerror("$ROM=%08x P1=%02x P2=%02x Prev_P2=%02x Nibble=%1x PCM_data=%02x\n", m_adpcm_addr, m_i8748_P1, data, m_i8748_P2, m_pcm_shift, m_pcm_nibble);
@ -290,16 +291,15 @@ WRITE8_MEMBER(chinagat_state::saiyugoub1_m5205_clk_w )
/* to the xtal pins of the MSM5205 */
/* Actually, T0 output clk mode is not supported by the i8048 core */
#if 0
device_t *device = machine().device("adpcm");
#if 0
m_m5205_clk++;
if (m_m5205_clk == 8)
{
msm5205_vclk_w(device, 1); /* ??? */
msm5205_vclk_w(m_adpcm, 1); /* ??? */
m_m5205_clk = 0;
}
else
msm5205_vclk_w(device, 0); /* ??? */
msm5205_vclk_w(m_adpcm, 0); /* ??? */
#endif
}

View File

@ -53,7 +53,8 @@ public:
chinsan_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_video(*this, "video"),
m_maincpu(*this, "maincpu") { }
m_maincpu(*this, "maincpu"),
m_adpcm(*this, "adpcm") { }
/* memory pointers */
required_shared_ptr<UINT8> m_video;
@ -79,6 +80,7 @@ public:
UINT32 screen_update_chinsan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(chin_adpcm_int);
required_device<cpu_device> m_maincpu;
required_device<msm5205_device> m_adpcm;
};
@ -236,10 +238,9 @@ READ8_MEMBER(chinsan_state::chinsan_input_port_1_r)
WRITE8_MEMBER(chinsan_state::chin_adpcm_w)
{
device_t *device = machine().device("adpcm");
m_adpcm_pos = (data & 0xff) * 0x100;
m_adpcm_idle = 0;
msm5205_reset_w(device, 0);
msm5205_reset_w(m_adpcm, 0);
}
/*************************************
@ -543,7 +544,7 @@ WRITE_LINE_MEMBER(chinsan_state::chin_adpcm_int)
if (m_adpcm_pos >= 0x10000 || m_adpcm_idle)
{
//m_adpcm_idle = 1;
msm5205_reset_w(machine().device("adpcm"), 1);
msm5205_reset_w(m_adpcm, 1);
m_trigger = 0;
}
else
@ -551,7 +552,7 @@ WRITE_LINE_MEMBER(chinsan_state::chin_adpcm_int)
UINT8 *ROM = memregion("adpcm")->base();
m_adpcm_data = ((m_trigger ? (ROM[m_adpcm_pos] & 0x0f) : (ROM[m_adpcm_pos] & 0xf0) >> 4));
msm5205_data_w(machine().device("adpcm"), m_adpcm_data & 0xf);
msm5205_data_w(m_adpcm, m_adpcm_data & 0xf);
m_trigger ^= 1;
if(m_trigger == 0)
{

View File

@ -149,9 +149,6 @@ MACHINE_START_MEMBER(ddragon_state,ddragon)
/* configure banks */
membank("bank1")->configure_entries(0, 8, memregion("maincpu")->base() + 0x10000, 0x4000);
m_adpcm_1 = machine().device("adpcm1");
m_adpcm_2 = machine().device("adpcm2");
/* register for save states */
save_item(NAME(m_dd_sub_cpu_busy));
save_item(NAME(m_scrollx_hi));
@ -410,8 +407,8 @@ WRITE8_MEMBER(ddragon_state::ddragon_spriteram_w)
WRITE8_MEMBER(ddragon_state::dd_adpcm_w)
{
device_t *adpcm = (offset & 1) ? m_adpcm_2 : m_adpcm_1;
int chip = (adpcm == m_adpcm_1) ? 0 : 1;
device_t *adpcm = (offset & 1) ? m_adpcm2 : m_adpcm1;
int chip = (adpcm == m_adpcm1) ? 0 : 1;
switch (offset / 2)
{
@ -458,12 +455,12 @@ void ddragon_state::dd_adpcm_int( device_t *device, int chip )
WRITE_LINE_MEMBER(ddragon_state::dd_adpcm_int_1)
{
dd_adpcm_int(m_adpcm_1,0);
dd_adpcm_int(m_adpcm1,0);
}
WRITE_LINE_MEMBER(ddragon_state::dd_adpcm_int_2)
{
dd_adpcm_int(m_adpcm_2,0);
dd_adpcm_int(m_adpcm2,0);
}

View File

@ -104,7 +104,8 @@ class jantotsu_state : public driver_device
public:
jantotsu_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu") { }
m_maincpu(*this, "maincpu"),
m_adpcm(*this, "adpcm") { }
/* sound-related */
UINT32 m_adpcm_pos;
@ -134,6 +135,7 @@ public:
UINT32 screen_update_jantotsu(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(jan_adpcm_int);
required_device<cpu_device> m_maincpu;
required_device<msm5205_device> m_adpcm;
};
@ -270,14 +272,12 @@ READ8_MEMBER(jantotsu_state::jantotsu_dsw2_r)
WRITE8_MEMBER(jantotsu_state::jan_adpcm_w)
{
device_t *device = machine().device("adpcm");
switch (offset)
{
case 0:
m_adpcm_pos = (data & 0xff) * 0x100;
m_adpcm_idle = 0;
msm5205_reset_w(device, 0);
msm5205_reset_w(m_adpcm, 0);
/* I don't think that this will ever happen, it's there just to be sure
(i.e. I'll probably never do a "nagare" in my entire life ;-) ) */
if(data & 0x20)
@ -287,7 +287,7 @@ WRITE8_MEMBER(jantotsu_state::jan_adpcm_w)
/*same write as port 2? MSM sample ack? */
case 1:
// m_adpcm_idle = 1;
// msm5205_reset_w(device, 1);
// msm5205_reset_w(m_adpcm, 1);
// printf("%02x 1\n", data);
break;
}
@ -298,7 +298,7 @@ WRITE_LINE_MEMBER(jantotsu_state::jan_adpcm_int)
if (m_adpcm_pos >= 0x10000 || m_adpcm_idle)
{
//m_adpcm_idle = 1;
msm5205_reset_w(machine().device("adpcm"), 1);
msm5205_reset_w(m_adpcm, 1);
m_adpcm_trigger = 0;
}
else
@ -306,7 +306,7 @@ WRITE_LINE_MEMBER(jantotsu_state::jan_adpcm_int)
UINT8 *ROM = memregion("adpcm")->base();
m_adpcm_data = ((m_adpcm_trigger ? (ROM[m_adpcm_pos] & 0x0f) : (ROM[m_adpcm_pos] & 0xf0) >> 4));
msm5205_data_w(machine().device("adpcm"), m_adpcm_data & 0xf);
msm5205_data_w(m_adpcm, m_adpcm_data & 0xf);
m_adpcm_trigger ^= 1;
if (m_adpcm_trigger == 0)
{

View File

@ -67,7 +67,9 @@ class kungfur_state : public driver_device
public:
kungfur_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu") { }
m_maincpu(*this, "maincpu"),
m_adpcm1(*this, "adpcm1"),
m_adpcm2(*this, "adpcm2") { }
UINT8 m_latch[3];
UINT8 m_control;
@ -88,6 +90,8 @@ public:
DECLARE_WRITE_LINE_MEMBER(kfr_adpcm1_int);
DECLARE_WRITE_LINE_MEMBER(kfr_adpcm2_int);
required_device<cpu_device> m_maincpu;
required_device<msm5205_device> m_adpcm1;
required_device<msm5205_device> m_adpcm2;
};
@ -166,13 +170,13 @@ WRITE8_MEMBER(kungfur_state::kungfur_control_w)
// d6-d7: sound trigger (edge)
if ((data ^ m_control) & 0x40)
{
msm5205_reset_w(machine().device("adpcm1"), data >> 6 & 1);
msm5205_reset_w(m_adpcm1, data >> 6 & 1);
m_adpcm_pos[0] = m_adpcm_data[0] * 0x400;
m_adpcm_sel[0] = 0;
}
if ((data ^ m_control) & 0x80)
{
msm5205_reset_w(machine().device("adpcm2"), data >> 7 & 1);
msm5205_reset_w(m_adpcm2, data >> 7 & 1);
m_adpcm_pos[1] = m_adpcm_data[1] * 0x400;
m_adpcm_sel[1] = 0;
}
@ -197,7 +201,7 @@ WRITE_LINE_MEMBER(kungfur_state::kfr_adpcm1_int)
UINT8 *ROM = memregion("adpcm1")->base();
UINT8 data = ROM[m_adpcm_pos[0] & 0x1ffff];
msm5205_data_w(machine().device("adpcm1"), m_adpcm_sel[0] ? data & 0xf : data >> 4 & 0xf);
msm5205_data_w(m_adpcm1, m_adpcm_sel[0] ? data & 0xf : data >> 4 & 0xf);
m_adpcm_pos[0] += m_adpcm_sel[0];
m_adpcm_sel[0] ^= 1;
}
@ -207,7 +211,7 @@ WRITE_LINE_MEMBER(kungfur_state::kfr_adpcm2_int)
UINT8 *ROM = memregion("adpcm2")->base();
UINT8 data = ROM[m_adpcm_pos[1] & 0x3ffff];
msm5205_data_w(machine().device("adpcm2"), m_adpcm_sel[1] ? data & 0xf : data >> 4 & 0xf);
msm5205_data_w(m_adpcm2, m_adpcm_sel[1] ? data & 0xf : data >> 4 & 0xf);
m_adpcm_pos[1] += m_adpcm_sel[1];
m_adpcm_sel[1] ^= 1;
}

View File

@ -206,7 +206,8 @@ public:
: driver_device(mconfig, type, tag),
m_audiocpu(*this, "audiocpu"),
m_v9938(*this, "v9938"),
m_maincpu(*this, "maincpu") { }
m_maincpu(*this, "maincpu"),
m_adpcm(*this, "adpcm") { }
required_device<cpu_device> m_audiocpu;
required_device<v9938_device> m_v9938;
@ -231,6 +232,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(kurukuru_msm5205_vck);
DECLARE_WRITE_LINE_MEMBER(kurukuru_vdp_interrupt);
required_device<cpu_device> m_maincpu;
required_device<msm5205_device> m_adpcm;
};
#define MAIN_CLOCK XTAL_21_4772MHz
@ -289,7 +291,7 @@ void kurukuru_state::update_sound_irq(UINT8 cause)
WRITE_LINE_MEMBER(kurukuru_state::kurukuru_msm5205_vck)
{
update_sound_irq(m_sound_irq_cause | 2);
msm5205_data_w(machine().device("adpcm"), m_adpcm_data);
msm5205_data_w(m_adpcm, m_adpcm_data);
}
@ -384,7 +386,6 @@ WRITE8_MEMBER(kurukuru_state::kurukuru_adpcm_data_w)
WRITE8_MEMBER(kurukuru_state::kurukuru_adpcm_reset_w)
{
device_t *device = machine().device("adpcm");
/*
6-bit latch. only 4 connected...
bit 0 = RESET
@ -392,8 +393,8 @@ WRITE8_MEMBER(kurukuru_state::kurukuru_adpcm_reset_w)
bit 2 = S2
bit 3 = S1
*/
msm5205_playmode_w(device, BITSWAP8((data>>1), 7,6,5,4,3,0,1,2));
msm5205_reset_w(device, data & 1);
msm5205_playmode_w(m_adpcm, BITSWAP8((data>>1), 7,6,5,4,3,0,1,2));
msm5205_reset_w(m_adpcm, data & 1);
}
READ8_MEMBER(kurukuru_state::kurukuru_soundlatch_r)

View File

@ -188,7 +188,7 @@ WRITE8_MEMBER(mermaid_state::rougien_sample_playback_w)
m_adpcm_pos = m_adpcm_rom_sel*0x1000;
m_adpcm_end = m_adpcm_pos+0x1000;
m_adpcm_idle = 0;
msm5205_reset_w(machine().device("adpcm"), 0);
msm5205_reset_w(m_adpcm, 0);
}
m_adpcm_play_reg = data & 1;
@ -403,7 +403,7 @@ WRITE_LINE_MEMBER(mermaid_state::rougien_adpcm_int)
if (m_adpcm_pos >= m_adpcm_end || m_adpcm_idle)
{
//m_adpcm_idle = 1;
msm5205_reset_w(machine().device("adpcm"), 1);
msm5205_reset_w(m_adpcm, 1);
m_adpcm_trigger = 0;
}
else
@ -411,7 +411,7 @@ WRITE_LINE_MEMBER(mermaid_state::rougien_adpcm_int)
UINT8 *ROM = memregion("adpcm")->base();
m_adpcm_data = ((m_adpcm_trigger ? (ROM[m_adpcm_pos] & 0x0f) : (ROM[m_adpcm_pos] & 0xf0) >> 4));
msm5205_data_w(machine().device("adpcm"), m_adpcm_data & 0xf);
msm5205_data_w(m_adpcm, m_adpcm_data & 0xf);
m_adpcm_trigger ^= 1;
if (m_adpcm_trigger == 0)
{

View File

@ -3,7 +3,7 @@
Double Dragon & Double Dragon II (but also China Gate)
*************************************************************************/
#include "sound/msm5205.h"
class ddragon_state : public driver_device
{
@ -19,7 +19,9 @@ public:
m_darktowr_mcu_ports(*this, "darktowr_mcu"),
m_maincpu(*this, "maincpu"),
m_soundcpu(*this, "soundcpu"),
m_subcpu(*this, "sub") { }
m_subcpu(*this, "sub"),
m_adpcm1(*this, "adpcm1"),
m_adpcm2(*this, "adpcm2") { }
/* memory pointers */
optional_shared_ptr<UINT8> m_rambase;
@ -65,8 +67,8 @@ public:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_soundcpu;
optional_device<cpu_device> m_subcpu;
device_t *m_adpcm_1;
device_t *m_adpcm_2;
optional_device<msm5205_device> m_adpcm1;
optional_device<msm5205_device> m_adpcm2;
DECLARE_WRITE_LINE_MEMBER(irq_handler);
DECLARE_WRITE8_MEMBER(ddragon_bgvideoram_w);
DECLARE_WRITE8_MEMBER(ddragon_fgvideoram_w);

View File

@ -3,6 +3,7 @@
Mermaid
*************************************************************************/
#include "sound/msm5205.h"
class mermaid_state : public driver_device
{
@ -16,7 +17,8 @@ public:
m_spriteram(*this, "spriteram"),
m_colorram(*this, "colorram"),
m_ay8910_enable(*this, "ay8910_enable"),
m_maincpu(*this, "maincpu"){ }
m_maincpu(*this, "maincpu"),
m_adpcm(*this, "adpcm"){ }
/* memory pointers */
required_shared_ptr<UINT8> m_videoram2;
@ -51,6 +53,7 @@ public:
/* devices */
required_device<cpu_device> m_maincpu;
optional_device<msm5205_device> m_adpcm;
device_t *m_ay1;
device_t *m_ay2;