1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-04 18:29:40 +00:00

Attempts to resolve my direct-indirect addressing stumble.

This commit is contained in:
Thomas Harte 2020-10-13 20:21:53 -04:00
parent a15d4a156b
commit 8f5537aaaa
3 changed files with 15 additions and 16 deletions

View File

@ -280,6 +280,11 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
} }
continue; continue;
case OperationConstructDirectIndirect:
data_address_ = data_bank_ + direct_ + data_buffer_.value;
data_address_increment_mask_ = 0xff'ff'ff;
continue;
case OperationConstructDirectIndexedIndirect: case OperationConstructDirectIndexedIndirect:
data_address_ = data_bank_ + ( data_address_ = data_bank_ + (
((direct_ + x() + instruction_buffer_.value) & e_masks_[1]) + ((direct_ + x() + instruction_buffer_.value) & e_masks_[1]) +
@ -292,16 +297,6 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
} }
continue; 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: case OperationConstructDirectIndirectIndexedLong:
data_address_ = y() + instruction_buffer_.value; data_address_ = y() + instruction_buffer_.value;
data_address_increment_mask_ = 0xff'ff'ff; data_address_increment_mask_ = 0xff'ff'ff;

View File

@ -423,9 +423,14 @@ struct CPU::WDC65816::ProcessorStorageConstructor {
static void direct_indirect(AccessType type, bool is8bit, const std::function<void(MicroOp)> &target) { static void direct_indirect(AccessType type, bool is8bit, const std::function<void(MicroOp)> &target) {
target(CycleFetchIncrementPC); // DO. target(CycleFetchIncrementPC); // DO.
target(OperationConstructDirectIndirect); target(OperationConstructDirect);
target(CycleFetchPCThrowaway); // IO. target(CycleFetchPCThrowaway); // IO.
target(CycleFetchIncrementData); // AAL.
target(CycleFetchData); // AAH.
target(OperationConstructDirectIndirect);
read_write(type, is8bit, target); 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<void(MicroOp)> &target) { static void direct_indirect_indexed_long(AccessType type, bool is8bit, const std::function<void(MicroOp)> &target) {
target(CycleFetchIncrementPC); // DO. target(CycleFetchIncrementPC); // DO.
target(OperationConstructDirectIndirect); target(OperationConstructDirect);
target(CycleFetchPCThrowaway); // IO. target(CycleFetchPCThrowaway); // IO.
target(CycleFetchIncrementData); // AAL. target(CycleFetchIncrementData); // AAL.
@ -466,7 +471,7 @@ struct CPU::WDC65816::ProcessorStorageConstructor {
static void direct_indirect_long(AccessType type, bool is8bit, const std::function<void(MicroOp)> &target) { static void direct_indirect_long(AccessType type, bool is8bit, const std::function<void(MicroOp)> &target) {
target(CycleFetchIncrementPC); // DO. target(CycleFetchIncrementPC); // DO.
target(OperationConstructDirectIndirect); target(OperationConstructDirect);
target(CycleFetchPCThrowaway); // IO. target(CycleFetchPCThrowaway); // IO.
target(CycleFetchIncrementData); // AAL. target(CycleFetchIncrementData); // AAL.

View File

@ -89,9 +89,8 @@ enum MicroOp: uint8_t {
/// Skips the next micro-op if the low byte of the direct register is 0. /// Skips the next micro-op if the low byte of the direct register is 0.
OperationConstructDirectIndexedIndirect, OperationConstructDirectIndexedIndirect,
/// Constructs the current direct indexed indirect address using the data bank and /// Constructs the current direct indexed indirect address using the value
/// direct registers plus the value currently in the instruction buffer. /// currently in the data buffer.
/// Skips the next micro-op if the low byte of the direct register is 0.
OperationConstructDirectIndirect, OperationConstructDirectIndirect,
/// Adds y to the low 16-bits currently in the instruction buffer and appends a high 8-bits /// Adds y to the low 16-bits currently in the instruction buffer and appends a high 8-bits