1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-02 20:30:00 +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;
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 <typename BusHandler> void Processor<BusHandler>::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;

View File

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