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.sramAccess = false;
|
||||||
gb->memory.rtcAccess = false;
|
gb->memory.rtcAccess = false;
|
||||||
gb->memory.activeRtcReg = 0;
|
gb->memory.activeRtcReg = 0;
|
||||||
gb->memory.rtcLatched = 0;
|
gb->memory.rtcLatched = false;
|
||||||
memset(&gb->memory.rtcRegs, 0, sizeof(gb->memory.rtcRegs));
|
memset(&gb->memory.rtcRegs, 0, sizeof(gb->memory.rtcRegs));
|
||||||
|
|
||||||
memset(&gb->memory.hram, 0, sizeof(gb->memory.hram));
|
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;
|
break;
|
||||||
case 0x3:
|
case 0x3:
|
||||||
if (memory->rtcLatched && value == 0) {
|
if (memory->rtcLatched && value == 0) {
|
||||||
memory->rtcLatched = value;
|
memory->rtcLatched = false;
|
||||||
} else if (!memory->rtcLatched && value == 1) {
|
} else if (!memory->rtcLatched && value == 1) {
|
||||||
_latchRtc(memory);
|
_latchRtc(memory);
|
||||||
|
memory->rtcLatched = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ struct GBMemory {
|
||||||
|
|
||||||
bool rtcAccess;
|
bool rtcAccess;
|
||||||
int activeRtcReg;
|
int activeRtcReg;
|
||||||
int rtcLatched;
|
bool rtcLatched;
|
||||||
uint8_t rtcRegs[5];
|
uint8_t rtcRegs[5];
|
||||||
struct mRTCSource* rtc;
|
struct mRTCSource* rtc;
|
||||||
struct mRotationSource* rotation;
|
struct mRotationSource* rotation;
|
||||||
|
|
Loading…
Reference in New Issue