From a9d2a9ef5dd4bc3ca1374c50ab12db56e61183c7 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();