From 52e5987dcb1deff5cc24cad70a3261ad0d6e82fa Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 13 Jan 2016 13:36:07 +0100 Subject: [PATCH] latching of external_input makes previous revert to work by Juergen(nw) --- src/devices/cpu/ccpu/ccpu.cpp | 12 ++++++++---- src/devices/cpu/ccpu/ccpu.h | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/devices/cpu/ccpu/ccpu.cpp b/src/devices/cpu/ccpu/ccpu.cpp index 85756d12794..bde43753786 100644 --- a/src/devices/cpu/ccpu/ccpu.cpp +++ b/src/devices/cpu/ccpu/ccpu.cpp @@ -121,6 +121,7 @@ void ccpu_cpu_device::device_start() save_item(NAME(m_drflag)); save_item(NAME(m_waiting)); save_item(NAME(m_watchdog)); + save_item(NAME(m_extinput)); // Register state for debugger state_add( CCPU_PC, "PC", m_PC).formatstr("%04X"); @@ -149,7 +150,7 @@ void ccpu_cpu_device::state_string_export(const device_state_entry &entry, std:: TEST_NC ? 'N' : 'n', TEST_LT ? 'L' : 'l', TEST_EQ ? 'E' : 'e', - m_external_input() ? 'M' : 'm', + m_extinput ? 'M' : 'm', TEST_DR ? 'D' : 'd'); break; } @@ -206,8 +207,11 @@ void ccpu_cpu_device::execute_run() m_nextmiflag = m_nextnextmiflag; /* fetch the opcode */ + opcode = READOP(m_PC); + if (opcode == 0x51 || opcode == 0x59) + m_extinput = m_external_input(); debugger_instruction_hook(this, m_PC); - opcode = READOP(m_PC++); + m_PC++; switch (opcode) { @@ -286,7 +290,7 @@ void ccpu_cpu_device::execute_run() /* JMIB/JEHB */ case 0x51: - if (m_external_input()) { m_PC = ((m_PC - 1) & 0xf000) + m_J; CYCLES(2); } + if (m_extinput) { m_PC = ((m_PC - 1) & 0xf000) + m_J; CYCLES(2); } NEXT_ACC_B; CYCLES(2); break; @@ -333,7 +337,7 @@ void ccpu_cpu_device::execute_run() /* JMI/JEH */ case 0x59: - if (m_external_input()) { m_PC = ((m_PC - 1) & 0xf000) + m_J; CYCLES(2); } + if (m_extinput) { m_PC = ((m_PC - 1) & 0xf000) + m_J; CYCLES(2); } NEXT_ACC_A; CYCLES(2); break; diff --git a/src/devices/cpu/ccpu/ccpu.h b/src/devices/cpu/ccpu/ccpu.h index bfae00383e3..9247e54f16d 100644 --- a/src/devices/cpu/ccpu/ccpu.h +++ b/src/devices/cpu/ccpu/ccpu.h @@ -113,6 +113,7 @@ protected: UINT8 m_waiting; UINT8 m_watchdog; + UINT8 m_extinput; int m_icount;