diff --git a/Components/6526/Implementation/6526Storage.hpp b/Components/6526/Implementation/6526Storage.hpp index 66c5a2236..77a5d0e62 100644 --- a/Components/6526/Implementation/6526Storage.hpp +++ b/Components/6526/Implementation/6526Storage.hpp @@ -39,6 +39,11 @@ struct MOS6526Storage { pending |= ReloadInOne; } } + + // If this write has hit during a reload cycle, reload. + if(pending & ReloadNow) { + value = reload; + } } template void set_control(uint8_t v) { @@ -46,9 +51,9 @@ struct MOS6526Storage { } template bool advance(bool chained_input) { - // TODO: remove most of the conditionals here. + // TODO: remove most of the conditionals here in favour of bit shuffling. - pending <<= 1; + pending = (pending & PendingClearMask) << 1; // // Apply feeder states inputs: anything that @@ -117,11 +122,6 @@ struct MOS6526Storage { } - // - // Clear any bits that would flow into the wrong field. - // - pending &= PendingClearMask; - return should_reload; }