(MESS) Mac: convert ASC to devcb2 IRQ output, some minor modernization. [R. Belmont]

This commit is contained in:
R. Belmont 2013-07-29 04:27:57 +00:00
parent 80291551c5
commit fbe209f09c
5 changed files with 41 additions and 66 deletions

View File

@ -46,8 +46,8 @@ const device_type ASC = &device_creator<asc_device>;
asc_device::asc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, ASC, "ASC", tag, owner, clock, "asc", __FILE__),
device_sound_interface(mconfig, *this),
m_chip_type(0),
m_irq_cb(NULL)
write_irq(*this),
m_chip_type(0)
{
}
@ -63,18 +63,6 @@ void asc_device::static_set_type(device_t &device, int type)
asc.m_chip_type = type;
}
//-------------------------------------------------
// static_set_type - configuration helper to set
// the IRQ callback
//-------------------------------------------------
void asc_device::static_set_irqf(device_t &device, void (*irqf)(device_t *device, int state))
{
asc_device &asc = downcast<asc_device &>(device);
asc.m_irq_cb = irqf;
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@ -99,6 +87,8 @@ void asc_device::device_start()
save_item(NAME(m_regs));
save_item(NAME(m_phase));
save_item(NAME(m_incr));
write_irq.resolve_safe();
}
@ -183,10 +173,7 @@ void asc_device::sound_stream_update(sound_stream &stream, stream_sample_t **inp
{
m_regs[R_FIFOSTAT-0x800] |= 0x4; // fifo less than half full
m_regs[R_FIFOSTAT-0x800] |= 0x8; // just pass the damn test
if (m_irq_cb)
{
m_irq_cb(this, 1);
}
write_irq(ASSERT_LINE);
}
break;
@ -194,35 +181,23 @@ void asc_device::sound_stream_update(sound_stream &stream, stream_sample_t **inp
if (m_fifo_cap_a == 0x1ff)
{
m_regs[R_FIFOSTAT-0x800] |= 1; // fifo A half-empty
if (m_irq_cb)
{
m_irq_cb(this, 1);
}
write_irq(ASSERT_LINE);
}
else if (m_fifo_cap_a == 0x1) // fifo A fully empty
{
m_regs[R_FIFOSTAT-0x800] |= 2; // fifo A empty
if (m_irq_cb)
{
m_irq_cb(this, 1);
}
write_irq(ASSERT_LINE);
}
if (m_fifo_cap_b == 0x1ff)
{
m_regs[R_FIFOSTAT-0x800] |= 4; // fifo B half-empty
if (m_irq_cb)
{
m_irq_cb(this, 1);
}
write_irq(ASSERT_LINE);
}
else if (m_fifo_cap_b == 0x1) // fifo B fully empty
{
m_regs[R_FIFOSTAT-0x800] |= 8; // fifo B empty
if (m_irq_cb)
{
m_irq_cb(this, 1);
}
write_irq(ASSERT_LINE);
}
break;
}
@ -356,10 +331,7 @@ READ8_MEMBER( asc_device::read )
m_regs[R_FIFOSTAT-0x800] = 0;
// reading this clears interrupts
if (m_irq_cb)
{
m_irq_cb(this, 0);
}
write_irq(CLEAR_LINE);
return rv;

View File

@ -51,7 +51,7 @@ enum
#define MCFG_ASC_TYPE(_type) \
asc_device::static_set_type(*device, _type);
#define MCFG_IRQ_FUNC(_irqf) \
asc_device::static_set_irqf(*device, _irqf);
downcast<asc_device *>(device)->set_irqf(DEVCB2_##_irqf);
//**************************************************************************
// TYPE DEFINITIONS
@ -67,7 +67,14 @@ public:
// inline configuration helpers
static void static_set_type(device_t &device, int type);
static void static_set_irqf(device_t &device, void (*irqf)(device_t *device, int state));
template<class _write> void set_irqf(_write wr)
{
write_irq.set_callback(wr);
}
devcb2_write_line write_irq;
DECLARE_READ8_MEMBER(read);
DECLARE_WRITE8_MEMBER(write);
@ -104,7 +111,6 @@ protected:
// inline data
UINT8 m_chip_type;
void (*m_irq_cb)(device_t *device, int state);
UINT8 m_fifo_a[0x400];
UINT8 m_fifo_b[0x400];

View File

@ -1051,7 +1051,7 @@ static MACHINE_CONFIG_START( macprtb, mac_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, mac_asc_irq)
MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq))
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
@ -1087,7 +1087,7 @@ static MACHINE_CONFIG_START( macii, mac_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, mac_asc_irq)
MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq))
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
@ -1137,7 +1137,7 @@ static MACHINE_CONFIG_START( maciifx, mac_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, mac_asc_irq)
MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq))
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
@ -1206,7 +1206,7 @@ static MACHINE_CONFIG_DERIVED( maclc, macii )
MCFG_NUBUS_BUS_ADD("pds", "maincpu", nubus_intf)
MCFG_NUBUS_SLOT_ADD("pds","lcpds", mac_lcpds_cards, NULL)
MCFG_ASC_REPLACE("asc", C15M, ASC_TYPE_V8, mac_asc_irq)
MCFG_ASC_REPLACE("asc", C15M, ASC_TYPE_V8, WRITELINE(mac_state, mac_asc_irq))
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
@ -1247,7 +1247,7 @@ static MACHINE_CONFIG_DERIVED( maclc3, maclc )
MCFG_RAM_DEFAULT_SIZE("4M")
MCFG_RAM_EXTRA_OPTIONS("8M,16M,32M,48M,64M,80M")
MCFG_ASC_REPLACE("asc", C15M, ASC_TYPE_SONORA, mac_asc_irq)
MCFG_ASC_REPLACE("asc", C15M, ASC_TYPE_SONORA, WRITELINE(mac_state, mac_asc_irq))
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
@ -1345,7 +1345,7 @@ static MACHINE_CONFIG_START( macse30, mac_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, mac_asc_irq)
MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq))
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
@ -1397,7 +1397,7 @@ static MACHINE_CONFIG_START( macpb140, mac_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, mac_asc_irq)
MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq))
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
@ -1465,7 +1465,7 @@ static MACHINE_CONFIG_START( macpb160, mac_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, mac_asc_irq)
MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq))
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
@ -1537,7 +1537,7 @@ static MACHINE_CONFIG_DERIVED( macclas2, maclc )
MCFG_SCREEN_VISIBLE_AREA(0, MAC_H_VIS-1, 0, MAC_V_VIS-1)
MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macrbv)
MCFG_ASC_REPLACE("asc", C15M, ASC_TYPE_EAGLE, mac_asc_irq)
MCFG_ASC_REPLACE("asc", C15M, ASC_TYPE_EAGLE, WRITELINE(mac_state, mac_asc_irq))
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
@ -1679,7 +1679,7 @@ static MACHINE_CONFIG_START( macqd700, mac_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_ASC_ADD("asc", C15M, ASC_TYPE_EASC, mac_asc_irq)
MCFG_ASC_ADD("asc", C15M, ASC_TYPE_EASC, WRITELINE(mac_state, mac_asc_irq))
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)

