c6280: converted to use inline config. nw.

This commit is contained in:
Fabio Priuli 2014-04-11 04:52:34 +00:00
parent 1dfb6f9135
commit cc0b2f6102
9 changed files with 25 additions and 79 deletions

View File

@ -248,17 +248,8 @@ const device_type C6280 = &device_creator<c6280_device>;
c6280_device::c6280_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, C6280, "HuC6280", tag, owner, clock, "c6280", __FILE__),
device_sound_interface(mconfig, *this)
{
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void c6280_device::device_config_complete()
device_sound_interface(mconfig, *this),
m_cpudevice(*this)
{
}
@ -273,8 +264,6 @@ void c6280_device::device_start()
/* Create stereo stream */
m_stream = machine().sound().stream_alloc(*this, 0, 2, rate, this);
const c6280_interface *intf = (const c6280_interface *)static_config();
/* Loudest volume level for table */
double level = 65535.0 / 6.0 / 32.0;
@ -285,12 +274,6 @@ void c6280_device::device_start()
m_lfo_control = 0;
memset(m_channel, 0, sizeof(channel) * 8);
m_cpudevice = machine().device<h6280_device>(intf->cpu);
if (m_cpudevice == NULL)
{
fatalerror("c6280_init: no CPU found with tag of '%s'\n", tag());
}
/* Make waveform frequency table */
for (int i = 0; i < 4096; i += 1)
{
@ -321,14 +304,14 @@ void c6280_device::device_start()
save_item(NAME(m_lfo_control));
for (int chan = 0; chan < 8; chan++)
{
state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_frequency);
state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_control);
state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_balance);
state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_waveform);
state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_index);
state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_dda);
state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_noise_control);
state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_noise_counter);
state_save_register_item(machine(), "c6280", NULL, chan, m_channel[chan].m_counter);
save_item(NAME(m_channel[chan].m_frequency), chan);
save_item(NAME(m_channel[chan].m_control), chan);
save_item(NAME(m_channel[chan].m_balance), chan);
save_item(NAME(m_channel[chan].m_waveform), chan);
save_item(NAME(m_channel[chan].m_index), chan);
save_item(NAME(m_channel[chan].m_dda), chan);
save_item(NAME(m_channel[chan].m_noise_control), chan);
save_item(NAME(m_channel[chan].m_noise_counter), chan);
save_item(NAME(m_channel[chan].m_counter), chan);
}
}

View File

@ -5,24 +5,20 @@
#include "cpu/h6280/h6280.h"
struct c6280_interface
{
const char * cpu;
};
class c6280_device : public device_t,
public device_sound_interface
{
public:
c6280_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
static void set_devicecpu_tag(device_t &device, const char *tag) { downcast<c6280_device &>(device).m_cpudevice.set_tag(tag); }
// read/write
DECLARE_READ8_MEMBER( c6280_r );
DECLARE_WRITE8_MEMBER( c6280_w );
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
// sound stream update overrides
@ -43,7 +39,7 @@ private:
// internal state
sound_stream *m_stream;
h6280_device *m_cpudevice;
required_device<h6280_device> m_cpudevice;
UINT8 m_select;
UINT8 m_balance;
UINT8 m_lfo_frequency;
@ -56,5 +52,8 @@ private:
extern const device_type C6280;
#define MCFG_C6280_CPU(_tag) \
c6280_device::set_devicecpu_tag(*device, "^"_tag);
#endif /* __C6280_H__ */

View File

@ -212,11 +212,6 @@ GFXDECODE_END
/******************************************************************************/
static const c6280_interface c6280_config =
{
"audiocpu"
};
static MACHINE_CONFIG_START( battlera, battlera_state )
/* basic machine hardware */
@ -255,7 +250,7 @@ static MACHINE_CONFIG_START( battlera, battlera_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.85)
MCFG_SOUND_ADD("c6280", C6280, 21477270/6)
MCFG_SOUND_CONFIG(c6280_config)
MCFG_C6280_CPU("audiocpu")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.60)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.60)
MACHINE_CONFIG_END

View File

@ -175,11 +175,6 @@ static INPUT_PORTS_START(ggconnie)
PORT_DIPSETTING(0x00, DEF_STR(On) )
INPUT_PORTS_END
static const c6280_interface c6280_config =
{
"maincpu"
};
static MACHINE_CONFIG_START( ggconnie, ggconnie_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", H6280, PCE_MAIN_CLOCK/3)
@ -221,7 +216,7 @@ static MACHINE_CONFIG_START( ggconnie, ggconnie_state )
MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker")
MCFG_SOUND_ADD("c6280", C6280, PCE_MAIN_CLOCK/6)
MCFG_SOUND_CONFIG(c6280_config)
MCFG_C6280_CPU("maincpu")
MCFG_SOUND_ROUTE(0, "lspeaker", 1.00)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.00)

