From 445e9e20aa6db377236a05d5ab034b2d766d7f2a Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 11 Mar 2023 20:16:38 -0500 Subject: [PATCH] Interrupt callback rationalization - Make CPUs pass interrupt return PC as a second argument to standard_irq_callback - Add interrupt return PC to "Stopped at interrupt" message produced by debugger 'gint' command - Add messages to trace logs whenever interrupts are accepted - Attempt to step over interrupt routines for applicable debugger commands - Eliminate standard_irq_callback_member wrapper method - Update many CPU cores to invoke standard_irq_callback at the start of or during interrupt processing, rather than at the end or when the input line changes - Remove IRQ callbacks for some input lines that never cause interrupts - mb88xx, mcs48: Add IRQ callbacks for internal interrupts --- .../cpu/arcompact/arcompact_execute.cpp | 2 +- src/devices/cpu/arm/arm.cpp | 4 +- src/devices/cpu/asap/asap.cpp | 2 +- src/devices/cpu/capricorn/capricorn.cpp | 2 +- src/devices/cpu/clipper/clipper.cpp | 4 +- src/devices/cpu/cosmac/cosmac.cpp | 8 +-- src/devices/cpu/cp1610/cp1610.cpp | 4 +- src/devices/cpu/dsp16/dsp16.cpp | 6 +- src/devices/cpu/e0c6200/e0c6200.cpp | 4 +- src/devices/cpu/e132xs/e132xs.cpp | 28 ++++---- src/devices/cpu/e132xs/e132xsdrc.cpp | 2 +- src/devices/cpu/f2mc16/f2mc16.cpp | 7 +- src/devices/cpu/f8/f8.cpp | 2 +- src/devices/cpu/g65816/g65816.cpp | 4 +- src/devices/cpu/h6280/h6280.cpp | 4 +- src/devices/cpu/h8/gt913.cpp | 2 +- src/devices/cpu/h8/h83002.cpp | 2 +- src/devices/cpu/h8/h83003.cpp | 2 +- src/devices/cpu/h8/h83006.cpp | 2 +- src/devices/cpu/h8/h83008.cpp | 2 +- src/devices/cpu/h8/h83032.cpp | 2 +- src/devices/cpu/h8/h83042.cpp | 2 +- src/devices/cpu/h8/h83048.cpp | 2 +- src/devices/cpu/h8/h83337.cpp | 2 +- src/devices/cpu/h8/h8s2245.cpp | 2 +- src/devices/cpu/h8/h8s2320.cpp | 2 +- src/devices/cpu/h8/h8s2357.cpp | 2 +- src/devices/cpu/h8/h8s2655.cpp | 2 +- src/devices/cpu/hmcs40/hmcs40.cpp | 2 +- src/devices/cpu/hphybrid/hphybrid.cpp | 2 +- src/devices/cpu/i386/i386.cpp | 2 +- src/devices/cpu/i8008/i8008.cpp | 2 +- src/devices/cpu/i8085/i8085.cpp | 12 ++-- src/devices/cpu/i86/i286.cpp | 2 +- src/devices/cpu/i86/i86.cpp | 2 +- src/devices/cpu/i960/i960.cpp | 2 +- src/devices/cpu/ks0164/ks0164.cpp | 3 +- src/devices/cpu/lc8670/lc8670.cpp | 3 +- src/devices/cpu/m37710/m37710.cpp | 2 +- src/devices/cpu/m6502/odeco16.lst | 6 +- src/devices/cpu/m6502/om6502.lst | 6 +- src/devices/cpu/m6502/om65c02.lst | 6 +- src/devices/cpu/m6502/om740.lst | 4 +- src/devices/cpu/m6502/or65c19.lst | 6 +- src/devices/cpu/m6502/ow65c02s.lst | 6 +- src/devices/cpu/m6502/oxavix.lst | 7 +- src/devices/cpu/m6800/m6800.cpp | 2 +- src/devices/cpu/m6800/m6801.cpp | 8 +-- src/devices/cpu/m68000/m68000.cpp | 4 +- src/devices/cpu/m68000/m68kcpu.cpp | 4 +- src/devices/cpu/m6805/m6805.cpp | 4 +- src/devices/cpu/m6805/m68705.cpp | 3 +- src/devices/cpu/m6805/m68hc05.cpp | 3 +- src/devices/cpu/m6809/base6x09.lst | 18 ++--- src/devices/cpu/m88000/m88000.cpp | 6 +- src/devices/cpu/mb88xx/mb88xx.cpp | 8 ++- src/devices/cpu/mc68hc11/mc68hc11.cpp | 15 ++-- src/devices/cpu/mcs48/mcs48.cpp | 10 +-- src/devices/cpu/mcs48/mcs48.h | 1 - src/devices/cpu/mcs51/mcs51.cpp | 25 ++++--- src/devices/cpu/mcs96/mcs96ops.lst | 2 +- src/devices/cpu/melps4/melps4.cpp | 4 +- src/devices/cpu/minx/minx.cpp | 2 +- src/devices/cpu/mips/mips1.cpp | 15 ++-- src/devices/cpu/mips/r4000.cpp | 2 +- src/devices/cpu/mn1880/mn1880.cpp | 2 +- .../cpu/nanoprocessor/nanoprocessor.cpp | 2 +- src/devices/cpu/nec/nec.cpp | 2 +- src/devices/cpu/nec/v25.cpp | 2 +- src/devices/cpu/ns32000/ns32000.cpp | 16 ++--- src/devices/cpu/pdp8/hd6120.cpp | 4 +- src/devices/cpu/pic17/pic17.cpp | 8 +-- src/devices/cpu/romp/romp.cpp | 8 +-- src/devices/cpu/s2650/s2650.cpp | 2 +- src/devices/cpu/saturn/saturn.cpp | 8 +-- src/devices/cpu/score/score.cpp | 3 +- src/devices/cpu/se3208/se3208.cpp | 4 +- src/devices/cpu/sh/sh2.cpp | 4 +- src/devices/cpu/sh/sh4comn.cpp | 10 +-- src/devices/cpu/sm510/sm510base.cpp | 4 +- src/devices/cpu/t11/t11.cpp | 2 +- src/devices/cpu/tms1000/tms2100.cpp | 4 +- src/devices/cpu/tms32025/tms32025.cpp | 6 +- src/devices/cpu/tms34010/tms34010.cpp | 8 +-- src/devices/cpu/tms7000/tms7000.cpp | 4 +- src/devices/cpu/ucom4/ucom4.cpp | 4 +- src/devices/cpu/unsp/unsp.cpp | 4 +- src/devices/cpu/upd7810/upd7810.cpp | 4 +- src/devices/cpu/v30mz/v30mz.cpp | 2 +- src/devices/cpu/v60/v60.cpp | 3 +- src/devices/cpu/xavix2/xavix2.cpp | 2 +- src/devices/cpu/z180/z180op.hxx | 2 +- src/devices/cpu/z8/z8.cpp | 2 +- src/devices/cpu/z80/z80.cpp | 2 +- src/devices/cpu/z8000/z8000.cpp | 8 +-- src/emu/debug/debugcpu.cpp | 72 +++++++++++++++++-- src/emu/debug/debugcpu.h | 3 +- src/emu/diexec.cpp | 11 +-- src/emu/diexec.h | 3 +- 99 files changed, 299 insertions(+), 246 deletions(-) diff --git a/src/devices/cpu/arcompact/arcompact_execute.cpp b/src/devices/cpu/arcompact/arcompact_execute.cpp index d7da4fd1e2a..f6bc43a8b6b 100644 --- a/src/devices/cpu/arcompact/arcompact_execute.cpp +++ b/src/devices/cpu/arcompact/arcompact_execute.cpp @@ -69,6 +69,7 @@ void arcompact_device::check_interrupts() logerror("HACK/TEST IRQ\n"); + standard_irq_callback(level, m_pc); if (level == 1) { m_regs[REG_ILINK1] = m_pc; @@ -89,7 +90,6 @@ void arcompact_device::check_interrupts() set_pc(m_INTVECTORBASE + vector * 8); m_irq_pending = 0; debugreg_clear_ZZ(); - standard_irq_callback_member(*this, 0); } } } diff --git a/src/devices/cpu/arm/arm.cpp b/src/devices/cpu/arm/arm.cpp index 6a99468da75..bcbdda00899 100644 --- a/src/devices/cpu/arm/arm.cpp +++ b/src/devices/cpu/arm/arm.cpp @@ -446,19 +446,19 @@ void arm_cpu_device::arm_check_irq_state() if (m_pendingFiq && (pc&F_MASK)==0) { + standard_irq_callback(ARM_FIRQ_LINE, R15 & ADDRESS_MASK); R15 = eARM_MODE_FIQ; /* Set FIQ mode so PC is saved to correct R14 bank */ SetRegister( 14, pc ); /* save PC */ R15 = (pc&PSR_MASK)|(pc&IRQ_MASK)|0x1c|eARM_MODE_FIQ|I_MASK|F_MASK; /* Mask both IRQ & FIRQ, set PC=0x1c */ - standard_irq_callback(ARM_FIRQ_LINE); return; } if (m_pendingIrq && (pc&I_MASK)==0) { + standard_irq_callback(ARM_IRQ_LINE, R15 & ADDRESS_MASK); R15 = eARM_MODE_IRQ; /* Set IRQ mode so PC is saved to correct R14 bank */ SetRegister( 14, pc ); /* save PC */ R15 = (pc&PSR_MASK)|(pc&IRQ_MASK)|0x18|eARM_MODE_IRQ|I_MASK|(pc&F_MASK); /* Mask only IRQ, set PC=0x18 */ - standard_irq_callback(ARM_IRQ_LINE); return; } } diff --git a/src/devices/cpu/asap/asap.cpp b/src/devices/cpu/asap/asap.cpp index 6fb1ab12592..53f66aa1900 100644 --- a/src/devices/cpu/asap/asap.cpp +++ b/src/devices/cpu/asap/asap.cpp @@ -455,8 +455,8 @@ inline void asap_device::check_irqs() { if (m_irq_state && m_iflag) { + standard_irq_callback(ASAP_IRQ0, m_pc); generate_exception(EXCEPTION_INTERRUPT); - standard_irq_callback(ASAP_IRQ0); } } diff --git a/src/devices/cpu/capricorn/capricorn.cpp b/src/devices/cpu/capricorn/capricorn.cpp index ee398f5296a..ddf3d6d821c 100644 --- a/src/devices/cpu/capricorn/capricorn.cpp +++ b/src/devices/cpu/capricorn/capricorn.cpp @@ -1535,7 +1535,7 @@ void capricorn_cpu_device::take_interrupt() // Int. ack sequence takes 9 cycles // Microcode FSM runs through this state sequence (see patent): // 31-15-26-13-23-22-30-16-20 - standard_irq_callback(0); + standard_irq_callback(0, m_genpc); m_icount -= 9; push_pc(); uint8_t vector = m_intack_in(); diff --git a/src/devices/cpu/clipper/clipper.cpp b/src/devices/cpu/clipper/clipper.cpp index e310b66ea62..0071a1a7e8a 100644 --- a/src/devices/cpu/clipper/clipper.cpp +++ b/src/devices/cpu/clipper/clipper.cpp @@ -184,7 +184,7 @@ void clipper_device::execute_run() if (m_nmi) { // acknowledge non-maskable interrupt - standard_irq_callback(INPUT_LINE_NMI); + standard_irq_callback(INPUT_LINE_NMI, m_pc); LOGMASKED(LOG_EXCEPTION, "non-maskable interrupt\n"); m_pc = intrap(EXCEPTION_INTERRUPT_BASE, m_pc); @@ -197,7 +197,7 @@ void clipper_device::execute_run() if ((m_ivec & IVEC_LEVEL) <= SSW(IL)) { // acknowledge interrupt - standard_irq_callback(INPUT_LINE_IRQ0); + standard_irq_callback(INPUT_LINE_IRQ0, m_pc); m_pc = intrap(EXCEPTION_INTERRUPT_BASE + m_ivec * 8, m_pc); diff --git a/src/devices/cpu/cosmac/cosmac.cpp b/src/devices/cpu/cosmac/cosmac.cpp index bc38bf034c2..cdd4d5d9fed 100644 --- a/src/devices/cpu/cosmac/cosmac.cpp +++ b/src/devices/cpu/cosmac/cosmac.cpp @@ -1205,8 +1205,6 @@ inline void cosmac_device::dma_input() { m_state = cosmac_state::STATE_0_FETCH; } - - standard_irq_callback(COSMAC_INPUT_LINE_DMAIN); } @@ -1239,8 +1237,6 @@ inline void cosmac_device::dma_output() { m_state = cosmac_state::STATE_0_FETCH; } - - standard_irq_callback(COSMAC_INPUT_LINE_DMAOUT); } @@ -1250,6 +1246,8 @@ inline void cosmac_device::dma_output() inline void cosmac_device::interrupt() { + standard_irq_callback(COSMAC_INPUT_LINE_INT, R[P]); + T = (X << 4) | P; X = 2; P = 1; @@ -1272,8 +1270,6 @@ inline void cosmac_device::interrupt() { m_state = cosmac_state::STATE_0_FETCH; } - - standard_irq_callback(COSMAC_INPUT_LINE_INT); } diff --git a/src/devices/cpu/cp1610/cp1610.cpp b/src/devices/cpu/cp1610/cp1610.cpp index 71d41844be8..1be6605fec8 100644 --- a/src/devices/cpu/cp1610/cp1610.cpp +++ b/src/devices/cpu/cp1610/cp1610.cpp @@ -3302,7 +3302,7 @@ void cp1610_cpu_device::execute_run() else if (m_intr_pending) { /* PSHR R7 */ - standard_irq_callback(CP1610_INT_INTR); + standard_irq_callback(CP1610_INT_INTR, m_r[7]); m_write_intak(m_r[6]); cp1610_writemem16(m_r[6],m_r[7]); m_r[6]++; @@ -3313,7 +3313,7 @@ void cp1610_cpu_device::execute_run() else if (m_intrm_pending && m_intr_enabled) { /* PSHR R7 */ - standard_irq_callback(CP1610_INT_INTRM); + standard_irq_callback(CP1610_INT_INTRM, m_r[7]); m_write_intak(m_r[6]); cp1610_writemem16(m_r[6],m_r[7]); m_r[6]++; diff --git a/src/devices/cpu/dsp16/dsp16.cpp b/src/devices/cpu/dsp16/dsp16.cpp index 4078389e2bc..c068fcf6d28 100644 --- a/src/devices/cpu/dsp16/dsp16.cpp +++ b/src/devices/cpu/dsp16/dsp16.cpp @@ -440,7 +440,7 @@ void dsp16_device_base::execute_set_input(int inputnum, int state) m_ick_in = (ASSERT_LINE == state) ? 1U : 0U; } if (CLEAR_LINE != state) - standard_irq_callback(DSP16_ICK_LINE); + standard_irq_callback(DSP16_ICK_LINE, m_st_pcbase); break; case DSP16_ILD_LINE: if (sio_ild_active()) @@ -462,7 +462,7 @@ void dsp16_device_base::execute_set_input(int inputnum, int state) m_ock_in = (ASSERT_LINE == state) ? 1U : 0U; } if (CLEAR_LINE != state) - standard_irq_callback(DSP16_OCK_LINE); + standard_irq_callback(DSP16_OCK_LINE, m_st_pcbase); break; case DSP16_OLD_LINE: if (sio_old_active()) @@ -718,7 +718,7 @@ template inline void dsp16_device_base::execute_so { LOGINT("DSP16: asserting IACK (PC = %04X)\n", m_st_pcbase); m_iack_cb(m_iack_out = 0U); - standard_irq_callback(DSP16_INT_LINE); + standard_irq_callback(DSP16_INT_LINE, m_st_pcbase); } break; case FLAGS_IACK_CLEAR: diff --git a/src/devices/cpu/e0c6200/e0c6200.cpp b/src/devices/cpu/e0c6200/e0c6200.cpp index 303ad5d5754..06aacef049b 100644 --- a/src/devices/cpu/e0c6200/e0c6200.cpp +++ b/src/devices/cpu/e0c6200/e0c6200.cpp @@ -156,6 +156,8 @@ void e0c6200_cpu_device::device_reset() void e0c6200_cpu_device::do_interrupt() { + standard_irq_callback(m_irq_id, m_pc); + // interrupt handling takes 13* cycles, plus 1 extra if cpu was halted // *: 12.5 on E0C6200A, does the cpu osc source change polarity or something? m_icount -= 13; @@ -168,8 +170,6 @@ void e0c6200_cpu_device::do_interrupt() // page 1 of the current bank m_pc = (m_pc & 0x1000) | 0x100 | m_irq_vector; - - standard_irq_callback(m_irq_id); } device_memory_interface::space_config_vector e0c6200_cpu_device::memory_space_config() const diff --git a/src/devices/cpu/e132xs/e132xs.cpp b/src/devices/cpu/e132xs/e132xs.cpp index 1331bb1a890..137a45404f2 100644 --- a/src/devices/cpu/e132xs/e132xs.cpp +++ b/src/devices/cpu/e132xs/e132xs.cpp @@ -935,56 +935,56 @@ void hyperstone_device::check_interrupts() /* IO3 is priority 5; state is in bit 6 of ISR; FCR bit 10 enables input and FCR bit 8 inhibits interrupt */ if (IO3_LINE_STATE && (FCR & 0x00000500) == 0x00000400) { + standard_irq_callback(IRQ_IO3, m_core->global_regs[0]); execute_int(get_trap_addr(TRAPNO_IO3)); - standard_irq_callback(IRQ_IO3); return; } /* INT1 is priority 7; state is in bit 0 of ISR; FCR bit 28 inhibits interrupt */ if (INT1_LINE_STATE && (FCR & 0x10000000) == 0x00000000) { + standard_irq_callback(IRQ_INT1, m_core->global_regs[0]); execute_int(get_trap_addr(TRAPNO_INT1)); - standard_irq_callback(IRQ_INT1); return; } /* INT2 is priority 9; state is in bit 1 of ISR; FCR bit 29 inhibits interrupt */ if (INT2_LINE_STATE && (FCR & 0x20000000) == 0x00000000) { + standard_irq_callback(IRQ_INT2, m_core->global_regs[0]); execute_int(get_trap_addr(TRAPNO_INT2)); - standard_irq_callback(IRQ_INT2); return; } /* INT3 is priority 11; state is in bit 2 of ISR; FCR bit 30 inhibits interrupt */ if (INT3_LINE_STATE && (FCR & 0x40000000) == 0x00000000) { + standard_irq_callback(IRQ_INT3, m_core->global_regs[0]); execute_int(get_trap_addr(TRAPNO_INT3)); - standard_irq_callback(IRQ_INT3); return; } /* INT4 is priority 13; state is in bit 3 of ISR; FCR bit 31 inhibits interrupt */ if (INT4_LINE_STATE && (FCR & 0x80000000) == 0x00000000) { + standard_irq_callback(IRQ_INT4, m_core->global_regs[0]); execute_int(get_trap_addr(TRAPNO_INT4)); - standard_irq_callback(IRQ_INT4); return; } /* IO1 is priority 14; state is in bit 4 of ISR; FCR bit 2 enables input and FCR bit 0 inhibits interrupt */ if (IO1_LINE_STATE && (FCR & 0x00000005) == 0x00000004) { + standard_irq_callback(IRQ_IO1, m_core->global_regs[0]); execute_int(get_trap_addr(TRAPNO_IO1)); - standard_irq_callback(IRQ_IO1); return; } /* IO2 is priority 15; state is in bit 5 of ISR; FCR bit 6 enables input and FCR bit 4 inhibits interrupt */ if (IO2_LINE_STATE && (FCR & 0x00000050) == 0x00000040) { + standard_irq_callback(IRQ_IO2, m_core->global_regs[0]); execute_int(get_trap_addr(TRAPNO_IO2)); - standard_irq_callback(IRQ_IO2); return; } } @@ -993,8 +993,8 @@ void hyperstone_device::check_interrupts() /* IO3 is priority 5; state is in bit 6 of ISR; FCR bit 10 enables input and FCR bit 8 inhibits interrupt */ if (IO3_LINE_STATE && (FCR & 0x00000500) == 0x00000400) { + standard_irq_callback(IRQ_IO3, m_core->global_regs[0]); execute_int(get_trap_addr(TRAPNO_IO3)); - standard_irq_callback(IRQ_IO3); return; } @@ -1009,8 +1009,8 @@ void hyperstone_device::check_interrupts() /* INT1 is priority 7; state is in bit 0 of ISR; FCR bit 28 inhibits interrupt */ if (INT1_LINE_STATE && (FCR & 0x10000000) == 0x00000000) { + standard_irq_callback(IRQ_INT1, m_core->global_regs[0]); execute_int(get_trap_addr(TRAPNO_INT1)); - standard_irq_callback(IRQ_INT1); return; } @@ -1025,8 +1025,8 @@ void hyperstone_device::check_interrupts() /* INT2 is priority 9; state is in bit 1 of ISR; FCR bit 29 inhibits interrupt */ if (INT2_LINE_STATE && (FCR & 0x20000000) == 0x00000000) { + standard_irq_callback(IRQ_INT2, m_core->global_regs[0]); execute_int(get_trap_addr(TRAPNO_INT2)); - standard_irq_callback(IRQ_INT2); return; } @@ -1041,8 +1041,8 @@ void hyperstone_device::check_interrupts() /* INT3 is priority 11; state is in bit 2 of ISR; FCR bit 30 inhibits interrupt */ if (INT3_LINE_STATE && (FCR & 0x40000000) == 0x00000000) { + standard_irq_callback(IRQ_INT3, m_core->global_regs[0]); execute_int(get_trap_addr(TRAPNO_INT3)); - standard_irq_callback(IRQ_INT3); return; } @@ -1057,24 +1057,24 @@ void hyperstone_device::check_interrupts() /* INT4 is priority 13; state is in bit 3 of ISR; FCR bit 31 inhibits interrupt */ if (INT4_LINE_STATE && (FCR & 0x80000000) == 0x00000000) { + standard_irq_callback(IRQ_INT4, m_core->global_regs[0]); execute_int(get_trap_addr(TRAPNO_INT4)); - standard_irq_callback(IRQ_INT4); return; } /* IO1 is priority 14; state is in bit 4 of ISR; FCR bit 2 enables input and FCR bit 0 inhibits interrupt */ if (IO1_LINE_STATE && (FCR & 0x00000005) == 0x00000004) { + standard_irq_callback(IRQ_IO1, m_core->global_regs[0]); execute_int(get_trap_addr(TRAPNO_IO1)); - standard_irq_callback(IRQ_IO1); return; } /* IO2 is priority 15; state is in bit 5 of ISR; FCR bit 6 enables input and FCR bit 4 inhibits interrupt */ if (IO2_LINE_STATE && (FCR & 0x00000050) == 0x00000040) { + standard_irq_callback(IRQ_IO2, m_core->global_regs[0]); execute_int(get_trap_addr(TRAPNO_IO2)); - standard_irq_callback(IRQ_IO2); return; } } diff --git a/src/devices/cpu/e132xs/e132xsdrc.cpp b/src/devices/cpu/e132xs/e132xsdrc.cpp index 31bcda4b104..fc3fb108539 100644 --- a/src/devices/cpu/e132xs/e132xsdrc.cpp +++ b/src/devices/cpu/e132xs/e132xsdrc.cpp @@ -65,7 +65,7 @@ inline void hyperstone_device::ccfunc_print() inline void hyperstone_device::ccfunc_standard_irq_callback() { - standard_irq_callback(m_core->arg0); + standard_irq_callback(m_core->arg0, m_core->global_regs[0]); } static void cfunc_unimplemented(void *param) diff --git a/src/devices/cpu/f2mc16/f2mc16.cpp b/src/devices/cpu/f2mc16/f2mc16.cpp index de4098685c7..7d85bff282a 100644 --- a/src/devices/cpu/f2mc16/f2mc16.cpp +++ b/src/devices/cpu/f2mc16/f2mc16.cpp @@ -231,7 +231,7 @@ void f2mc16_device::execute_run() { while (m_icount > 0) { - if (m_outstanding_irqs) + if (m_outstanding_irqs && !m_prefix_valid) { int cpulevel = m_ps >> 13; @@ -247,9 +247,10 @@ void f2mc16_device::execute_run() //m_icount--; + if (!m_prefix_valid) + debugger_instruction_hook((m_pcb<<16) | m_pc); u8 opcode = read_8((m_pcb<<16) | m_pc); - debugger_instruction_hook((m_pcb<<16) | m_pc); switch (opcode) { case 0x00: // NOP @@ -3403,7 +3404,7 @@ void f2mc16_device::clear_irq(int vector) // note: this function must not use m_tmp16 unless you change RETI void f2mc16_device::take_irq(int vector, int level) { - standard_irq_callback(vector); + standard_irq_callback(vector, (m_pcb<<16) | m_pc); // printf("take_irq: vector %d, level %d, old PC = %02x%04x\n", vector, level, m_pcb, m_pc); push_16_ssp(m_acc>>16); push_16_ssp(m_acc & 0xffff); diff --git a/src/devices/cpu/f8/f8.cpp b/src/devices/cpu/f8/f8.cpp index 4700ff27ac8..e545b7da9db 100644 --- a/src/devices/cpu/f8/f8.cpp +++ b/src/devices/cpu/f8/f8.cpp @@ -453,7 +453,7 @@ void f8_cpu_device::ROMC_0F() * must move the contents of the data bus into the low order * byte of PC0. */ - m_irq_vector = standard_irq_callback(F8_INPUT_LINE_INT_REQ); + m_irq_vector = standard_irq_callback(F8_INPUT_LINE_INT_REQ, m_pc0); m_dbus = m_irq_vector & 0x00ff; m_pc1 = m_pc0; m_pc0 = (m_pc0 & 0xff00) | m_dbus; diff --git a/src/devices/cpu/g65816/g65816.cpp b/src/devices/cpu/g65816/g65816.cpp index 7476fb8cde0..dcde7138fbe 100644 --- a/src/devices/cpu/g65816/g65816.cpp +++ b/src/devices/cpu/g65816/g65816.cpp @@ -589,6 +589,7 @@ void g65816_device::g65816i_set_reg_p(unsigned value) void g65816_device::g65816i_interrupt_hardware(unsigned vector) { + standard_irq_callback(0, g65816_get_pc()); if (FLAG_E) { CLK(7); @@ -598,7 +599,6 @@ void g65816_device::g65816i_interrupt_hardware(unsigned vector) g65816i_set_flag_i(IFLAG_SET); REGISTER_PB = 0; g65816i_jump_16(g65816i_read_16_vector(vector)); - standard_irq_callback(0); } else { @@ -610,7 +610,6 @@ void g65816_device::g65816i_interrupt_hardware(unsigned vector) g65816i_set_flag_i(IFLAG_SET); REGISTER_PB = 0; g65816i_jump_16(g65816i_read_16_vector(vector)); - standard_irq_callback(0); } } @@ -641,6 +640,7 @@ void g65816_device::g65816i_interrupt_software(unsigned vector) void g65816_device::g65816i_interrupt_nmi() { + standard_irq_callback(G65816_LINE_NMI, g65816_get_pc()); if (FLAG_E) { CLK(7); diff --git a/src/devices/cpu/h6280/h6280.cpp b/src/devices/cpu/h6280/h6280.cpp index 27c042ab299..5bbda527e9b 100644 --- a/src/devices/cpu/h6280/h6280.cpp +++ b/src/devices/cpu/h6280/h6280.cpp @@ -413,14 +413,14 @@ inline void h6280_device::check_and_take_irq_lines() if ( m_irq_state[0] != CLEAR_LINE && !(m_irq_mask & 0x2) ) { + standard_irq_callback(0, PCW); do_interrupt(H6280_IRQ1_VEC); - standard_irq_callback(0); } else if ( m_irq_state[1] != CLEAR_LINE && !(m_irq_mask & 0x1) ) { + standard_irq_callback(1, PCW); do_interrupt(H6280_IRQ2_VEC); - standard_irq_callback(1); } } } diff --git a/src/devices/cpu/h8/gt913.cpp b/src/devices/cpu/h8/gt913.cpp index c56c8ed94f3..ca2430a1f6f 100644 --- a/src/devices/cpu/h8/gt913.cpp +++ b/src/devices/cpu/h8/gt913.cpp @@ -242,7 +242,7 @@ void gt913_device::update_irq_filter() void gt913_device::interrupt_taken() { - standard_irq_callback(m_intc->interrupt_taken(taken_irq_vector)); + standard_irq_callback(m_intc->interrupt_taken(taken_irq_vector), NPC); } void gt913_device::internal_update(uint64_t current_time) diff --git a/src/devices/cpu/h8/h83002.cpp b/src/devices/cpu/h8/h83002.cpp index 664134669c9..697c275f16f 100644 --- a/src/devices/cpu/h8/h83002.cpp +++ b/src/devices/cpu/h8/h83002.cpp @@ -219,7 +219,7 @@ void h83002_device::update_irq_filter() void h83002_device::interrupt_taken() { - standard_irq_callback(intc->interrupt_taken(taken_irq_vector)); + standard_irq_callback(intc->interrupt_taken(taken_irq_vector), NPC); } void h83002_device::internal_update(uint64_t current_time) diff --git a/src/devices/cpu/h8/h83003.cpp b/src/devices/cpu/h8/h83003.cpp index 39829d5de12..84be5879454 100644 --- a/src/devices/cpu/h8/h83003.cpp +++ b/src/devices/cpu/h8/h83003.cpp @@ -240,7 +240,7 @@ void h83003_device::update_irq_filter() void h83003_device::interrupt_taken() { - standard_irq_callback(intc->interrupt_taken(taken_irq_vector)); + standard_irq_callback(intc->interrupt_taken(taken_irq_vector), NPC); } void h83003_device::internal_update(uint64_t current_time) diff --git a/src/devices/cpu/h8/h83006.cpp b/src/devices/cpu/h8/h83006.cpp index d19937e93dc..ebe6b16c2e9 100644 --- a/src/devices/cpu/h8/h83006.cpp +++ b/src/devices/cpu/h8/h83006.cpp @@ -207,7 +207,7 @@ void h83006_device::update_irq_filter() void h83006_device::interrupt_taken() { - standard_irq_callback(intc->interrupt_taken(taken_irq_vector)); + standard_irq_callback(intc->interrupt_taken(taken_irq_vector), NPC); } void h83006_device::internal_update(uint64_t current_time) diff --git a/src/devices/cpu/h8/h83008.cpp b/src/devices/cpu/h8/h83008.cpp index 3db7c5a71aa..69a2090f89b 100644 --- a/src/devices/cpu/h8/h83008.cpp +++ b/src/devices/cpu/h8/h83008.cpp @@ -184,7 +184,7 @@ void h83008_device::update_irq_filter() void h83008_device::interrupt_taken() { - standard_irq_callback(intc->interrupt_taken(taken_irq_vector)); + standard_irq_callback(intc->interrupt_taken(taken_irq_vector), NPC); } void h83008_device::internal_update(uint64_t current_time) diff --git a/src/devices/cpu/h8/h83032.cpp b/src/devices/cpu/h8/h83032.cpp index f1abc18b912..41fcb08bcef 100644 --- a/src/devices/cpu/h8/h83032.cpp +++ b/src/devices/cpu/h8/h83032.cpp @@ -210,7 +210,7 @@ void h83032_device::update_irq_filter() void h83032_device::interrupt_taken() { - standard_irq_callback(intc->interrupt_taken(taken_irq_vector)); + standard_irq_callback(intc->interrupt_taken(taken_irq_vector), NPC); } void h83032_device::internal_update(uint64_t current_time) diff --git a/src/devices/cpu/h8/h83042.cpp b/src/devices/cpu/h8/h83042.cpp index 2b0631d201e..71892c2178f 100644 --- a/src/devices/cpu/h8/h83042.cpp +++ b/src/devices/cpu/h8/h83042.cpp @@ -219,7 +219,7 @@ void h83042_device::update_irq_filter() void h83042_device::interrupt_taken() { - standard_irq_callback(intc->interrupt_taken(taken_irq_vector)); + standard_irq_callback(intc->interrupt_taken(taken_irq_vector), NPC); } void h83042_device::internal_update(uint64_t current_time) diff --git a/src/devices/cpu/h8/h83048.cpp b/src/devices/cpu/h8/h83048.cpp index 2358914e6cf..464acb46e39 100644 --- a/src/devices/cpu/h8/h83048.cpp +++ b/src/devices/cpu/h8/h83048.cpp @@ -224,7 +224,7 @@ void h83048_device::update_irq_filter() void h83048_device::interrupt_taken() { - standard_irq_callback(intc->interrupt_taken(taken_irq_vector)); + standard_irq_callback(intc->interrupt_taken(taken_irq_vector), NPC); } void h83048_device::internal_update(uint64_t current_time) diff --git a/src/devices/cpu/h8/h83337.cpp b/src/devices/cpu/h8/h83337.cpp index 7f9e835513c..dd13112e592 100644 --- a/src/devices/cpu/h8/h83337.cpp +++ b/src/devices/cpu/h8/h83337.cpp @@ -157,7 +157,7 @@ void h83337_device::update_irq_filter() void h83337_device::interrupt_taken() { - standard_irq_callback(intc->interrupt_taken(taken_irq_vector)); + standard_irq_callback(intc->interrupt_taken(taken_irq_vector), NPC); } void h83337_device::internal_update(uint64_t current_time) diff --git a/src/devices/cpu/h8/h8s2245.cpp b/src/devices/cpu/h8/h8s2245.cpp index b5101017f07..a7b9321a1bc 100644 --- a/src/devices/cpu/h8/h8s2245.cpp +++ b/src/devices/cpu/h8/h8s2245.cpp @@ -282,7 +282,7 @@ void h8s2245_device::update_irq_filter() void h8s2245_device::interrupt_taken() { - standard_irq_callback(intc->interrupt_taken(taken_irq_vector)); + standard_irq_callback(intc->interrupt_taken(taken_irq_vector), NPC); } void h8s2245_device::internal_update(uint64_t current_time) diff --git a/src/devices/cpu/h8/h8s2320.cpp b/src/devices/cpu/h8/h8s2320.cpp index 14cd0e0a396..3cb72c6313a 100644 --- a/src/devices/cpu/h8/h8s2320.cpp +++ b/src/devices/cpu/h8/h8s2320.cpp @@ -406,7 +406,7 @@ void h8s2320_device::update_irq_filter() void h8s2320_device::interrupt_taken() { - standard_irq_callback(intc->interrupt_taken(taken_irq_vector)); + standard_irq_callback(intc->interrupt_taken(taken_irq_vector), NPC); } void h8s2320_device::internal_update(uint64_t current_time) diff --git a/src/devices/cpu/h8/h8s2357.cpp b/src/devices/cpu/h8/h8s2357.cpp index eda704291c5..b33267d826f 100644 --- a/src/devices/cpu/h8/h8s2357.cpp +++ b/src/devices/cpu/h8/h8s2357.cpp @@ -347,7 +347,7 @@ void h8s2357_device::update_irq_filter() void h8s2357_device::interrupt_taken() { - standard_irq_callback(intc->interrupt_taken(taken_irq_vector)); + standard_irq_callback(intc->interrupt_taken(taken_irq_vector), NPC); } void h8s2357_device::internal_update(uint64_t current_time) diff --git a/src/devices/cpu/h8/h8s2655.cpp b/src/devices/cpu/h8/h8s2655.cpp index eb29b29bdc3..85e78f4b3bb 100644 --- a/src/devices/cpu/h8/h8s2655.cpp +++ b/src/devices/cpu/h8/h8s2655.cpp @@ -359,7 +359,7 @@ void h8s2655_device::update_irq_filter() void h8s2655_device::interrupt_taken() { - standard_irq_callback(intc->interrupt_taken(taken_irq_vector)); + standard_irq_callback(intc->interrupt_taken(taken_irq_vector), NPC); } void h8s2655_device::internal_update(uint64_t current_time) diff --git a/src/devices/cpu/hmcs40/hmcs40.cpp b/src/devices/cpu/hmcs40/hmcs40.cpp index 841e37e1558..b94818f8288 100644 --- a/src/devices/cpu/hmcs40/hmcs40.cpp +++ b/src/devices/cpu/hmcs40/hmcs40.cpp @@ -454,6 +454,7 @@ void hmcs40_cpu_device::do_interrupt() // line 0/1 for external interrupt, let's use 2 for t/c interrupt int line = (m_iri) ? m_eint_line : 2; + standard_irq_callback(line, m_pc); // vector $3f, on page 0(timer/counter), or page 1(external) // external interrupt has priority over t/c interrupt @@ -463,7 +464,6 @@ void hmcs40_cpu_device::do_interrupt() else m_irt = 0; - standard_irq_callback(line); m_prev_pc = m_pc; cycle(); diff --git a/src/devices/cpu/hphybrid/hphybrid.cpp b/src/devices/cpu/hphybrid/hphybrid.cpp index a4eb434167a..c1289b0175a 100644 --- a/src/devices/cpu/hphybrid/hphybrid.cpp +++ b/src/devices/cpu/hphybrid/hphybrid.cpp @@ -1318,7 +1318,7 @@ void hp_hybrid_cpu_device::check_for_interrupts() return; } - standard_irq_callback(irqline); + standard_irq_callback(irqline , add_mae(AEC_CASE_A , m_reg_P)); // Get interrupt vector in low byte (level is available on PA3) uint8_t vector = !m_int_func.isnull() ? m_int_func(BIT(m_flags , HPHYBRID_IRH_BIT) ? 1 : 0) : 0xff; diff --git a/src/devices/cpu/i386/i386.cpp b/src/devices/cpu/i386/i386.cpp index 4e1c653bec5..07c24bc71b9 100644 --- a/src/devices/cpu/i386/i386.cpp +++ b/src/devices/cpu/i386/i386.cpp @@ -1529,7 +1529,7 @@ void i386_device::i386_check_irq_line() if ( (m_irq_state) && m_IF ) { m_cycles -= 2; - i386_trap(standard_irq_callback(0), 1, 0); + i386_trap(standard_irq_callback(0, m_pc), 1, 0); } } diff --git a/src/devices/cpu/i8008/i8008.cpp b/src/devices/cpu/i8008/i8008.cpp index c404508560b..2c997f30c4f 100644 --- a/src/devices/cpu/i8008/i8008.cpp +++ b/src/devices/cpu/i8008/i8008.cpp @@ -275,7 +275,7 @@ void i8008_device::take_interrupt() m_HALT = 0; } // For now only support one byte operation to be executed - execute_one(standard_irq_callback(0)); + execute_one(standard_irq_callback(0, m_PC.d)); } inline void i8008_device::execute_one(int opcode) diff --git a/src/devices/cpu/i8085/i8085.cpp b/src/devices/cpu/i8085/i8085.cpp index aaaa1f6b288..09b739c76d0 100644 --- a/src/devices/cpu/i8085/i8085.cpp +++ b/src/devices/cpu/i8085/i8085.cpp @@ -549,7 +549,7 @@ void i8085a_cpu_device::check_for_interrupts() /* break out of HALT state and call the IRQ ack callback */ break_halt_for_interrupt(); - standard_irq_callback(I8085_TRAP_LINE); + standard_irq_callback(I8085_TRAP_LINE, m_PC.w.l); /* push the PC and jump to $0024 */ op_push(m_PC); @@ -566,7 +566,7 @@ void i8085a_cpu_device::check_for_interrupts() /* break out of HALT state and call the IRQ ack callback */ break_halt_for_interrupt(); - standard_irq_callback(I8085_RST75_LINE); + standard_irq_callback(I8085_RST75_LINE, m_PC.w.l); /* push the PC and jump to $003C */ op_push(m_PC); @@ -580,7 +580,7 @@ void i8085a_cpu_device::check_for_interrupts() { /* break out of HALT state and call the IRQ ack callback */ break_halt_for_interrupt(); - standard_irq_callback(I8085_RST65_LINE); + standard_irq_callback(I8085_RST65_LINE, m_PC.w.l); /* push the PC and jump to $0034 */ op_push(m_PC); @@ -594,7 +594,7 @@ void i8085a_cpu_device::check_for_interrupts() { /* break out of HALT state and call the IRQ ack callback */ break_halt_for_interrupt(); - standard_irq_callback(I8085_RST55_LINE); + standard_irq_callback(I8085_RST55_LINE, m_PC.w.l); /* push the PC and jump to $002C */ op_push(m_PC); @@ -608,7 +608,7 @@ void i8085a_cpu_device::check_for_interrupts() { /* break out of HALT state and call the IRQ ack callback */ if (!m_in_inta_func.isnull()) - standard_irq_callback(I8085_INTR_LINE); + standard_irq_callback(I8085_INTR_LINE, m_PC.w.l); break_halt_for_interrupt(); u8 vector = read_inta(); @@ -713,7 +713,7 @@ u8 i8085a_cpu_device::read_op() u8 i8085a_cpu_device::read_inta() { if (m_in_inta_func.isnull()) - return standard_irq_callback(I8085_INTR_LINE); + return standard_irq_callback(I8085_INTR_LINE, m_PC.w.l); else return m_in_inta_func(m_PC.w.l); } diff --git a/src/devices/cpu/i86/i286.cpp b/src/devices/cpu/i86/i286.cpp index 2d2f2d1b650..192fb483051 100644 --- a/src/devices/cpu/i86/i286.cpp +++ b/src/devices/cpu/i86/i286.cpp @@ -878,7 +878,7 @@ void i80286_cpu_device::interrupt_descriptor(int number, int hwint, int error) if(number == -1) { - number = standard_irq_callback(0); + number = standard_irq_callback(0, update_pc() & m_amask); hwint = 1; } diff --git a/src/devices/cpu/i86/i86.cpp b/src/devices/cpu/i86/i86.cpp index fd85830e86b..8c78c47a1ab 100644 --- a/src/devices/cpu/i86/i86.cpp +++ b/src/devices/cpu/i86/i86.cpp @@ -585,7 +585,7 @@ void i8086_common_cpu_device::interrupt(int int_num, int trap) m_TF = m_IF = 0; if (int_num == -1) - int_num = standard_irq_callback(0); + int_num = standard_irq_callback(0, (m_sregs[CS] << 4) + m_ip); debugger_exception_hook(int_num); m_easeg = CS; diff --git a/src/devices/cpu/i960/i960.cpp b/src/devices/cpu/i960/i960.cpp index b8f0bf47315..9449988fd6e 100644 --- a/src/devices/cpu/i960/i960.cpp +++ b/src/devices/cpu/i960/i960.cpp @@ -2263,7 +2263,7 @@ void i960_cpu_device::execute_set_input(int irqline, int state) } // and ack it to the core now that it's queued - standard_irq_callback(irqline); + standard_irq_callback(irqline, m_IP); } } diff --git a/src/devices/cpu/ks0164/ks0164.cpp b/src/devices/cpu/ks0164/ks0164.cpp index 5b419cc3e90..b66080ba06b 100644 --- a/src/devices/cpu/ks0164/ks0164.cpp +++ b/src/devices/cpu/ks0164/ks0164.cpp @@ -108,6 +108,7 @@ void ks0164_cpu_device::handle_irq() // Normal irq (not reset), save pc and psw if(m_r[R_PSW] & F_I) return; + standard_irq_callback(0, m_r[R_PC]); m_program.write_word(m_r[R_SP] - 2, m_r[R_PC]); m_program.write_word(m_r[R_SP] - 4, m_r[R_PSW]); m_r[R_SP] -= 4; @@ -118,8 +119,6 @@ void ks0164_cpu_device::handle_irq() m_r[R_PSW] = (m_r[R_PSW] & 0xfff0) | (index ? index - 1 : 0); m_r[R_PC] = m_program_cache.read_word(index*2); m_icount --; - if(index) - standard_irq_callback(0); } } diff --git a/src/devices/cpu/lc8670/lc8670.cpp b/src/devices/cpu/lc8670/lc8670.cpp index d0ab5bbc19d..01c8bc8873a 100644 --- a/src/devices/cpu/lc8670/lc8670.cpp +++ b/src/devices/cpu/lc8670/lc8670.cpp @@ -640,6 +640,7 @@ void lc8670_cpu_device::check_irqs() if (irq != 0) { LOGMASKED(LOG_IRQ, "%s: interrupt %d (Priority=%d, Level=%d) executed\n", tag(), irq, priority, m_irq_lev); + standard_irq_callback(irq, m_pc); m_irq_lev |= (1 << priority); @@ -652,8 +653,6 @@ void lc8670_cpu_device::check_irqs() // clear the IRQ flag m_irq_flag &= ~(1 << irq); - - standard_irq_callback(irq); } } diff --git a/src/devices/cpu/m37710/m37710.cpp b/src/devices/cpu/m37710/m37710.cpp index 6ca096d1e4f..43106bfc1a3 100644 --- a/src/devices/cpu/m37710/m37710.cpp +++ b/src/devices/cpu/m37710/m37710.cpp @@ -1076,7 +1076,7 @@ void m37710_cpu_device::m37710i_update_irqs() if (wantedIRQ != -1) { - standard_irq_callback(wantedIRQ); + standard_irq_callback(wantedIRQ, REG_PG | REG_PC); // make sure we're running to service the interrupt CPU_STOPPED &= ~STOP_LEVEL_WAI; diff --git a/src/devices/cpu/m6502/odeco16.lst b/src/devices/cpu/m6502/odeco16.lst index ebcac8522a7..61b74c247e4 100644 --- a/src/devices/cpu/m6502/odeco16.lst +++ b/src/devices/cpu/m6502/odeco16.lst @@ -15,15 +15,15 @@ brk_16_imp write(SP, irq_taken ? P & ~F_B : P); dec_SP(); if(nmi_pending) { + standard_irq_callback(NMI_LINE, PC); PC = read_arg(0xfff7); PC = set_h(PC, read_arg(0xfff6)); nmi_pending = false; - standard_irq_callback(NMI_LINE); } else { + if(irq_taken) + standard_irq_callback(IRQ_LINE, PC); PC = read_arg(0xfff3); PC = set_h(PC, read_arg(0xfff2)); - if(irq_taken) - standard_irq_callback(IRQ_LINE); } irq_taken = false; P |= F_I; // Do *not* move after the prefetch diff --git a/src/devices/cpu/m6502/om6502.lst b/src/devices/cpu/m6502/om6502.lst index 0fe5d0edeb9..5252fdf424f 100644 --- a/src/devices/cpu/m6502/om6502.lst +++ b/src/devices/cpu/m6502/om6502.lst @@ -272,15 +272,15 @@ brk_imp write(SP, irq_taken ? P & ~F_B : P); dec_SP(); if(nmi_pending) { + standard_irq_callback(NMI_LINE, PC); PC = read_arg(0xfffa); PC = set_h(PC, read_arg(0xfffb)); nmi_pending = false; - standard_irq_callback(NMI_LINE); } else { + if(irq_taken) + standard_irq_callback(IRQ_LINE, PC); PC = read_arg(0xfffe); PC = set_h(PC, read_arg(0xffff)); - if(irq_taken) - standard_irq_callback(IRQ_LINE); } irq_taken = false; P |= F_I; // Do *not* move after the prefetch diff --git a/src/devices/cpu/m6502/om65c02.lst b/src/devices/cpu/m6502/om65c02.lst index 62eb0a31cf1..516631c699c 100644 --- a/src/devices/cpu/m6502/om65c02.lst +++ b/src/devices/cpu/m6502/om65c02.lst @@ -232,15 +232,15 @@ brk_c_imp write(SP, irq_taken || nmi_pending ? P & ~F_B : P); dec_SP(); if(irq_taken && nmi_pending) { + standard_irq_callback(NMI_LINE, PC); PC = read_arg(0xfffa); PC = set_h(PC, read_arg(0xfffb)); nmi_pending = false; - standard_irq_callback(NMI_LINE); } else { + if(irq_taken) + standard_irq_callback(IRQ_LINE, PC); PC = read_arg(0xfffe); PC = set_h(PC, read_arg(0xffff)); - if(irq_taken) - standard_irq_callback(IRQ_LINE); } irq_taken = false; P = (P | F_I) & ~F_D; // Do *not* move after the prefetch diff --git a/src/devices/cpu/m6502/om740.lst b/src/devices/cpu/m6502/om740.lst index 5e63f07a5bf..21e64ac64e1 100644 --- a/src/devices/cpu/m6502/om740.lst +++ b/src/devices/cpu/m6502/om740.lst @@ -221,10 +221,10 @@ brk_m_imp write(SP, irq_taken ? P & ~F_B : P); dec_SP(); // BRK uses the vector of the interrupt with the highest priority if any are enabled and pending + if(irq_taken) + standard_irq_callback(IRQ_LINE, PC); PC = read_arg(m_irq_vector); PC = set_h(PC, read_arg(m_irq_vector+1)); - if(irq_taken) - standard_irq_callback(IRQ_LINE); irq_taken = false; P |= F_I; // Do *not* move after the prefetch prefetch(); diff --git a/src/devices/cpu/m6502/or65c19.lst b/src/devices/cpu/m6502/or65c19.lst index 34ff488eadb..df67446d8d4 100644 --- a/src/devices/cpu/m6502/or65c19.lst +++ b/src/devices/cpu/m6502/or65c19.lst @@ -107,16 +107,16 @@ brk_r_imp write(SP, irq_taken || nmi_pending ? P & ~F_B : P); dec_SP(); if(irq_taken && nmi_pending) { + standard_irq_callback(NMI_LINE, PC); PC = read_arg(0xfffc); PC = set_h(PC, read_arg(0xfffd)); nmi_pending = false; - standard_irq_callback(NMI_LINE); } else { + if(irq_taken) + standard_irq_callback(((~TMP & 0x000e) >> 1) - 1, PC); TMP = get_irq_vector(); PC = read_arg(TMP); PC = set_h(PC, read_arg(TMP+1)); - if(irq_taken) - standard_irq_callback(((~TMP & 0x000e) >> 1) - 1); } irq_taken = false; P = (P | F_I) & ~F_D; // Do *not* move after the prefetch diff --git a/src/devices/cpu/m6502/ow65c02s.lst b/src/devices/cpu/m6502/ow65c02s.lst index a5d334389a9..bc8c50f2bb1 100644 --- a/src/devices/cpu/m6502/ow65c02s.lst +++ b/src/devices/cpu/m6502/ow65c02s.lst @@ -191,15 +191,15 @@ brk_s_imp write(SP, irq_taken || nmi_pending ? P & ~F_B : P); dec_SP(); if(irq_taken && nmi_pending) { + standard_irq_callback(NMI_LINE, PC); PC = read_vector(0xfffa); PC = set_h(PC, read_vector(0xfffb)); nmi_pending = false; - standard_irq_callback(NMI_LINE); } else { + if(irq_taken) + standard_irq_callback(IRQ_LINE, PC); PC = read_vector(0xfffe); PC = set_h(PC, read_vector(0xffff)); - if(irq_taken) - standard_irq_callback(IRQ_LINE); } irq_taken = false; P = (P | F_I) & ~F_D; // Do *not* move after the prefetch diff --git a/src/devices/cpu/m6502/oxavix.lst b/src/devices/cpu/m6502/oxavix.lst index b828473b841..08b122e5a65 100644 --- a/src/devices/cpu/m6502/oxavix.lst +++ b/src/devices/cpu/m6502/oxavix.lst @@ -57,6 +57,7 @@ brk_xav_imp write_stack(SP, irq_taken ? P & ~F_B : P); dec_SP(); if(nmi_pending) { + standard_irq_callback(NMI_LINE, PC); if (m_vector_callback.isnull()) { PC = read_arg(0xfffa); @@ -77,8 +78,9 @@ brk_xav_imp } nmi_pending = false; - standard_irq_callback(NMI_LINE); } else { + if(irq_taken) + standard_irq_callback(IRQ_LINE, PC); if (m_vector_callback.isnull()) { PC = read_arg(0xfffe); @@ -97,9 +99,6 @@ brk_xav_imp PC = set_h(PC, read_arg(0xffff)); } } - - if(irq_taken) - standard_irq_callback(IRQ_LINE); } irq_taken = false; P |= F_I; // Do *not* move after the prefetch diff --git a/src/devices/cpu/m6800/m6800.cpp b/src/devices/cpu/m6800/m6800.cpp index 4df393c0a4c..3dca17292a4 100644 --- a/src/devices/cpu/m6800/m6800.cpp +++ b/src/devices/cpu/m6800/m6800.cpp @@ -507,8 +507,8 @@ void m6800_cpu_device::check_irq_lines() if (!(CC & 0x10)) { + standard_irq_callback(M6800_IRQ_LINE, m_pc.w.l); enter_interrupt("take IRQ1\n", 0xfff8); - standard_irq_callback(M6800_IRQ_LINE); } } else diff --git a/src/devices/cpu/m6800/m6801.cpp b/src/devices/cpu/m6800/m6801.cpp index e759a0b57cc..51b94209bb7 100644 --- a/src/devices/cpu/m6800/m6801.cpp +++ b/src/devices/cpu/m6800/m6801.cpp @@ -401,8 +401,8 @@ void m6801_cpu_device::m6800_check_irq2() { if ((m_tcsr & (TCSR_EICI|TCSR_ICF)) == (TCSR_EICI|TCSR_ICF)) { + standard_irq_callback(M6801_TIN_LINE, m_pc.w.l); TAKE_ICI; - standard_irq_callback(M6801_TIN_LINE); } else if ((m_tcsr & (TCSR_EOCI|TCSR_OCF)) == (TCSR_EOCI|TCSR_OCF)) { @@ -424,8 +424,8 @@ void hd6301x_cpu_device::m6800_check_irq2() { if ((m_tcsr & (TCSR_EICI|TCSR_ICF)) == (TCSR_EICI|TCSR_ICF)) { + standard_irq_callback(M6801_TIN_LINE, m_pc.w.l); TAKE_ICI; - standard_irq_callback(M6801_TIN_LINE); } else if ((m_tcsr & (TCSR_EOCI|TCSR_OCF)) == (TCSR_EOCI|TCSR_OCF) || (m_tcsr2 & (TCSR2_EOCI2|TCSR2_OCF2)) == (TCSR2_EOCI2|TCSR2_OCF2)) @@ -452,8 +452,8 @@ void hd6301y_cpu_device::m6800_check_irq2() { if ((m_p6csr & 0xc0) == 0xc0) { + standard_irq_callback(M6801_IS_LINE, m_pc.w.l); TAKE_ISI; - standard_irq_callback(M6801_IS_LINE); } else hd6301x_cpu_device::m6800_check_irq2(); @@ -970,8 +970,6 @@ void m6801_cpu_device::execute_set_input(int irqline, int state) } } m_sc1_state = ASSERT_LINE == state; - if (CLEAR_LINE != state) - standard_irq_callback(M6801_SC1_LINE); // re-entrant - do it after setting m_sc1_state break; case M6801_TIN_LINE: diff --git a/src/devices/cpu/m68000/m68000.cpp b/src/devices/cpu/m68000/m68000.cpp index ef2d7a5ab29..cbefca3a3f4 100644 --- a/src/devices/cpu/m68000/m68000.cpp +++ b/src/devices/cpu/m68000/m68000.cpp @@ -432,11 +432,11 @@ void m68000_device::start_interrupt_vector_lookup() int level = m_next_state >> 24; if(m_interrupt_mixer) - standard_irq_callback(level == 7 && m_nmi_uses_generic ? INPUT_LINE_NMI : level); + standard_irq_callback(level == 7 && m_nmi_uses_generic ? INPUT_LINE_NMI : level, m_pc); else { for(int i=0; i<3; i++) if(level & (1< 13) rm16(0x1ffc, m_pc); @@ -511,7 +511,7 @@ void m6805_base_device::interrupt() } SEI; /* no vectors supported, just do the callback to clear irq_state if needed */ - standard_irq_callback(0); + standard_irq_callback(0, m_pc.w.l); interrupt_vector(); diff --git a/src/devices/cpu/m6805/m68705.cpp b/src/devices/cpu/m6805/m68705.cpp index 96a36d2c711..bf177329863 100644 --- a/src/devices/cpu/m6805/m68705.cpp +++ b/src/devices/cpu/m6805/m68705.cpp @@ -568,11 +568,11 @@ void m6805_hmos_device::interrupt() pushbyte(m_cc); } SEI; - standard_irq_callback(0); if (BIT(m_pending_interrupts, M6805_IRQ_LINE)) { LOGINT("servicing /INT interrupt\n"); + standard_irq_callback(0, m_pc.w.l); m_pending_interrupts &= ~(1 << M6805_IRQ_LINE); if (m_params.m_addr_width > 13) rm16(M6805_VECTOR_INT, m_pc); @@ -582,6 +582,7 @@ void m6805_hmos_device::interrupt() else if (BIT(m_pending_interrupts, M6805_INT_TIMER)) { LOGINT("servicing timer/counter interrupt\n"); + standard_irq_callback(1, m_pc.w.l); if (m_params.m_addr_width > 13) rm16(M6805_VECTOR_TIMER, m_pc); else diff --git a/src/devices/cpu/m6805/m68hc05.cpp b/src/devices/cpu/m6805/m68hc05.cpp index a4d1864f372..53cecc7116e 100644 --- a/src/devices/cpu/m6805/m68hc05.cpp +++ b/src/devices/cpu/m6805/m68hc05.cpp @@ -605,11 +605,11 @@ void m68hc05_device::interrupt() pushbyte(m_cc); } SEI; - standard_irq_callback(0); if (m_pending_interrupts & M68HC05_INT_IRQ) { LOGINT("servicing external interrupt\n"); + standard_irq_callback(0, m_pc.w.l); m_irq_latch = 0; m_pending_interrupts &= ~M68HC05_INT_IRQ; if (m_params.m_addr_width > 13) @@ -620,6 +620,7 @@ void m68hc05_device::interrupt() else if (m_pending_interrupts & M68HC05_INT_TIMER) { LOGINT("servicing timer interrupt\n"); + standard_irq_callback(1, m_pc.w.l); if (m_params.m_addr_width > 13) rm16(M68HC05_VECTOR_TIMER & m_params.m_vector_mask, m_pc); else diff --git a/src/devices/cpu/m6809/base6x09.lst b/src/devices/cpu/m6809/base6x09.lst index d7387dc02ea..ed000701cc2 100644 --- a/src/devices/cpu/m6809/base6x09.lst +++ b/src/devices/cpu/m6809/base6x09.lst @@ -11,7 +11,7 @@ NMI: %PUSH_REGISTERS; m_cc |= CC_I | CC_F; set_ea(VECTOR_NMI); - standard_irq_callback(INPUT_LINE_NMI); + standard_irq_callback(INPUT_LINE_NMI, m_pc.w); goto INTERRUPT_VECTOR; FIRQ: @@ -32,7 +32,7 @@ FIRQ: %PUSH_REGISTERS; m_cc |= CC_I | CC_F; set_ea(VECTOR_FIRQ); - standard_irq_callback(M6809_FIRQ_LINE); + standard_irq_callback(M6809_FIRQ_LINE, m_pc.w); goto INTERRUPT_VECTOR; IRQ: @@ -45,7 +45,7 @@ IRQ: %PUSH_REGISTERS; m_cc |= CC_I; set_ea(VECTOR_IRQ); - standard_irq_callback(M6809_IRQ_LINE); + standard_irq_callback(M6809_IRQ_LINE, m_pc.w); goto INTERRUPT_VECTOR; INTERRUPT_VECTOR: @@ -612,9 +612,9 @@ CWAI: // invoke standard interrupt callback for MAME core switch (m_ea.w) { - case VECTOR_NMI: standard_irq_callback(INPUT_LINE_NMI); break; - case VECTOR_FIRQ: standard_irq_callback(M6809_FIRQ_LINE); break; - case VECTOR_IRQ: standard_irq_callback(M6809_IRQ_LINE); break; + case VECTOR_NMI: standard_irq_callback(INPUT_LINE_NMI, m_pc.w); break; + case VECTOR_FIRQ: standard_irq_callback(M6809_FIRQ_LINE, m_pc.w); break; + case VECTOR_IRQ: standard_irq_callback(M6809_IRQ_LINE, m_pc.w); break; default: break; } @@ -670,7 +670,7 @@ SWI: // doesn't use SOFTWARE_INTERRUPT label because SWI will // inhibit IRQ/FIRQ set_ea(VECTOR_SWI); - standard_irq_callback(M6809_SWI); + standard_irq_callback(M6809_SWI, m_pc.w); m_cc |= CC_E; set_regop16(m_s); m_temp.w = entire_state_registers(); @@ -682,12 +682,12 @@ SWI: SWI2: set_ea(VECTOR_SWI2); - standard_irq_callback(M6809_SWI); + standard_irq_callback(M6809_SWI, m_pc.w); goto SOFTWARE_INTERRUPT; SWI3: set_ea(VECTOR_SWI3); - standard_irq_callback(M6809_SWI); + standard_irq_callback(M6809_SWI, m_pc.w); goto SOFTWARE_INTERRUPT; SOFTWARE_INTERRUPT: diff --git a/src/devices/cpu/m88000/m88000.cpp b/src/devices/cpu/m88000/m88000.cpp index 657af493133..26d17fb302c 100644 --- a/src/devices/cpu/m88000/m88000.cpp +++ b/src/devices/cpu/m88000/m88000.cpp @@ -219,11 +219,11 @@ void mc88100_device::execute_run() // interrupt check if (m_int_state && !(m_cr[PSR] & PSR_IND)) { - exception(E_INTERRUPT); - // notify debugger if (machine().debug_flags & DEBUG_FLAG_ENABLED) - debug()->interrupt_hook(INPUT_LINE_IRQ0); + debug()->interrupt_hook(INPUT_LINE_IRQ0, m_fip); + + exception(E_INTERRUPT); } // update shadow registers diff --git a/src/devices/cpu/mb88xx/mb88xx.cpp b/src/devices/cpu/mb88xx/mb88xx.cpp index 1ef53c5e00b..5841169d763 100644 --- a/src/devices/cpu/mb88xx/mb88xx.cpp +++ b/src/devices/cpu/mb88xx/mb88xx.cpp @@ -423,7 +423,9 @@ void mb88_cpu_device::update_pio( int cycles ) /* process pending interrupts */ if (m_pending_interrupt & m_pio) { - m_SP[m_SI] = GETPC(); + uint16_t intpc = GETPC(); + + m_SP[m_SI] = intpc; m_SP[m_SI] |= TEST_CF() << 15; m_SP[m_SI] |= TEST_ZF() << 14; m_SP[m_SI] |= TEST_ST() << 13; @@ -434,7 +436,7 @@ void mb88_cpu_device::update_pio( int cycles ) if (m_pending_interrupt & m_pio & INT_CAUSE_EXTERNAL) { /* if we have a live external source, call the irqcallback */ - standard_irq_callback( 0 ); + standard_irq_callback( 0, intpc ); /* The datasheet doesn't mention if the interrupt flag * is cleared, but it seems to be only for this case. */ m_pio &= ~INT_CAUSE_EXTERNAL; @@ -442,10 +444,12 @@ void mb88_cpu_device::update_pio( int cycles ) } else if (m_pending_interrupt & m_pio & INT_CAUSE_TIMER) { + standard_irq_callback( 1, intpc ); m_PC = 0x04; } else if (m_pending_interrupt & m_pio & INT_CAUSE_SERIAL) { + standard_irq_callback( 2, intpc ); m_PC = 0x06; } diff --git a/src/devices/cpu/mc68hc11/mc68hc11.cpp b/src/devices/cpu/mc68hc11/mc68hc11.cpp index 6a03dcb769b..337c02ae8ac 100644 --- a/src/devices/cpu/mc68hc11/mc68hc11.cpp +++ b/src/devices/cpu/mc68hc11/mc68hc11.cpp @@ -1085,7 +1085,7 @@ void mc68hc11_cpu_device::check_irq_lines() { if( m_irq_state[MC68HC11_IRQ_LINE]!=CLEAR_LINE && (!(m_ccr & CC_I)) ) { - uint16_t pc_vector; + standard_irq_callback(MC68HC11_IRQ_LINE, m_pc); if(m_wait_state == 0) { @@ -1096,12 +1096,11 @@ void mc68hc11_cpu_device::check_irq_lines() PUSH8(REG_B); PUSH8(m_ccr); } - pc_vector = READ16(0xfff2); + uint16_t pc_vector = READ16(0xfff2); SET_PC(pc_vector); m_ccr |= CC_I; //irq taken, mask the flag if(m_wait_state == 1) { m_wait_state = 2; } if(m_stop_state == 1) { m_stop_state = 2; } - standard_irq_callback(MC68HC11_IRQ_LINE); } /* check timers here */ @@ -1135,7 +1134,7 @@ void mc68hc11_cpu_device::check_irq_lines() if( m_irq_state[MC68HC11_RTI_LINE]!=CLEAR_LINE && (!(m_ccr & CC_I)) && m_tmsk2 & 0x40) { - uint16_t pc_vector; + standard_irq_callback(MC68HC11_RTI_LINE, m_pc); if(m_wait_state == 0) { @@ -1146,18 +1145,17 @@ void mc68hc11_cpu_device::check_irq_lines() PUSH8(REG_B); PUSH8(m_ccr); } - pc_vector = READ16(0xfff0); + uint16_t pc_vector = READ16(0xfff0); SET_PC(pc_vector); m_ccr |= CC_I; //irq taken, mask the flag if(m_wait_state == 1) { m_wait_state = 2; } if(m_stop_state == 1) { m_stop_state = 2; } - standard_irq_callback(MC68HC11_RTI_LINE); m_irq_state[MC68HC11_RTI_LINE] = CLEAR_LINE; // auto-ack irq } if( m_irq_state[MC68HC11_TOC1_LINE]!=CLEAR_LINE && (!(m_ccr & CC_I)) && m_tmsk1 & 0x80) { - uint16_t pc_vector; + standard_irq_callback(MC68HC11_TOC1_LINE, m_pc); if(m_wait_state == 0) { @@ -1168,12 +1166,11 @@ void mc68hc11_cpu_device::check_irq_lines() PUSH8(REG_B); PUSH8(m_ccr); } - pc_vector = READ16(0xffe8); + uint16_t pc_vector = READ16(0xffe8); SET_PC(pc_vector); m_ccr |= CC_I; //irq taken, mask the flag if(m_wait_state == 1) { m_wait_state = 2; } if(m_stop_state == 1) { m_stop_state = 2; } - standard_irq_callback(MC68HC11_TOC1_LINE); m_irq_state[MC68HC11_TOC1_LINE] = CLEAR_LINE; // auto-ack irq } diff --git a/src/devices/cpu/mcs48/mcs48.cpp b/src/devices/cpu/mcs48/mcs48.cpp index 719759efe73..f1654f35e6a 100644 --- a/src/devices/cpu/mcs48/mcs48.cpp +++ b/src/devices/cpu/mcs48/mcs48.cpp @@ -717,8 +717,6 @@ OPHANDLER( in_a_dbb ) burn_cycles(1); // acknowledge the IBF IRQ and clear the bit in STS - if ((m_sts & STS_IBF) != 0) - standard_irq_callback(UPI41_INPUT_IBF); m_sts &= ~STS_IBF; // if P2 flags are enabled, update the state of P2 @@ -1258,6 +1256,9 @@ void mcs48_cpu_device::check_irqs() // external interrupts take priority else if ((m_irq_state || (m_sts & STS_IBF) != 0) && m_xirq_enabled) { + // indicate we took the external IRQ + standard_irq_callback(0, m_pc); + burn_cycles(2); m_irq_in_progress = true; @@ -1270,14 +1271,13 @@ void mcs48_cpu_device::check_irqs() // transfer to location 0x03 execute_call(0x03); - - // indicate we took the external IRQ - standard_irq_callback(0); } // timer overflow interrupts follow else if (m_timer_overflow && m_tirq_enabled) { + standard_irq_callback(1, m_pc); + burn_cycles(2); m_irq_in_progress = true; diff --git a/src/devices/cpu/mcs48/mcs48.h b/src/devices/cpu/mcs48/mcs48.h index 421641fb607..c37f9899d9b 100644 --- a/src/devices/cpu/mcs48/mcs48.h +++ b/src/devices/cpu/mcs48/mcs48.h @@ -50,7 +50,6 @@ enum enum { MCS48_INPUT_IRQ = 0, - UPI41_INPUT_IBF = 0, MCS48_INPUT_EA }; diff --git a/src/devices/cpu/mcs51/mcs51.cpp b/src/devices/cpu/mcs51/mcs51.cpp index 9f5bd04e4c0..0b85d6c22cf 100644 --- a/src/devices/cpu/mcs51/mcs51.cpp +++ b/src/devices/cpu/mcs51/mcs51.cpp @@ -1826,9 +1826,21 @@ void mcs51_cpu_device::check_irqs() return; } - // Hack to work around polling latency issue with JB INT0/INT1 - if (m_last_op == 0x20 && ((int_vec == V_IE0 && m_last_bit == 0xb2) || (int_vec == V_IE1 && m_last_bit == 0xb3))) - PC = PPC + 3; + // indicate we took the external IRQ + if (int_vec == V_IE0) + { + // Hack to work around polling latency issue with JB INT0 + if (m_last_op == 0x20 && m_last_bit == 0xb2) + PC = PPC + 3; + standard_irq_callback(0, PC); + } + else if (int_vec == V_IE1) + { + // Hack to work around polling latency issue with JB INT1 + if (m_last_op == 0x20 && m_last_bit == 0xb3) + PC = PPC + 3; + standard_irq_callback(1, PC); + } //Save current pc to stack, set pc to new interrupt vector push_pc(); @@ -1849,10 +1861,6 @@ void mcs51_cpu_device::check_irqs() //External Int Flag only cleared when configured as Edge Triggered.. if(GET_IT0) /* for some reason having this, breaks alving dmd games */ SET_IE0(0); - - /* indicate we took the external IRQ */ - standard_irq_callback(0); - break; case V_TF0: //Timer 0 - Always clear Flag @@ -1862,9 +1870,6 @@ void mcs51_cpu_device::check_irqs() //External Int Flag only cleared when configured as Edge Triggered.. if(GET_IT1) /* for some reason having this, breaks alving dmd games */ SET_IE1(0); - /* indicate we took the external IRQ */ - standard_irq_callback(1); - break; case V_TF1: //Timer 1 - Always clear Flag diff --git a/src/devices/cpu/mcs96/mcs96ops.lst b/src/devices/cpu/mcs96/mcs96ops.lst index 0331bcd1700..b6242a35a70 100644 --- a/src/devices/cpu/mcs96/mcs96ops.lst +++ b/src/devices/cpu/mcs96/mcs96ops.lst @@ -7,12 +7,12 @@ fetch if(level != 7) pending_irq &= ~(1<interrupt_hook(22 - count_leading_zeros_32((iphw - 1) & ~iphw)); + debug()->interrupt_hook(22 - count_leading_zeros_32((iphw - 1) & ~iphw), m_pc); } } else diff --git a/src/devices/cpu/mn1880/mn1880.cpp b/src/devices/cpu/mn1880/mn1880.cpp index 0843947a480..94149564e16 100644 --- a/src/devices/cpu/mn1880/mn1880.cpp +++ b/src/devices/cpu/mn1880/mn1880.cpp @@ -2427,7 +2427,7 @@ void mn1880_device::execute_run() { // IRQ0 (first of four external edge inputs?) has the highest priority (after RESET) unsigned level = 32 - count_leading_zeros_32((m_irq - 1) & ~m_irq); - (void)standard_irq_callback(level); + (void)standard_irq_callback(level, cpu.ip); cpu.ie &= ~(1 << level); // No separate in-service lockout; handler must re-enable specific interrupt m_if &= ~(1 << level); cpu.iemask = true; diff --git a/src/devices/cpu/nanoprocessor/nanoprocessor.cpp b/src/devices/cpu/nanoprocessor/nanoprocessor.cpp index 197efcc0b4a..da3dadedd80 100644 --- a/src/devices/cpu/nanoprocessor/nanoprocessor.cpp +++ b/src/devices/cpu/nanoprocessor/nanoprocessor.cpp @@ -136,7 +136,7 @@ void hp_nanoprocessor_device::execute_run() // outside of the NP, usually by ANDing the DC7 line with the interrupt // request signal) if (BIT(m_flags, NANO_I_BIT)) { - standard_irq_callback(0); + standard_irq_callback(0, m_reg_PA); m_reg_ISR = m_reg_PA; m_reg_PA = m_int_ack_func(); // Vector fetching takes 1 cycle diff --git a/src/devices/cpu/nec/nec.cpp b/src/devices/cpu/nec/nec.cpp index 3a961a0a4be..605480c3207 100644 --- a/src/devices/cpu/nec/nec.cpp +++ b/src/devices/cpu/nec/nec.cpp @@ -323,7 +323,7 @@ void nec_common_device::nec_interrupt(unsigned int_num, int/*INTSOURCES*/ source m_MF = 1; if (source == INT_IRQ) /* get vector */ - int_num = standard_irq_callback(0); + int_num = standard_irq_callback(0, PC()); debugger_exception_hook(int_num); dest_off = read_mem_word(int_num*4); diff --git a/src/devices/cpu/nec/v25.cpp b/src/devices/cpu/nec/v25.cpp index 321db738a04..ae13e89730d 100644 --- a/src/devices/cpu/nec/v25.cpp +++ b/src/devices/cpu/nec/v25.cpp @@ -258,7 +258,7 @@ void v25_common_device::nec_interrupt(unsigned int_num, int /*INTSOURCES*/ sourc logerror("%06x: BRKS executed with no decryption table\n",PC()); break; case INT_IRQ: /* get vector */ - int_num = standard_irq_callback(0); + int_num = standard_irq_callback(0, PC()); break; default: break; diff --git a/src/devices/cpu/ns32000/ns32000.cpp b/src/devices/cpu/ns32000/ns32000.cpp index 3ae8d57bc15..f8d3ad47e1b 100644 --- a/src/devices/cpu/ns32000/ns32000.cpp +++ b/src/devices/cpu/ns32000/ns32000.cpp @@ -894,21 +894,21 @@ template void ns32000_device::execute_run() { if (m_nmi_line) { - // service interrupt - interrupt(NMI, m_pc); - // notify the debugger if (machine().debug_enabled()) - debug()->interrupt_hook(INPUT_LINE_NMI); + debug()->interrupt_hook(INPUT_LINE_NMI, m_pc); + + // service interrupt + interrupt(NMI, m_pc); } else if (m_int_line && (m_psr & PSR_I)) { - // service interrupt - interrupt(NVI, m_pc); - // notify the debugger if (machine().debug_enabled()) - debug()->interrupt_hook(INPUT_LINE_IRQ0); + debug()->interrupt_hook(INPUT_LINE_IRQ0, m_pc); + + // service interrupt + interrupt(NVI, m_pc); } // update trace pending diff --git a/src/devices/cpu/pdp8/hd6120.cpp b/src/devices/cpu/pdp8/hd6120.cpp index fda3deea264..b1198387e70 100644 --- a/src/devices/cpu/pdp8/hd6120.cpp +++ b/src/devices/cpu/pdp8/hd6120.cpp @@ -1289,7 +1289,7 @@ void hd6120_device::execute_run() case minor_state::INTGNT_1: m_ac = m_temp & 07777; - (void)standard_irq_callback(INTREQ_LINE); + (void)standard_irq_callback(INTREQ_LINE, m_if << 12 | m_pc); m_intgnt = true; m_intgnt_callback(0); m_flags &= 6; @@ -1307,7 +1307,7 @@ void hd6120_device::execute_run() m_ac = m_temp & 07777; debugger_privilege_hook(); if (BIT(m_pnlflgs, 2)) - (void)standard_irq_callback(CPREQ_LINE); + (void)standard_irq_callback(CPREQ_LINE, m_if << 12 | m_pc); if (m_intgnt) m_intgnt_callback(1); m_if |= 010; diff --git a/src/devices/cpu/pic17/pic17.cpp b/src/devices/cpu/pic17/pic17.cpp index 99dff413d54..0258b052ca9 100644 --- a/src/devices/cpu/pic17/pic17.cpp +++ b/src/devices/cpu/pic17/pic17.cpp @@ -443,28 +443,28 @@ u16 pic17_cpu_device::interrupt_vector() if (BIT(active_ints, 0)) { // Interrupt on RA0/INT pin edge - standard_irq_callback(0); + standard_irq_callback(0, m_pc); m_intsta &= 0xef; // INTF is cleared return 0x0008; } else if (BIT(active_ints, 1)) { // Interrupt on TMR0 overflow - standard_irq_callback(1); + standard_irq_callback(1, m_pc); m_intsta &= 0xdf; // T0IF is cleared return 0x0010; } else if (BIT(active_ints, 2)) { // Interrupt on RA1/T0CKI pin edge - standard_irq_callback(2); + standard_irq_callback(2, m_pc); m_intsta &= 0xbf; // T0CKIF is cleared return 0x0018; } else if (BIT(active_ints, 3)) { // Peripheral interrupts (not further distinguished here, and PEIF is *not* cleared) - standard_irq_callback(3); + standard_irq_callback(3, m_pc); return 0x0020; } else diff --git a/src/devices/cpu/romp/romp.cpp b/src/devices/cpu/romp/romp.cpp index 6057c7621d4..c46c7b29f2d 100644 --- a/src/devices/cpu/romp/romp.cpp +++ b/src/devices/cpu/romp/romp.cpp @@ -1004,12 +1004,7 @@ void romp_device::execute_set_input(int irqline, int state) default: // interrupt lines are active low if (!state) - { m_reqi |= 1U << irqline; - - // enable debugger interrupt breakpoints - standard_irq_callback(irqline); - } else m_reqi &= ~(1U << irqline); break; @@ -1111,6 +1106,9 @@ void romp_device::interrupt_check() { if (BIT(m_reqi, irl) || BIT(m_scr[IRB], 15 - irl)) { + // enable debugger interrupt breakpoints + standard_irq_callback(irl, m_scr[IAR]); + LOGMASKED(LOG_INTERRUPT, "interrupt_check taking interrupt request level %d\n", irl); interrupt_enter(irl, m_scr[IAR]); diff --git a/src/devices/cpu/s2650/s2650.cpp b/src/devices/cpu/s2650/s2650.cpp index 4b668f569a7..9adac06044c 100644 --- a/src/devices/cpu/s2650/s2650.cpp +++ b/src/devices/cpu/s2650/s2650.cpp @@ -213,7 +213,7 @@ inline int s2650_device::check_irq_line() m_halt = 0; m_iar = (m_iar + 1) & PMSK; } - standard_irq_callback(0); + standard_irq_callback(0, m_page + m_iar); /* Say hi */ int vector = m_intack_handler(); diff --git a/src/devices/cpu/saturn/saturn.cpp b/src/devices/cpu/saturn/saturn.cpp index fcbafdb5a7f..d79d9acdee3 100644 --- a/src/devices/cpu/saturn/saturn.cpp +++ b/src/devices/cpu/saturn/saturn.cpp @@ -332,15 +332,14 @@ void saturn_device::device_reset() void saturn_device::saturn_take_irq() { + LOG("SATURN takes IRQ ($%04x)\n", m_pc); + standard_irq_callback(SATURN_IRQ_LINE, m_pc); + m_in_irq = 1; /* reset by software, using RTI */ m_pending_irq = 0; m_icount -= 7; saturn_push(m_pc); m_pc=IRQ_ADDRESS; - - LOG("SATURN takes IRQ ($%04x)\n", m_pc); - - standard_irq_callback(SATURN_IRQ_LINE); } void saturn_device::execute_run() @@ -398,7 +397,6 @@ void saturn_device::execute_set_input(int inputnum, int state) if (m_sleeping && state==1) { LOG("SATURN set_wakeup_line(ASSERT)\n"); - standard_irq_callback(SATURN_WAKEUP_LINE); m_sleeping = 0; } break; diff --git a/src/devices/cpu/score/score.cpp b/src/devices/cpu/score/score.cpp index c973bbedc0a..14565f23488 100644 --- a/src/devices/cpu/score/score.cpp +++ b/src/devices/cpu/score/score.cpp @@ -221,7 +221,6 @@ void score7_cpu_device::execute_set_input(int inputnum, int state) { if (state) { - standard_irq_callback(inputnum); if (inputnum > 0 && inputnum < 64) m_pending_interrupt |= 1ULL << inputnum; } @@ -316,7 +315,7 @@ void score7_cpu_device::check_irq() if (m_pending_interrupt & (1ULL << i)) { m_pending_interrupt &= ~(1ULL << i); - standard_irq_callback(i); + standard_irq_callback(i, m_pc); gen_exception(EXCEPTION_INTERRUPT, i); return; } diff --git a/src/devices/cpu/se3208/se3208.cpp b/src/devices/cpu/se3208/se3208.cpp index 7ebed23e5ea..a93aee29762 100644 --- a/src/devices/cpu/se3208/se3208.cpp +++ b/src/devices/cpu/se3208/se3208.cpp @@ -1726,7 +1726,7 @@ void se3208_device::device_reset() void se3208_device::SE3208_NMI() { - standard_irq_callback(INPUT_LINE_NMI); + standard_irq_callback(INPUT_LINE_NMI, m_PC); m_machinex_cb(0x00); PushVal(m_PC); @@ -1742,7 +1742,7 @@ void se3208_device::SE3208_Interrupt() if(!TESTFLAG(FLAG_ENI)) return; - standard_irq_callback(0); + standard_irq_callback(0, m_PC); m_machinex_cb(0x01); PushVal(m_PC); diff --git a/src/devices/cpu/sh/sh2.cpp b/src/devices/cpu/sh/sh2.cpp index c117afadbe0..5da515fe422 100644 --- a/src/devices/cpu/sh/sh2.cpp +++ b/src/devices/cpu/sh/sh2.cpp @@ -801,12 +801,12 @@ void sh2_device::sh2_exception(const char *message, int irqline) { if(m_vecmd == true) { - vector = standard_irq_callback(irqline); + vector = standard_irq_callback(irqline, m_sh2_state->pc); LOG("SH-2 exception #%d (external vector: $%x) after [%s]\n", irqline, vector, message); } else { - standard_irq_callback(irqline); + standard_irq_callback(irqline, m_sh2_state->pc); vector = 64 + irqline/2; LOG("SH-2 exception #%d (autovector: $%x) after [%s]\n", irqline, vector, message); } diff --git a/src/devices/cpu/sh/sh4comn.cpp b/src/devices/cpu/sh/sh4comn.cpp index ca7f42dc766..b43d8b1d5c0 100644 --- a/src/devices/cpu/sh/sh4comn.cpp +++ b/src/devices/cpu/sh/sh4comn.cpp @@ -409,7 +409,7 @@ void sh34_base_device::sh4_exception(const char *message, int exception) // hand vector = 0x600; - standard_irq_callback(INPUT_LINE_NMI); + standard_irq_callback(INPUT_LINE_NMI, m_sh2_state->pc); LOG(("SH-4 '%s' nmi exception after [%s]\n", tag(), message)); } else { // if ((m_m[ICR] & 0x4000) && (m_nmi_line_state == ASSERT_LINE)) @@ -421,9 +421,9 @@ void sh34_base_device::sh4_exception(const char *message, int exception) // hand m_m[INTEVT] = exception_codes[exception]; vector = 0x600; if ((exception >= SH4_INTC_IRL0) && (exception <= SH4_INTC_IRL3)) - standard_irq_callback((exception-SH4_INTC_IRL0)+SH4_IRL0); + standard_irq_callback((exception-SH4_INTC_IRL0)+SH4_IRL0, m_sh2_state->pc); else - standard_irq_callback(SH4_IRL3+1); + standard_irq_callback(SH4_IRL3+1, m_sh2_state->pc); LOG(("SH-4 '%s' interrupt exception #%d after [%s]\n", tag(), exception, message)); } } @@ -448,9 +448,9 @@ void sh34_base_device::sh4_exception(const char *message, int exception) // hand vector = 0x600; if ((exception >= SH4_INTC_IRL0) && (exception <= SH4_INTC_IRL3)) - standard_irq_callback((exception-SH4_INTC_IRL0)+SH4_IRL0); + standard_irq_callback((exception-SH4_INTC_IRL0)+SH4_IRL0, m_sh2_state->pc); else - standard_irq_callback(SH4_IRL3+1); + standard_irq_callback(SH4_IRL3+1, m_sh2_state->pc); if (sh3_intevt2_exception_codes[exception]==-1) fatalerror("sh3_intevt2_exception_codes unpopulated for exception %02x\n", exception); diff --git a/src/devices/cpu/sm510/sm510base.cpp b/src/devices/cpu/sm510/sm510base.cpp index 05768cdd95d..96421034b97 100644 --- a/src/devices/cpu/sm510/sm510base.cpp +++ b/src/devices/cpu/sm510/sm510base.cpp @@ -243,13 +243,13 @@ void sm510_base_device::execute_set_input(int line, int state) void sm510_base_device::do_interrupt() { + standard_irq_callback(0, m_pc + m_skip); + // note: official doc warns that Bl/Bm and the stack are undefined // after waking up, but we leave it unchanged m_icount--; m_halt = false; wakeup_vector(); - - standard_irq_callback(0); } diff --git a/src/devices/cpu/t11/t11.cpp b/src/devices/cpu/t11/t11.cpp index 422ea6e0510..5094508c76f 100644 --- a/src/devices/cpu/t11/t11.cpp +++ b/src/devices/cpu/t11/t11.cpp @@ -241,7 +241,7 @@ void t11_device::t11_check_irqs() if (irq->priority > (PSW & 0340)) { // call the callback - standard_irq_callback(m_cp_state & 15); + standard_irq_callback(m_cp_state & 15, PC); // T11 encodes the interrupt level on DAL<12:8> uint8_t iaddr = bitswap<4>(~m_cp_state & 15, 0, 1, 2, 3); diff --git a/src/devices/cpu/tms1000/tms2100.cpp b/src/devices/cpu/tms1000/tms2100.cpp index b469e7c7b08..cb0fbb16c75 100644 --- a/src/devices/cpu/tms1000/tms2100.cpp +++ b/src/devices/cpu/tms1000/tms2100.cpp @@ -243,6 +243,8 @@ void tms2100_cpu_device::read_opcode() void tms2100_cpu_device::interrupt() { + standard_irq_callback(0, m_rom_address); + // save registers m_pb_save = m_pb; m_cb_save = m_cb; @@ -264,8 +266,6 @@ void tms2100_cpu_device::interrupt() m_cb = 0; m_status = 1; m_il |= 1; - - standard_irq_callback(0); } diff --git a/src/devices/cpu/tms32025/tms32025.cpp b/src/devices/cpu/tms32025/tms32025.cpp index 756ffb7b776..dd615547e35 100644 --- a/src/devices/cpu/tms32025/tms32025.cpp +++ b/src/devices/cpu/tms32025/tms32025.cpp @@ -1858,8 +1858,8 @@ int tms32025_device::process_IRQs() if ((m_IFR & 0x01) && (m_imr & 0x01)) { /* IRQ line 0 */ //logerror("TMS32025: Active INT0\n"); + standard_irq_callback(0, m_PC); m_PC = 0x0002; - standard_irq_callback(0); m_idle = 0; m_IFR &= (~0x01); SET0(INTM_FLAG); @@ -1867,8 +1867,8 @@ int tms32025_device::process_IRQs() } if ((m_IFR & 0x02) && (m_imr & 0x02)) { /* IRQ line 1 */ //logerror("TMS32025: Active INT1\n"); + standard_irq_callback(1, m_PC); m_PC = 0x0004; - standard_irq_callback(1); m_idle = 0; m_IFR &= (~0x02); SET0(INTM_FLAG); @@ -1876,8 +1876,8 @@ int tms32025_device::process_IRQs() } if ((m_IFR & 0x04) && (m_imr & 0x04)) { /* IRQ line 2 */ //logerror("TMS32025: Active INT2\n"); + standard_irq_callback(2, m_PC); m_PC = 0x0006; - standard_irq_callback(2); m_idle = 0; m_IFR &= (~0x04); SET0(INTM_FLAG); diff --git a/src/devices/cpu/tms34010/tms34010.cpp b/src/devices/cpu/tms34010/tms34010.cpp index 161e20d7396..8602cdbb5db 100644 --- a/src/devices/cpu/tms34010/tms34010.cpp +++ b/src/devices/cpu/tms34010/tms34010.cpp @@ -691,15 +691,15 @@ void tms340x0_device::check_interrupt() /* if we took something, generate it */ if (vector) { + /* call the callback for externals */ + if (irqline >= 0) + standard_irq_callback(irqline, m_pc); + PUSH(m_pc); PUSH(m_st); RESET_ST(); m_pc = RLONG(vector); COUNT_CYCLES(16); - - /* call the callback for externals */ - if (irqline >= 0) - standard_irq_callback(irqline); } } diff --git a/src/devices/cpu/tms7000/tms7000.cpp b/src/devices/cpu/tms7000/tms7000.cpp index 3ce6f001ca2..22b553b9a33 100644 --- a/src/devices/cpu/tms7000/tms7000.cpp +++ b/src/devices/cpu/tms7000/tms7000.cpp @@ -420,12 +420,12 @@ void tms7000_device::do_interrupt(int irqline) else m_icount -= 19; + standard_irq_callback(irqline, m_pc); + push8(m_sr); push16(m_pc); m_sr = 0; m_pc = read_mem16(0xfffc - irqline * 2); - - standard_irq_callback(irqline); } diff --git a/src/devices/cpu/ucom4/ucom4.cpp b/src/devices/cpu/ucom4/ucom4.cpp index ade42ba1e12..4c2a43427c4 100644 --- a/src/devices/cpu/ucom4/ucom4.cpp +++ b/src/devices/cpu/ucom4/ucom4.cpp @@ -358,13 +358,13 @@ void ucom4_cpu_device::execute_set_input(int line, int state) void ucom4_cpu_device::do_interrupt() { + standard_irq_callback(0, m_pc); + m_icount--; push_stack(); m_pc = 0xf << 2; m_int_f = 0; m_inte_f = (m_family == NEC_UCOM43) ? 0 : 1; - - standard_irq_callback(0); } diff --git a/src/devices/cpu/unsp/unsp.cpp b/src/devices/cpu/unsp/unsp.cpp index f0c0b929454..6a815b7f441 100644 --- a/src/devices/cpu/unsp/unsp.cpp +++ b/src/devices/cpu/unsp/unsp.cpp @@ -449,13 +449,13 @@ inline void unsp_device::trigger_fiq() if (!m_core->m_enable_fiq || m_core->m_fiq) return; + standard_irq_callback(UNSP_FIQ_LINE, m_core->m_r[REG_PC]); m_core->m_fiq = 1; push(m_core->m_r[REG_PC], &m_core->m_r[REG_SP]); push(m_core->m_r[REG_SR], &m_core->m_r[REG_SP]); m_core->m_r[REG_PC] = read16(m_vectorbase + 0x06); m_core->m_r[REG_SR] = 0; - standard_irq_callback(UNSP_FIQ_LINE); } inline void unsp_device::trigger_irq(int line) @@ -463,6 +463,7 @@ inline void unsp_device::trigger_irq(int line) if ((m_core->m_ine == 0 && m_core->m_irq == 1) || m_core->m_pri <= line || !m_core->m_enable_irq) return; + standard_irq_callback(UNSP_IRQ0_LINE+line, m_core->m_r[REG_PC]); m_core->m_irq = 1; push(m_core->m_r[REG_PC], &m_core->m_r[REG_SP]); @@ -477,7 +478,6 @@ inline void unsp_device::trigger_irq(int line) m_core->m_r[REG_PC] = read16(m_vectorbase + 0x08 + line); m_core->m_r[REG_SR] = 0; - standard_irq_callback(UNSP_IRQ0_LINE+line); } void unsp_device::check_irqs() diff --git a/src/devices/cpu/upd7810/upd7810.cpp b/src/devices/cpu/upd7810/upd7810.cpp index 55c50cdfafc..bb3cda2449b 100644 --- a/src/devices/cpu/upd7810/upd7810.cpp +++ b/src/devices/cpu/upd7810/upd7810.cpp @@ -835,7 +835,7 @@ void upd7810_device::upd7810_take_irq() { /* acknowledge external IRQ */ if (irqline) - standard_irq_callback(irqline); + standard_irq_callback(irqline, PC); SP--; WM( SP, PSW ); SP--; @@ -896,7 +896,7 @@ void upd7801_device::upd7810_take_irq() { /* acknowledge external IRQ */ if (irqline) - standard_irq_callback(irqline); + standard_irq_callback(irqline, PC); SP--; WM( SP, PSW ); SP--; diff --git a/src/devices/cpu/v30mz/v30mz.cpp b/src/devices/cpu/v30mz/v30mz.cpp index 93c7ad1440e..3a755bc6706 100644 --- a/src/devices/cpu/v30mz/v30mz.cpp +++ b/src/devices/cpu/v30mz/v30mz.cpp @@ -1343,7 +1343,7 @@ void v30mz_cpu_device::interrupt(int int_num) if (int_num == -1) { - standard_irq_callback(0); + standard_irq_callback(0, pc()); int_num = m_vector_func(); m_irq_state = CLEAR_LINE; diff --git a/src/devices/cpu/v60/v60.cpp b/src/devices/cpu/v60/v60.cpp index fdce71f6808..32cf642e34b 100644 --- a/src/devices/cpu/v60/v60.cpp +++ b/src/devices/cpu/v60/v60.cpp @@ -559,6 +559,7 @@ void v60_device::stall() void v60_device::v60_do_irq(int vector) { + debugger_exception_hook(vector); uint32_t oldPSW = v60_update_psw_for_exception(1, 0); // Push PC and PSW onto the stack @@ -580,7 +581,7 @@ void v60_device::v60_try_irq() if(m_irq_line != ASSERT_LINE) m_irq_line = CLEAR_LINE; - vector = standard_irq_callback(0); + vector = standard_irq_callback(0, PC); v60_do_irq(vector + 0x40); } diff --git a/src/devices/cpu/xavix2/xavix2.cpp b/src/devices/cpu/xavix2/xavix2.cpp index 2f1753b1523..04e94af800e 100644 --- a/src/devices/cpu/xavix2/xavix2.cpp +++ b/src/devices/cpu/xavix2/xavix2.cpp @@ -144,8 +144,8 @@ uint32_t xavix2_device::execute_input_lines() const noexcept u32 xavix2_device::check_interrupt(u32 cpc) { if(m_int_line && ((m_hr[4] & F_I) || m_wait)) { - standard_irq_callback(0); m_ilr1 = m_wait ? cpc + 1 : cpc; + standard_irq_callback(0, m_ilr1); m_wait = false; m_ei_count = 0; m_if1 = m_hr[4]; diff --git a/src/devices/cpu/z180/z180op.hxx b/src/devices/cpu/z180/z180op.hxx index 06aa195624a..bdecb65966e 100644 --- a/src/devices/cpu/z180/z180op.hxx +++ b/src/devices/cpu/z180/z180op.hxx @@ -308,7 +308,7 @@ int z180_device::take_interrupt(int irq) { // retrieve the IRQ vector from the daisy chain or CPU interface device_z80daisy_interface *intf = daisy_get_irq_device(); - irq_vector = (intf != nullptr) ? intf->z80daisy_irq_ack() : standard_irq_callback_member(*this, 0); + irq_vector = (intf != nullptr) ? intf->z80daisy_irq_ack() : standard_irq_callback(0, m_PC.w.l); LOG("Z180 single int. irq_vector $%02x\n", irq_vector); diff --git a/src/devices/cpu/z8/z8.cpp b/src/devices/cpu/z8/z8.cpp index d59651b683b..d84e8992eee 100644 --- a/src/devices/cpu/z8/z8.cpp +++ b/src/devices/cpu/z8/z8.cpp @@ -1347,7 +1347,7 @@ void z8_device::take_interrupt(int irq) // acknowledge the IRQ m_irq &= ~(1 << irq); - standard_irq_callback(irq); + standard_irq_callback(irq, m_pc); // get the interrupt vector address uint16_t vector = irq * 2; diff --git a/src/devices/cpu/z80/z80.cpp b/src/devices/cpu/z80/z80.cpp index 86d9d29469b..a10754cf0b4 100644 --- a/src/devices/cpu/z80/z80.cpp +++ b/src/devices/cpu/z80/z80.cpp @@ -3259,7 +3259,7 @@ void z80_device::take_interrupt() // fetch the IRQ vector device_z80daisy_interface *intf = daisy_get_irq_device(); - int irq_vector = (intf != nullptr) ? intf->z80daisy_irq_ack() : standard_irq_callback_member(*this, 0); + int irq_vector = (intf != nullptr) ? intf->z80daisy_irq_ack() : standard_irq_callback(0, m_pc.w.l); LOG(("Z80 single int. irq_vector $%02x\n", irq_vector)); /* 'interrupt latency' cycles */ diff --git a/src/devices/cpu/z8000/z8000.cpp b/src/devices/cpu/z8000/z8000.cpp index 9e71aa4765e..15439e8b307 100644 --- a/src/devices/cpu/z8000/z8000.cpp +++ b/src/devices/cpu/z8000/z8000.cpp @@ -393,7 +393,7 @@ void z8002_device::Interrupt() else if (m_irq_req & Z8000_SEGTRAP) { - //standard_irq_callback(SEGT_LINE); + //standard_irq_callback(SEGT_LINE, m_pc); m_irq_vec = m_iack_in[0](m_pc); CHANGE_FCW(fcw | F_S_N | F_SEG_Z8001());/* switch to segmented (on Z8001) system mode */ @@ -408,7 +408,7 @@ void z8002_device::Interrupt() else if (m_irq_req & Z8000_NMI) { - standard_irq_callback(NMI_LINE); + standard_irq_callback(NMI_LINE, m_pc); m_irq_vec = m_iack_in[1](m_pc); m_halt = false; @@ -425,7 +425,7 @@ void z8002_device::Interrupt() else if ((m_irq_req & Z8000_NVI) && (m_fcw & F_NVIE)) { - standard_irq_callback(NVI_LINE); + standard_irq_callback(NVI_LINE, m_pc); m_irq_vec = m_iack_in[2](m_pc); m_halt = false; @@ -441,7 +441,7 @@ void z8002_device::Interrupt() else if ((m_irq_req & Z8000_VI) && (m_fcw & F_VIE)) { - standard_irq_callback(VI_LINE); + standard_irq_callback(VI_LINE, m_pc); m_irq_vec = m_iack_in[3](m_pc); m_halt = false; diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index eeddc7864ca..87d6484d37d 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -637,15 +637,46 @@ void device_debug::stop_hook() // acknowledged //------------------------------------------------- -void device_debug::interrupt_hook(int irqline) +void device_debug::interrupt_hook(int irqline, offs_t pc) { // see if this matches a pending interrupt request if ((m_flags & DEBUG_FLAG_STOP_INTERRUPT) != 0 && (m_stopirq == -1 || m_stopirq == irqline)) { m_device.machine().debugger().cpu().set_execution_stopped(); - m_device.machine().debugger().console().printf("Stopped on interrupt (CPU '%s', IRQ %d)\n", m_device.tag(), irqline); + const address_space &space = m_memory->space(AS_PROGRAM); + if (space.is_octal()) + m_device.machine().debugger().console().printf("Stopped on interrupt (CPU '%s', IRQ %d, PC=%0*o)\n", m_device.tag(), irqline, (space.logaddr_width() + 2) / 3, pc); + else + m_device.machine().debugger().console().printf("Stopped on interrupt (CPU '%s', IRQ %d, PC=%0*X)\n", m_device.tag(), irqline, space.logaddrchars(), pc); compute_debug_flags(); } + + if (m_trace != nullptr) + m_trace->interrupt_update(irqline, pc); + + if ((m_flags & (DEBUG_FLAG_STEPPING_OVER | DEBUG_FLAG_STEPPING_OUT | DEBUG_FLAG_STEPPING_BRANCH)) != 0) + { + if ((m_flags & DEBUG_FLAG_CALL_IN_PROGRESS) == 0) + { + if ((m_flags & DEBUG_FLAG_TEST_IN_PROGRESS) != 0) + { + if ((m_stepaddr == pc && (m_flags & DEBUG_FLAG_STEPPING_BRANCH_FALSE) != 0) || + (m_stepaddr != pc && m_delay_steps == 1 && (m_flags & (DEBUG_FLAG_STEPPING_OUT | DEBUG_FLAG_STEPPING_BRANCH_TRUE)) != 0)) + { + // step over the interrupt and then call it finished + m_flags = (m_flags & ~(DEBUG_FLAG_TEST_IN_PROGRESS | DEBUG_FLAG_STEPPING_ANY)) | DEBUG_FLAG_STEPPING_OVER; + m_stepsleft = 1; + } + } + + // remember the interrupt return address + m_flags |= DEBUG_FLAG_CALL_IN_PROGRESS; + m_stepaddr = pc; + } + + m_flags &= ~DEBUG_FLAG_TEST_IN_PROGRESS; + m_delay_steps = 0; + } } @@ -675,7 +706,7 @@ void device_debug::exception_hook(int exception) if (matched) { m_device.machine().debugger().cpu().set_execution_stopped(); - m_device.machine().debugger().console().printf("Stopped on exception (CPU '%s', exception %X, PC=%s)\n", m_device.tag(), exception, m_state->state_string(STATE_GENPCBASE)); + m_device.machine().debugger().console().printf("Stopped on exception (CPU '%s', exception %X, PC=%s)\n", m_device.tag(), exception, m_state->state_string(STATE_GENPC)); compute_debug_flags(); } } @@ -701,7 +732,7 @@ void device_debug::exception_hook(int exception) if (debugcpu.is_stopped()) { debugcpu.set_execution_stopped(); - m_device.machine().debugger().console().printf("Stopped at exception point %X (CPU '%s', PC=%s)\n", ep.m_index, m_device.tag(), m_state->state_string(STATE_GENPCBASE)); + m_device.machine().debugger().console().printf("Stopped at exception point %X (CPU '%s', PC=%s)\n", ep.m_index, m_device.tag(), m_state->state_string(STATE_GENPC)); compute_debug_flags(); } break; @@ -799,7 +830,7 @@ void device_debug::instruction_hook(offs_t curpc) m_delay_steps--; if (m_delay_steps == 0) { - // branch taken or subroutine entered (TODO: interrupt acknowledgment or interleaved multithreading can falsely trigger this) + // branch taken or subroutine entered (TODO: interleaved multithreading can falsely trigger this) if ((m_flags & DEBUG_FLAG_TEST_IN_PROGRESS) != 0 && (m_flags & (DEBUG_FLAG_STEPPING_OUT | DEBUG_FLAG_STEPPING_BRANCH_TRUE)) != 0) { debugcpu.set_execution_stopped(); @@ -847,7 +878,10 @@ void device_debug::instruction_hook(offs_t curpc) // check the temp running breakpoint and break if we hit it else if ((m_flags & DEBUG_FLAG_STOP_PC) != 0 && m_stopaddr == curpc) { - machine.debugger().console().printf("Stopped at temporary breakpoint %X on CPU '%s'\n", m_stopaddr, m_device.tag()); + if (is_octal()) + machine.debugger().console().printf("Stopped at temporary breakpoint %o on CPU '%s'\n", m_stopaddr, m_device.tag()); + else + machine.debugger().console().printf("Stopped at temporary breakpoint %X on CPU '%s'\n", m_stopaddr, m_device.tag()); debugcpu.set_execution_stopped(); } @@ -2015,6 +2049,32 @@ void device_debug::tracer::update(offs_t pc) } +//------------------------------------------------- +// interrupt_update - log interrupt to tracefile +//------------------------------------------------- + +void device_debug::tracer::interrupt_update(int irqline, offs_t pc) +{ + if (m_trace_over) + { + if (m_trace_over_target != ~0) + return; + m_trace_over_target = pc; + } + + // if we just finished looping, indicate as much + *m_file << "\n"; + if (m_detect_loops && m_loops != 0) + { + util::stream_format(*m_file, " (loops for %d instructions)\n", m_loops); + m_loops = 0; + } + + util::stream_format(*m_file, " (interrupted at %s, IRQ %d)\n\n", debug_disasm_buffer(m_debug.device()).pc_to_string(pc), irqline); + m_file->flush(); +} + + //------------------------------------------------- // vprintf - generic print to the trace file //------------------------------------------------- diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h index 416581071a7..e0470e9a16a 100644 --- a/src/emu/debug/debugcpu.h +++ b/src/emu/debug/debugcpu.h @@ -51,7 +51,7 @@ public: // hooks used by the rest of the system void start_hook(const attotime &endtime); void stop_hook(); - void interrupt_hook(int irqline); + void interrupt_hook(int irqline, offs_t pc); void exception_hook(int exception); void privilege_hook(); void instruction_hook(offs_t curpc); @@ -227,6 +227,7 @@ private: ~tracer(); void update(offs_t pc); + void interrupt_update(int irqline, offs_t pc); void vprintf(util::format_argument_pack const &args); void flush(); bool logerror() const { return m_logerror; } diff --git a/src/emu/diexec.cpp b/src/emu/diexec.cpp index b1f885e2b9d..4b06edc36d5 100644 --- a/src/emu/diexec.cpp +++ b/src/emu/diexec.cpp @@ -520,17 +520,12 @@ void device_execute_interface::interface_clock_changed(bool sync_on_new_clock_do //------------------------------------------------- -// standard_irq_callback_member - IRQ acknowledge +// standard_irq_callback - IRQ acknowledge // callback; handles HOLD_LINE case and signals // to the debugger //------------------------------------------------- -IRQ_CALLBACK_MEMBER( device_execute_interface::standard_irq_callback_member ) -{ - return device.execute().standard_irq_callback(irqline); -} - -int device_execute_interface::standard_irq_callback(int irqline) +int device_execute_interface::standard_irq_callback(int irqline, offs_t pc) { // get the default vector and acknowledge the interrupt if needed int vector = m_input[irqline].default_irq_callback(); @@ -543,7 +538,7 @@ int device_execute_interface::standard_irq_callback(int irqline) // notify the debugger if (device().machine().debug_flags & DEBUG_FLAG_ENABLED) - device().debug()->interrupt_hook(irqline); + device().debug()->interrupt_hook(irqline, pc); return vector; } diff --git a/src/emu/diexec.h b/src/emu/diexec.h index 69d65c9212e..422d5a32e1c 100644 --- a/src/emu/diexec.h +++ b/src/emu/diexec.h @@ -221,8 +221,7 @@ protected: // for use by devcpu for now... int current_input_state(unsigned i) const { return m_input[i].m_curstate; } void set_icountptr(int &icount) { assert(!m_icountptr); m_icountptr = &icount; } - IRQ_CALLBACK_MEMBER(standard_irq_callback_member); - int standard_irq_callback(int irqline); + int standard_irq_callback(int irqline, offs_t pc); // debugger hooks bool debugger_enabled() const { return bool(device().machine().debug_flags & DEBUG_FLAG_ENABLED); }