From e1f22f6903be558789fc2a1bada425e9e7d6cc50 Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Sat, 31 Aug 2019 08:45:04 +0100 Subject: [PATCH] Make it slightly easier to call individual opcodes from external control. Signed-off-by: Adrian Conlon --- Z80/inc/Z80.h | 1 + Z80/src/Z80.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Z80/inc/Z80.h b/Z80/inc/Z80.h index a41c75b..de9cbdc 100644 --- a/Z80/inc/Z80.h +++ b/Z80/inc/Z80.h @@ -52,6 +52,7 @@ namespace EightBit { Signal ExecutingInstruction; Signal ExecutedInstruction; + int execute(uint8_t opcode) { return IntelProcessor::execute(opcode); } int execute() final; int step() final; diff --git a/Z80/src/Z80.cpp b/Z80/src/Z80.cpp index 10d5e7a..4244868 100644 --- a/Z80/src/Z80.cpp +++ b/Z80/src/Z80.cpp @@ -69,7 +69,7 @@ void EightBit::Z80::handleINT() { di(); switch (IM()) { case 0: // i8080 equivalent - IntelProcessor::execute(BUS().DATA()); + execute(BUS().DATA()); break; case 1: restart(7 << 3); @@ -674,9 +674,9 @@ int EightBit::Z80::step() { } else if (UNLIKELY(lowered(INT()))) { handleINT(); } else if (UNLIKELY(lowered(HALT()))) { - IntelProcessor::execute(0); // NOP + execute(0); // NOP } else { - IntelProcessor::execute(fetchByte()); + execute(fetchByte()); } } ExecutedInstruction.fire(*this); @@ -1368,7 +1368,7 @@ void EightBit::Z80::executeOther(const int x, const int y, const int z, const in if (UNLIKELY(m_displaced)) fetchDisplacement(); lowerM1(); - IntelProcessor::execute(fetchByte()); + execute(fetchByte()); break; case 2: // OUT (n),A writePort(fetchByte()); @@ -1418,17 +1418,17 @@ void EightBit::Z80::executeOther(const int x, const int y, const int z, const in case 1: // DD prefix m_displaced = m_prefixDD = true; lowerM1(); - IntelProcessor::execute(fetchByte()); + execute(fetchByte()); break; case 2: // ED prefix m_prefixED = true; lowerM1(); - IntelProcessor::execute(fetchByte()); + execute(fetchByte()); break; case 3: // FD prefix m_displaced = m_prefixFD = true; lowerM1(); - IntelProcessor::execute(fetchByte()); + execute(fetchByte()); break; default: UNREACHABLE;