From 7f501ff29cd7d6d4de2e30a4f4e0eb859e0b5fea Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Wed, 7 Feb 2018 23:00:38 +0000 Subject: [PATCH] Temporarily perhaps, reintroduce post-read and pre-write bus events (for the NES) Signed-off-by: Adrian Conlon --- inc/Bus.h | 3 +++ src/Bus.cpp | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/inc/Bus.h b/inc/Bus.h index 3d016d6..9424119 100644 --- a/inc/Bus.h +++ b/inc/Bus.h @@ -10,8 +10,11 @@ namespace EightBit { public: virtual ~Bus() = default; + Signal WritingByte; Signal WrittenByte; + Signal ReadingByte; + Signal ReadByte; register16_t& ADDRESS(); uint8_t& DATA(); diff --git a/src/Bus.cpp b/src/Bus.cpp index 44bb0f0..3bc3b62 100644 --- a/src/Bus.cpp +++ b/src/Bus.cpp @@ -41,7 +41,9 @@ uint16_t EightBit::Bus::peekWord(uint16_t address) { uint8_t EightBit::Bus::read() { ReadingByte.fire(ADDRESS().word); - return reference(); + const auto returned = reference(); + ReadByte.fire(ADDRESS().word); + return returned; } uint8_t EightBit::Bus::read(uint16_t offset) { @@ -55,6 +57,7 @@ uint8_t EightBit::Bus::read(register16_t address) { } void EightBit::Bus::write(uint8_t value) { + WritingByte.fire(ADDRESS().word); reference() = value; WrittenByte.fire(ADDRESS().word); }