Make it slightly easier to call individual opcodes from external control.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2019-08-31 08:45:04 +01:00
parent f48f1d559e
commit e1f22f6903
2 changed files with 8 additions and 7 deletions

View File

@ -52,6 +52,7 @@ namespace EightBit {
Signal<Z80> ExecutingInstruction; Signal<Z80> ExecutingInstruction;
Signal<Z80> ExecutedInstruction; Signal<Z80> ExecutedInstruction;
int execute(uint8_t opcode) { return IntelProcessor::execute(opcode); }
int execute() final; int execute() final;
int step() final; int step() final;

View File

@ -69,7 +69,7 @@ void EightBit::Z80::handleINT() {
di(); di();
switch (IM()) { switch (IM()) {
case 0: // i8080 equivalent case 0: // i8080 equivalent
IntelProcessor::execute(BUS().DATA()); execute(BUS().DATA());
break; break;
case 1: case 1:
restart(7 << 3); restart(7 << 3);
@ -674,9 +674,9 @@ int EightBit::Z80::step() {
} else if (UNLIKELY(lowered(INT()))) { } else if (UNLIKELY(lowered(INT()))) {
handleINT(); handleINT();
} else if (UNLIKELY(lowered(HALT()))) { } else if (UNLIKELY(lowered(HALT()))) {
IntelProcessor::execute(0); // NOP execute(0); // NOP
} else { } else {
IntelProcessor::execute(fetchByte()); execute(fetchByte());
} }
} }
ExecutedInstruction.fire(*this); 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)) if (UNLIKELY(m_displaced))
fetchDisplacement(); fetchDisplacement();
lowerM1(); lowerM1();
IntelProcessor::execute(fetchByte()); execute(fetchByte());
break; break;
case 2: // OUT (n),A case 2: // OUT (n),A
writePort(fetchByte()); 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 case 1: // DD prefix
m_displaced = m_prefixDD = true; m_displaced = m_prefixDD = true;
lowerM1(); lowerM1();
IntelProcessor::execute(fetchByte()); execute(fetchByte());
break; break;
case 2: // ED prefix case 2: // ED prefix
m_prefixED = true; m_prefixED = true;
lowerM1(); lowerM1();
IntelProcessor::execute(fetchByte()); execute(fetchByte());
break; break;
case 3: // FD prefix case 3: // FD prefix
m_displaced = m_prefixFD = true; m_displaced = m_prefixFD = true;
lowerM1(); lowerM1();
IntelProcessor::execute(fetchByte()); execute(fetchByte());
break; break;
default: default:
UNREACHABLE; UNREACHABLE;