Skip to content

Commit

Permalink
md: always sync core MD components regardless of reduced sync
Browse files Browse the repository at this point in the history
Fixes VDP H/V tests in testpico when running as a 32X rom.
  • Loading branch information
LukeUsher committed Feb 18, 2025
1 parent 25a2602 commit b225130
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions ares/md/cpu/cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ auto CPU::step(u32 clocks) -> void {
refresh.ram += clocks;
refresh.external += clocks;
Thread::step(clocks);
cyclesUntilSync -= clocks;
cyclesUntilFullSync -= clocks;
}

inline auto CPU::idle(u32 clocks) -> void {
Expand All @@ -74,8 +74,10 @@ inline auto CPU::idle(u32 clocks) -> void {

auto CPU::wait(u32 clocks) -> void {
step(clocks);
if (cyclesUntilSync <= 0) {
cyclesUntilSync = minCyclesBetweenSyncs;

Thread::synchronize(apu, cartridge, opn2, vdp);
if (cyclesUntilFullSync <= 0) {
cyclesUntilFullSync = minCyclesBetweenSyncs;
Thread::synchronize();
}
}
Expand Down
2 changes: 1 addition & 1 deletion ares/md/cpu/cpu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ struct CPU : M68000, Thread {
int stolenMcycles = 0;
} state;

int cyclesUntilSync = 0;
int cyclesUntilFullSync = 0;
int minCyclesBetweenSyncs = 0;
};

Expand Down

0 comments on commit b225130

Please sign in to comment.