Simplify daisy-chain IRQ ack routine (get rid of delegate member) (nw)

This commit is contained in:
AJR 2016-12-29 14:29:38 -05:00
parent 096c443fbf
commit 9a39a8709e
5 changed files with 10 additions and 16 deletions

View File

@ -1969,8 +1969,6 @@ void z180_device::device_start()
m_odirect = &m_oprogram->direct();
m_iospace = &space(AS_IO);
daisy_set_irq_callback(device_irq_acknowledge_delegate(FUNC(z180_device::standard_irq_callback_member), this));
/* set up the state table */
{
state_add(Z180_PC, "PC", m_PC.w.l);

View File

@ -307,7 +307,8 @@ int z180_device::take_interrupt(int irq)
if( irq == Z180_INT_IRQ0 )
{
// retrieve the IRQ vector from the daisy chain or CPU interface
irq_vector = daisy_call_ack_device();
device_z80daisy_interface *intf = daisy_get_irq_device();
irq_vector = (intf != nullptr) ? intf->z80daisy_irq_ack() : standard_irq_callback_member(*this, 0);
LOG(("Z180 '%s' single int. irq_vector $%02x\n", tag(), irq_vector));

View File

@ -3158,7 +3158,8 @@ void z80_device::take_interrupt()
m_irqack_cb(true);
// fetch the IRQ vector
int irq_vector = daisy_call_ack_device();
device_z80daisy_interface *intf = daisy_get_irq_device();
int irq_vector = (intf != nullptr) ? intf->z80daisy_irq_ack() : standard_irq_callback_member(*this, 0);
LOG(("Z80 '%s' single int. irq_vector $%02x\n", tag(), irq_vector));
/* Interrupt mode 2. Call [i:databyte] */
@ -3410,8 +3411,6 @@ void z80_device::device_start()
m_decrypted_opcodes_direct = &m_decrypted_opcodes->direct();
m_io = &space(AS_IO);
daisy_set_irq_callback(device_irq_acknowledge_delegate(FUNC(z80_device::standard_irq_callback_member), this));
IX = IY = 0xffff; /* IX and IY are FFFF after a reset! */
F = ZF; /* Zero flag is set */

View File

@ -166,11 +166,11 @@ int z80_daisy_chain_interface::daisy_update_irq_state()
//-------------------------------------------------
// call_ack_device - acknowledge an interrupt
// from a chained device and return the vector
// daisy_get_irq_device - return the device
// in the chain that requested the interrupt
//-------------------------------------------------
int z80_daisy_chain_interface::daisy_call_ack_device()
device_z80daisy_interface *z80_daisy_chain_interface::daisy_get_irq_device()
{
// loop over all devices; dev[0] is the highest priority
for (device_z80daisy_interface *intf = m_chain; intf != nullptr; intf = intf->m_daisy_next)
@ -178,14 +178,12 @@ int z80_daisy_chain_interface::daisy_call_ack_device()
// if this device is asserting the INT line, that's the one we want
int state = intf->z80daisy_irq_state();
if (state & Z80_DAISY_INT)
return intf->z80daisy_irq_ack(); // call the requesting device
return intf;
}
if (VERBOSE && daisy_chain_present())
device().logerror("Interrupt from outside Z80 daisy chain\n");
// call back the CPU interface to retrieve the vector
return m_irq_callback(device(), 0);
return nullptr;
}

View File

@ -94,17 +94,15 @@ protected:
// initialization
void daisy_init(const z80_daisy_config *daisy);
void daisy_set_irq_callback(const device_irq_acknowledge_delegate &callback) { m_irq_callback = callback; }
// callbacks
int daisy_update_irq_state();
int daisy_call_ack_device();
device_z80daisy_interface *daisy_get_irq_device();
void daisy_call_reti_device();
private:
const z80_daisy_config *m_daisy_config;
device_z80daisy_interface *m_chain; // head of the daisy chain
device_irq_acknowledge_delegate m_irq_callback;
};