removed interrupt handling code

This commit is contained in:
thrust26 2024-07-30 21:49:00 +02:00
parent 5d1f4a2a0e
commit 1a16d3633f
2 changed files with 1 additions and 55 deletions

View File

@ -417,15 +417,6 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
#endif #endif
} }
// JTZ, TODO: This code seems to be superfluous for a 6507:
// See if we need to handle an interrupt
if((myExecutionStatus & MaskableInterruptBit) ||
(myExecutionStatus & NonmaskableInterruptBit))
{
// Yes, so handle the interrupt
interruptHandler();
}
// See if a fatal error has occurred // See if a fatal error has occurred
if(myExecutionStatus & FatalErrorBit) if(myExecutionStatus & FatalErrorBit)
{ {
@ -450,34 +441,6 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void M6502::interruptHandler()
{
// Handle the interrupt
if((myExecutionStatus & MaskableInterruptBit) && !I)
{
mySystem->incrementCycles(7 * SYSTEM_CYCLES_PER_CPU);
mySystem->poke(0x0100 + SP--, (PC - 1) >> 8);
mySystem->poke(0x0100 + SP--, (PC - 1) & 0x00ff);
mySystem->poke(0x0100 + SP--, PS() & (~0x10));
D = false;
I = true;
PC = static_cast<uInt16>(mySystem->peek(0xFFFE)) | (static_cast<uInt16>(mySystem->peek(0xFFFF)) << 8);
}
else if(myExecutionStatus & NonmaskableInterruptBit)
{
mySystem->incrementCycles(7 * SYSTEM_CYCLES_PER_CPU);
mySystem->poke(0x0100 + SP--, (PC - 1) >> 8);
mySystem->poke(0x0100 + SP--, (PC - 1) & 0x00ff);
mySystem->poke(0x0100 + SP--, PS() & (~0x10));
D = false;
PC = static_cast<uInt16>(mySystem->peek(0xFFFA)) | (static_cast<uInt16>(mySystem->peek(0xFFFB)) << 8);
}
// Clear the interrupt bits in myExecutionStatus
myExecutionStatus &= ~(MaskableInterruptBit | NonmaskableInterruptBit);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool M6502::save(Serializer& out) const bool M6502::save(Serializer& out) const
{ {

View File

@ -83,16 +83,6 @@ class M6502 : public Serializable
*/ */
void reset(); void reset();
/**
Request a maskable interrupt
*/
void irq() { myExecutionStatus |= MaskableInterruptBit; }
/**
Request a non-maskable interrupt
*/
void nmi() { myExecutionStatus |= NonmaskableInterruptBit; }
/** /**
Set the callback for handling a halt condition Set the callback for handling a halt condition
*/ */
@ -330,11 +320,6 @@ class M6502 : public Serializable
C = ps & 0x01; C = ps & 0x01;
} }
/**
Called after an interrupt has be requested using irq() or nmi()
*/
void interruptHandler();
/** /**
Check whether halt was requested (RDY low) and notify Check whether halt was requested (RDY low) and notify
*/ */
@ -362,9 +347,7 @@ class M6502 : public Serializable
*/ */
static constexpr uInt8 static constexpr uInt8
StopExecutionBit = 0x01, StopExecutionBit = 0x01,
FatalErrorBit = 0x02, FatalErrorBit = 0x02
MaskableInterruptBit = 0x04,
NonmaskableInterruptBit = 0x08
; ;
uInt8 myExecutionStatus{0}; uInt8 myExecutionStatus{0};