mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +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:
parent
c3ea6dc1f5
commit
41d5dd8679
@ -93,7 +93,7 @@ class FUSETests: XCTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
// machine.runForNumber(ofCycles: Int32(tStates))
|
||||
machine.runForNumber(ofCycles: Int32(tStates))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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_;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user