mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-11-12 17:04:46 +00:00
Correct at least some of the problems with the Z80 interrupt rewrite
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
23f7a88480
commit
f1b3fc1932
@ -53,8 +53,6 @@ namespace EightBit {
|
||||
bool& INT() { return m_intLine; }
|
||||
bool& NMI() { return m_nmiLine; }
|
||||
|
||||
//int interrupt(bool maskable, uint8_t value);
|
||||
|
||||
virtual int execute(uint8_t opcode) final;
|
||||
virtual int step() final;
|
||||
|
||||
|
@ -651,36 +651,36 @@ int EightBit::Z80::step() {
|
||||
resetCycles();
|
||||
if (LIKELY(powered())) {
|
||||
M1() = true;
|
||||
uint8_t instruction;
|
||||
if (UNLIKELY(NMI())) {
|
||||
NMI() = IFF1() = false;
|
||||
restart(0x66);
|
||||
addCycles(13);
|
||||
return cycles();
|
||||
} else if (UNLIKELY(INT() && IFF1())) {
|
||||
di();
|
||||
switch (IM()) {
|
||||
case 0:
|
||||
instruction = BUS().DATA();
|
||||
break;
|
||||
case 1:
|
||||
restart(7 << 3);
|
||||
addCycles(13);
|
||||
return cycles();
|
||||
case 2:
|
||||
pushWord(PC());
|
||||
PC().low = BUS().DATA();
|
||||
PC().high = IV();
|
||||
addCycles(19);
|
||||
return cycles();
|
||||
default:
|
||||
UNREACHABLE;
|
||||
}
|
||||
} else {
|
||||
instruction = fetchByte();
|
||||
}
|
||||
M1() = true;
|
||||
return execute(instruction);
|
||||
if (UNLIKELY(INT())) {
|
||||
INT() = false;
|
||||
if (IFF1()) {
|
||||
di();
|
||||
switch (IM()) {
|
||||
case 0:
|
||||
return execute(BUS().DATA());
|
||||
break;
|
||||
case 1:
|
||||
restart(7 << 3);
|
||||
addCycles(13);
|
||||
return cycles();
|
||||
case 2:
|
||||
pushWord(PC());
|
||||
PC().low = BUS().DATA();
|
||||
PC().high = IV();
|
||||
addCycles(19);
|
||||
return cycles();
|
||||
default:
|
||||
UNREACHABLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return execute(fetchByte());
|
||||
}
|
||||
return cycles();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user