From bdb2a2af7ebd3a07964926eaae30415bff1d6b06 Mon Sep 17 00:00:00 2001 From: Mark Garlanger Date: Sun, 4 Jun 2023 13:48:59 -0500 Subject: z80.cpp - Add EI to IM0 handler (#11307) * z80.cpp - Add EI to IM0 handler The heath/h89.cpp with a z37 soft-sectored controller uses IM0 and places an EI instruction on the bus when DRQ signal is received from the WD disk controller. I'm putting this part up early to get comments. Maybe someone with more experience with the z80 code could implement the top TODO in this file ``` - Interrupt mode 0 should be able to execute arbitrary opcodes ``` --- src/devices/cpu/z80/z80.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/devices/cpu/z80/z80.cpp b/src/devices/cpu/z80/z80.cpp index 6941ac6c4e6..35dd0322533 100644 --- a/src/devices/cpu/z80/z80.cpp +++ b/src/devices/cpu/z80/z80.cpp @@ -3320,11 +3320,24 @@ void z80_device::take_interrupt() PCD = irq_vector & 0xffff; break; default: /* rst (or other opcodes?) */ - /* RST $xx cycles */ - CC(op, 0xff); - T(m_icount_executing - MTM * 2); - wm16_sp(m_pc); - PCD = irq_vector & 0x0038; + if (irq_vector == 0xfb) + { + // EI + CC(op, 0xfb); + T(m_icount_executing); + ei(); + } + else if ((irq_vector & 0xc7) == 0xc7) + { + /* RST $xx cycles */ + CC(op, 0xff); + T(m_icount_executing - MTM * 2); + wm16_sp(m_pc); + PCD = irq_vector & 0x0038; + } + else { + logerror("z80device::take_interrupt unexpected opcode in im0 mode: 0x%02x\n", irq_vector); + } break; } } -- cgit v1.2.3