diff --git a/Changes.txt b/Changes.txt index ef49c8e11..bb0909587 100644 --- a/Changes.txt +++ b/Changes.txt @@ -29,6 +29,9 @@ * Tweaked bankswitch autodetection for the 0840, F8 and FE schemes; several homebrews that didn't run before now work correctly. + * Fixed regression in M6532 INTIM reads; at least one known ROM + (Mr. Roboto Berzerk hack) wasn't working properly. + -Have fun! diff --git a/src/emucore/M6532.cxx b/src/emucore/M6532.cxx index a95cd9dcf..e38fd61b5 100644 --- a/src/emucore/M6532.cxx +++ b/src/emucore/M6532.cxx @@ -180,7 +180,12 @@ uInt8 M6532::peek(uInt16 addr) // Get number of clocks since timer was set Int32 timer = timerClocks(); - if(timer >= 0) + + // Note that this constant comes from z26, and corresponds to + // 256 intervals of T1024T (ie, the maximum that the timer should hold) + // I'm not sure why this is required, but quite a few ROMs fail + // if we just check >= 0. + if(!(timer & 0x40000)) { // Return at 'divide by TIMxT' interval rate return (timer >> myIntervalShift) & 0xff;