Closed deltabeard closed 11 months ago
RTC latching is emulated on the https://github.com/deltabeard/Peanut-GB/tree/fix-rtc2 branch, but the rtc3test at https://github.com/aaaaaa123456789/rtc3test still does not pass.
RTC emulation greatly improved in 97548efe9688176cac3f29aa1a3acdce945bf878 but still not perfect.
Since the RTC is updated every second, and currently only during VSYNC, RTC latching for each read/write may not be required as the RTC is guaranteed to not be updated during VSYNC. The only instance that there could be an issue is when the game has latched the RTC on the last CPU instruction before VSYNC occurs, causing the RTC to be updated whilst the game is reading/writing to it.
Hence, whenever the front end is updating the RTC, Peanut-GB should check whether the RTC has been latched first and only update the RTC if it is not latched.