votrax_sc01_device: converted to devcb2 (nw)

This commit is contained in:
Ivan Vangelista 2014-03-19 12:26:41 +00:00
parent 7721c04301
commit b3c35fa4bc
5 changed files with 17 additions and 57 deletions

View File

@ -98,24 +98,11 @@ votrax_sc01_device::votrax_sc01_device(const machine_config &mconfig, const char
: device_t(mconfig, VOTRAX_SC01, "Votrax SC-01", tag, owner, clock, "votrax", __FILE__),
device_sound_interface(mconfig, *this),
m_stream(NULL),
m_phoneme_timer(NULL)
m_phoneme_timer(NULL),
m_request_cb(*this)
{
}
//-------------------------------------------------
// static_set_interface - configuration helper
// to set the interface
//-------------------------------------------------
void votrax_sc01_device::static_set_interface(device_t &device, const votrax_sc01_interface &interface)
{
votrax_sc01_device &votrax = downcast<votrax_sc01_device &>(device);
static_cast<votrax_sc01_interface &>(votrax) = interface;
}
//**************************************************************************
// READ/WRITE HANDLERS
//**************************************************************************
@ -144,7 +131,7 @@ mame_printf_debug("%s: STROBE %s (F1=%X F2=%X FC=%X F3=%X F2Q=%X VA=%X FA=%X CL=
m_latch_92 = 0;
// clear the request signal
m_request_func(m_request_state = m_internal_request = CLEAR_LINE);
m_request_cb(m_request_state = m_internal_request = CLEAR_LINE);
m_phoneme_timer->adjust(attotime::zero);
}
@ -1145,7 +1132,7 @@ void votrax_sc01_device::device_start()
m_phoneme = 0x3f;
// reset outputs
m_request_func.resolve(m_request_cb, *this);
m_request_cb.resolve_safe();
m_request_state = ASSERT_LINE;
m_internal_request = ASSERT_LINE;
@ -1237,7 +1224,7 @@ void votrax_sc01_device::device_reset()
// reset inputs
m_phoneme = 0x3f;
m_request_func(m_internal_request = m_request_state = ASSERT_LINE);
m_request_cb(m_internal_request = m_request_state = ASSERT_LINE);
// reset timing circuit
m_master_clock = 0;
@ -1356,7 +1343,7 @@ void votrax_sc01_device::device_timer(emu_timer &timer, device_timer_id id, int
if (m_internal_request == ASSERT_LINE)
{
mame_printf_debug("%s: REQUEST\n", timer.machine().time().as_string(3));
m_request_func(m_request_state = ASSERT_LINE);
m_request_cb(m_request_state = ASSERT_LINE);
return;
}

View File

@ -20,36 +20,25 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_VOTRAX_SC01_ADD(_tag, _clock, _interface) \
MCFG_DEVICE_ADD(_tag, VOTRAX_SC01, _clock) \
votrax_sc01_device::static_set_interface(*device, _interface);
#define MCFG_VOTRAX_SC01_REQUEST_CB(_devcb) \
devcb = &votrax_sc01_device::set_request_callback(*device, DEVCB2_##_devcb);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> votrax_sc01_interface
struct votrax_sc01_interface
{
devcb_write_line m_request_cb; // callback for request
};
// ======================> votrax_sc01_device
class votrax_sc01_device : public device_t,
public device_sound_interface,
public votrax_sc01_interface
public device_sound_interface
{
public:
// construction/destruction
votrax_sc01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// static configuration helpers
static void static_set_interface(device_t &device, const votrax_sc01_interface &interface);
template<class _Object> static devcb2_base &set_request_callback(device_t &device, _Object object) { return downcast<votrax_sc01_device &>(device).m_request_cb.set_callback(object); }
// writers
DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE8_MEMBER( inflection_w );
@ -84,7 +73,7 @@ private:
UINT8 m_phoneme; // 6-bit phoneme value
// outputs
devcb_resolved_write_line m_request_func; // request callback
devcb2_write_line m_request_cb; // callback for request
UINT8 m_request_state; // request as seen to the outside world
UINT8 m_internal_request; // request managed by stream timing

View File

@ -451,16 +451,6 @@ static const riot6532_interface gottlieb_riot6532_intf =
};
//-------------------------------------------------
// VOTRAX interface
//-------------------------------------------------
static const votrax_sc01_interface gottlieb_votrax_interface =
{
DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, gottlieb_sound_r1_device, votrax_request)
};
//-------------------------------------------------
// audio CPU map
//-------------------------------------------------
@ -498,7 +488,8 @@ MACHINE_CONFIG_FRAGMENT( gottlieb_sound_r1_with_votrax )
MCFG_FRAGMENT_ADD(gottlieb_sound_r1)
// add the VOTRAX
MCFG_VOTRAX_SC01_ADD("votrax", 720000, gottlieb_votrax_interface)
MCFG_DEVICE_ADD("votrax", VOTRAX_SC01, 720000)
MCFG_VOTRAX_SC01_REQUEST_CB(DEVWRITELINE(DEVICE_SELF_OWNER, gottlieb_sound_r1_device, votrax_request))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.50)
MACHINE_CONFIG_END

View File

@ -256,10 +256,6 @@ static const ay8910_interface ay8910_intf =
DEVCB_NULL // port B write
};
static struct votrax_sc01_interface votrax_interface =
{
};
WRITE8_MEMBER( votrpss_state::kbd_put )
{
m_term_data = data;
@ -294,7 +290,7 @@ static MACHINE_CONFIG_START( votrpss, votrpss_state )
MCFG_SOUND_ADD("ay", AY8910, XTAL_8MHz/4) /* 2.000 MHz, verified */
MCFG_SOUND_CONFIG(ay8910_intf)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MCFG_VOTRAX_SC01_ADD("votrax", 720000, votrax_interface ) /* 720 kHz? needs verify */
MCFG_DEVICE_ADD("votrax", VOTRAX_SC01, 720000) /* 720 kHz? needs verify */
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
/* Devices */

View File

@ -97,10 +97,6 @@ WRITE_LINE_MEMBER(votrtnt_state::write_acia_clock)
m_acia->write_rxc(state);
}
static struct votrax_sc01_interface votrtnt_votrax_interface =
{
DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0)
};
/******************************************************************************
Machine Drivers
@ -128,7 +124,8 @@ static MACHINE_CONFIG_START( votrtnt, votrtnt_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_VOTRAX_SC01_ADD("votrax", 720000, votrtnt_votrax_interface ) /* 720kHz? needs verify */
MCFG_DEVICE_ADD("votrax", VOTRAX_SC01, 720000) /* 720kHz? needs verify */
MCFG_VOTRAX_SC01_REQUEST_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
MACHINE_CONFIG_END