mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-23 03:32:32 +00:00
Implements the 65C02 NOPs.
This commit is contained in:
parent
e46bde35f5
commit
e3f6da6994
@ -76,6 +76,8 @@ class KlausDormannTests: XCTestCase {
|
||||
case 0x0730: return "BBS: branch not taken"
|
||||
case 0x0733: return "BBR: branch taken"
|
||||
|
||||
case 0x2884: return "JMP (abs) exhibited 6502 page-crossing bug"
|
||||
|
||||
case 0: return "Didn't find tests"
|
||||
default: return "Unknown error at \(String(format:"%04x", address))"
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ template <typename T, bool uses_ready_line> class Processor: public ProcessorBas
|
||||
/*!
|
||||
Constructs an instance of the 6502 that will use @c bus_handler for all bus communications.
|
||||
*/
|
||||
Processor(Personality personality, T &bus_handler) : ProcessorBase(personality), bus_handler_(bus_handler) {}
|
||||
Processor(Personality personality, T &bus_handler) : ProcessorBase(personality), personality_(personality), bus_handler_(bus_handler) {}
|
||||
|
||||
/*!
|
||||
Runs the 6502 for a supplied number of cycles.
|
||||
@ -221,6 +221,7 @@ template <typename T, bool uses_ready_line> class Processor: public ProcessorBas
|
||||
void set_ready_line(bool active);
|
||||
|
||||
private:
|
||||
Personality personality_;
|
||||
T &bus_handler_;
|
||||
};
|
||||
|
||||
|
@ -93,7 +93,16 @@ if(number_of_cycles <= Cycles(0)) break;
|
||||
} break;
|
||||
|
||||
case CycleFetchOperand:
|
||||
read_mem(operand_, pc_.full);
|
||||
if(
|
||||
personality_ == P6502 ||
|
||||
(operation_&7) != 3 ||
|
||||
operation_ == 0xcb ||
|
||||
operation_ == 0xdb
|
||||
) {
|
||||
read_mem(operand_, pc_.full);
|
||||
} else {
|
||||
printf("Skipping %02x\n", operation_);
|
||||
}
|
||||
break;
|
||||
|
||||
case OperationDecodeOperation:
|
||||
|
@ -242,6 +242,24 @@ ProcessorStorage::ProcessorStorage(Personality personality) {
|
||||
for(int location = 0x0f; location <= 0xff; location += 0x10) {
|
||||
Install(location, Program(OperationLoadAddressZeroPage, CycleFetchOperandFromAddress, OperationBBRBBS));
|
||||
}
|
||||
|
||||
// Add NOPs.
|
||||
|
||||
// The 1-byte, 1-cycle (!) NOPs.
|
||||
for(int c = 0x03; c <= 0xf3; c += 0x10) {
|
||||
Install(c, ImpliedNop());
|
||||
}
|
||||
for(int c = 0x0b; c <= 0xbb; c += 0x10) {
|
||||
Install(c, ImpliedNop());
|
||||
}
|
||||
for(int c = 0xeb; c <= 0xfb; c += 0x10) {
|
||||
Install(c, ImpliedNop());
|
||||
}
|
||||
|
||||
// The 2-byte, 2-cycle NOPs that the 6502 doesn't have.
|
||||
for(int c = 0x02; c <= 0x62; c += 0x10) {
|
||||
Install(c, ImmediateNop());
|
||||
}
|
||||
}
|
||||
#undef Install
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user