diff --git a/Processors/65816/Implementation/65816Implementation.hpp b/Processors/65816/Implementation/65816Implementation.hpp index ff2e997ec..da436c016 100644 --- a/Processors/65816/Implementation/65816Implementation.hpp +++ b/Processors/65816/Implementation/65816Implementation.hpp @@ -268,7 +268,7 @@ template void Processor::run_for(const Cycles continue; case OperationConstructDirectX: - data_address_ = (direct_ + x()) & 0xffff; + data_address_ = (instruction_buffer_.value + direct_ + x()) & 0xffff; incorrect_data_address_ = (direct_ & 0xff00) + (data_address_ & 0x00ff); if(!(direct_&0xff)) { ++next_op_; @@ -276,7 +276,8 @@ template void Processor::run_for(const Cycles continue; case OperationConstructDirectY: - data_address_ = (direct_ + y()) & 0xffff; + data_address_ = (instruction_buffer_.value + direct_ + y()) & 0xffff; + // TODO: given the 16-bit internal arithmetic, confirm this is the correct spurious address. incorrect_data_address_ = (direct_ & 0xff00) + (data_address_ & 0x00ff); if(!(direct_&0xff)) { ++next_op_;