From 617147a175d5783f9820098023c63625ecbf88fc Mon Sep 17 00:00:00 2001 From: thrust26 Date: Fri, 13 Dec 2024 09:33:15 +0100 Subject: [PATCH] slightly enhanced PlusROM display in debugger (keeps last send/receive now) --- src/emucore/PlusROM.cxx | 10 +++++++--- src/emucore/PlusROM.hxx | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/emucore/PlusROM.cxx b/src/emucore/PlusROM.cxx index 2feb08b5f..db3e70fdc 100644 --- a/src/emucore/PlusROM.cxx +++ b/src/emucore/PlusROM.cxx @@ -364,7 +364,7 @@ bool PlusROM::load(Serializer& in) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PlusROM::reset() { - myRxReadPos = myRxWritePos = myTxPos = 0; + myRxReadPos = myRxWritePos = myTxPos = myLastRxReadPos = myLastTxPos = 0; myPendingRequests.clear(); } @@ -424,6 +424,7 @@ void PlusROM::send() myTxPos ); + myLastTxPos = myTxPos - 1; myTxPos = 0; // We push to the back in order to avoid reverse_iterator in receive() @@ -478,6 +479,7 @@ void PlusROM::receive() // and start over const auto [responseSize, response] = (*iter)->getResponse(); + myLastRxReadPos = myRxReadPos; for(size_t i = 0; i < responseSize; ++i) myRxBuffer[myRxWritePos++] = response[i]; @@ -497,8 +499,9 @@ void PlusROM::receive() ByteArray PlusROM::getSend() const { ByteArray arr; + uInt8 txPos = myTxPos != 0 ? myTxPos : myLastTxPos; - for(int i = 0; i < myTxPos; ++i) + for(int i = 0; i < txPos; ++i) arr.push_back(myTxBuffer[i]); return arr; @@ -508,8 +511,9 @@ ByteArray PlusROM::getSend() const ByteArray PlusROM::getReceive() const { ByteArray arr; + uInt8 txReadPos = myRxReadPos != myRxWritePos ? myRxReadPos : myLastRxReadPos; - for(uInt8 i = myRxReadPos; i != myRxWritePos; ++i) + for(uInt8 i = txReadPos; i != myRxWritePos; ++i) arr.push_back(myRxBuffer[i]); return arr; diff --git a/src/emucore/PlusROM.hxx b/src/emucore/PlusROM.hxx index 2d574cfac..ef307e892 100644 --- a/src/emucore/PlusROM.hxx +++ b/src/emucore/PlusROM.hxx @@ -191,6 +191,7 @@ class PlusROM : public Serializable std::array myRxBuffer{}, myTxBuffer{}; uInt8 myRxReadPos{0}, myRxWritePos{0}, myTxPos{0}; + uInt8 myLastRxReadPos{0}, myLastTxPos{0}; std::deque> myPendingRequests;