diff --git a/InstructionSets/M68k/ExceptionVectors.hpp b/InstructionSets/M68k/ExceptionVectors.hpp index 83fbf2552..e56c71efb 100644 --- a/InstructionSets/M68k/ExceptionVectors.hpp +++ b/InstructionSets/M68k/ExceptionVectors.hpp @@ -29,7 +29,7 @@ enum Exception { FormatError = 14, UninitialisedInterrupt = 15, SpuriousInterrupt = 24, - InterruptAutovectorBase = 25, + InterruptAutovectorBase = 25, // This is the vector for interrupt level _1_. TrapBase = 32, FPBranchOrSetOnUnorderedCondition = 48, FPInexactResult = 49, diff --git a/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp b/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp index af9055586..6f2bc868d 100644 --- a/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp +++ b/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp @@ -44,6 +44,7 @@ enum ExecutionState: int { StandardException, BusOrAddressErrorException, + DoInterrupt, // Specific addressing mode fetches. // @@ -313,8 +314,9 @@ void Processor status_.interrupt_level) { + MoveToStateSpecific(DoInterrupt); + } MoveToStateSpecific(STOP); // Perform the RESET exception, which seeds the stack pointer and program @@ -410,14 +416,80 @@ void Processor status_.interrupt_level) { + MoveToStateSpecific(DoInterrupt); + } + + // Read and decode an opcode. opcode_ = prefetch_.high.w; instruction_ = decoder_.decode(opcode_); - instruction_address_.l = program_counter_.l - 4; // Signal the bus handler if requested. if constexpr (signal_will_perform) { diff --git a/Processors/68000Mk2/Implementation/68000Mk2Storage.hpp b/Processors/68000Mk2/Implementation/68000Mk2Storage.hpp index 5dad01a37..ee050c49f 100644 --- a/Processors/68000Mk2/Implementation/68000Mk2Storage.hpp +++ b/Processors/68000Mk2/Implementation/68000Mk2Storage.hpp @@ -58,6 +58,11 @@ struct ProcessorBase: public InstructionSet::M68k::NullFlowController { /// Current input interrupt level. int bus_interrupt_level_ = 0; + // I don't have great information on the 68000 interrupt latency; as a first + // guess, capture the bus interrupt level upon every prefetch, and use that for + // the inner-loop decision. + int captured_interrupt_level_ = 0; + /// Contains the prefetch queue; the most-recently fetched thing is the /// low portion of this word, and the thing fetched before that has /// proceeded to the high portion.