diff --git a/puce65c02.cpp b/puce65c02.cpp index 703fc0f..790b08f 100644 --- a/puce65c02.cpp +++ b/puce65c02.cpp @@ -113,8 +113,7 @@ void puce65c02::setPC(uint16_t address) { uint16_t puce65c02::exec(unsigned long long int cycleCount) { cycleCount += ticks; // cycleCount becomes the targeted ticks value8 - while (ticks < cycleCount) { - if (state == run || state == step) { + while (ticks < cycleCount && (state == run || state == step)) { uint8_t value8; uint16_t value16; @@ -2553,7 +2552,6 @@ uint16_t puce65c02::exec(unsigned long long int cycleCount) { break; } // end of switch - } // end of if } // end of while return PC; }