diff --git a/Processors/65816/Implementation/65816Implementation.hpp b/Processors/65816/Implementation/65816Implementation.hpp index 63861d4c1..f2e19b42d 100644 --- a/Processors/65816/Implementation/65816Implementation.hpp +++ b/Processors/65816/Implementation/65816Implementation.hpp @@ -280,6 +280,11 @@ template void Processor::run_for(const Cycles } continue; + case OperationConstructDirectIndirect: + data_address_ = data_bank_ + direct_ + data_buffer_.value; + data_address_increment_mask_ = 0xff'ff'ff; + continue; + case OperationConstructDirectIndexedIndirect: data_address_ = data_bank_ + ( ((direct_ + x() + instruction_buffer_.value) & e_masks_[1]) + @@ -292,16 +297,6 @@ template void Processor::run_for(const Cycles } continue; - case OperationConstructDirectIndirect: // TODO: seems very incorrect. Check this and the programs that use it; - // 12 looks wrong, the others look correct? - data_address_ = (direct_ + instruction_buffer_.value) & 0xffff; - data_address_increment_mask_ = 0x00'ff'ff; - - if(!(direct_&0xff)) { - ++next_op_; - } - continue; - case OperationConstructDirectIndirectIndexedLong: data_address_ = y() + instruction_buffer_.value; data_address_increment_mask_ = 0xff'ff'ff; diff --git a/Processors/65816/Implementation/65816Storage.cpp b/Processors/65816/Implementation/65816Storage.cpp index d0c0d8fcb..988a962a7 100644 --- a/Processors/65816/Implementation/65816Storage.cpp +++ b/Processors/65816/Implementation/65816Storage.cpp @@ -423,9 +423,14 @@ struct CPU::WDC65816::ProcessorStorageConstructor { static void direct_indirect(AccessType type, bool is8bit, const std::function &target) { target(CycleFetchIncrementPC); // DO. - target(OperationConstructDirectIndirect); + target(OperationConstructDirect); target(CycleFetchPCThrowaway); // IO. + target(CycleFetchIncrementData); // AAL. + target(CycleFetchData); // AAH. + + target(OperationConstructDirectIndirect); + read_write(type, is8bit, target); } @@ -450,7 +455,7 @@ struct CPU::WDC65816::ProcessorStorageConstructor { static void direct_indirect_indexed_long(AccessType type, bool is8bit, const std::function &target) { target(CycleFetchIncrementPC); // DO. - target(OperationConstructDirectIndirect); + target(OperationConstructDirect); target(CycleFetchPCThrowaway); // IO. target(CycleFetchIncrementData); // AAL. @@ -466,7 +471,7 @@ struct CPU::WDC65816::ProcessorStorageConstructor { static void direct_indirect_long(AccessType type, bool is8bit, const std::function &target) { target(CycleFetchIncrementPC); // DO. - target(OperationConstructDirectIndirect); + target(OperationConstructDirect); target(CycleFetchPCThrowaway); // IO. target(CycleFetchIncrementData); // AAL. diff --git a/Processors/65816/Implementation/65816Storage.hpp b/Processors/65816/Implementation/65816Storage.hpp index 3606b0b47..d9537fb49 100644 --- a/Processors/65816/Implementation/65816Storage.hpp +++ b/Processors/65816/Implementation/65816Storage.hpp @@ -89,9 +89,8 @@ enum MicroOp: uint8_t { /// Skips the next micro-op if the low byte of the direct register is 0. OperationConstructDirectIndexedIndirect, - /// Constructs the current direct indexed indirect address using the data bank and - /// direct registers plus the value currently in the instruction buffer. - /// Skips the next micro-op if the low byte of the direct register is 0. + /// Constructs the current direct indexed indirect address using the value + /// currently in the data buffer. OperationConstructDirectIndirect, /// Adds y to the low 16-bits currently in the instruction buffer and appends a high 8-bits