diff --git a/OSBindings/Mac/Clock SignalTests/WolfgangLorenzTests.swift b/OSBindings/Mac/Clock SignalTests/WolfgangLorenzTests.swift index 7f9e6f7c1..a7233d8e4 100644 --- a/OSBindings/Mac/Clock SignalTests/WolfgangLorenzTests.swift +++ b/OSBindings/Mac/Clock SignalTests/WolfgangLorenzTests.swift @@ -256,6 +256,11 @@ class WolfgangLorenzTests: XCTestCase, CSTestMachineTrapHandler { machine.setValue(0x0801, for: .programCounter) machine.setValue(0xfd, for: .stackPointer) machine.setValue(0x04, for: .flags) + + // For consistency when debugging; otherwise immaterial. + machine.setValue(0x00, for: .A) + machine.setValue(0x00, for: .X) + machine.setValue(0x00, for: .Y) } } diff --git a/Processors/65816/Implementation/65816Implementation.hpp b/Processors/65816/Implementation/65816Implementation.hpp index d8b11676b..59ceebd56 100644 --- a/Processors/65816/Implementation/65816Implementation.hpp +++ b/Processors/65816/Implementation/65816Implementation.hpp @@ -249,7 +249,10 @@ template void Processor::run_for(const Cycles continue; case OperationConstructDirectIndexedIndirect: - data_address_ = data_bank_ + (direct_ + x() + instruction_buffer_.value) & 0xffff; + data_address_ = data_bank_ + ( + ((direct_ + x() + instruction_buffer_.value) & e_masks_[1]) + + (direct_ & e_masks_[0]) + ) & 0xffff; if(!(direct_&0xff)) { ++next_op_; }