mirror of https://github.com/mgba-emu/mgba.git
GB Memory: Fix RTC latching
This commit is contained in:
parent
2ee192d868
commit
b14aafe9cb
|
@ -132,7 +132,7 @@ void GBMemoryReset(struct GB* gb) {
|
|||
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 @@ void _GBMBC3(struct GBMemory* memory, uint16_t address, uint8_t value) {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ struct GBMemory {
|
|||
|
||||
bool rtcAccess;
|
||||
int activeRtcReg;
|
||||
int rtcLatched;
|
||||
bool rtcLatched;
|
||||
uint8_t rtcRegs[5];
|
||||
struct mRTCSource* rtc;
|
||||
struct mRotationSource* rotation;
|
||||
|
|
Loading…
Reference in New Issue