mirror of
https://github.com/TomHarte/CLK.git
synced 2026-01-23 01:16:10 +00:00
Implement fast modify path; fix more NOPs.
This commit is contained in:
@@ -49,6 +49,7 @@ enum class AddressingMode {
|
||||
|
||||
Absolute,
|
||||
AbsoluteIndexed,
|
||||
FastAbsoluteIndexedModify,
|
||||
Zero,
|
||||
ZeroIndexed,
|
||||
ZeroIndirect,
|
||||
@@ -556,14 +557,19 @@ struct Decoder<model, std::enable_if_t<model == Model::Synertek65C02>> {
|
||||
case 0x3c: return {AbsoluteIndexed, Operation::BIT};
|
||||
case 0x9c: return {Absolute, Operation::STZ};
|
||||
|
||||
case 0x1f: return {AbsoluteIndexed, Operation::NOP};
|
||||
case 0x3f: return {AbsoluteIndexed, Operation::NOP};
|
||||
case 0x5f: return {AbsoluteIndexed, Operation::NOP};
|
||||
case 0x7f: return {AbsoluteIndexed, Operation::NOP};
|
||||
case 0x9f: return {AbsoluteIndexed, Operation::NOP};
|
||||
case 0xbf: return {AbsoluteIndexed, Operation::NOP};
|
||||
case 0xdf: return {AbsoluteIndexed, Operation::NOP};
|
||||
case 0xff: return {AbsoluteIndexed, Operation::NOP};
|
||||
case 0x1e: return {FastAbsoluteIndexedModify, Operation::ASL};
|
||||
case 0x3e: return {FastAbsoluteIndexedModify, Operation::ROL};
|
||||
case 0x5e: return {FastAbsoluteIndexedModify, Operation::LSR};
|
||||
case 0x7e: return {FastAbsoluteIndexedModify, Operation::ROR};
|
||||
|
||||
case 0x1f: return {AbsoluteIndexed, Operation::FastNOP};
|
||||
case 0x3f: return {AbsoluteIndexed, Operation::FastNOP};
|
||||
case 0x5f: return {AbsoluteIndexed, Operation::FastNOP};
|
||||
case 0x7f: return {AbsoluteIndexed, Operation::FastNOP};
|
||||
case 0x9f: return {AbsoluteIndexed, Operation::FastNOP};
|
||||
case 0xbf: return {AbsoluteIndexed, Operation::FastNOP};
|
||||
case 0xdf: return {AbsoluteIndexed, Operation::FastNOP};
|
||||
case 0xff: return {AbsoluteIndexed, Operation::FastNOP};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -323,6 +323,27 @@ void Processor<model, Traits>::run_for(const Cycles cycles) {
|
||||
access(BusOperation::Read, Literal(registers.pc.full), throwaway);
|
||||
goto access_absolute;
|
||||
|
||||
// MARK: - Fast absolute indexed modify, which is a 65c02 improvement but not applied universally.
|
||||
|
||||
case access_program(FastAbsoluteIndexedModify):
|
||||
++registers.pc.full;
|
||||
|
||||
// Read top half of address.
|
||||
Storage::address_.halves.low = Storage::operand_;
|
||||
check_interrupt();
|
||||
access(BusOperation::Read, Literal(registers.pc.full), Storage::address_.halves.high);
|
||||
|
||||
// If this is a read and the top byte doesn't need adjusting, skip that cycle.
|
||||
Storage::operand_ = Storage::address_.halves.high;
|
||||
Storage::address_.full += index();
|
||||
if(Storage::address_.halves.high == Storage::operand_) {
|
||||
goto access_absolute;
|
||||
}
|
||||
|
||||
check_interrupt();
|
||||
access(BusOperation::Read, Literal(registers.pc.full), throwaway);
|
||||
goto access_absolute;
|
||||
|
||||
// MARK: - Indexed indirect.
|
||||
|
||||
case access_program(IndexedIndirect):
|
||||
|
||||
Reference in New Issue
Block a user