mirror of
https://github.com/holub/mame
synced 2025-04-20 23:42:22 +03:00
ics2115 now using devcb2 instead of custom callback (nw)
This commit is contained in:
parent
feae9a4e56
commit
2c5cc77eb7
@ -17,16 +17,10 @@
|
||||
// device type definition
|
||||
const device_type ICS2115 = &device_creator<ics2115_device>;
|
||||
|
||||
void ics2115_device::static_set_irqf(device_t &device, void (*irqf)(device_t *device, int state))
|
||||
{
|
||||
ics2115_device &ics2115 = downcast<ics2115_device &>(device);
|
||||
ics2115.m_irq_cb = irqf;
|
||||
}
|
||||
|
||||
ics2115_device::ics2115_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, ICS2115, "ICS2115", tag, owner, clock, "ics2115", __FILE__),
|
||||
device_sound_interface(mconfig, *this),
|
||||
m_irq_cb(NULL)
|
||||
m_irq_cb(*this)
|
||||
{
|
||||
}
|
||||
|
||||
@ -36,6 +30,8 @@ void ics2115_device::device_start()
|
||||
m_timer[0].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ics2115_device::timer_cb_0),this), this);
|
||||
m_timer[1].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ics2115_device::timer_cb_1),this), this);
|
||||
m_stream = machine().sound().stream_alloc(*this, 0, 2, 33075);
|
||||
|
||||
m_irq_cb.resolve_safe();
|
||||
|
||||
//Exact formula as per patent 5809466
|
||||
//This seems to give the ok fit but it is not good enough.
|
||||
@ -858,8 +854,8 @@ void ics2115_device::recalc_irq()
|
||||
for(int i = 0; (!irq) && (i < 32); i++)
|
||||
irq |= m_voice[i].vol_ctrl.irq_pending && m_voice[i].osc_conf.irq_pending;
|
||||
m_irq_on = irq;
|
||||
if(m_irq_cb)
|
||||
m_irq_cb(this, irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
if(!m_irq_cb.isnull())
|
||||
m_irq_cb(irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER( ics2115_device::timer_cb_0 )
|
||||
|
@ -10,15 +10,12 @@
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define MCFG_ICS2115_ADD(_tag, _clock, _irqf) \
|
||||
MCFG_DEVICE_ADD(_tag, ICS2115, _clock) \
|
||||
MCFG_IRQ_FUNC(_irqf)
|
||||
#define MCFG_ICS2115_REPLACE(_tag, _clock, _irqf) \
|
||||
MCFG_DEVICE_REPLACE(_tag, ICS2115, _clock) \
|
||||
MCFG_IRQ_FUNC(_irqf)
|
||||
#define MCFG_ICS2115_ADD(_tag, _clock) \
|
||||
MCFG_DEVICE_ADD(_tag, ICS2115, _clock)
|
||||
|
||||
#define MCFG_ICS2115_IRQ_CB(_devcb) \
|
||||
devcb = &ics2115_device::set_irq_callback(*device, DEVCB2_##_devcb);
|
||||
|
||||
#define MCFG_IRQ_FUNC(_irqf) \
|
||||
ics2115_device::static_set_irqf(*device, _irqf);
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
@ -95,8 +92,7 @@ public:
|
||||
// construction/destruction
|
||||
ics2115_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
// inline configuration helpers
|
||||
static void static_set_irqf(device_t &device, void (*irqf)(device_t *device, int state));
|
||||
template<class _Object> static devcb2_base &set_irq_callback(device_t &device, _Object object) { return downcast<ics2115_device &>(device).m_irq_cb.set_callback(object); }
|
||||
|
||||
DECLARE_READ8_MEMBER(read);
|
||||
DECLARE_WRITE8_MEMBER(write);
|
||||
@ -119,7 +115,7 @@ protected:
|
||||
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||
|
||||
// internal state
|
||||
void (*m_irq_cb)(device_t *device, int state);
|
||||
devcb2_write_line m_irq_cb;
|
||||
|
||||
UINT8 *m_rom;
|
||||
INT16 m_ulaw[256];
|
||||
|
@ -187,6 +187,7 @@ public:
|
||||
DECLARE_WRITE16_MEMBER(lhb_okibank_w);
|
||||
DECLARE_READ16_MEMBER(ics2115_word_r);
|
||||
DECLARE_WRITE16_MEMBER(ics2115_word_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(sound_irq);
|
||||
DECLARE_DRIVER_INIT(lhbv33c);
|
||||
DECLARE_DRIVER_INIT(drgnwrldv21j);
|
||||
DECLARE_DRIVER_INIT(wlcc);
|
||||
@ -4056,7 +4057,7 @@ MACHINE_CONFIG_END
|
||||
|
||||
|
||||
|
||||
static void sound_irq(device_t *device, int state)
|
||||
WRITE_LINE_MEMBER(igs011_state::sound_irq)
|
||||
{
|
||||
// m_maincpu->set_input_line(3, state);
|
||||
}
|
||||
@ -4074,7 +4075,8 @@ static MACHINE_CONFIG_DERIVED( vbowl, igs011_base )
|
||||
// MCFG_GFXDECODE_ADD("gfxdecode", "palette", igs011_hi)
|
||||
|
||||
MCFG_DEVICE_REMOVE("oki")
|
||||
MCFG_ICS2115_ADD("ics", 0, sound_irq)
|
||||
MCFG_ICS2115_ADD("ics", 0)
|
||||
MCFG_ICS2115_IRQ_CB(WRITELINE(igs011_state, sound_irq))
|
||||
// MCFG_SOUND_ADD("ics", ICS2115, 0)
|
||||
// MCFG_SOUND_CONFIG(vbowl_ics2115_interface)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 5.0)
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
DECLARE_WRITE32_MEMBER(igs_tx_videoram_w);
|
||||
DECLARE_WRITE32_MEMBER(igs_bg_videoram_w);
|
||||
DECLARE_WRITE32_MEMBER(igs_palette32_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(sound_irq);
|
||||
DECLARE_DRIVER_INIT(sdwx);
|
||||
DECLARE_DRIVER_INIT(chessc2);
|
||||
DECLARE_DRIVER_INIT(lhzb4);
|
||||
@ -424,7 +425,7 @@ static MACHINE_CONFIG_START( igs_majhong, igs_m027_state )
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
static void sound_irq( device_t *device, int level )
|
||||
WRITE_LINE_MEMBER(igs_m027_state::sound_irq)
|
||||
{
|
||||
}
|
||||
|
||||
@ -449,7 +450,8 @@ static MACHINE_CONFIG_START( fearless, igs_m027_state )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
MCFG_ICS2115_ADD("ics", 0, sound_irq)
|
||||
MCFG_ICS2115_ADD("ics", 0)
|
||||
MCFG_ICS2115_IRQ_CB(WRITELINE(igs_m027_state, sound_irq))
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 5.0)
|
||||
|
||||
MACHINE_CONFIG_END
|
||||
|
@ -281,18 +281,11 @@ WRITE8_MEMBER(pgm_state::z80_l3_w)
|
||||
soundlatch3_byte_w(space, 0, data);
|
||||
}
|
||||
|
||||
void pgm_sound_irq( device_t *device, int level )
|
||||
WRITE_LINE_MEMBER(pgm_state::pgm_sound_irq)
|
||||
{
|
||||
pgm_state *state = device->machine().driver_data<pgm_state>();
|
||||
state->m_soundcpu->set_input_line(0, level);
|
||||
m_soundcpu->set_input_line(0, state);
|
||||
}
|
||||
|
||||
/*static const ics2115_interface pgm_ics2115_interface =
|
||||
{
|
||||
sound_irq
|
||||
};*/
|
||||
|
||||
|
||||
/*** Memory Maps *************************************************************/
|
||||
|
||||
/*** Z80 (sound CPU)**********************************************************/
|
||||
@ -539,7 +532,8 @@ MACHINE_CONFIG_FRAGMENT( pgmbase )
|
||||
|
||||
/*sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
MCFG_ICS2115_ADD("ics", 0, pgm_sound_irq)
|
||||
MCFG_ICS2115_ADD("ics", 0)
|
||||
MCFG_ICS2115_IRQ_CB(WRITELINE(pgm_state, pgm_sound_irq))
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 5.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
@ -84,6 +84,7 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(z80_l3_w);
|
||||
DECLARE_WRITE16_MEMBER(pgm_tx_videoram_w);
|
||||
DECLARE_WRITE16_MEMBER(pgm_bg_videoram_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pgm_sound_irq);
|
||||
|
||||
DECLARE_DRIVER_INIT(pgm);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user