View File

@ -143,7 +143,6 @@ extern const via6522_interface mac_via6522_intf;
extern const via6522_interface mac_via6522_2_intf;
extern const via6522_interface mac_via6522_adb_intf;
void mac_asc_irq(device_t *device, int state);
void mac_fdc_set_enable_lines(device_t *device, int enable_mask);
/*----------- defined in audio/mac.c -----------*/
@ -408,6 +407,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(adb_linechange_w);
DECLARE_WRITE_LINE_MEMBER(mac_scsi_irq);
DECLARE_WRITE_LINE_MEMBER(mac_asc_irq);
DECLARE_DIRECT_UPDATE_MEMBER(overlay_opbaseoverride);
private:

View File

@ -107,7 +107,6 @@
#define AUDIO_IS_CLASSIC (m_model <= MODEL_MAC_CLASSIC)
#define MAC_HAS_VIA2 ((m_model >= MODEL_MAC_II) && (m_model != MODEL_MAC_IIFX))
#define ASC_INTS_RBV ((mac->m_model >= MODEL_MAC_IICI) && (mac->m_model <= MODEL_MAC_IIVI)) || ((mac->m_model >= MODEL_MAC_LC) && (mac->m_model <= MODEL_MAC_LC_580))
#define INTS_RBV ((m_model >= MODEL_MAC_IICI) && (m_model <= MODEL_MAC_IIVI)) || ((m_model >= MODEL_MAC_LC) && (m_model <= MODEL_MAC_LC_580))
#ifdef MAME_DEBUG
@ -304,31 +303,29 @@ void mac_state::set_via2_interrupt(int value)
this->field_interrupts();
}
void mac_asc_irq(device_t *device, int state)
WRITE_LINE_MEMBER(mac_state::mac_asc_irq)
{
mac_state *mac = device->machine().driver_data<mac_state>();
if (ASC_INTS_RBV)
if (INTS_RBV)
{
if (state)
if (state == ASSERT_LINE)
{
mac->m_rbv_regs[3] |= 0x10; // any VIA 2 interrupt | sound interrupt
mac->rbv_recalc_irqs();
m_rbv_regs[3] |= 0x10; // any VIA 2 interrupt | sound interrupt
rbv_recalc_irqs();
}
else
{
mac->m_rbv_regs[3] &= ~0x10;
mac->rbv_recalc_irqs();
m_rbv_regs[3] &= ~0x10;
rbv_recalc_irqs();
}
}
else if ((mac->m_model == MODEL_MAC_PORTABLE) || (mac->m_model == MODEL_MAC_PB100))
else if ((m_model == MODEL_MAC_PORTABLE) || (m_model == MODEL_MAC_PB100))
{
// m_asc_interrupt = state;
// mac->field_interrupts();
// field_interrupts();
}
else if ((mac->m_model >= MODEL_MAC_II) && (mac->m_model != MODEL_MAC_IIFX))
else if ((m_model >= MODEL_MAC_II) && (m_model != MODEL_MAC_IIFX))
{
mac->m_via2->write_cb1(state^1);
m_via2->write_cb1(state^1);
}
}