mirror of
https://github.com/TomHarte/CLK.git
synced 2024-10-06 15:00:05 +00:00
Attempts direct and direct indexed indirect.
This commit is contained in:
parent
d8dccf2500
commit
9a05c68ce7
@ -21,6 +21,9 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
|
|||||||
#define read(address, value) perform_bus(address, value, MOS6502Esque::Read)
|
#define read(address, value) perform_bus(address, value, MOS6502Esque::Read)
|
||||||
#define write(address, value) perform_bus(address, value, MOS6502Esque::Write)
|
#define write(address, value) perform_bus(address, value, MOS6502Esque::Write)
|
||||||
|
|
||||||
|
#define x() (x_.full & x_masks_[1])
|
||||||
|
#define y() (y_.full & x_masks_[1])
|
||||||
|
|
||||||
Cycles number_of_cycles = cycles + cycles_left_to_run_;
|
Cycles number_of_cycles = cycles + cycles_left_to_run_;
|
||||||
while(number_of_cycles > Cycles(0)) {
|
while(number_of_cycles > Cycles(0)) {
|
||||||
const MicroOp operation = *next_op_;
|
const MicroOp operation = *next_op_;
|
||||||
@ -107,15 +110,15 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CycleFetchBlockX:
|
case CycleFetchBlockX:
|
||||||
read(((instruction_buffer_.value & 0xff00) << 8) | (x_.full & x_masks_[1]), data_buffer_.any_byte());
|
read(((instruction_buffer_.value & 0xff00) << 8) | x(), data_buffer_.any_byte());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CycleFetchBlockY:
|
case CycleFetchBlockY:
|
||||||
read(((instruction_buffer_.value & 0xff00) << 8) | (y_.full & x_masks_[1]), &throwaway);
|
read(((instruction_buffer_.value & 0xff00) << 8) | y(), &throwaway);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CycleStoreBlockY:
|
case CycleStoreBlockY:
|
||||||
write(((instruction_buffer_.value & 0xff00) << 8) | (y_.full & x_masks_[1]), data_buffer_.any_byte());
|
write(((instruction_buffer_.value & 0xff00) << 8) | x(), data_buffer_.any_byte());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#undef increment_data_address
|
#undef increment_data_address
|
||||||
@ -172,16 +175,16 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case OperationConstructAbsoluteIndexedIndirect:
|
case OperationConstructAbsoluteIndexedIndirect:
|
||||||
data_address_ = (instruction_buffer_.value + (x_.full & x_masks_[1])) & 0xffff;
|
data_address_ = (instruction_buffer_.value + x()) & 0xffff;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OperationConstructAbsoluteLongX:
|
case OperationConstructAbsoluteLongX:
|
||||||
data_address_ = instruction_buffer_.value + (x_.full & x_masks_[1]);
|
data_address_ = instruction_buffer_.value + x();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OperationConstructAbsoluteXRead:
|
case OperationConstructAbsoluteXRead:
|
||||||
case OperationConstructAbsoluteX:
|
case OperationConstructAbsoluteX:
|
||||||
data_address_ = ((instruction_buffer_.value + (x_.full & x_masks_[1])) & 0xffff) | data_bank_;
|
data_address_ = ((instruction_buffer_.value + x()) & 0xffff) | data_bank_;
|
||||||
incorrect_data_address_ = (data_address_ & 0xff) | (instruction_buffer_.value & 0xff00) | data_bank_;
|
incorrect_data_address_ = (data_address_ & 0xff) | (instruction_buffer_.value & 0xff00) | data_bank_;
|
||||||
|
|
||||||
// If the incorrect address isn't actually incorrect, skip its usage.
|
// If the incorrect address isn't actually incorrect, skip its usage.
|
||||||
@ -192,7 +195,7 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
|
|||||||
|
|
||||||
case OperationConstructAbsoluteYRead:
|
case OperationConstructAbsoluteYRead:
|
||||||
case OperationConstructAbsoluteY:
|
case OperationConstructAbsoluteY:
|
||||||
data_address_ = ((instruction_buffer_.value + (y_.full & x_masks_[1])) & 0xffff) | data_bank_;
|
data_address_ = ((instruction_buffer_.value + y()) & 0xffff) | data_bank_;
|
||||||
incorrect_data_address_ = (data_address_ & 0xff) | (instruction_buffer_.value & 0xff00) | data_bank_;
|
incorrect_data_address_ = (data_address_ & 0xff) | (instruction_buffer_.value & 0xff00) | data_bank_;
|
||||||
|
|
||||||
// If the incorrect address isn't actually incorrect, skip its usage.
|
// If the incorrect address isn't actually incorrect, skip its usage.
|
||||||
@ -201,6 +204,20 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OperationConstructDirect:
|
||||||
|
data_address_ = direct_ + instruction_buffer_.value;
|
||||||
|
if(!(direct_&0xff)) {
|
||||||
|
++next_op_;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OperationConstructDirectIndexedIndirect:
|
||||||
|
data_address_ = direct_ + x() + instruction_buffer_.value;
|
||||||
|
if(!(direct_&0xff)) {
|
||||||
|
++next_op_;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Performance.
|
// Performance.
|
||||||
//
|
//
|
||||||
@ -301,6 +318,8 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
|
|||||||
#undef read
|
#undef read
|
||||||
#undef write
|
#undef write
|
||||||
#undef bus_operation
|
#undef bus_operation
|
||||||
|
#undef x
|
||||||
|
#undef y
|
||||||
|
|
||||||
cycles_left_to_run_ = number_of_cycles;
|
cycles_left_to_run_ = number_of_cycles;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user