Skip to content

Commit

Permalink
slightly enhanced PlusROM display in debugger (keeps last send/receiv…
Browse files Browse the repository at this point in the history
…e now)
  • Loading branch information
thrust26 committed Dec 13, 2024
1 parent 4ba7bfd commit 617147a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/emucore/PlusROM.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ bool PlusROM::load(Serializer& in)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PlusROM::reset()
{
myRxReadPos = myRxWritePos = myTxPos = 0;
myRxReadPos = myRxWritePos = myTxPos = myLastRxReadPos = myLastTxPos = 0;
myPendingRequests.clear();
}

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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];

Expand All @@ -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;
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/emucore/PlusROM.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class PlusROM : public Serializable

std::array<uInt8, 256> myRxBuffer{}, myTxBuffer{};
uInt8 myRxReadPos{0}, myRxWritePos{0}, myTxPos{0};
uInt8 myLastRxReadPos{0}, myLastTxPos{0};

std::deque<shared_ptr<PlusROMRequest>> myPendingRequests;

Expand Down

0 comments on commit 617147a

Please sign in to comment.