From 9c78f70071daa8d4d65ffe335c21af0e4b523841 Mon Sep 17 00:00:00 2001 From: Oxore Date: Sun, 25 Sep 2022 16:37:03 +0300 Subject: Impl read and write watchpoints --- bus.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'bus.cpp') diff --git a/bus.cpp b/bus.cpp index 444749c..9697c09 100644 --- a/bus.cpp +++ b/bus.cpp @@ -142,9 +142,13 @@ static inline bool memory_write( #define MASK_24(X) ((X) & (0xFF << 24)) +extern void m68k_read_callback(const uint32_t address, const uint32_t size); +extern void m68k_write_callback(const uint32_t address, const uint32_t size); + unsigned int m68k_read_memory_8(unsigned int address) { assert(MASK_24(address) == 0); // Just curious + m68k_read_callback(address, 4); const struct read_result ret = memory_read(BITNESS_8, address); if (!ret.successful) exit_error("Read error u8 @%08x", address); @@ -153,6 +157,7 @@ unsigned int m68k_read_memory_8(unsigned int address) unsigned int m68k_read_memory_16(unsigned int address) { + m68k_read_callback(address, 2); assert(MASK_24(address) == 0); // Just curious const struct read_result ret = memory_read(BITNESS_16, address); if (!ret.successful) @@ -162,6 +167,7 @@ unsigned int m68k_read_memory_16(unsigned int address) unsigned int m68k_read_memory_32(unsigned int address) { + m68k_read_callback(address, 1); assert(MASK_24(address) == 0); // Just curious const struct read_result ret = memory_read(BITNESS_32, address); if (!ret.successful) @@ -190,6 +196,7 @@ unsigned int m68k_read_disassembler_32(unsigned int address) void m68k_write_memory_8(unsigned int address, unsigned int value) { assert(MASK_24(address) == 0); // Just curious + m68k_write_callback(address, 1); const bool successful = memory_write(BITNESS_8, address, value); if (!successful) exit_error("Attempted to write %02x (u8) to address %08x", value&0xff, address); @@ -198,6 +205,7 @@ void m68k_write_memory_8(unsigned int address, unsigned int value) void m68k_write_memory_16(unsigned int address, unsigned int value) { assert(MASK_24(address) == 0); // Just curious + m68k_write_callback(address, 2); const bool successful = memory_write(BITNESS_16, address, value); if (!successful) exit_error("Attempted to write %04x (u16) to address %08x", value&0xffff, address); @@ -206,6 +214,7 @@ void m68k_write_memory_16(unsigned int address, unsigned int value) void m68k_write_memory_32(unsigned int address, unsigned int value) { assert(MASK_24(address) == 0); // Just curious + m68k_write_callback(address, 4); const bool successful = memory_write(BITNESS_16, address, value); if (!successful) exit_error("Attempted to write %08x (u32) to address %08x", value, address); -- cgit v1.2.3