SH2 Cache

Featured image for article: SH2 Cache

SEGA Saturn has two CPUs. Each CPU has cache memory to enhance the throughput. YabaSanshiro does not emulate that until version 1.7.6, Because each CPU accesses the same memory space and it should be the same data, and emulating cache needs many CPU cycles for each memory access. But I noticed that some games are programmed on the assumption that the data referenced by each CPU is inconsistent and the difference in timing with and without hitting the cache. Virtua Fighter is one of them. You may notice that sometimes character warps to the outside of the ring. Each CPU refers to the same address but expects different data!

Implementing a cache function is inevitable. So I enable YAB_WANT_CACHE option. And debug and fix until Virtua Fighter runs without warps. As side effects, the stability of YabSanshiro increases on other games. This Youtube video is the showcase of this implementation.

Not Benefits only. The cache implementation needs much more CPU cycles. It is 20% slower than it without cache emulation. You need at least a 2GHz CPU to run YabaSanshiro with cache emulation for full-speed emulation. So SH2 Cache will be an option on version 1.8.x. If you have a fast enough CPU and want more accuracy try this option!

UPDATED

Beta test for SH2 Cache is started at 3/18/2022.

If you find a regression or compatibility issue, please report.