C64: prevent multiple write to filter reg

issue #1114
This commit is contained in:
tildearrow 2023-05-20 15:19:45 -05:00
parent 61a15835db
commit d644189201

View file

@ -105,6 +105,7 @@ void DivPlatformC64::updateFilter() {
} }
void DivPlatformC64::tick(bool sysTick) { void DivPlatformC64::tick(bool sysTick) {
bool willUpdateFilter=false;
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {
chan[i].std.next(); chan[i].std.next();
if (chan[i].std.vol.had) { if (chan[i].std.vol.had) {
@ -117,10 +118,10 @@ void DivPlatformC64::tick(bool sysTick) {
if (filtCut>2047) filtCut=2047; if (filtCut>2047) filtCut=2047;
if (filtCut<0) filtCut=0; if (filtCut<0) filtCut=0;
} }
updateFilter(); willUpdateFilter=true;
} else { } else {
vol=MIN(15,chan[i].std.vol.val); vol=MIN(15,chan[i].std.vol.val);
updateFilter(); willUpdateFilter=true;
} }
} }
if (NEW_ARP_STRAT) { if (NEW_ARP_STRAT) {
@ -156,11 +157,11 @@ void DivPlatformC64::tick(bool sysTick) {
} }
if (chan[i].std.ex1.had) { if (chan[i].std.ex1.had) {
filtControl=chan[i].std.ex1.val&15; filtControl=chan[i].std.ex1.val&15;
updateFilter(); willUpdateFilter=true;
} }
if (chan[i].std.ex2.had) { if (chan[i].std.ex2.had) {
filtRes=chan[i].std.ex2.val&15; filtRes=chan[i].std.ex2.val&15;
updateFilter(); willUpdateFilter=true;
} }
if (chan[i].std.ex3.had) { if (chan[i].std.ex3.had) {
chan[i].sync=chan[i].std.ex3.val&1; chan[i].sync=chan[i].std.ex3.val&1;
@ -207,6 +208,7 @@ void DivPlatformC64::tick(bool sysTick) {
chan[i].freqChanged=false; chan[i].freqChanged=false;
} }
} }
if (willUpdateFilter) updateFilter();
} }
int DivPlatformC64::dispatch(DivCommand c) { int DivPlatformC64::dispatch(DivCommand c) {