mirror of
https://github.com/TomHarte/CLK.git
synced 2026-04-24 05:18:36 +00:00
Added the concept of a trap handler to the all-RAM processor and exposed it via the test Z80 classes.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#define AllRAMProcessor_hpp
|
||||
|
||||
#include <cstdint>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
namespace CPU {
|
||||
@@ -20,9 +21,22 @@ class AllRAMProcessor {
|
||||
uint32_t get_timestamp();
|
||||
void set_data_at_address(uint16_t startAddress, size_t length, const uint8_t *data);
|
||||
|
||||
class TrapHandler {
|
||||
public:
|
||||
virtual void processor_did_trap(AllRAMProcessor &, uint16_t address) = 0;
|
||||
};
|
||||
void set_trap_handler(TrapHandler *trap_handler);
|
||||
void add_trap_address(uint16_t address);
|
||||
|
||||
protected:
|
||||
std::vector<uint8_t> memory_;
|
||||
uint32_t timestamp_;
|
||||
|
||||
void check_address_for_trap(uint16_t address);
|
||||
|
||||
private:
|
||||
std::set<uint16_t> trap_addresses_;
|
||||
TrapHandler *trap_handler_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user