all repos — mgba @ b14aafe9cb5499bbeb54478c74b56e781e5936ca

mGBA Game Boy Advance Emulator

GB Memory: Fix RTC latching
Jeffrey Pfau jeffrey@endrift.com
Sat, 28 May 2016 12:27:30 -0700
commit

b14aafe9cb5499bbeb54478c74b56e781e5936ca

parent

2ee192d868a452ff0e562925dd76cd8c805a0d67

2 files changed, 4 insertions(+), 3 deletions(-)

jump to
M src/gb/memory.csrc/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.hsrc/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;