This PR removes the cycles member from the mos6502 class and replaces it's use in mos6502::Run with a simple decrement of the parameter n.
This is for the simple reason that cycles overflows pretty quickly (a few mins) causing the emulation to halt (example below).
uint32_t start = cycles; // cycles near 2^32 (say 2^32 -n +1)
while(start + n /* overflow! start + n is now less than cycles*/ > cycles && !illegalOpcode)
/* no code executed*/
The fix is:
while(n-- > 0 && !illegalOpcode)
Which does the same as before with no risk of overflow.
P.s. There's also a bunch of white-space corrections thrown in for free by my editor.
This PR removes the
cycles
member from themos6502
class and replaces it's use inmos6502::Run
with a simple decrement of the parametern
.This is for the simple reason that
cycles
overflows pretty quickly (a few mins) causing the emulation to halt (example below).The fix is:
Which does the same as before with no risk of overflow.
P.s. There's also a bunch of white-space corrections thrown in for free by my editor.