diff --git a/src/devices/cpu/adsp2100/adsp2100.cpp b/src/devices/cpu/adsp2100/adsp2100.cpp index a83614b04c3..42627c3d5e2 100644 --- a/src/devices/cpu/adsp2100/adsp2100.cpp +++ b/src/devices/cpu/adsp2100/adsp2100.cpp @@ -606,7 +606,7 @@ void adsp21xx_device::device_reset() // reset PC and loops m_pc = (m_chip_type >= CHIP_TYPE_ADSP2101) ? 0 : 4; - m_ppc = -1; + m_ppc = m_pc; m_loop = 0xffff; m_loop_condition = 0; diff --git a/src/devices/cpu/dsp32/dsp32ops.hxx b/src/devices/cpu/dsp32/dsp32ops.hxx index e89aa74fed7..696e4f14885 100644 --- a/src/devices/cpu/dsp32/dsp32ops.hxx +++ b/src/devices/cpu/dsp32/dsp32ops.hxx @@ -125,6 +125,7 @@ inline void dsp32c_device::execute_one() UINT32 op; PROCESS_DEFERRED_MEMORY(); + m_ppc = PC; debugger_instruction_hook(this, PC); op = ROPCODE(PC); m_icount -= 4; // 4 clocks per cycle diff --git a/src/devices/cpu/hd61700/hd61700.cpp b/src/devices/cpu/hd61700/hd61700.cpp index ce96d03c699..e48b83a576f 100644 --- a/src/devices/cpu/hd61700/hd61700.cpp +++ b/src/devices/cpu/hd61700/hd61700.cpp @@ -201,8 +201,6 @@ void hd61700_cpu_device::device_start() void hd61700_cpu_device::device_reset() { - m_ppc = 0x0000; - m_curpc = 0x0000; set_pc(0x0000); m_flags = FLAG_SW; m_state = 0; @@ -335,6 +333,8 @@ void hd61700_cpu_device::execute_run() { do { + m_ppc = m_curpc; + debugger_instruction_hook(this, m_curpc); // verify that CPU is not in sleep @@ -348,8 +348,6 @@ void hd61700_cpu_device::execute_run() check_irqs(); - m_ppc = m_curpc; - // instruction fetch op = read_op(); @@ -2739,6 +2737,7 @@ inline void hd61700_cpu_device::set_pc(INT32 new_pc) { m_curpc = (m_curpc & 0x30000) | new_pc; m_pc = new_pc & 0xffff; + m_ppc = m_curpc; m_fetch_addr = new_pc<<1; } diff --git a/src/devices/cpu/lc8670/lc8670.cpp b/src/devices/cpu/lc8670/lc8670.cpp index 026cb1c8756..9ea32374479 100644 --- a/src/devices/cpu/lc8670/lc8670.cpp +++ b/src/devices/cpu/lc8670/lc8670.cpp @@ -417,10 +417,10 @@ void lc8670_cpu_device::execute_run() { check_irqs(); + m_ppc = m_pc; debugger_instruction_hook(this, m_pc); int cycles; - m_ppc = m_pc; if (REG_PCON & HALT_MODE) { diff --git a/src/devices/cpu/m68000/m68kcpu.cpp b/src/devices/cpu/m68000/m68kcpu.cpp index 053ab3d6976..573673f800b 100644 --- a/src/devices/cpu/m68000/m68kcpu.cpp +++ b/src/devices/cpu/m68000/m68kcpu.cpp @@ -797,6 +797,9 @@ inline void m68000_base_device::cpu_execute(void) /* Set tracing accodring to T1. (T0 is done inside instruction) */ m68ki_trace_t1(this); /* auto-disable (see m68kcpu.h) */ + /* Record previous program counter */ + REG_PPC(this) = REG_PC(this); + /* Call external hook to peek at CPU */ debugger_instruction_hook(this, REG_PC(this)); @@ -804,9 +807,6 @@ inline void m68000_base_device::cpu_execute(void) if (!instruction_hook.isnull()) instruction_hook(*program, REG_PC(this), 0xffffffff); - /* Record previous program counter */ - REG_PPC(this) = REG_PC(this); - try { if (!pmmu_enabled) diff --git a/src/devices/cpu/mcs96/mcs96ops.lst b/src/devices/cpu/mcs96/mcs96ops.lst index 372acb44218..3c2516ae54a 100644 --- a/src/devices/cpu/mcs96/mcs96ops.lst +++ b/src/devices/cpu/mcs96/mcs96ops.lst @@ -15,9 +15,9 @@ fetch standard_irq_callback(OP1); check_irq(); } + PPC = PC; if(machine().debug_flags & DEBUG_FLAG_ENABLED) debugger_instruction_hook(this, PC); - PPC = PC; OP1 = read_pc(); if(OP1 == 0xfe) { OP1 = read_pc(); @@ -26,9 +26,9 @@ fetch inst_state = OP1; fetch_noirq + PPC = PC; if(machine().debug_flags & DEBUG_FLAG_ENABLED) debugger_instruction_hook(this, PC); - PPC = PC; OP1 = read_pc(); if(OP1 == 0xfe) { OP1 = read_pc(); diff --git a/src/devices/cpu/pic16c5x/pic16c5x.cpp b/src/devices/cpu/pic16c5x/pic16c5x.cpp index 2844fc04a58..3a4193db730 100644 --- a/src/devices/cpu/pic16c5x/pic16c5x.cpp +++ b/src/devices/cpu/pic16c5x/pic16c5x.cpp @@ -863,9 +863,8 @@ void pic16c5x_device::device_start() state_add( PIC16C5x_PSCL, "PSCL", m_debugger_temp).callimport().formatstr("%3s"); state_add( STATE_GENPC, "GENPC", m_PC).noshow(); - state_add( STATE_GENPCBASE, "CURPC", m_PC).noshow(); + state_add( STATE_GENPCBASE, "CURPC", m_PREVPC).noshow(); state_add( STATE_GENFLAGS, "GENFLAGS", m_OPTION).formatstr("%13s").noshow(); - state_add( STATE_GENPCBASE, "PREVPC", m_PREVPC).noshow(); m_icountptr = &m_icount; } diff --git a/src/devices/cpu/pic16c62x/pic16c62x.cpp b/src/devices/cpu/pic16c62x/pic16c62x.cpp index 1d990c23794..baf29483185 100644 --- a/src/devices/cpu/pic16c62x/pic16c62x.cpp +++ b/src/devices/cpu/pic16c62x/pic16c62x.cpp @@ -937,9 +937,8 @@ void pic16c62x_device::device_start() state_add( PIC16C62x_PSCL, "PSCL", m_debugger_temp).callimport().formatstr("%3s"); state_add( STATE_GENPC, "GENPC", m_PC).noshow(); - state_add( STATE_GENPCBASE, "CURPC", m_PC).noshow(); + state_add( STATE_GENPCBASE, "CURPC", m_PREVPC).noshow(); state_add( STATE_GENFLAGS, "GENFLAGS", m_OPTION).formatstr("%13s").noshow(); - state_add( STATE_GENPCBASE, "PREVPC", m_PREVPC).noshow(); m_icountptr = &m_icount; } diff --git a/src/devices/cpu/score/score.cpp b/src/devices/cpu/score/score.cpp index bb5f9cd5255..f9ae1e5d291 100644 --- a/src/devices/cpu/score/score.cpp +++ b/src/devices/cpu/score/score.cpp @@ -94,7 +94,7 @@ void score7_cpu_device::device_start() state_add(STATE_GENPC, "GENPC", m_pc).formatstr("%08X").noshow(); state_add(STATE_GENPCBASE, "CURPC", m_ppc).formatstr("%8X").noshow(); - state_add(STATE_GENFLAGS, "GENFLAGS", m_ppc).formatstr("%5s").noshow(); + state_add(STATE_GENFLAGS, "GENFLAGS", REG_CR).callexport().formatstr("%5s").noshow(); // save state save_item(NAME(m_pc)); @@ -168,9 +168,8 @@ void score7_cpu_device::execute_run() { do { - debugger_instruction_hook(this, m_pc); - m_ppc = m_pc; + debugger_instruction_hook(this, m_pc); check_irq(); diff --git a/src/devices/cpu/se3208/se3208.cpp b/src/devices/cpu/se3208/se3208.cpp index ec8ddaf0649..8889d1def61 100644 --- a/src/devices/cpu/se3208/se3208.cpp +++ b/src/devices/cpu/se3208/se3208.cpp @@ -1752,10 +1752,10 @@ void se3208_device::execute_run() { UINT16 Opcode=m_direct->read_word(m_PC, WORD_XOR_LE(0)); + m_PPC = m_PC; debugger_instruction_hook(this, m_PC); (this->*OpTable[Opcode])(Opcode); - m_PPC=m_PC; m_PC+=2; //Check interrupts if(m_NMI==ASSERT_LINE) diff --git a/src/devices/cpu/tms34010/tms34010.cpp b/src/devices/cpu/tms34010/tms34010.cpp index dd45a91a848..c2e67ccee7c 100644 --- a/src/devices/cpu/tms34010/tms34010.cpp +++ b/src/devices/cpu/tms34010/tms34010.cpp @@ -742,8 +742,8 @@ void tms340x0_device::execute_run() do { UINT16 op; - debugger_instruction_hook(this, m_pc); m_ppc = m_pc; + debugger_instruction_hook(this, m_pc); op = ROPCODE(); (this->*s_opcode_table[op >> 4])(op); } while (m_icount > 0); diff --git a/src/devices/cpu/z180/z180.cpp b/src/devices/cpu/z180/z180.cpp index c904ea33eec..26fee676f7e 100644 --- a/src/devices/cpu/z180/z180.cpp +++ b/src/devices/cpu/z180/z180.cpp @@ -2346,7 +2346,6 @@ void z180_device::execute_run() if (m_nmi_pending) { LOG(("Z180 '%s' take NMI\n", tag())); - _PPC = -1; /* there isn't a valid previous program counter */ LEAVE_HALT(); /* Check if processor was halted */ /* disable DMA transfers!! */ diff --git a/src/devices/cpu/z180/z180op.hxx b/src/devices/cpu/z180/z180op.hxx index c00515ee9a5..2479479344a 100644 --- a/src/devices/cpu/z180/z180op.hxx +++ b/src/devices/cpu/z180/z180op.hxx @@ -298,9 +298,6 @@ int z180_device::take_interrupt(int irq) int irq_vector; int cycles = 0; - /* there isn't a valid previous program counter */ - _PPC = -1; - /* Check if processor was halted */ LEAVE_HALT(); diff --git a/src/devices/cpu/z80/z80.cpp b/src/devices/cpu/z80/z80.cpp index e0a3bbb8863..ffbb57fd723 100644 --- a/src/devices/cpu/z80/z80.cpp +++ b/src/devices/cpu/z80/z80.cpp @@ -3126,9 +3126,6 @@ OP(op,ff) { rst(0x38); void z80_device::take_nmi() { - /* there isn't a valid previous program counter */ - PRVPC = -1; - /* Check if processor was halted */ leave_halt(); @@ -3149,9 +3146,6 @@ void z80_device::take_interrupt() { int irq_vector; - /* there isn't a valid previous program counter */ - PRVPC = -1; - /* Check if processor was halted */ leave_halt(); @@ -3236,9 +3230,6 @@ void z80_device::take_interrupt() void nsc800_device::take_interrupt_nsc800() { - /* there isn't a valid previous program counter */ - PRVPC = -1; - /* Check if processor was halted */ leave_halt(); diff --git a/src/devices/cpu/z8000/z8000.cpp b/src/devices/cpu/z8000/z8000.cpp index 114faab7441..2b8b874bceb 100644 --- a/src/devices/cpu/z8000/z8000.cpp +++ b/src/devices/cpu/z8000/z8000.cpp @@ -584,7 +584,6 @@ void z8002_device::clear_internal_state() void z8002_device::register_debug_state() { - state_add( Z8000_PPC, "prev PC", m_ppc ).formatstr("%08X"); state_add( Z8000_PC, "PC", m_pc ).formatstr("%08X"); state_add( Z8000_NSPOFF, "NSPOFF", m_nspoff ).formatstr("%04X"); state_add( Z8000_NSPSEG, "NSPSEG", m_nspseg ).formatstr("%04X"); @@ -783,6 +782,7 @@ void z8002_device::execute_run() if (z8k_segm_mode == Z8K_SEGM_MODE_AUTO) z8k_segm = (m_fcw & F_SEG_Z8001()) ? 1 : 0; + m_ppc = m_pc; debugger_instruction_hook(this, m_pc); if (m_irq_req & Z8000_HALT) @@ -793,7 +793,6 @@ void z8002_device::execute_run() { Z8000_exec *exec; - m_ppc = m_pc; m_op[0] = RDOP(); m_op_valid = 1; exec = &z8000_exec[m_op[0]]; diff --git a/src/devices/cpu/z8000/z8000.h b/src/devices/cpu/z8000/z8000.h index 2a0f00c3266..577b82a0935 100644 --- a/src/devices/cpu/z8000/z8000.h +++ b/src/devices/cpu/z8000/z8000.h @@ -11,7 +11,7 @@ enum { Z8000_PC=1, - Z8000_PPC, Z8000_NSPSEG, Z8000_NSPOFF, Z8000_FCW, + Z8000_NSPSEG, Z8000_NSPOFF, Z8000_FCW, Z8000_PSAPSEG, Z8000_PSAPOFF, Z8000_REFRESH, Z8000_IRQ_REQ, Z8000_IRQ_SRV, Z8000_IRQ_VEC, Z8000_R0, Z8000_R1, Z8000_R2, Z8000_R3,