1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 16:31:31 +00:00

Added a memory access delegate to the Z80 all-ram processor, to allow access patterns to be captured.

This commit is contained in:
Thomas Harte 2017-05-22 19:24:11 -04:00
parent c3ea6dc1f5
commit 41d5dd8679
3 changed files with 18 additions and 2 deletions

View File

@ -93,7 +93,7 @@ class FUSETests: XCTestCase {
}
}
// machine.runForNumber(ofCycles: Int32(tStates))
machine.runForNumber(ofCycles: Int32(tStates))
}
}
}

View File

@ -11,7 +11,7 @@
using namespace CPU::Z80;
AllRAMProcessor::AllRAMProcessor() : ::CPU::AllRAMProcessor(65536) {}
AllRAMProcessor::AllRAMProcessor() : ::CPU::AllRAMProcessor(65536), delegate_(nullptr) {}
int AllRAMProcessor::perform_machine_cycle(const MachineCycle *cycle) {
switch(cycle->operation) {
@ -34,5 +34,11 @@ int AllRAMProcessor::perform_machine_cycle(const MachineCycle *cycle) {
printf("???\n");
break;
}
timestamp_ += cycle->length;
if(delegate_ != nullptr) {
delegate_->z80_all_ram_processor_did_perform_bus_operation(*this, cycle->operation, *cycle->address, *cycle->value, timestamp_);
}
return 0;
}

View File

@ -23,6 +23,16 @@ class AllRAMProcessor:
AllRAMProcessor();
int perform_machine_cycle(const MachineCycle *cycle);
struct MemoryAccessDelegate {
virtual void z80_all_ram_processor_did_perform_bus_operation(AllRAMProcessor &processor, BusOperation operation, uint16_t address, uint8_t value, int time_stamp);
};
void set_memory_access_delegate(MemoryAccessDelegate *delegate) {
delegate_ = delegate;
}
private:
MemoryAccessDelegate *delegate_;
};
}