mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
sp0250 also using devcb2 now (nw)
This commit is contained in:
parent
dc7511306f
commit
35083e3a9d
@ -46,7 +46,8 @@ sp0250_device::sp0250_device(const machine_config &mconfig, const char *tag, dev
|
||||
m_RNG(0),
|
||||
m_stream(NULL),
|
||||
m_voiced(0),
|
||||
m_fifo_pos(0)
|
||||
m_fifo_pos(0),
|
||||
m_drq(*this)
|
||||
{
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
@ -62,38 +63,17 @@ sp0250_device::sp0250_device(const machine_config &mconfig, const char *tag, dev
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_config_complete - perform any
|
||||
// operations now that the configuration is
|
||||
// complete
|
||||
//-------------------------------------------------
|
||||
|
||||
void sp0250_device::device_config_complete()
|
||||
{
|
||||
// inherit a copy of the static data
|
||||
const sp0250_interface *intf = reinterpret_cast<const sp0250_interface *>(static_config());
|
||||
if (intf != NULL)
|
||||
*static_cast<sp0250_interface *>(this) = *intf;
|
||||
|
||||
// or initialize to defaults if none provided
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void sp0250_device::device_start()
|
||||
{
|
||||
const sp0250_interface *intf = reinterpret_cast<const sp0250_interface *>(static_config());
|
||||
|
||||
m_RNG = 1;
|
||||
m_drq = ( intf!= NULL) ? m_drq_callback : NULL;
|
||||
if (m_drq != NULL)
|
||||
m_drq.resolve_safe();
|
||||
if (!m_drq.isnull())
|
||||
{
|
||||
m_drq(this, ASSERT_LINE);
|
||||
m_drq( ASSERT_LINE);
|
||||
machine().scheduler().timer_pulse(attotime::from_hz(clock()) * CLOCK_DIVIDER, timer_expired_delegate(FUNC(sp0250_device::timer_tick), this));
|
||||
}
|
||||
|
||||
@ -159,8 +139,7 @@ void sp0250_device::load_values()
|
||||
m_filter[5].B = sp0250_gc(m_fifo[13]);
|
||||
m_filter[5].F = sp0250_gc(m_fifo[14]);
|
||||
m_fifo_pos = 0;
|
||||
if (m_drq != NULL)
|
||||
m_drq(this, ASSERT_LINE);
|
||||
m_drq(ASSERT_LINE);
|
||||
|
||||
m_pcount = 0;
|
||||
m_rcount = 0;
|
||||
@ -182,8 +161,8 @@ WRITE8_MEMBER( sp0250_device::write )
|
||||
if (m_fifo_pos != 15)
|
||||
{
|
||||
m_fifo[m_fifo_pos++] = data;
|
||||
if (m_fifo_pos == 15 && m_drq != NULL)
|
||||
m_drq(this, CLEAR_LINE);
|
||||
if (m_fifo_pos == 15)
|
||||
m_drq(CLEAR_LINE);
|
||||
}
|
||||
else
|
||||
logerror("%s: overflow SP0250 FIFO\n", machine().describe_context());
|
||||
|
@ -3,26 +3,20 @@
|
||||
#ifndef __SP0250_H__
|
||||
#define __SP0250_H__
|
||||
|
||||
|
||||
struct sp0250_interface {
|
||||
void (*m_drq_callback)(device_t *device, int state);
|
||||
};
|
||||
|
||||
|
||||
class sp0250_device : public device_t,
|
||||
public device_sound_interface,
|
||||
public sp0250_interface
|
||||
public device_sound_interface
|
||||
{
|
||||
public:
|
||||
sp0250_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
~sp0250_device() {}
|
||||
|
||||
template<class _Object> static devcb2_base &set_drq_callback(device_t &device, _Object object) { return downcast<sp0250_device &>(device).m_drq.set_callback(object); }
|
||||
|
||||
DECLARE_WRITE8_MEMBER( write );
|
||||
UINT8 drq_r();
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
|
||||
// sound stream update overrides
|
||||
@ -40,7 +34,7 @@ private:
|
||||
int m_voiced;
|
||||
UINT8 m_fifo[15];
|
||||
int m_fifo_pos;
|
||||
void (*m_drq)(device_t *device, int state);
|
||||
devcb2_write_line m_drq;
|
||||
|
||||
struct
|
||||
{
|
||||
@ -54,5 +48,9 @@ private:
|
||||
|
||||
extern const device_type SP0250;
|
||||
|
||||
#define MCFG_SP0250_DRQ_CALLBACK(_write) \
|
||||
devcb = &sp0250_device::set_drq_callback(*device, DEVCB2_##_write);
|
||||
|
||||
|
||||
|
||||
#endif /* __SP0250_H__ */
|
||||
|
@ -80,16 +80,6 @@ speech_sound_device::speech_sound_device(const machine_config &mconfig, const ch
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_config_complete - perform any
|
||||
// operations now that the configuration is
|
||||
// complete
|
||||
//-------------------------------------------------
|
||||
|
||||
void speech_sound_device::device_config_complete()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
@ -152,11 +142,9 @@ WRITE8_MEMBER( speech_sound_device::p2_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void speech_sound_device::drq_w(device_t *device, int level)
|
||||
WRITE_LINE_MEMBER(speech_sound_device::drq_w)
|
||||
{
|
||||
speech_sound_device *speech = device->machine().device<speech_sound_device>("segaspeech");
|
||||
|
||||
speech->m_drq = (level == ASSERT_LINE);
|
||||
m_drq = (state == ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -226,20 +214,6 @@ static ADDRESS_MAP_START( speech_portmap, AS_IO, 8, driver_device )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Speech board sound interfaces
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static const struct sp0250_interface sp0250_interface =
|
||||
{
|
||||
speech_sound_device::drq_w
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Speech board machine drivers
|
||||
@ -256,7 +230,7 @@ MACHINE_CONFIG_FRAGMENT( sega_speech_board )
|
||||
/* sound hardware */
|
||||
MCFG_SOUND_ADD("segaspeech", SEGASPEECH, 0)
|
||||
MCFG_SOUND_ADD("speech", SP0250, SPEECH_MASTER_CLOCK)
|
||||
MCFG_SOUND_CONFIG(sp0250_interface)
|
||||
MCFG_SP0250_DRQ_CALLBACK(DEVWRITELINE("segaspeech", speech_sound_device, drq_w))
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
@ -25,11 +25,10 @@ public:
|
||||
DECLARE_WRITE8_MEMBER( p1_w );
|
||||
DECLARE_WRITE8_MEMBER( p2_w );
|
||||
|
||||
static void drq_w(device_t *device, int level);
|
||||
DECLARE_WRITE_LINE_MEMBER(drq_w);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
|
||||
// sound stream update overrides
|
||||
|
Loading…
Reference in New Issue
Block a user