From 654f2f4c492df84c0a7d0ebaa7bec92457c129df Mon Sep 17 00:00:00 2001 From: Melefo <42809472+Melefo@users.noreply.github.com> Date: Thu, 26 Mar 2020 22:03:02 +0100 Subject: [PATCH] Fixing APU's padding cycles --- sources/APU/APU.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sources/APU/APU.cpp b/sources/APU/APU.cpp index c2cacd9..cc56ec6 100644 --- a/sources/APU/APU.cpp +++ b/sources/APU/APU.cpp @@ -706,6 +706,10 @@ namespace ComSquare::APU { unsigned total = 0; + if (this->_paddingCycles > cycles) { + this->_paddingCycles -= cycles; + return; + } cycles -= this->_paddingCycles; while (total < cycles && this->_state == Running) total += this->_executeInstruction();