From 290598429a526ef3642eb33dd7fac194d133d803 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 9 Oct 2020 23:22:48 -0400 Subject: [PATCH] Applies indirect page zero emulation mode addressing constraint to ix addressing. Lorenz's LDA tests now pass in emulation mode. --- OSBindings/Mac/Clock SignalTests/WolfgangLorenzTests.swift | 5 +++++ Processors/65816/Implementation/65816Implementation.hpp | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) 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_; }