From 9a39a8709e609bdb5398727b30e7b59691b06fd1 Mon Sep 17 00:00:00 2001 From: AJR Date: Thu, 29 Dec 2016 14:29:38 -0500 Subject: Simplify daisy-chain IRQ ack routine (get rid of delegate member) (nw) --- src/devices/cpu/z180/z180.cpp | 2 -- src/devices/cpu/z180/z180op.hxx | 3 ++- src/devices/cpu/z80/z80.cpp | 5 ++--- src/devices/cpu/z80/z80daisy.cpp | 12 +++++------- src/devices/cpu/z80/z80daisy.h | 4 +--- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/devices/cpu/z180/z180.cpp b/src/devices/cpu/z180/z180.cpp index 0c208a1f467..a9ba848ebdd 100644 --- a/src/devices/cpu/z180/z180.cpp +++ b/src/devices/cpu/z180/z180.cpp @@ -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); diff --git a/src/devices/cpu/z180/z180op.hxx b/src/devices/cpu/z180/z180op.hxx index cad25aa4d1f..fce6718f40d 100644 --- a/src/devices/cpu/z180/z180op.hxx +++ b/src/devices/cpu/z180/z180op.hxx @@ -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)); diff --git a/src/devices/cpu/z80/z80.cpp b/src/devices/cpu/z80/z80.cpp index 93b697b5edf..cb8c0ecc8ed 100644 --- a/src/devices/cpu/z80/z80.cpp +++ b/src/devices/cpu/z80/z80.cpp @@ -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 */ diff --git a/src/devices/cpu/z80/z80daisy.cpp b/src/devices/cpu/z80/z80daisy.cpp index a46f7956179..23169dd3600 100644 --- a/src/devices/cpu/z80/z80daisy.cpp +++ b/src/devices/cpu/z80/z80daisy.cpp @@ -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; } diff --git a/src/devices/cpu/z80/z80daisy.h b/src/devices/cpu/z80/z80daisy.h index 7a11cb829c7..896285516ee 100644 --- a/src/devices/cpu/z80/z80daisy.h +++ b/src/devices/cpu/z80/z80daisy.h @@ -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; }; -- cgit v1.2.3