View File

@ -169,11 +169,6 @@ static I8155_INTERFACE(i8155_intf)
DEVCB_DRIVER_LINE_MEMBER(paranoia_state,paranoia_i8155_timer_out)
};
static const c6280_interface c6280_config =
{
"maincpu"
};
static MACHINE_CONFIG_START( paranoia, paranoia_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", H6280, PCE_MAIN_CLOCK/3)
@ -208,7 +203,7 @@ static MACHINE_CONFIG_START( paranoia, paranoia_state )
MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker")
MCFG_SOUND_ADD("c6280", C6280, PCE_MAIN_CLOCK/6)
MCFG_SOUND_CONFIG(c6280_config)
MCFG_C6280_CPU("maincpu")
MCFG_SOUND_ROUTE(0, "lspeaker", 1.00)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.00)

View File

@ -361,11 +361,6 @@ static I8155_INTERFACE(i8155_intf)
DEVCB_DRIVER_LINE_MEMBER(tourvision_state,tourvision_timer_out)
};
static const c6280_interface c6280_config =
{
"maincpu"
};
WRITE_LINE_MEMBER(tourvision_state::pce_irq_changed)
{
m_maincpu->set_input_line(0, state);
@ -401,7 +396,7 @@ static MACHINE_CONFIG_START( tourvision, tourvision_state )
MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker")
MCFG_SOUND_ADD("c6280", C6280, PCE_MAIN_CLOCK/6)
MCFG_SOUND_CONFIG(c6280_config)
MCFG_C6280_CPU("maincpu")
MCFG_SOUND_ROUTE(0, "lspeaker", 1.00)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.00)

View File

@ -300,11 +300,6 @@ static ADDRESS_MAP_START( pce_io , AS_IO, 8, uapce_state )
AM_RANGE( 0x00, 0x03) AM_DEVREADWRITE( "huc6270", huc6270_device, read, write )
ADDRESS_MAP_END
static const c6280_interface c6280_config =
{
"maincpu"
};
WRITE_LINE_MEMBER(uapce_state::pce_irq_changed)
{
m_maincpu->set_input_line(0, state);
@ -339,7 +334,7 @@ static MACHINE_CONFIG_START( uapce, uapce_state )
MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker")
MCFG_SOUND_ADD("c6280", C6280, PCE_MAIN_CLOCK/6)
MCFG_SOUND_CONFIG(c6280_config)
MCFG_C6280_CPU("maincpu")
MCFG_SOUND_ROUTE(0, "lspeaker", 0.5)
MCFG_SOUND_ROUTE(1, "rspeaker", 0.5)

View File

@ -284,11 +284,6 @@ static ADDRESS_MAP_START( sgx_io , AS_IO, 8, pce_state )
ADDRESS_MAP_END
static const c6280_interface c6280_config =
{
"maincpu"
};
UINT32 pce_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_huc6260->video_update( bitmap, cliprect );
@ -337,7 +332,7 @@ static MACHINE_CONFIG_START( pce_common, pce_state )
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_SOUND_ADD(C6280_TAG, C6280, MAIN_CLOCK/6)
MCFG_SOUND_CONFIG(c6280_config)
MCFG_C6280_CPU("maincpu")
MCFG_SOUND_ROUTE( 0, "lspeaker", 1.00 )
MCFG_SOUND_ROUTE( 1, "rspeaker", 1.00 )
@ -402,7 +397,7 @@ static MACHINE_CONFIG_START( sgx, pce_state )
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_SOUND_ADD(C6280_TAG, C6280, MAIN_CLOCK/6)
MCFG_SOUND_CONFIG(c6280_config)
MCFG_C6280_CPU("maincpu")
MCFG_SOUND_ROUTE(0, "lspeaker", 1.00)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.00)

View File

@ -514,12 +514,6 @@ static const floppy_interface x1_floppy_interface =
};
#if 0
static const c6280_interface c6280_config =
{
"pce_cpu"
};
#endif
static MACHINE_CONFIG_START( x1twin, x1twin_state )
/* basic machine hardware */
@ -599,7 +593,7 @@ static MACHINE_CONFIG_START( x1twin, x1twin_state )
#if 0
MCFG_SOUND_ADD("c6280", C6280, PCE_MAIN_CLOCK/6)
// MCFG_SOUND_CONFIG(c6280_config)
MCFG_C6280_CPU("pce_cpu")
MCFG_SOUND_ROUTE(0, "pce_l", 0.5)
MCFG_SOUND_ROUTE(1, "pce_r", 0.5)
#endif