GB Memory: Fix RTC latching
Jeffrey Pfau jeffrey@endrift.com
Sat, 28 May 2016 12:27:30 -0700
2 files changed,
4 insertions(+),
3 deletions(-)
M
src/gb/memory.c
→
src/gb/memory.c
@@ -132,7 +132,7 @@
gb->memory.sramAccess = false; gb->memory.rtcAccess = false; gb->memory.activeRtcReg = 0; - gb->memory.rtcLatched = 0; + gb->memory.rtcLatched = false; memset(&gb->memory.rtcRegs, 0, sizeof(gb->memory.rtcRegs)); memset(&gb->memory.hram, 0, sizeof(gb->memory.hram));@@ -682,9 +682,10 @@ }
break; case 0x3: if (memory->rtcLatched && value == 0) { - memory->rtcLatched = value; + memory->rtcLatched = false; } else if (!memory->rtcLatched && value == 1) { _latchRtc(memory); + memory->rtcLatched = true; } break; }
M
src/gb/memory.h
→
src/gb/memory.h
@@ -149,7 +149,7 @@ size_t romSize;
bool rtcAccess; int activeRtcReg; - int rtcLatched; + bool rtcLatched; uint8_t rtcRegs[5]; struct mRTCSource* rtc; struct mRotationSource* rotation;